Unigine::Properties Class
Header: | #include <UnigineProperties.h> |
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.
You can also subscribe for such events to handle them.
- This class is a singleton.
- To modify a single property, use functions of the Property class.
Handling Events#
You can subscribe for events to track any changes made to any property and perform certain actions. The signature of the handler function must be as follows:
void handler_function_name(const PropertyPtr &property);
void AppWorldLogic::property_removed(const PropertyPtr &property)
{
Log::message("Property \"%s\" was removed.\n", property->getName());
}
// somewhere in the code
// inherit a new property named "new_property_1" from the base property "surface_base"
Properties::findManualProperty("surface_base")->inherit("new_property_1");
// subscribing for property removal
Properties::getEventRemoved().connect(this, &AppWorldLogic::property_removed);
// remove the property named "new_property_1"
Properties::removeProperty(Properties::findProperty("new_property_1")->getGUID());
See Also#
- C++ API sample located in the folder <UnigineSDK>/source/samples/Api/Systems/Properties
Properties Class
Members
getNumProperties() const#
Returns the current The total number of properties loaded for the current project.
Return value
CurrentEvent<const Ptr<Property> &> getEventRemoved() const#
Event triggered when a property is removed. You can subscribe to events via
connect()
and unsubscribe via
disconnect(). You can also use
EventConnection
and
EventConnections
classes for convenience (see examples below).
The event handler signature is as follows: myhandler(For more details see the Event Handling article.
Usage Example
// implement the Removed event handler
void removed_event_handler(const Ptr<Property> & property)
{
Log::message("\Handling Removed event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections removed_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
Properties::getEventRemoved().connect(removed_event_connections, removed_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Properties::getEventRemoved().connect(removed_event_connections, [](const Ptr<Property> & property) {
Log::message("\Handling Removed event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
removed_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection removed_event_connection;
// subscribe to the Removed event with a handler function keeping the connection
Properties::getEventRemoved().connect(removed_event_connection, removed_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
removed_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
removed_event_connection.setEnabled(true);
// ...
// remove subscription to the Removed event via the connection
removed_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Removed event handler implemented as a class member
void event_handler(const Ptr<Property> & property)
{
Log::message("\Handling Removed event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
Properties::getEventRemoved().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Removed event with a handler function
Properties::getEventRemoved().connect(removed_event_handler);
// remove subscription to the Removed event later by the handler function
Properties::getEventRemoved().disconnect(removed_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId removed_handler_id;
// subscribe to the Removed event with a lambda handler function and keeping connection ID
removed_handler_id = Properties::getEventRemoved().connect([](const Ptr<Property> & property) {
Log::message("\Handling Removed event (lambda).\n");
}
);
// remove the subscription later using the ID
Properties::getEventRemoved().disconnect(removed_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Removed events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Properties::getEventRemoved().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
Properties::getEventRemoved().setEnabled(true);
Return value
Event reference.Event<const Ptr<Property> &> getEventReparented() const#
Event triggered when the parent of a property is changed. You can subscribe to events via
connect()
and unsubscribe via
disconnect(). You can also use
EventConnection
and
EventConnections
classes for convenience (see examples below).
The event handler signature is as follows: myhandler(For more details see the Event Handling article.
Usage Example
// implement the Reparented event handler
void reparented_event_handler(const Ptr<Property> & property)
{
Log::message("\Handling Reparented event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections reparented_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
Properties::getEventReparented().connect(reparented_event_connections, reparented_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Properties::getEventReparented().connect(reparented_event_connections, [](const Ptr<Property> & property) {
Log::message("\Handling Reparented event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
reparented_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection reparented_event_connection;
// subscribe to the Reparented event with a handler function keeping the connection
Properties::getEventReparented().connect(reparented_event_connection, reparented_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
reparented_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
reparented_event_connection.setEnabled(true);
// ...
// remove subscription to the Reparented event via the connection
reparented_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Reparented event handler implemented as a class member
void event_handler(const Ptr<Property> & property)
{
Log::message("\Handling Reparented event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
Properties::getEventReparented().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Reparented event with a handler function
Properties::getEventReparented().connect(reparented_event_handler);
// remove subscription to the Reparented event later by the handler function
Properties::getEventReparented().disconnect(reparented_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId reparented_handler_id;
// subscribe to the Reparented event with a lambda handler function and keeping connection ID
reparented_handler_id = Properties::getEventReparented().connect([](const Ptr<Property> & property) {
Log::message("\Handling Reparented event (lambda).\n");
}
);
// remove the subscription later using the ID
Properties::getEventReparented().disconnect(reparented_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Reparented events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Properties::getEventReparented().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
Properties::getEventReparented().setEnabled(true);
Return value
Event reference.Event<const Ptr<Property> &> getEventRenamed() const#
Event triggered when the name of a property is changed. You can subscribe to events via
connect()
and unsubscribe via
disconnect(). You can also use
EventConnection
and
EventConnections
classes for convenience (see examples below).
The event handler signature is as follows: myhandler(For more details see the Event Handling article.
Usage Example
// implement the Renamed event handler
void renamed_event_handler(const Ptr<Property> & property)
{
Log::message("\Handling Renamed event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections renamed_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
Properties::getEventRenamed().connect(renamed_event_connections, renamed_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Properties::getEventRenamed().connect(renamed_event_connections, [](const Ptr<Property> & property) {
Log::message("\Handling Renamed event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
renamed_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection renamed_event_connection;
// subscribe to the Renamed event with a handler function keeping the connection
Properties::getEventRenamed().connect(renamed_event_connection, renamed_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
renamed_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
renamed_event_connection.setEnabled(true);
// ...
// remove subscription to the Renamed event via the connection
renamed_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Renamed event handler implemented as a class member
void event_handler(const Ptr<Property> & property)
{
Log::message("\Handling Renamed event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
Properties::getEventRenamed().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Renamed event with a handler function
Properties::getEventRenamed().connect(renamed_event_handler);
// remove subscription to the Renamed event later by the handler function
Properties::getEventRenamed().disconnect(renamed_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId renamed_handler_id;
// subscribe to the Renamed event with a lambda handler function and keeping connection ID
renamed_handler_id = Properties::getEventRenamed().connect([](const Ptr<Property> & property) {
Log::message("\Handling Renamed event (lambda).\n");
}
);
// remove the subscription later using the ID
Properties::getEventRenamed().disconnect(renamed_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Renamed events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Properties::getEventRenamed().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
Properties::getEventRenamed().setEnabled(true);
Return value
Event reference.Event<const Ptr<Property> &> getEventMoved() const#
Event triggered when the path of a property is changed. You can subscribe to events via
connect()
and unsubscribe via
disconnect(). You can also use
EventConnection
and
EventConnections
classes for convenience (see examples below).
The event handler signature is as follows: myhandler(For more details see the Event Handling article.
Usage Example
// implement the Moved event handler
void moved_event_handler(const Ptr<Property> & property)
{
Log::message("\Handling Moved event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections moved_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
Properties::getEventMoved().connect(moved_event_connections, moved_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Properties::getEventMoved().connect(moved_event_connections, [](const Ptr<Property> & property) {
Log::message("\Handling Moved event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
moved_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection moved_event_connection;
// subscribe to the Moved event with a handler function keeping the connection
Properties::getEventMoved().connect(moved_event_connection, moved_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
moved_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
moved_event_connection.setEnabled(true);
// ...
// remove subscription to the Moved event via the connection
moved_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Moved event handler implemented as a class member
void event_handler(const Ptr<Property> & property)
{
Log::message("\Handling Moved event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
Properties::getEventMoved().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Moved event with a handler function
Properties::getEventMoved().connect(moved_event_handler);
// remove subscription to the Moved event later by the handler function
Properties::getEventMoved().disconnect(moved_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId moved_handler_id;
// subscribe to the Moved event with a lambda handler function and keeping connection ID
moved_handler_id = Properties::getEventMoved().connect([](const Ptr<Property> & property) {
Log::message("\Handling Moved event (lambda).\n");
}
);
// remove the subscription later using the ID
Properties::getEventMoved().disconnect(moved_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Moved events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Properties::getEventMoved().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
Properties::getEventMoved().setEnabled(true);
Return value
Event reference.Event<const Ptr<Property> &> getEventCreated() const#
Event triggered when a new property is created. You can subscribe to events via
connect()
and unsubscribe via
disconnect(). You can also use
EventConnection
and
EventConnections
classes for convenience (see examples below).
The event handler signature is as follows: myhandler(For more details see the Event Handling article.
Usage Example
// implement the Created event handler
void created_event_handler(const Ptr<Property> & property)
{
Log::message("\Handling Created event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections created_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
Properties::getEventCreated().connect(created_event_connections, created_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Properties::getEventCreated().connect(created_event_connections, [](const Ptr<Property> & property) {
Log::message("\Handling Created event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
created_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection created_event_connection;
// subscribe to the Created event with a handler function keeping the connection
Properties::getEventCreated().connect(created_event_connection, created_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
created_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
created_event_connection.setEnabled(true);
// ...
// remove subscription to the Created event via the connection
created_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Created event handler implemented as a class member
void event_handler(const Ptr<Property> & property)
{
Log::message("\Handling Created event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
Properties::getEventCreated().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the Created event with a handler function
Properties::getEventCreated().connect(created_event_handler);
// remove subscription to the Created event later by the handler function
Properties::getEventCreated().disconnect(created_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 5. Subscribe to an event saving an ID and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// define a connection ID to be used to unsubscribe later
EventConnectionId created_handler_id;
// subscribe to the Created event with a lambda handler function and keeping connection ID
created_handler_id = Properties::getEventCreated().connect([](const Ptr<Property> & property) {
Log::message("\Handling Created event (lambda).\n");
}
);
// remove the subscription later using the ID
Properties::getEventCreated().disconnect(created_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 6. Ignoring all Created events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Properties::getEventCreated().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
Properties::getEventCreated().setEnabled(true);
Return value
Event reference.int getNumProperties ( ) const#
Returns the total number of properties loaded for the current project.Return value
Total number of properties loaded.Ptr<Property> getProperty ( int num ) const#
Returns a property by its number. The returned property can be modified by using methods of the Property class.Vector<PropertyPtr> my_properties;
for (int i = 0; i < Properties::getNumProperties(); i++) {
my_properties.append(Properties::getProperty(i));
}
Arguments
- int num - Number of the property in range from 0 to the total number of properties.
Return value
Property smart pointer if it exists or NULL.bool isProperty ( const char * name ) const#
Checks if a property with the given name exists.Arguments
- const char * name - Name of the property.
Return value
1 if a property with the given name exists; otherwise, 0.bool isProperty ( const UGUID & guid ) const#
Checks if a property with the given GUID exists.Arguments
Return value
1 if a property with the given GUID exists; otherwise, 0.bool isManualProperty ( const char * name ) const#
Checks if a property with the given name exists.Arguments
- const char * name - Name of the manual property.
Return value
1 if a manual property with the given name exists; otherwise, 0.const char * getPropertyName ( int num ) const#
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.
Ptr<Property> cloneProperty ( const UGUID & guid, const char * name = 0, const char * 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
- const UGUID & guid - GUID of the property to clone.
- const char * name - Cloned property name.
- const char * path - Path to save the cloned property.
Return value
Property smart pointer if the property with the specified GUID exists or nullptr.Ptr<Property> findProperty ( const char * name ) const#
Searches for a property with the given name. The returned property can be managed using the methods of the Property class.Arguments
- const char * name - Property name.
Return value
Property, if it is found (an instance of the Property class); otherwise, nullptr.Ptr<Property> findManualProperty ( const char * name ) const#
Searches for a manual property with the given name. The returned property can be managed using the methods of the Property class.Arguments
- const char * name - Manual property name.
Return value
Manual property, if it is found (an instance of the Property class); otherwise, nullptr.Ptr<Property> findPropertyByGUID ( const UGUID & guid ) const#
Searches for a property with the given GUID. The returned property can be managed using the methods of the Property class.Arguments
Return value
Property, if it is found (an instance of the Property class); otherwise, nullptr.Ptr<Property> findPropertyByPath ( const char * path ) const#
Searches for a property with the given path. The returned property can be managed using the methods of the Property class.Arguments
- const char * path - Property path.
Return value
Property, if it is found (an instance of the Property class); otherwise, nullptr.Ptr<Property> findPropertyByFileGUID ( const UGUID & guid ) const#
Searches for a property with the given *.prop file GUID. The returned property can be managed using the methods of the Property class.Arguments
Return value
Property, if it is found (an instance of the Property class); otherwise, nullptr.Ptr<Property> loadProperty ( const char * path ) #
Loads a property from the specified *.prop file. The returned property can be managed using the methods of the Property class.Arguments
- const char * 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.Ptr<Property> inheritProperty ( const UGUID & guid, const char * name = 0, const char * 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
- const UGUID & guid - GUID of the property to inherit from.
- const char * name - Inherited property name.
- const char * path - Path to save the inherited property.
Return value
Property smart pointer if the property with the specified GUID exists or nullptr.bool removeProperty ( const UGUID & guid, bool remove_file = 0, bool 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
- const UGUID & guid - GUID of the property to remove.
- bool remove_file - Flag indicating if the corresponding *.prop file will be deleted. Set 1 to delete the file, or 0 to keep it.
- bool 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.bool renameProperty ( const UGUID & guid, const char * 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
- const UGUID & guid - GUID of the property to be renamed.
- const char * new_name - New name for the property to be set.
Return value
1 if the property is renamed successfully; otherwise, 0.bool replaceProperty ( const Ptr<Property> & property, const Ptr<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
- const Ptr<Property> & property - Property to be replaced.
- const Ptr<Property> & new_property - New property.
Return value
1 if the property is replaced successfully; otherwise, 0.bool reparentProperty ( const UGUID & guid, const UGUID & new_parent, bool 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
- const UGUID & guid - GUID of the property whose parent is to be changed.
- const UGUID & new_parent - GUID of the property to be set as a new parent.
- bool 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 reloadProperties ( ) #
Reloads all *.prop files from all data folders.If new *.prop files are found, they will be loaded automatically. The hierarchy will be rebuilt if necessary, while keeping all overridden parameter values.
int saveProperties ( ) const#
Saves all properties that can be saved to corresponding *.prop files.Return value
1 if all properties are saved successfully; otherwise, 0.Last update:
2024-03-20
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)