tsShapeConstruct.cpp
Engine/source/ts/tsShapeConstruct.cpp
Public Defines
define
CHECK_INDEX_IN_RANGE(func, index, maxIndex, ret) ( ( index < 0 ) || ( index >= maxIndex ) ) \ { \ ( "TSShapeConstructor::" #func ": index out of " \ "range (0-%d)", maxIndex-1); \ return ret; \ }
define
GET_MESH(func, var, name, ret) * var = mShape->findMesh(name); \ (!var) \ { \ ( "TSShapeConstructor::" #func ": Could not " \ "mesh '%s'", name); \ return ret; \ }
define
GET_NODE_INDEX_ALLOW_ROOT(func, var, name, ret) var##Index = -1; \ (name[0]) \ { \ var##Index = mShape->findNode(name); \ (var##Index < 0) \ { \ ( "TSShapeConstructor::" #func ": Could not " \ " node '%s'", name); \ return ret; \ } \ } \ * var = var##Index < 0 ? : &(mShape->nodes[var##Index]); \ (var##Index); \ (var)
define
GET_NODE_INDEX_NO_ROOT(func, var, name, ret) var##Index = mShape->findNode(name); \ (var##Index < 0) \ { \ ( "TSShapeConstructor::" #func ": Could not " \ "node '%s'", name); \ return ret; \ } \ * var = &(mShape->nodes[var##Index]); \ (var##Index); \ (var)
define
GET_OBJECT(func, var, name, ret) var##Index = mShape->findObject(name); \ (var##Index < 0) \ { \ ( "TSShapeConstructor::" #func ": Could not " \ "object '%s'", name); \ return ret; \ } \ * var = &(mShape->objects[var##Index]); \ (var##Index); \ (var)
define
GET_SEQUENCE(func, var, name, ret) var##Index = mShape->findSequence(name); \ (var##Index < 0) \ { \ ( "TSShapeConstructor::" #func ": Could not " \ "sequence named '%s'", name); \ return ret; \ } \ * var = &(mShape->sequences[var##Index]); \ (var##Index); \ (var);
define
MAX_PATH_LENGTH() 256
define
RETURN_IF_MATCH(type) (!(name, #type)) return Cmd##type
Public Variables
Called when the DTS or DAE resource is flushed from memory Not normally
Public Functions
ConsoleDocClass(TSShapeConstructor , "@brief An object used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> modify a DTS or COLLADA shape model after it has " "been loaded by <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Torque\n\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">gameObjects\n</a>" )
TiXmlElement *
createNodeWithText(const char * name, const char * text)
DefineTSShapeConstructorMethod(addImposter , S32 , (S32 size, S32 equatorSteps, S32 polarSteps, S32 dl, S32 dim, bool includePoles, F32 polarAngle) , (size, equatorSteps, polarSteps, dl, dim, includePoles, polarAngle) , - 1, "Add (or edit) an imposter detail level <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "If the shape already contains an imposter detail level, this command will " "simply change the imposter <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">settings\n</a>" " @param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of the imposter detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" " @param equatorSteps defines the number of snapshots <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> take around the " "equator. Imagine the object being rotated around the vertical axis, then " "a snapshot taken at regularly spaced <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">intervals.\n</a>" " @param polarSteps defines the number of snapshots taken between the poles " " , at each equator step. eg. At each equator snapshot, " "snapshots are taken at regular intervals between the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">poles.\n</a>" " @param dl the detail level <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use when generating the snapshots. Note that " "this is an array index rather than a detail size. So <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> an object has detail " "sizes of:200 , 150 , and 40, then setting @a dl <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 1 will generate the snapshots " "using detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> 150.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @param dim defines the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of the imposter images in pixels. The larger the " " number, the more detailed the billboard will <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">be.\n</a>" " @param includePoles flag indicating whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> include the \"pole\" snapshots. " "ie. the views from the top and bottom of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n</a>" "@param polar_angle <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> pole snapshots are active , this " "parameter defines the camera angle(in degrees) within which <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> render the " "pole snapshot. eg. <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> polar_angle is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 25 degrees, then the snapshot " "taken at the pole(looking directly down or up at the object) will be rendered " "when the camera is within 25 degrees of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">pole.\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.addImposter(2, 4, 0, 0, 64, false, 0);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "%this.addImposter(2, 4, 2, 0, 64, true, 10);//this command would edit the existing imposter detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(addMesh , bool , (const char *meshName, const char *srcShape, const char *srcMesh) , (meshName, srcShape, srcMesh) , false , "Add geometry from another DTS or DAE shape <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> into this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "Any materials <a href="/coding/file/tsshapeconstruct_8cpp/#tsshapeconstruct_8cpp_1a21625ca11566389388a748ad1acc0990">required</a> by the source mesh are also copied into this shape.<br>\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param meshName full name (object name + detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a>) of the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> mesh. If " "no detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> is present at the end of the name, a value of 2 is used.< br >" "An underscore before the number at the end of the name will be interpreted as " "a negative sign. eg. \"MyMesh_4\" will be interpreted as \"MyMesh-4\".\n" "@param srcShape name of a shape <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> (DTS or DAE) that contains the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mesh\n</a>" "@param srcMesh the full name (object name + detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a>) of the mesh <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> " "copy from the DTS/DAE <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> into this shape</li>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.addMesh(\"ColMesh-1\", \"./collision.dts\", \"ColMesh\", \"Col-1\" );\n" "%this.addMesh( \"SimpleShape10\", \"./testShape.dae\", \"MyMesh2\", "" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(addNode , bool , (const char *name, const char *parentName, TransformF txfm, bool isWorld) , (TransformF::Identity, false) , (name, parentName, txfm, isWorld) , false , "Add a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n</a>" "@param name name <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> node , the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> node will be at the root level of the node <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">hierarchy.\n</a>" " @param txfm(optional) transform string of the form:\"pos.x pos.y pos.z rot.x rot.y rot.z rot.angle\"\n" "@param isworld (optional) flag <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set the local-<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a>-parent or the global " "transform. If false, or not specified, the position and orientation are " "treated as relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the node 's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">parent.\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.addNode(\"Nose\", \"Bip01 Head\", \"0 2 2 0 0 1 0\" );\n" "%this.addNode( \"myRoot\", \"\", \"0 0 4 0 0 1 1.57\" );\n" "%this.addNode( \"Nodes\", \"Bip01 Head\", \"0 2 0 0 0 1 0\", true );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(addSequence , bool , (const char *source, const char *name, S32 start, S32 end, bool padRot, bool padTrans) , (0, -1, true, false) , (source, name, start, end, padRot, padTrans) , false , "Add a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "@param source the name of an existing sequence, or the name of a DTS or DAE " "shape or DSQ sequence file. When the shape <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> contains more than one " " sequence, the desired sequence can be specified by appending the name <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the " "end of the shape file. eg. \"myShape.dts run\" would select the \"run\" " "sequence from the \"myShape.dts\" file.\n\n" "@param name name of the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence\n</a>" "@param start (optional) first frame <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> copy. Defaults <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 0, the first frame in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" " @param end(optional) last frame <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> copy. Defaults <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> - 1, the last frame in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" " @param padRot(optional) copy root-pose rotation keys <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> non-animated nodes. This is useful <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> " "the source sequence data has a different root-pose <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the target shape, such as <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> one character was " "in the <a href="/coding/group/group__engineapi__types/#group__engineapi__types_1ga16a0f7e7053a679c9bf4289b441a2be7">T</a> pose, and the other had arms at the side. Normally only nodes that are actually rotated by " "the source sequence have keyframes added, but setting this flag will also add keyframes <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> nodes " "that are not animated, but have a different root-pose rotation <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the target shape root <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">pose.\n</a>" " @param padTrans(optional) copy root-pose translation keys <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> non-animated nodes. This is useful <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> " "the source sequence data has a different root-pose <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the target shape, such as <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> one character was " "in the <a href="/coding/group/group__engineapi__types/#group__engineapi__types_1ga16a0f7e7053a679c9bf4289b441a2be7">T</a> pose, and the other had arms at the side. Normally only nodes that are actually moved by " "the source sequence have keyframes added, but setting this flag will also add keyframes <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> nodes " "that are not animated, but have a different root-pose position <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the target shape root <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">pose.\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.addSequence(\"./testShape.dts ambient\", \"ambient\" );\n" "%this.addSequence( \"./myPlayer.dae run\", \"run\" );\n" "%this.addSequence( \"./player_look.dsq\", \"look\", 0, -1 ); // start <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">end\n</a>" "%this.addSequence( \"walk\", \"walk_shortA\", 0, 4 ); // start <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> frame 4\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "%this.addSequence( \"walk\", \"walk_shortB\", 4, -1 ); // frame 4 <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">end\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(addTrigger , bool , (const char *name, S32 keyframe, S32 state) , (name, keyframe, state) , false , "Add a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> trigger <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param keyframe keyframe of the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">trigger\n</a>" "@param state of the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">trigger\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.addTrigger(\"walk\", 3, 1 );\n" "%this.addTrigger( \"walk\", 5, -1 );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(dumpShape , void , (const char *filename) , ("") , (filename) , "Dump the shape hierarchy <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the console or <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> a file. Useful <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> reviewing " "the result of a series of construction <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">commands.\n</a>" "@param filename Destination filename. If not specified, dump <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">console.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.dumpShape();//dump <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">console\n</a>" "%this.dumpShape(\"./dump.txt\" ); // dump <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getBounds , Box3F , () , () , Box3F::Invalid , "Get the bounding box <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "@return Bounding box \"minX minY minZ maxX maxY maxZ\"" )
DefineTSShapeConstructorMethod(getDetailLevelCount , S32 , () , () , 0 , "Get the total number of detail levels in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "@return the number of detail levels in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape\n</a>" )
DefineTSShapeConstructorMethod(getDetailLevelIndex , S32 , (S32 size) , (size) , - 1, "Get the index of the detail level with a given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">size.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of the detail level <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">lookup\n</a>" "@return index of the detail level with the desired size, or -1 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> no such " "detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">exists\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a>(%this.getDetailLevelSize(32)==-1)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " <a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>(\"Error: This shape does not have a detail level at <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> 32\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getDetailLevelName , const char * , (S32 index) , (index) , "" )
DefineTSShapeConstructorMethod(getDetailLevelSize , S32 , (S32 index) , (index) , 0 )
DefineTSShapeConstructorMethod(getImposterDetailLevel , S32 , () , () , - 1, "Get the index of the imposter (auto-billboard) detail level (<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> any).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return imposter detail level index, or -1 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the shape does not use " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">imposters.\n\n</a>" )
DefineTSShapeConstructorMethod(getImposterSettings , const char * , (S32 index) , (index) , "" )
DefineTSShapeConstructorMethod(getMeshCount , S32 , (const char *name) , (name) , 0 )
DefineTSShapeConstructorMethod(getMeshMaterial , const char * , (const char *name) , (name) , "" , "Get the name of the material attached <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> a mesh. Note that only the first " "material used by the mesh is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">returned.\n</a>" "@param name full name (object name + detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a>) of the mesh <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return name of the material attached <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the mesh (suitable <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> use with the <a href="/coding/class/classmaterial/">Material</a> mapTo field)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>( \"Mesh material is \" @ %this.sgetMeshMaterial( \"SimpleShape128\" ) );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getMeshName , const char * , (const char *name, S32 index) , (name, index) , "" )
DefineTSShapeConstructorMethod(getMeshSize , S32 , (const char *name, S32 index) , (name, index) , - 1, "Get the detail level <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of the indexed mesh <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n</a>" "@param name name of the object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@param index index of the mesh (valid range is 0 - getMeshCount()-1)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return the mesh detail level <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">size.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// print sizes <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> all detail levels of this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "% objName)
DefineTSShapeConstructorMethod(getMeshType , const char * , (const char *name) , (name) , "" , "Get the display type of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mesh.\n</a>" "@param name name of the mesh <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the string returned is one of:" "<dl><dt>normal</dt><dd>a normal 3D mesh</dd>" "<dt>billboard</dt><dd>a mesh that always faces the camera</dd>" "<dt>billboardzaxis</dt><dd>a mesh that always faces the camera in the Z-axis</dd></dl>\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>( \"Mesh type is \" @ %this.getMeshType( \"SimpleShape128\" ) );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getNodeChildCount , S32 , (const char *name) , (name) , 0 )
DefineTSShapeConstructorMethod(getNodeChildName , const char * , (const char *name, S32 index) , (name, index) , "" , "Get the name of the indexed child <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n</a>" "@param name name of the parent node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query.\n</a>" "@param index index of the child node (valid range is 0 - getNodeChildName()-1).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return the name of the indexed child <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "function dumpNode( %shape, %name, %indent )\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " <a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>( %indent @ %name );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " %<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1ad43c3812e6d13e0518d9f8b8f463ffcf">count</a> = %shape.getNodeChildCount( %name );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> ( %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a> = 0; %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a> < %<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1ad43c3812e6d13e0518d9f8b8f463ffcf">count</a>; %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a>++ )\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " dumpNode( %shape, %shape.getNodeChildName( %name, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a> ), %indent @ \" \" );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "}\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "function dumpShape( %shape )\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " // recursively dump node <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">hierarchy\n</a>" " %<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1ad43c3812e6d13e0518d9f8b8f463ffcf">count</a> = %shape.getNodeCount();\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> ( %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a> = 0; %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a> < %<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1ad43c3812e6d13e0518d9f8b8f463ffcf">count</a>; %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a>++ )\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " // dump top level <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">nodes\n</a>" " %name = %shape.getNodeName( %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> ( %shape.getNodeParentName( %name ) $= "" )\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " dumpNode( %shape, %name, \"\" );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " }\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "}\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getNodeCount , S32 , () , () , 0 )
DefineTSShapeConstructorMethod(getNodeIndex , S32 , (const char *name) , (name) , - 1, "Get the index of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n</a>" "@param name name of the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">lookup.\n</a>" "@return the index of the named node)
DefineTSShapeConstructorMethod(getNodeName , const char * , (S32 index) , (index) , "" , "Get the name of the indexed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n</a>" "@param index index of the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> lookup (valid range is 0 - getNodeCount()-1).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return the name of the indexed node)
DefineTSShapeConstructorMethod(getNodeObjectCount , S32 , (const char *name) , (name) , 0 )
DefineTSShapeConstructorMethod(getNodeObjectName , const char * , (const char *name, S32 index) , (name, index) , "" )
DefineTSShapeConstructorMethod(getNodeParentName , const char * , (const char *name) , (name) , "" , "Get the name of the node's parent. If the node has no parent , return an empty <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">string.\n</a>" " @param name name of the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query.\n</a>" " @return the name of the node 's parent, or \"\" <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the node is at the root <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>( \"Bip01 Pelvis parent = \" @ %this.getNodeParentName( \"Bip01 Pelvis \") );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getNodeTransform , TransformF , (const char *name, bool isWorld) , (false) , (name, isWorld) , TransformF::Identity , "Get the base (ie. not animated) transform of a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n</a>" "@param name name of the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query.\n</a>" "@param isWorld true <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> get the global transform)
DefineTSShapeConstructorMethod(getObjectCount , S32 , () , () , 0 )
DefineTSShapeConstructorMethod(getObjectIndex , S32 , (const char *name) , (name) , - 1)
DefineTSShapeConstructorMethod(getObjectName , const char * , (S32 index) , (index) , "" )
DefineTSShapeConstructorMethod(getObjectNode , const char * , (const char *name) , (name) , "" , "Get the name of the node this object is attached <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "@param name name of the object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">get.\n</a>" "@return the name of the attached node, or an empty string <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> this " "object is not attached <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> a node(usually the case <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> skinned meshes).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>(\"Hand is attached <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> \" @ %this.getObjectNode( \"Hand\" ) );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getSequenceBlend , const char * , (const char *name) , (name) , "" , "Get information about blended <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequences.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return TAB delimited string of the form: \"isBlend blendSeq blendFrame\" )
DefineTSShapeConstructorMethod(getSequenceCount , S32 , () , () , 0 , "Get the total number of sequences in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "@return the number of sequences in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape\n\n</a>" )
DefineTSShapeConstructorMethod(getSequenceCyclic , bool , (const char *name) , (name) , false , "Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> this sequence is cyclic (looping).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> this sequence is cyclic, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a>(!%this.getSequenceCyclic(\"ambient\" ) )\n" " error( \"ambient sequence is not cyclic!\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getSequenceFrameCount , S32 , (const char *name) , (name) , 0 , "Get the number of keyframes in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return number of keyframes in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>( \"Run has \" @ %this.getSequenceFrameCount( \"run\" ) @ \" keyframes\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getSequenceGroundSpeed , const char * , (const char *name) , (name) , "" )
DefineTSShapeConstructorMethod(getSequenceIndex , S32 , (const char *name) , (name) , - 1, "Find the index of the sequence with the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">lookup\n</a>" "@return index of the sequence with matching name, or -1 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> not <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> a given sequence exists in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape\n</a>" "<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a>(%this.getSequenceIndex(\"walk\" ) == -1 )\n" " <a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>( \"Could not <a href="/coding/file/talgorithm_8h/#talgorithm_8h_1a113846f47aa4d2409fe12e783dcd69cf">find</a> 'walk' sequence\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getSequenceName , const char * , (S32 index) , (index) , "" )
DefineTSShapeConstructorMethod(getSequencePriority , F32 , (const char *name) , (name) , -1. 0f, "Get the priority setting of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return priority value of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence\n\n</a>" )
DefineTSShapeConstructorMethod(getSequenceSource , const char * , (const char *name) , (name) , "" , "Get information about where the sequence data came <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">from.\n</a>" "For example, whether it was loaded from an external DSQ <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file.\n</a>" " @param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" " @return TAB delimited string of the form:\"from reserved start end total\" , where:" "< dl >" "< dt >from</dt >< dd >the source of the animation data, such as the path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> " "a DSQ file, or the name of an existing sequence in the shape. This field " "will be empty <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> sequences already embedded in the DTS or DAE file.</dd >" "< dt >reserved</dt >< dd >reserved value</dd >" "< dt >start</dt >< dd >the first frame in the source sequence used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> create this sequence</dd >" "< dt >end</dt >< dd >the last frame in the source sequence used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> create this sequence</dd >" "< dt >total</dt >< dd >the total number of frames in the source sequence</dd >" "</dl >\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//print the source <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the walk <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">animation\n</a>" "<a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>(\"walk source:\" SPC getField( %this.getSequenceSource( \"walk\" ), 0 ) );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getTargetCount , S32 , () , () , 0 )
DefineTSShapeConstructorMethod(getTargetName , const char * , (S32 index) , (index) , "" )
DefineTSShapeConstructorMethod(getTrigger , const char * , (const char *name, S32 index) , (name, index) , "" )
DefineTSShapeConstructorMethod(getTriggerCount , S32 , (const char *name) , (name) , 0 , "Get the number of triggers in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return number of triggers in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence\n\n</a>" )
DefineTSShapeConstructorMethod(notifyShapeChanged , void , () , () , "Notify game objects that this shape <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> has changed, allowing them <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> update " "internal data <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> needed." )
DefineTSShapeConstructorMethod(removeDetailLevel , bool , (S32 index) , (index) , false , "Remove the detail level (including all meshes in the detail level)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of the detail level <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">remove\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.removeDetailLevel(2);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(removeImposter , bool , () , () , false , "() Remove the imposter detail level (<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> any) from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" )
DefineTSShapeConstructorMethod(removeMesh , bool , (const char *name) , (name) , false , "Remove a mesh from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "If all geometry is removed from an object, the object is also <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">removed.\n</a>" " @param name full name(object name+detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a>) of the mesh <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">remove\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.removeMesh(\"SimpleShape128\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(removeNode , bool , (const char *name) , (name) , false , "Remove a node from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "The named node is removed from the shape, including from any sequences that " "use the node. Child nodes and objects attached <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the node are re-assigned " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the node 's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">parent.\n</a>" " @param name name of the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">remove.\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.removeNode(\"Nose\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(removeObject , bool , (const char *name) , (name) , false , "Remove an object (including all meshes <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> that object) from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "@param name name of the object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">remove.\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful)
DefineTSShapeConstructorMethod(removeSequence , bool , (const char *name) , (name) , false , "Remove the sequence from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">remove\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" )
DefineTSShapeConstructorMethod(removeTrigger , bool , (const char *name, S32 keyframe, S32 state) , (name, keyframe, state) , false , "Remove a trigger from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param keyframe keyframe of the trigger <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">remove\n</a>" "@param state of the trigger <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">remove\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.removeTrigger(\"walk\", 3, 1 );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(renameDetailLevel , bool , (const char *oldName, const char *newName) , (oldName, newName) , false , "Rename a detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n</a>" "@note Note that detail level names must be unique, so this command will " "fail <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> there is already a detail level with the desired <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name\n</a>" " @param oldName current name of the detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" " @param newName <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> name of the detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.renameDetailLevel(\"detail-1\", \"collision-1\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(renameNode , bool , (const char *oldName, const char *newName) , (oldName, newName) , false , "Rename a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n</a>" "@note Note that node names must be unique, so this command will fail <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> " "there is already a node with the desired <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name\n</a>" " @param oldName current name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node\n</a>" " @param newName <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.renameNode(\"Bip01 L Hand\", \"mount5\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(renameObject , bool , (const char *oldName, const char *newName) , (oldName, newName) , false , "Rename an <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n</a>" "@note Note that object names must be unique, so this command will fail <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> " "there is already an object with the desired <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name\n</a>" " @param oldName current name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" " @param newName <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.renameObject(\"MyBox\", \"Box\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(renameSequence , bool , (const char *oldName, const char *newName) , (oldName, newName) , false , "Rename a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" "@note Note that sequence names must be unique, so this command will fail " "<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> there is already a sequence with the desired <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name\n</a>" " @param oldName current name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence\n</a>" " @param newName <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.renameSequence(\"walking\", \"walk\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(saveShape , void , (const char *filename) , (filename) , "Save the shape (with all current changes) <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> DTS <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file.\n</a>" "@param filename Destination <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">filename.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.saveShape( \"./myShape.dts\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setBounds , bool , (Box3F bbox) , (bbox) , false , "Set the shape bounds <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the given bounding <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">box.\n</a>" "@param Bounding box \"minX minY minZ maxX maxY maxZ\"\n" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n</a>" )
DefineTSShapeConstructorMethod(setDetailLevelSize , S32 , (S32 index, S32 newSize) , (index, newSize) , index , "Change the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of a detail level." "@note Note that detail levels are always sorted in decreasing <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> order, " "so this command may cause detail level indices <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">change.\n</a>" " @param index index of the detail level <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" " @param newSize <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" " @return <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> index <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.setDetailLevelSize(2, 256);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setMeshMaterial , bool , (const char *meshName, const char *matName) , (meshName, matName) , false , "Set the name of the material attached <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mesh.\n</a>" "@param meshName full name , or the name of a " "<a href="/coding/class/classmaterial/">Material</a> object already defined in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">script.\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//set the mesh <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">material\n</a>" "%this.setMeshMaterial(\"SimpleShape128\", \"test_mat\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setMeshSize , bool , (const char *name, S32 size) , (name, size) , false , "Change the detail level <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of the named <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mesh.\n</a>" "@param name full name (object name + current <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> ) of the mesh <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> detail level <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">size\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.setMeshSize(\"SimpleShape128\", 64 );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setMeshType , bool , (const char *name, const char *type) , (name, type) , false , "Set the display type <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mesh.\n</a>" "@param name full name (object name + detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a>) of the mesh <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param type the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> type <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the mesh: \"normal\" , \"billboard\" or \"billboardzaxis\"\n" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//set the mesh <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">billboard\n</a>" "%this.setMeshType(\"SimpleShape64\", \"billboard\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setNodeParent , bool , (const char *name, const char *parentName) , (name, parentName) , false , "Set the parent of a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n</a>" "@param name name of the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param parentName name of the parent node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set (use \"\" <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the root level)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.setNodeParent(\"Bip01 Pelvis\", \"start01\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setNodeTransform , bool , (const char *name, TransformF txfm, bool isWorld) , (false) , (name, txfm, isWorld) , false , "Set the base transform of a node. That is, the transform of the node when " "in the root(not-animated) <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">pose.\n</a>" " @param name name of the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" " @param txfm transform string of the form:\"pos.x pos.y pos.z rot.x rot.y rot.z rot.angle\"\n" "@param isworld (optional) flag <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set the local-<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a>-parent or the global " "transform. If false, or not specified, the position and orientation are " "treated as relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the node 's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">parent.\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.setNodeTransform(\"mount0\", \"0 0 1 0 0 1 0\" );\n" "%this.setNodeTransform( \"mount0\", \"0 0 0 0 0 1 1.57\" );\n" "%this.setNodeTransform( \"mount0\", \"1 0 0 0 0 1 0\", true );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setObjectNode , bool , (const char *objName, const char *nodeName) , (objName, nodeName) , false , "Set the node an object is attached <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "When the shape is rendered, the object geometry is rendered at the node 's " "current <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transform.\n</a>" " @param objName name of the object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" " @param nodeName name of the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> attach the object <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.setObjectNode(\"Hand\", \"Bip01 LeftHand\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setSequenceBlend , bool , (const char *name, bool blend, const char *blendSeq, S32 blendFrame) , (name, blend, blendSeq, blendFrame) , false , "Mark a sequence as a blend or non-<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">blend.\n</a>" "A blend sequence is one that will be added on top of any other playing " "sequences. This is done by storing the animated node transforms relative " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> a reference frame, rather than as absolute <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transforms.\n</a>" " @param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" " @param blend true <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> make the sequence a blend, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> a non-<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">blend\n</a>" " @param blendSeq the name of the sequence that contains the blend reference <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">frame\n</a>" " @param blendFrame the reference frame in the blendSeq <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.setSequenceBlend(\"look\", true, \"root\", 0 );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setSequenceCyclic , bool , (const char *name, bool cyclic) , (name, cyclic) , false , "Mark a sequence as cyclic or non-<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">cyclic.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param cyclic true <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> make the sequence cyclic, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> non-<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">cyclic\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.setSequenceCyclic(\"ambient\", true );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "%this.setSequenceCyclic( \"shoot\", false );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setSequenceGroundSpeed , bool , (const char *name, Point3F transSpeed, Point3F rotSpeed) , (Point3F::Zero) , (name, transSpeed, rotSpeed) , false , "Set the translation and rotation ground speed of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" "The ground speed of the sequence is set by generating ground transform " "keyframes. The ground translational and rotational speed is assumed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> " "be constant <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the duration of the sequence. Existing ground frames <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> " "the sequence (<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> any) will be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">replaced.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param transSpeed translational speed (trans.x trans.y trans.z) in " "Torque units per <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">frame\n</a>" "@param rotSpeed (optional) rotational speed (rot.x rot.y rot.z) in " "radians per frame. Default is \"0 0 0\"\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.setSequenceGroundSpeed(\"run\", \"5 0 0\" );\n" "%this.setSequenceGroundSpeed( \"spin\", \"0 0 0\", \"4 0 0\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setSequencePriority , bool , (const char *name, F32 priority) , (name, priority) , false , "Set the sequence <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">priority.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param priority <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> priority <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" )
DefineTSShapeConstructorMethod(writeChangeSet , void , () , () , "Write the current change set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> a <a href="/coding/class/classtsshapeconstructor/">TSShapeConstructor</a> script file. The " "name of the script <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> is the same as the model, but with .cs extension. " "eg. myShape.cs <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> myShape.dts or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">myShape.dae.\n</a>" )
IMPLEMENT_CALLBACK(TSShapeConstructor , onLoad , void , () , () , "Called immediately after the DTS or DAE <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> has been loaded; before the " "shape data is available <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> any other object (<a href="/coding/class/classstaticshape/">StaticShape</a>, <a href="/coding/class/classplayer/">Player</a> etc). This " "is where you should put any post-load commands <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> modify the shape in-memory " "such as addNode, renameSequence etc." )
ImplementEnumType(TSShapeConstructorLodType , "\n\n" "@ingroup <a href="/coding/class/classtsshapeconstructor/">TSShapeConstructor</a>" )
Called when the DTS or DAE resource is flushed from memory Not normally but may be useful to perform cleanup
ImplementEnumType(TSShapeConstructorUpAxis , "Axis <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> upwards direction when importing from <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Collada.\n\n</a>" "@ingroup <a href="/coding/class/classtsshapeconstructor/">TSShapeConstructor</a>" )
bool
namesEqual(const String & nameA, const String & nameB)
SplitSequencePathAndName(String & srcPath, String & srcName)
Detailed Description
Public Defines
CHECK_INDEX_IN_RANGE(func, index, maxIndex, ret) ( ( index < 0 ) || ( index >= maxIndex ) ) \ { \ ( "TSShapeConstructor::" #func ": index out of " \ "range (0-%d)", maxIndex-1); \ return ret; \ }
GET_MESH(func, var, name, ret) * var = mShape->findMesh(name); \ (!var) \ { \ ( "TSShapeConstructor::" #func ": Could not " \ "mesh '%s'", name); \ return ret; \ }
GET_NODE_INDEX_ALLOW_ROOT(func, var, name, ret) var##Index = -1; \ (name[0]) \ { \ var##Index = mShape->findNode(name); \ (var##Index < 0) \ { \ ( "TSShapeConstructor::" #func ": Could not " \ " node '%s'", name); \ return ret; \ } \ } \ * var = var##Index < 0 ? : &(mShape->nodes[var##Index]); \ (var##Index); \ (var)
GET_NODE_INDEX_NO_ROOT(func, var, name, ret) var##Index = mShape->findNode(name); \ (var##Index < 0) \ { \ ( "TSShapeConstructor::" #func ": Could not " \ "node '%s'", name); \ return ret; \ } \ * var = &(mShape->nodes[var##Index]); \ (var##Index); \ (var)
GET_OBJECT(func, var, name, ret) var##Index = mShape->findObject(name); \ (var##Index < 0) \ { \ ( "TSShapeConstructor::" #func ": Could not " \ "object '%s'", name); \ return ret; \ } \ * var = &(mShape->objects[var##Index]); \ (var##Index); \ (var)
GET_SEQUENCE(func, var, name, ret) var##Index = mShape->findSequence(name); \ (var##Index < 0) \ { \ ( "TSShapeConstructor::" #func ": Could not " \ "sequence named '%s'", name); \ return ret; \ } \ * var = &(mShape->sequences[var##Index]); \ (var##Index); \ (var);
MAX_PATH_LENGTH() 256
RETURN_IF_MATCH(type) (!(name, #type)) return Cmd##type
Public Variables
EndImplementEnumType
onUnload
Called when the DTS or DAE resource is flushed from memory Not normally required
void
Public Functions
ConsoleDocClass(TSShapeConstructor , "@brief An object used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> modify a DTS or COLLADA shape model after it has " "been loaded by <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Torque\n\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">gameObjects\n</a>" )
createNodeWithText(const char * name, const char * text)
DefineTSShapeConstructorMethod(addImposter , S32 , (S32 size, S32 equatorSteps, S32 polarSteps, S32 dl, S32 dim, bool includePoles, F32 polarAngle) , (size, equatorSteps, polarSteps, dl, dim, includePoles, polarAngle) , - 1, "Add (or edit) an imposter detail level <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "If the shape already contains an imposter detail level, this command will " "simply change the imposter <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">settings\n</a>" " @param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of the imposter detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" " @param equatorSteps defines the number of snapshots <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> take around the " "equator. Imagine the object being rotated around the vertical axis, then " "a snapshot taken at regularly spaced <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">intervals.\n</a>" " @param polarSteps defines the number of snapshots taken between the poles " " , at each equator step. eg. At each equator snapshot, " "snapshots are taken at regular intervals between the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">poles.\n</a>" " @param dl the detail level <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use when generating the snapshots. Note that " "this is an array index rather than a detail size. So <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> an object has detail " "sizes of:200 , 150 , and 40, then setting @a dl <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 1 will generate the snapshots " "using detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> 150.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @param dim defines the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of the imposter images in pixels. The larger the " " number, the more detailed the billboard will <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">be.\n</a>" " @param includePoles flag indicating whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> include the \"pole\" snapshots. " "ie. the views from the top and bottom of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n</a>" "@param polar_angle <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> pole snapshots are active , this " "parameter defines the camera angle(in degrees) within which <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> render the " "pole snapshot. eg. <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> polar_angle is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 25 degrees, then the snapshot " "taken at the pole(looking directly down or up at the object) will be rendered " "when the camera is within 25 degrees of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">pole.\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.addImposter(2, 4, 0, 0, 64, false, 0);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "%this.addImposter(2, 4, 2, 0, 64, true, 10);//this command would edit the existing imposter detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(addMesh , bool , (const char *meshName, const char *srcShape, const char *srcMesh) , (meshName, srcShape, srcMesh) , false , "Add geometry from another DTS or DAE shape <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> into this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "Any materials <a href="/coding/file/tsshapeconstruct_8cpp/#tsshapeconstruct_8cpp_1a21625ca11566389388a748ad1acc0990">required</a> by the source mesh are also copied into this shape.<br>\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param meshName full name (object name + detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a>) of the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> mesh. If " "no detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> is present at the end of the name, a value of 2 is used.< br >" "An underscore before the number at the end of the name will be interpreted as " "a negative sign. eg. \"MyMesh_4\" will be interpreted as \"MyMesh-4\".\n" "@param srcShape name of a shape <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> (DTS or DAE) that contains the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mesh\n</a>" "@param srcMesh the full name (object name + detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a>) of the mesh <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> " "copy from the DTS/DAE <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> into this shape</li>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.addMesh(\"ColMesh-1\", \"./collision.dts\", \"ColMesh\", \"Col-1\" );\n" "%this.addMesh( \"SimpleShape10\", \"./testShape.dae\", \"MyMesh2\", "" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(addNode , bool , (const char *name, const char *parentName, TransformF txfm, bool isWorld) , (TransformF::Identity, false) , (name, parentName, txfm, isWorld) , false , "Add a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n</a>" "@param name name <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> node , the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> node will be at the root level of the node <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">hierarchy.\n</a>" " @param txfm(optional) transform string of the form:\"pos.x pos.y pos.z rot.x rot.y rot.z rot.angle\"\n" "@param isworld (optional) flag <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set the local-<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a>-parent or the global " "transform. If false, or not specified, the position and orientation are " "treated as relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the node 's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">parent.\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.addNode(\"Nose\", \"Bip01 Head\", \"0 2 2 0 0 1 0\" );\n" "%this.addNode( \"myRoot\", \"\", \"0 0 4 0 0 1 1.57\" );\n" "%this.addNode( \"Nodes\", \"Bip01 Head\", \"0 2 0 0 0 1 0\", true );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(addSequence , bool , (const char *source, const char *name, S32 start, S32 end, bool padRot, bool padTrans) , (0, -1, true, false) , (source, name, start, end, padRot, padTrans) , false , "Add a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "@param source the name of an existing sequence, or the name of a DTS or DAE " "shape or DSQ sequence file. When the shape <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> contains more than one " " sequence, the desired sequence can be specified by appending the name <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the " "end of the shape file. eg. \"myShape.dts run\" would select the \"run\" " "sequence from the \"myShape.dts\" file.\n\n" "@param name name of the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence\n</a>" "@param start (optional) first frame <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> copy. Defaults <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 0, the first frame in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" " @param end(optional) last frame <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> copy. Defaults <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> - 1, the last frame in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" " @param padRot(optional) copy root-pose rotation keys <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> non-animated nodes. This is useful <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> " "the source sequence data has a different root-pose <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the target shape, such as <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> one character was " "in the <a href="/coding/group/group__engineapi__types/#group__engineapi__types_1ga16a0f7e7053a679c9bf4289b441a2be7">T</a> pose, and the other had arms at the side. Normally only nodes that are actually rotated by " "the source sequence have keyframes added, but setting this flag will also add keyframes <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> nodes " "that are not animated, but have a different root-pose rotation <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the target shape root <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">pose.\n</a>" " @param padTrans(optional) copy root-pose translation keys <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> non-animated nodes. This is useful <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> " "the source sequence data has a different root-pose <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the target shape, such as <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> one character was " "in the <a href="/coding/group/group__engineapi__types/#group__engineapi__types_1ga16a0f7e7053a679c9bf4289b441a2be7">T</a> pose, and the other had arms at the side. Normally only nodes that are actually moved by " "the source sequence have keyframes added, but setting this flag will also add keyframes <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> nodes " "that are not animated, but have a different root-pose position <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the target shape root <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">pose.\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.addSequence(\"./testShape.dts ambient\", \"ambient\" );\n" "%this.addSequence( \"./myPlayer.dae run\", \"run\" );\n" "%this.addSequence( \"./player_look.dsq\", \"look\", 0, -1 ); // start <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">end\n</a>" "%this.addSequence( \"walk\", \"walk_shortA\", 0, 4 ); // start <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> frame 4\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "%this.addSequence( \"walk\", \"walk_shortB\", 4, -1 ); // frame 4 <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">end\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(addTrigger , bool , (const char *name, S32 keyframe, S32 state) , (name, keyframe, state) , false , "Add a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> trigger <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param keyframe keyframe of the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">trigger\n</a>" "@param state of the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">trigger\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.addTrigger(\"walk\", 3, 1 );\n" "%this.addTrigger( \"walk\", 5, -1 );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(dumpShape , void , (const char *filename) , ("") , (filename) , "Dump the shape hierarchy <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the console or <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> a file. Useful <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> reviewing " "the result of a series of construction <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">commands.\n</a>" "@param filename Destination filename. If not specified, dump <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">console.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.dumpShape();//dump <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">console\n</a>" "%this.dumpShape(\"./dump.txt\" ); // dump <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getBounds , Box3F , () , () , Box3F::Invalid , "Get the bounding box <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "@return Bounding box \"minX minY minZ maxX maxY maxZ\"" )
DefineTSShapeConstructorMethod(getDetailLevelCount , S32 , () , () , 0 , "Get the total number of detail levels in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "@return the number of detail levels in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape\n</a>" )
DefineTSShapeConstructorMethod(getDetailLevelIndex , S32 , (S32 size) , (size) , - 1, "Get the index of the detail level with a given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">size.\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of the detail level <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">lookup\n</a>" "@return index of the detail level with the desired size, or -1 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> no such " "detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">exists\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a>(%this.getDetailLevelSize(32)==-1)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " <a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>(\"Error: This shape does not have a detail level at <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> 32\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getDetailLevelName , const char * , (S32 index) , (index) , "" )
DefineTSShapeConstructorMethod(getDetailLevelSize , S32 , (S32 index) , (index) , 0 )
DefineTSShapeConstructorMethod(getImposterDetailLevel , S32 , () , () , - 1, "Get the index of the imposter (auto-billboard) detail level (<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> any).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return imposter detail level index, or -1 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the shape does not use " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">imposters.\n\n</a>" )
DefineTSShapeConstructorMethod(getImposterSettings , const char * , (S32 index) , (index) , "" )
DefineTSShapeConstructorMethod(getMeshCount , S32 , (const char *name) , (name) , 0 )
DefineTSShapeConstructorMethod(getMeshMaterial , const char * , (const char *name) , (name) , "" , "Get the name of the material attached <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> a mesh. Note that only the first " "material used by the mesh is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">returned.\n</a>" "@param name full name (object name + detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a>) of the mesh <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return name of the material attached <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the mesh (suitable <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> use with the <a href="/coding/class/classmaterial/">Material</a> mapTo field)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>( \"Mesh material is \" @ %this.sgetMeshMaterial( \"SimpleShape128\" ) );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getMeshName , const char * , (const char *name, S32 index) , (name, index) , "" )
DefineTSShapeConstructorMethod(getMeshSize , S32 , (const char *name, S32 index) , (name, index) , - 1, "Get the detail level <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of the indexed mesh <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n</a>" "@param name name of the object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@param index index of the mesh (valid range is 0 - getMeshCount()-1)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return the mesh detail level <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">size.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// print sizes <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> all detail levels of this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "% objName)
DefineTSShapeConstructorMethod(getMeshType , const char * , (const char *name) , (name) , "" , "Get the display type of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mesh.\n</a>" "@param name name of the mesh <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return the string returned is one of:" "<dl><dt>normal</dt><dd>a normal 3D mesh</dd>" "<dt>billboard</dt><dd>a mesh that always faces the camera</dd>" "<dt>billboardzaxis</dt><dd>a mesh that always faces the camera in the Z-axis</dd></dl>\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>( \"Mesh type is \" @ %this.getMeshType( \"SimpleShape128\" ) );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getNodeChildCount , S32 , (const char *name) , (name) , 0 )
DefineTSShapeConstructorMethod(getNodeChildName , const char * , (const char *name, S32 index) , (name, index) , "" , "Get the name of the indexed child <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n</a>" "@param name name of the parent node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query.\n</a>" "@param index index of the child node (valid range is 0 - getNodeChildName()-1).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return the name of the indexed child <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "function dumpNode( %shape, %name, %indent )\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " <a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>( %indent @ %name );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " %<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1ad43c3812e6d13e0518d9f8b8f463ffcf">count</a> = %shape.getNodeChildCount( %name );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> ( %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a> = 0; %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a> < %<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1ad43c3812e6d13e0518d9f8b8f463ffcf">count</a>; %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a>++ )\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " dumpNode( %shape, %shape.getNodeChildName( %name, %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a> ), %indent @ \" \" );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "}\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "function dumpShape( %shape )\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " // recursively dump node <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">hierarchy\n</a>" " %<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1ad43c3812e6d13e0518d9f8b8f463ffcf">count</a> = %shape.getNodeCount();\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> ( %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a> = 0; %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a> < %<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1ad43c3812e6d13e0518d9f8b8f463ffcf">count</a>; %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a>++ )\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " // dump top level <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">nodes\n</a>" " %name = %shape.getNodeName( %<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1acb559820d9ca11295b4500f179ef6392">i</a> );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> ( %shape.getNodeParentName( %name ) $= "" )\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " dumpNode( %shape, %name, \"\" );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " }\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "}\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getNodeCount , S32 , () , () , 0 )
DefineTSShapeConstructorMethod(getNodeIndex , S32 , (const char *name) , (name) , - 1, "Get the index of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n</a>" "@param name name of the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">lookup.\n</a>" "@return the index of the named node)
DefineTSShapeConstructorMethod(getNodeName , const char * , (S32 index) , (index) , "" , "Get the name of the indexed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n</a>" "@param index index of the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> lookup (valid range is 0 - getNodeCount()-1).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return the name of the indexed node)
DefineTSShapeConstructorMethod(getNodeObjectCount , S32 , (const char *name) , (name) , 0 )
DefineTSShapeConstructorMethod(getNodeObjectName , const char * , (const char *name, S32 index) , (name, index) , "" )
DefineTSShapeConstructorMethod(getNodeParentName , const char * , (const char *name) , (name) , "" , "Get the name of the node's parent. If the node has no parent , return an empty <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">string.\n</a>" " @param name name of the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query.\n</a>" " @return the name of the node 's parent, or \"\" <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the node is at the root <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>( \"Bip01 Pelvis parent = \" @ %this.getNodeParentName( \"Bip01 Pelvis \") );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getNodeTransform , TransformF , (const char *name, bool isWorld) , (false) , (name, isWorld) , TransformF::Identity , "Get the base (ie. not animated) transform of a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n</a>" "@param name name of the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query.\n</a>" "@param isWorld true <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> get the global transform)
DefineTSShapeConstructorMethod(getObjectCount , S32 , () , () , 0 )
DefineTSShapeConstructorMethod(getObjectIndex , S32 , (const char *name) , (name) , - 1)
DefineTSShapeConstructorMethod(getObjectName , const char * , (S32 index) , (index) , "" )
DefineTSShapeConstructorMethod(getObjectNode , const char * , (const char *name) , (name) , "" , "Get the name of the node this object is attached <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "@param name name of the object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">get.\n</a>" "@return the name of the attached node, or an empty string <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> this " "object is not attached <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> a node(usually the case <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> skinned meshes).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>(\"Hand is attached <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> \" @ %this.getObjectNode( \"Hand\" ) );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getSequenceBlend , const char * , (const char *name) , (name) , "" , "Get information about blended <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequences.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return TAB delimited string of the form: \"isBlend blendSeq blendFrame\" )
DefineTSShapeConstructorMethod(getSequenceCount , S32 , () , () , 0 , "Get the total number of sequences in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "@return the number of sequences in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape\n\n</a>" )
DefineTSShapeConstructorMethod(getSequenceCyclic , bool , (const char *name) , (name) , false , "Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> this sequence is cyclic (looping).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> this sequence is cyclic, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a>(!%this.getSequenceCyclic(\"ambient\" ) )\n" " error( \"ambient sequence is not cyclic!\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getSequenceFrameCount , S32 , (const char *name) , (name) , 0 , "Get the number of keyframes in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return number of keyframes in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>( \"Run has \" @ %this.getSequenceFrameCount( \"run\" ) @ \" keyframes\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getSequenceGroundSpeed , const char * , (const char *name) , (name) , "" )
DefineTSShapeConstructorMethod(getSequenceIndex , S32 , (const char *name) , (name) , - 1, "Find the index of the sequence with the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">lookup\n</a>" "@return index of the sequence with matching name, or -1 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> not <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Check <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> a given sequence exists in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape\n</a>" "<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a>(%this.getSequenceIndex(\"walk\" ) == -1 )\n" " <a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>( \"Could not <a href="/coding/file/talgorithm_8h/#talgorithm_8h_1a113846f47aa4d2409fe12e783dcd69cf">find</a> 'walk' sequence\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getSequenceName , const char * , (S32 index) , (index) , "" )
DefineTSShapeConstructorMethod(getSequencePriority , F32 , (const char *name) , (name) , -1. 0f, "Get the priority setting of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return priority value of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence\n\n</a>" )
DefineTSShapeConstructorMethod(getSequenceSource , const char * , (const char *name) , (name) , "" , "Get information about where the sequence data came <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">from.\n</a>" "For example, whether it was loaded from an external DSQ <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file.\n</a>" " @param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" " @return TAB delimited string of the form:\"from reserved start end total\" , where:" "< dl >" "< dt >from</dt >< dd >the source of the animation data, such as the path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> " "a DSQ file, or the name of an existing sequence in the shape. This field " "will be empty <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> sequences already embedded in the DTS or DAE file.</dd >" "< dt >reserved</dt >< dd >reserved value</dd >" "< dt >start</dt >< dd >the first frame in the source sequence used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> create this sequence</dd >" "< dt >end</dt >< dd >the last frame in the source sequence used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> create this sequence</dd >" "< dt >total</dt >< dd >the total number of frames in the source sequence</dd >" "</dl >\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//print the source <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the walk <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">animation\n</a>" "<a href="/coding/file/ggendoflinefix_8txt/#ggendoflinefix_8txt_1a7f8fee038817022b75b8865e5da4eba3">echo</a>(\"walk source:\" SPC getField( %this.getSequenceSource( \"walk\" ), 0 ) );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(getTargetCount , S32 , () , () , 0 )
DefineTSShapeConstructorMethod(getTargetName , const char * , (S32 index) , (index) , "" )
DefineTSShapeConstructorMethod(getTrigger , const char * , (const char *name, S32 index) , (name, index) , "" )
DefineTSShapeConstructorMethod(getTriggerCount , S32 , (const char *name) , (name) , 0 , "Get the number of triggers in the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">query\n</a>" "@return number of triggers in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence\n\n</a>" )
DefineTSShapeConstructorMethod(notifyShapeChanged , void , () , () , "Notify game objects that this shape <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> has changed, allowing them <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> update " "internal data <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> needed." )
DefineTSShapeConstructorMethod(removeDetailLevel , bool , (S32 index) , (index) , false , "Remove the detail level (including all meshes in the detail level)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of the detail level <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">remove\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.removeDetailLevel(2);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(removeImposter , bool , () , () , false , "() Remove the imposter detail level (<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> any) from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" )
DefineTSShapeConstructorMethod(removeMesh , bool , (const char *name) , (name) , false , "Remove a mesh from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "If all geometry is removed from an object, the object is also <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">removed.\n</a>" " @param name full name(object name+detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a>) of the mesh <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">remove\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.removeMesh(\"SimpleShape128\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(removeNode , bool , (const char *name) , (name) , false , "Remove a node from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "The named node is removed from the shape, including from any sequences that " "use the node. Child nodes and objects attached <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the node are re-assigned " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the node 's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">parent.\n</a>" " @param name name of the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">remove.\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.removeNode(\"Nose\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(removeObject , bool , (const char *name) , (name) , false , "Remove an object (including all meshes <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> that object) from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "@param name name of the object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">remove.\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful)
DefineTSShapeConstructorMethod(removeSequence , bool , (const char *name) , (name) , false , "Remove the sequence from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">shape.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">remove\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" )
DefineTSShapeConstructorMethod(removeTrigger , bool , (const char *name, S32 keyframe, S32 state) , (name, keyframe, state) , false , "Remove a trigger from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param keyframe keyframe of the trigger <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">remove\n</a>" "@param state of the trigger <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">remove\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.removeTrigger(\"walk\", 3, 1 );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(renameDetailLevel , bool , (const char *oldName, const char *newName) , (oldName, newName) , false , "Rename a detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level.\n</a>" "@note Note that detail level names must be unique, so this command will " "fail <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> there is already a detail level with the desired <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name\n</a>" " @param oldName current name of the detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" " @param newName <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> name of the detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.renameDetailLevel(\"detail-1\", \"collision-1\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(renameNode , bool , (const char *oldName, const char *newName) , (oldName, newName) , false , "Rename a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n</a>" "@note Note that node names must be unique, so this command will fail <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> " "there is already a node with the desired <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name\n</a>" " @param oldName current name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node\n</a>" " @param newName <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.renameNode(\"Bip01 L Hand\", \"mount5\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(renameObject , bool , (const char *oldName, const char *newName) , (oldName, newName) , false , "Rename an <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n</a>" "@note Note that object names must be unique, so this command will fail <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> " "there is already an object with the desired <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name\n</a>" " @param oldName current name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" " @param newName <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.renameObject(\"MyBox\", \"Box\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(renameSequence , bool , (const char *oldName, const char *newName) , (oldName, newName) , false , "Rename a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" "@note Note that sequence names must be unique, so this command will fail " "<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> there is already a sequence with the desired <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name\n</a>" " @param oldName current name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence\n</a>" " @param newName <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> name of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.renameSequence(\"walking\", \"walk\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(saveShape , void , (const char *filename) , (filename) , "Save the shape (with all current changes) <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> DTS <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file.\n</a>" "@param filename Destination <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">filename.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.saveShape( \"./myShape.dts\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setBounds , bool , (Box3F bbox) , (bbox) , false , "Set the shape bounds <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the given bounding <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">box.\n</a>" "@param Bounding box \"minX minY minZ maxX maxY maxZ\"\n" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n</a>" )
DefineTSShapeConstructorMethod(setDetailLevelSize , S32 , (S32 index, S32 newSize) , (index, newSize) , index , "Change the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of a detail level." "@note Note that detail levels are always sorted in decreasing <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> order, " "so this command may cause detail level indices <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">change.\n</a>" " @param index index of the detail level <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" " @param newSize <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n</a>" " @return <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> index <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">level\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.setDetailLevelSize(2, 256);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setMeshMaterial , bool , (const char *meshName, const char *matName) , (meshName, matName) , false , "Set the name of the material attached <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mesh.\n</a>" "@param meshName full name , or the name of a " "<a href="/coding/class/classmaterial/">Material</a> object already defined in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">script.\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//set the mesh <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">material\n</a>" "%this.setMeshMaterial(\"SimpleShape128\", \"test_mat\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setMeshSize , bool , (const char *name, S32 size) , (name, size) , false , "Change the detail level <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> of the named <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mesh.\n</a>" "@param name full name (object name + current <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> ) of the mesh <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> detail level <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">size\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.setMeshSize(\"SimpleShape128\", 64 );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setMeshType , bool , (const char *name, const char *type) , (name, type) , false , "Set the display type <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mesh.\n</a>" "@param name full name (object name + detail <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1ab7d671599a7b25ca99a487fa341bc33a">size</a>) of the mesh <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param type the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> type <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the mesh: \"normal\" , \"billboard\" or \"billboardzaxis\"\n" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//set the mesh <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">billboard\n</a>" "%this.setMeshType(\"SimpleShape64\", \"billboard\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setNodeParent , bool , (const char *name, const char *parentName) , (name, parentName) , false , "Set the parent of a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node.\n</a>" "@param name name of the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param parentName name of the parent node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set (use \"\" <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the root level)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.setNodeParent(\"Bip01 Pelvis\", \"start01\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setNodeTransform , bool , (const char *name, TransformF txfm, bool isWorld) , (false) , (name, txfm, isWorld) , false , "Set the base transform of a node. That is, the transform of the node when " "in the root(not-animated) <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">pose.\n</a>" " @param name name of the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" " @param txfm transform string of the form:\"pos.x pos.y pos.z rot.x rot.y rot.z rot.angle\"\n" "@param isworld (optional) flag <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set the local-<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a>-parent or the global " "transform. If false, or not specified, the position and orientation are " "treated as relative <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the node 's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">parent.\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.setNodeTransform(\"mount0\", \"0 0 1 0 0 1 0\" );\n" "%this.setNodeTransform( \"mount0\", \"0 0 0 0 0 1 1.57\" );\n" "%this.setNodeTransform( \"mount0\", \"1 0 0 0 0 1 0\", true );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setObjectNode , bool , (const char *objName, const char *nodeName) , (objName, nodeName) , false , "Set the node an object is attached <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "When the shape is rendered, the object geometry is rendered at the node 's " "current <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transform.\n</a>" " @param objName name of the object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" " @param nodeName name of the node <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> attach the object <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.setObjectNode(\"Hand\", \"Bip01 LeftHand\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setSequenceBlend , bool , (const char *name, bool blend, const char *blendSeq, S32 blendFrame) , (name, blend, blendSeq, blendFrame) , false , "Mark a sequence as a blend or non-<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">blend.\n</a>" "A blend sequence is one that will be added on top of any other playing " "sequences. This is done by storing the animated node transforms relative " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> a reference frame, rather than as absolute <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">transforms.\n</a>" " @param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" " @param blend true <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> make the sequence a blend, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> a non-<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">blend\n</a>" " @param blendSeq the name of the sequence that contains the blend reference <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">frame\n</a>" " @param blendFrame the reference frame in the blendSeq <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.setSequenceBlend(\"look\", true, \"root\", 0 );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setSequenceCyclic , bool , (const char *name, bool cyclic) , (name, cyclic) , false , "Mark a sequence as cyclic or non-<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">cyclic.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param cyclic true <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> make the sequence cyclic, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> non-<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">cyclic\n</a>" " @return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.setSequenceCyclic(\"ambient\", true );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "%this.setSequenceCyclic( \"shoot\", false );\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setSequenceGroundSpeed , bool , (const char *name, Point3F transSpeed, Point3F rotSpeed) , (Point3F::Zero) , (name, transSpeed, rotSpeed) , false , "Set the translation and rotation ground speed of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sequence.\n</a>" "The ground speed of the sequence is set by generating ground transform " "keyframes. The ground translational and rotational speed is assumed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> " "be constant <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the duration of the sequence. Existing ground frames <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> " "the sequence (<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> any) will be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">replaced.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param transSpeed translational speed (trans.x trans.y trans.z) in " "Torque units per <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">frame\n</a>" "@param rotSpeed (optional) rotational speed (rot.x rot.y rot.z) in " "radians per frame. Default is \"0 0 0\"\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "%this.setSequenceGroundSpeed(\"run\", \"5 0 0\" );\n" "%this.setSequenceGroundSpeed( \"spin\", \"0 0 0\", \"4 0 0\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineTSShapeConstructorMethod(setSequencePriority , bool , (const char *name, F32 priority) , (name, priority) , false , "Set the sequence <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">priority.\n</a>" "@param name name of the sequence <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modify\n</a>" "@param priority <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> priority <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">value\n</a>" "@return true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> successful, false <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">otherwise\n\n</a>" )
DefineTSShapeConstructorMethod(writeChangeSet , void , () , () , "Write the current change set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> a <a href="/coding/class/classtsshapeconstructor/">TSShapeConstructor</a> script file. The " "name of the script <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> is the same as the model, but with .cs extension. " "eg. myShape.cs <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> myShape.dts or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">myShape.dae.\n</a>" )
IMPLEMENT_CALLBACK(TSShapeConstructor , onLoad , void , () , () , "Called immediately after the DTS or DAE <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> has been loaded; before the " "shape data is available <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> any other object (<a href="/coding/class/classstaticshape/">StaticShape</a>, <a href="/coding/class/classplayer/">Player</a> etc). This " "is where you should put any post-load commands <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> modify the shape in-memory " "such as addNode, renameSequence etc." )
IMPLEMENT_CONOBJECT(TSShapeConstructor )
ImplementEnumType(TSShapeConstructorLodType , "\n\n" "@ingroup <a href="/coding/class/classtsshapeconstructor/">TSShapeConstructor</a>" )
ImplementEnumType(TSShapeConstructorUpAxis , "Axis <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> upwards direction when importing from <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Collada.\n\n</a>" "@ingroup <a href="/coding/class/classtsshapeconstructor/">TSShapeConstructor</a>" )
namesEqual(const String & nameA, const String & nameB)
SplitSequencePathAndName(String & srcPath, String & srcName)
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#include "platform/platform.h" 25#include "ts/tsShapeConstruct.h" 26 27#include "ts/tsShapeInstance.h" 28#include "ts/tsMaterialList.h" 29#include "console/consoleTypes.h" 30#include "console/engineAPI.h" 31#include "core/resourceManager.h" 32#include "core/stream/bitStream.h" 33#include "core/stream/fileStream.h" 34#include "core/stream/memStream.h" 35#include "core/fileObject.h" 36 37#define MAX_PATH_LENGTH 256 38 39 40//#define DEBUG_SPEW 41 42ConsoleDocClass( TSShapeConstructor, 43 "@brief An object used to modify a DTS or COLLADA shape model after it has " 44 "been loaded by Torque\n\n" 45 "@ingroup gameObjects\n" 46); 47 48IMPLEMENT_CALLBACK( TSShapeConstructor, onLoad, void, (), (), 49 "Called immediately after the DTS or DAE file has been loaded; before the " 50 "shape data is available to any other object (StaticShape, Player etc). This " 51 "is where you should put any post-load commands to modify the shape in-memory " 52 "such as addNode, renameSequence etc." ) 53 54IMPLEMENT_CALLBACK( TSShapeConstructor, onUnload, void, (), (), 55 "Called when the DTS or DAE resource is flushed from memory. Not normally " 56 "<a href="/coding/file/tsshapeconstruct_8cpp/#tsshapeconstruct_8cpp_1a21625ca11566389388a748ad1acc0990">required</a>, but may be useful <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> perform cleanup." ) 57 58ImplementEnumType( TSShapeConstructorUpAxis, 59 "Axis <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use <a href="/coding/file/types_8visualc_8h/#types_8visualc_8h_1aad3a54ef5fb260160ec7493483246022">for</a> upwards direction when importing from Collada.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" 60 "@ingroup <a href="/coding/class/classtsshapeconstructor/">TSShapeConstructor</a>" ) 61 { UPAXISTYPE_X_UP, "X_AXIS" }, 62 { UPAXISTYPE_Y_UP, "Y_AXIS" }, 63 { UPAXISTYPE_Z_UP, "Z_AXIS" }, 64 { UPAXISTYPE_COUNT, "DEFAULT" } 65EndImplementEnumType; 66 67ImplementEnumType( TSShapeConstructorLodType, 68 "\n\n" 69 "@ingroup TSShapeConstructor" ) 70 { ColladaUtils::ImportOptions::DetectDTS, "DetectDTS" }, 71 { ColladaUtils::ImportOptions::SingleSize, "SingleSize" }, 72 { ColladaUtils::ImportOptions::TrailingNumber, "TrailingNumber" }, 73EndImplementEnumType; 74 75 76//----------------------------------------------------------------------------- 77 78String TSShapeConstructor::smCapsuleShapePath("core/art/shapes/unit_capsule.dts"); 79String TSShapeConstructor::smCubeShapePath("core/art/shapes/unit_cube.dts"); 80String TSShapeConstructor::smSphereShapePath("core/art/shapes/unit_sphere.dts"); 81 82ResourceRegisterPostLoadSignal< TSShape> TSShapeConstructor::_smAutoLoad( &TSShapeConstructor::_onTSShapeLoaded ); 83ResourceRegisterUnloadSignal< TSShape> TSShapeConstructor::_smAutoUnload( &TSShapeConstructor::_onTSShapeUnloaded ); 84 85void TSShapeConstructor::_onTSShapeLoaded( Resource< TSShape>& resource ) 86{ 87 TSShapeConstructor* ctor = findShapeConstructor( resource.getPath().getFullPath() ); 88 if( ctor ) 89 ctor->_onLoad( resource ); 90 91 if (ctor && ctor->mShape && ctor->mShape->needsReinit()) 92 { 93 ctor->mShape->init(); 94 } 95} 96 97void TSShapeConstructor::_onTSShapeUnloaded( const Torque::Path& path, TSShape* shape ) 98{ 99 TSShapeConstructor* ctor = findShapeConstructor( path.getFullPath() ); 100 if( ctor && ( ctor->getShape() == shape ) ) 101 ctor->_onUnload(); 102} 103 104// TSShape names are case insensitive 105static inline bool namesEqual( const String& nameA, const String& nameB ) 106{ 107 return nameA.equal( nameB, String::NoCase ); 108} 109 110static void SplitSequencePathAndName( String& srcPath, String& srcName ) 111{ 112 srcName = ""; 113 114 // Determine if there is a sequence name at the end of the source string, and 115 // if so, split the filename from the sequence name 116 S32 split = srcPath.find(' ', 0, String::Right); 117 S32 split2 = srcPath.find('\t', 0, String::Right); 118 if ((split == String::NPos) || (split2 > split)) 119 split = split2; 120 if (split != String::NPos) 121 { 122 split2 = split + 1; 123 while ((srcPath[split2] != '\0') && dIsspace(srcPath[split2])) 124 split2++; 125 126 // now 'split' is at the end of the path, and 'split2' is at the start of the sequence name 127 srcName = srcPath.substr(split2); 128 srcPath = srcPath.erase(split, srcPath.length()-split); 129 } 130} 131 132//----------------------------------------------------------------------------- 133 134IMPLEMENT_CONOBJECT(TSShapeConstructor); 135 136TSShapeConstructor::TSShapeConstructor() 137 : mShapePath(""), mLoadingShape(false) 138{ 139 mShape = NULL; 140} 141 142TSShapeConstructor::~TSShapeConstructor() 143{ 144} 145 146bool TSShapeConstructor::addSequenceFromField( void *obj, const char *index, const char *data ) 147{ 148 TSShapeConstructor *pObj = static_cast<TSShapeConstructor*>( obj ); 149 150 if ( data && data[0] ) 151 pObj->mSequences.push_back( FileName(data) ); 152 153 return false; 154} 155 156void TSShapeConstructor::initPersistFields() 157{ 158 addGroup( "Media" ); 159 addField( "baseShape", TypeStringFilename, Offset(mShapePath, TSShapeConstructor), 160 "Specifies the path to the DTS or DAE file to be operated on by this object.\n" 161 "Since the TSShapeConstructor script must be in the same folder as the DTS or " 162 "DAE file, it is recommended to use a relative path so that the shape and " 163 "script files can be copied to another location without having to modify the " 164 "path." ); 165 endGroup( "Media" ); 166 167 addGroup( "Collada" ); 168 addField( "upAxis", TYPEID< domUpAxisType >(), Offset(mOptions.upAxis, TSShapeConstructor), 169 "Override the <up_axis> element in the COLLADA (.dae) file. No effect for DTS files.\n" 170 "Set to one of the following values:\n" 171 "<dl><dt>X_AXIS</dt><dd>Positive X points up. Model will be rotated into Torque's coordinate system (Z up).</dd>" 172 "<dt>Y_AXIS</dt><dd>Positive Y points up. Model will be rotated into Torque's coordinate system (Z up).</dd>" 173 "<dt>Z_AXIS</dt><dd>Positive Z points up. No rotation will be applied to the model.</dd>" 174 "<dt>DEFAULT</dt><dd>The default value. Use the value in the .dae file (defaults to Z_AXIS if the <up_axis> element is not present).</dd></dl>" ); 175 176 addField( "unit", TypeF32, Offset(mOptions.unit, TSShapeConstructor), 177 "Override the <unit> element in the COLLADA (.dae) file. No effect for DTS files.\n" 178 "COLLADA (.dae) files usually contain a <unit> element that indicates the " 179 "'real world' units that the model is described in. It means you can work " 180 "in sensible and meaningful units in your modeling app.<br>\n" 181 "For example, if you were modeling a small object like a cup, it might make " 182 "sense to work in inches (1 MAX unit = 1 inch), but if you were modeling a " 183 "building, it might make more sense to work in feet (1 MAX unit = 1 foot). " 184 "If you export both models to COLLADA, T3D will automatically scale them " 185 "appropriately. 1 T3D unit = 1 meter, so the cup would be scaled down by 0.0254, " 186 "and the building scaled down by 0.3048, given them both the correct scale " 187 "relative to each other.<br>\n" 188 "Omit the field or set to -1 to use the value in the .dae file (1.0 if the " 189 "<unit> element is not present)" ); 190 191 addField( "lodType", TYPEID< ColladaUtils::ImportOptions::eLodType >(), Offset(mOptions.lodType, TSShapeConstructor), 192 "Control how the COLLADA (.dae) importer interprets LOD in the model. No effect for DTS files.\n" 193 "Set to one of the following values:\n" 194 "<dl><dt>DetectDTS</dt><dd>The default value. Instructs the importer to search for a 'baseXXX->startXXX' node hierarchy at the root level. If found, the importer acts as if ''TrailingNumber'' was set. Otherwise, all geometry is imported at a single detail size.</dd>" 195 "<dt>SingleSize</dt><dd>All geometry is imported at a fixed detail size. Numbers at the end of geometry node's are ignored.</dd>" 196 "<dt>TrailingNumber</dt><dd>Numbers at the end of geometry node's name are interpreted as the detail size (similar to DTS exporting). Geometry instances with the same base name but different trailing number are grouped into the same object.</dd>" 197 "<dt>DEFAULT</dt><dd>The default value. Use the value in the .dae file (defaults to Z_AXIS if the <up_axis> element is not present).</dd></dl>" ); 198 199 addField( "singleDetailSize", TypeS32, Offset(mOptions.singleDetailSize, TSShapeConstructor), 200 "Sets the detail size when lodType is set to SingleSize. No effect otherwise, and no effect for DTS files.\n" 201 "@see lodType" ); 202 203 addField( "matNamePrefix", TypeRealString, Offset(mOptions.matNamePrefix, TSShapeConstructor), 204 "Prefix to apply to all material map names in the COLLADA (.dae) file. No effect for DTS files.\n" 205 "This field is useful to avoid material name clashes for exporters that generate generic material " 206 "names like \"texture0\" or \"material1\"." ); 207 208 addField( "alwaysImport", TypeRealString, Offset(mOptions.alwaysImport, TSShapeConstructor), 209 "TAB separated patterns of nodes to import even if in neverImport list. No effect for DTS files.\n" 210 "Torque allows unwanted nodes in COLLADA (.dae) files to to be ignored " 211 "during import. This field contains a TAB separated list of patterns to " 212 "match node names. Any node that matches one of the patterns in the list " 213 "will <b>always</b> be imported, even if it also matches the neverImport list\n" 214 "@see neverImport\n\n" 215 "@tsexample\n" 216 "singleton TSShapeConstructor(MyShapeDae)\n" 217 "{\n" 218 " baseShape = \"./myShape.dae\";\n" 219 " alwaysImport = \"mount*\" TAB \"eye\";\n" 220 " neverImport = \"*-PIVOT\";\n" 221 "}\n" 222 "@endtsexample" ); 223 224 addField( "neverImport", TypeRealString, Offset(mOptions.neverImport, TSShapeConstructor), 225 "TAB separated patterns of nodes to ignore on loading. No effect for DTS files.\n" 226 "Torque allows unwanted nodes in COLLADA (.dae) files to to be ignored " 227 "during import. This field contains a TAB separated list of patterns to " 228 "match node names. Any node that matches one of the patterns in the list will " 229 "not be imported (unless it matches the alwaysImport list.\n" 230 "@see alwaysImport" ); 231 232 addField( "alwaysImportMesh", TypeRealString, Offset(mOptions.alwaysImportMesh, TSShapeConstructor), 233 "TAB separated patterns of meshes to import even if in neverImportMesh list. No effect for DTS files.\n" 234 "Torque allows unwanted meshes in COLLADA (.dae) files to to be ignored " 235 "during import. This field contains a TAB separated list of patterns to " 236 "match mesh names. Any mesh that matches one of the patterns in the list " 237 "will <b>always</b> be imported, even if it also matches the neverImportMesh list\n" 238 "@see neverImportMesh\n\n" 239 "@tsexample\n" 240 "singleton TSShapeConstructor(MyShapeDae)\n" 241 "{\n" 242 " baseShape = \"./myShape.dae\";\n" 243 " alwaysImportMesh = \"body*\" TAB \"armor\" TAB \"bounds\";\n" 244 " neverImportMesh = \"*-dummy\";\n" 245 "}\n" 246 "@endtsexample" ); 247 248 addField( "neverImportMesh", TypeRealString, Offset(mOptions.neverImportMesh, TSShapeConstructor), 249 "TAB separated patterns of meshes to ignore on loading. No effect for DTS files.\n" 250 "Torque allows unwanted meshes in COLLADA (.dae) files to to be ignored " 251 "during import. This field contains a TAB separated list of patterns to " 252 "match mesh names. Any mesh that matches one of the patterns in the list will " 253 "not be imported (unless it matches the alwaysImportMesh list.\n" 254 "@see alwaysImportMesh" ); 255 256 addField( "ignoreNodeScale", TypeBool, Offset(mOptions.ignoreNodeScale, TSShapeConstructor), 257 "Ignore <scale> elements inside COLLADA <node>s. No effect for DTS files.\n" 258 "This field is a workaround for certain exporters that generate bad node " 259 "scaling, and is not usually required." ); 260 261 addField( "adjustCenter", TypeBool, Offset(mOptions.adjustCenter, TSShapeConstructor), 262 "Translate COLLADA model on import so the origin is at the center. No effect for DTS files." ); 263 264 addField( "adjustFloor", TypeBool, Offset(mOptions.adjustFloor, TSShapeConstructor), 265 "Translate COLLADA model on import so origin is at the (Z axis) bottom of the model. No effect for DTS files.\n" 266 "This can be used along with adjustCenter to have the origin at the " 267 "center of the bottom of the model.\n" 268 "@see adjustCenter" ); 269 270 addField( "forceUpdateMaterials", TypeBool, Offset(mOptions.forceUpdateMaterials, TSShapeConstructor), 271 "Forces update of the materials.cs file in the same folder as the COLLADA " 272 "(.dae) file, even if Materials already exist. No effect for DTS files.\n" 273 "Normally only Materials that are not already defined are written to materials.cs." ); 274 endGroup( "Collada" ); 275 276 addGroup( "Sequences" ); 277 addProtectedField( "sequence", TypeStringFilename, NULL, &addSequenceFromField, &emptyStringProtectedGetFn, 278 "Legacy method of adding sequences to a DTS or DAE shape after loading.\n\n" 279 "@tsexample\n" 280 "singleton TSShapeConstructor(MyShapeDae)\n" 281 "{\n" 282 " baseShape = \"./myShape.dae\";\n" 283 " sequence = \"../anims/root.dae root\";\n" 284 " sequence = \"../anims/walk.dae walk\";\n" 285 " sequence = \"../anims/jump.dsq jump\";\n" 286 "}\n" 287 "@endtsexample" ); 288 endGroup( "Sequences" ); 289 290 Parent::initPersistFields(); 291} 292 293void TSShapeConstructor::consoleInit() 294{ 295 Parent::consoleInit(); 296 297 Con::addVariable( "$pref::TSShapeConstructor::CapsuleShapePath", TypeRealString, &TSShapeConstructor::smCapsuleShapePath, 298 "The file path to the capsule shape used by tsMeshFit.\n\n" 299 "@ingroup MeshFit\n" ); 300 301 Con::addVariable( "$pref::TSShapeConstructor::CubeShapePath", TypeRealString, &TSShapeConstructor::smCubeShapePath, 302 "The file path to the cube shape used by tsMeshFit.\n\n" 303 "@ingroup MeshFit\n" ); 304 305 Con::addVariable( "$pref::TSShapeConstructor::SphereShapePath", TypeRealString, &TSShapeConstructor::smSphereShapePath, 306 "The file path to the sphere shape used by tsMeshFit.\n\n" 307 "@ingroup MeshFit\n" ); 308} 309 310TSShapeConstructor* TSShapeConstructor::findShapeConstructor(const FileName& path) 311{ 312 SimGroup *group; 313 if (Sim::findObject( "TSShapeConstructorGroup", group )) 314 { 315 // Find the TSShapeConstructor object for the given shape file 316 for (S32 i = 0; i < group->size(); i++) 317 { 318 TSShapeConstructor* tss = dynamic_cast<TSShapeConstructor*>( group->at(i) ); 319 if ( tss->mShapePath.equal( path, String::NoCase ) ) 320 return tss; 321 } 322 } 323 return NULL; 324} 325 326//----------------------------------------------------------------------------- 327bool TSShapeConstructor::onAdd() 328{ 329 if ( !Parent::onAdd() ) 330 return false; 331 332 // Prevent multiple objects pointing at the same shape file 333 TSShapeConstructor* tss = findShapeConstructor( mShapePath ); 334 if ( tss ) 335 { 336 Con::errorf("TSShapeConstructor::onAdd failed: %s is already referenced by " 337 "another TSShapeConstructor object (%s - %d)", mShapePath.c_str(), 338 tss->getName(), tss->getId()); 339 return false; 340 } 341 342 // Add to the TSShapeConstructor group (for lookups) 343 SimGroup *group; 344 if ( !Sim::findObject( "TSShapeConstructorGroup", group ) ) 345 { 346 group = new SimGroup(); 347 if ( !group->registerObject("TSShapeConstructorGroup") ) 348 { 349 Con::errorf("TSShapeConstructor::onAdd failed: Could not register " 350 "TSShapeConstructorGroup"); 351 return false; 352 } 353 Sim::getRootGroup()->addObject( group ); 354 } 355 group->addObject( this ); 356 357 // This is only here for backwards compatibility! 358 // 359 // If we have no sequences, it may be using the older sequence# syntax. 360 // Check for dynamic fields of that pattern and add them into the sequence vector. 361 if ( mSequences.empty() ) 362 { 363 for ( U32 idx = 0; idx < MaxLegacySequences; idx++ ) 364 { 365 String field = String::ToString( "sequence%d", idx ); 366 const char *data = getDataField( StringTable->insert(field.c_str()), NULL ); 367 368 // Break at first field not used 369 if ( !data || !data[0] ) 370 break; 371 372 // By pushing the field thru Con::setData for TypeStringFilename 373 // we get the default filename expansion. If we didn't do this 374 // then we would have unexpanded ~/ in the file paths. 375 String expanded; 376 Con::setData( TypeStringFilename, &expanded, 0, 1, &data ); 377 addSequenceFromField( this, NULL, expanded.c_str() ); 378 } 379 } 380 381 // If an instance of this shape has already been loaded, call onLoad now 382 Resource<TSShape> shape = ResourceManager::get().find( mShapePath ); 383 384 if ( shape ) 385 _onLoad( shape ); 386 387 if (mShape && mShape->needsReinit()) 388 { 389 mShape->init(); 390 } 391 392 return true; 393} 394 395//----------------------------------------------------------------------------- 396 397void TSShapeConstructor::_onLoad(TSShape* shape) 398{ 399 // Check if we should unload first 400 if ( mShape ) 401 _onUnload(); 402 403 #ifdef DEBUG_SPEW 404 Con::printf( "[TSShapeConstructor] attaching to shape '%s'", mShapePath.c_str() ); 405 #endif 406 407 mShape = shape; 408 mChangeSet.clear(); 409 mLoadingShape = true; 410 411 // Add sequences defined using field syntax 412 for ( S32 i = 0; i < mSequences.size(); i++ ) 413 { 414 if ( mSequences[i].isEmpty() ) 415 continue; 416 417 // Split the sequence path from the target sequence name 418 String destName; 419 String srcPath( mSequences[i] ); 420 SplitSequencePathAndName( srcPath, destName ); 421 422 addSequence( srcPath, destName ); 423 } 424 425 // Call script function 426 onLoad_callback(); 427 mLoadingShape = false; 428} 429 430//----------------------------------------------------------------------------- 431 432void TSShapeConstructor::_onUnload() 433{ 434 #ifdef DEBUG_SPEW 435 Con::printf( "[TSShapeConstructor] detaching from '%s'", mShapePath.c_str() ); 436 #endif 437 438 onUnload_callback(); 439 440 mShape = NULL; 441} 442 443//----------------------------------------------------------------------------- 444// Storage 445 446bool TSShapeConstructor::writeField(StringTableEntry fieldname, const char *value) 447{ 448 // Ignore the sequence fields (these are written as 'addSequence' commands instead) 449 if ( dStrnicmp( fieldname, "sequence", 8 ) == 0 ) 450 return false; 451 else if ( dStrnicmp( fieldname, "baseShape", 9 ) == 0 ) 452 { 453 // Small hack to only write the base filename (no path) since the 454 // TSShapeConstructor script must be in the same folder as the model, and 455 // then we can easily copy both around without having to change the field 456 const char* filename = dStrrchr( value, '/' ); 457 if ( filename > value ) 458 { 459 S32 len = dStrlen( filename ); 460 dMemmove((void*)(value + 1), filename, len ); 461 ((char*)value)[0] = '.'; 462 ((char*)value)[len + 1] = '\0'; 463 } 464 return true; 465 } 466 467 return Parent::writeField( fieldname, value ); 468} 469 470//----------------------------------------------------------------------------- 471// Console utility methods 472 473// These macros take care of doing node, sequence and object lookups, including 474// printing error messages to the console if the element cannot be found. 475 476// Check that the given index is valid (0 - max-1). If not, generate an 477// error and return. 478#define CHECK_INDEX_IN_RANGE(func, index, maxIndex, ret) \ 479 if ( ( index < 0 ) || ( index >= maxIndex ) ) \ 480 { \ 481 Con::errorf( "TSShapeConstructor::" #func ": index out of " \ 482 "range (0-%d)", maxIndex-1); \ 483 return ret; \ 484 } 485 486// Do a node lookup and allow the root node name ("") 487#define GET_NODE_INDEX_ALLOW_ROOT(func, var, name, ret) \ 488 S32 var##Index = -1; \ 489 if (name[0]) \ 490 { \ 491 var##Index = mShape->findNode(name); \ 492 if (var##Index < 0) \ 493 { \ 494 Con::errorf( "TSShapeConstructor::" #func ": Could not " \ 495 "find node '%s'", name); \ 496 return ret; \ 497 } \ 498 } \ 499 TSShape::Node* var = var##Index < 0 ? NULL : &(mShape->nodes[var##Index]); \ 500 TORQUE_UNUSED(var##Index); \ 501 TORQUE_UNUSED(var) 502 503// Do a node lookup, root node ("") is not allowed 504#define GET_NODE_INDEX_NO_ROOT(func, var, name, ret) \ 505 S32 var##Index = mShape->findNode(name); \ 506 if (var##Index < 0) \ 507 { \ 508 Con::errorf( "TSShapeConstructor::" #func ": Could not find " \ 509 "node '%s'", name); \ 510 return ret; \ 511 } \ 512 TSShape::Node* var = &(mShape->nodes[var##Index]); \ 513 TORQUE_UNUSED(var##Index); \ 514 TORQUE_UNUSED(var) 515 516// Do an object lookup 517#define GET_OBJECT(func, var, name, ret) \ 518 S32 var##Index = mShape->findObject(name); \ 519 if (var##Index < 0) \ 520 { \ 521 Con::errorf( "TSShapeConstructor::" #func ": Could not find " \ 522 "object '%s'", name); \ 523 return ret; \ 524 } \ 525 TSShape::Object* var = &(mShape->objects[var##Index]); \ 526 TORQUE_UNUSED(var##Index); \ 527 TORQUE_UNUSED(var) 528 529// Do a mesh lookup 530#define GET_MESH(func, var, name, ret) \ 531 TSMesh* var = mShape->findMesh(name); \ 532 if (!var) \ 533 { \ 534 Con::errorf( "TSShapeConstructor::" #func ": Could not find " \ 535 "mesh '%s'", name); \ 536 return ret; \ 537 } 538 539// Do a sequence lookup 540#define GET_SEQUENCE(func, var, name, ret) \ 541 S32 var##Index = mShape->findSequence(name); \ 542 if (var##Index < 0) \ 543 { \ 544 Con::errorf( "TSShapeConstructor::" #func ": Could not find " \ 545 "sequence named '%s'", name); \ 546 return ret; \ 547 } \ 548 TSShape::Sequence* var = &(mShape->sequences[var##Index]); \ 549 TORQUE_UNUSED(var##Index); \ 550 TORQUE_UNUSED(var); 551 552 553//----------------------------------------------------------------------------- 554// DUMP 555DefineTSShapeConstructorMethod( dumpShape, void, ( const char* filename ), ( "" ), 556 ( filename ),, 557 "Dump the shape hierarchy to the console or to a file. Useful for reviewing " 558 "the result of a series of construction commands.\n" 559 "@param filename Destination filename. If not specified, dump to console.\n\n" 560 "@tsexample\n" 561 "%this.dumpShape(); // dump to console\n" 562 "%this.dumpShape( \"./dump.txt\" ); // dump to file\n" 563 "@endtsexample\n" ) 564{ 565 TSShapeInstance* tsi = new TSShapeInstance( mShape, false ); 566 567 if ( dStrEqual( filename, "" ) ) 568 { 569 // Dump the constructed shape to a memory stream 570 MemStream* dumpStream = new MemStream( 8192 ); 571 tsi->dump( *dumpStream ); 572 573 // Write stream to the console 574 U32 end = dumpStream->getPosition(); 575 dumpStream->setPosition( 0 ); 576 while ( dumpStream->getPosition() < end ) 577 { 578 char line[1024]; 579 dumpStream->readLine( (U8*)line, sizeof(line) ); 580 Con::printf( line ); 581 } 582 583 delete dumpStream; 584 } 585 else 586 { 587 // Dump constructed shape to file 588 char filenameBuf[1024]; 589 Con::expandScriptFilename( filenameBuf, sizeof(filenameBuf), filename ); 590 591 FileStream* dumpStream = new FileStream; 592 if ( dumpStream->open( filenameBuf, Torque::FS::File::Write ) ) 593 { 594 tsi->dump( *dumpStream ); 595 dumpStream->close(); 596 } 597 else 598 Con::errorf( "dumpShape failed: Could not open file '%s' for writing", filenameBuf ); 599 600 delete dumpStream; 601 } 602 603 delete tsi; 604}} 605 606DefineTSShapeConstructorMethod( saveShape, void, ( const char* filename ),, 607 ( filename ),, 608 "Save the shape (with all current changes) to a new DTS file.\n" 609 "@param filename Destination filename.\n\n" 610 "@tsexample\n" 611 "%this.saveShape( \"./myShape.dts\" );\n" 612 "@endtsexample\n" ) 613{ 614 char filenameBuf[1024]; 615 Con::expandScriptFilename( filenameBuf, sizeof(filenameBuf), filename ); 616 617 FileStream* dtsStream = new FileStream; 618 if ( dtsStream->open( filenameBuf, Torque::FS::File::Write ) ) 619 { 620 mShape->write( dtsStream ); 621 dtsStream->close(); 622 } 623 else 624 { 625 Con::errorf( "saveShape failed: Could not open '%s' for writing", filenameBuf ); 626 } 627 delete dtsStream; 628}} 629 630DefineTSShapeConstructorMethod( writeChangeSet, void, (),, 631 (),, 632 "Write the current change set to a TSShapeConstructor script file. The " 633 "name of the script file is the same as the model, but with .cs extension. " 634 "eg. myShape.cs for myShape.dts or myShape.dae.\n" ) 635{ 636 Torque::Path scriptPath( mShapePath ); 637 scriptPath.setExtension( "cs" ); 638 639 // Read current file contents 640 FileObject f; 641 f.readMemory( scriptPath.getFullPath() ); 642 643 // Write new file 644 FileStream *stream; 645 if ((stream = FileStream::createAndOpen( scriptPath.getFullPath(), Torque::FS::File::Write )) == NULL) 646 { 647 Con::errorf( "Failed to write TSShapeConstructor change set to %s", scriptPath.getFullPath().c_str() ); 648 return; 649 } 650 651 // Write existing file contents up to the start of the onLoad function 652 String beginMessage( avar( "function %s::onLoad(%%this)", getName() ) ); 653 String endMessage( "}" ); 654 655 while ( !f.isEOF() ) 656 { 657 const char* buffer = (const char *) f.readLine(); 658 if ( !dStrcmp( buffer, beginMessage )) 659 break; 660 stream->writeText( buffer ); 661 stream->writeText( "\r\n" ); 662 } 663 664 // Write the new contents 665 if ( f.isEOF() ) 666 stream->writeText( "\r\n" ); 667 stream->writeText( beginMessage ); 668 stream->writeText( "\r\n{\r\n" ); 669 670 mChangeSet.write( mShape, *stream, scriptPath.getPath() ); 671 672 stream->writeText( endMessage ); 673 stream->writeText( "\r\n" ); 674 675 // Now skip the contents of the function 676 while ( !f.isEOF() ) 677 { 678 const char* buffer = (const char *) f.readLine(); 679 if ( !dStrcmp( buffer, endMessage )) 680 break; 681 } 682 683 // Write the remainder of the existing file contents 684 while( !f.isEOF() ) 685 { 686 const char* buffer = (const char *) f.readLine(); 687 stream->writeText( buffer ); 688 stream->writeText( "\r\n" ); 689 } 690 691 delete stream; 692}} 693 694DefineTSShapeConstructorMethod( notifyShapeChanged, void, (),, 695 (),, 696 "Notify game objects that this shape file has changed, allowing them to update " 697 "internal data if needed." ) 698{ 699 ResourceManager::get().getChangedSignal().trigger( mShapePath ); 700}} 701 702//----------------------------------------------------------------------------- 703// NODES 704DefineTSShapeConstructorMethod( getNodeCount, S32, (),, 705 (), 0, 706 "Get the total number of nodes in the shape.\n" 707 "@return the number of nodes in the shape.\n\n" 708 "@tsexample\n" 709 "%count = %this.getNodeCount();\n" 710 "@endtsexample\n" ) 711{ 712 return mShape->nodes.size(); 713}} 714 715DefineTSShapeConstructorMethod( getNodeIndex, S32, ( const char* name ),, 716 ( name ), -1, 717 "Get the index of the node.\n" 718 "@param name name of the node to lookup.\n" 719 "@return the index of the named node, or -1 if no such node exists.\n\n" 720 "@tsexample\n" 721 "// get the index of Bip01 Pelvis node in the shape\n" 722 "%index = %this.getNodeIndex( \"Bip01 Pelvis\" );\n" 723 "@endtsexample\n" ) 724{ 725 return mShape->findNode( name ); 726}} 727 728DefineTSShapeConstructorMethod( getNodeName, const char*, ( S32 index ),, 729 ( index ), "", 730 "Get the name of the indexed node.\n" 731 "@param index index of the node to lookup (valid range is 0 - getNodeCount()-1).\n" 732 "@return the name of the indexed node, or \"\" if no such node exists.\n\n" 733 "@tsexample\n" 734 "// print the names of all the nodes in the shape\n" 735 "%count = %this.getNodeCount();\n" 736 "for (%i = 0; %i < %count; %i++)\n" 737 " echo(%i SPC %this.getNodeName(%i));\n" 738 "@endtsexample\n" ) 739{ 740 CHECK_INDEX_IN_RANGE( getNodeName, index, mShape->nodes.size(), "" ); 741 return mShape->getName( mShape->nodes[index].nameIndex ); 742}} 743 744DefineTSShapeConstructorMethod( getNodeParentName, const char*, ( const char* name ),, 745 ( name ), "", 746 "Get the name of the node's parent. If the node has no parent (ie. it is at " 747 "the root level), return an empty string.\n" 748 "@param name name of the node to query.\n" 749 "@return the name of the node's parent, or \"\" if the node is at the root level\n\n" 750 "@tsexample\n" 751 "echo( \"Bip01 Pelvis parent = \" @ %this.getNodeParentName( \"Bip01 Pelvis \") );\n" 752 "@endtsexample\n" ) 753{ 754 GET_NODE_INDEX_NO_ROOT( getNodeParentName, node, name, "" ); 755 756 if ( node->parentIndex < 0 ) 757 return ""; 758 else 759 return mShape->getName( mShape->nodes[node->parentIndex].nameIndex ); 760}} 761 762DefineTSShapeConstructorMethod( setNodeParent, bool, ( const char* name, const char* parentName ),, 763 ( name, parentName ), false, 764 "Set the parent of a node.\n" 765 "@param name name of the node to modify\n" 766 "@param parentName name of the parent node to set (use \"\" to move the node to the root level)\n" 767 "@return true if successful, false if failed\n\n" 768 "@tsexample\n" 769 "%this.setNodeParent( \"Bip01 Pelvis\", \"start01\" );\n" 770 "@endtsexample\n" ) 771{ 772 GET_NODE_INDEX_NO_ROOT( setNodeParent, node, name, false ); 773 GET_NODE_INDEX_ALLOW_ROOT( setNodeParent, parent, parentName, false ); 774 775 node->parentIndex = parentIndex; 776 ADD_TO_CHANGE_SET(); 777 778 return true; 779}} 780 781DefineTSShapeConstructorMethod( getNodeChildCount, S32, ( const char* name ),, 782 ( name ), 0, 783 "Get the number of children of this node.\n" 784 "@param name name of the node to query.\n" 785 "@return the number of child nodes.\n\n" 786 "@tsexample\n" 787 "%count = %this.getNodeChildCount( \"Bip01 Pelvis\" );\n" 788 "@endtsexample\n" ) 789{ 790 GET_NODE_INDEX_ALLOW_ROOT( getNodeChildCount, node, name, 0 ); 791 792 Vector<S32> nodeChildren; 793 mShape->getNodeChildren( nodeIndex, nodeChildren ); 794 return nodeChildren.size(); 795}} 796 797DefineTSShapeConstructorMethod( getNodeChildName, const char*, ( const char* name, S32 index ),, 798 ( name, index ), "", 799 "Get the name of the indexed child node.\n" 800 "@param name name of the parent node to query.\n" 801 "@param index index of the child node (valid range is 0 - getNodeChildName()-1).\n" 802 "@return the name of the indexed child node.\n\n" 803 "@tsexample\n" 804 "function dumpNode( %shape, %name, %indent )\n" 805 "{\n" 806 " echo( %indent @ %name );\n" 807 " %count = %shape.getNodeChildCount( %name );\n" 808 " for ( %i = 0; %i < %count; %i++ )\n" 809 " dumpNode( %shape, %shape.getNodeChildName( %name, %i ), %indent @ \" \" );\n" 810 "}\n\n" 811 "function dumpShape( %shape )\n" 812 "{\n" 813 " // recursively dump node hierarchy\n" 814 " %count = %shape.getNodeCount();\n" 815 " for ( %i = 0; %i < %count; %i++ )\n" 816 " {\n" 817 " // dump top level nodes\n" 818 " %name = %shape.getNodeName( %i );\n" 819 " if ( %shape.getNodeParentName( %name ) $= "" )\n" 820 " dumpNode( %shape, %name, \"\" );\n" 821 " }\n" 822 "}\n" 823 "@endtsexample\n" ) 824{ 825 GET_NODE_INDEX_ALLOW_ROOT( getNodeChildName, node, name, "" ); 826 827 Vector<S32> nodeChildren; 828 mShape->getNodeChildren( nodeIndex, nodeChildren ); 829 CHECK_INDEX_IN_RANGE( getNodeChildName, index, nodeChildren.size(), "" ); 830 831 return mShape->getName( mShape->nodes[nodeChildren[index]].nameIndex ); 832}} 833 834DefineTSShapeConstructorMethod( getNodeObjectCount, S32, ( const char* name ),, 835 ( name ), 0, 836 "Get the number of geometry objects attached to this node.\n" 837 "@param name name of the node to query.\n" 838 "@return the number of attached objects.\n\n" 839 "@tsexample\n" 840 "%count = %this.getNodeObjectCount( \"Bip01 Head\" );\n" 841 "@endtsexample\n" ) 842{ 843 GET_NODE_INDEX_ALLOW_ROOT( getNodeObjectCount, node, name, 0 ); 844 845 Vector<S32> nodeObjects; 846 mShape->getNodeObjects( nodeIndex, nodeObjects ); 847 return nodeObjects.size(); 848}} 849 850DefineTSShapeConstructorMethod( getNodeObjectName, const char*, ( const char* name, S32 index ),, 851 ( name, index ), "", 852 "Get the name of the indexed object.\n" 853 "@param name name of the node to query.\n" 854 "@param index index of the object (valid range is 0 - getNodeObjectCount()-1).\n" 855 "@return the name of the indexed object.\n\n" 856 "@tsexample\n" 857 "// print the names of all objects attached to the node\n" 858 "%count = %this.getNodeObjectCount( \"Bip01 Head\" );\n" 859 "for ( %i = 0; %i < %count; %i++ )\n" 860 " echo( %this.getNodeObjectName( \"Bip01 Head\", %i ) );\n" 861 "@endtsexample\n" ) 862{ 863 GET_NODE_INDEX_ALLOW_ROOT( getNodeObjectName, node, name, "" ); 864 865 Vector<S32> nodeObjects; 866 mShape->getNodeObjects( nodeIndex, nodeObjects ); 867 CHECK_INDEX_IN_RANGE( getNodeObjectName, index, nodeObjects.size(), "" ); 868 869 return mShape->getName( mShape->objects[nodeObjects[index]].nameIndex ); 870}} 871 872DefineTSShapeConstructorMethod( getNodeTransform, TransformF, ( const char* name, bool isWorld ), ( false ), 873 ( name, isWorld ), TransformF::Identity, 874 "Get the base (ie. not animated) transform of a node.\n" 875 "@param name name of the node to query.\n" 876 "@param isWorld true to get the global transform, false (or omitted) to get " 877 "the local-to-parent transform.\n" 878 "@return the node transform in the form \"pos.x pos.y pos.z rot.x rot.y rot.z rot.angle\".\n\n" 879 "@tsexample\n" 880 "%ret = %this.getNodeTransform( \"mount0\" );\n" 881 "%this.setNodeTransform( \"mount4\", %ret );\n" 882 "@endtsexample\n" ) 883{ 884 GET_NODE_INDEX_NO_ROOT( getNodeTransform, node, name, TransformF::Identity ); 885 886 // Get the node transform 887 Point3F pos; 888 AngAxisF aa; 889 890 if ( isWorld ) 891 { 892 // World transform 893 MatrixF mat; 894 mShape->getNodeWorldTransform( nodeIndex, &mat ); 895 pos = mat.getPosition(); 896 aa.set( mat ); 897 } 898 else 899 { 900 // Local transform 901 pos = mShape->defaultTranslations[nodeIndex]; 902 const Quat16& q16 = mShape->defaultRotations[nodeIndex]; 903 aa.set( q16.getQuatF() ); 904 } 905 906 return TransformF( pos, aa ); 907}} 908 909DefineTSShapeConstructorMethod( setNodeTransform, bool, ( const char* name, TransformF txfm, bool isWorld ), ( false ), 910 ( name, txfm, isWorld ), false, 911 "Set the base transform of a node. That is, the transform of the node when " 912 "in the root (not-animated) pose.\n" 913 "@param name name of the node to modify\n" 914 "@param txfm transform string of the form: \"pos.x pos.y pos.z rot.x rot.y rot.z rot.angle\"\n" 915 "@param isworld (optional) flag to set the local-to-parent or the global " 916 "transform. If false, or not specified, the position and orientation are " 917 "treated as relative to the node's parent.\n" 918 "@return true if successful, false otherwise\n\n" 919 "@tsexample\n" 920 "%this.setNodeTransform( \"mount0\", \"0 0 1 0 0 1 0\" );\n" 921 "%this.setNodeTransform( \"mount0\", \"0 0 0 0 0 1 1.57\" );\n" 922 "%this.setNodeTransform( \"mount0\", \"1 0 0 0 0 1 0\", true );\n" 923 "@endtsexample\n" ) 924{ 925 GET_NODE_INDEX_NO_ROOT( setNodeTransform, node, name, false ); 926 927 Point3F pos( txfm.getPosition() ); 928 QuatF rot( txfm.getOrientation() ); 929 930 if ( isWorld ) 931 { 932 // World transform 933 934 // Get the node's parent (if any) 935 if ( node->parentIndex != -1 ) 936 { 937 MatrixF mat; 938 mShape->getNodeWorldTransform( node->parentIndex, &mat ); 939 940 // Pre-multiply by inverse of parent's world transform to get 941 // local node transform 942 mat.inverse(); 943 mat.mul( txfm.getMatrix() ); 944 945 rot.set( mat ); 946 pos = mat.getPosition(); 947 } 948 } 949 950 if ( !mShape->setNodeTransform( name, pos, rot) ) 951 return false; 952 953 ADD_TO_CHANGE_SET(); 954 return true; 955}} 956 957DefineTSShapeConstructorMethod( renameNode, bool, ( const char* oldName, const char* newName ),, 958 ( oldName, newName ), false, 959 "Rename a node.\n" 960 "@note Note that node names must be unique, so this command will fail if " 961 "there is already a node with the desired name\n" 962 "@param oldName current name of the node\n" 963 "@param newName new name of the node\n" 964 "@return true if successful, false otherwise\n\n" 965 "@tsexample\n" 966 "%this.renameNode( \"Bip01 L Hand\", \"mount5\" );\n" 967 "@endtsexample\n" ) 968{ 969 GET_NODE_INDEX_NO_ROOT( renameNode, node, oldName, false ); 970 971 if ( !mShape->renameNode( oldName, newName ) ) 972 return false; 973 974 ADD_TO_CHANGE_SET(); 975 return true; 976}} 977 978DefineTSShapeConstructorMethod( addNode, bool, ( const char* name, const char* parentName, TransformF txfm, bool isWorld ), ( TransformF::Identity, false ), 979 ( name, parentName, txfm, isWorld ), false, 980 "Add a new node.\n" 981 "@param name name for the new node (must not already exist)\n" 982 "@param parentName name of an existing node to be the parent of the new node. " 983 "If empty (\"\"), the new node will be at the root level of the node hierarchy.\n" 984 "@param txfm (optional) transform string of the form: \"pos.x pos.y pos.z rot.x rot.y rot.z rot.angle\"\n" 985 "@param isworld (optional) flag to set the local-to-parent or the global " 986 "transform. If false, or not specified, the position and orientation are " 987 "treated as relative to the node's parent.\n" 988 "@return true if successful, false otherwise\n\n" 989 "@tsexample\n" 990 "%this.addNode( \"Nose\", \"Bip01 Head\", \"0 2 2 0 0 1 0\" );\n" 991 "%this.addNode( \"myRoot\", \"\", \"0 0 4 0 0 1 1.57\" );\n" 992 "%this.addNode( \"Nodes\", \"Bip01 Head\", \"0 2 0 0 0 1 0\", true );\n" 993 "@endtsexample\n" ) 994{ 995 Point3F pos( txfm.getPosition() ); 996 QuatF rot( txfm.getOrientation() ); 997 998 if ( isWorld ) 999 { 1000 // World transform 1001 1002 // Get the node's parent (if any) 1003 S32 parentIndex = mShape->findNode( parentName ); 1004 if ( parentIndex != -1 ) 1005 { 1006 MatrixF mat; 1007 mShape->getNodeWorldTransform( parentIndex, &mat ); 1008 1009 // Pre-multiply by inverse of parent's world transform to get 1010 // local node transform 1011 mat.inverse(); 1012 mat.mul( txfm.getMatrix() ); 1013 1014 rot.set( mat ); 1015 pos = mat.getPosition(); 1016 } 1017 } 1018 1019 if ( !mShape->addNode( name, parentName, pos, rot ) ) 1020 return false; 1021 1022 ADD_TO_CHANGE_SET(); 1023 return true; 1024}} 1025 1026DefineTSShapeConstructorMethod( removeNode, bool, ( const char* name ),, 1027 ( name ), false, 1028 "Remove a node from the shape.\n" 1029 "The named node is removed from the shape, including from any sequences that " 1030 "use the node. Child nodes and objects attached to the node are re-assigned " 1031 "to the node's parent.\n" 1032 "@param name name of the node to remove.\n" 1033 "@return true if successful, false otherwise.\n\n" 1034 "@tsexample\n" 1035 "%this.removeNode( \"Nose\" );\n" 1036 "@endtsexample\n" ) 1037{ 1038 GET_NODE_INDEX_NO_ROOT( removeNode, node, name, false ); 1039 1040 if ( !mShape->removeNode( name ) ) 1041 return false; 1042 1043 ADD_TO_CHANGE_SET(); 1044 return true; 1045}} 1046 1047//----------------------------------------------------------------------------- 1048// MATERIALS 1049 1050DefineTSShapeConstructorMethod( getTargetCount, S32, (),, (), 0, 1051 "Get the number of materials in the shape.\n" 1052 "@return the number of materials in the shape.\n\n" 1053 "@tsexample\n" 1054 "%count = %this.getTargetCount();\n" 1055 "@endtsexample\n" ) 1056{ 1057 return mShape->getTargetCount(); 1058}} 1059 1060DefineTSShapeConstructorMethod( getTargetName, const char*, ( S32 index ),, 1061 ( index ), "", 1062 "Get the name of the indexed shape material.\n" 1063 "@param index index of the material to get (valid range is 0 - getTargetCount()-1).\n" 1064 "@return the name of the indexed material.\n\n" 1065 "@tsexample\n" 1066 "%count = %this.getTargetCount();\n" 1067 "for ( %i = 0; %i < %count; %i++ )\n" 1068 " echo( \"Target \" @ %i @ \": \" @ %this.getTargetName( %i ) );\n" 1069 "@endtsexample\n" ) 1070{ 1071 return mShape->getTargetName( index ); 1072}} 1073 1074//----------------------------------------------------------------------------- 1075// OBJECTS 1076 1077DefineTSShapeConstructorMethod( getObjectCount, S32, (),, (), 0, 1078 "Get the total number of objects in the shape.\n" 1079 "@return the number of objects in the shape.\n\n" 1080 "@tsexample\n" 1081 "%count = %this.getObjectCount();\n" 1082 "@endtsexample\n" ) 1083{ 1084 return mShape->objects.size(); 1085}} 1086 1087DefineTSShapeConstructorMethod( getObjectName, const char*, ( S32 index ),, 1088 ( index ), "", 1089 "Get the name of the indexed object.\n" 1090 "@param index index of the object to get (valid range is 0 - getObjectCount()-1).\n" 1091 "@return the name of the indexed object.\n\n" 1092 "@tsexample\n" 1093 "// print the names of all objects in the shape\n" 1094 "%count = %this.getObjectCount();\n" 1095 "for ( %i = 0; %i < %count; %i++ )\n" 1096 " echo( %i SPC %this.getObjectName( %i ) );\n" 1097 "@endtsexample\n" ) 1098{ 1099 CHECK_INDEX_IN_RANGE( getObjectName, index, mShape->objects.size(), "" ); 1100 1101 return mShape->getName( mShape->objects[index].nameIndex ); 1102}} 1103 1104DefineTSShapeConstructorMethod( getObjectIndex, S32, ( const char* name ),, 1105 ( name ), -1, 1106 "Get the index of the first object with the given name.\n" 1107 "@param name name of the object to get.\n" 1108 "@return the index of the named object.\n\n" 1109 "@tsexample\n" 1110 "%index = %this.getObjectIndex( \"Head\" );\n" 1111 "@endtsexample\n" ) 1112{ 1113 return mShape->findObject( name ); 1114}} 1115 1116DefineTSShapeConstructorMethod( getObjectNode, const char*, ( const char* name ),, 1117 ( name ), "", 1118 "Get the name of the node this object is attached to.\n" 1119 "@param name name of the object to get.\n" 1120 "@return the name of the attached node, or an empty string if this " 1121 "object is not attached to a node (usually the case for skinned meshes).\n\n" 1122 "@tsexample\n" 1123 "echo( \"Hand is attached to \" @ %this.getObjectNode( \"Hand\" ) );\n" 1124 "@endtsexample\n" ) 1125{ 1126 GET_OBJECT( getObjectNode, obj, name, 0 ); 1127 if ( obj->nodeIndex < 0 ) 1128 return ""; 1129 else 1130 return mShape->getName( mShape->nodes[obj->nodeIndex].nameIndex ); 1131}} 1132 1133DefineTSShapeConstructorMethod( setObjectNode, bool, ( const char* objName, const char* nodeName ),, 1134 ( objName, nodeName ), false, 1135 "Set the node an object is attached to.\n" 1136 "When the shape is rendered, the object geometry is rendered at the node's " 1137 "current transform.\n" 1138 "@param objName name of the object to modify\n" 1139 "@param nodeName name of the node to attach the object to\n" 1140 "@return true if successful, false otherwise\n\n" 1141 "@tsexample\n" 1142 "%this.setObjectNode( \"Hand\", \"Bip01 LeftHand\" );\n" 1143 "@endtsexample\n" ) 1144{ 1145 if ( !mShape->setObjectNode( objName, nodeName ) ) 1146 return false; 1147 1148 ADD_TO_CHANGE_SET(); 1149 return true; 1150}} 1151 1152DefineTSShapeConstructorMethod( renameObject, bool, ( const char* oldName, const char* newName ),, 1153 ( oldName, newName ), false, 1154 "Rename an object.\n" 1155 "@note Note that object names must be unique, so this command will fail if " 1156 "there is already an object with the desired name\n" 1157 "@param oldName current name of the object\n" 1158 "@param newName new name of the object\n" 1159 "@return true if successful, false otherwise\n\n" 1160 "@tsexample\n" 1161 "%this.renameObject( \"MyBox\", \"Box\" );\n" 1162 "@endtsexample\n" ) 1163{ 1164 if ( !mShape->renameObject( oldName, newName ) ) 1165 return false; 1166 1167 ADD_TO_CHANGE_SET(); 1168 return true; 1169}} 1170 1171DefineTSShapeConstructorMethod( removeObject, bool, ( const char* name ),, 1172 ( name ), false, 1173 "Remove an object (including all meshes for that object) from the shape.\n" 1174 "@param name name of the object to remove.\n" 1175 "@return true if successful, false otherwise.\n\n" 1176 "@tsexample\n" 1177 "// clear all objects in the shape\n" 1178 "%count = %this.getObjectCount();\n" 1179 "for ( %i = %count-1; %i >= 0; %i-- )\n" 1180 " %this.removeObject( %this.getObjectName(%i) );\n" 1181 "@endtsexample\n" ) 1182{ 1183 if ( !mShape->removeObject( name ) ) 1184 return false; 1185 1186 ADD_TO_CHANGE_SET(); 1187 return true; 1188}} 1189 1190//----------------------------------------------------------------------------- 1191// MESHES 1192DefineTSShapeConstructorMethod( getMeshCount, S32, ( const char* name ),, 1193 ( name ), 0, 1194 "Get the number of meshes (detail levels) for the specified object.\n" 1195 "@param name name of the object to query\n" 1196 "@return the number of meshes for this object.\n\n" 1197 "@tsexample\n" 1198 "%count = %this.getMeshCount( \"SimpleShape\" );\n" 1199 "@endtsexample\n" ) 1200{ 1201 GET_OBJECT( getMeshCount, obj, name, 0 ); 1202 1203 Vector<S32> objectDetails; 1204 mShape->getObjectDetails( objIndex, objectDetails ); 1205 return objectDetails.size(); 1206}} 1207 1208DefineTSShapeConstructorMethod( getMeshName, const char*, ( const char* name, S32 index ),, 1209 ( name, index ), "", 1210 "Get the name of the indexed mesh (detail level) for the specified object.\n" 1211 "@param name name of the object to query\n" 1212 "@param index index of the mesh (valid range is 0 - getMeshCount()-1)\n" 1213 "@return the mesh name.\n\n" 1214 "@tsexample\n" 1215 "// print the names of all meshes in the shape\n" 1216 "%objCount = %this.getObjectCount();\n" 1217 "for ( %i = 0; %i < %objCount; %i++ )\n" 1218 "{\n" 1219 " %objName = %this.getObjectName( %i );\n" 1220 " %meshCount = %this.getMeshCount( %objName );\n" 1221 " for ( %j = 0; %j < %meshCount; %j++ )\n" 1222 " echo( %this.getMeshName( %objName, %j ) );\n" 1223 "}\n" 1224 "@endtsexample\n" ) 1225{ 1226 GET_OBJECT( getMeshName, obj, name, "" ); 1227 1228 Vector<S32> objectDetails; 1229 mShape->getObjectDetails(objIndex, objectDetails); 1230 1231 CHECK_INDEX_IN_RANGE( getMeshName, index, objectDetails.size(), "" ); 1232 1233 static const U32 bufSize = 256; 1234 char* returnBuffer = Con::getReturnBuffer(bufSize); 1235 dSprintf(returnBuffer, bufSize, "%s %d", name, (S32)mShape->details[objectDetails[index]].size); 1236 return returnBuffer; 1237}} 1238 1239DefineTSShapeConstructorMethod( getMeshSize, S32, ( const char* name, S32 index ),, 1240 ( name, index ), -1, 1241 "Get the detail level size of the indexed mesh for the specified object.\n" 1242 "@param name name of the object to query\n" 1243 "@param index index of the mesh (valid range is 0 - getMeshCount()-1)\n" 1244 "@return the mesh detail level size.\n\n" 1245 "@tsexample\n" 1246 "// print sizes for all detail levels of this object\n" 1247 "%objName = \"trunk\";\n" 1248 "%count = %this.getMeshCount( %objName );\n" 1249 "for ( %i = 0; %i < %count; %i++ )\n" 1250 " echo( %this.getMeshSize( %objName, %i ) );\n" 1251 "@endtsexample\n" ) 1252{ 1253 GET_OBJECT( getMeshName, obj, name, -1 ); 1254 1255 Vector<S32> objectDetails; 1256 mShape->getObjectDetails( objIndex, objectDetails ); 1257 1258 CHECK_INDEX_IN_RANGE( getMeshName, index, objectDetails.size(), -1 ); 1259 1260 return (S32)mShape->details[objectDetails[index]].size; 1261}} 1262 1263DefineTSShapeConstructorMethod( setMeshSize, bool, ( const char* name, S32 size ),, 1264 ( name, size ), false, 1265 "Change the detail level size of the named mesh.\n" 1266 "@param name full name (object name + current size ) of the mesh to modify\n" 1267 "@param size new detail level size\n" 1268 "@return true if successful, false otherwise.\n\n" 1269 "@tsexample\n" 1270 "%this.setMeshSize( \"SimpleShape128\", 64 );\n" 1271 "@endtsexample\n" ) 1272{ 1273 if ( !mShape->setMeshSize( name, size ) ) 1274 return false; 1275 1276 ADD_TO_CHANGE_SET(); 1277 return true; 1278}} 1279 1280DefineTSShapeConstructorMethod( getMeshType, const char*, ( const char* name ),, 1281 ( name ), "", 1282 "Get the display type of the mesh.\n" 1283 "@param name name of the mesh to query\n" 1284 "@return the string returned is one of:" 1285 "<dl><dt>normal</dt><dd>a normal 3D mesh</dd>" 1286 "<dt>billboard</dt><dd>a mesh that always faces the camera</dd>" 1287 "<dt>billboardzaxis</dt><dd>a mesh that always faces the camera in the Z-axis</dd></dl>\n\n" 1288 "@tsexample\n" 1289 "echo( \"Mesh type is \" @ %this.getMeshType( \"SimpleShape128\" ) );\n" 1290 "@endtsexample\n" ) 1291{ 1292 GET_MESH( getMeshType, mesh, name, "normal" ); 1293 1294 if (mesh->getFlags(TSMesh::BillboardZAxis)) 1295 return "billboardzaxis"; 1296 else if (mesh->getFlags(TSMesh::Billboard)) 1297 return "billboard"; 1298 else 1299 return "normal"; 1300}} 1301 1302DefineTSShapeConstructorMethod( setMeshType, bool, ( const char* name, const char* type ),, 1303 ( name, type ), false, 1304 "Set the display type for the mesh.\n" 1305 "@param name full name (object name + detail size) of the mesh to modify\n" 1306 "@param type the new type for the mesh: \"normal\", \"billboard\" or \"billboardzaxis\"\n" 1307 "@return true if successful, false otherwise\n\n" 1308 "@tsexample\n" 1309 "// set the mesh to be a billboard\n" 1310 "%this.setMeshType( \"SimpleShape64\", \"billboard\" );\n" 1311 "@endtsexample\n" ) 1312{ 1313 GET_MESH( setMeshType, mesh, name, false ); 1314 1315 // Update the mesh flags 1316 mesh->clearFlags( TSMesh::Billboard | TSMesh::BillboardZAxis ); 1317 if ( dStrEqual( type, "billboard" ) ) 1318 mesh->setFlags( TSMesh::Billboard ); 1319 else if ( dStrEqual( type, "billboardzaxis" ) ) 1320 mesh->setFlags( TSMesh::Billboard | TSMesh::BillboardZAxis ); 1321 else if ( !dStrEqual( type, "normal" ) ) 1322 { 1323 Con::printf( "setMeshType: Unknown mesh type '%s'", type ); 1324 return false; 1325 } 1326 1327 ADD_TO_CHANGE_SET(); 1328 return true; 1329}} 1330 1331DefineTSShapeConstructorMethod( getMeshMaterial, const char*, ( const char* name ),, 1332 ( name ), "", 1333 "Get the name of the material attached to a mesh. Note that only the first " 1334 "material used by the mesh is returned.\n" 1335 "@param name full name (object name + detail size) of the mesh to query\n" 1336 "@return name of the material attached to the mesh (suitable for use with the Material mapTo field)\n\n" 1337 "@tsexample\n" 1338 "echo( \"Mesh material is \" @ %this.sgetMeshMaterial( \"SimpleShape128\" ) );\n" 1339 "@endtsexample\n" ) 1340{ 1341 GET_MESH( getMeshMaterial, mesh, name, "" ); 1342 1343 // Return the name of the first material attached to this mesh 1344 S32 matIndex = mesh->primitives[0].matIndex & TSDrawPrimitive::MaterialMask; 1345 if ((matIndex >= 0) && (matIndex < mShape->materialList->size())) 1346 return mShape->materialList->getMaterialName( matIndex ); 1347 else 1348 return ""; 1349}} 1350 1351DefineTSShapeConstructorMethod( setMeshMaterial, bool, ( const char* meshName, const char* matName ),, 1352 ( meshName, matName ), false, 1353 "Set the name of the material attached to the mesh.\n" 1354 "@param meshName full name (object name + detail size) of the mesh to modify\n" 1355 "@param matName name of the material to attach. This could be the base name of " 1356 "the diffuse texture (eg. \"test_mat\" for \"test_mat.jpg\"), or the name of a " 1357 "Material object already defined in script.\n" 1358 "@return true if successful, false otherwise\n\n" 1359 "@tsexample\n" 1360 "// set the mesh material\n" 1361 "%this.setMeshMaterial( \"SimpleShape128\", \"test_mat\" );\n" 1362 "@endtsexample\n" ) 1363{ 1364 GET_MESH( setMeshMaterial, mesh, meshName, false ); 1365 1366 // Check if this material is already in the shape 1367 S32 matIndex; 1368 for ( matIndex = 0; matIndex < mShape->materialList->size(); matIndex++ ) 1369 { 1370 if ( dStrEqual( matName, mShape->materialList->getMaterialName( matIndex ) ) ) 1371 break; 1372 } 1373 if ( matIndex == mShape->materialList->size() ) 1374 { 1375 // Add a new material to the shape 1376 U32 flags = TSMaterialList::S_Wrap | TSMaterialList::T_Wrap; 1377 mShape->materialList->push_back( matName, flags ); 1378 } 1379 1380 // Set this material for all primitives in the mesh 1381 for ( S32 i = 0; i < mesh->primitives.size(); i++ ) 1382 { 1383 U32 matType = mesh->primitives[i].matIndex & ( TSDrawPrimitive::TypeMask | TSDrawPrimitive::Indexed ); 1384 mesh->primitives[i].matIndex = ( matType | matIndex ); 1385 } 1386 1387 ADD_TO_CHANGE_SET(); 1388 return true; 1389}} 1390 1391DefineTSShapeConstructorMethod( addMesh, bool, ( const char* meshName, const char* srcShape, const char* srcMesh ),, 1392 ( meshName, srcShape, srcMesh ), false, 1393 "Add geometry from another DTS or DAE shape file into this shape.\n" 1394 "Any materials required by the source mesh are also copied into this shape.<br>\n" 1395 "@param meshName full name (object name + detail size) of the new mesh. If " 1396 "no detail size is present at the end of the name, a value of 2 is used.<br>" 1397 "An underscore before the number at the end of the name will be interpreted as " 1398 "a negative sign. eg. \"MyMesh_4\" will be interpreted as \"MyMesh-4\".\n" 1399 "@param srcShape name of a shape file (DTS or DAE) that contains the mesh\n" 1400 "@param srcMesh the full name (object name + detail size) of the mesh to " 1401 "copy from the DTS/DAE file into this shape</li>" 1402 "@return true if successful, false otherwise\n\n" 1403 "@tsexample\n" 1404 "%this.addMesh( \"ColMesh-1\", \"./collision.dts\", \"ColMesh\", \"Col-1\" );\n" 1405 "%this.addMesh( \"SimpleShape10\", \"./testShape.dae\", \"MyMesh2\", "" );\n" 1406 "@endtsexample\n" ) 1407{ 1408 // Load the shape source file 1409 char filenameBuf[1024]; 1410 Con::expandScriptFilename(filenameBuf, sizeof(filenameBuf), srcShape); 1411 1412 Resource<TSShape> hSrcShape = ResourceManager::get().load( filenameBuf ); 1413 if ( !bool(hSrcShape) ) 1414 { 1415 Con::errorf( "addMesh failed: Could not load source shape: '%s'", filenameBuf ); 1416 return false; 1417 } 1418 1419 TSShape* shape = const_cast<TSShape*>( (const TSShape*)hSrcShape ); 1420 if ( !mShape->addMesh( shape, srcMesh, meshName ) ) 1421 return false; 1422 1423 ADD_TO_CHANGE_SET(); 1424 return true; 1425}} 1426 1427DefineTSShapeConstructorMethod( removeMesh, bool, ( const char* name ),, 1428 ( name ), false, 1429 "Remove a mesh from the shape.\n" 1430 "If all geometry is removed from an object, the object is also removed.\n" 1431 "@param name full name (object name + detail size) of the mesh to remove\n" 1432 "@return true if successful, false otherwise\n\n" 1433 "@tsexample\n" 1434 "%this.removeMesh( \"SimpleShape128\" );\n" 1435 "@endtsexample\n" ) 1436{ 1437 if ( !mShape->removeMesh( name ) ) 1438 return false; 1439 1440 ADD_TO_CHANGE_SET(); 1441 return true; 1442}} 1443 1444DefineTSShapeConstructorMethod( getBounds, Box3F, (),, 1445 (), Box3F::Invalid, 1446 "Get the bounding box for the shape.\n" 1447 "@return Bounding box \"minX minY minZ maxX maxY maxZ\"" ) 1448{ 1449 return mShape->bounds; 1450}} 1451 1452DefineTSShapeConstructorMethod( setBounds, bool, ( Box3F bbox ),, 1453 ( bbox ), false, 1454 "Set the shape bounds to the given bounding box.\n" 1455 "@param Bounding box \"minX minY minZ maxX maxY maxZ\"\n" 1456 "@return true if successful, false otherwise\n" ) 1457{ 1458 // Set shape bounds 1459 TSShape* shape = mShape; 1460 1461 shape->bounds = bbox; 1462 shape->bounds.getCenter( &shape->center ); 1463 shape->radius = ( shape->bounds.maxExtents - shape->center ).len(); 1464 shape->tubeRadius = shape->radius; 1465 1466 ADD_TO_CHANGE_SET(); 1467 return true; 1468}} 1469 1470//----------------------------------------------------------------------------- 1471// DETAILS 1472DefineTSShapeConstructorMethod( getDetailLevelCount, S32, (),, (), 0, 1473 "Get the total number of detail levels in the shape.\n" 1474 "@return the number of detail levels in the shape\n" ) 1475{ 1476 return mShape->details.size(); 1477}} 1478 1479DefineTSShapeConstructorMethod( getDetailLevelName, const char*, ( S32 index ),, 1480 ( index ), "", 1481 "Get the name of the indexed detail level.\n" 1482 "@param index detail level index (valid range is 0 - getDetailLevelCount()-1)\n" 1483 "@return the detail level name\n\n" 1484 "@tsexample\n" 1485 "// print the names of all detail levels in the shape\n" 1486 "%count = %this.getDetailLevelCount();\n" 1487 "for ( %i = 0; %i < %count; %i++ )\n" 1488 " echo( %i SPC %this.getDetailLevelName( %i ) );\n" 1489 "@endtsexample\n" ) 1490{ 1491 CHECK_INDEX_IN_RANGE( getDetailLevelName, index, mShape->details.size(), "" ); 1492 1493 return mShape->getName(mShape->details[index].nameIndex); 1494}} 1495 1496DefineTSShapeConstructorMethod( getDetailLevelSize, S32, ( S32 index),, 1497 ( index ), 0, 1498 "Get the size of the indexed detail level.\n" 1499 "@param index detail level index (valid range is 0 - getDetailLevelCount()-1)\n" 1500 "@return the detail level size\n\n" 1501 "@tsexample\n" 1502 "// print the sizes of all detail levels in the shape\n" 1503 "%count = %this.getDetailLevelCount();\n" 1504 "for ( %i = 0; %i < %count; %i++ )\n" 1505 " echo( \"Detail\" @ %i @ \" has size \" @ %this.getDetailLevelSize( %i ) );\n" 1506 "@endtsexample\n" ) 1507{ 1508 CHECK_INDEX_IN_RANGE( getDetailLevelSize, index, mShape->details.size(), 0 ); 1509 1510 return (S32)mShape->details[index].size; 1511}} 1512 1513DefineTSShapeConstructorMethod( getDetailLevelIndex, S32, ( S32 size ),, 1514 ( size ), -1, 1515 "Get the index of the detail level with a given size.\n" 1516 "@param size size of the detail level to lookup\n" 1517 "@return index of the detail level with the desired size, or -1 if no such " 1518 "detail exists\n\n" 1519 "@tsexample\n" 1520 "if ( %this.getDetailLevelSize( 32 ) == -1 )\n" 1521 " echo( \"Error: This shape does not have a detail level at size 32\" );\n" 1522 "@endtsexample\n" ) 1523{ 1524 return mShape->findDetailBySize( size ); 1525}} 1526 1527DefineTSShapeConstructorMethod( renameDetailLevel, bool, ( const char* oldName, const char* newName ),, 1528 ( oldName, newName ), false, 1529 "Rename a detail level.\n" 1530 "@note Note that detail level names must be unique, so this command will " 1531 "fail if there is already a detail level with the desired name\n" 1532 "@param oldName current name of the detail level\n" 1533 "@param newName new name of the detail level\n" 1534 "@return true if successful, false otherwise\n\n" 1535 "@tsexample\n" 1536 "%this.renameDetailLevel( \"detail-1\", \"collision-1\" );\n" 1537 "@endtsexample\n" ) 1538{ 1539 if ( !mShape->renameDetail( oldName, newName ) ) 1540 return false; 1541 1542 ADD_TO_CHANGE_SET(); 1543 return true; 1544}} 1545 1546DefineTSShapeConstructorMethod( removeDetailLevel, bool, ( S32 index ),, 1547 ( index ), false, 1548 "Remove the detail level (including all meshes in the detail level)\n" 1549 "@param size size of the detail level to remove\n" 1550 "@return true if successful, false otherwise\n" 1551 "@tsexample\n" 1552 "%this.removeDetailLevel( 2 );\n" 1553 "@endtsexample\n" ) 1554{ 1555 if ( !mShape->removeDetail( index ) ) 1556 return false; 1557 1558 ADD_TO_CHANGE_SET(); 1559 return true; 1560}} 1561 1562DefineTSShapeConstructorMethod( setDetailLevelSize, S32, ( S32 index, S32 newSize ),, 1563 ( index, newSize ), index, 1564 "Change the size of a detail level." 1565 "@note Note that detail levels are always sorted in decreasing size order, " 1566 "so this command may cause detail level indices to change.\n" 1567 "@param index index of the detail level to modify\n" 1568 "@param newSize new size for the detail level\n" 1569 "@return new index for this detail level\n\n" 1570 "@tsexample\n" 1571 "%this.setDetailLevelSize( 2, 256 );\n" 1572 "@endtsexample\n" ) 1573{ 1574 S32 dl = mShape->setDetailSize( index, newSize ); 1575 if ( dl >= 0 ) 1576 ADD_TO_CHANGE_SET(); 1577 return dl; 1578}} 1579 1580DefineTSShapeConstructorMethod( getImposterDetailLevel, S32, (),, (), -1, 1581 "Get the index of the imposter (auto-billboard) detail level (if any).\n" 1582 "@return imposter detail level index, or -1 if the shape does not use " 1583 "imposters.\n\n" ) 1584{ 1585 for ( S32 i = 0; i < mShape->details.size(); i++ ) 1586 { 1587 if ( mShape->details[i].subShapeNum < 0 ) 1588 return i; 1589 } 1590 return -1; 1591}} 1592 1593DefineTSShapeConstructorMethod( getImposterSettings, const char*, ( S32 index ),, 1594 ( index ), "", 1595 "Get the settings used to generate imposters for the indexed detail level.\n" 1596 "@param index index of the detail level to query (does not need to be an " 1597 "imposter detail level\n" 1598 "@return string of the form: \"valid eqSteps pSteps dl dim poles angle\", where:" 1599 "<dl>" 1600 "<dt>valid</dt><dd>1 if this detail level generates imposters, 0 otherwise</dd>" 1601 "<dt>eqSteps</dt><dd>number of steps around the equator</dd>" 1602 "<dt>pSteps</dt><dd>number of steps between the poles</dd>" 1603 "<dt>dl</dt><dd>index of the detail level used to generate imposters</dd>" 1604 "<dt>dim</dt><dd>size (in pixels) of each imposter image</dd>" 1605 "<dt>poles</dt><dd>1 to include pole images, 0 otherwise</dd>" 1606 "<dt>angle</dt><dd>angle at which to display pole images</dd>" 1607 "</dl>\n\n" 1608 "@tsexample\n" 1609 "// print the imposter detail level settings\n" 1610 "%index = %this.getImposterDetailLevel();\n" 1611 "if ( %index != -1 )\n" 1612 " echo( \"Imposter settings: \" @ %this.getImposterSettings( %index ) );\n" 1613 "@endtsexample\n" ) 1614{ 1615 CHECK_INDEX_IN_RANGE( getImposterSettings, index, mShape->details.size(), "" ); 1616 1617 // Return information about the detail level 1618 const TSShape::Detail& det = mShape->details[index]; 1619 1620 static const U32 bufSize = 512; 1621 char* returnBuffer = Con::getReturnBuffer(bufSize); 1622 dSprintf(returnBuffer, bufSize, "%d\t%d\t%d\t%d\t%d\t%d\t%g", 1623 (S32)( det.subShapeNum < 0 ), // isImposter 1624 det.bbEquatorSteps, 1625 det.bbPolarSteps, 1626 det.bbDetailLevel, 1627 det.bbDimension, 1628 det.bbIncludePoles, 1629 det.bbPolarAngle ); 1630 1631 return returnBuffer; 1632}} 1633 1634DefineTSShapeConstructorMethod( addImposter, S32, ( S32 size, S32 equatorSteps, S32 polarSteps, S32 dl, S32 dim, bool includePoles, F32 polarAngle ),, 1635 ( size, equatorSteps, polarSteps, dl, dim, includePoles, polarAngle ), -1, 1636 "Add (or edit) an imposter detail level to the shape.\n" 1637 "If the shape already contains an imposter detail level, this command will " 1638 "simply change the imposter settings\n" 1639 "@param size size of the imposter detail level\n" 1640 "@param equatorSteps defines the number of snapshots to take around the " 1641 "equator. Imagine the object being rotated around the vertical axis, then " 1642 "a snapshot taken at regularly spaced intervals.\n" 1643 "@param polarSteps defines the number of snapshots taken between the poles " 1644 "(top and bottom), at each equator step. eg. At each equator snapshot, " 1645 "snapshots are taken at regular intervals between the poles.\n" 1646 "@param dl the detail level to use when generating the snapshots. Note that " 1647 "this is an array index rather than a detail size. So if an object has detail " 1648 "sizes of: 200, 150, and 40, then setting @a dl to 1 will generate the snapshots " 1649 "using detail size 150.\n" 1650 "@param dim defines the size of the imposter images in pixels. The larger the " 1651 "number, the more detailed the billboard will be.\n" 1652 "@param includePoles flag indicating whether to include the \"pole\" snapshots. " 1653 "ie. the views from the top and bottom of the object.\n" 1654 "@param polar_angle if pole snapshots are active (@a includePoles is true), this " 1655 "parameter defines the camera angle (in degrees) within which to render the " 1656 "pole snapshot. eg. if polar_angle is set to 25 degrees, then the snapshot " 1657 "taken at the pole (looking directly down or up at the object) will be rendered " 1658 "when the camera is within 25 degrees of the pole.\n" 1659 "@return true if successful, false otherwise\n\n" 1660 "@tsexample\n" 1661 "%this.addImposter( 2, 4, 0, 0, 64, false, 0 );\n" 1662 "%this.addImposter( 2, 4, 2, 0, 64, true, 10 ); // this command would edit the existing imposter detail level\n" 1663 "@endtsexample\n" ) 1664{ 1665 // Add the imposter detail level 1666 dl = mShape->addImposter( getShapePath(), size, equatorSteps, polarSteps, dl, dim, includePoles, polarAngle); 1667 if ( dl != -1 ) 1668 ADD_TO_CHANGE_SET(); 1669 return dl; 1670}} 1671 1672DefineTSShapeConstructorMethod( removeImposter, bool, (),, (), false, 1673 "() Remove the imposter detail level (if any) from the shape.\n" 1674 "@return true if successful, false otherwise\n\n" ) 1675{ 1676 if ( !mShape->removeImposter() ) 1677 return false; 1678 1679 ADD_TO_CHANGE_SET(); 1680 return true; 1681}} 1682 1683//----------------------------------------------------------------------------- 1684// SEQUENCES 1685DefineTSShapeConstructorMethod( getSequenceCount, S32, (),, (), 0, 1686 "Get the total number of sequences in the shape.\n" 1687 "@return the number of sequences in the shape\n\n" ) 1688{ 1689 return mShape->sequences.size(); 1690}} 1691 1692DefineTSShapeConstructorMethod( getSequenceIndex, S32, ( const char* name),, 1693 ( name ), -1, 1694 "Find the index of the sequence with the given name.\n" 1695 "@param name name of the sequence to lookup\n" 1696 "@return index of the sequence with matching name, or -1 if not found\n\n" 1697 "@tsexample\n" 1698 "// Check if a given sequence exists in the shape\n" 1699 "if ( %this.getSequenceIndex( \"walk\" ) == -1 )\n" 1700 " echo( \"Could not find 'walk' sequence\" );\n" 1701 "@endtsexample\n" ) 1702{ 1703 return mShape->findSequence( name ); 1704}} 1705 1706DefineTSShapeConstructorMethod( getSequenceName, const char*, ( S32 index ),, 1707 ( index ), "", 1708 "Get the name of the indexed sequence.\n" 1709 "@param index index of the sequence to query (valid range is 0 - getSequenceCount()-1)\n" 1710 "@return the name of the sequence\n\n" 1711 "@tsexample\n" 1712 "// print the name of all sequences in the shape\n" 1713 "%count = %this.getSequenceCount();\n" 1714 "for ( %i = 0; %i < %count; %i++ )\n" 1715 " echo( %i SPC %this.getSequenceName( %i ) );\n" 1716 "@endtsexample\n" ) 1717{ 1718 CHECK_INDEX_IN_RANGE( getSequenceName, index, mShape->sequences.size(), "" ); 1719 1720 return mShape->getName( mShape->sequences[index].nameIndex ); 1721}} 1722 1723DefineTSShapeConstructorMethod( getSequenceSource, const char*, ( const char* name ),, 1724 ( name ), "", 1725 "Get information about where the sequence data came from.\n" 1726 "For example, whether it was loaded from an external DSQ file.\n" 1727 "@param name name of the sequence to query\n" 1728 "@return TAB delimited string of the form: \"from reserved start end total\", where:" 1729 "<dl>" 1730 "<dt>from</dt><dd>the source of the animation data, such as the path to " 1731 "a DSQ file, or the name of an existing sequence in the shape. This field " 1732 "will be empty for sequences already embedded in the DTS or DAE file.</dd>" 1733 "<dt>reserved</dt><dd>reserved value</dd>" 1734 "<dt>start</dt><dd>the first frame in the source sequence used to create this sequence</dd>" 1735 "<dt>end</dt><dd>the last frame in the source sequence used to create this sequence</dd>" 1736 "<dt>total</dt><dd>the total number of frames in the source sequence</dd>" 1737 "</dl>\n\n" 1738 "@tsexample\n" 1739 "// print the source for the walk animation\n" 1740 "echo( \"walk source:\" SPC getField( %this.getSequenceSource( \"walk\" ), 0 ) );\n" 1741 "@endtsexample\n" ) 1742{ 1743 GET_SEQUENCE( getSequenceSource, seq, name, "" ); 1744 1745 // Return information about the source data for this sequence 1746 static const U32 bufSize = 512; 1747 char* returnBuffer = Con::getReturnBuffer(bufSize); 1748 dSprintf( returnBuffer, bufSize, "%s\t%d\t%d\t%d", 1749 seq->sourceData.from.c_str(), seq->sourceData.start, 1750 seq->sourceData.end, seq->sourceData.total ); 1751 return returnBuffer; 1752}} 1753 1754DefineTSShapeConstructorMethod( getSequenceFrameCount, S32, ( const char* name ),, 1755 ( name ), 0, 1756 "Get the number of keyframes in the sequence.\n" 1757 "@param name name of the sequence to query\n" 1758 "@return number of keyframes in the sequence\n\n" 1759 "@tsexample\n" 1760 "echo( \"Run has \" @ %this.getSequenceFrameCount( \"run\" ) @ \" keyframes\" );\n" 1761 "@endtsexample\n" ) 1762{ 1763 GET_SEQUENCE( getSequenceFrameCount, seq, name, 0 ); 1764 return seq->numKeyframes; 1765}} 1766 1767DefineTSShapeConstructorMethod( getSequencePriority, F32, ( const char* name ),, 1768 ( name ), -1.0f, 1769 "Get the priority setting of the sequence.\n" 1770 "@param name name of the sequence to query\n" 1771 "@return priority value of the sequence\n\n" ) 1772{ 1773 GET_SEQUENCE( getSequencePriority, seq, name, 0.0f ); 1774 return seq->priority; 1775}} 1776 1777DefineTSShapeConstructorMethod( setSequencePriority, bool, ( const char* name, F32 priority ),, 1778 ( name, priority ), false, 1779 "Set the sequence priority.\n" 1780 "@param name name of the sequence to modify\n" 1781 "@param priority new priority value\n" 1782 "@return true if successful, false otherwise\n\n" ) 1783{ 1784 GET_SEQUENCE( setSequencePriority, seq, name, false ); 1785 1786 seq->priority = priority; 1787 ADD_TO_CHANGE_SET(); 1788 return true; 1789}} 1790 1791DefineTSShapeConstructorMethod( getSequenceGroundSpeed, const char*, ( const char* name ),, 1792 ( name ), "", 1793 "Get the ground speed of the sequence.\n" 1794 "@note Note that only the first 2 ground frames of the sequence are " 1795 "examined; the speed is assumed to be constant throughout the sequence.\n" 1796 "@param name name of the sequence to query\n" 1797 "@return string of the form: \"trans.x trans.y trans.z rot.x rot.y rot.z\"\n\n" 1798 "@tsexample\n" 1799 "%speed = VectorLen( getWords( %this.getSequenceGroundSpeed( \"run\" ), 0, 2 ) );\n" 1800 " echo( \"Run moves at \" @ %speed @ \" units per frame\" );\n" 1801 "@endtsexample\n" ) 1802{ 1803 // Find the sequence and return the ground speed (assumed to be constant) 1804 GET_SEQUENCE( getSequenceGroundSpeed, seq, name, "" ); 1805 1806 Point3F trans(0,0,0), rot(0,0,0); 1807 if ( seq->numGroundFrames > 0 ) 1808 { 1809 const Point3F& p1 = mShape->groundTranslations[seq->firstGroundFrame]; 1810 const Point3F& p2 = mShape->groundTranslations[seq->firstGroundFrame + 1]; 1811 trans = p2 - p1; 1812 1813 QuatF r1 = mShape->groundRotations[seq->firstGroundFrame].getQuatF(); 1814 QuatF r2 = mShape->groundRotations[seq->firstGroundFrame + 1].getQuatF(); 1815 r2 -= r1; 1816 1817 MatrixF mat; 1818 r2.setMatrix(&mat); 1819 rot = mat.toEuler(); 1820 } 1821 1822 static const U32 bufSize = 256; 1823 char* returnBuffer = Con::getReturnBuffer(bufSize); 1824 dSprintf( returnBuffer, bufSize, "%g %g %g %g %g %g", 1825 trans.x, trans.y, trans.z, rot.x, rot.y, rot.z ); 1826 return returnBuffer; 1827}} 1828 1829DefineTSShapeConstructorMethod( setSequenceGroundSpeed, bool, ( const char* name, Point3F transSpeed, Point3F rotSpeed ), ( Point3F::Zero ), 1830 ( name, transSpeed, rotSpeed ), false, 1831 "Set the translation and rotation ground speed of the sequence.\n" 1832 "The ground speed of the sequence is set by generating ground transform " 1833 "keyframes. The ground translational and rotational speed is assumed to " 1834 "be constant for the duration of the sequence. Existing ground frames for " 1835 "the sequence (if any) will be replaced.\n" 1836 "@param name name of the sequence to modify\n" 1837 "@param transSpeed translational speed (trans.x trans.y trans.z) in " 1838 "Torque units per frame\n" 1839 "@param rotSpeed (optional) rotational speed (rot.x rot.y rot.z) in " 1840 "radians per frame. Default is \"0 0 0\"\n" 1841 "@return true if successful, false otherwise\n\n" 1842 "@tsexample\n" 1843 "%this.setSequenceGroundSpeed( \"run\", \"5 0 0\" );\n" 1844 "%this.setSequenceGroundSpeed( \"spin\", \"0 0 0\", \"4 0 0\" );\n" 1845 "@endtsexample\n" ) 1846{ 1847 if ( !mShape->setSequenceGroundSpeed( name, transSpeed, rotSpeed ) ) 1848 return false; 1849 1850 ADD_TO_CHANGE_SET(); 1851 return true; 1852}} 1853 1854DefineTSShapeConstructorMethod( getSequenceCyclic, bool, ( const char* name ),, 1855 ( name ), false, 1856 "Check if this sequence is cyclic (looping).\n" 1857 "@param name name of the sequence to query\n" 1858 "@return true if this sequence is cyclic, false if not\n\n" 1859 "@tsexample\n" 1860 "if ( !%this.getSequenceCyclic( \"ambient\" ) )\n" 1861 " error( \"ambient sequence is not cyclic!\" );\n" 1862 "@endtsexample\n" ) 1863{ 1864 GET_SEQUENCE( getSequenceCyclic, seq, name, false ); 1865 return seq->isCyclic(); 1866}} 1867 1868DefineTSShapeConstructorMethod( setSequenceCyclic, bool, ( const char* name, bool cyclic ),, 1869 ( name, cyclic ), false, 1870 "Mark a sequence as cyclic or non-cyclic.\n" 1871 "@param name name of the sequence to modify\n" 1872 "@param cyclic true to make the sequence cyclic, false for non-cyclic\n" 1873 "@return true if successful, false otherwise\n\n" 1874 "@tsexample\n" 1875 "%this.setSequenceCyclic( \"ambient\", true );\n" 1876 "%this.setSequenceCyclic( \"shoot\", false );\n" 1877 "@endtsexample\n" ) 1878{ 1879 GET_SEQUENCE( setSequenceCyclic, seq, name, false ); 1880 1881 // update cyclic flag 1882 if (cyclic != seq->isCyclic()) 1883 { 1884 if (cyclic && !seq->isCyclic()) 1885 seq->flags |= TSShape::Cyclic; 1886 else if (!cyclic && seq->isCyclic()) 1887 seq->flags &= (~(TSShape::Cyclic)); 1888 1889 ADD_TO_CHANGE_SET(); 1890 } 1891 return true; 1892}} 1893 1894DefineTSShapeConstructorMethod( getSequenceBlend, const char*, ( const char* name ),, 1895 ( name ), "", 1896 "Get information about blended sequences.\n" 1897 "@param name name of the sequence to query\n" 1898 "@return TAB delimited string of the form: \"isBlend blendSeq blendFrame\", where:" 1899 "<dl>" 1900 "<dt>blend_flag</dt><dd>a boolean flag indicating whether this sequence is a blend</dd>" 1901 "<dt>blend_seq_name</dt><dd>the name of the sequence that contains the reference " 1902 "frame (empty for blend sequences embedded in DTS files)</dd>" 1903 "<dt>blend_seq_frame</dt><dd>the blend reference frame (empty for blend sequences " 1904 "embedded in DTS files)</dd>" 1905 "</dl>\n" 1906 "@note Note that only sequences set to be blends using the setSequenceBlend " 1907 "command will contain the blendSeq and blendFrame information.\n\n" 1908 "@tsexample\n" 1909 "%blendData = %this.getSequenceBlend( \"look\" );\n" 1910 "if ( getField( %blendData, 0 ) )\n" 1911 " echo( \"look is a blend, reference: \" @ getField( %blendData, 1 ) );\n" 1912 "@endtsexample\n" ) 1913{ 1914 GET_SEQUENCE( getSequenceBlend, seq, name, "0" ); 1915 1916 // Return the blend information (flag reference_sequence reference_frame) 1917 static const U32 bufSize = 512; 1918 char* returnBuffer = Con::getReturnBuffer(bufSize); 1919 dSprintf( returnBuffer, bufSize, "%d\t%s\t%d", (int)seq->isBlend(), 1920 seq->sourceData.blendSeq.c_str(), seq->sourceData.blendFrame ); 1921 return returnBuffer; 1922}} 1923 1924DefineTSShapeConstructorMethod( setSequenceBlend, bool, ( const char* name, bool blend, const char* blendSeq, S32 blendFrame ),, 1925 ( name, blend, blendSeq, blendFrame ), false, 1926 "Mark a sequence as a blend or non-blend.\n" 1927 "A blend sequence is one that will be added on top of any other playing " 1928 "sequences. This is done by storing the animated node transforms relative " 1929 "to a reference frame, rather than as absolute transforms.\n" 1930 "@param name name of the sequence to modify\n" 1931 "@param blend true to make the sequence a blend, false for a non-blend\n" 1932 "@param blendSeq the name of the sequence that contains the blend reference frame\n" 1933 "@param blendFrame the reference frame in the blendSeq sequence\n" 1934 "@return true if successful, false otherwise\n\n" 1935 "@tsexample\n" 1936 "%this.setSequenceBlend( \"look\", true, \"root\", 0 );\n" 1937 "@endtsexample\n" ) 1938{ 1939 GET_SEQUENCE( setSequenceBlend, seq, name, false ); 1940 1941 if ( !mShape->setSequenceBlend( name, blend, blendSeq, blendFrame ) ) 1942 return false; 1943 1944 ADD_TO_CHANGE_SET(); 1945 return true; 1946}} 1947 1948DefineTSShapeConstructorMethod( renameSequence, bool, ( const char* oldName, const char* newName ),, 1949 ( oldName, newName ), false, 1950 "Rename a sequence.\n" 1951 "@note Note that sequence names must be unique, so this command will fail " 1952 "if there is already a sequence with the desired name\n" 1953 "@param oldName current name of the sequence\n" 1954 "@param newName new name of the sequence\n" 1955 "@return true if successful, false otherwise\n\n" 1956 "@tsexample\n" 1957 "%this.renameSequence( \"walking\", \"walk\" );\n" 1958 "@endtsexample\n" ) 1959{ 1960 GET_SEQUENCE( renameSequence, seq, oldName, false ); 1961 1962 if ( !mShape->renameSequence( oldName, newName ) ) 1963 return false; 1964 1965 ADD_TO_CHANGE_SET(); 1966 return true; 1967}} 1968 1969DefineTSShapeConstructorMethod( addSequence, bool, 1970 ( const char* source, const char* name, S32 start, S32 end, bool padRot, bool padTrans ), 1971 ( 0, -1, true, false ), ( source, name, start, end, padRot, padTrans ), false, 1972 "Add a new sequence to the shape.\n" 1973 "@param source the name of an existing sequence, or the name of a DTS or DAE " 1974 "shape or DSQ sequence file. When the shape file contains more than one " 1975 "sequence, the desired sequence can be specified by appending the name to the " 1976 "end of the shape file. eg. \"myShape.dts run\" would select the \"run\" " 1977 "sequence from the \"myShape.dts\" file.\n\n" 1978 "@param name name of the new sequence\n" 1979 "@param start (optional) first frame to copy. Defaults to 0, the first frame in the sequence.\n" 1980 "@param end (optional) last frame to copy. Defaults to -1, the last frame in the sequence.\n" 1981 "@param padRot (optional) copy root-pose rotation keys for non-animated nodes. This is useful if " 1982 "the source sequence data has a different root-pose to the target shape, such as if one character was " 1983 "in the T pose, and the other had arms at the side. Normally only nodes that are actually rotated by " 1984 "the source sequence have keyframes added, but setting this flag will also add keyframes for nodes " 1985 "that are not animated, but have a different root-pose rotation to the target shape root pose.\n" 1986 "@param padTrans (optional) copy root-pose translation keys for non-animated nodes. This is useful if " 1987 "the source sequence data has a different root-pose to the target shape, such as if one character was " 1988 "in the T pose, and the other had arms at the side. Normally only nodes that are actually moved by " 1989 "the source sequence have keyframes added, but setting this flag will also add keyframes for nodes " 1990 "that are not animated, but have a different root-pose position to the target shape root pose.\n" 1991 "@return true if successful, false otherwise\n\n" 1992 "@tsexample\n" 1993 "%this.addSequence( \"./testShape.dts ambient\", \"ambient\" );\n" 1994 "%this.addSequence( \"./myPlayer.dae run\", \"run\" );\n" 1995 "%this.addSequence( \"./player_look.dsq\", \"look\", 0, -1 ); // start to end\n" 1996 "%this.addSequence( \"walk\", \"walk_shortA\", 0, 4 ); // start to frame 4\n" 1997 "%this.addSequence( \"walk\", \"walk_shortB\", 4, -1 ); // frame 4 to end\n" 1998 "@endtsexample\n" ) 1999{ 2000 String srcName; 2001 String srcPath( source ); 2002 SplitSequencePathAndName( srcPath, srcName ); 2003 2004 if ( !mShape->addSequence( srcPath, srcName, name, start, end, padRot, padTrans ) ) 2005 return false; 2006 2007 ADD_TO_CHANGE_SET(); 2008 return true; 2009}} 2010 2011DefineTSShapeConstructorMethod( removeSequence, bool, ( const char* name ),, 2012 ( name ), false, 2013 "Remove the sequence from the shape.\n" 2014 "@param name name of the sequence to remove\n" 2015 "@return true if successful, false otherwise\n\n" ) 2016{ 2017 if ( !mShape->removeSequence( name ) ) 2018 return false; 2019 2020 ADD_TO_CHANGE_SET(); 2021 return true; 2022}} 2023 2024//----------------------------------------------------------------------------- 2025// TRIGGERS 2026DefineTSShapeConstructorMethod( getTriggerCount, S32, ( const char* name ),, 2027 ( name ), 0, 2028 "Get the number of triggers in the specified sequence.\n" 2029 "@param name name of the sequence to query\n" 2030 "@return number of triggers in the sequence\n\n" ) 2031{ 2032 GET_SEQUENCE( getTriggerCount, seq, name, 0 ); 2033 return seq->numTriggers; 2034}} 2035 2036DefineTSShapeConstructorMethod( getTrigger, const char*, ( const char* name, S32 index ),, 2037 ( name, index ), "", 2038 "Get information about the indexed trigger\n" 2039 "@param name name of the sequence to query\n" 2040 "@param index index of the trigger (valid range is 0 - getTriggerCount()-1)\n" 2041 "@return string of the form \"frame state\"\n\n" 2042 "@tsexample\n" 2043 "// print all triggers in the sequence\n" 2044 "%count = %this.getTriggerCount( \"back\" );\n" 2045 "for ( %i = 0; %i < %count; %i++ )\n" 2046 " echo( %i SPC %this.getTrigger( \"back\", %i ) );\n" 2047 "@endtsexample\n" ) 2048{ 2049 // Find the sequence and return the indexed trigger (frame and state) 2050 GET_SEQUENCE( getTrigger, seq, name, "" ); 2051 2052 CHECK_INDEX_IN_RANGE( getTrigger, index, seq->numTriggers, "" ); 2053 2054 const TSShape::Trigger& trig = mShape->triggers[seq->firstTrigger + index]; 2055 S32 frame = trig.pos * seq->numKeyframes; 2056 S32 state = getBinLog2(trig.state & TSShape::Trigger::StateMask) + 1; 2057 if (!(trig.state & TSShape::Trigger::StateOn)) 2058 state = -state; 2059 2060 static const U32 bufSize = 32; 2061 char* returnBuffer = Con::getReturnBuffer(bufSize); 2062 dSprintf(returnBuffer, bufSize, "%d %d", frame, state); 2063 return returnBuffer; 2064}} 2065 2066DefineTSShapeConstructorMethod( addTrigger, bool, ( const char* name, S32 keyframe, S32 state ),, 2067 ( name, keyframe, state ), false, 2068 "Add a new trigger to the sequence.\n" 2069 "@param name name of the sequence to modify\n" 2070 "@param keyframe keyframe of the new trigger\n" 2071 "@param state of the new trigger\n" 2072 "@return true if successful, false otherwise\n\n" 2073 "@tsexample\n" 2074 "%this.addTrigger( \"walk\", 3, 1 );\n" 2075 "%this.addTrigger( \"walk\", 5, -1 );\n" 2076 "@endtsexample\n" ) 2077{ 2078 if ( !mShape->addTrigger( name, keyframe, state ) ) 2079 return false; 2080 2081 ADD_TO_CHANGE_SET(); 2082 return true; 2083}} 2084 2085DefineTSShapeConstructorMethod( removeTrigger, bool, ( const char* name, S32 keyframe, S32 state ),, 2086 ( name, keyframe, state ), false, 2087 "Remove a trigger from the sequence.\n" 2088 "@param name name of the sequence to modify\n" 2089 "@param keyframe keyframe of the trigger to remove\n" 2090 "@param state of the trigger to remove\n" 2091 "@return true if successful, false otherwise\n\n" 2092 "@tsexample\n" 2093 "%this.removeTrigger( \"walk\", 3, 1 );\n" 2094 "@endtsexample\n" ) 2095{ 2096 if ( !mShape->removeTrigger( name, keyframe, state ) ) 2097 return false; 2098 2099 ADD_TO_CHANGE_SET(); 2100 return true; 2101}} 2102 2103 2104//----------------------------------------------------------------------------- 2105// Change-Set manipulation 2106TSShapeConstructor::ChangeSet::eCommandType TSShapeConstructor::ChangeSet::getCmdType(const char* name) 2107{ 2108 #define RETURN_IF_MATCH(type) if (!dStricmp(name, #type)) return Cmd##type 2109 2110 RETURN_IF_MATCH(AddNode); 2111 else RETURN_IF_MATCH(RemoveNode); 2112 else RETURN_IF_MATCH(RenameNode); 2113 else RETURN_IF_MATCH(SetNodeTransform); 2114 else RETURN_IF_MATCH(SetNodeParent); 2115 2116 else RETURN_IF_MATCH(AddMesh); 2117 else RETURN_IF_MATCH(AddPrimitive); 2118 else RETURN_IF_MATCH(SetMeshSize); 2119 else RETURN_IF_MATCH(SetMeshType); 2120 else RETURN_IF_MATCH(SetMeshMaterial); 2121 else RETURN_IF_MATCH(RemoveMesh); 2122 2123 else RETURN_IF_MATCH(SetObjectNode); 2124 else RETURN_IF_MATCH(RenameObject); 2125 else RETURN_IF_MATCH(RemoveObject); 2126 else RETURN_IF_MATCH(SetBounds); 2127 2128 else RETURN_IF_MATCH(SetDetailLevelSize); 2129 else RETURN_IF_MATCH(RenameDetailLevel); 2130 else RETURN_IF_MATCH(RemoveDetailLevel); 2131 else RETURN_IF_MATCH(AddImposter); 2132 else RETURN_IF_MATCH(RemoveImposter); 2133 else RETURN_IF_MATCH(AddCollisionDetail); 2134 2135 else RETURN_IF_MATCH(AddSequence); 2136 else RETURN_IF_MATCH(RemoveSequence); 2137 else RETURN_IF_MATCH(RenameSequence); 2138 else RETURN_IF_MATCH(SetSequenceCyclic); 2139 else RETURN_IF_MATCH(SetSequenceBlend); 2140 else RETURN_IF_MATCH(SetSequencePriority); 2141 else RETURN_IF_MATCH(SetSequenceGroundSpeed); 2142 2143 else RETURN_IF_MATCH(AddTrigger); 2144 else RETURN_IF_MATCH(RemoveTrigger); 2145 2146 else return CmdInvalid; 2147 2148 #undef RETURN_IF_MATCH 2149} 2150 2151void TSShapeConstructor::ChangeSet::write(TSShape* shape, Stream& stream, const String& savePath) 2152{ 2153 // First make a copy of the change-set 2154 ChangeSet output; 2155 for ( S32 i = 0; i < mCommands.size(); i++ ) 2156 output.add(mCommands[i]); 2157 2158 // Remove all __backup__ sequences (used during Shape Editing) 2159 if (shape) 2160 { 2161 for (S32 i = 0; i < shape->sequences.size(); i++) 2162 { 2163 const char* seqName = shape->getName( shape->sequences[i].nameIndex ); 2164 if ( dStrStartsWith( seqName, "__backup__" ) ) 2165 { 2166 Command cmd( "removeSequence" ); 2167 cmd.addArgs( seqName ); 2168 output.add( cmd ); 2169 } 2170 } 2171 } 2172 2173 // Write the final change set to the stream 2174 for (U32 i = 0; i < output.mCommands.size(); i++) 2175 { 2176 const Command& cmd = output.mCommands[i]; 2177 2178 // Write the command 2179 stream.writeTabs( 1 ); 2180 stream.writeText( "%this." ); 2181 2182 stream.writeText( cmd.name ); 2183 stream.writeText( "(" ); 2184 2185 if ( cmd.argc > 0 ) 2186 { 2187 // Use relative paths when possible 2188 String str( cmd.argv[0] ); 2189 if ( str.startsWith( savePath ) ) 2190 { 2191 // Need to add "./" to a local file for the script file system. Otherwise 2192 // it will be assumed to be a full and complete path when it comes to loading. 2193 str = "./" + str.substr( savePath.length() + 1 ); 2194 } 2195 2196 stream.writeText( "\"" ); 2197 stream.write( str.length(), str.c_str() ); 2198 stream.writeText( "\"" ); 2199 2200 // Write remaining arguments and newline 2201 for (U32 j = 1; j < cmd.argc; j++) 2202 { 2203 // Use relative paths when possible 2204 String str( cmd.argv[j] ); 2205 if ( str.startsWith( savePath ) ) 2206 str = str.substr( savePath.length() + 1 ); 2207 2208 stream.writeText( ", \"" ); 2209 stream.write( str.length(), str.c_str() ); 2210 stream.writeText( "\"" ); 2211 } 2212 } 2213 stream.writeText( ");\r\n" ); 2214 } 2215} 2216 2217 2218TiXmlElement *createNodeWithText( const char* name, const char* text ) 2219{ 2220 TiXmlElement* node = new TiXmlElement( name ); 2221 node->LinkEndChild( new TiXmlText( text ) ); 2222 return node; 2223} 2224 2225void TSShapeConstructor::ChangeSet::add( TSShapeConstructor::ChangeSet::Command& cmd ) 2226{ 2227 // Lookup the command type 2228 cmd.type = getCmdType( cmd.name );if ( cmd.type == CmdInvalid ) 2229 return; 2230 2231 // Ignore operations on __proxy__ sequences (they are only used by the shape editor) 2232 if ( cmd.argv[0].startsWith( "__proxy__" ) || ((cmd.type == CmdAddSequence) && cmd.argv[1].startsWith( "__proxy__") ) ) 2233 return; 2234 2235 // Add the command to the change set (apply command specific collapsing) 2236 bool addCommand = true; 2237 switch ( cmd.type ) 2238 { 2239 2240 // Node commands 2241 case CmdSetNodeParent: addCommand = addCmd_setNodeParent( cmd ); break; 2242 case CmdSetNodeTransform: addCommand = addCmd_setNodeTransform( cmd ); break; 2243 case CmdRenameNode: addCommand = addCmd_renameNode( cmd ); break; 2244 case CmdRemoveNode: addCommand = addCmd_removeNode( cmd ); break; 2245 2246 // Mesh commands 2247 case CmdSetMeshSize: addCommand = addCmd_setMeshSize( cmd ); break; 2248 case CmdSetMeshType: addCommand = addCmd_setMeshType( cmd ); break; 2249 case CmdSetMeshMaterial: addCommand = addCmd_setMeshMaterial( cmd ); break; 2250 case CmdRemoveMesh: addCommand = addCmd_removeMesh( cmd ); break; 2251 2252 // Object commands 2253 case CmdSetObjectNode: addCommand = addCmd_setObjectNode( cmd ); break; 2254 case CmdRenameObject: addCommand = addCmd_renameObject( cmd ); break; 2255 case CmdRemoveObject: addCommand = addCmd_removeObject( cmd ); break; 2256 case CmdSetBounds: addCommand = addCmd_setBounds( cmd ); break; 2257 2258 // Detail level commands 2259 case CmdRenameDetailLevel: addCommand = addCmd_renameDetailLevel( cmd ); break; 2260 case CmdRemoveDetailLevel: addCommand = addCmd_removeDetailLevel( cmd ); break; 2261 case CmdSetDetailLevelSize: addCommand = addCmd_setDetailSize( cmd ); break; 2262 case CmdAddImposter: addCommand = addCmd_addImposter( cmd ); break; 2263 case CmdRemoveImposter: addCommand = addCmd_removeImposter( cmd ); break; 2264 2265 // Sequence commands 2266 case CmdAddSequence: addCommand = addCmd_addSequence( cmd ); break; 2267 case CmdSetSequencePriority: addCommand = addCmd_setSequencePriority( cmd ); break; 2268 case CmdSetSequenceGroundSpeed: addCommand = addCmd_setSequenceGroundSpeed( cmd ); break; 2269 case CmdSetSequenceCyclic: addCommand = addCmd_setSequenceCyclic( cmd ); break; 2270 case CmdSetSequenceBlend: addCommand = addCmd_setSequenceBlend( cmd ); break; 2271 case CmdRenameSequence: addCommand = addCmd_renameSequence( cmd ); break; 2272 case CmdRemoveSequence: addCommand = addCmd_removeSequence( cmd ); break; 2273 2274 case CmdAddTrigger: addCommand = addCmd_addTrigger( cmd ); break; 2275 case CmdRemoveTrigger: addCommand = addCmd_removeTrigger( cmd ); break; 2276 2277 // Other commands that do not have optimizations 2278 default: 2279 break; 2280 } 2281 2282 if ( addCommand ) 2283 mCommands.push_back( cmd ); 2284} 2285 2286//----------------------------------------------------------------------------- 2287// NODE COMMANDS 2288 2289bool TSShapeConstructor::ChangeSet::addCmd_setNodeParent( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2290{ 2291 // No dependencies, replace the parent argument for any previous addNode or 2292 // setNodeParent. 2293 2294 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2295 { 2296 Command& cmd = mCommands[index]; 2297 switch ( cmd.type ) 2298 { 2299 case CmdAddNode: 2300 case CmdSetNodeParent: 2301 if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) ) 2302 { 2303 cmd.argv[1] = newCmd.argv[1]; // Replace parent argument 2304 return false; 2305 } 2306 break; 2307 2308 default: 2309 break; 2310 } 2311 } 2312 2313 return true; 2314 2315} 2316 2317bool TSShapeConstructor::ChangeSet::addCmd_setNodeTransform( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2318{ 2319 // No dependencies, replace the parent argument for any previous addNode or 2320 // setNodeParent. 2321 2322 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2323 { 2324 Command& cmd = mCommands[index]; 2325 switch ( cmd.type ) 2326 { 2327 case CmdAddNode: 2328 if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) ) 2329 { 2330 cmd.argc = newCmd.argc + 1; // Replace transform argument 2331 cmd.argv[2] = newCmd.argv[1]; 2332 cmd.argv[3] = newCmd.argv[2]; 2333 return false; 2334 } 2335 break; 2336 2337 case CmdSetNodeTransform: 2338 if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) ) 2339 { 2340 cmd = newCmd; // Collapse successive set transform commands 2341 return false; 2342 } 2343 break; 2344 2345 default: 2346 break; 2347 } 2348 } 2349 2350 return true; 2351} 2352 2353bool TSShapeConstructor::ChangeSet::addCmd_renameNode( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2354{ 2355 // Replace name argument for previous addNode or renameNode, but stop 2356 // if the new name is already in use (can occur if 2 nodes switch names). eg. 2357 // A->C 2358 // B->A 2359 // C->B (cannot replace the previous A->C with A->B as 'B' is in use) 2360 2361 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2362 { 2363 Command& cmd = mCommands[index]; 2364 switch ( cmd.type ) 2365 { 2366 case CmdAddNode: 2367 if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) ) 2368 { 2369 cmd.argv[0] = newCmd.argv[1]; // Replace initial name argument 2370 return false; 2371 } 2372 break; 2373 2374 case CmdRenameNode: 2375 if ( namesEqual( cmd.argv[1], newCmd.argv[0] ) ) 2376 { 2377 cmd.argv[1] = newCmd.argv[1]; // Collapse successive renames 2378 if ( namesEqual( cmd.argv[0], cmd.argv[1] ) ) 2379 mCommands.erase(index); // Ignore empty renames 2380 return false; 2381 } 2382 else if ( namesEqual( cmd.argv[0], newCmd.argv[1] ) ) 2383 return true; // Name is in use, cannot go back further 2384 break; 2385 2386 default: 2387 break; 2388 } 2389 } 2390 2391 return true; 2392} 2393 2394bool TSShapeConstructor::ChangeSet::addCmd_removeNode( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2395{ 2396 // No dependencies. Remove any previous command that references the node 2397 2398 String nodeName( newCmd.argv[0] ); 2399 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2400 { 2401 Command& cmd = mCommands[index]; 2402 switch ( cmd.type ) 2403 { 2404 case CmdAddNode: 2405 if ( namesEqual( cmd.argv[0], nodeName ) ) 2406 { 2407 mCommands.erase(index); // Remove the added node 2408 return false; 2409 } 2410 break; 2411 2412 case CmdSetNodeTransform: 2413 case CmdSetNodeParent: 2414 if ( namesEqual( cmd.argv[0], nodeName ) ) 2415 mCommands.erase(index); // Remove any commands that reference the removed node 2416 break; 2417 2418 case CmdRenameNode: 2419 if ( namesEqual( cmd.argv[1], nodeName ) ) 2420 { 2421 nodeName = cmd.argv[0]; // Node is renamed 2422 mCommands.erase(index); 2423 } 2424 break; 2425 2426 default: 2427 break; 2428 } 2429 } 2430 2431 return true; 2432} 2433 2434//----------------------------------------------------------------------------- 2435// SEQUENCE COMMANDS 2436 2437bool TSShapeConstructor::ChangeSet::addCmd_addSequence( TSShapeConstructor::ChangeSet::Command& newCmd ) 2438{ 2439 // For sequences added from ShapeEditor __backup sequences, search backwards for 2440 // any changes made to the source of the __backup sequence. If none are found, 2441 // use the __backup source instead of the __backup. 2442 const char* backupPrefix = "__backup__"; 2443 if ( !newCmd.argv[0].startsWith( backupPrefix ) ) 2444 return true; 2445 2446 S32 start = dStrlen( backupPrefix ); 2447 S32 end = newCmd.argv[0].find( '_', 0, String::Right ); 2448 String sourceName = newCmd.argv[0].substr( start, end - start ); 2449 2450 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2451 { 2452 Command& cmd = mCommands[index]; 2453 switch ( cmd.type ) 2454 { 2455 case CmdSetSequencePriority: 2456 case CmdSetSequenceCyclic: 2457 case CmdSetSequenceBlend: 2458 case CmdSetSequenceGroundSpeed: 2459 // __backup sequence source has been modified => cannot go back further 2460 if ( namesEqual( cmd.argv[0], sourceName ) ) 2461 return true; 2462 2463 case CmdAddSequence: 2464 if ( namesEqual( cmd.argv[1], newCmd.argv[0] ) ) 2465 { 2466 // No changes to the __backup sequence were found 2467 newCmd.argv[0] = sourceName; 2468 return true; 2469 } 2470 break; 2471 2472 default: 2473 break; 2474 } 2475 } 2476 2477 return true; 2478} 2479 2480bool TSShapeConstructor::ChangeSet::addCmd_setSequencePriority( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2481{ 2482 // Replace any previous setSequencePriority command, but stop if the 2483 // sequence is used as a source for addSequence (since the priority is 2484 // copied). 2485 2486 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2487 { 2488 Command& cmd = mCommands[index]; 2489 switch ( cmd.type ) 2490 { 2491 case CmdSetSequencePriority: 2492 if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) ) 2493 { 2494 cmd.argv[1] = newCmd.argv[1]; // Collapse successive set priority commands 2495 return false; 2496 } 2497 break; 2498 2499 case CmdAddSequence: 2500 if ( namesEqual( cmd.argv[1], newCmd.argv[0] ) ) 2501 return true; // Sequence is used as source => cannot go back further 2502 break; 2503 2504 default: 2505 break; 2506 } 2507 } 2508 2509 return true; 2510} 2511 2512bool TSShapeConstructor::ChangeSet::addCmd_setSequenceGroundSpeed( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2513{ 2514 // Replace any previous setSequenceGroundSpeed command, but stop if the 2515 // sequence is used as a source for addSequence (since the priority is 2516 // copied). 2517 2518 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2519 { 2520 Command& cmd = mCommands[index]; 2521 switch ( cmd.type ) 2522 { 2523 case CmdSetSequenceGroundSpeed: 2524 if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) ) 2525 { 2526 cmd.argv[1] = newCmd.argv[1]; // Collapse successive set ground speed commands 2527 return false; 2528 } 2529 break; 2530 2531 case CmdAddSequence: 2532 if ( namesEqual( cmd.argv[1], newCmd.argv[0] ) ) 2533 return true; // Sequence is used as source => cannot go back further 2534 break; 2535 2536 default: 2537 break; 2538 } 2539 } 2540 2541 return true; 2542} 2543 2544bool TSShapeConstructor::ChangeSet::addCmd_setSequenceCyclic( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2545{ 2546 // Replace any previous setSequenceCyclic command, but stop if the 2547 // sequence is used as a source for addSequence (since the priority is 2548 // copied). 2549 2550 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2551 { 2552 Command& cmd = mCommands[index]; 2553 switch ( cmd.type ) 2554 { 2555 case CmdSetSequenceCyclic: 2556 if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) && 2557 dAtob( cmd.argv[1] ) != dAtob( newCmd.argv[1] ) ) 2558 { 2559 mCommands.erase(index); // ignore both setCyclic commands (1 undoes the other) 2560 return false; 2561 } 2562 break; 2563 2564 case CmdAddSequence: 2565 if ( namesEqual( cmd.argv[1], newCmd.argv[0] ) ) 2566 return true; // Sequence is used as source => cannot go back further 2567 break; 2568 2569 default: 2570 break; 2571 } 2572 } 2573 2574 return true; 2575} 2576 2577bool TSShapeConstructor::ChangeSet::addCmd_setSequenceBlend( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2578{ 2579 // Replace any previous setSequenceBlend command, but stop if the 2580 // sequence is used as a source for addSequence (since the priority is 2581 // copied). 2582 2583 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2584 { 2585 Command& cmd = mCommands[index]; 2586 switch ( cmd.type ) 2587 { 2588 case CmdSetSequenceBlend: 2589 if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) && 2590 dAtob( cmd.argv[1] ) != dAtob( newCmd.argv[1] ) && 2591 namesEqual( cmd.argv[2], newCmd.argv[2] ) && 2592 dAtoi( cmd.argv[3] ) == dAtoi( newCmd.argv[3] ) ) 2593 { 2594 mCommands.erase(index); // Ignore both setBlend commands (1 undoes the other) 2595 return false; 2596 } 2597 break; 2598 2599 case CmdAddSequence: 2600 if ( namesEqual( cmd.argv[1], newCmd.argv[0] ) ) 2601 return true; // Sequence is used as source => cannot go back further 2602 break; 2603 2604 default: 2605 break; 2606 } 2607 } 2608 2609 return true; 2610} 2611 2612bool TSShapeConstructor::ChangeSet::addCmd_renameSequence( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2613{ 2614 // Replace name argument for previous addSequence or renameSequence, but stop 2615 // if the new name is already in use (can occur if 2 nodes switch names). eg. 2616 // A->C 2617 // B->A 2618 // C->B (cannot replace the previous A->C with A->B as 'B' is in use) 2619 // 2620 // Once a previous command is found, go forward through the command list and 2621 // update any references to the old name 2622 2623 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2624 { 2625 Command& cmd = mCommands[index]; 2626 switch ( cmd.type ) 2627 { 2628 case CmdRenameSequence: 2629 if ( namesEqual( cmd.argv[0], newCmd.argv[1] ) && !namesEqual( cmd.argv[1], newCmd.argv[0] ) ) 2630 return true; // Name is in use => cannot go back further 2631 // fall through to common processing 2632 case CmdAddSequence: 2633 if ( namesEqual( cmd.argv[1], newCmd.argv[0] ) ) 2634 { 2635 if ( cmd.type == CmdRenameSequence ) 2636 { 2637 cmd.argv[1] = newCmd.argv[1]; // Collapse successive renames 2638 if ( namesEqual( cmd.argv[0], cmd.argv[1] ) ) 2639 mCommands.erase(index); // Ignore empty renames 2640 } 2641 else if ( cmd.type == CmdAddSequence ) 2642 { 2643 cmd.argv[1] = newCmd.argv[1]; // Replace initial name argument 2644 } 2645 2646 // Update any references to the old name 2647 for ( S32 j = index + 1; j < mCommands.size(); j++ ) 2648 { 2649 Command& cmd2 = mCommands[j]; 2650 switch ( cmd2.type ) 2651 { 2652 case CmdSetSequencePriority: 2653 case CmdSetSequenceCyclic: 2654 case CmdSetSequenceBlend: 2655 case CmdSetSequenceGroundSpeed: 2656 if ( namesEqual( cmd2.argv[0], newCmd.argv[0] ) ) 2657 cmd2.argv[0] = newCmd.argv[1]; 2658 break; 2659 } 2660 } 2661 return false; 2662 } 2663 break; 2664 2665 default: 2666 break; 2667 } 2668 } 2669 2670 return true; 2671} 2672 2673bool TSShapeConstructor::ChangeSet::addCmd_removeSequence( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2674{ 2675 // Remove any previous command that references the sequence, but stop if the 2676 // sequence is used as a source for addSequence 2677 2678 String seqName( newCmd.argv[0] ); 2679 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2680 { 2681 Command& cmd = mCommands[index]; 2682 switch ( cmd.type ) 2683 { 2684 case CmdAddSequence: 2685 if ( namesEqual( cmd.argv[1], seqName ) ) 2686 { 2687 mCommands.erase( index ); // Remove the added sequence 2688 return false; 2689 } 2690 else if ( namesEqual( cmd.argv[0], seqName ) ) 2691 { 2692 // Removed sequence is used as source for another sequence => can't 2693 // go back any further 2694 return true; 2695 } 2696 break; 2697 2698 case CmdRenameSequence: 2699 if ( namesEqual( cmd.argv[1], seqName ) ) 2700 { 2701 seqName = cmd.argv[0]; // Sequence is renamed 2702 mCommands.erase( index ); 2703 } 2704 break; 2705 2706 case CmdSetSequencePriority: 2707 case CmdSetSequenceGroundSpeed: 2708 case CmdSetSequenceCyclic: 2709 case CmdSetSequenceBlend: 2710 case CmdAddTrigger: 2711 case CmdRemoveTrigger: 2712 if ( namesEqual( cmd.argv[0], seqName ) ) 2713 mCommands.erase( index ); // Remove any commands that reference the removed sequence 2714 break; 2715 2716 default: 2717 break; 2718 } 2719 } 2720 2721 return true; 2722} 2723 2724bool TSShapeConstructor::ChangeSet::addCmd_addTrigger( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2725{ 2726 // Remove a matching removeTrigger command, but stop if the sequence is used as 2727 // a source for addSequence (since triggers are copied). 2728 2729 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2730 { 2731 Command& cmd = mCommands[index]; 2732 switch ( cmd.type ) 2733 { 2734 case CmdRemoveTrigger: 2735 if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) && 2736 cmd.argv[1] == newCmd.argv[1] && 2737 cmd.argv[2] == newCmd.argv[2] ) 2738 { 2739 mCommands.erase(index); // Remove previous removeTrigger command 2740 return false; 2741 } 2742 break; 2743 2744 case CmdAddSequence: 2745 if ( namesEqual( cmd.argv[1], newCmd.argv[0] ) ) 2746 return true; // Sequence is used as a source => cannot go back further 2747 break; 2748 2749 default: 2750 break; 2751 } 2752 } 2753 2754 return true; 2755} 2756 2757bool TSShapeConstructor::ChangeSet::addCmd_removeTrigger( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2758{ 2759 // Remove a matching addTrigger command, but stop if the sequence is used as 2760 // a source for addSequence (since triggers are copied). 2761 2762 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2763 { 2764 Command& cmd = mCommands[index]; 2765 switch ( cmd.type ) 2766 { 2767 case CmdAddTrigger: 2768 if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) && 2769 cmd.argv[1] == newCmd.argv[1] && 2770 cmd.argv[2] == newCmd.argv[2] ) 2771 { 2772 mCommands.erase(index); // Remove previous addTrigger command 2773 return false; 2774 } 2775 break; 2776 2777 case CmdAddSequence: 2778 if ( namesEqual( cmd.argv[1], newCmd.argv[0] ) ) 2779 return true; // Sequence is used as a source => cannot go back further 2780 break; 2781 2782 default: 2783 break; 2784 } 2785 } 2786 2787 return true; 2788} 2789 2790//----------------------------------------------------------------------------- 2791// MESH COMMANDS 2792 2793bool TSShapeConstructor::ChangeSet::addCmd_setMeshSize( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2794{ 2795 // Replace size argument for previous addMesh or setMeshSize, but stop if the 2796 // new name is already in use (can occur if 2 nodes switch names). eg. 2797 // A->C 2798 // B->A 2799 // C->B (cannot replace the previous A->C with A->B as 'B' is in use) 2800 2801 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2802 { 2803 Command& cmd = mCommands[index]; 2804 switch ( cmd.type ) 2805 { 2806 case CmdAddMesh: 2807 if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) ) 2808 { 2809 cmd.argv[0] = newCmd.argv[1]; // Replace initial size argument 2810 return false; 2811 } 2812 break; 2813 2814 case CmdSetMeshSize: 2815 if ( cmd.argv[1] == newCmd.argv[0] ) 2816 { 2817 cmd.argv[1] = newCmd.argv[1]; // Collapse successive size sets 2818 if ( cmd.argv[0] == cmd.argv[1] ) 2819 mCommands.erase(index); // Ignore empty resizes 2820 return false; 2821 } 2822 else if ( cmd.argv[0] == newCmd.argv[1] ) 2823 return true; // Size is in use, cannot go back further 2824 break; 2825 2826 default: 2827 break; 2828 } 2829 } 2830 2831 return true; 2832} 2833 2834bool TSShapeConstructor::ChangeSet::addCmd_setMeshType( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2835{ 2836 // Replace any previous setMeshType command, but stop if the mesh is used as 2837 // a source for addMesh (since the type is copied). 2838 2839 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2840 { 2841 Command& cmd = mCommands[index]; 2842 switch ( cmd.type ) 2843 { 2844 case CmdSetMeshType: 2845 if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) ) 2846 { 2847 cmd.argv[1] = newCmd.argv[1]; // Collapse successive set type commands 2848 return false; 2849 } 2850 break; 2851 2852 case CmdAddMesh: 2853 if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) ) 2854 return true; // Mesh is used as source => cannot go back further 2855 break; 2856 2857 default: 2858 break; 2859 } 2860 } 2861 2862 return true; 2863} 2864 2865bool TSShapeConstructor::ChangeSet::addCmd_setMeshMaterial( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2866{ 2867 // Replace any previous setMeshMaterial command, but stop if the mesh is used as 2868 // a source for addMesh (since the materials are copied). 2869 2870 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2871 { 2872 Command& cmd = mCommands[index]; 2873 switch ( cmd.type ) 2874 { 2875 case CmdSetMeshMaterial: 2876 if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) ) 2877 { 2878 cmd.argv[1] = newCmd.argv[1]; // Collapse successive set material commands 2879 return false; 2880 } 2881 break; 2882 2883 case CmdAddMesh: 2884 if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) ) 2885 return true; // Mesh is used as source => cannot go back further 2886 break; 2887 2888 default: 2889 break; 2890 } 2891 } 2892 2893 return true; 2894} 2895 2896bool TSShapeConstructor::ChangeSet::addCmd_removeMesh( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2897{ 2898 // Remove any previous command that references the mesh, but stop if the mesh 2899 // is used as a source for addMesh 2900 2901 String meshName( newCmd.argv[0] ); 2902 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2903 { 2904 Command& cmd = mCommands[index]; 2905 switch ( cmd.type ) 2906 { 2907 case CmdAddMesh: 2908 if ( namesEqual( cmd.argv[0], meshName ) ) 2909 { 2910 mCommands.erase( index ); // Remove the added mesh 2911 return false; 2912 } 2913 else if ( namesEqual( cmd.argv[2], meshName ) ) 2914 { 2915 // Removed mesh is used as source for another mesh => can't go back 2916 // any further 2917 return true; 2918 } 2919 break; 2920 2921 case CmdAddPrimitive: 2922 if ( namesEqual( cmd.argv[0], meshName ) ) 2923 { 2924 mCommands.erase( index ); // Remove the added primitive 2925 return false; 2926 } 2927 break; 2928 2929 case CmdSetMeshSize: 2930 case CmdSetMeshType: 2931 case CmdSetMeshMaterial: 2932 if ( namesEqual( cmd.argv[0], meshName ) ) 2933 mCommands.erase( index ); // Remove any commands that reference the removed mesh 2934 break; 2935 2936 default: 2937 break; 2938 } 2939 } 2940 2941 return true; 2942} 2943 2944//----------------------------------------------------------------------------- 2945// OBJECT COMMANDS 2946 2947bool TSShapeConstructor::ChangeSet::addCmd_setObjectNode( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2948{ 2949 // No dependencies, replace the node argument for any previous parent argument for any previous addNode or 2950 // setNodeParent. 2951 2952 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2953 { 2954 Command& cmd = mCommands[index]; 2955 switch ( cmd.type ) 2956 { 2957 case CmdAddMesh: 2958 { 2959 S32 dummy; 2960 if ( namesEqual( String::GetTrailingNumber(cmd.argv[0], dummy), newCmd.argv[0] ) ) 2961 { 2962 cmd.argv[3] = newCmd.argv[1]; // Replace node argument 2963 return false; 2964 } 2965 break; 2966 } 2967 2968 case CmdSetObjectNode: 2969 if ( namesEqual( cmd.argv[0], newCmd.argv[0] ) ) 2970 { 2971 cmd.argv[1] = newCmd.argv[1]; 2972 return false; 2973 } 2974 break; 2975 2976 default: 2977 break; 2978 } 2979 } 2980 2981 return true; 2982} 2983 2984bool TSShapeConstructor::ChangeSet::addCmd_renameObject( const TSShapeConstructor::ChangeSet::Command& newCmd ) 2985{ 2986 // Replace name argument for previous renameObject, but stop if the new name 2987 // is already in use (can occur if 2 objects switch names). eg. 2988 // A->C 2989 // B->A 2990 // C->B (cannot replace the previous A->C with A->B as 'B' is in use) 2991 2992 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 2993 { 2994 Command& cmd = mCommands[index]; 2995 switch ( cmd.type ) 2996 { 2997 case CmdRenameObject: 2998 if ( namesEqual( cmd.argv[1], newCmd.argv[0] ) ) 2999 { 3000 cmd.argv[1] = newCmd.argv[1]; // Collapse successive renames 3001 if ( namesEqual( cmd.argv[0], cmd.argv[1] ) ) 3002 mCommands.erase(index); // Ignore empty renames 3003 return false; 3004 } 3005 else if ( namesEqual( cmd.argv[0], newCmd.argv[1] ) ) 3006 return true; // Name is in use, cannot go back further 3007 break; 3008 3009 default: 3010 break; 3011 } 3012 } 3013 3014 return true; 3015} 3016 3017bool TSShapeConstructor::ChangeSet::addCmd_removeObject( const TSShapeConstructor::ChangeSet::Command& newCmd ) 3018{ 3019 // Remove any previous command that references the object, but stop if any 3020 // object mesh is used as a source for addMesh 3021 3022 S32 dummy; 3023 String objName( newCmd.argv[0] ); 3024 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 3025 { 3026 Command& cmd = mCommands[index]; 3027 switch ( cmd.type ) 3028 { 3029 case CmdAddMesh: 3030 if ( namesEqual( String::GetTrailingNumber(cmd.argv[0], dummy), objName ) ) 3031 { 3032 mCommands.erase( index ); // Remove the added mesh 3033 // Must still add the removeObject command as there could be multiple 3034 // meshes in the object 3035 } 3036 else if ( namesEqual( String::GetTrailingNumber(cmd.argv[2], dummy), objName ) ) 3037 { 3038 // Removed mesh is used as source for another mesh => can't go back 3039 // any further 3040 return true; 3041 } 3042 break; 3043 3044 case CmdRenameObject: 3045 if ( namesEqual( cmd.argv[1], objName ) ) 3046 { 3047 objName = cmd.argv[0]; // Object is renamed 3048 mCommands.erase( index ); 3049 } 3050 break; 3051 3052 case CmdSetObjectNode: 3053 if ( namesEqual( cmd.argv[0], objName ) ) 3054 mCommands.erase( index ); // Remove any commands that reference the removed object 3055 break; 3056 3057 case CmdSetMeshSize: 3058 case CmdSetMeshType: 3059 case CmdSetMeshMaterial: 3060 case CmdRemoveMesh: 3061 if ( namesEqual( String::GetTrailingNumber(cmd.argv[0], dummy), objName ) ) 3062 mCommands.erase( index ); // Remove comands that reference the removed object 3063 break; 3064 3065 default: 3066 break; 3067 } 3068 } 3069 3070 return true; 3071} 3072 3073bool TSShapeConstructor::ChangeSet::addCmd_setBounds( const TSShapeConstructor::ChangeSet::Command& newCmd ) 3074{ 3075 // Only the last bounds update applies, so replace any previous command. 3076 3077 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 3078 { 3079 Command& cmd = mCommands[index]; 3080 switch ( cmd.type ) 3081 { 3082 case CmdSetBounds: 3083 mCommands.erase( index ); 3084 break; 3085 3086 default: 3087 break; 3088 } 3089 } 3090 3091 return true; 3092} 3093 3094//----------------------------------------------------------------------------- 3095// DETAIL COMMANDS 3096 3097bool TSShapeConstructor::ChangeSet::addCmd_renameDetailLevel( const TSShapeConstructor::ChangeSet::Command& newCmd ) 3098{ 3099 // Replace name argument for previous renameDetailLevel, but stop if the new 3100 // name is already in use (can occur if 2 objects switch names). eg. 3101 // A->C 3102 // B->A 3103 // C->B (cannot replace the previous A->C with A->B as 'B' is in use) 3104 3105 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 3106 { 3107 Command& cmd = mCommands[index]; 3108 switch ( cmd.type ) 3109 { 3110 case CmdRenameDetailLevel: 3111 if ( namesEqual( cmd.argv[1], newCmd.argv[0] ) ) 3112 { 3113 cmd.argv[1] = newCmd.argv[1]; // Collapse successive renames 3114 if ( namesEqual( cmd.argv[0], cmd.argv[1] ) ) 3115 mCommands.erase(index); // Ignore empty renames 3116 return false; 3117 } 3118 else if ( namesEqual( cmd.argv[0], newCmd.argv[1] ) ) 3119 return true; // Name is in use, cannot go back further 3120 break; 3121 3122 default: 3123 break; 3124 } 3125 } 3126 3127 return true; 3128} 3129 3130bool TSShapeConstructor::ChangeSet::addCmd_removeDetailLevel( const TSShapeConstructor::ChangeSet::Command& newCmd ) 3131{ 3132 // Remove any previous command that references the detail, but stop if a mesh 3133 // is used as a source for addMesh 3134 3135 S32 detSize = dAtoi( newCmd.argv[0] ); 3136 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 3137 { 3138 Command& cmd = mCommands[index]; 3139 S32 size; 3140 3141 switch ( cmd.type ) 3142 { 3143 case CmdAddMesh: 3144 String::GetTrailingNumber( cmd.argv[2], size ); 3145 if ( size == detSize ) 3146 { 3147 // Removed detail is used as source for another mesh => can't go back 3148 // any further 3149 return true; 3150 } 3151 // fall through 3152 3153 case CmdAddPrimitive: 3154 case CmdSetMeshSize: 3155 case CmdSetMeshType: 3156 case CmdSetMeshMaterial: 3157 case CmdRemoveMesh: 3158 String::GetTrailingNumber( cmd.argv[0], size ); 3159 if ( size == detSize ) 3160 mCommands.erase( index ); 3161 break; 3162 3163 case CmdAddImposter: 3164 case CmdAddCollisionDetail: 3165 if ( dAtoi(cmd.argv[0]) == detSize ) 3166 { 3167 mCommands.erase( index ); 3168 return false; 3169 } 3170 break; 3171 3172 default: 3173 break; 3174 } 3175 } 3176 3177 return true; 3178} 3179 3180bool TSShapeConstructor::ChangeSet::addCmd_setDetailSize( const TSShapeConstructor::ChangeSet::Command& newCmd ) 3181{ 3182 // Similar to renameXXX. Replace size argument for previous addImposter or 3183 // setDetailLevelSize, but stop if the new size is already in use (can occur 3184 // if 2 details switch sizes). eg. 3185 // A->C 3186 // B->A 3187 // C->B (cannot replace the previous A->C with A->B as 'B' is in use) 3188 3189 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 3190 { 3191 Command& cmd = mCommands[index]; 3192 switch ( cmd.type ) 3193 { 3194 case CmdAddImposter: 3195 if ( cmd.argv[0] == newCmd.argv[0] ) 3196 { 3197 cmd.argv[0] = newCmd.argv[1]; // Change detail size argument 3198 return false; 3199 } 3200 break; 3201 3202 case CmdSetDetailLevelSize: 3203 if ( cmd.argv[1] == newCmd.argv[0] ) 3204 { 3205 cmd.argv[1] = newCmd.argv[1]; // Collapse successive detail size changes 3206 if ( cmd.argv[0] == cmd.argv[1] ) 3207 mCommands.erase(index); // Ignore empty changes 3208 return false; 3209 } 3210 else if ( cmd.argv[0] == newCmd.argv[1] ) 3211 return true; // Detail size already in use => cannot go back further 3212 break; 3213 3214 default: 3215 break; 3216 } 3217 } 3218 3219 return true; 3220} 3221 3222bool TSShapeConstructor::ChangeSet::addCmd_addImposter( const TSShapeConstructor::ChangeSet::Command& newCmd ) 3223{ 3224 // Remove previous removeImposter, and replace any previous addImposter. If 3225 // replacing, also remove any setDetailLevelSize for the old imposter 3226 3227 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 3228 { 3229 Command& cmd = mCommands[index]; 3230 switch ( cmd.type ) 3231 { 3232 case CmdAddImposter: 3233 // Replace the AddImposter command, but first remove any reference to 3234 // the added detail level. 3235 for ( S32 j = index + 1; j < mCommands.size(); j++ ) 3236 { 3237 Command& cmd2 = mCommands[j]; 3238 if ( ( cmd2.type == CmdSetDetailLevelSize ) && 3239 cmd2.argv[0] == cmd.argv[0] ) 3240 { 3241 mCommands.erase(j); 3242 break; 3243 } 3244 } 3245 // Replace previous addImposter command 3246 cmd = newCmd; 3247 return false; 3248 3249 case CmdRemoveImposter: 3250 mCommands.erase(index); // Remove previous removeImposter command 3251 break; 3252 3253 default: 3254 break; 3255 } 3256 } 3257 3258 return true; 3259} 3260 3261bool TSShapeConstructor::ChangeSet::addCmd_removeImposter( const TSShapeConstructor::ChangeSet::Command& newCmd ) 3262{ 3263 // Remove any previous addImposter, and also remove any setDetailLevelSize 3264 // for that imposter. 3265 // Always need to return true, since we could be removing imposters already 3266 // present in the shape (not added with addImposter). 3267 3268 for ( S32 index = mCommands.size()-1; index >= 0; index-- ) 3269 { 3270 Command& cmd = mCommands[index]; 3271 switch ( cmd.type ) 3272 { 3273 case CmdAddImposter: 3274 // Remove the AddImposter command, but first remove any reference to 3275 // the added detail level. 3276 for ( S32 j = index + 1; j < mCommands.size(); j++ ) 3277 { 3278 Command& cmd2 = mCommands[j]; 3279 if ( ( cmd2.type == CmdSetDetailLevelSize ) && 3280 cmd2.argv[0] == cmd.argv[0] ) 3281 { 3282 mCommands.erase(j); 3283 break; 3284 } 3285 } 3286 mCommands.erase(index); 3287 break; 3288 3289 default: 3290 break; 3291 } 3292 } 3293 3294 return true; 3295} 3296 3297void TSShapeConstructor::onActionPerformed() 3298{ 3299 // Reinit shape if we modify stuff in the shape editor, otherwise delay 3300 if (!mLoadingShape) 3301 { 3302 if (mShape && mShape->needsReinit()) 3303 { 3304 mShape->init(); 3305 } 3306 } 3307} 3308
