This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine::Property Class

Header: #include <UnigineProperties.h>

This class provides an interface for property manipulation: it is used to modify properties that allow you to control values of the logic-related parameters. When a property is assigned to a node, an instanced internal property is created and saved into a .world or .node file. However, rather than the whole list of parameters it contains only the modified ones.

The concepts of a path and a name of the property should be distinguished:

  • The path specifies where the property is stored on the disk. The path includes a property file name.
  • The name specifies how the property will be displayed in the UnigineEditor (the Property Hierarchy window, the nodes surface section of the Parameters window). The name can also be used to refer to a property from the code.
By default, the property name and the *.prop file name coincide.

By using functions of this class, you can, for example, implement a properties editor.

Properties specify the way the object will behave and interact with other objects and the scene environment.

A property is a "material" for application logic represented by a set of logic-related parameters. Properties can be used to build components to extend the functionality of nodes.

All properties in the project are organized into a hierarchy. To be modified, properties should be obtained from the hierarchy via API functions.

Property parameters are managed individually via the PropertyParameter class, to get any parameter by its name or ID you should use the getParameterPtr() method.

Source code (C++)
PropertyParameterPtr pPropertyParameter = pProperty->getParameterPtr(); // get "root" parameter
pTargetNode = pPropertyParameter->getChild(k)->getValueNode(); // get child with index "k", then its value
// ...
positionFactor = pPropertyParameter->getChild(k)->getValueFloat();
// etc.

If you know names, you can use:
pTargetNode = pProperty->getParameterPtr("target")->getValueNode();
positionFactor = pProperty->getParameterPtr("position_factor")->getValueFloat();

Automatic type conversion of property parameters make them act like some universal variables i.e. you can set a new value for an integer parameter int_param and type it like this:

Source code (C++)
PropertyParameterPtr int_param;

/* ... */

// setting a new value of integer parameter using a string
int_param->setValue(“15”);

// setting a new value of integer parameter using a float
int_param->setValue(5.0f);

// getting integer parameter’s value as a string
Log::message(“Integer parameter value: %s”, int_param->getValueString().get());

Notice
You can modify only existing parameters of the property. To add or remove new parameters, you should manually edit the .prop file or use API to edit the XML file via the code.

Adding and Removing Properties#

Notice
The Property class doesn't allow adding a new property to the property hierarchy.
A new property can be added to the hierarchy in one of the following ways:
  • By creating and editing the corresponding .prop file manually. For example, in the data folder let us create the following file describing a property for a GameObjectUnit:
    Source code (XML)
    <?xml version="1.0" encoding="utf-8"?>
    <property version="2.7.3" manual="1" editable="0" name="GameObjectsUnit">
    	<parameter name="weapon_type" type="switch" items="air,land,all_types">0</parameter>
    	<parameter name="attack" type="toggle">1</parameter>
    	<parameter name="damage" type="int" max="1000">1</parameter>
    	<parameter name="velocity" type="float" max="100">30</parameter>
    	<parameter name="material" type="string"/>
    </property>
  • By inheriting from the existing property via Properties::inheritProperty() function or inherit() function of the Property class. For example:
    Source code (C++)
    // get a pointer to the property manager
    Properties *properties = Properties::get();
    
    // inherit a GameObjectsUnit_0 property from the GameObjectsUnit property
    PropertyPtr inherited_prop = properties->findManualProperty("GameObjectsUnit")->inherit("GameObjectsUnit_0", "game_object_unit_0.prop");
    
    // inherit a GameObjectsUnit_1 property from the GameObjectsUnit_0 property via the Manager
    properties->inheritProperty(inherited_prop->getGUID(), "GameObjectsUnit_1", "game_object_unit_1.prop");
    To save all properties in the hierarchy that can be saved (i.e., editable, having a path specified, and not internal or manual ones) via the Properties::saveProperties() function.
    Notice
    By default, all parameters and states of the inherited property are the same as specified in the parent property. A child property can override some parameters of its parent or add new ones.
  • By editing the corresponding .prop file via API: you can open an XML file, write data into it and save it.

To delete a property, you can simply call the removeProperty() function:

Source code (C++)
// remove the property with the given name with all its children and delete the *.prop file
properties->removeProperty(properties->findProperty("GameObjectsUnit_0")->getGUID(), 1, 1);

Adding Callbacks#

You can add callbacks to track any changes made to the property and its parameters and perform certain actions. The signature of the callback function can be one of the following:

Source code (C++)
// for the CALLBACK_PARAMETER_CHANGED type
void callback_function_name(PropertyPtr property, int parameter_num);

// for all other types
void callback_function_name(PropertyPtr property);
The example below shows how to add a callback to track changes of property parameters and report the name of the property and the changed parameter (suppose we have a manual property named my_prop with an integer parameter named my_int_param).
Source code (C++)
void parameter_changed(PropertyPtr property, int num)
{
	Log::message("Parameter \"%s\" of the property \"%s\" has changed its value.\n", property->getParameterName(num), property->getName());
    // ...
}

// somewhere in the code

// getting a manual property named "my_prop" via the Property Manager
PropertyPtr property = Properties::get()->findManualProperty("my_prop");

// setting our callback function on parameter change
property->addCallback(Property::CALLBACK_PARAMETER_CHANGED, MakeCallback(parameter_changed));

// changing the value of the "my_int_param" parameter
property->setParameterInt(property->findParameter("my_int_param"), 3);

Usage Example#

To illustrate how properties and their parameters are managed let's make a simple viewer for all properties in the project as well as for their parameters. Our viewer will have the following features:

  • View the list of all properties used in the project.
  • View the list of parameters of the currently selected property. Inherited, overridden and unique parameters are displayed in different colors.
  • Change the value of the selected property parameter.
  • Reset the value of the selected property parameter.
  • Inherit a new property from the selected one.
  • Clone the selected property.
  • Save the currently selected property to a file.
  • Reload all properties.

We can add the the following *.prop files to the data folder of our project to check our viewer:

  • my_property.prop

    my_property.prop

    Source code (XML)
    <?xml version="1.0" encoding="utf-8"?>
    <property version="2.7.3.0" name="my_property" parent="node_base" manual="1">
    	
    	<parameter name="damage" type="int" max="1000">1</parameter>
    	<parameter name="mass" type="float" tooltip="Aircraft mass">1345</parameter>
    	<parameter name="attack" type="toggle">1</parameter>
    	<parameter name="weapon_type" type="switch" items="air,land,all_types">0</parameter>
    	<parameter name="Mask" type="mask"/>
    	<parameter name="Base Material" type="material"/>
    	<parameter name="Model Node" type="node"/>
    
    	<struct name="member">
    		<parameter name="name" type="string"></parameter>
    		<parameter name="rank" type="switch" items="2LT,1LT,CPT,MAJ,LTC,COL,BG,MG">0</parameter>
    		<parameter name="year" type="int"></parameter>
    		<parameter name="status" type="toggle">1</parameter>
    	</struct>
    	<parameter name="Members" type="array" array_type="member" group="Crew Information">
    			<value>
    				<parameter name="name">Mike Watts</parameter>
    				<parameter name="rank" type="switch" items="2LT,1LT,CPT,MAJ,LTC,COL,BG,MG">3</parameter>
    				<parameter name="year">1990</parameter>
    			</value>
    			<value>
    				<parameter name="name">John Doe</parameter>
    				<parameter name="rank" type="switch" items="2LT,1LT,CPT,MAJ,LTC,COL,BG,MG">2</parameter>
    				<parameter name="year">1995</parameter>
    			</value>
    			<value>
    				<parameter name="name">Vincent Preston</parameter>
    				<parameter name="rank" type="switch" items="2LT,1LT,CPT,MAJ,LTC,COL,BG,MG">1</parameter>
    				<parameter name="year">1997</parameter>
    			</value>
    		</parameter>
    	<parameter name="Service Flags" type="array" array_type="toggle" group="Auxiliary">
    		<value>1</value>
    		<value>0</value>
    		<value>1</value>
    		<value>0</value>
    	</parameter>
    </property>
  • custom_prop.prop

    custom_prop.prop

    Source code (XML)
    <?xml version="1.0" encoding="utf-8"?>
    <property version="2.7.3.0" name="custom_prop" manual="1">
    	 <!-- First structure declaration -->
    	 <struct name="struct1">
    			 <parameter name="param_a" type="int">1</parameter>
    			 <parameter name="param_b" type="toggle">0</parameter>
    			 <parameter name="param_c" type="int">1</parameter>
    	 </struct>
    	 <!-- Inherited structure declaration-->
    	 <struct name="struct2" parent_name="struct1">
    			 <parameter name="param2_a" type="toggle">0</parameter>
    			 <parameter name="param2_b" type="float">1.0</parameter>
    	 </struct>
    	 <!-- Struct parameter of struct2 type -->
    	 <parameter name="my_struct_param" type="struct2"></parameter>
    	 <!-- Nested structure declaration -->
    	 <struct name="struct3">
    			 <parameter name="param3_a" type="struct2">0</parameter>
    			 <parameter name="param3_b" type="int">15</parameter>
    	 </struct>
    
    	 <!-- Declaration of a one-dimensional array of struct3 elements-->
    	 <parameter name="my_struct_array" array_type="struct3"></parameter>
    </property>
  • custom_prop_0.prop inherited from the custom_prop property.

    custom_prop_0.prop

    Source code (XML)
    <?xml version="1.0" encoding="utf-8"?>
    <property version="2.7.3.0" name="custom_prop_0" manual="1" parent="custom_prop">
    	 <!-- Declaration of a 2-dimensional array (matrix) of integer elements-->
    	 <parameter name="my_int_array" array_type="int" array_dim="2"></parameter>
    </property>

Below is the source code in C++ implementing our Property Viewer. You can copy and paste it to the corresponding files of your project.

AppSystemLogic.h

Source code (C++)
#ifndef __APP_SYSTEM_LOGIC_H__
#define __APP_SYSTEM_LOGIC_H__

#include <UnigineLogic.h>
#include <UnigineWidgets.h>
#include <UnigineGui.h>
#include <UnigineMap.h>

using namespace Unigine;
using namespace Math;

class AppSystemLogic : public Unigine::SystemLogic {

private:
	// declaring UI widgets to be used
	WidgetWindowPtr window;
	WidgetHBoxPtr hbox;

	WidgetGroupBoxPtr properties_gb;
	WidgetTreeBoxPtr properties;
	WidgetGroupBoxPtr parameters_gb;
	WidgetTreeBoxPtr parameters;
	WidgetGroupBoxPtr value_gb;
	WidgetGroupBoxPtr menu_gb;

	WidgetVBoxPtr vbox2, vbox3;
	WidgetHBoxPtr hbox2;
	WidgetButtonPtr reload;
	WidgetButtonPtr clone;
	WidgetButtonPtr inherit;
	WidgetButtonPtr save_prop;

	// values
	Vector<WidgetLabelPtr> label;
	WidgetEditLinePtr value;
	WidgetButtonPtr change;
	WidgetButtonPtr reset;

	WidgetLabelPtr info;
	WidgetLabelPtr prop_info;
	// lists of properties and parameters
	Map<int, PropertyPtr> item_prop;
	Map<int, PropertyParameterPtr> item_param;

	void refresh_properties();
	void properties_changed();
	void parameters_changed();

	void change_clicked();
	void reset_clicked();
	void reload_clicked();
	void refresh_info();
	void clone_clicked();
	void inherit_clicked();
	void save_prop_clicked();


public:
	AppSystemLogic();
	virtual ~AppSystemLogic();

	virtual int init();

	virtual int update();
	virtual int render();

	virtual int shutdown();
	virtual int destroy();
};

#endif // __APP_SYSTEM_LOGIC_H__

AppSystemLogic.cpp

Source code (C++)
#include "AppSystemLogic.h"
#include <UnigineApp.h>
#include <UnigineProperties.h>
#include <UnigineFileSystem.h>
#include <functional>

// System logic, it exists during the application life cycle.
// These methods are called right after corresponding system script's (UnigineScript) methods.

AppSystemLogic::AppSystemLogic()
{
}

AppSystemLogic::~AppSystemLogic()
{
}

int AppSystemLogic::init()
{
	App::get()->setUpdate(1);
	
	// creating user interface
	GuiPtr gui = Gui::get();
	window = WidgetWindow::create(gui, "Properties Viewer");
	window->setSizeable(1);
	window->setWidth(App::get()->getWidth());
	window->setHeight(App::get()->getHeight());
	gui->addChild(window->getWidget(), Gui::ALIGN_OVERLAP);

	vbox2 = WidgetVBox::create(gui);
	window->addChild(vbox2->getWidget(), Gui::ALIGN_EXPAND);

	hbox = WidgetHBox::create(gui);
	vbox2->addChild(hbox->getWidget(), Gui::ALIGN_EXPAND);

	properties_gb = WidgetGroupBox::create(gui, "Properties");
	parameters_gb = WidgetGroupBox::create(gui, "Parameters");
	hbox->addChild(properties_gb->getWidget(), Gui::ALIGN_EXPAND);
	hbox->addChild(parameters_gb->getWidget(), Gui::ALIGN_EXPAND);

	properties = WidgetTreeBox::create(gui);
	parameters = WidgetTreeBox::create(gui);
	properties_gb->addChild(properties->getWidget(), Gui::ALIGN_EXPAND);
	parameters_gb->addChild(parameters->getWidget(), Gui::ALIGN_EXPAND);

	vbox3 = WidgetVBox::create(gui);
	hbox->addChild(vbox3->getWidget(), Gui::ALIGN_EXPAND);
	value_gb = WidgetGroupBox::create(gui, "Value");
	value_gb->setWidth(300);
	value_gb->setHeight(300);
	value_gb->arrange();
	menu_gb = WidgetGroupBox::create(gui, "Menu");
	vbox3->addChild(value_gb->getWidget(), Gui::ALIGN_LEFT);
	vbox3->addChild(menu_gb->getWidget(), Gui::ALIGN_EXPAND);

	label.append() = WidgetLabel::create(gui, "");
	label.last()->setFontRich(1);
	value_gb->addChild(label.last()->getWidget(), Gui::ALIGN_LEFT);
	value = WidgetEditLine::create(gui);
	value_gb->addChild(value->getWidget(), Gui::ALIGN_EXPAND);
	for (int i = 0; i < 12; i++)
	{
		label.append() = WidgetLabel::create(gui, "");
		label.last()->setFontRich(1);
		value_gb->addChild(label.last()->getWidget(), Gui::ALIGN_LEFT);
	}
	change = WidgetButton::create(gui, "Change Value");
	value_gb->addChild(change->getWidget(), Gui::ALIGN_LEFT);
	reset = WidgetButton::create(gui, "Reset Value");
	value_gb->addChild(reset->getWidget(), Gui::ALIGN_LEFT);

	reload = WidgetButton::create(gui, "Reload Property Files");
	clone = WidgetButton::create(gui, "Clone Property");
	inherit = WidgetButton::create(gui, "Inherit Property");
	save_prop = WidgetButton::create(gui, "Save Property");

	menu_gb->addChild(reload->getWidget(), Gui::ALIGN_EXPAND);
	menu_gb->addChild(clone->getWidget(), Gui::ALIGN_EXPAND);
	menu_gb->addChild(inherit->getWidget(), Gui::ALIGN_EXPAND);
	menu_gb->addChild(save_prop->getWidget(), Gui::ALIGN_EXPAND);

	info = WidgetLabel::create(gui);
	info->setFontRich(1);
	info->setText(
		"<font color=00ffff>Unique value</font><br>"
		"<font color=ffffff>Inherited value</font><br>"
		"<font color=ffff00>Overridden value</font><br>");
	menu_gb->addChild(info->getWidget(), Gui::ALIGN_LEFT);
	prop_info = WidgetLabel::create(gui);
	menu_gb->addChild(prop_info->getWidget(), Gui::ALIGN_LEFT);
	
	// setting callbacks for UI elements
	properties->addCallback(Gui::CHANGED, MakeCallback(this, &AppSystemLogic::properties_changed));
	parameters->addCallback(Gui::CHANGED, MakeCallback(this, &AppSystemLogic::parameters_changed));

	change->addCallback(Gui::CLICKED, MakeCallback(this, &AppSystemLogic::change_clicked));
	reset->addCallback(Gui::CLICKED, MakeCallback(this, &AppSystemLogic::reset_clicked));
	reload->addCallback(Gui::CLICKED, MakeCallback(this, &AppSystemLogic::reload_clicked));
	clone->addCallback(Gui::CLICKED, MakeCallback(this, &AppSystemLogic::clone_clicked));
	inherit->addCallback(Gui::CLICKED, MakeCallback(this, &AppSystemLogic::inherit_clicked));
	save_prop->addCallback(Gui::CLICKED, MakeCallback(this, &AppSystemLogic::save_prop_clicked));

	refresh_properties();

	return 1;
}

/// method refreshing properties
void AppSystemLogic::refresh_properties()
{
	properties->setCallbackEnabled(Gui::CHANGED, 0);
	properties->clear();
	item_prop.clear();
	
	// recursive function iterating through all children properties and building property hierarchy
	std::function<void(int, const PropertyPtr &)> attach_children = [&, this](int parent, const PropertyPtr &prop_parent)
	{
		for (int k = 0; k < prop_parent->getNumChildren(); k++)
		{
			PropertyPtr prop = prop_parent->getChild(k); prop->setParameterInt(0, 1); prop->getParameterPtr();
			if (prop != prop_parent && prop->getParent() && prop->getParent() == prop_parent)
			{
				int child = properties->addItem(prop->getName());
				properties->addItemChild(parent, child);
				item_prop.append(child, prop);
				attach_children(child, prop);
			}
		}
	};
	// building property hierarchy
	for (int i = 0; i < Properties::get()->getNumProperties(); i++)
	{
		PropertyPtr prop_base = Properties::get()->getProperty(i);
		if (prop_base->isBase())
		{
			int parent = properties->addItem(prop_base->getName());
			item_prop.append(parent, prop_base);
			attach_children(parent, prop_base);
		}
	}
	properties->setCallbackEnabled(Gui::CHANGED, 1);
}

/// method refreshing property parameters
void AppSystemLogic::properties_changed()
{
	parameters->setCallbackEnabled(Gui::CHANGED, 0);
	// clearing the list of propety parameters and updating values displayed
	parameters->clear();
	value_gb->setEnabled(0);
	for (int i = 0; i <= 12; i++)
		label[i]->setText("");

	item_param.clear();
	
	int item = properties->getCurrentItem();
	if (item == -1)
	{
		parameters->setCallbackEnabled(Gui::CHANGED, 1);
		return;
	}
	// getting a property from the list in accordance with current selection
	PropertyPtr prop = item_prop[item];
	
	// getting a root parameter of the selected property
	PropertyParameterPtr pp = prop->getParameterPtr();
	
	// recursive function iterating through all parameters of a property
	std::function<void(int, const PropertyParameterPtr &)> add_parameters = [&, this](int parent, const PropertyParameterPtr &p)
	{
		for (int i = 0; i < p->getNumChildren(); i++)
		{
			PropertyParameterPtr child = p->getChild(i);
			int child_index = parameters->addItem(child->getName());
			parameters->setItemColor(child_index,
				vec4(
				itof(child->isInherited()),
				1,
				itof(!child->isOverridden()),
				child->isHidden() ? 0.5f : 1.0f));
			item_param.append(child_index, child);

			if (parent != -1)
				parameters->addItemChild(parent, child_index);

			add_parameters(child_index, child);
		}
	};
	
	// building the hierarchy of parameters for the selected property
	add_parameters(-1, pp);
	
	// preparing property information
	String pi = String::format("\nName: %s\nPath: %s\nInternal: %d\nStructs: %d\n", prop->getName(), prop->getPath(), prop->isInternal(), prop->getNumStructs());
	// adding all structures defined in the property (if any)
	for (int i = 0; i < prop->getNumStructs(); i++)
		pi += String::format("%d) %s\n", i, prop->getStructName(i));
	// displaying property information
	prop_info->setText(pi.get());

	parameters->setCallbackEnabled(Gui::CHANGED, 1);
	parameters->setCurrentItem(-1);
}
/// method refreshing information about the currently selected property parameter
void AppSystemLogic::parameters_changed()
{
	// checking if any property parameter is selected
	int item = parameters->getCurrentItem();
	if (item == -1)		
		return;
	
	value_gb->setEnabled(1);
	// getting the parameter from the list in accordance with current selection
	PropertyParameterPtr p = item_param[item];
	int i = 0;
	label[i++]->setText(String::format("<font color=ffff00>ID:</font> %d", p->getID()));
	label[i++]->setText(String::format("<font color=ffff00>Name:</font> %s", p->getName()));
	label[i++]->setText(String::format("<font color=ffff00>Title:</font> %s", p->getTitle()));
	label[i++]->setText(String::format("<font color=ffff00>Tooltip:</font> %s", p->getTooltip()));
	label[i++]->setText(String::format("<font color=ffff00>Group:</font> %s", p->getGroup()));
	label[i++]->setText(String::format("<font color=ffff00>Filter:</font> %s", p->getFilter()));
	
	String s;
	// displaying parameter's type
	if (p->getType() == Property::PARAMETER_ARRAY)
		s = String::format("<font color=ffff00>Type:</font> array "
		"[<font color=ffff00>Size:</font> %d, <font color=ffff00>Type:</font> %s]", p->getArraySize(), p->getArrayTypeName());
	else if (p->getType() == Property::PARAMETER_STRUCT)
		s = String::format("<font color=ffff00>Type:</font> struct [<font color=ffff00>Struct Name:</font> %s]", p->getStructName());
	else
		s = String::format("<font color=ffff00>Type:</font> %s", p->getProperty()->parameterNameByType(p->getType()));
	label[i++]->setText(s.get());
	label[i++]->setText(String::format("<font color=ffff00>Hidden:</font> %d", p->isHidden()));
	label[i++]->setText(String::format("<font color=ffff00>Inherited:</font> %d", p->isInherited()));
	label[i++]->setText(String::format("<font color=ffff00>Overridden:</font> %d", p->isOverridden()));
	label[i++]->setText(String::format("<font color=ffff00>Has Min:</font> %d", p->hasSliderMinValue()));
	label[i++]->setText(String::format("<font color=ffff00>Has Max:</font> %d", p->hasSliderMaxValue()));
	s = "";
	if (p->getType() == Property::PARAMETER_INT)
		s = String::format("<font color=ffff00>Min:</font> %d <font color=ffff00>Max:</font> %d", p->getIntMinValue(), p->getIntMaxValue());
	else if (p->getType() == Property::PARAMETER_FLOAT)
		s = String::format("<font color=ffff00>Min:</font> %f <font color=ffff00>Max:</font> %f", p->getFloatMinValue(), p->getFloatMaxValue());
	else if (p->getType() == Property::PARAMETER_DOUBLE)
		s = String::format("<font color=ffff00>Min:</font> %f <font color=ffff00>Max:</font> %f", p->getDoubleMinValue(), p->getDoubleMaxValue());
	else if (p->getType() == Property::PARAMETER_SWITCH)
		s = String::format("<font color=ffff00>Switch Num Items:</font> %d", p->getSwitchNumItems());
	label[i++]->setText(s.get());
	value->setText(p->getValueString().get());
	reset->setEnabled(p->isOverridden());
}

/// change button on_click event handler
void AppSystemLogic::change_clicked()
{
	// checking if any property parameter is currently selected
	int item = parameters->getCurrentItem();
	if (item == -1)
		return;
	// setting the value of the currently selected property parameter and refreshing information
	PropertyParameterPtr pp = item_param[item];
	pp->setValue(value->getText());

	refresh_info();
}

/// reset button on_click event handler
void AppSystemLogic::reset_clicked()
{
	// checking if any property parameter is currently selected
	int item = parameters->getCurrentItem();
	if (item == -1)
		return;
	
	// resetting the value of the currently selected property parameter and refreshing information
	PropertyParameterPtr pp = item_param[item];
	pp->resetValue();

	refresh_info();
}

/// reload button on_click event handler
void AppSystemLogic::reload_clicked()
{
	// reload all properties and refreshing information
	Properties::get()->reloadProperties();
	refresh_info();
}

/// method refreshing property and parameter information
void AppSystemLogic::refresh_info()
{
	// getting current indices of property and parameter selection
	int item_pr = properties->getCurrentItem();
	int item_pa = parameters->getCurrentItem();
	refresh_properties();
	
	// setting current items and updating information displayed
	properties->setCurrentItem(clamp(item_pr, -1, properties->getNumItems() - 1));
	properties_changed();
	parameters->setCurrentItem(clamp(item_pa, -1, parameters->getNumItems() - 1));
	parameters_changed();
}

void AppSystemLogic::clone_clicked()
{
	// checking if any property is selected in the hierarchy
	int item = properties->getCurrentItem();
	if (item == -1)
		return;
	// cloning the selected property
	PropertyPtr p = item_prop[item];
	PropertyPtr p_clone = p->clone();
	p_clone->setName(String::format("%s_cloned", p->getName()));
	
	// refreshing information displayed
	refresh_info();
}

/// inherit button on_click event handler
void AppSystemLogic::inherit_clicked()
{
	// checking if any property is selected in the hierarchy
	int item = properties->getCurrentItem();
	if (item == -1)
		return;
	// inheriting a new property from the selected one
	PropertyPtr p = item_prop[item];
	p->inherit()->setName(String::format("%s_inherited", p->getName()));
	
	// refreshing information displayed
	refresh_info();
}

/// method saving the currently selected property to the "my_test_prop.prop" file
void AppSystemLogic::save_prop_clicked()
{	
	// checking if any property is selected in the hierarchy
	int item = properties->getCurrentItem();
	if (item == -1)
		return;
	// saving a property to the specified file
	PropertyPtr p = item_prop[item];
	p->save("my_test_prop.prop");
}


int AppSystemLogic::update()
{
	return 1;
}

int AppSystemLogic::render()
{
	// Write here code to be called before rendering each render frame.
	return 1;
}
// end of the main loop

int AppSystemLogic::shutdown()
{
	// Write here code to be called on engine shutdown.
	return 1;
}

int AppSystemLogic::destroy()
{
	// Write here code to be called when the video mode is changed or the application is restarted (i.e. video_restart is called). It is used to reinitialize the graphics context.
	return 1;
}

Property Class

Members


static PropertyPtr create ( )

Constructor. Creates a new property instance.

Ptr<Property> getChild( int num )

Returns the child property of the current property.

Arguments

  • int num - The number of the target child property.

Return value

Child property.

int getID( )

Returns the ID of the property.

Return value

Property ID.

UGUID getGUID( )

Returns the GUID of the property.

Return value

GUID of the property.

int isBase( )

Returns a value indicating if the property is a base property.

Return value

1 if the property is a base property; otherwise, 0.

void setEditable( int editable )

Sets a value indicating if the property can be edited.

Arguments

  • int editable - 1 to make the property editable; 0 to make it read-only.

int isEditable( )

Returns a value indicating if the property can be edited.

Return value

1 if the property is editable; otherwise, 0.

int isHidden( )

Returns a value indicating if the property is hidden.

Return value

1 if the property is hidden; otherwise, 0.

int isEngine( )

Returns a value indicating if the property is engine-related (i.e. required for engine operation). Such properties are stored in the core, editor and editor2 folders.

Return value

1 if the property is engine-related; otherwise, 0.

int isInternal( )

Returns a value indicating if the property is internal.

Return value

1 if the property is internal; otherwise, 0.

int isManual( )

Returns a value indicating if the property is manual.

Return value

1 if the property is manual; otherwise, 0.

int isHierarchyValid( )

Returns a value indicating if there are no missing parents in the hierarchy of the property.

Return value

1 if there are no missing parents in the hierarchy of the property; otherwise, 0.

int isParameterInherited( int num )

Returns a value indicating if the given parameter is inherited from a parent.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

1 if the given parameter is inherited from a parent; otherwise, 0.

int isParameterHidden( int num )

Returns a value indicating if the given parameter is hidden.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

1 if the given parameter is hidden; otherwise, 0.

int isParameterOverridden( int num )

Returns a value indicating if a given parameter is overridden.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

1 if the given parameter is overridden; otherwise, 0.

void setName( const char * name )

Sets a new name for the property.
Notice
This method is not available for manual and non-editable properties.

Arguments

  • const char * name - Name of the property.

const char * getName( )

Returns the property name.

Return value

Name of the property.
Notice
If the property is internal and has a parent, the parent's name will be returned.

int getNumChildren( )

Returns the number of children of the current property.

Return value

Number of child properties.

int getNumParameters( )

Returns the number of property's parameters.
Warning
This function is deprecated and will be removed in the next release

Return value

Number of property parameters.

int hasOverrides( )

Returns a value indicating if the property has at least one overriden parameter.

Return value

1 if the property has at least one overriden parameter; otherwise, 0.

int findParameter( const char * name )

Searches for a parameter by the given name among all parameters of the current property and also among all parameters of the parent property that aren't overridden in the current property.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • const char * name - Name of the parameter.

Return value

The number of the parameter, if it is found; otherwise, -1.

int fetchParameter( const char * name, int fast_id )

Searches for a parameter by a given name among all parameters of the property.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • const char * name - Parameter name.
  • int fast_id - Parameter number in users auxiliary parameters cache. The value must be in the range [0; 128].

Return value

Parameter number, if it is found; otherwise, -1.

bool setParameter( int num, const Variable & value )

Updates the value of the given parameter.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • const Variable & value - New value of the parameter.

Variable getParameter( int num )

Returns the value of the given parameter.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Value of the parameter.

const char * getParameterGroup( int num )

Returns the name of the group, to which the specified property parameter belongs. Property parameters are displayed in groups in the Parameters window of the UnigineEditor.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number.

Return value

Name of the group to which the specified property parameter belongs.

const char * getParameterFilter( int num )

Returns the filter string associated with the specified 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).
Notice
This attribute is available only for file, material and property parameter types.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number.

Return value

String specifying a filter for file, material or property parameter values.

const char * getParameterTitle( int num )

Returns the title of the specified property parameter. This title is displayed in the UnigineEditor's UI.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number.

Return value

Title of the specified property parameter.

const char * getParameterTooltip( int num )

Returns the tooltip of the specified property parameter. This tooltip is displayed in the UnigineEditor, when user hovers a mouse over the property field.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number.

Return value

Tooltip text of the specified property parameter.

void setParameterFile( int num, const char * value )

Updates the value of the given 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 getParameterFile() method) depends on the flags set for the parameter:

Source code (C++)
// flags = "asset"
setParameterFile("guid://asset_guid"); 		// getParameterFile() -> asset_path
setParameterFile("guid://runtime_guid");	// getParameterFile() -> asset_path
setParameterFile("asset_path");				// getParameterFile() -> asset_path
setParameterFile("runtime_path");			// getParameterFile() -> asset_path

// flags = "runtime" - default
setParameterFile("guid://asset_guid"); 		// getParameterFile() -> runtime_path
setParameterFile("guid://runtime_guid");	// getParameterFile() -> runtime_path
setParameterFile("asset_path");				// getParameterFile() -> runtime_path
setParameterFile("runtime_path");			// getParameterFile() -> runtime_path

// flags = "abspath"
setParameterFile(file_path);				// getParameterFile() -> file_path
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • const char * value - New value for the file parameter.

const char * getParameterFile( int num, int fast )

Returns the current value of the given file parameter.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list. An index in users auxiliary parameters cache can laso be specified, in this case the fast flag should be set to 1.
  • 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:
Source code (C++)
// flags = "asset"
setParameterFile("guid://asset_guid"); 		// getParameterFile() -> asset_path
setParameterFile("guid://runtime_guid");	// getParameterFile() -> asset_path
setParameterFile("asset_path");				// getParameterFile() -> asset_path
setParameterFile("runtime_path");			// getParameterFile() -> asset_path

// flags = "runtime" - default
setParameterFile("guid://asset_guid"); 		// getParameterFile() -> runtime_path
setParameterFile("guid://runtime_guid");	// getParameterFile() -> runtime_path
setParameterFile("asset_path");				// getParameterFile() -> runtime_path
setParameterFile("runtime_path");			// getParameterFile() -> runtime_path

// flags = "abspath"
setParameterFile(file_path);				// getParameterFile() -> file_path
Notice
To get a GUID of the file, use the getParameterGUID() method.

int getParameterFileIsAsset( int num )

Returns a value indicating if the specified file parameter stores a reference to an asset file.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

1 if the specified file parameter stores a reference to an asset file; otherwise, 0.

int getParameterFileIsRuntime( int num )

Returns a value indicating if the specified file parameter stores a reference to a runtime file.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

1 if the specified file parameter stores a reference to a runtime file; otherwise, 0.

int getParameterFileIsAbsPath( int num )

Returns a value indicating if the specified file parameter stores an absolute file path.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

1 if the specified file parameter stores an absolute file path; otherwise, 0.

int isParameterFileExist( int num )

Returns a value indicating if a file corresponding to the specified file parameter of the property exists.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

1 if a file corresponding to the specified property parameter exists; otherwise, 0.

void setParameterMaterial( int num, const Ptr<Material> & value )

Updates the value of the given material parameter. If the PARAMETER_MATERIAL variable isn't set for the parameter, or the property is not editable, the value won't be updated.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • const Ptr<Material> & value - Material smart pointer to be set as a value of the specified parameter.

Ptr<Material> getParameterMaterial( int num )

Returns the current value of the given material parameter. If the PARAMETER_MATERIAL variable isn't set for the parameter, the function will return NULL.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Material smart pointer currently set as a value of the specified parameter.

void setParameterProperty( int num, const Ptr<Property> & value )

Updates the value of the given property parameter. If the PARAMETER_PROPERTY variable isn't set for the parameter, or the property is not editable, the value won't be updated.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • const Ptr<Property> & value - Property smart pointer to be set as a value of the specified parameter.

Ptr<Property> getParameterProperty( int num )

Returns the current value of the given property parameter. If the PARAMETER_PROPERTY variable isn't set for the parameter, the function will return NULL.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Property smart pointer currently set as a value of the specified parameter.

void setParameterColor( int num, const Math::vec4 & value )

Updates a value of the given color parameter. If the PARAMETER_COLOR variable isn't set for the parameter, the color value won't be updated.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • const Math::vec4 & value - New value for the color parameter.

Math::vec4 getParameterColor( int num )

Returns the current color set for the given color parameter. If the PARAMETER_COLOR variable isn't set for the parameter, the function will return (0,0,0,0).
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Color value of the color parameter. If an error occurs, (0,0,0,0) will be returned.

void setParameterDouble( int num, double value )

Updates the value of the given double parameter. If the PARAMETER_DOUBLE variable isn't set for the parameter, or the property is not editable, the value won't be updated.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • double value - New value for the double parameter.

double getParameterDouble( int num )

Returns the current value of the given double parameter. If the PARAMETER_DOUBLE variable isn't set for the parameter, the function will return 0.0f.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Value of the douuble parameter.

double getParameterDoubleMaxValue( int num )

Returns the maximum allowed value of the given double parameter. If the PARAMETER_DOUBLE variable isn't set for the parameter, the function will return 1.0f.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Maximum allowed value of the double parameter.

double getParameterDoubleMinValue( int num )

Returns the minimum allowed value of the given double parameter. If the PARAMETER_DOUBLE variable isn't set for the parameter, the function will return 0.0f.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Minimum allowed value for the double parameter.

void setParameterFloat( int num, float value )

Updates the value of the given float parameter. If the PARAMETER_FLOAT variable isn't set for the parameter, or the property is not editable, the value won't be updated.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • float value - New value of the float parameter.

float getParameterFloat( int num )

Returns the current value of the given float parameter. If the PARAMETER_FLOAT variable isn't set for the parameter, the function will return 0.0f.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Value of the float parameter.

float getParameterFloatMaxValue( int num )

Returns the maximum allowed value of the given float parameter. If the PARAMETER_FLOAT variable isn't set for the parameter, the function will return 1.0f.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Maximum allowed value of the float parameter.

float getParameterFloatMinValue( int num )

Returns the minimum allowed value of the given float parameter. If the PARAMETER_FLOAT variable isn't set for the parameter, the function will return 0.0f.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Minimum allowed value of the float parameter.

void setParameterGUID( int num, const UGUID & value )

Updates the value of the given file, material, or property parameter using the specified GUID. If the property is not editable, the value won't be updated.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • const UGUID & value - New GUID value for the specified parameter.

UGUID getParameterGUID( int num )

Returns the current value of the given file, material, or property parameter as a GUID (i.e. a GUID of a material, a property or a file will be returned).
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Value of the specified parameter as a GUID.

void setParameterNode( int num, const Ptr<Node> & value )

Updates the value of the given Node parameter. If the PARAMETER_NODE variable isn't set for the parameter, or the property is not editable, the value won't be updated.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • const Ptr<Node> & value - Node smart pointer to be set as a value of the specified parameter.

Ptr<Node> getParameterNode( int num )

Returns the current value of the given Node parameter. If the PARAMETER_NODE variable isn't set for the parameter, the function will return NULL.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Node smart pointer currently set as a value of the specified parameter.

void setParameterNodeID( int num, int value )

Updates the value of the given Node parameter by the specified node ID. If the PARAMETER_NODE variable isn't set for the parameter, or the property is not editable, the value won't be updated.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • int value - ID of a node to be set as a value of the specified parameter.

int getParameterNodeID( int num )

Returns the current value of the given Node parameter. If the PROPERTY_PARAMETER_NODE variable isn't set for the parameter, the function will return 0.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

ID of a node currently set as a value of the specified parameter.

void setParameterInt( int num, int value )

Updates the value of the given integer parameter. If the PARAMETER_INT variable isn't set for the parameter, or the property is not editable, the value won't be updated.

For example, the values of some integer parameter named param_1 of some property can be set as follows:

Source code (C++)
property->setParameterInt(property->findParameter("param_1"), 1);
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • int value - New value for the integer parameter.

int getParameterInt( int num )

Returns the current value of the given integer parameter. If the PARAMETER_INT variable isn't set for the parameter, the function will return 0.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Value of the integer parameter.

int getParameterIntMaxValue( int num )

Returns the maximum allowed value of the given integer parameter. If the PARAMETER_INT variable isn't set for the parameter, the function will return 1.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Maximum allowed value of the integer parameter.

int getParameterIntMinValue( int num )

Returns the minimum allowed value of the given integer parameter. If the PARAMETER_INT variable isn't set for the parameter, the function will return 0.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Minimum allowed value of the integer parameter.

void setParameterMask( int num, int value )

Updates a value of the given mask parameter. If the PARAMETER_MASK variable isn't set for the parameter, or the property is not editable, the value won't be updated.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • int value - New value for the mask parameter.

int getParameterMask( int num )

Returns the current value set for the given mask parameter. If the PARAMETER_MASK variable isn't set for the parameter, the function will return 0.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Value of the mask parameter. If an error occurs, 0 will be returned.

const char * getParameterName( int num )

Returns the name of the given property's parameter name.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - The number of the target parameter in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account).

Return value

Name of the parameter.

int getParameterSliderLog10( int num )

Returns a value indicating if the given slider parameter of the current property uses a logarithmic scale (with the base ten). The slider parameter is a parameter of one of the following types: PARAMETER_INT, PARAMETER_FLOAT, PARAMETER_DOUBLE.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - The number of the slider parameter in range from 0 to the total number of the property's parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account).

Return value

1 if the parameter uses a logarithmic scale; otherwise, 0.

int getParameterSliderMaxExpand( int num )

Returns a value indicating if the maximum value of the given slider parameter can be increased. The slider parameter is a parameter of one of the following types: PARAMETER_INT, PARAMETER_FLOAT, PARAMETER_DOUBLE.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - The number of the slider parameter in range from 0 to the total number of the property's parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account).

Return value

1 if the maximum value can be changed; otherwise, 0.

int getParameterSliderMinExpand( int num )

Returns a value indicating if the minimum value of the given slider parameter can be decreased. The slider parameter is a parameter of one of the following types: PARAMETER_INT, PARAMETER_FLOAT, PARAMETER_DOUBLE.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - The number of the slider parameter in range from 0 to the total number of the property's parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account).

Return value

1 if the minimum value can be changed; otherwise, 0.

int hasParameterSliderMaxValue( int num )

Returns a value indicating if a slider parameter with a given number has the maximum value specified.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - The number of the slider parameter in range from 0 to the total number of the property's parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account).

Return value

1 if a slider parameter with a given number has the maximum value specified; otherwise, 0.

int hasParameterSliderMinValue( int num )

Returns a value indicating if a slider parameter with a given number has the minimum value specified.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - The number of the slider parameter in range from 0 to the total number of the property's parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account).

Return value

1 if a slider parameter with a given number has the minimum value specified; otherwise, 0.

void setParameterString( int num, const char * value )

Updates the value of the given string parameter. If the PARAMETER_STRING variable isn't set for the parameter, or the property is not editable, the value won't be updated.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • const char * value - New value for the string parameter.

const char * getParameterString( int num )

Returns the current value of the given string parameter. If the PARAMETER_STRING variable isn't set for the parameter, the function will return NULL.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Value of the string parameter.

void setParameterSwitch( int num, int value )

Updates the value of the given switch parameter. If the PARAMETER_SWITCH variable isn't set for the parameter, or the property is not editable, the value won't be updated.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • int value - New value for the switch parameter.

int getParameterSwitch( int num )

Returns the current value of the given switch parameter. If the PARAMETER_SWITCH variable isn't set for the parameter, the function will return 0.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Value of the switch parameter.

const char * getParameterSwitchItem( int num, int item )

Returns the value of the item of the given switch parameter. If the PARAMETER_SWITCH variable isn't set for the parameter, the function will return NULL.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • int item - Number of the item of the switch parameter.

Return value

Value of the item. If an error occurs, NULL will be returned.

int getParameterSwitchNumItems( int num )

Returns the number of items of the given switch parameter. If the PARAMETER_SWITCH variable isn't set for the parameter, the function will return 0.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Number of items of the switch parameter.

void setParameterToggle( int num, int value )

Updates the value of the given toggle parameter. If the PARAMETER_TOGGLE variable isn't set for the parameter, or the property is not editable, the value won't be updated.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • int value - New value of the toggle parameter.

int getParameterToggle( int num )

Returns the current value of the given toggle parameter. If the PARAMETER_TOGGLE variable isn't set for the parameter, the function will return 0.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Value of the toggle parameter.

int getParameterType( int num )

Returns the type of the given parameter.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - The number of the target parameter in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account).

Return value

One of the PARAMETER_* pre-defined variables; if an error occurs, -1 will be returned.

void setParameterVec3( int num, const Math::vec3 & value )

Updates the value of the given vector (vec3) parameter. If the PARAMETER_VEC3 variable isn't set for the parameter, or the property is not editable, the value won't be updated.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • const Math::vec3 & value - New value for the vector (vec3) parameter.

Math::vec3 getParameterVec3( int num )

Returns the current value of the given vector (vec3) parameter. If the PARAMETER_VEC3 variable isn't set for the parameter, the function will return (0,0,0).
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Value of the vector (vec3) parameter.

void setParameterVec4( int num, const Math::vec4 & value )

Updates the value of the given vector (vec4) parameter. If the PARAMETER_VEC4 variable isn't set for the parameter, or the property is not editable, the value won't be updated.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.
  • const Math::vec4 & value - New value for the vector (vec4) parameter.

Math::vec4 getParameterVec4( int num )

Returns the current value of the given vector (vec4) parameter. If the PARAMETER_VEC4 variable isn't set for the parameter, the function will return (0,0,0,0).
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number in range from 0 to the total number of the property parameters (including parameters of its parent; if a parameter of the current property overrides the parent property's parameter, the parent property's parameter isn't taken into account). New parameters are added to the end of the parameters list.

Return value

Value of the vector (vec4) parameter.

void resetParameter( int num )

Resets the overriden value of the given parameter to the parent's value.
Warning
This function is deprecated and will be removed in the next release

Arguments

  • int num - Parameter number.

Ptr<Property> getParent( )

Returns the parent property.

Return value

Parent property if it exists; if the current property has no parent, nullptr will be returned.

int isParent( const char * name )

Returns a value indicating if the property with the given name is a parent of this property.

Suppose we have the following two manual properties in our project:

  • Source code (XML)
    <?xml version="1.0" encoding="utf-8"?>
    <property version="2.7.3" name="my_prop" parent_name="surface_base" manual="1">
    	<parameter name="my_parameter">100</parameter>
    </property>
  • Source code (XML)
    <?xml version="1.0" encoding="utf-8"?>
    <property version="2.7.3" name="my_prop_0" parent_name="my_prop" manual="1">
    	<parameter name="my_parameter1">101</parameter>
    	<parameter name="my_parameter2">101</parameter>
    </property>
The following code will return 1 as the my_prop property is the parent of the my_prop_0 property:
Source code (C++)
// get a property named my_prop_0
PropertyPtr property = Properties::get()->findManualProperty("my_prop_0");
// perform parent check
Log::message("%d\n",property->isParent("my_prop"));

Arguments

  • const char * name - Parent property name.

Return value

1 if the property with the given name is a parent of this property; otherwise, 0.

int isParent( const UGUID & guid )

Returns a value indicating if the property with the given GUID is a parent of this property.

Arguments

  • const UGUID & guid - Parent property GUID.

Return value

1 if the property with the given GUID is a parent of this property; otherwise, 0.

int setParent( const Ptr<Property> & property, int save_all_values = 0 )

Sets the given property as the parent for this property and saves the parameter values of the property (if the corresponding flag is set).
Notice
The method is not available for manual and non-editable properties.

Arguments

  • const Ptr<Property> & property - Property to be set as the parent for this property.
  • int save_all_values - Flag indicating if parameter values of the property will be saved after reparenting.

Return value

1 if the given property was successfully set as the parent for this property; otherwise, 0.

void setPath( const char * path )

Sets a new path for the property.

Arguments

  • const char * path - New path to the property file.

void setFileGUID( const UGUID & fileguid )

Sets a new GUID for the property file.

Arguments

  • const UGUID & fileguid - New GUID for the property file.

UGUID getFileGUID( )

Returns the current GUID of the property file.

Return value

GUID of the property file.

const char * getPath( )

Returns a path to the property.

Return value

Path to the property.

Ptr<Property> clone( )

Clones the property. The cloned property won't have a name, a path and won't be displayed in the properties hierarchy.

Return value

Cloned property smart pointer.

Ptr<Property> clone( const char * name, const char * path )

Clones the property and assigns the specified name and path to the clone. The cloned property will be saved to the specified path on saveProperties() call. This method may be used, for example, to create a property missed during project's migration.

Arguments

  • const char * name - Cloned property name.
  • const char * path - Path to save the cloned property.

Return value

Cloned property smart pointer.

Ptr<Property> clone( const char * name, const char * path, const UGUID & guid )

Clones the property and assigns the specified name, GUID and path to the clone. The cloned property will be saved to the specified path on saveProperties() call. This method may be used, for example, to create a property missed during project's migration.

Arguments

  • const char * name - Cloned property name.
  • const char * path - Path to save the cloned property.
  • const UGUID & guid - Cloned property GUID.

Return value

Cloned property smart pointer.

Ptr<Property> clone( const char * name )

Clones the property.
Source code (UnigineScript)
// get a property to be cloned
Properties *properties = Properties::get();
PropertyPtr property = properties->findProperty("surface_base_0");
// clone the property
PropertyPtr cloned = property->clone("cloned_surface_base_0");
// perform something on the cloned pointer
// ...
// delete the pointer
cloned.grab();
cloned.destroy();

Arguments

  • const char * name - Cloned property name.

Return value

Cloned property smart pointer.

void grab( )

Sets the owner flag to 1 for the Property pointer. The Property should not be handled by the class after this function is called

int isOwner( )

Returns the owner flag. If the pointer is the owner, on its deletion the property also will be deleted. Use grab() and release() functions to change ownership.

Return value

The owner flag.

void release( )

Releases the Property (sets the owner flag to 0 for the pointer). The Property should be handled by the class after this function is called.

Ptr<Property> inherit( )

Inherits a new property from this one. The inherited property will be empty: it won't have a name, a path and won't be displayed in the properties hierarchy.

Return value

Inherited property smart pointer.

Ptr<Property> inherit( const char * name )

Inherits a new property from this one and assigns the specified name to it.

Arguments

  • const char * name - Inherited property name.

Return value

Inherited property smart pointer.

Ptr<Property> inherit( const char * name, const char * path )

Inherits a new property from this one and assigns the specified name and path to it. The inherited property will be saved to the specified path on saveProperties() call.

Arguments

  • const char * name - Inherited property name.
  • const char * path - Path to save the inherited property.

Return value

Inherited property smart pointer.

Ptr<Property> inherit( const char * name, const char * path, const UGUID & guid )

Inherits a new property from this one and assigns the specified name, GUID and path to it. The inherited property will be saved to the specified path on saveProperties() call.

Arguments

  • const char * name - Inherited property name.
  • const char * path - Path to save the inherited property.
  • const UGUID & guid - Inherited property GUID.

Return value

Inherited property smart pointer.

int load( )

Loads the property from the file specified by the setPath() function.
Notice
This function can be used to load properties created during application execution or stored outside the data directory.

Return value

1 if the property data is loaded successfully; otherwise, 0.

int load( const char * path )

Loads the property from the specified *.prop file.

Arguments

  • const char * path - Path to the *.prop file to load the property data from.

Return value

1 if the property data is loaded successfully; otherwise, 0.

int loadXml( const Ptr<Xml> & xml )

Loads data of the property (all its parameters) from the given instance of the Xml class.

Arguments

  • const Ptr<Xml> & xml - Xml class instance in which the property data is stored.

Return value

1 if the property data is loaded successfully; otherwise, 0.

int loadWorld( const Ptr<Xml> & xml )

Loads data of the current property (all its options, states and parameters) from the given instance of the Xml class.

Arguments

  • const Ptr<Xml> & xml - Xml class instance in which the property data is stored.

Return value

1 if the property data is loaded successfully; otherwise, 0.

int reload( )

Reloads the property and all its children.

Return value

1 if the property is reloaded successfully; otherwise, 0.

int restoreState( const Ptr<Stream> & stream, int restore_mode = 0 )

Restores the data of the property (all its parameters) from a binary stream in the specified mode.

Arguments

Return value

1 if the property parameter data is restored successfully; otherwise, 0.

int canSaveInFile( )

Returns a value indicating if the property can be saved to a file. For example, this function will return 0 for an internal or manual property.

Return value

1 if the property can be saved to a file; otherwise, 0.

int saveState( const Ptr<Stream> & stream )

Saves data of the current property (all its parameters) into a binary stream.

Arguments

  • const Ptr<Stream> & stream - Stream into which the property data will be saved.

Return value

1 if the property data is saved successfully; otherwise, 0.

int save( )

Saves the property data to the file specified by the setPath() function.
Notice
This method is not available for manual and internal properties.

Return value

1 if the property data is saved successfully; otherwise, 0.

int save( const char * path )

Saves the property data to the specified *.prop file.
Notice
This method is not available for manual properties.

Arguments

  • const char * path - Path to the *.prop file to save the property data to.

Return value

1 if the property data is saved successfully; otherwise, 0.

int saveXml( const Ptr<Xml> & xml )

Saves data of the property (all its parameters) to the given instance of the Xml class.
Notice
This method is not available for manual properties.

Arguments

  • const Ptr<Xml> & xml - Xml class instance into which the property data will be saved.

Return value

1 if the property data is saved successfully; otherwise, 0.

int saveWorld( const Ptr<Xml> & xml, int force = 0 )

Saves data of the current property (all its parameters) into the given instance of the Xml class.

Arguments

  • const Ptr<Xml> & xml - Xml class instance into which the property data will be saved.
  • int force - A value indicating if forced saving of property data is used: 1 to enable forced saving, 0 to disable it.

Return value

1 if the property data is saved successfully; otherwise, 0.

void * addCallback( int callback, Unigine::CallbackBase1< Ptr<Property> > * func )

Adds a callback of the specified type. Callback functions can be used to determine actions to be performed when any changes to the property are made. The signature of the callback function should be as follows:
Source code (C++)
// for all types except for the CALLBACK_PARAMETER_CHANGED
void callback_function_name(PropertyPtr property);
Here is an example of tracking property name change via callbacks:
Source code (C++)
void name_changed(PropertyPtr property)
{
	Log::message("A property has changed its name to \"%s\".\n", property->getName());
    // ...
}

// somewhere in the code

// inheriting a new property named "my_prop" from the base property "surface_base" via the Property Manager
PropertyPtr property = Properties::get()->findManualProperty("surface_base")->inherit("my_prop");

// setting our callback function on renaming a property
property->addCallback(Property::CALLBACK_RENAMED, MakeCallback(name_changed));

// renaming the property
property->setName("new name");

Arguments

  • int callback - Callback type. One of the CALLBACK_* variables.
  • Unigine::CallbackBase1< Ptr<Property> > * func - Callback pointer.

Return value

ID of the last added callback of the specified type, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

void * addCallback( int callback, Unigine::CallbackBase2< Ptr<Property>, int > * func )

Adds a callback of the specified type. Callback functions can be used to determine actions to be performed when any changes to the property are made. The signature of the callback function should be as follows:
Source code (C++)
// for the CALLBACK_PARAMETER_CHANGED type
void callback_function_name(PropertyPtr property, int parameter_num);

Arguments

  • int callback - Callback type. One of the CALLBACK_* variables.
  • Unigine::CallbackBase2< Ptr<Property>, int > * func - Callback pointer.

Return value

ID of the last added callback of the specified type, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

bool removeCallback( int callback, void * id )

Removes the specified callback from the list of callbacks of the specified type. Callback functions can be used to determine actions to be performed when any changes to the property are made.

Arguments

  • int callback - Callback type. One of the CALLBACK_* variables.
  • void * id - Callback ID obtained when adding it.

Return value

True if the callback with the given ID was removed successfully; otherwise false.

void clearCallbacks( int callback )

Clears all added callbacks of the specified type. Callback functions can be used to determine actions to be performed when any changes to the property are made.

Arguments

  • int callback - Callback type. One of the CALLBACK_* variables.

int parameterTypeByName( const char * param_type )

Returns parameter type identifier by the type name specified.

Arguments

  • const char * param_type - Parameter type name.

Return value

Parameter type identifier, one of the PARAMETER_* variables.

const char * parameterNameByType( int param_type )

Returns parameter type name by the type identifier specified.

Arguments

  • int param_type - Parameter type identifier, one of the PARAMETER_* variables.

Return value

Parameter type name.

Ptr<PropertyParameter> getParameterPtr( )

Returns the root property parameter.

You can't iterate through all parameters of the property in a single loop, a recursive function should be used instead:

Source code (C++)
#include <functional>
std::function<void(const PropertyParameterPtr &)> recursive_func = [&, this](const PropertyParameterPtr &p)
{
	for (int i = 0; i < p->getNumChildren(); i++)
	{
		PropertyParameterPtr child = p->getChild(i);
		
		// do something... e.g. print parameter names and values
		Log::message("- %s: %s \n", child->getName(), child->getValueString().get());
		
		recursive_func(child);
	}
};

/* ... */
int AppWorldLogic::init() {
	/* ... */
	
	// getting the root parameter of the property
	PropertyParameterPtr root_parameter = property->getParameterPtr();

	// iterating through all parameters of the property
	recursive_func(root_parameter);
	
	return 1;
}

Return value

Root property parameter smart pointer.

Ptr<PropertyParameter> getParameterPtr( const char * name )

Returns a property parameter by its name.

Arguments

  • const char * name - Property parameter name.

Return value

Property parameter smart pointer.
Notice
This method never returns nullptr, regardless of whether a parameter with the specified name exists or not. It only displays an error message in the console in case of a non-existing parameter. To check if such parameter really exists, use the PropertyParameter.isExists() method. For example:
Source code (C++)
// getting some property named "my_property"
PropertyPtr pProperty = Properties::get()->findManualProperty("my_property");

// trying to get a property parameter named "some_parameter"
PropertyParameterPtr param = pProperty->getParameterPtr("some_parameter");

// checking if such parameter exists and displaying a message
if (param->isExist())
	Log::message("Specified property parameter exists!\n");
else
	Log::message("No such parameter!\n");

Ptr<PropertyParameter> getParameterPtr( int id )

Returns a property parameter by its ID.

Arguments

  • int id - Property parameter ID.

Return value

Property parameter smart pointer.
Notice
This method never returns nullptr, regardless of whether a parameter with the specified ID exists or not. It only displays an error message in the console in case of a non-existing parameter. To check if such parameter really exists, use the PropertyParameter.isExists() method. For example:
Source code (C++)
// getting some property named "my_property"
PropertyPtr pProperty = Properties::get()->findManualProperty("my_property");

// trying to get a property parameter having the ID=30
PropertyParameterPtr param = pProperty->getParameterPtr(30);

// checking if such parameter exists and displaying a message
if (param->isExist())
	Log::message("Property parameter with the specified ID exists!\n");
else
	Log::message("No such parameter!\n");

int getNumStructs( )

Returns the number of structures of the property.

Return value

Number of structures of the property.

int findStruct( const char * name )

Returns the number of the structure with the specified name.

Arguments

  • const char * name - Name of the structure to be found.

Return value

Number of the structure with the specified name, if it exists; otherwise, -1.

const char * getStructName( int num )

Returns the name of the structure with the specified number.

Arguments

  • int num - Structure number.

Return value

Structure name, if such structure exists, otherwise nullptr.
Last update: 2019-01-16
Build: ()