engine.properties Functions
The functions below are used to control property loading and management within the project: you can get, clone, inherit, or remove any property within the project. Reparenting is supported for all non-manual and editable properties.
- This class is a singleton.
- To modify a single property, use functions of the Property class.
Adding Callbacks#
See Also#
- C++ API sample located in the folder <UnigineSDK>/source/samples/Api/Systems/Properties
Properties Class
Members
int engine.properties.getNumProperties ( ) #
Returns the total number of properties loaded for the current project.Return value
Total number of properties loaded.Property engine.properties.getProperty ( int num ) #
Returns a property by its number. The returned property can be modified by using methods of the Property class.Property properties[];
for (int i; i < engine.properties.getNumProperties(); i++) {
properties[i] = engine.properties.getProperty(i);
}
Arguments
- int num - Number of the property in range from 0 to the total number of properties.
Return value
Property instance if it exists or NULL.engine.properties.isProperty ( ) #
Checks if a property with the given name exists.Arguments
Return value
1 if a property with the given name exists; otherwise, 0.int engine.properties.isManualProperty ( string name ) #
Checks if a property with the given name exists.Arguments
- string name - Name of the manual property.
Return value
1 if a manual property with the given name exists; otherwise, 0.string engine.properties.getPropertyName ( int num ) #
Returns the name of the property by its number.Arguments
- int num - Number of the property in range from 0 to the total number of properties.
Return value
Name of the property.If the property with the specified number is internal and has a parent, the parent's name will be returned.
Property engine.properties.cloneProperty ( UGUID guid, string name = 0, string path = 0 ) #
Clones the property and assigns the specified name and path to the clone.Without a name the cloned property won't be displayed in the properties hierarchy, without a path it won't be saved when saveProperties() is called.
Arguments
- UGUID guid - GUID of the property to clone.
- string name - Cloned property name.
- string path - Path to save the cloned property.
Return value
Property instance if the property with the specified GUID exists or nullptr.Property engine.properties.findProperty ( string name ) #
Searches for a property with the given name. The returned property can be managed using the methods of the Property class.Arguments
- string name - Property name.
Return value
Property, if it is found (an instance of the Property class); otherwise, nullptr.Property engine.properties.findManualProperty ( string name ) #
Searches for a manual property with the given name. The returned property can be managed using the methods of the Property class.Arguments
- string name - Manual property name.
Return value
Manual property, if it is found (an instance of the Property class); otherwise, nullptr.Property engine.properties.findPropertyByGUID ( UGUID guid ) #
Searches for a property with the given GUID. The returned property can be managed using the methods of the Property class.Arguments
- UGUID guid - Property GUID.
Return value
Property, if it is found (an instance of the Property class); otherwise, nullptr.Property engine.properties.findPropertyByPath ( string path ) #
Searches for a property with the given path. The returned property can be managed using the methods of the Property class.Arguments
- string path - Property path.
Return value
Property, if it is found (an instance of the Property class); otherwise, nullptr.Property engine.properties.findPropertyByFileGUID ( UGUID guid ) #
Searches for a property with the given *.prop file GUID. The returned property can be managed using the methods of the Property class.Arguments
- UGUID guid - Property file GUID.
Return value
Property, if it is found (an instance of the Property class); otherwise, nullptr.Property engine.properties.loadProperty ( string path ) #
Loads a property from the specified *.prop file. The returned property can be managed using the methods of the Property class.Arguments
- string path - Path to the *.prop file to load a property from.
Return value
Property, if it is loaded successfully (an instance of the Property class); otherwise, nullptr.Property engine.properties.inheritProperty ( UGUID guid, string name = 0, string path = 0 ) #
Inherits a property from the given property and assigns the specified name and path to the new property.Without a name the inherited property won't be displayed in the properties hierarchy, without a path it won't be saved when saveProperties() is called.
Arguments
- UGUID guid - GUID of the property to inherit from.
- string name - Inherited property name.
- string path - Path to save the inherited property.
Return value
Property instance if the property with the specified GUID exists or nullptr.int engine.properties.removeProperty ( UGUID guid, int remove_file = 0, int remove_children = 1 ) #
Removes the property with the specified GUID.A root property (the property that has no parent) or a non-editable property cannot be removed using this function.
Arguments
- UGUID guid - GUID of the property to remove.
- int remove_file - Flag indicating if the corresponding *.prop file will be deleted. Set 1 to delete the file, or 0 to keep it.
- int remove_children - Flag indicating if all children of the property will be deleted. Set 1 to delete all children of the property, or 0 to link all children to the parent.
Return value
1 if the property is removed successfully; otherwise, 0.int engine.properties.renameProperty ( UGUID guid, string new_name ) #
Changes the name of the property with the specified GUID.- The name of the *.prop file is not affected.
- This method is not available for the manual and non-editable properties.
Arguments
- UGUID guid - GUID of the property to be renamed.
- string new_name - New name for the property to be set.
Return value
1 if the property is renamed successfully; otherwise, 0.int engine.properties.replaceProperty ( Property property, Property new_property ) #
Replaces the specified property with a new one for all nodes and surfaces. The new property that replaces the specified one must exist. For example, if you have 3 nodes with the same property, calling this method will change this property to the specified one for all these nodes.Arguments
- Property property - Property to be replaced.
- Property new_property - New property.
Return value
1 if the property is replaced successfully; otherwise, 0.int engine.properties.reparentProperty ( UGUID guid, UGUID new_parent, int save_all_values = 0 ) #
Sets a new parent for the specified property. Both properties with given GUIDs must exist.The method isn't available for the manual and non-editable properties.
Arguments
- UGUID guid - GUID of the property whose parent is to be changed.
- UGUID new_parent - GUID of the property to be set as a new parent.
- int save_all_values - Flag indicating if parameter values of the specified property will be saved after reparenting.
Return value
1 if the parent for the property is changed successfully; otherwise, 0.void engine.properties.reloadProperties ( ) #
Reloads all *.prop files from all data folders.If new *.prop files are found, they will be loaded automatically. The hierachy will be rebuilt if necessary, while keeping all overridden parameter values.
int engine.properties.saveProperties ( ) #
Saves all properties that can be saved to corresponding *.prop files.Return value
1 if all properties are saved successfully; otherwise, 0.Last update:
2019-08-16
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)