Anim8or Community

General Category => ASL Scripts => Topic started by: BOB_I_Ts on March 13, 2010, 12:38:03 am

Title: !Attributes
Post by: BOB_I_Ts 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 ?
Title: Re: !Attributes
Post by: Kubajzz 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]

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 */
$"$console", "w");
Title: Re: !Attributes
Post by: BOB_I_Ts 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 !
Title: Re: !Attributes
Post by: BOB_I_Ts 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