Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Author Topic: The Plane Primitive  (Read 17070 times)

flametiger74

  • Full Member
  • ***
  • Posts: 152
    • View Profile
The Plane Primitive
« on: January 30, 2008, 08:50:01 pm »

Hey all
I was trying to figure out a script by Tyson Collins (AKA Null) and I was wondering if someone could explain to me some of the things Here's the script I added some questions which are blue. One last thing where does it say in the script which points are where.

#plugin("object", "mesh", "plane"); I understand this it's the name and type
#parameter("side", float, 10.0, 0.001, 99999, scale);I'm guessing this is the parameter
#return($plane); What does return do and how can it do it if  $plane hasn't been declared
#button(17, 25, 2,
    0x00000000, 0x00000000, 0x0fffffff, 0x00010001,
    0x00010001, 0x00010001, 0x00010001, 0x00010001,
    0x00010001, 0x00010001, 0x00010001, 0x00010001,
    0x00010001, 0x00010001, 0x00010001, 0x00010001,
    0x00010001, 0x00010001, 0x0fffffff, 0x00000000,
    0x00000000, 0x00000000, 0x00000000, 0x00000000,
    0x00000000);
shape $plane;   It looks like these are all declaring variables but what are they.
int $side,$i;
point3 $p;
$side = parameter("side");

$plane.Open();
$plane.OpenFace(0,4);
Basicly I don't really get what the rest is saying like what's "TextCoord. and all the other stuff
$p.x = -$side;
$p.y = 0;
$p.z = -$side;
$plane.TexCoordN($plane.AddTexCoord((0,1)));
$plane.VertexN($plane.AddPoint($p));

$p.x = $side;
$p.y = 0;
$p.z = -$side;
$plane.TexCoordN($plane.AddTexCoord((1,1)));
$plane.VertexN($plane.AddPoint($p));

$p.x = $side;
$p.y = 0;
$p.z = $side;
$plane.TexCoordN($plane.AddTexCoord((1,0)));
$plane.VertexN($plane.AddPoint($p));

$p.x = -$side;
$p.y = 0;
$p.z = $side;
$plane.TexCoordN($plane.AddTexCoord((0,0)));
$plane.VertexN($plane.AddPoint($p));

$plane.CloseFace();
$plane.Close();


If someone could please help me I would really appreciate it. Thanks[/glow][/shadow]
« Last Edit: January 30, 2008, 09:18:41 pm by flametiger74 »
Logged

BOB_I_Ts

  • Full Member
  • ***
  • Posts: 157
    • View Profile
    • Anim8rOrg
Re: The Plane Primitive
« Reply #1 on: January 30, 2008, 09:30:37 pm »

Hey all
I was trying to figure out a script by Tyson Collins (AKA Null) and I was wondering if someone could explain to me some of the things Here's the script I added some questions which are blue. One last thing where does it say in the script which points are where.

#plugin("object", "mesh", "plane"); I understand this it's the name and type
#parameter("side", float, 10.0, 0.001, 99999, scale);this parameter are mouse rules for the shape 1st is name for the dialog 2nd parameters is type of counter used 3rd is default/start scale 4th is min scale 5th max scale and last parameter tells animator to scale object
optional 7th can be added to locked to x,y or z scale per viewpoint when using non-unform scale tool by adding for example edit line "scale,scale_y);" at the end

#return($plane); this declares the object
#button(17, 25, 2,
    0x00000000, 0x00000000, 0x0fffffff, 0x00010001,
    0x00010001, 0x00010001, 0x00010001, 0x00010001,
    0x00010001, 0x00010001, 0x00010001, 0x00010001,
    0x00010001, 0x00010001, 0x00010001, 0x00010001,
    0x00010001, 0x00010001, 0x0fffffff, 0x00000000,
    0x00000000, 0x00000000, 0x00000000, 0x00000000,
    0x00000000);
shape $plane;   these are the elements/counters used in the script
int $side,$i;
point3 $p;
$side = parameter("side");

$plane.Open();
$plane.OpenFace(0,4);
TextCoord are the U,V texture coordinates fixed to the point textcoord must be set before the point is drawn
$p.x = -$side;
$p.y = 0;
$p.z = -$side;
$plane.TexCoordN($plane.AddTexCoord((0,1)));
$plane.VertexN($plane.AddPoint($p));

$p.x = $side;
$p.y = 0;
$p.z = -$side;
$plane.TexCoordN($plane.AddTexCoord((1,1)));
$plane.VertexN($plane.AddPoint($p));

$p.x = $side;
$p.y = 0;
$p.z = $side;
$plane.TexCoordN($plane.AddTexCoord((1,0)));
$plane.VertexN($plane.AddPoint($p));

$p.x = -$side;
$p.y = 0;
$p.z = $side;
$plane.TexCoordN($plane.AddTexCoord((0,0)));
$plane.VertexN($plane.AddPoint($p));

$plane.CloseFace();
$plane.Close();


If someone could please help me I would really appreciate it. Thanks
maybe of interest i did shape based from Tysons script uvblock.an8 which shows use of the scale_# parameter were you can change the uv of the block using xy of non-unform scale tool or hold right mouse down to scale shape "z" from front view
Remember to apply a texture to block after  ;D
« Last Edit: January 30, 2008, 09:36:44 pm by BOB_I_Ts »
Logged

flametiger74

  • Full Member
  • ***
  • Posts: 152
    • View Profile
Re: The Plane Primitive
« Reply #2 on: January 30, 2008, 10:28:27 pm »

Thanks but that dosn't really help me understand parametive scripts
Logged

vobla

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: The Plane Primitive
« Reply #3 on: January 31, 2008, 07:28:02 am »

#parameter("side", float, 10.0, 0.001, 99999, scale);I'm guessing this is the parameter
That is correct.
side - param name;
float - type;
10.0 - min value;
0.001 - min step;
99999 - max value;
scale - scale parameter (aparantly non uniform scale wont be available on this obj, couse author use side for width and for length).

#return($plane);
It's return value. At the end of the script this value wil be passed back to Anim8tor. It's not initialized yet.. Hmm.. My gues, that you pass name of the variable, which you sould initialize later. Other wise "#return(..)" or smthng like that would be normaly at the end of the script.

shape $plane;
point3 $p;
point3 like shape is a structured type variable type. It has three floating point values. $i has $i.x, $i.y and $i.z (point 3d coordinates).
shape has loc is a point3 type property - it hold the location of the shape. shape also has some methods..

You can read more http://www.anim8or.com/scripts/spec/Anim8or_Scripting_Language.html
veeeerrry useful :)

Basicly I don't really get what the rest is saying like what's "TextCoord. and all the other stuff
$p.x = -$side;
$p.y = 0;
$p.z = -$side;
$plane.TexCoordN($plane.AddTexCoord((0,1)));
$plane.VertexN($plane.AddPoint($p));

Ok, first three lines set the point $p properties - x, y and z.
$plane wich is the shape type has some methods. I will rewrite last two lines more elegant and explain it step by step:

int $point_index;
shape $plane;
point3 $p;

[..........]

$point_index = $plane.AddTexCoord(0, 1);   // Add new texture coordinates to a point (we get the new point index)..

$plane.TexCoordsN($point_index);   // We use $point_index to actually set the added texture coords. More info for texture coords in general: http://paulyg.f2s.com/uv.htm

$point_index = $plane.AddPoint($p);   // We add point to the plane and get integer value - added point index - as a return value;

$plane.VertexN($point_index);   // Draw the added point.

So, basicly we have to set point parameters and then draw it..


Cheers ;)
Logged