![]() |
![]() |
![]() |
![]() |
instancer
Synopsis
module instancer {
int+read+req _Value;
group+nonotify+read+req _*Group;
int+read _active;
};Description
instancer is used to dynamically change the state of the instanced property on an object.
You should use this module when you want to dynamically activate or deactivate a portion of your network.If instanced=0, the actual widget is not created resulting in a sometimes substantial performance gain.
Parameters
Specifies the integer value for the instanced property. This value should be 1 or 0. The module runs when this parameter changes. Input port
The value of this parameter specifies the object whose instanced property should be changed. Changing this parameter does not cause this module to rerun. Input port.
1 (the default) means instance the object when Value changes from 0 to 1 and de-instance when values changes from 1 to 0.
2 means instance the object when Value changes from 0 to 1 but do not de-instance the object when value changes from 1 to 0.
Example
This example defines a macro that contains a shell. The instancer module attaches the instanced state of the shell to its visibility. When the shell is made visible, it is instanced at the same time. When it is made invisible, it is deinstanced. This example sets the default instanced property on the shell to 0 so that the shell is not instanced initially when the network is instanced.
macro Dialog {
int visible = 0;
GMOD.instancer instancer {
Group => Dialog_shell;
Value => visible;
};
macro Dialog_shell<instanced=0> {
UIshell my_shell {
visible => <-.<-.visible;
};
UIdial my_dial {
parent => my_shell;
};
};
};
![]() |
![]() |
![]() |
![]() |