Table of Contents

Class DynamicVariableExtensions

Namespace
MonkeyLoader.Resonite
Assembly
MonkeyLoader.Resonite.Integration.dll

Contains extension methods related to FrooxEngine.DynamicVariableSpaces and their variables.

public static class DynamicVariableExtensions
Inheritance
DynamicVariableExtensions
Inherited Members

Methods

CreateSpace(Slot, string?, bool)

Attaches a FrooxEngine.DynamicVariableSpace component to this slot with the given spaceName and optionally enables OnlyDirectBinding.

public static DynamicVariableSpace CreateSpace(this Slot slot, string? spaceName, bool onlyDirectBinding = false)

Parameters

slot Slot

The slot to create the component on.

spaceName string

The name for the created space.

onlyDirectBinding bool

Whether only variables with a matching space name should bind to the created space.

Returns

DynamicVariableSpace

The created FrooxEngine.DynamicVariableSpace component.

FindOrCreateSpace(Slot, string?, bool)

Searches for a FrooxEngine.DynamicVariableSpace with the given spaceName that covers this slot, or attaches one to it with the given parameters.

public static DynamicVariableSpace FindOrCreateSpace(this Slot slot, string? spaceName, bool onlyDirectBinding = false)

Parameters

slot Slot

The slot to create the component on.

spaceName string

The name for the created space.

onlyDirectBinding bool

Whether only variables with a matching space name should bind to the created space.

Returns

DynamicVariableSpace

The found or attached FrooxEngine.DynamicVariableSpace.

Remarks

The found FrooxEngine.DynamicVariableSpace's OnlyDirectBinding option may differ from the supplied value.

GetAvailableSpaces(Slot, Predicate<DynamicVariableSpace>?)

Gets all FrooxEngine.DynamicVariableSpaces that apply to this FrooxEngine.Slot.
Optionally includes only those that pass through the filter.

public static IEnumerable<DynamicVariableSpace> GetAvailableSpaces(this Slot slot, Predicate<DynamicVariableSpace>? filter = null)

Parameters

slot Slot

The FrooxEngine.Slot to find all applicable FrooxEngine.DynamicVariableSpaces for.

filter Predicate<DynamicVariableSpace>

The optional predicate to apply to the returned

Returns

IEnumerable<DynamicVariableSpace>

All FrooxEngine.DynamicVariableSpace that apply to this FrooxEngine.Slot and optionally pass the filter.

Remarks

This function is different from a regular FrooxEngine.Slot.GetComponentsInParents<FrooxEngine.DynamicVariableSpace>() call,
as it considers that FrooxEngine.DynamicVariableSpaces deeper in the hierarchy hide ones higher up with the same name.
If a FrooxEngine.DynamicVariableSpace deeper in the hierarchy doesn't pass the filter,
it will still hide any higher up ones with the same name that might pass it, because they don't apply to this FrooxEngine.Slot.

GetAvailableVariableIdentities(Slot)

Gets all full Dynamic Variable identities that apply to this FrooxEngine.Slot

public static IEnumerable<DynamicVariableIdentity> GetAvailableVariableIdentities(this Slot slot)

Parameters

slot Slot

The FrooxEngine.Slot to find all applicable full Dynamic Variable identities for.

Returns

IEnumerable<DynamicVariableIdentity>

All full Dynamic Variable identities that apply to this FrooxEngine.Slot.

Remarks

This function uses FrooxEngine.DynamicVariableSpace.GetAvailableSpaces(),
which is different from a regular FrooxEngine.Slot.GetComponentsInParents<FrooxEngine.DynamicVariableSpace>() call,
as it considers that FrooxEngine.DynamicVariableSpaces deeper in the hierarchy hide ones higher up with the same name.

GetAvailableVariableIdentities(Slot, string)

Gets all full Dynamic Variable identities that apply to this FrooxEngine.Slot, which match the given name.

public static IEnumerable<DynamicVariableIdentity> GetAvailableVariableIdentities(this Slot slot, string name)

Parameters

slot Slot

The FrooxEngine.Slot to find all applicable full Dynamic Variable identities for.

name string

The name that the variable identities must have.

Returns

IEnumerable<DynamicVariableIdentity>

All full Dynamic Variable identities that apply to this FrooxEngine.Slot that have the given name.

Remarks

This function uses FrooxEngine.DynamicVariableSpace.GetAvailableSpaces(),
which is different from a regular FrooxEngine.Slot.GetComponentsInParents<FrooxEngine.DynamicVariableSpace>() call,
as it considers that FrooxEngine.DynamicVariableSpaces deeper in the hierarchy hide ones higher up with the same name.

GetAvailableVariableIdentities(Slot, Type)

Gets all full Dynamic Variable identities that apply to this FrooxEngine.Slot, which can be assigned a value of the given Type.

public static IEnumerable<DynamicVariableIdentity> GetAvailableVariableIdentities(this Slot slot, Type type)

Parameters

slot Slot

The FrooxEngine.Slot to find all applicable full Dynamic Variable identities for.

type Type

The type that must be assignable to the variables.

Returns

IEnumerable<DynamicVariableIdentity>

All full Dynamic Variable identities that apply to this FrooxEngine.Slot that the given Type can be assigned to.

Remarks

This function uses FrooxEngine.DynamicVariableSpace.GetAvailableSpaces(),
which is different from a regular FrooxEngine.Slot.GetComponentsInParents<FrooxEngine.DynamicVariableSpace>() call,
as it considers that FrooxEngine.DynamicVariableSpaces deeper in the hierarchy hide ones higher up with the same name.

GetAvailableVariableIdentities<T>(Slot)

Gets all full Dynamic Variable identities that apply to this FrooxEngine.Slot, which can be assigned a value of type T.

public static IEnumerable<DynamicVariableIdentity> GetAvailableVariableIdentities<T>(this Slot slot)

Parameters

slot Slot

The FrooxEngine.Slot to find all applicable full Dynamic Variable identities for.

Returns

IEnumerable<DynamicVariableIdentity>

All full Dynamic Variable identities that apply to this FrooxEngine.Slot that T can be assigned to.

Type Parameters

T

The type that must be assignable to the variables.

Remarks

This function uses FrooxEngine.DynamicVariableSpace.GetAvailableSpaces(),
which is different from a regular FrooxEngine.Slot.GetComponentsInParents<FrooxEngine.DynamicVariableSpace>() call,
as it considers that FrooxEngine.DynamicVariableSpaces deeper in the hierarchy hide ones higher up with the same name.

GetHandler<T>(IDynamicVariable<T>)

Gets the FrooxEngine.DynamicVariableHandler<T> of this dynamic variable.

public static DynamicVariableHandler<T> GetHandler<T>(this IDynamicVariable<T> dynamicVariable)

Parameters

dynamicVariable IDynamicVariable<T>

The dynamic variable of which to get the FrooxEngine.DynamicVariableHandler<T>.

Returns

DynamicVariableHandler<T>

The FrooxEngine.DynamicVariableHandler<T> of this dynamic variable.

Type Parameters

T

Exceptions

NullReferenceException

When the FrooxEngine.DynamicVariableHandler<T> of this dynamic variable could not be found.

GetLinkedSpace(IDynamicVariable)

Gets the FrooxEngine.DynamicVariableSpace that this dynamic variable is linked to.

public static DynamicVariableSpace GetLinkedSpace(this IDynamicVariable dynamicVariable)

Parameters

dynamicVariable IDynamicVariable

The dynamic variable of which to get the linked FrooxEngine.DynamicVariableSpace.

Returns

DynamicVariableSpace

The FrooxEngine.DynamicVariableSpace that this dynamic variable is linked to.

Exceptions

NullReferenceException

When this dynamic variable is not linked to a FrooxEngine.DynamicVariableSpace or it could not be found.

GetLinkedVariables(DynamicVariableSpace, Predicate<IDynamicVariable>?, bool, bool, Predicate<Slot>?)

Gets all dynamic variable components linked to this FrooxEngine.DynamicVariableSpace that fulfill the given conditions.

public static IEnumerable<IDynamicVariable> GetLinkedVariables(this DynamicVariableSpace space, Predicate<IDynamicVariable>? filter = null, bool includeLocal = false, bool excludeDisabled = false, Predicate<Slot>? slotFilter = null)

Parameters

space DynamicVariableSpace

The dynamic variable space to get the linked variables of.

filter Predicate<IDynamicVariable>

A predicate to filter the linked variables returned; or null for all.

includeLocal bool

Whether to include local FrooxEngine.Slots in the search.

excludeDisabled bool

Whether to exclude disabled components from the results.

slotFilter Predicate<Slot>

A predicate to filter the FrooxEngine.Slots included in the search; or null for all.
The children of excluded FrooxEngine.Slots are excluded as well.

Returns

IEnumerable<IDynamicVariable>

The dynamic variable components linked to this FrooxEngine.DynamicVariableSpace that fulfill the given conditions.

GetLinkedVariables<T>(DynamicVariableSpace, Predicate<IDynamicVariable<T>>?, bool, bool, Predicate<Slot>?)

Gets all dynamic variable components linked to this FrooxEngine.DynamicVariableSpace that fulfill the given conditions.

public static IEnumerable<IDynamicVariable<T>> GetLinkedVariables<T>(this DynamicVariableSpace space, Predicate<IDynamicVariable<T>>? filter = null, bool includeLocal = false, bool excludeDisabled = false, Predicate<Slot>? slotFilter = null)

Parameters

space DynamicVariableSpace

The dynamic variable space to get the linked variables of.

filter Predicate<IDynamicVariable<T>>

A predicate to filter the linked variables returned; or null for all.

includeLocal bool

Whether to include local FrooxEngine.Slots in the search.

excludeDisabled bool

Whether to exclude disabled components from the results.

slotFilter Predicate<Slot>

A predicate to filter the FrooxEngine.Slots included in the search; or null for all.
The children of excluded FrooxEngine.Slots are excluded as well.

Returns

IEnumerable<IDynamicVariable<T>>

The dynamic variable components linked to this FrooxEngine.DynamicVariableSpace that fulfill the given conditions.

Type Parameters

T

The type of the values of the dynamic variables.

GetSyncWithVariable(SyncType, string, bool, bool)

Searches for a FrooxEngine.DynamicTypeField targetting this Type field and exposing it with the given variable name on the nearest Slot, or attaches one with the given parameters to it.

public static DynamicTypeField GetSyncWithVariable(this SyncType typeField, string variable, bool setupReset = false, bool forceCurrentValue = false)

Parameters

typeField SyncType

The Type field targetted by the FrooxEngine.DynamicTypeField.

variable string

The VariableName of the FrooxEngine.DynamicTypeField.

setupReset bool

Whether to also attach a FrooxEngine.DynamicValueVariableReset<T> with the current Type for load, paste, and duplicate.

forceCurrentValue bool

Whether to force the FrooxEngine.DynamicVariableSpace's Type for the variable to the references's current Type when attaching a FrooxEngine.DynamicTypeField.

Returns

DynamicTypeField

The found or attached FrooxEngine.DynamicTypeField.

GetSyncWithVariable<T>(IField<T>, string, bool, bool)

Searches for a FrooxEngine.DynamicField<T> targetting this field and exposing it with the given variable name on the nearest Slot, or attaches one with the given parameters to it.

public static DynamicField<T> GetSyncWithVariable<T>(this IField<T> field, string variable, bool setupReset = false, bool forceCurrentValue = false)

Parameters

field IField<T>

The field targetted by the FrooxEngine.DynamicField<T>.

variable string

The VariableName of the FrooxEngine.DynamicField<T>.

setupReset bool

Whether to also attach a FrooxEngine.DynamicValueVariableReset<T> with the current value for load, paste, and duplicate.

forceCurrentValue bool

Whether to force the FrooxEngine.DynamicVariableSpace's value for the variable to the field's current value when attaching a FrooxEngine.DynamicField<T>.

Returns

DynamicField<T>

The found or attached FrooxEngine.DynamicField<T>.

Type Parameters

T

The type of the field's value.

GetSyncWithVariable<T>(SyncRef<T>, string, bool, bool)

Searches for a FrooxEngine.DynamicReference<T> targetting this reference and exposing it with the given variable name on the nearest Slot, or attaches one with the given parameters to it.

public static DynamicReference<T> GetSyncWithVariable<T>(this SyncRef<T> reference, string variable, bool setupReset = false, bool forceCurrentValue = false) where T : class, IWorldElement

Parameters

reference SyncRef<T>

The reference targetted by the FrooxEngine.DynamicReference<T>.

variable string

The VariableName of the FrooxEngine.DynamicReference<T>.

setupReset bool

Whether to also attach a FrooxEngine.DynamicValueVariableReset<T> with the current target for load, paste, and duplicate.

forceCurrentValue bool

Whether to force the FrooxEngine.DynamicVariableSpace's target for the variable to the references's current target when attaching a FrooxEngine.DynamicReference<T>.

Returns

DynamicReference<T>

The found or attached FrooxEngine.DynamicReference<T>.

Type Parameters

T

The type of the reference's target.

GetVariableIdentities(DynamicVariableSpace)

Gets all full Dynamic Variable identities that are associated with this FrooxEngine.DynamicVariableSpace.

public static IEnumerable<DynamicVariableIdentity> GetVariableIdentities(this DynamicVariableSpace space)

Parameters

space DynamicVariableSpace

The FrooxEngine.DynamicVariableSpace to get all the variable identities of.

Returns

IEnumerable<DynamicVariableIdentity>

All full Dynamic Variable identities associated with this space.

GetVariableIdentities(DynamicVariableSpace, string)

Gets all full Dynamic Variable identities that are associated with this FrooxEngine.DynamicVariableSpace, which match the given name.

public static IEnumerable<DynamicVariableIdentity> GetVariableIdentities(this DynamicVariableSpace space, string name)

Parameters

space DynamicVariableSpace

The FrooxEngine.DynamicVariableSpace to get all the variable identities of.

name string

The name that the variable identities must have.

Returns

IEnumerable<DynamicVariableIdentity>

All full Dynamic Variable identities associated with this space that have the given name.

GetVariableIdentities(DynamicVariableSpace, Type)

Gets all full Dynamic Variable identities that are associated with this FrooxEngine.DynamicVariableSpace, which can be assigned a value of the given Type.

public static IEnumerable<DynamicVariableIdentity> GetVariableIdentities(this DynamicVariableSpace space, Type type)

Parameters

space DynamicVariableSpace

The FrooxEngine.DynamicVariableSpace to get all the variable identities of.

type Type

The type that must be assignable to the variables.

Returns

IEnumerable<DynamicVariableIdentity>

All full Dynamic Variable identities associated with this space that the given Type can be assigned to.

GetVariableIdentities<T>(DynamicVariableSpace)

Gets all full Dynamic Variable identities that are associated with this FrooxEngine.DynamicVariableSpace, which can be assigned a value of type T.

public static IEnumerable<DynamicVariableIdentity> GetVariableIdentities<T>(this DynamicVariableSpace space)

Parameters

space DynamicVariableSpace

The FrooxEngine.DynamicVariableSpace to get all the variable identities of.

Returns

IEnumerable<DynamicVariableIdentity>

All full Dynamic Variable identities associated with this space that T can be assigned to.

Type Parameters

T

The type that must be assignable to the variables.

IsLinkedToSpace(IDynamicVariable)

Determines whether this dynamic variable is linked against a FrooxEngine.DynamicVariableSpace.

public static bool IsLinkedToSpace(this IDynamicVariable dynamicVariable)

Parameters

dynamicVariable IDynamicVariable

The dynamic variable for which to check for a linked FrooxEngine.DynamicVariableSpace.

Returns

bool

true if this dynamic variable is linked to a FrooxEngine.DynamicVariableSpace; otherwise, false.

IsLinkedToSpace(IDynamicVariable, DynamicVariableSpace)

Determines whether this dynamic variable is linked against the given FrooxEngine.DynamicVariableSpace.

public static bool IsLinkedToSpace(this IDynamicVariable dynamicVariable, DynamicVariableSpace space)

Parameters

dynamicVariable IDynamicVariable

The dynamic variable for which to check the linked FrooxEngine.DynamicVariableSpace.

space DynamicVariableSpace

The dynamic variable space to compare to the linked one.

Returns

bool

true if this dynamic variable is linked to the given FrooxEngine.DynamicVariableSpace; otherwise, false.

IsValidName(string?)

Tests whether this string is a valid dynamic variable name.

public static bool IsValidName(this string? variableName)

Parameters

variableName string

The string to test.

Returns

bool

true if this string is a valid name; otherwise, false.

ParseAsPath(string?, out string?, out string?)

Parses this string into processed dynamic variable space and path names, if possible.

public static void ParseAsPath(this string? path, out string? spaceName, out string? variableName)

Parameters

path string

The string to parse.

spaceName string

The parsed space name, or null if not applicable.

variableName string

The parsed variable name, or null if not applicable.

ProcessName(string?)

Processes this string to a trimmed and valid dynamic variable (space) name.

public static string? ProcessName(this string? variableName)

Parameters

variableName string

The string to process.

Returns

string

The trimmed name if valid; otherwise, null.

TryGetHandler<T>(IDynamicVariable<T>, out DynamicVariableHandler<T>?)

Tries to get the FrooxEngine.DynamicVariableHandler<T> of this dynamic variable.

public static bool TryGetHandler<T>(this IDynamicVariable<T> dynamicVariable, out DynamicVariableHandler<T>? handler)

Parameters

dynamicVariable IDynamicVariable<T>

The dynamic variable of which to get the FrooxEngine.DynamicVariableHandler<T>.

handler DynamicVariableHandler<T>

The FrooxEngine.DynamicVariableHandler<T> of this dynamic variable; otherwise, null.

Returns

bool

true if the FrooxEngine.DynamicVariableHandler<T> of this dynamic variable was found; otherwise, false.

Type Parameters

T

TryGetLinkedSpace(IDynamicVariable, out DynamicVariableSpace?)

Tries to get the FrooxEngine.DynamicVariableSpace that this dynamic variable is linked to.

public static bool TryGetLinkedSpace(this IDynamicVariable dynamicVariable, out DynamicVariableSpace? linkedSpace)

Parameters

dynamicVariable IDynamicVariable

The dynamic variable of which to get the linked FrooxEngine.DynamicVariableSpace.

linkedSpace DynamicVariableSpace

The FrooxEngine.DynamicVariableSpace that this dynamic variable is linked to was found; otherwise, null.

Returns

bool

true if this dynamic variable is linked to a FrooxEngine.DynamicVariableSpace; otherwise, false.