PropertyParameter Class
UnigineScript is deprecated and will be removed in future releases. Please consider using C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScipt is not guaranteed, as the current level of support assumes only fixing critical issues.
This class is used to represent a property parameter.
PropertyParameter Class
Members
int getID ( ) #
Returns the ID of the property parameter.Return value
ID of the property parameter.Property getProperty ( ) #
Returns the property, that owns the parameter.Return value
Property instance owning the parameter.UGUID getPropertyGUID ( ) #
Returns the GUID of the property that owns the parameter.Return value
GUID of the property that owns the parameter.PropertyParameter getParent ( ) #
Returns the parent property parameter, if it exists.Return value
Parent property parameter, if it exists; otherwise, NULL.int getNumChildren ( ) #
Returns the total number of children of the property parameter.Return value
Total number of children of the property parameter.int isChild ( PropertyParameter parameter ) #
Returns a value indicating if the specified property parameter is a child of this property parameter.Arguments
- PropertyParameter parameter - Property parameter to be checked.
Return value
1 if the specified property parameter is a child of this property parameter; otherwise, 0.int findChild ( string name ) #
Returns the number of the child property parameter with the specified name.Arguments
- string name - Name of the child property parameter to be found.
Return value
Number of the child property parameter with the specified name, if it exists; otherwise, -1.getChild ( int num ) #
Returns a child property parameter by its number.Arguments
- int num - Number of the child property parameter in the range from 0 to the total number of children of this property parameter.
Return value
Child property parameter instance, if it exists; otherwise, NULL.getChild ( ) #
Returns a child property parameter by its name.Arguments
Return value
Child property parameter instance, if it exists; otherwise, NULL.int getChildIndex ( PropertyParameter parameter ) #
Returns the index of the specified child property parameter.Arguments
- PropertyParameter parameter - Child property parameter for which an index is to be found.
Return value
Index of the child property parameter in the range from 0 to the total number of children of this property parameter, if such a child exists; otherwise, -1.int isExist ( ) #
Returns a value indicating if the property parameter is an existing one.Return value
1 if the property parameter is an existing one; otherwise, 0.int isHidden ( ) #
Returns a value indicating if the property parameter is hidden.Return value
1 if the property parameter is hidden; otherwise, 0.int isInherited ( ) #
Returns a value indicating if the property parameter is inherited from a parent.Return value
1 if the property parameter is inherited from a parent; otherwise, 0.int isOverridden ( ) #
Returns a value indicating if the property parameter is overridden.Return value
1 if the property parameter is overridden; otherwise, 0.int getType ( ) #
Returns the type of the property parameter.Return value
One of the PROPERTY_PARAMETER_* pre-defined variables; if an error occurs, -1 will be returned.string getName ( ) #
Returns the name of the property parameter.Return value
Property parameter name.string getTitle ( ) #
Returns the title of the property parameter. This title is displayed in the UnigineEditor's UI.Return value
Property parameter title.string getTooltip ( ) #
Returns the tooltip for the property parameter. This title is displayed in the UnigineEditor's UI.Return value
Property parameter tooltip.string getGroup ( ) #
Returns the name of the group to which the property parameter belongs.Return value
name of the group to which the property parameter belongs.string getFilter ( ) #
Returns the filter string associated with the property parameter. This string specifies a filter for file, material or property parameter values thet will be used in the UnigineEditor. For example, you can specify ".xml|.node|.txt" to filter certain types of assets, or specify a base material to filter out materials, that cannot be used in a particular case (e.g. to avoid an attempt of assigning a post material to a mesh).Return value
String specifying a filter for file, material or property parameter values.void resetValue ( ) #
Resets an overridden value of the property parameter.Resetting a value of the property parameter affects all its children.
int getValueInt ( ) #
Returns the current value of the property parameter as an integer.Return value
Value of the property parameter.float getValueFloat ( ) #
Returns the current value of the property parameter as a float.Return value
Value of the property parameter.double getValueDouble ( ) #
Returns the current value of the property parameter as a double.Return value
Value of the property parameter.String getValueString ( ) #
Returns the current value of the property parameter as a string.Return value
Value of the property parameter.vec2 getValueVec2 ( ) #
Returns the current value of the property parameter as a two-component vec2 vector.Return value
Value of the property parameter.vec3 getValueVec3 ( ) #
Returns the current value of the property parameter as a three-component vec3 vector.Return value
Value of the property parameter.vec4 getValueVec4 ( ) #
Returns the current value of the property parameter as a four-component vec4 vector.Return value
Value of the property parameter.dvec2 getValueDVec2 ( ) #
Returns the current value of the property parameter as a two-component dvec2 vector.Return value
Value of the property parameter.dvec3 getValueDVec3 ( ) #
Returns the current value of the property parameter as a three-component dvec3 vector.Return value
Value of the property parameter.dvec4 getValueDVec4 ( ) #
Returns the current value of the property parameter as a four-component dvec4 vector.Return value
Value of the property parameter.ivec2 getValueIVec2 ( ) #
Returns the current value of the property parameter as a two-component ivec2 vector.Return value
Value of the property parameter.ivec3 getValueIVec3 ( ) #
Returns the current value of the property parameter as a three-component ivec3 vector.Return value
Value of the property parameter.ivec4 getValueIVec4 ( ) #
Returns the current value of the property parameter as a four-component ivec4 vector.Return value
Value of the property parameter.UGUID getValueGUID ( ) #
Returns the current value of the property parameter as a UGUID.Return value
Value of the property parameter.Node getValueNode ( ) #
Returns the current value of the property parameter as a Node.Return value
Value of the property parameter.Property getValueProperty ( ) #
Returns the current value of the property parameter as a Property.Return value
Value of the property parameter.Material getValueMaterial ( ) #
Returns the current value of the property parameter as a Material.Return value
Value of the property parameter.bool setValue ( Variable value ) #
Sets the value of the property parameter using the Variable specified.Arguments
- Variable value - Variable to be set as the value of the property parameter.
Return value
true if the property value is set successfully; otherwise, false.Variable getValue ( ) #
Returns the current value of the property parameter as a Variable.Return value
Value of the property parameter.void setValueInt ( int val ) #
Sets the value of the property parameter using the integer value specified.Arguments
- int val - Integer value to be set as the value of the property parameter.
int getIntMinValue ( ) #
Returns the minimum integer value of the property parameter.Return value
Minimum integer value of the property parameter.int getIntMaxValue ( ) #
Returns the maximum integer value of the property parameter.Return value
Maximum integer value of the property parameter.void setValueFloat ( float val ) #
Sets the value of the property parameter using the float value specified.Arguments
- float val - Float value to be set as the value of the property parameter.
float getFloatMinValue ( ) #
Returns the minimum float value of the property parameter.Return value
Minimum float value of the property parameter.float getFloatMaxValue ( ) #
Returns the maximum float value of the property parameter.Return value
Maximum float value of the property parameter.void setValueDouble ( double val ) #
Sets the value of the property parameter using the double value specified.Arguments
- double val - Double value to be set as the value of the property parameter.
double getDoubleMinValue ( ) #
Returns the minimum double value of the property parameter.Return value
Minimum double value of the property parameter.double getDoubleMaxValue ( ) #
Returns the maximum double value of the property parameter.Return value
Maximum double value of the property parameter.int hasSliderMinValue ( ) #
Returns a value indicating if the slider parameter has the minimum value specified. The slider parameter is a parameter of one of the following types: PROPERTY_PARAMETER_INT, PROPERTY_PARAMETER_FLOAT, PROPERTY_PARAMETER_DOUBLE.Return value
1 if the slider parameter has the minimum value specified; otherwise, 0.int hasSliderMaxValue ( ) #
Returns a value indicating if the slider parameter has the maximum value specified. The slider parameter is a parameter of one of the following types: PROPERTY_PARAMETER_INT, PROPERTY_PARAMETER_FLOAT, PROPERTY_PARAMETER_DOUBLE.Return value
1 if the slider parameter has the maximum value specified; otherwise, 0.int getSliderLog10 ( ) #
Returns a value indicating if the slider parameter uses a logarithmic scale (with the base ten). The slider parameter is a parameter of one of the following types: PROPERTY_PARAMETER_INT, PROPERTY_PARAMETER_FLOAT, PROPERTY_PARAMETER_DOUBLE.Return value
1 if the property parameter uses a logarithmic scale; otherwise, 0.int getSliderMinExpand ( ) #
Returns a value indicating if the minimum value of the slider parameter can be decreased. Slider parameter is a parameter of one of the following types: PROPERTY_PARAMETER_INT, PROPERTY_PARAMETER_FLOAT, PROPERTY_PARAMETER_DOUBLE.Return value
1 if the minimum value can be changed; otherwise, 0.int getSliderMaxExpand ( ) #
Returns a value indicating if the maximum value of the slider parameter can be decreased. Slider parameter is a parameter of one of the following types: PROPERTY_PARAMETER_INT, PROPERTY_PARAMETER_FLOAT, PROPERTY_PARAMETER_DOUBLE.Return value
1 if the maximum value can be changed; otherwise, 0.void setValueToggle ( int toggle ) #
Sets the value of the toggle parameter. If the PROPERTY_PARAMETER_TOGGLE variable isn't set for the parameter, or the property is not editable, the value won't be updated.Arguments
- int toggle - New value of the toggle parameter.
int getValueToggle ( ) #
Returns the current value of the toggle parameter. If the PROPERTY_PARAMETER_TOGGLE variable isn't set for the parameter, the function will return 0.Return value
Value of the toggle parameter.void setValueSwitch ( int val ) #
Sets the value of the switch parameter. If the PROPERTY_PARAMETER_SWITCH variable isn't set for the parameter, or the property is not editable, the value won't be updated.Arguments
- int val - New value of the switch parameter.
int getValueSwitch ( ) #
Returns the current value of the switch parameter. If the PROPERTY_PARAMETER_SWITCH variable isn't set for the parameter, the function will return 0.Return value
Value of the switch parameter.int getSwitchNumItems ( ) #
Returns the number of items of the switch parameter. If the PROPERTY_PARAMETER_SWITCH variable isn't set for the parameter, the function will return 0.Return value
Number of items of the switch parameter.void setSwitchItem ( int item ) #
Sets the item with the specified number as a value of the switch parameter.Suppose we have a property switch parameter declared as follows:
<parameter items="red=-1,green,blue=5,yellow"/>
Spaces in the items attribute declaration are taken into account. Thus, items="red=-1, green" shall produce 2 items: "red" and " green".
After loading we'll have switch items with the following values: red = -1, green = 0, blue = 5, yellow = 6.
PropertyParameter.setValue(5); // "blue" shall be selected in the corresponding combobox in the UnigineEditor
PropertyParameter.setSwitchItem(3); // "yellow" shall be selected in the corresponding combobox in the UnigineEditor (as it is the 3-rd item, starting from 0).
// If "green" item is selected in the UnigineEditor:
PropertyParameter.getValueInt(); // returns 0, as "green" corresponds to the value of 0.
PropertyParameter.getSwitchItem() // returns 1, as "green" is the 1-st element in the combobox (starting from 0).
Arguments
- int item - Number of the item of the switch parameter.
int getSwitchItem ( ) #
Returns the number of the currently selected item of the switch parameter.Suppose we have a property switch parameter declared as follows:
<parameter items="red=-1,green,blue=5,yellow"/>
Spaces in the items attribute declaration are taken into account. Thus, items="red=-1, green" shall produce 2 items: "red" and " green"
After loading we'll have switch items with the following values: red = -1, green = 0, blue = 5, yellow = 6.
PropertyParameter.setValue(5); // "blue" shall be selected in the corresponding combobox in the UnigineEditor
PropertyParameter.setSwitchItem(3); // "yellow" shall be selected in the corresponding combobox in the UnigineEditor (as it is the 3-rd item, starting from 0).
// If "green" item is selected in the UnigineEditor:
PropertyParameter.getValueInt(); // returns 0, as "green" corresponds to the value of 0.
PropertyParameter.getSwitchItem() // returns 1, as "green" is the 1-st element in the combobox (starting from 0).
Return value
Number of the currently selected item of the switch parameter.string getSwitchItemName ( int item ) #
Returns the name of the item of the switch parameter.Arguments
- int item - Number of the item of the switch parameter.
Return value
Name of the item of the switch parameter with the specified number.int getSwitchItemValue ( int item ) #
Returns the value of the item of the switch parameter with the specified number.Arguments
- int item - Number of the item of the switch parameter.
Return value
Value of the item of the switch parameter with the specified number.void setValueString ( String value ) #
Sets the value of the property parameter using the string specified.Arguments
- String value - String to be set as the value of the property parameter.
void setValueColor ( vec4 color ) #
Sets the value of the property parameter using the four-component vec4 color vector (R, G, B, A) specified.Arguments
- vec4 color - Four-component color vector (R, G, B, A) to be set as the value of the property parameter.
vec4 getValueColor ( ) #
Returns the current value of the property parameter as a four-component vec4 color vector (R, G, B, A).Return value
Value of the property parameter.void setValueVec2 ( vec2 vec2 ) #
Sets the value of the property parameter using the two-component vec2 vector specified.Arguments
- vec2 vec2 - Two-component float vector to be set as the value of the property parameter.
void setValueVec3 ( vec3 vec3 ) #
Sets the value of the property parameter using the three-component vec3 vector specified.Arguments
- vec3 vec3 - Three-component float vector to be set as the value of the property parameter.
void setValueVec4 ( vec4 vec4 ) #
Sets the value of the property parameter using the four-component vec4 vector specified.Arguments
- vec4 vec4 - Four-component float vector to be set as the value of the property parameter.
void setValueDVec2 ( dvec2 dvec2 ) #
Sets the value of the property parameter using the two-component dvec2 vector specified.Arguments
- dvec2 dvec2 - Two-component double vector to be set as the value of the property parameter.
void setValueDVec3 ( dvec3 dvec3 ) #
Sets the value of the property parameter using the three-component dvec3 vector specified.Arguments
- dvec3 dvec3 - Three-component double vector to be set as the value of the property parameter.
void setValueDVec4 ( dvec4 dvec4 ) #
Sets the value of the property parameter using the four-component dvec4 vector specified.Arguments
- dvec4 dvec4 - Four-component double vector to be set as the value of the property parameter.
void setValueIVec2 ( ivec2 ivec2 ) #
Sets the value of the property parameter using the two-component ivec2 vector specified.Arguments
- ivec2 ivec2 - Two-component integer vector to be set as the value of the property parameter.
void setValueIVec3 ( ivec3 ivec3 ) #
Sets the value of the property parameter using the three-component ivec3 vector specified.Arguments
- ivec3 ivec3 - Three-component integer vector to be set as the value of the property parameter.
void setValueIVec4 ( ivec4 ivec4 ) #
Sets the value of the property parameter using the four-component ivec4 vector specified.Arguments
- ivec4 ivec4 - Four-component integer vector to be set as the value of the property parameter.
void setValueMask ( int mask ) #
Sets the value of the mask parameter. If the PROPERTY_PARAMETER_MASK variable isn't set for the parameter, or the property is not editable, the value won't be updated.Arguments
- int mask - Mask to be set as the value of the property parameter.
int getValueMask ( ) #
Returns the current value of the property parameter as an integer mask.Return value
Value of the property parameter.void setValueFile ( string file ) #
Sets the value of the file parameter. If the property is not editable, the value won't be updated.
The value stored in the file parameter (this value will be returned by the getValueFile() method) depends on the flags set for the parameter:
// flags = "asset"
setValueFile("guid://asset_guid"); // getValueFile() -> asset_path
setValueFile("guid://runtime_guid"); // getValueFile() -> asset_path
setValueFile("asset_path"); // getValueFile() -> asset_path
setValueFile("runtime_path"); // getValueFile() -> asset_path
// flags = "runtime" - default
setValueFile("guid://asset_guid"); // getValueFile() -> runtime_path
setValueFile("guid://runtime_guid"); // getValueFile() -> runtime_path
setValueFile("asset_path"); // getValueFile() -> runtime_path
setValueFile("runtime_path"); // getValueFile() -> runtime_path
// flags = "abspath"
setValueFile(file_path); // getValueFile() -> file_path
Arguments
- string file - Value for the file parameter to be set.
string getValueFile ( int fast = 0 ) #
Returns the current value of the file parameter.Arguments
- int fast - 1 to use the specified number as an index in users auxiliary parameters cache; otherwise, 0.
Return value
Current file parameter value depending on the flags set for the parameter:// flags = "asset"
setValueFile("guid://asset_guid"); // getValueFile() -> asset_path
setValueFile("guid://runtime_guid"); // getValueFile() -> asset_path
setValueFile("asset_path"); // getValueFile() -> asset_path
setValueFile("runtime_path"); // getValueFile() -> asset_path
// flags = "runtime" - default
setValueFile("guid://asset_guid"); // getValueFile() -> runtime_path
setValueFile("guid://runtime_guid"); // getValueFile() -> runtime_path
setValueFile("asset_path"); // getValueFile() -> runtime_path
setValueFile("runtime_path"); // getValueFile() -> runtime_path
// flags = "abspath"
setValueFile(file_path); // getValueFile() -> file_path
To get a GUID of the file, use the getValueGUID() method.
string getValueFile ( ) #
Returns the current value of the file parameter.Return value
Current file parameter valueint getFileIsAsset ( ) #
Returns a value indicating if the file parameter stores a reference to an asset file.Return value
1 if the file parameter stores a reference to an asset file; otherwise, 0.int getFileIsRuntime ( ) #
Returns a value indicating if the file parameter stores a reference to a runtime file.Return value
1 if the file parameter stores a reference to a runtime file; otherwise, 0.int getFileIsAbsPath ( ) #
Returns a value indicating if the file parameter stores an absolute file path.Return value
1 if the file parameter stores an absolute file path; otherwise, 0.int isFileExist ( ) #
Returns a value indicating if a file corresponding to the property parameter exists.Return value
1 if a file corresponding to the property parameter exists; otherwise, 0.void setValueProperty ( Property property ) #
Sets the value of the property parameter using the Property specified.Arguments
- Property property - Value of the property parameter.
void setValueMaterial ( Material material ) #
Sets the value of the property parameter using the Material specified.Arguments
- Material material - Value of the property parameter.
void setValueNode ( Node node ) #
Sets the value of the property parameter using the Node specified.Arguments
- Node node - Value of the property parameter.
void setValueNodeID ( int valuenodeid ) #
Sets the value of the property parameter using the Node ID specified.Arguments
- int valuenodeid - Value of the property parameter.
int getValueNodeID ( ) #
Returns the current value of the property parameter as a Node ID.Return value
Value of the property parameter.void setArraySize ( int size ) #
Sets a new size of the array parameter.Arguments
- int size - New array size to be set (number of elements).
int getArraySize ( ) #
Returns the current size of the array parameter.Return value
Current array size (number of elements).int getArrayType ( ) #
Returns the type of elements of the array parameter.Return value
Type of array elements, one of the PROPERTY_PARAMETER_* variables.This method does not return PROPERTY_PARAMETER_ARRAY for an array parameter, it returns the type of array elements instead (e.g. PROPERTY_PARAMETER_FLOAT, PROPERTY_PARAMETER_STRUCT, etc.)
string getArrayTypeName ( ) #
Returns the type name of elements of the array parameter.Return value
Type name of of elements of the array parameter (Float, Node, Material, etc.).int getArrayDim ( ) #
Returns the dimension of the array parameter.Multi-dimensional arrays are represented as arrays of arrays, thus, the return value of this method will decrease with each level down the hierarchy.
Return value
Dimension of the array parameter.int getMaskType ( ) #
Returns the type of elements of the mask parameter.Return value
Type of the mask parameter, one of the PROPERTY_PARAMETER_MASK_* variables.string getStructName ( ) #
Returns the name of the structure, that defines the type of the struct parameter.Return value
Name of the structure, that defines the type of the struct parameter.int saveState ( Stream stream ) #
Saves data of the property parameter into a binary stream.Arguments
- Stream stream - Stream into which the property parameter data will be saved.
Return value
1 if the property parameter data is saved successfully; otherwise, 0.int restoreState ( Stream stream, int restore_mode = 0 ) #
Restores the data of the property parameter from a binary stream in the specified mode.Arguments
- Stream stream - Stream in which the saved property parameter data is stored.
- int restore_mode - Restore mode. One of the PROPERTY_RESTORE_MODE_* values. The default value is PROPERTY_RESTORE_MODE_REPLACE.
Return value
1 if the property parameter data is restored successfully; otherwise, 0.int isInt ( ) #
Returns a value indicating if the current property parameter is an integer.Return value
1 if the property parameter is an integer; otherwise, 0int isFloat ( ) #
Returns a value indicating if the current property parameter is a float.Return value
1 if the property parameter is a float; otherwise, 0int isDouble ( ) #
Returns a value indicating if the current property parameter is a double.Return value
1 if the property parameter is a double; otherwise, 0int isToggle ( ) #
Returns a value indicating if the current property parameter is a toggle.Return value
1 if the property parameter is a toggle; otherwise, 0int isSwitch ( ) #
Returns a value indicating if the current property parameter is a switch.Return value
1 if the property parameter is a switch; otherwise, 0int isString ( ) #
Returns a value indicating if the current property parameter is a string.Return value
1 if the property parameter is a string; otherwise, 0int isColor ( ) #
Returns a value indicating if the current property parameter is a color.Return value
1 if the property parameter is a color; otherwise, 0int isVec2 ( ) #
Returns a value indicating if the current property parameter is a vector of 2 float components.Return value
1 if the property parameter is a vector of 2 float components; otherwise, 0int isVec3 ( ) #
Returns a value indicating if the current property parameter is a vector of 3 float components.Return value
1 if the property parameter is a vector of 3 float components; otherwise, 0int isVec4 ( ) #
Returns a value indicating if the current property parameter is a vector of 4 float components.Return value
1 if the property parameter is a vector of 4 float components; otherwise, 0int isDVec2 ( ) #
Returns a value indicating if the current property parameter is a vector of 2 double components.Return value
1 if the property parameter is a vector of 2 double components; otherwise, 0int isDVec3 ( ) #
Returns a value indicating if the current property parameter is a vector of 3 double components.Return value
1 if the property parameter is a vector of 3 double components; otherwise, 0int isDVec4 ( ) #
Returns a value indicating if the current property parameter is a vector of 4 double components.Return value
1 if the property parameter is a vector of 4 double components; otherwise, 0int isIVec2 ( ) #
Returns a value indicating if the current property parameter is a vector of 2 integer components.Return value
1 if the property parameter is a vector of 2 integer components; otherwise, 0int isIVec3 ( ) #
Returns a value indicating if the current property parameter is a vector of 3 integer components.Return value
1 if the property parameter is a vector of 3 integer components; otherwise, 0int isIVec4 ( ) #
Returns a value indicating if the current property parameter is a vector of 4 integer components.Return value
1 if the property parameter is a vector of 4 integer components; otherwise, 0int isMask ( ) #
Returns a value indicating if the current property parameter is a mask.Return value
1 if the property parameter is a mask; otherwise, 0int isFile ( ) #
Returns a value indicating if the current property parameter is a file.Return value
1 if the property parameter is a file; otherwise, 0int isProperty ( ) #
Returns a value indicating if the current property parameter is a property.Return value
1 if the property parameter is a property; otherwise, 0int isMaterial ( ) #
Returns a value indicating if the current property parameter is a material.Return value
1 if the property parameter is a material; otherwise, 0int isNode ( ) #
Returns a value indicating if the current property parameter is a node.Return value
1 if the property parameter is a node; otherwise, 0int isArray ( ) #
Returns a value indicating if the current property parameter is an array.Return value
1 if the property parameter is an array; otherwise, 0int isStruct ( ) #
Returns a value indicating if the current property parameter is a structure.Return value
1 if the property parameter is a structure; otherwise, 0void setValueGUID ( UGUID valueguid ) #
Sets the UGUID variable as a property parameter value.Arguments
- UGUID valueguid - UGUID type value
int isValuePropertyInternal ( ) #
Checks if the property parameter flag is set to internal (flags="internal"). If it is internal, only a property assigned to some node can be assigned to it. If the property parameter is not internal, a property from the Asset Browser can be assigned to it.Return value
1 if a property parameter's flag is set to "Internal"; otherwise, 0.Last update:
2020-04-10
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)