Component:BooleanUserOverrideGather: Difference between revisions

From Resonite Wiki
Automated: create new component page
 
Document BooleanUserOverrideGather
 
Line 1: Line 1:
The '''BooleanUserOverrideGather''' Component allows storing [[Type:Bool|Boolean]] "override" values for each user listed under <code>_overrides</code> and [[Drive|driving]] the <code>Target</code> field. The behavior is similar to [[Component:ValueUserOverride|ValueUserOverride]]&lt;[[Type:Bool|Bool]]&gt;, except this component also reports aggregate information about the overrides.
{{Infobox Component
{{Infobox Component
|Image=BooleanUserOverrideGatherComponent.png
|Image=BooleanUserOverrideGatherComponent.png
|Name=Boolean User Override Gather
|Name=Boolean User Override Gather
}}
}}
{{stub}}


== Usage ==
== Usage ==
{{Table ComponentFields
{{Table ComponentFields
|Default|Bool|
|Default|Bool|The default value given to <code>Target</code> if no suitable override exists in <code>_overrides</code>.
|CreateOverrideOnWrite|Bool|
|CreateOverrideOnWrite|Bool|Whether an entry in <code>_overrides</code> should be created when <code>Target</code> is written back.
|PersistentOverrides|Bool|
|PersistentOverrides|Bool|Whether values in <code>_overrides</code> should persist when the component is saved.
|_overrides|{{RootFieldType|SyncBag`1|[[Type:Override|Override]]&lt;[[Type:Bool|Bool]]&gt;}}|TypeAdv3=true|
|_overrides|{{RootFieldType|SyncBag`1|[[Type:Override|Override]]&lt;[[Type:Bool|Bool]]&gt;}}|TypeAdv3=true|A Bag of the [[Type:Bool|Boolean]] Overrides and the corresponding [[Type:UserRef|UserRef]] they apply to.
|Target|{{RootFieldType|FieldDrive`1|[[Type:Bool|Bool]]}}|TypeAdv4=true|
|Target|{{RootFieldType|FieldDrive`1|[[Type:Bool|Bool]]}}|TypeAdv4=true|Reference to the field that gets driven to the override value.
|Any|{{RootFieldType|RawOutput`1|[[Type:Bool|Bool]]}}|TypeAdv5=true|
|Any|{{RootFieldType|RawOutput`1|[[Type:Bool|Bool]]}}|TypeAdv5=true|Reports <code>true</code> when ''any user'' in the session would have their override be <code>true</code> (either from the default value or an override).
|All|{{RootFieldType|RawOutput`1|[[Type:Bool|Bool]]}}|TypeAdv6=true|
|All|{{RootFieldType|RawOutput`1|[[Type:Bool|Bool]]}}|TypeAdv6=true|Reports <code>true</code> when ''all users'' in the session would have their override be <code>true</code> (either from the default value or an override).
|None|{{RootFieldType|RawOutput`1|[[Type:Bool|Bool]]}}|TypeAdv7=true|
|None|{{RootFieldType|RawOutput`1|[[Type:Bool|Bool]]}}|TypeAdv7=true|Reports <code>true</code> when ''none of the users'' in the session would have their override be <code>true</code> (either from the default value or an override).
|TrueCount|{{RootFieldType|RawOutput`1|[[Type:Int|Int]]}}|TypeAdv8=true|
|TrueCount|{{RootFieldType|RawOutput`1|[[Type:Int|Int]]}}|TypeAdv8=true|Reports the total count of <code>true</code> values for all users in the session.
|FalseCount|{{RootFieldType|RawOutput`1|[[Type:Int|Int]]}}|TypeAdv9=true|
|FalseCount|{{RootFieldType|RawOutput`1|[[Type:Int|Int]]}}|TypeAdv9=true|Reports the total count of <code>false</code> values for all users in the session.
}}
 
Note that the reporting fields (Any, All, None, TrueCount and FalseCount) count only the values for users ''in the sessions'' (including away users and headless servers), but not all the values in the <code>_overrides</code> list.
 
== Override ==
{{Table TypeFields
|User|[[Type:UserRef|UserRef]]|TypeAdv0=true| The [[Type:User|User]] that should see <code>Value</code>'s content inside of <code>Target</code> locally instead of <code>Default</code>'s content.
|Value|[[Type:Bool|Bool]]|TypeAdv1=true| The Boolean value that <code>User</code> should see target driven to locally.
}}
}}


== Behavior ==
== Behavior ==
The <code>_overrides</code> bag contains a list of users and their associated Boolean values - whenever the local user matches a user entry in the bag, the associated value is driven to <code>Target</code>. Otherwise, <code>Target</code> is driven to the value in <code>Default</code>.
<code>CreateOverrideOnWrite</code> allows for new users and values to be added to the bag when the driven value in <code>Target</code> is directly or indirectly changed by that user. If it is not enabled, the value in <code>Target</code> is not changeable unless the override is added or changed manually from the inspector panel.
Attempting to write to or otherwise cause a discrete entry to a driven field is known as Hooking it. Any Hook to the <code>Target</code> value is intercepted by the '''BooleanUserOverrideGather''' Component and will change the modifying user's entry in the <code>_overrides</code> bag. If there is no entry for the user and if <code>CreateOverrideOnWrite</code> is enabled, it will create an entry using the set value.


== Examples ==
== Examples ==


== See Also ==
== Related Components ==
* [[Component:ValueUserOverride|ValueUserOverride]]
* [[Component:NumericUserOverrideGather|NumericUserOverrideGather]]


[[Category:Components:Transform:Drivers{{#translation:}}|Boolean User Override Gather]]
[[Category:Components:Transform:Drivers{{#translation:}}|Boolean User Override Gather]]
[[Category:Components{{#translation:}}|Boolean User Override Gather]]
[[Category:Components{{#translation:}}|Boolean User Override Gather]]
[[Category:ComponentStubs]]
[[Category:ComponentStubs]]

Latest revision as of 15:38, 23 June 2024

The BooleanUserOverrideGather Component allows storing Boolean "override" values for each user listed under _overrides and driving the Target field. The behavior is similar to ValueUserOverride<Bool>, except this component also reports aggregate information about the overrides.

Component image 
Boolean User Override Gather component as seen in the Scene Inspector


Usage

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled.
Default Bool The default value given to Target if no suitable override exists in _overrides.
CreateOverrideOnWrite Bool Whether an entry in _overrides should be created when Target is written back.
PersistentOverrides Bool Whether values in _overrides should persist when the component is saved.
_overrides direct SyncBag`1<Override<Bool>> A Bag of the Boolean Overrides and the corresponding UserRef they apply to.
Target field drive of Bool Reference to the field that gets driven to the override value.
Any raw output of Bool Reports true when any user in the session would have their override be true (either from the default value or an override).
All raw output of Bool Reports true when all users in the session would have their override be true (either from the default value or an override).
None raw output of Bool Reports true when none of the users in the session would have their override be true (either from the default value or an override).
TrueCount raw output of Int Reports the total count of true values for all users in the session.
FalseCount raw output of Int Reports the total count of false values for all users in the session.

Note that the reporting fields (Any, All, None, TrueCount and FalseCount) count only the values for users in the sessions (including away users and headless servers), but not all the values in the _overrides list.

Override

Fields
Name Type Description
User UserRef The User that should see Value's content inside of Target locally instead of Default's content.
Value Bool The Boolean value that User should see target driven to locally.


Behavior

The _overrides bag contains a list of users and their associated Boolean values - whenever the local user matches a user entry in the bag, the associated value is driven to Target. Otherwise, Target is driven to the value in Default.

CreateOverrideOnWrite allows for new users and values to be added to the bag when the driven value in Target is directly or indirectly changed by that user. If it is not enabled, the value in Target is not changeable unless the override is added or changed manually from the inspector panel.

Attempting to write to or otherwise cause a discrete entry to a driven field is known as Hooking it. Any Hook to the Target value is intercepted by the BooleanUserOverrideGather Component and will change the modifying user's entry in the _overrides bag. If there is no entry for the user and if CreateOverrideOnWrite is enabled, it will create an entry using the set value.

Examples

Related Components