Eden Editor: Configuring Attributes: Difference between revisions
Categories: Eden EditorEden Editor: Modding
|  (Created page with "WIP Entity Attributes: Modding Entity Attributes: Modding") | mNo edit summary | ||
| Line 1: | Line 1: | ||
| === Config === | |||
| <syntaxhighlight lang="cpp">class Cfg3DEN | |||
| { | |||
| 	// Configuration of all objects | |||
| 	class Object | |||
| 	{ | |||
| 		// Categories collapsible in "Edit Attributes" window | |||
| 		class AttributeCategories | |||
| 		{ | |||
| 			// Category class, can be anything | |||
| 			class MyCategory | |||
| 			{ | |||
| 				displayName = "Object Init"; // Category name visible in Edit Attributes window | |||
| 				collapsed = 1; // When 1, the category is collapsed by default | |||
| 				class Attributes | |||
| 				{ | |||
| 					// Attribute class, can be anything | |||
| 					class MyAttribute | |||
| 					{ | |||
| 						property = "MyAttribute"; // Unique config property name saved in SQM | |||
| 						control = "Edit"; // UI control base class displayed in Edit Attributes window, points to Cfg3DEN >> Attributes | |||
| 						unique = 0; // When 1, only one entity of the type can have the value in the mission (used for example for variable names or player control) | |||
| 						validate = "code"; // Validate the value before saving. Can be "none", "expression", "condition", "number" or "variable" | |||
| 						condition = "object"; // Condition for attribute to appear. | |||
| 						// Expression called when applying the attribute in Eden and at the scenario start | |||
| 						// Entity is passed as _this, value is passed as _value, property name is passed as _property | |||
| 						// %s is replaced by attribute config name. It can be used only once in the expression | |||
| 						expression = "_this setVariable [%s,_value];"; | |||
| 						// Expression called when custom property is undefined yet (i.e., when setting the attribute for the first time) | |||
| 						// Entity is passed as _this | |||
| 						// Returned value is the default value | |||
| 						// Used when no value is returned, or when it's of other type than NUMBER, STRING or ARRAY | |||
| 						// Custom attributes of logic entities (e.g., modules) are saved always, even when they have default value | |||
| 						defaultValue = "42"; | |||
| 					}; | |||
| 				}; | |||
| 			}; | |||
| 		}; | |||
| 	}; | |||
| }; | |||
| </syntaxhighlight> | |||
| === Conditions === | |||
| === Lists === | |||
| === Data Validation === | |||
| == Scripting Commands == | |||
| == Event Handlers == | |||
| [[Category:Eden Editor|Entity Attributes: Modding]] | [[Category:Eden Editor|Entity Attributes: Modding]] | ||
| [[Category:Eden Editor: Modding|Entity Attributes: Modding]] | [[Category:Eden Editor: Modding|Entity Attributes: Modding]] | ||
Revision as of 15:45, 3 November 2015
Config
class Cfg3DEN
{
	// Configuration of all objects
	class Object
	{
		// Categories collapsible in "Edit Attributes" window
		class AttributeCategories
		{
			// Category class, can be anything
			class MyCategory
			{
				displayName = "Object Init"; // Category name visible in Edit Attributes window
				collapsed = 1; // When 1, the category is collapsed by default
				class Attributes
				{
					// Attribute class, can be anything
					class MyAttribute
					{
						property = "MyAttribute"; // Unique config property name saved in SQM
						control = "Edit"; // UI control base class displayed in Edit Attributes window, points to Cfg3DEN >> Attributes
						unique = 0; // When 1, only one entity of the type can have the value in the mission (used for example for variable names or player control)
						validate = "code"; // Validate the value before saving. Can be "none", "expression", "condition", "number" or "variable"
						condition = "object"; // Condition for attribute to appear.
						// Expression called when applying the attribute in Eden and at the scenario start
						// Entity is passed as _this, value is passed as _value, property name is passed as _property
						// %s is replaced by attribute config name. It can be used only once in the expression
						expression = "_this setVariable [%s,_value];";
						// Expression called when custom property is undefined yet (i.e., when setting the attribute for the first time)
						// Entity is passed as _this
						// Returned value is the default value
						// Used when no value is returned, or when it's of other type than NUMBER, STRING or ARRAY
						// Custom attributes of logic entities (e.g., modules) are saved always, even when they have default value
						defaultValue = "42";
					};
				};
			};
		};
	};
};
