Xpressionist gives you the ability to create objects for your project. These objects are cameras, lights, effectors, illuminators and smokers.
The create function can be accessed via the Functions menu. A create function looks like this:
create_objecttype( "name", "parent", position, object_specific_attribute )
We will start with something simple, the creation of a radial light. Create a new project and add Xpressionist. Choose "light: radial" from the create function menu. The create function for a radial light will be inserted at the current cursor position:
create_radiallight( "name", "parent", position);
As you see this function has three default arguments: "name", "parent" and position. These words are place holders that tell you what type of value to insert at which position within the brackets. If you execute this function as is with the Update Project button or the Check Syntax button you will get an error, since the place holder arguments have no real value, or no values are assigned to them. Xpressionist expects a vector where the word position is in the function. So to use this function you need to fill it with a meaning. You need to insert a vector to tell Xpressionist at which position to create the light:
create_radiallight( "name", "parent", vec( 10, 10, 10 ) );
This tells Xpressionisst to create the light at the position X = 10, Y = 10 and Z = 10 within Animators world space. The next argument we will examine is "name". Right, here you can enter a string that will be used as a name for your newly created object. If we want to name this radial light "sun" we need to insert "sun" as a name argument:
create_radiallight( "sun", "parent", vec( 10 , 10, 10 ) );
This will create a light with the name "sun" at the position X = 10, Y = 10 and Z = 10 of your world coordinate system, but not yet. We finally need to take care of the second argument which is "parent". With this second argument you can link the newly created object to another object in the scene. Just enter the name of the desired parent object within the double quotes and Xpressionist will create this object as a child of that parent object. To create the object in the first hierachic level just leave the parent argument blank - just use double quotes without anything between them:
create_radiallight( "sun", "", vec( 10, 10, 10 ) );
If you now hit the Update Project button Xpressionist will create a radial light with the name sun at X = 10, Y = 10 and Z = 10 on the first hierachic level of the project window.
Delete the sun light that you have just created. Now enter Xpressionist and change the stament to this:
create_radiallight( "sun", "Camera_1", vec( 10, 10, 10 ) );
Hit the Update Project button. Now if you close the Xpressionist window you will notice that a radial light with the name "sun" has been added to the default Camera 1 object as a child object. Also note that now the position argument acts like a parent offset. The object will be placed at X = 10, Y = 10 and Z = 10 relative to its parent object and not relative to the world origin. Now lets try to create three objects that are linked together:
create_radiallight( "sun_1", "", vec( 10, 10, 10 ) );
create_radiallight( "sun_2", "sun_1", vec( 10, 10, 10 ) );
 create_radiallight( "sun_3", "sun_2", vec( 10, 10, 10 ) );
The first statement creates a light with the name "sun_1". The second statement creates a light with the name "sun_2" as a child of "sun_1". The third statement crates a light with the name "sun_3" as a child of "sun_2". I have shifted the statements one tab to the right each to make the hierachial structure visible in the script - it also works if written just in a row of course.
Summary
In this section, you learned how to:
- create an object with a create function
- use the "name" argument to give your object a name
- use the "parent" argument to link your object to other objects or to create entire hierarchies
- use the position argument to place your object in the scene or to offset it from its parent
Continue on next page ->
|