Conditional statements
Do you need more explanation? I find it useful, with more complex tours and elements (wether pano- or ui-), to be able to 'switch' some actions, if this then that (not event-driven, but state-driven).
(I can, with the up-comming implementation of variable nodes, do some of this myself without conditional statements, but it wont be as nice as this.
Also, then you are going to have to update the docs to include the usable (bool) functions, maybe a new capter?
Also (2), currently (implementation wise), it would be very very (very) useful to have "0" be read as false and anything else as true. e.g. when in a ramp, you may want to enable/disable an ui-/panoelement (and its children) when setting their blend. Here you can then also set the visibility to the ramp value: enabling if blend > 0, else disabling.)
I just mocked up an example of the implementation, barely considering usability, so feedback will be needed:
<condition event="foo"
type="="
target="panoelement1"
property="visible"
value="false">
<behavior>
<action event="true" ... />
....
<action event="false" ... />
....
</behavior>
</condition>
fieldOfView | SPi-V dev
Re: Conditional statements
When implemented like this, conditions would need to be checked on every event. This would impact performance.
Instead, you can change the 'enabled' property of a behavior when the condition changes yourself. Actions contained in a behavior whose 'enabled' property is set to false won't fire. You can use this mechanism to simulate conditional statements.
You can use the 'bool()' function to cast any value to a boolean.
Re: Conditional statements
> When implemented like this, conditions would need to be checked on every event. This would impact performance.
I understand, but I suggested this because I want it to check on every event!
Sure one would be stupid to put one in a ramp, listening the change event! But being called at the stop/start event this isn't more expensive then using undocumented functions, state variables and the like...
All this besides, How do i use these functions? Especially functions in functions? (nested)
Known functions (to me, just for reference purpose):
"getproperty",
"abs", "max", "min", "random", "randomfloat",
"integer", "float", "string", "bool",
"sin", "cos", "tan", "sqrt", "power", "log"
+ - * /
e.g. type="setProperty" .... value='=bool(getproperty("panoelement1","pan"))'
or: type="setProperty" .... value='=bool(=getproperty("panoelement1","pan"))'
Re: Conditional statements
Also, I believe, its about readability/ease of programing question. For bigger tours I already notice that I often frown about my own code. (though I notice, when comparing with others, my code looks really clean ;) )
Re: Conditional statements
Oh, one more! How feasible is this? Hard to implement? (I'm asking this as dev to dev)