*/}}

la_tns_drivers.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. /*
  2. * LaGUI: A graphical application framework.
  3. * Copyright (C) 2022-2023 Wu Yiming
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include "../la_5.h"
  19. extern LA MAIN;
  20. extern struct _tnsMain *T;
  21. laBaseNodeType TNS_IDN_TRANSFORM;
  22. laBaseNodeType TNS_IDN_MAKE_TRANSFORM;
  23. laBaseNodeType TNS_IDN_ACTION_PLAYER;
  24. laPropContainer* TNS_PC_IDN_TRANSFORM;
  25. laPropContainer* TNS_PC_IDN_MAKE_TRANSFORM;
  26. laPropContainer* TNS_PC_IDN_ACTION_PLAYER;
  27. void IDN_TransformInit(tnsTransformNode* n, int NoCreate){
  28. if(NoCreate){return;}
  29. n->Mat=laCreateInSocket("MAT",0); strSafeSet(&n->Base.Name,"Transform");
  30. }
  31. void IDN_TransformDestroy(tnsTransformNode* n){
  32. laDestroyInSocket(n->Mat); strSafeDestroy(&n->Base.Name);
  33. }
  34. int IDN_TransformVisit(tnsTransformNode* n, laNodeVisitInfo* vi){
  35. if(LA_SRC_AND_PARENT(n->Mat)){ laBaseNode*bn=n->Mat->Source->Parent; LA_VISIT_NODE(bn,vi); }
  36. LA_ADD_THIS_NODE(n,vi);
  37. return LA_DAG_FLAG_PERM;
  38. }
  39. int IDN_TransformEval(tnsTransformNode* n){
  40. if(!n->Target) return 0;
  41. tnsObject* ob=n->Target; if(ob->PlayDuplicate){ ob=ob->PlayDuplicate; }
  42. if((!n->Mat->Source) || (n->Mat->Source->DataType!=(LA_PROP_FLOAT|LA_PROP_ARRAY)) || (n->Mat->Source->ArrLen!=16)){
  43. tnsLoadIdentity44d(ob->DeltaTransform); tnsSelfMatrixChanged(ob, 1);
  44. }else{
  45. memcpy(ob->DeltaTransform, n->Mat->Source->Data, sizeof(tnsMatrix44d)); tnsSelfMatrixChanged(ob, 1);
  46. }
  47. laNotifyInstanceUsers(n->Target);
  48. return 1;
  49. }
  50. void IDN_TransformCopy(tnsTransformNode* new, tnsTransformNode* old, int DoRematch){
  51. if(DoRematch){ LA_IDN_NEW_LINK(Mat) return; }
  52. memAssignRef(new,&new->Target,old->Target);
  53. }
  54. void tnsui_TransformNode(laUiList *uil, laPropPack *This, laPropPack *Extra, laColumn *UNUSED, int context){
  55. laColumn* c=laFirstColumn(uil); tnsTransformNode*n=This->EndInstance;
  56. LA_BASE_NODE_HEADER(uil,c,This);
  57. laColumn* cl,*cr; laSplitColumn(uil,c,0.3); cl=laLeftColumn(c,0); cr=laRightColumn(c,0);
  58. laUiItem* b=laBeginRow(uil,cl,0,0);
  59. laShowNodeSocket(uil,cl,This,"mat",0)->Flags|=LA_UI_SOCKET_LABEL_E;
  60. laEndRow(uil,b);
  61. laShowItem(uil,cr,This,"target");
  62. }
  63. void IDN_MakeTransformInit(tnsMakeTransformNode* n, int NoCreate){
  64. if(NoCreate){return;}
  65. n->Out=laCreateOutSocket(n,"MAT",0); strSafeSet(&n->Base.Name,"Make Transform");
  66. n->Loc=laCreateInSocket("LOC",0);
  67. n->Rot=laCreateInSocket("ROT",0); n->Angle=laCreateInSocket("ANGLE",0); n->UseRot[2]=1;
  68. n->Sca=laCreateInSocket("SCALE",0); n->UseSca=1;
  69. }
  70. void IDN_MakeTransformDestroy(tnsMakeTransformNode* n){
  71. laDestroyOutSocket(n->Out); strSafeDestroy(&n->Base.Name);
  72. laDestroyInSocket(n->Loc);
  73. laDestroyInSocket(n->Rot); laDestroyInSocket(n->Angle);
  74. laDestroyInSocket(n->Sca);
  75. }
  76. int IDN_MakeTransformVisit(tnsMakeTransformNode* n, laNodeVisitInfo* vi){
  77. LA_GUARD_THIS_NODE(n,vi);
  78. if(LA_SRC_AND_PARENT(n->Loc)){ laBaseNode*bn=n->Loc->Source->Parent; LA_VISIT_NODE(bn,vi); }
  79. if(LA_SRC_AND_PARENT(n->Rot)){ laBaseNode*bn=n->Rot->Source->Parent; LA_VISIT_NODE(bn,vi); }
  80. if(LA_SRC_AND_PARENT(n->Sca)){ laBaseNode*bn=n->Sca->Source->Parent; LA_VISIT_NODE(bn,vi); }
  81. if(LA_SRC_AND_PARENT(n->Angle)){ laBaseNode*bn=n->Angle->Source->Parent; LA_VISIT_NODE(bn,vi); }
  82. LA_ADD_THIS_NODE(n,vi);
  83. return LA_DAG_FLAG_PERM;
  84. }
  85. int IDN_MakeTransformEval(tnsMakeTransformNode* n){
  86. tnsMatrix44d mm,mt,mr,ms; real* UseT,*UseR,*UseA,*UseS; tnsVector3d nr;
  87. if(LA_SRC_AND_PARENT(n->Loc) && n->Loc->Source->ArrLen>=3 && n->Loc->Source->DataType==LA_PROP_FLOAT|LA_PROP_ARRAY){ UseT=n->Loc->Source->Data; }else{ UseT=n->UseLoc; }
  88. if(LA_SRC_AND_PARENT(n->Rot) && n->Rot->Source->ArrLen>=3 && n->Rot->Source->DataType==LA_PROP_FLOAT|LA_PROP_ARRAY){ UseR=n->Rot->Source->Data; }else{ UseR=n->UseRot; }
  89. if(LA_SRC_AND_PARENT(n->Angle) && n->Angle->Source->DataType&LA_PROP_FLOAT){ UseA=n->Angle->Source->Data; }else{ UseA=&n->UseAngle; }
  90. if(LA_SRC_AND_PARENT(n->Sca) && n->Sca->Source->DataType&LA_PROP_FLOAT){ UseS=n->Sca->Source->Data; }else{ UseS=&n->UseSca; }
  91. tnsMakeTranslationMatrix44d(mt,LA_COLOR3(UseT));
  92. tnsNormalize3d(nr, UseR); tnsMakeRotationMatrix44d(mr,*UseA, LA_COLOR3(nr));
  93. tnsMakeScaleMatrix44d(ms,*UseS,*UseS,*UseS);
  94. tnsMultiply44d(mm,mt,mr); tnsMultiply44d(n->Mat,mm,ms);
  95. n->Out->ArrLen=16; n->Out->Data=n->Mat; n->Out->DataType=LA_PROP_FLOAT|LA_PROP_ARRAY;
  96. return 1;
  97. }
  98. void IDN_MakeTransformCopy(tnsMakeTransformNode* new, tnsMakeTransformNode* old, int DoRematch){
  99. if(DoRematch){ LA_IDN_NEW_LINK(Loc) LA_IDN_NEW_LINK(Rot) LA_IDN_NEW_LINK(Sca) LA_IDN_NEW_LINK(Angle) return; }
  100. LA_IDN_OLD_DUPL(Out); new->UseSca=old->UseSca; new->UseAngle=old->UseAngle;
  101. tnsVectorSet3v(new->UseLoc,old->UseLoc); tnsVectorSet3v(new->UseRot,old->UseRot);
  102. }
  103. void tnsui_MakeTransformNode(laUiList *uil, laPropPack *This, laPropPack *Extra, laColumn *UNUSED, int context){
  104. laColumn* c=laFirstColumn(uil); tnsMakeTransformNode*n=This->EndInstance;
  105. laUiItem* b2, *rui;
  106. LA_BASE_NODE_HEADER(uil,c,This);
  107. laUiItem* b=laBeginRow(uil,c,0,0);
  108. laShowNodeSocket(uil,c,This,"loc",0)->Flags|=LA_UI_SOCKET_LABEL_E; b2=laOnConditionThat(uil,c,laNot(laPropExpression(This,"loc.source")));{
  109. laShowItem(uil,c,This,"use_loc")->Expand=1;
  110. }laEndCondition(uil,b2);
  111. laEndRow(uil,b);
  112. b=laBeginRow(uil,c,0,0);
  113. laShowNodeSocket(uil,c,This,"rot",0)->Flags|=LA_UI_SOCKET_LABEL_E; b2=laOnConditionThat(uil,c,laNot(laPropExpression(This,"rot.source")));{
  114. laShowItem(uil,c,This,"use_rot")->Expand=1;
  115. }laEndCondition(uil,b2);
  116. laEndRow(uil,b);
  117. b=laBeginRow(uil,c,0,0);
  118. laShowNodeSocket(uil,c,This,"angle",0)->Flags|=LA_UI_SOCKET_LABEL_E; b2=laOnConditionThat(uil,c,laNot(laPropExpression(This,"angle.source")));{
  119. laShowItem(uil,c,This,"use_angle")->Expand=1;
  120. }laEndCondition(uil,b2);
  121. laEndRow(uil,b);
  122. b=laBeginRow(uil,c,0,0);
  123. laShowNodeSocket(uil,c,This,"sca",0)->Flags|=LA_UI_SOCKET_LABEL_E; b2=laOnConditionThat(uil,c,laNot(laPropExpression(This,"sca.source")));{
  124. laShowItem(uil,c,This,"use_sca")->Expand=1;
  125. }laEndCondition(uil,b2);
  126. laEndRow(uil,b);
  127. b=laBeginRow(uil,c,0,0);
  128. laShowSeparator(uil,c)->Expand=1;;
  129. laShowNodeSocket(uil,c,This,"out",0)->Flags|=LA_UI_SOCKET_LABEL_W;
  130. laEndRow(uil,b);
  131. }
  132. void IDN_ActionPlayerInit(tnsActionPlayerNode* n, int NoCreate){
  133. if(NoCreate){ return; }
  134. strSafeSet(&n->Base.Name,"Make Transform");
  135. n->Next=laCreateOutSocket(n,"NEXT",0); n->Prev=laCreateInSocket("PREV",0);
  136. n->Transport=laCreateInSocket("TRANSPORT",0); n->Detached=laCreateInSocket("DETACHED",0); n->Time=laCreateInSocket("TIME",0);
  137. }
  138. void IDN_ActionPlayerDestroy(tnsActionPlayerNode* n){
  139. laDestroyInSocket(n->Prev); laDestroyOutSocket(n->Next); strSafeDestroy(&n->Base.Name);
  140. laDestroyInSocket(n->Transport); laDestroyInSocket(n->Time); laDestroyInSocket(n->Detached);
  141. }
  142. int IDN_ActionPlayerVisit(tnsActionPlayerNode* n, laNodeVisitInfo* vi){
  143. LA_GUARD_THIS_NODE(n,vi);
  144. if(LA_SRC_AND_PARENT(n->Prev)){ laBaseNode*bn=n->Prev->Source->Parent; LA_VISIT_NODE(bn,vi); }
  145. LA_ADD_THIS_NODE(n,vi);
  146. return LA_DAG_FLAG_PERM;
  147. }
  148. int IDN_ActionPlayerEval(tnsActionPlayerNode* n){
  149. if(!T->Runtime.CurrentEN || !n->Action){ return 1; } tnsEvaluatedNode* en=T->Runtime.CurrentEN;
  150. int transport = n->iTransport; LA_GET_SRC_AS_VALUE(transport,n->Transport);
  151. int detached = n->iDetached; LA_GET_SRC_AS_VALUE(detached,n->Detached);
  152. real time = 0; int has_time=n->Time->Source?1:0; LA_GET_SRC_AS_VALUE(time,n->Time);
  153. if(en->ActionRetarget){
  154. laActionRetarget* ar=en->ActionRetarget;
  155. en->ActionRetarget->DetachedInNode = detached;
  156. if(!en->ActionRetarget->DetachedInNode){ ar=((tnsRootObject*)en->Target)->ActionRetarget; }
  157. laRetargetedAction* ra=la_AnimationGetRetargetedAction(ar,n->Action); if(!ra){ return 1; }
  158. ra->PlayStatus = transport; if(has_time){ ra->PlayHead = time; }
  159. }else{
  160. tnsRootObject* o=en->Target; if(o->Base.Type!=TNS_OBJECT_ROOT){ return 1; }
  161. if(has_time){ n->Action->Offset=0; n->Action->PlayHead=time; }
  162. }
  163. return 1;
  164. }
  165. void IDN_ActionPlayerCopy(tnsActionPlayerNode* new, tnsActionPlayerNode* old, int DoRematch){
  166. if(DoRematch){ LA_IDN_NEW_LINK(Prev) return; }
  167. LA_IDN_OLD_DUPL(Next); new->Time=old->Time; new->Transport=old->Transport; new->Detached=old->Detached;
  168. new->iDetached = old->iDetached; new->iTransport = old->iTransport;
  169. memAssignRef(new,&new->Action,old->Action);
  170. }
  171. void tnsui_ActionPlayerNode(laUiList *uil, laPropPack *This, laPropPack *Extra, laColumn *UNUSED, int context){
  172. laColumn* c=laFirstColumn(uil),*cl,*cr,*cll,*clr;
  173. LA_BASE_NODE_HEADER(uil,c,This);
  174. laSplitColumn(uil,c,0.6); cl=laLeftColumn(c,0); cr=laRightColumn(c,3);
  175. laSplitColumn(uil,cl,0.4); cll=laLeftColumn(cl,3); clr=laRightColumn(cl,0);
  176. tnsActionPlayerNode*n=This->EndInstance;
  177. laUiItem* b2, *rui;
  178. laShowNodeSocket(uil,cr,This,"prev",0)->Flags|=LA_UI_SOCKET_LABEL_W;
  179. laShowNodeSocket(uil,cr,This,"next",0)->Flags|=LA_UI_SOCKET_LABEL_W;
  180. laUiItem* b=laBeginRow(uil,cl,0,0);
  181. laShowNodeSocket(uil,cl,This,"in_transport",0); b2=laOnConditionThat(uil,c,laNot(laPropExpression(This,"in_transport.source")));{
  182. laShowItemFull(uil,cl,This,"transport",0,"text=Transport",0,0)->Expand=1;
  183. }laElse(uil,b2);{
  184. laShowLabel(uil,cl,"Transport",0,0)->Expand=1;
  185. }laEndCondition(uil,b2);
  186. laShowNodeSocket(uil,cl,This,"in_detached",0); b2=laOnConditionThat(uil,c,laNot(laPropExpression(This,"in_detached.source")));{
  187. laShowItemFull(uil,cl,This,"detached",0,"text=Detached",0,0)->Expand=1;
  188. }laElse(uil,b2);{
  189. laShowLabel(uil,cl,"Detached",0,0)->Expand=1;
  190. }laEndCondition(uil,b2);
  191. laEndRow(uil,b);
  192. laShowNodeSocket(uil,cll,This,"in_time",0)->Flags|=LA_UI_SOCKET_LABEL_E;
  193. laShowItemFull(uil,clr,This,"action",LA_WIDGET_COLLECTION_SELECTOR,0,laui_IdentifierOnly,0);
  194. }
  195. int OPCHK_AddDriverPage(laPropPack *This, laStringSplitor *ss){
  196. if (This && la_EnsureSubTarget(This->LastPs->p,0) == TNS_PC_OBJECT_GENERIC) return 1;
  197. return 0;
  198. }
  199. int OPINV_AddDriverPage(laOperator* a, laEvent *e){
  200. tnsObject* ob=a->This?a->This->EndInstance:0; if(!ob || !ob->Drivers) return LA_CANCELED;
  201. laRackPage* dp=memAcquire(sizeof(laRackPage));
  202. strSafeSet(&dp->Name,"New Page");
  203. lstAppendItem(&ob->Drivers->Pages, dp);
  204. memAssignRef(dp,&dp->ParentObject,ob); memAssignRef(ob->Drivers,&ob->Drivers->CurrentPage,dp);
  205. dp->RackType=LA_RACK_TYPE_DRIVER;
  206. laNotifyInstanceUsers(ob->Drivers); laRecordAndPush(a->This,"","Add driver page", 0);
  207. return LA_FINISHED;
  208. }
  209. int OPCHK_RemoveDriverPage(laPropPack *This, laStringSplitor *ss){
  210. if ((!This) || (la_EnsureSubTarget(This->LastPs->p,0) != LA_PC_RACK_PAGE)) return 0;
  211. laRackPage* dp=This->EndInstance; if(!dp->ParentObject) return 0;
  212. return 1;
  213. }
  214. int OPINV_RemoveDriverPage(laOperator* a, laEvent *e){
  215. laRackPage* dp=a->This?a->This->EndInstance:0; if(!dp || !dp->ParentObject) return LA_CANCELED;
  216. tnsObject* ob=dp->ParentObject;
  217. if(strSame(strGetArgumentString(a->ExtraInstructionsP,"confirm"),"true")){
  218. strSafeDestroy(&dp->Name);
  219. while(dp->Racks.pFirst){ laDestroyRack(dp->Racks.pFirst); }
  220. while(lstPopPointer(&dp->Eval)); while(lstPopPointer(&dp->AlwaysBranchers));
  221. if(dp->ParentObject->Drivers->CurrentPage==dp){
  222. laRackPage* adp=dp->Item.pNext?dp->Item.pNext:dp->Item.pPrev;
  223. memAssignRef(dp->ParentObject->Drivers,&dp->ParentObject->Drivers->CurrentPage,adp);
  224. }laNotifyInstanceUsers(dp);
  225. lstRemoveItem(&dp->ParentObject->Drivers->Pages, dp); memLeave(dp);
  226. laNotifyInstanceUsers(ob->Drivers); laRecordAndPush(a->This,"","Remove driver page", 0);
  227. return LA_FINISHED;
  228. }
  229. laEnableOperatorPanel(a,a->This,e->x,e->y,200,200,0,0,0,0,0,0,0,0,e);
  230. return LA_RUNNING;
  231. }
  232. void laui_RemoveDriverPage(laUiList *uil, laPropPack *This, laPropPack *Extra, laColumn *UNUSED, int context){
  233. laColumn* c=laFirstColumn(uil);
  234. laShowItemFull(uil,c,This,"remove_driver_page",0,"confirm=true;text=Confirm",0,0);
  235. }
  236. int OPINV_RebuildDrivers(laOperator* a, laEvent *e){
  237. laGraphRequestRebuild();
  238. return LA_FINISHED;
  239. }
  240. tnsObject* tnsget_FirstObject(void* unused, void* unused2){
  241. return T->World->AllObjects.pFirst;
  242. }
  243. laAction* tnsget_FirstActionFromActionPlayer(tnsActionPlayerNode* apn, void* unused2){
  244. if(!apn->Base.InRack || !apn->Base.InRack->ParentPage || !apn->Base.InRack->ParentPage->ParentObject) return 0;
  245. tnsRootObject* ro = apn->Base.InRack->ParentPage->ParentObject; return ro->Actions.pFirst;
  246. }
  247. void tns_RegisterNodes(){
  248. laPropContainer *pc; laProp *p;
  249. laOperatorType *at;
  250. laEnumProp *ep;
  251. laCreateOperatorType("LA_add_driver_page", "New Page", "Add a driver page",OPCHK_AddDriverPage,0,0,OPINV_AddDriverPage,0,'+',0);
  252. laCreateOperatorType("LA_remove_driver_page", "Remove Page", "Remove a driver page",OPCHK_RemoveDriverPage,0,0,OPINV_RemoveDriverPage,OPMOD_FinishOnData,L'🗴',0)
  253. ->UiDefine=laui_RemoveDriverPage;
  254. laCreateOperatorType("LA_driver_rebuild", "Rebuild Drivers", "Rebuild drivers for evaluation",0,0,0,OPINV_RebuildDrivers,0,U'⭮',0);
  255. LA_NODE_CATEGORY_DRIVER=laEnsureNodeCategory("Driver",0,LA_RACK_TYPE_DRIVER);
  256. if(!MAIN.InitArgs.HasWorldObjects) return;
  257. pc=laAddPropertyContainer("tns_transform_node", "Transform", "Transform objects",0,tnsui_TransformNode,sizeof(tnsTransformNode),lapost_Node,0,1);
  258. TNS_PC_IDN_TRANSFORM=pc; laPropContainerExtraFunctions(pc,0,0,0,0,laui_DefaultNodeOperationsPropUiDefine);
  259. laAddSubGroup(pc,"base","Base","Base node","la_base_node",0,0,0,0,0,0,0,0,0,0,0,LA_UDF_LOCAL);
  260. laAddSubGroup(pc,"mat", "Mat","Input matrix","la_in_socket",0,0,0,offsetof(tnsTransformNode,Mat),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  261. laAddSubGroup(pc,"target", "Target","Target object","tns_object",0,LA_WIDGET_COLLECTION_SELECTOR,laui_IdentifierOnly,offsetof(tnsTransformNode,Target),tnsget_FirstObject,0,laget_ListNext,0,0,0,0,LA_UDF_REFER);
  262. pc=laAddPropertyContainer("tns_make_transform_node", "Make Transform", "Make transform matrix",0,tnsui_MakeTransformNode,sizeof(tnsMakeTransformNode),lapost_Node,0,1);
  263. TNS_PC_IDN_MAKE_TRANSFORM=pc; laPropContainerExtraFunctions(pc,0,0,0,0,laui_DefaultNodeOperationsPropUiDefine);
  264. laAddSubGroup(pc,"base","Base","Base node","la_base_node",0,0,0,0,0,0,0,0,0,0,0,LA_UDF_LOCAL);
  265. laAddSubGroup(pc,"out", "Out","Output matrix","la_out_socket",0,0,0,offsetof(tnsMakeTransformNode,Out),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  266. laAddSubGroup(pc,"loc", "Location","Location","la_in_socket",0,0,0,offsetof(tnsMakeTransformNode,Loc),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  267. laAddSubGroup(pc,"rot", "Rotation","Rotation","la_in_socket",0,0,0,offsetof(tnsMakeTransformNode,Rot),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  268. laAddSubGroup(pc,"sca", "Scale","Scale","la_in_socket",0,0,0,offsetof(tnsMakeTransformNode,Sca),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  269. laAddSubGroup(pc,"angle", "Angle","Rotation Angle","la_in_socket",0,0,0,offsetof(tnsMakeTransformNode,Angle),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  270. laAddFloatProperty(pc,"use_loc", "Location", "Use Location",0,"X,Y,Z",0,0,0,0.05,0,0,offsetof(tnsMakeTransformNode, UseLoc),0,0,3,0,0,0,0,0,0,0,0);
  271. laAddFloatProperty(pc,"use_rot", "Rotation", "Use Rotation",0,"X,Y,Z",0,0,0,0.05,0,0,offsetof(tnsMakeTransformNode, UseRot),0,0,3,0,0,0,0,0,0,0,0);
  272. laAddFloatProperty(pc,"use_sca", "Scale", "Use scale",0,0,0,0,0,0.05,0,0,offsetof(tnsMakeTransformNode, UseSca),0,0,0,0,0,0,0,0,0,0,0);
  273. laAddFloatProperty(pc,"use_angle", "Angle", "Use angle",0,0,0,0,0,0.05,0,0,offsetof(tnsMakeTransformNode, UseAngle),0,0,0,0,0,0,0,0,0,0,0);
  274. pc=laAddPropertyContainer("tns_action_player_node", "Action Player", "Action player node",0,tnsui_ActionPlayerNode,sizeof(tnsActionPlayerNode),lapost_Node,0,1);
  275. TNS_PC_IDN_ACTION_PLAYER=pc; laPropContainerExtraFunctions(pc,0,0,0,0,laui_DefaultNodeOperationsPropUiDefine);
  276. laAddSubGroup(pc,"base","Base","Base node","la_base_node",0,0,0,0,0,0,0,0,0,0,0,LA_UDF_LOCAL);
  277. laAddSubGroup(pc,"prev", "Previous","Previous node","la_in_socket",0,0,0,offsetof(tnsActionPlayerNode,Prev),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  278. laAddSubGroup(pc,"next", "Next","Next node","la_out_socket",0,0,0,offsetof(tnsActionPlayerNode,Next),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  279. laAddSubGroup(pc,"in_transport", "In Transport","Transport input","la_in_socket",0,0,0,offsetof(tnsActionPlayerNode,Transport),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  280. laAddSubGroup(pc,"in_time", "In Time","Time Input","la_in_socket",0,0,0,offsetof(tnsActionPlayerNode,Time),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  281. laAddSubGroup(pc,"in_detached", "In Detached","Detached input","la_in_socket",0,0,0,offsetof(tnsActionPlayerNode,Detached),0,0,0,0,0,0,0,LA_UDF_SINGLE);
  282. ep=laAddEnumProperty(pc,"transport","Transport","Action in transport",LA_WIDGET_ENUM_HIGHLIGHT,0,0,0,0,offsetof(tnsActionPlayerNode,iTransport),0,0,0,0,0,0,0,0,0,0);
  283. laAddEnumItemAs(ep,"STOPPED","Stopped","Player is stopped",0,0);
  284. laAddEnumItemAs(ep,"PLAYING","Playing","Player is playing",1,0);
  285. ep=laAddEnumProperty(pc,"detached","Detached","Action is detached on the instance",LA_WIDGET_ENUM_HIGHLIGHT,0,0,0,0,offsetof(tnsActionPlayerNode,iDetached),0,0,0,0,0,0,0,0,0,0);
  286. laAddEnumItemAs(ep,"NONE","None","Action is reused from instancer",0,0);
  287. laAddEnumItemAs(ep,"DETACHED","Detached","Action state is on instance itself",1,0);
  288. laAddSubGroup(pc,"action","Action","Target action","la_animation_action",0,0,0,offsetof(tnsActionPlayerNode,Action),tnsget_FirstActionFromActionPlayer,0,laget_ListNext,0,0,0,0,LA_UDF_REFER);
  289. LA_IDN_REGISTER("Transform",0,TNS_IDN_TRANSFORM,TNS_PC_IDN_TRANSFORM, IDN_Transform, tnsTransformNode);
  290. LA_IDN_REGISTER("Make Transform",0,TNS_IDN_MAKE_TRANSFORM,TNS_PC_IDN_MAKE_TRANSFORM, IDN_MakeTransform, tnsMakeTransformNode);
  291. LA_IDN_REGISTER("Action Player",0,TNS_IDN_ACTION_PLAYER,TNS_PC_IDN_ACTION_PLAYER, IDN_ActionPlayer, tnsActionPlayerNode);
  292. laNodeCategoryAddNodeTypes(LA_NODE_CATEGORY_MATH, &TNS_IDN_MAKE_TRANSFORM,0);
  293. laNodeCategoryAddNodeTypes(LA_NODE_CATEGORY_DRIVER, &TNS_IDN_TRANSFORM, &TNS_IDN_ACTION_PLAYER,0);
  294. }