Contents |
Blocks can be created by calling their factory functions. A list of all available factory functions is returned by GetFactories:
table sceng.GetFactories()
Then, just call the factory function and it will create a LuaBlock for that scene entity:
shader_material = sceng.ShaderMaterial()
In Lua, Objects are linked to their nodes in a single LuaBlock. This means that a function like:
box_object = sceng.BoxObject()
Actually creates both, the BoxObject, and the Node that holds this BoxObject.
All SceneEngine Blocks have a common access interface. This is a set of functions that return and modify all Block properties.
The main syntax to get and set a Block property is:
lua_block:Set( text property_name, value ) value lua_block:Get( text property_name )
The property_name is a text string that identifies the property, so for example:
box_object:Set( "width", 10.0 )
Sets the width of the box to 10.0.
The function GetInterface returns a table with the names of all variables that set and get values for a given Block:
box_object:GetInterface() returns : { "width", "height", "length", "width_subdivs", ... "name", "position", "material" }
GetInterface, Set and Get functions actually access and modify different types of data in SceneEngine.
Complex scenes are built by interconnecting many SceneEngine blocks together. In SceneEngine the connections go one way, always from.
box_object:Set( "material", shader_material )
A special dependency case is the DataTable, which holds all the attributes.
Attributes are
In ScEngLua, dependencies and attributes can be queried, set and get using the GetInterface, Set and Get functions: