XSIforum.com

octopus rig

0 Usuarios y 2 Visitantes están viendo este tema.

Epar

octopus rig
« en: 04 Septiembre 2008, 20:52:28 »
A ver,...el otro día encontré este script, que según entendí crea el rig para un pulpo (la verdad que que no había ninguna información, solo el script que adjunto).
....pero no lo consigo hacer funcionar: ya en la primera linea dice que falta una instrucción... :o

....como estoy muy pez en esto de los scripts, lo subo para que lo probéis y ver si alguien lo hace funcionar.....si es que funciona.




Example: Making an Octopus Rig

This example build an octopus rig. It consists of:

• A head component (MakeHead command)

• Eight tail components for the tentacles (MakeTail command)

• A few rig icon components for controls (MakeRigIcon command).

A collections of guide nulls are passed to each command to position the elements.

// build list of guide object positions and names
BuildGuideArrays();

var Octopus = new Object();

/////////////////////
// MAKE MODEL AND GLOBAL SRT ICON
/////////////////////
Octopus.Model = ActiveSceneRoot.AddModel();
Octopus.Model.Name = "Octopus"
Octopus.GlobalSRT = makeRigIcon(Octopus.Model, 4,
                                 0,0,0,    //position
                                 1,1,1,    //icon length,width,height
                                 893,      //color
                                 "GlobalSRT"  //name
                     );

//Make the main octopus controller
Octopus.BodyCtrl = makeRigIcon(Octopus.GlobalSRT, 2,
                                 0,4.5,0,  //position
                                 5,1.4,5,    //icon length,width,height
                                 253,      //color
                                 "BodyCtrl"  //name
                     );

                     //Make the tentacle control (manipulate to settle the tentacles)
Octopus.TentacleCtrl = makeRigIcon(Octopus.BodyCtrl, 2,
                                 0,4.5,0,  //position
                                 2.5,1,2.5,    //icon length,width,height
                                 49,       //color
                                 "TentacleCtrl"  //name
                     );

Octopus.TentacleCtrl.Kinematics.AddConstraint("Pose",Octopus.BodyCtrl,true);


          /////////////////////
// MAKE THE HEAD
/////////////////////
guidecoll = CreateGuideColl(guidepos, guidename, Array(0,1,2)); 

                     Octopus.Head = MakeHead(Octopus.BodyCtrl, //head parent
                     guidecoll,    //guide collection
                     "Octo",            //object name prefix
                     1,                //spine head and neck
                     0,                //head type (ignored unless creating box shadow)
                     3,                 //number of vertebrae
                     1,                 //stretch spine
                     null,         //spine sliders
                     null,         //ear guide collection
                     0,                 //shadow type
                     null);        //shadow parent

                     DeleteObj( guidecoll );

/////////////////////
// MAKE THE TENTACLES
/////////////////////

guidecoll = CreateGuideColl(guidepos, guidename, Array(3,4,5,6,7)); 

   var lXfm = XSIMath.CreateTransform();
   lXfm.SetIdentity();
   lXfm.SetRotationFromXYZAnglesValues(0,2*3.1415/8,0);

   Octopus.Tentacles = new Array();

   for(i=0;i<8;i++)
   {
       OffsetGuideColl(guidecoll, lXfm);
       Octopus.Tentacles = MakeTail(Octopus.BodyCtrl, //head parent
                            guidecoll,      //guide collection
                            6,              //number of bones
                            0,              //shadow type
                            null);          //shadow parent

        Octopus.Tentacles.Root.Kinematics.AddConstraint("Pose",Octopus.TentacleCtrl,true);
   }


DeleteObj( guidecoll );

Translate(Octopus.BodyCtrl, 0, 2, 0, siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null, 0);

//----------------------------------------------
// Builds an array of guide positions and names
//----------------------------------------------
function BuildGuideArrays()
{

   guidepos  = new Array();
   guidename = new Array();


   for (i=0;i<33;i++)
   {
       guidepos = XSIMath.CreateVector3();
   }

   i=0;

   //0 to 2
   guidepos.Set(0,5,0); guidename[i++] = "SpineBase";
   guidepos.Set(0,7,0); guidename[i++] = "SpineBaseDepth";
   guidepos.Set(0,9,0); guidename[i++] = "SpineEndDepth";

   //3 to 7
   guidepos.Set(1,5,0); guidename[i++] = "TentacleBase";
   guidepos.Set(3,5,0); guidename[i++] = "Tentacle1";
   guidepos.Set(5,5,0); guidename[i++] = "Tentacle2";
   guidepos.Set(7,5,0); guidename[i++] = "Tentacle3";
   guidepos.Set(9,5,0); guidename[i++] = "TentacleTip";

   }

//-------------------------------------------------------
// From array of positions and names created in BuildGuideArrays(),
// create a collection of guide nulls
//-------------------------------------------------------
function CreateGuideColl( in_aGuidePositions, in_aGuideNames, in_Indices)
{

   var lXfm = XSIMath.CreateTransform();
   var guidecoll = new ActiveXObject("XSI.Collection");

   var idx;
   for(idx=0; idx<in_Indices.length; idx++)
   {
//     logmessage(in_Indices[idx] + "  " + in_aGuideNames[in_Indices[idx]]);
       guidecoll.Add( GetPrim("Null", in_aGuideNames[in_Indices[idx]]) );
       lXfm.SetTranslation(in_aGuidePositions[in_Indices[idx]]);
       guidecoll(idx).Kinematics.Global.Transform = lXfm;
   }

   return guidecoll;
}

function OffsetGuideColl( in_GuideColl, in_OffsetXfo)
{
   var GuideXfm, idx;
   for(idx=0; idx<in_GuideColl.count; idx++)
   {
       GuideXfm = in_GuideColl(idx).Kinematics.Global.Transform;
       GuideXfm.Mul(GuideXfm,in_OffsetXfo);
       in_GuideColl(idx).Kinematics.Global.Transform = GuideXfm;
   }
}

eduardito

  • *****
  • 3064
  • hola holita
Re: octopus rig
« Respuesta #1 en: 04 Septiembre 2008, 21:11:12 »
podrias poner el fallo que te da?

Epar

Re: octopus rig
« Respuesta #2 en: 04 Septiembre 2008, 21:21:16 »
Es que ahora tengo la maquina renderizando si no pondría una captura.
Pero en resumidas cuentas al iniciarlo se queda parado y sale un mensaje diciendo algo así como: fin de la instrucción, se esperaba una... orden (?).
Y esta remarcado en rojo la primera  linea. Así que la borré y lo volví a iniciar...y sale el mismo mensaje en la linea dos..

...y así hasta que lo di por perdido.

No se, falta algo..igual una coma, un espacio...no se.

eduardito

  • *****
  • 3064
  • hola holita
Re: octopus rig
« Respuesta #3 en: 04 Septiembre 2008, 21:50:07 »
cuando puedas, pega el error tal cual sale.

Epar

Re: octopus rig
« Respuesta #4 en: 04 Septiembre 2008, 22:03:15 »
cuando puedas, pega el error tal cual sale.
No hay problema...pero para que esperar?
Pruebalo tu mismo, te tiene que dar el mismo error.

eduardito

  • *****
  • 3064
  • hola holita
Re: octopus rig
« Respuesta #5 en: 04 Septiembre 2008, 22:17:36 »
si pudiese lo haria pero no tengo el xsi aqui ahora mismo, sino ya lo hubiese probado. O0

Tomás

  • O_O
  • *****
  • 4621
  • Mi no entender
Re: octopus rig
« Respuesta #6 en: 04 Septiembre 2008, 22:47:27 »
Por cierto nunca peguéis código tal cual, utilizar el tag code . Suele alterarse el código y reemplazarse algunas cadenas.

Epar

Re: octopus rig
« Respuesta #7 en: 04 Septiembre 2008, 23:01:58 »
Aquí esta el error,...desde la primera linea, osea, que ni arranca (en la imagen ya he hecho tres intentos, como se puede apreciar)

Re: octopus rig
« Respuesta #8 en: 05 Septiembre 2008, 05:17:14 »
Tienes que cambiar el lenguaje a jscript, actualmente estás usando vbscript y por ende no "entiende" la sintaxis del script :)

Epar

Re: octopus rig
« Respuesta #9 en: 05 Septiembre 2008, 08:49:42 »
Tienes que cambiar el lenguaje a jscript, actualmente estás usando vbscript y por ende no "entiende" la sintaxis del script :)
Tomo nota.
Gracias