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: !Attributes  (Read 9758 times)

BOB_I_Ts

  • Full Member
  • ***
  • Posts: 157
    • View Profile
    • Anim8rOrg
!Attributes
« on: March 13, 2010, 12:38:03 am »

I notice attributes editor in anim8or see that it is use for rendering.

can attributes be used to change values in asl scripts as well if plugin required more than 10 parameters ?
Logged

Kubajzz

  • Flying Platypus
  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 548
  • Little doggie ate my avatar...
    • View Profile
Re: !Attributes
« Reply #1 on: March 13, 2010, 01:48:33 pm »

Yes. Check the "attribute" type and the "object.GetAttribute()" and "object.LookUpAttribute()" functions.

Here is a very, very simple example of a script that gets its input from an attribute:
Code: [Select]
#command("object");

attribute $Attr;
string $UserInput;
file $Output;

/* Get value from an attribute */
$Attr = project.curObject.LookupAttribute("AttributeNameHere");
if ($Attr != NULL) {
  $UserInput = $Attr.GetStringValue();
}

/* Print it to the console */
$Output.open("$console", "w");
$Output.print($UserInput);
$Output.close();
Logged

BOB_I_Ts

  • Full Member
  • ***
  • Posts: 157
    • View Profile
    • Anim8rOrg
Re: !Attributes
« Reply #2 on: March 14, 2010, 03:23:45 am »

Good when finish revising some old scripts im imagining somthing like a face generation primitive were attributes will reform facial regions ... but not just just yet so fare i only managed to decrease old pi script from 195 to 88 lines in notepad excluding u,v which i think was  ratio 1.0 from bottom left  = 0,0 to top right 1,1 !
Logged

BOB_I_Ts

  • Full Member
  • ***
  • Posts: 157
    • View Profile
    • Anim8rOrg
Re: !Attributes
« Reply #3 on: April 25, 2010, 02:27:06 pm »

i seem have mini issue with update of values changing
i remove the parameters then i put following (below) change into this script.a8s
 
Code: [Select]
int $index[9999],$i,$check;
point3 $p,$ap;
attribute $attr;

for $check = 0 to 2 do {
if ($check == 0) {
$attr = project.curObject.LookupAttribute("nose");
$ap = $attr.GetPoint3Value();
$a0 = $ap.x;
$a1 = $ap.y;
$a2 = $ap.z;
}
if ($check == 1) {
$attr = project.curObject.LookupAttribute("mouth");
$ap = $attr.GetPoint3Value();
$a3 = $ap.x;
$a4 = $ap.y;
$a5 = $ap.z;
}
if ($check == 2) {
$attr = project.curObject.LookupAttribute("jaw");
$ap = $attr.GetPoint3Value();
$a6 = $ap.x;
$a7 = $ap.y;
$a8 = $ap.z;
}
}

So i create object add attributes in editor nose , mouth and  jaw then set them all to "point" every thing works fine with values ,But issue is no change happen on the model untill i double click the model and click the ok button ,is there way to update script

This refresh(); function im unsure about returns invariant error no matter were i put it meh
Logged