SO3Engine
SCOLAnim.cpp
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
25
33#include <boost/format.hpp>
34
36#include "SCOLPack/SO3SCOL.h"
37
38// Animation includes
42
43// Scene Graph includes
48
49
52
64int getAnimationCallbackEndEvent(mmachine m, SCOL_PTR_TYPE id, SCOL_PTR_TYPE param)
65{
66#ifdef SO3_DEBUG
67 MMechostr(MSKDEBUG, "getAnimationCallbackEndEvent\n");
68#endif
69
70 int k;
71 int res = 0;
72
73 if (!(k = OBJbeginreflex(m, SO3ANIM, SCOL_PTR id, SO3_ANIM_END)))
74 {
75 res = OBJcallreflex(m, 0);
76 }
77 return res;
78}
79
80
89int SO3AnimTrackGetObject(mmachine m)
90{
91#ifdef SO3_DEBUG
92 MMechostr(MSKDEBUG, "SO3AnimTrackGetObject\n");
93#endif
94
95 int at = MMget(m, 0);
96 if (at == NIL)
97 {
98 MMechostr(MSKDEBUG, "AnimTrack IS NIL \n");
99 MMset(m, 0, NIL);
100 return 0;
101 }
102
103 SAnimTrack* animTrack = MMgetPointer<SAnimTrack*>(m, MTOP(at));
104 if (animTrack == NULL)
105 {
106 MMechostr(MSKDEBUG, "AnimTrack IS NULL \n");
107 MMset(m, 0, NIL);
108 return 0;
109 }
110
111 if (animTrack->GetType() != SAnimTrack::SO3_NODE_TRACK)
112 {
113 MMset(m, 0, NIL);
114 return 0;
115 }
116
117 try
118 {
119 SNode* curNode = animTrack->GetParentAnimation()->GetParentNode();
120 if (curNode == NULL)
121 {
122 MMechostr(MSKDEBUG, "curNode==NULL \n");
123 MMset(m, 0, NIL);
124 return 0;
125 }
126
127 int n = OBJfindTH(m, SO3OBJTYPE, SCOL_PTR (curNode));
128 if (n != NIL)
129 n = MMfetch(m, n, OFFOBJMAG);
130
131 MMset(m, 0, n);
132 }
133 catch (Ogre::Exception &e)
134 {
135 MMechostr(MSKDEBUG, "An exception has occurred: %s\n", e.what());
136 MMset(m, 0, NIL);
137 }
138
139 return 0;
140}
141
142
156{
157#ifdef SO3_DEBUG
158 MMechostr(MSKDEBUG, "SO3AnimTrackCreateKey\n");
159#endif
160
161 int sc = MTOP(MMpull(m));
162 int q = MTOP(MMpull(m));
163 int t = MTOP(MMpull(m));
164 int keyFrame = MMpull(m);
165 int at = MMget(m, 0);
166 if ((at == NIL) || (keyFrame == NIL) || (t == NIL) || (q == NIL))
167 {
168 MMset(m, 0, NIL);
169 return 0;
170 }
171
172 SAnimTrack* curAnimTrack = MMgetPointer<SAnimTrack*>(m, MTOP(at));
173 if (curAnimTrack == NULL)
174 {
175 MMset(m, 0, NIL);
176 return 0;
177 }
178
179 if (curAnimTrack->GetType() != SAnimTrack::SO3_NODE_TRACK)
180 {
181 MMset(m, 0, NIL);
182 return 0;
183 }
184
185 Ogre::Vector3 pos;
186 pos.x = (MMfetch(m, t, 0) == NIL) ? 0.0f : MTOF(MMfetch(m, t, 0));
187 pos.y = (MMfetch(m, t, 1) == NIL) ? 0.0f : MTOF(MMfetch(m, t, 1));
188 pos.z = (MMfetch(m, t, 2) == NIL) ? 0.0f : MTOF(MMfetch(m, t, 2));
189
190 Ogre::Vector3 scale;
191 scale.x = (MMfetch(m, sc, 0) == NIL) ? 1.0f : MTOF(MMfetch(m, sc, 0));
192 scale.y = (MMfetch(m, sc, 1) == NIL) ? 1.0f : MTOF(MMfetch(m, sc, 1));
193 scale.z = (MMfetch(m, sc, 2) == NIL) ? 1.0f : MTOF(MMfetch(m, sc, 2));
194
195 Ogre::Quaternion quat;
196 quat.x = (MMfetch(m, q, 0) == NIL) ? 0.0f : MTOF(MMfetch(m, q, 0));
197 quat.y = (MMfetch(m, q, 1) == NIL) ? 0.0f : MTOF(MMfetch(m, q, 1));
198 quat.z = (MMfetch(m, q, 2) == NIL) ? 0.0f : MTOF(MMfetch(m, q, 2));
199 quat.w = (MMfetch(m, q, 3) == NIL) ? 1.0f : MTOF(MMfetch(m, q, 3));
200 quat.normalise();
201
202 curAnimTrack->CreateKey(MTOF(keyFrame), pos, quat, scale);
203
204 MMset(m, 0, ITOM(1));
205 return 0;
206}
207
208
222{
223#ifdef SO3_DEBUG
224 MMechostr(MSKDEBUG, "SO3AnimTrackSetKeyTransform\n");
225#endif
226
227 int sc = MTOP(MMpull(m));
228 int q = MTOP(MMpull(m));
229 int t = MTOP(MMpull(m));
230 int keyFrame = MMpull(m);
231 int at = MMget(m, 0);
232 if ((at == NIL) || (keyFrame == NIL) || (t == NIL) || (q == NIL))
233 {
234 MMset(m, 0, NIL);
235 return 0;
236 }
237
238 SAnimTrack* curAnimTrack = MMgetPointer<SAnimTrack*>(m, MTOP(at));
239 if (curAnimTrack == NULL)
240 {
241 MMset(m, 0, NIL);
242 return 0;
243 }
244
245 if (curAnimTrack->GetType() != SAnimTrack::SO3_NODE_TRACK)
246 {
247 MMset(m, 0, NIL);
248 return 0;
249 }
250
251 Ogre::Vector3 pos;
252 pos.x = (MMfetch(m, t, 0) == NIL) ? 0.0f : MTOF(MMfetch(m, t, 0));
253 pos.y = (MMfetch(m, t, 1) == NIL) ? 0.0f : MTOF(MMfetch(m, t, 1));
254 pos.z = (MMfetch(m, t, 2) == NIL) ? 0.0f : MTOF(MMfetch(m, t, 2));
255
256 Ogre::Vector3 scale;
257 scale.x = (MMfetch(m, sc, 0) == NIL) ? 1.0f : MTOF(MMfetch(m, sc, 0));
258 scale.y = (MMfetch(m, sc, 1) == NIL) ? 1.0f : MTOF(MMfetch(m, sc, 1));
259 scale.z = (MMfetch(m, sc, 2) == NIL) ? 1.0f : MTOF(MMfetch(m, sc, 2));
260
261 Ogre::Quaternion quat;
262 quat.x = (MMfetch(m, q, 0) == NIL) ? 0.0f : MTOF(MMfetch(m, q, 0));
263 quat.y = (MMfetch(m, q, 1) == NIL) ? 0.0f : MTOF(MMfetch(m, q, 1));
264 quat.z = (MMfetch(m, q, 2) == NIL) ? 0.0f : MTOF(MMfetch(m, q, 2));
265 quat.w = (MMfetch(m, q, 3) == NIL) ? 1.0f : MTOF(MMfetch(m, q, 3));
266 quat.normalise();
267
268 curAnimTrack->SetKeyTransform(MTOI(keyFrame), pos, quat, scale);
269
270 MMset(m, 0, ITOM(1));
271 return 0;
272}
273
274
288{
289#ifdef SO3_DEBUG
290 MMechostr(MSKDEBUG, "SO3AnimTrackGetKeyTransform\n");
291#endif
292
293 int keyFrame = MMpull(m);
294 int at = MMget(m, 0);
295 if ((at == NIL) || (keyFrame == NIL))
296 {
297 MMset(m, 0, NIL);
298 return 0;
299 }
300
301 SAnimTrack* curAnimTrack = MMgetPointer<SAnimTrack*>(m, MTOP(at));
302 if (curAnimTrack == NULL)
303 {
304 MMset(m, 0, NIL);
305 return 0;
306 }
307
308 if (curAnimTrack->GetType() != SAnimTrack::SO3_NODE_TRACK)
309 {
310 MMset(m, 0, NIL);
311 return 0;
312 }
313
314 Ogre::Vector3 pos;
315 Ogre::Quaternion quat;
316 Ogre::Vector3 scale;
317
318 curAnimTrack->GetKeyTransform(MTOI(keyFrame), pos, quat, scale);
319
320 // Translation
321 int trans = MMmalloc(m, 3, TYPETAB);
322 if (trans == NIL)
323 {
324 MMset(m, 0, NIL);
325 return MERRMEM;
326 }
327 MMstore(m, trans, 0, FTOM(pos.x));
328 MMstore(m, trans, 1, FTOM(pos.y));
329 MMstore(m, trans, 2, FTOM(pos.z));
330 MMpush(m, PTOM(trans));
331
332 // Orientation
333 int torient = MMmalloc(m, 4, TYPETAB);
334 if (torient == NIL)
335 {
336 MMset(m, 0, NIL);
337 return MERRMEM;
338 }
339 MMstore(m, torient, 0, FTOM(quat.x));
340 MMstore(m, torient, 1, FTOM(quat.y));
341 MMstore(m, torient, 2, FTOM(quat.z));
342 MMstore(m, torient, 3, FTOM(quat.w));
343 MMpush(m, PTOM(torient));
344
345 // scale
346 int tscale = MMmalloc(m, 3, TYPETAB);
347 if (tscale == NIL)
348 {
349 MMset(m, 0, NIL);
350 return MERRMEM;
351 }
352 MMstore(m, tscale, 0, FTOM(scale.x));
353 MMstore(m, tscale, 1, FTOM(scale.y));
354 MMstore(m, tscale, 2, FTOM(scale.z));
355 MMpush(m, PTOM(tscale));
356
357 // FINAL TUPPLE
358 int result = MMmalloc(m, 3, TYPETAB);
359 if (result == NIL)
360 {
361 MMset(m, 0, NIL);
362 return MERRMEM;
363 }
364 MMstore(m, result, 2, MMpull(m));
365 MMstore(m, result, 1, MMpull(m));
366 MMstore(m, result, 0, MMpull(m));
367 MMset(m, 0, PTOM(result));
368 return 0;
369}
370
371
381{
382#ifdef SO3_DEBUG
383 MMechostr(MSKDEBUG, "SO3AnimTrackGetNumKeys\n");
384#endif
385
386 int at = MMget(m, 0);
387 if (at == NIL)
388 {
389 MMset(m, 0, NIL);
390 return 0;
391 }
392
393 SAnimTrack* curAnimTrack = MMgetPointer<SAnimTrack*>(m, MTOP(at));
394 if (curAnimTrack == NULL)
395 {
396 MMset(m, 0, NIL);
397 return 0;
398 }
399
400 int nb = curAnimTrack->GetNumKeyFrames();
401 MMset(m, 0, ITOM(nb));
402 return 0;
403}
404
405
416{
417#ifdef SO3_DEBUG
418 MMechostr(MSKDEBUG, "SO3AnimTrackGetKeyAtTime\n");
419#endif
420
421 int keyFrame = MMpull(m);
422 int at = MMget(m, 0);
423 if ((at == NIL) || (keyFrame == NIL))
424 {
425 MMset(m, 0, NIL);
426 return 0;
427 }
428
429 SAnimTrack* curAnimTrack = MMgetPointer<SAnimTrack*>(m, MTOP(at));
430 if (curAnimTrack == NULL)
431 {
432 MMset(m, 0, NIL);
433 return 0;
434 }
435
436 float ptime = curAnimTrack->GetKeyPositionTime(MTOI(keyFrame));
437
438 MMset(m, 0, FTOM(ptime));
439 return 0;
440}
441
442
453{
454#ifdef SO3_DEBUG
455 MMechostr(MSKDEBUG, "SO3AnimTrackRemoveKey\n");
456#endif
457
458 int keyFrame = MMpull(m);
459 int at = MMget(m, 0);
460 if ((at == NIL) || (keyFrame == NIL))
461 {
462 MMset(m, 0, NIL);
463 return 0;
464 }
465
466 SAnimTrack* curAnimTrack = MMgetPointer<SAnimTrack*>(m, MTOP(at));
467 if (curAnimTrack == NULL)
468 {
469 MMset(m, 0, NIL);
470 return 0;
471 }
472
473 if ((curAnimTrack->GetType() != SAnimTrack::SO3_NODE_TRACK) && (curAnimTrack->GetType() != SAnimTrack::SO3_SEQUENCE_TRACK))
474 {
475 MMset(m, 0, NIL);
476 return 0;
477 }
478
479 curAnimTrack->RemoveKey(MTOI(keyFrame));
480
481 MMset(m, 0, ITOM(1));
482 return 0;
483}
484
485
494int SO3AnimTrackOptimise(mmachine m)
495{
496#ifdef SO3_DEBUG
497 MMechostr(MSKDEBUG, "SO3AnimTrackOptimise\n");
498#endif
499
500 int at = MMget(m, 0);
501 if (at == NIL)
502 {
503 MMset(m, 0, NIL);
504 return 0;
505 }
506
507 SAnimTrack* curAnimTrack = MMgetPointer<SAnimTrack*>(m, MTOP(at));
508 if (curAnimTrack == NULL)
509 {
510 MMset(m, 0, NIL);
511 return 0;
512 }
513
514 curAnimTrack->SetOptimise();
515 MMset(m, 0, ITOM(1));
516 return 0;
517}
518
519
529{
530#ifdef SO3_DEBUG
531 MMechostr(MSKDEBUG, "SO3AnimTrackRemoveAllKeys\n");
532#endif
533
534 int at = MMget(m, 0);
535 if (at == NIL)
536 {
537 MMset(m, 0, NIL);
538 return 0;
539 }
540
541 SAnimTrack* curAnimTrack = MMgetPointer<SAnimTrack*>(m, MTOP(at));
542 if (curAnimTrack == NULL)
543 {
544 MMset(m, 0, NIL);
545 return 0;
546 }
547
548 if ((curAnimTrack->GetType() != SAnimTrack::SO3_NODE_TRACK) && (curAnimTrack->GetType() != SAnimTrack::SO3_SEQUENCE_TRACK))
549 {
550 MMset(m, 0, NIL);
551 return 0;
552 }
553
554 curAnimTrack->RemoveAllKeyFrames();
555 MMset(m, 0, ITOM(1));
556 return 0;
557}
558
559
568int SO3AnimationGetName(mmachine m)
569{
570#ifdef SO3_DEBUG
571 MMechostr(MSKDEBUG, "SO3AnimationGetName\n");
572#endif
573
574 int anim = MMpull(m);
575 if (anim == NIL)
576 {
577 MMpush(m, NIL);
578 return 0;
579 };
580
581 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
582 if (animation == NULL)
583 {
584 MMpush(m, NIL);
585 return 0;
586 }
587
588 // Scol name
589 return Mpushstrbloc(m, (char*)animation->GetName().c_str());
590}
591
592
603{
604#ifdef SO3_DEBUG
605 MMechostr(MSKDEBUG, "SO3AnimationSetLength\n");
606#endif
607
608 int l = MMpull(m);
609 int anim = MMget(m, 0);
610 if ((anim == NIL) || (l == NIL))
611 {
612 MMset(m, 0, NIL);
613 return 0;
614 }
615
616 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
617 if (animation == NULL)
618 {
619 MMset(m, 0, NIL);
620 return 0;
621 }
622
623 animation->SetLength((Ogre::Real)MTOF(l));
624 MMset(m, 0, ITOM(1));
625 return 0;
626}
627
628
639{
640#ifdef SO3_DEBUG
641 MMechostr(MSKDEBUG, "SO3AnimationSetTimePosition\n");
642#endif
643
644 int t = MMpull(m);
645 int anim = MMget(m, 0);
646 if ((anim == NIL) || (t == NIL))
647 {
648 MMset(m, 0, NIL);
649 return 0;
650 }
651
652 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
653 if (animation == NULL)
654 {
655 MMset(m, 0, NIL);
656 return 0;
657 }
658
659 animation->SetTimePosition((Ogre::Real)MTOF(t));
660 MMset(m, 0, ITOM(1));
661 return 0;
662}
663
664
675{
676#ifdef SO3_DEBUG
677 MMechostr(MSKDEBUG, "SO3AnimationSetWeight\n");
678#endif
679
680 int w = MMpull(m);
681 int anim = MMget(m, 0);
682 if ((anim == NIL) || (w == NIL))
683 {
684 MMset(m, 0, NIL);
685 return 0;
686 }
687
688 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
689 if (animation == NULL)
690 {
691 MMset(m, 0, NIL);
692 return 0;
693 }
694
695 animation->SetInitialWeight((Ogre::Real)MTOF(w));
696 MMset(m, 0, ITOM(1));
697 return 0;
698}
699
700
715{
716#ifdef SO3_DEBUG
717 MMechostr(MSKDEBUG, "SO3AnimationSetInterpMode\n");
718#endif
719
720 int flag = MTOI(MMpull(m));
721 int anim = MMget(m, 0);
722 if (anim == NIL)
723 {
724 MMset(m, 0, NIL);
725 return 0;
726 }
727
728 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
729 if (animation == NULL)
730 {
731 MMset(m, 0, NIL);
732 return 0;
733 }
734
735 animation->SetInterpolationMode(static_cast<SAnim::AnimInterpolationMode> (flag));
736 MMset(m, 0, ITOM(1));
737 return 0;
738}
739
740
755{
756#ifdef SO3_DEBUG
757 MMechostr(MSKDEBUG, "SO3AnimationSetRotInterpMode\n");
758#endif
759
760 int flag = MTOI(MMpull(m));
761 int anim = MMget(m, 0);
762 if (anim == NIL)
763 {
764 MMset(m, 0, NIL);
765 return 0;
766 }
767
768 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
769 if (animation == NULL)
770 {
771 MMset(m, 0, NIL);
772 return 0;
773 }
774
775 animation->SetRotationInterpolationMode(static_cast<SAnim::AnimRotationInterpolationMode> (flag));
776 MMset(m, 0, ITOM(1));
777 return 0;
778}
779
780
794{
795#ifdef SO3_DEBUG
796 MMechostr(MSKDEBUG, "SO3AnimationGetInterpMode\n");
797#endif
798
799 int anim = MMget(m, 0);
800 if (anim == NIL)
801 {
802 MMset(m, 0, NIL);
803 return 0;
804 }
805
806 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
807 if (animation == NULL)
808 {
809 MMset(m, 0, NIL);
810 return 0;
811 }
812
813 int flag = 0;
814 flag = (int)(animation->GetInterpolationMode());
815 MMset(m, 0, ITOM(flag));
816 return 0;
817}
818
819
835int SO3AnimationGetType(mmachine m)
836{
837#ifdef SO3_DEBUG
838 MMechostr(MSKDEBUG, "SO3AnimationGetType\n");
839#endif
840
841 int anim = MMget(m, 0);
842 if (anim == NIL)
843 {
844 MMset(m, 0, NIL);
845 return 0;
846 }
847
848 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
849 if (animation == NULL)
850 {
851 MMset(m, 0, NIL);
852 return 0;
853 }
854
855 int flag = 0;
856 flag = (int)(animation->GetType());
857 MMset(m, 0, ITOM(flag));
858 return 0;
859}
860
861
870int SO3AnimTrackDestroy(mmachine m)
871{
872#ifdef SO3_DEBUG
873 MMechostr(MSKDEBUG, "SO3AnimTrackDestroy\n");
874#endif
875
876 int at = MMget(m, 0);
877 if (at == NIL)
878 {
879 MMset(m, 0, NIL);
880 return 0;
881 }
882
883 SAnimTrack* animTrack = MMgetPointer<SAnimTrack*>(m, MTOP(at));
884 if (animTrack == NULL)
885 {
886 MMset(m, 0, NIL);
887 return 0;
888 }
889
890 if ((animTrack->GetType() != SAnimTrack::SO3_NODE_TRACK) && (animTrack->GetType() != SAnimTrack::SO3_SEQUENCE_TRACK))
891 {
892 MMset(m, 0, NIL);
893 return 0;
894 }
895
896 OBJdelTM(m, SO3ANIMTRACK, at);
897 MMset(m, 0, ITOM(1));
898
899 return 0;
900}
901
902
916{
917#ifdef SO3_DEBUG
918 MMechostr(MSKDEBUG, "SO3AnimationGetRotInterpMode\n");
919#endif
920
921 int anim = MMget(m, 0);
922 if (anim == NIL)
923 {
924 MMset(m, 0, NIL);
925 return 0;
926 }
927
928 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
929 if (animation == NULL)
930 {
931 MMset(m, 0, NIL);
932 return 0;
933 }
934
935 int flag = 0;
936 flag = (int)(animation->GetRotationInterpolationMode());
937 MMset(m, 0, ITOM(flag));
938 return 0;
939}
940
941
952{
953#ifdef SO3_DEBUG
954 MMechostr(MSKDEBUG, "SO3AnimationSetEnable\n");
955#endif
956
957 int bEnable = MTOI(MMpull(m));
958 int anim = MMget(m, 0);
959 if (anim == NIL)
960 {
961 MMset(m, 0, NIL);
962 return 0;
963 }
964
965 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
966 if (animation == NULL)
967 {
968 MMset(m, 0, NIL);
969 return 0;
970 }
971
972 animation->SetEnable(!bEnable ? false : true);
973
974 MMset(m, 0, ITOM(1));
975 return 0;
976}
977
978
988int SO3AnimationSetPause(mmachine m)
989{
990#ifdef SO3_DEBUG
991 MMechostr(MSKDEBUG, "SO3AnimationSetPause\n");
992#endif
993
994 int bPause = MTOI(MMpull(m));
995 int anim = MMget(m, 0);
996 if (anim == NIL)
997 {
998 MMset(m, 0, NIL);
999 return 0;
1000 }
1001
1002 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
1003 if (animation == NULL)
1004 {
1005 MMset(m, 0, NIL);
1006 return 0;
1007 }
1008
1009 animation->SetPaused(!bPause ? false : true);
1010
1011 MMset(m, 0, ITOM(1));
1012 return 0;
1013}
1014
1015
1025int SO3AnimationSetLoop(mmachine m)
1026{
1027#ifdef SO3_DEBUG
1028 MMechostr(MSKDEBUG, "SO3AnimationSetLoop\n");
1029#endif
1030 int bLoop = MTOI(MMpull(m));
1031 int anim = MMget(m, 0);
1032
1033 if ((anim == NIL) || (bLoop == NIL))
1034 {
1035 MMset(m, 0, NIL);
1036 return 0;
1037 }
1038
1039 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
1040 if (animation == NULL)
1041 {
1042 MMset(m, 0, NIL);
1043 return 0;
1044 }
1045
1046 animation->SetInitialLoop(!bLoop ? false : true);
1047
1048 MMset(m, 0, ITOM(1));
1049 return 0;
1050}
1051
1052
1062{
1063#ifdef SO3_DEBUG
1064 MMechostr(MSKDEBUG, "SO3AnimationOptimise\n");
1065#endif
1066
1067 int booleen = MTOI(MMpull(m));
1068 int anim = MMget(m, 0);
1069 if (anim == NIL)
1070 {
1071 MMset(m, 0, NIL);
1072 return 0;
1073 }
1074
1075 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
1076 if (animation == NULL)
1077 {
1078 MMset(m, 0, NIL);
1079 return 0;
1080 }
1081
1082 if (booleen == 0)
1083 animation->SetOptimise(false);
1084 else
1085 animation->SetOptimise(true);
1086
1087 MMset(m, 0, ITOM(1));
1088 return 0;
1089}
1090
1091
1101{
1102#ifdef SO3_DEBUG
1103 MMechostr(MSKDEBUG, "SO3AnimationGetEnable\n");
1104#endif
1105
1106 int anim = MMget(m, 0);
1107 if (anim == NIL)
1108 {
1109 MMset(m, 0, NIL);
1110 return 0;
1111 }
1112
1113 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
1114 if (animation == NULL)
1115 {
1116 MMset(m, 0, NIL);
1117 return 0;
1118 }
1119
1120 int booleen = 0;
1121 if (animation->GetEnable())
1122 booleen = 1;
1123
1124 MMset(m, 0, ITOM(booleen));
1125 return 0;
1126}
1127
1128
1138{
1139#ifdef SO3_DEBUG
1140 MMechostr(MSKDEBUG, "SO3AnimationGetPause\n");
1141#endif
1142
1143 int anim = MMget(m, 0);
1144 if (anim == NIL)
1145 {
1146 MMset(m, 0, NIL);
1147 return 0;
1148 }
1149
1150 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
1151 if (animation == NULL)
1152 {
1153 MMset(m, 0, NIL);
1154 return 0;
1155 }
1156
1157 int booleen = 0;
1158 if (animation->GetPaused())
1159 booleen = 1;
1160
1161 MMset(m, 0, ITOM(booleen));
1162 return 0;
1163}
1164
1165
1174int SO3AnimationGetLoop(mmachine m)
1175{
1176#ifdef SO3_DEBUG
1177 MMechostr(MSKDEBUG, "SO3AnimationGetLoop\n");
1178#endif
1179
1180 int anim = MMget(m, 0);
1181 if (anim == NIL)
1182 {
1183 MMset(m, 0, NIL);
1184 return 0;
1185 }
1186
1187 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
1188 if (animation == NULL)
1189 {
1190 MMset(m, 0, NIL);
1191 return 0;
1192 }
1193
1194 int state = 0;
1195 if (animation->GetInitialLoop())
1196 state = 1;
1197
1198 MMset(m, 0, ITOM(state));
1199 return 0;
1200}
1201
1202
1212{
1213#ifdef SO3_DEBUG
1214 MMechostr(MSKDEBUG, "SO3AnimationGetLength\n");
1215#endif
1216
1217 int anim = MMget(m, 0);
1218 if (anim == NIL)
1219 {
1220 MMset(m, 0, NIL);
1221 return 0;
1222 }
1223
1224 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
1225 if (animation == NULL)
1226 {
1227 MMset(m, 0, NIL);
1228 return 0;
1229 }
1230
1231 float l = 0.0f;
1232 l = animation->GetLength();
1233 MMset(m, 0, FTOM(l));
1234 return 0;
1235}
1236
1237
1247{
1248#ifdef SO3_DEBUG
1249 MMechostr(MSKDEBUG, "SO3AnimationGetTimePosition\n");
1250#endif
1251
1252 int anim = MMget(m, 0);
1253 if (anim == NIL)
1254 {
1255 MMset(m, 0, NIL);
1256 return 0;
1257 }
1258
1259 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
1260 if (animation == NULL)
1261 {
1262 MMset(m, 0, NIL);
1263 return 0;
1264 }
1265
1266 MMset(m, 0, FTOM(animation->GetTimePosition()));
1267 return 0;
1268}
1269
1270
1280{
1281#ifdef SO3_DEBUG
1282 MMechostr(MSKDEBUG, "SO3AnimationGetWeight\n");
1283#endif
1284
1285 int anim = MMget(m, 0);
1286 if (anim == NIL)
1287 {
1288 MMset(m, 0, NIL);
1289 return 0;
1290 }
1291
1292 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
1293 if (animation == NULL)
1294 {
1295 MMset(m, 0, NIL);
1296 return 0;
1297 }
1298
1299 MMset(m, 0, FTOM(animation->GetInitialWeight()));
1300 return 0;
1301}
1302
1303
1314{
1315#ifdef SO3_DEBUG
1316 MMechostr(MSKDEBUG, "SO3AnimationSetSpeed\n");
1317#endif
1318
1319 int fspeed = MMpull(m);
1320 int anim = MMget(m, 0);
1321 if ((anim == NIL) || (fspeed == NIL))
1322 {
1323 MMset(m, 0, NIL);
1324 return 0;
1325 }
1326
1327 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
1328 if (animation == NULL)
1329 {
1330 MMset(m, 0, NIL);
1331 return 0;
1332 }
1333
1334 animation->SetSpeed(MTOF(fspeed));
1335 MMset(m, 0, ITOM(1));
1336 return 0;
1337}
1338
1339
1349{
1350#ifdef SO3_DEBUG
1351 MMechostr(MSKDEBUG, "SO3AnimationGetSpeed\n");
1352#endif
1353
1354 int anim = MMget(m, 0);
1355 if (anim == NIL)
1356 {
1357 MMset(m, 0, NIL);
1358 return 0;
1359 }
1360
1361 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
1362 if (animation == NULL)
1363 {
1364 MMset(m, 0, NIL);
1365 return 0;
1366 }
1367
1368 MMset(m, 0, FTOM(animation->GetSpeed()));
1369 return 0;
1370}
1371
1372
1382{
1383#ifdef SO3_DEBUG
1384 MMechostr(MSKDEBUG, "SO3AnimationHasEnded\n");
1385#endif
1386
1387 int anim = MMget(m, 0);
1388 if (anim == NIL)
1389 {
1390 MMset(m, 0, NIL);
1391 return 0;
1392 }
1393
1394 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
1395 if (animation == NULL)
1396 {
1397 MMset(m, 0, NIL);
1398 return 0;
1399 }
1400
1401 int booleen = 0;
1402 if (animation->HasEnded())
1403 booleen = 1;
1404
1405 MMset(m, 0, ITOM(booleen));
1406 return 0;
1407}
1408
1409
1419{
1420#ifdef SO3_DEBUG
1421 MMechostr(MSKDEBUG, "SO3AnimationNumOfAnimationTrack\n");
1422#endif
1423
1424 int anim = MMget(m, 0);
1425 if (anim == NIL)
1426 {
1427 MMset(m, 0, NIL);
1428 return 0;
1429 }
1430
1431 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
1432 if (animation == NULL)
1433 {
1434 MMset(m, 0, NIL);
1435 return 0;
1436 }
1437
1438 int val = 0;
1439 val = animation->GetNumAnimationsTracks();
1440 MMset(m, 0, ITOM(val));
1441 return 0;
1442}
1443
1444
1454{
1455#ifdef SO3_DEBUG
1456 MMechostr(MSKDEBUG, "SO3ObjectSkeletonNumOfAnimation\n");
1457#endif
1458
1459 int skl = MMget(m, 0);
1460 if (skl == NIL)
1461 {
1462 MMset(m, 0, NIL);
1463 return 0;
1464 }
1465
1466 SNode* node = MMgetPointer<SNode*>(m, MTOP(skl));
1467 if (node == 0)
1468 {
1469 MMset(m, 0, NIL);
1470 return 0;
1471 }
1472
1473 if (node->GetNodeType() == SNode::ENTITY_TYPE_ID)
1474 {
1475 SEntity* entity = static_cast<SEntity*> (node);
1476 if (entity == NULL)
1477 {
1478 MMset(m, 0, NIL);
1479 return 0;
1480 }
1481
1482 if (entity->GetSkeleton() != 0)
1483 {
1484 int val = (int)entity->GetSkeleton()->GetNumAnimations();
1485 MMset(m, 0, ITOM(val));
1486 }
1487 else
1488 MMset(m, 0, NIL);
1489 }
1490 else
1491 MMset(m, 0, NIL);
1492
1493 return 0;
1494}
1495
1496
1506{
1507#ifdef SO3_DEBUG
1508 MMechostr(MSKDEBUG, "SO3ObjectGetAnimations\n");
1509#endif
1510
1511 int n = MMget(m, 0);
1512 if (n == NIL)
1513 {
1514 MMset(m, 0, NIL);
1515 return 0;
1516 }
1517
1518 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1519 if (node == 0)
1520 {
1521 MMset(m, 0, NIL);
1522 return 0;
1523 }
1524
1525 int tmp_res;
1526 size_t numAnimations = node->GetNumAnimations();
1527
1528 // Calculate the total animations of the node if it's an entity with a Skeleton attached
1529 if (node->GetNodeType() == SNode::ENTITY_TYPE_ID)
1530 {
1531 SEntity* entity = static_cast<SEntity*> (node);
1532 SSkeleton* entitySkeleton = entity->GetSkeleton();
1533 if (entitySkeleton != 0)
1534 numAnimations += entitySkeleton->GetNumAnimations();
1535 }
1536
1537 if (numAnimations > 0)
1538 {
1539 const SAnimMap animationListCopy = node->GetAnimations();
1540 SAnimMap::const_iterator iAnimations = animationListCopy.begin();
1541 while (iAnimations != animationListCopy.end())
1542 {
1543 int a = OBJfindTH(m, SO3ANIM, SCOL_PTR (iAnimations->second));
1544
1545 if (a != NIL)
1546 a = MMfetch(m, a, OFFOBJMAG);
1547
1548 if (MMpush(m, a))
1549 return MERRMEM;
1550
1551 INVERT(m, 0, 1);
1552 iAnimations++;
1553 }
1554
1555 if (node->GetNodeType() == SNode::ENTITY_TYPE_ID)
1556 {
1557 SEntity* entity = static_cast<SEntity*> (node);
1558
1559 // get all animations from list by entity and by type
1560 SSkeleton* entitySkeleton = entity->GetSkeleton();
1561 if (entitySkeleton != 0)
1562 {
1563 if (entitySkeleton->GetNumAnimations() > 0)
1564 {
1565 const SAnimMap animationListCopy = entitySkeleton->GetAnimations();
1566 SAnimMap::const_iterator iAnimations = animationListCopy.begin();
1567 while (iAnimations != animationListCopy.end())
1568 {
1569 int a = OBJfindTH(m, SO3ANIM, SCOL_PTR (iAnimations->second));
1570
1571 if (a != NIL)
1572 a = MMfetch(m, a, OFFOBJMAG);
1573
1574 if (MMpush(m, a))
1575 return MERRMEM;
1576
1577 INVERT(m, 0, 1);
1578 iAnimations++;
1579 }
1580 }
1581 }
1582 }
1583
1584 if (numAnimations == 0)
1585 {
1586 MMset(m, 0, NIL);
1587 return 0;
1588 }
1589
1590 MMpull(m);
1591 if (MMpush(m, NIL))
1592 return MERRMEM;
1593
1594 for (int j = 0; j<numAnimations; j++)
1595 {
1596 if (MMpush(m, 2 * 2))
1597 return MERRMEM;
1598
1599 if (int k = MBdeftab(m))
1600 return k;
1601 }
1602 }
1603 else
1604 MMset(m, 0, NIL);
1605
1606 return 0;
1607}
1608
1609
1619{
1620#ifdef SO3_DEBUG
1621 MMechostr(MSKDEBUG, "SO3AnimationListAnimTrack\n");
1622#endif
1623
1624 int a = MMget(m, 0);
1625 if (a == NIL)
1626 {
1627 MMset(m, 0, NIL);
1628 return 0;
1629 }
1630
1631 SAnim* anim = MMgetPointer<SAnim*>(m, MTOP(a));
1632 if (anim == NULL)
1633 {
1634 MMset(m, 0, NIL);
1635 return 0;
1636 }
1637
1638 if ((anim->GetType() == SAnim::SO3_SCENENODE_ANIM) || (anim->GetType() == SAnim::SO3_SEQUENCE_ANIM))
1639 {
1640 int tmp_res;
1641 const SAnimTrackList animationTrackListCopy = anim->GetAnimationsTracks();
1642 SAnimTrackList::const_iterator iAnimTrackList = animationTrackListCopy.begin();
1643 while (iAnimTrackList != animationTrackListCopy.end())
1644 {
1645 int a = OBJfindTH(m, SO3ANIMTRACK, SCOL_PTR (*iAnimTrackList));
1646 if (a != NIL)
1647 a = MMfetch(m, a, OFFOBJMAG);
1648
1649 if (MMpush(m, a))
1650 return MERRMEM;
1651
1652 INVERT(m, 0, 1);
1653 iAnimTrackList++;
1654 }
1655 MMpull(m);
1656 if (MMpush(m, NIL))
1657 return MERRMEM;
1658
1659 int numAnimations = anim->GetNumAnimationsTracks();
1660 for (int j = 0; j<numAnimations; j++)
1661 {
1662 if (MMpush(m, 2 * 2))
1663 return MERRMEM;
1664
1665 if (int k = MBdeftab(m))
1666 return k;
1667 }
1668 }
1669 else
1670 MMset(m, 0, NIL);
1671
1672 return 0;
1673}
1674
1675
1685{
1686#ifdef SO3_DEBUG
1687 MMechostr(MSKDEBUG, "SO3ObjectGetDisplaySkeleton\n");
1688#endif
1689
1690 int n = MMget(m, 0);
1691 if (n == NIL)
1692 {
1693 MMset(m, 0, NIL);
1694 return 0;
1695 }
1696
1697 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1698 if (node == 0)
1699 {
1700 MMset(m, 0, NIL);
1701 return 0;
1702 }
1703
1704 if (node->GetNodeType() == SNode::ENTITY_TYPE_ID)
1705 {
1706 SEntity* entity = static_cast<SEntity*> (node);
1707 if (entity->GetSkeleton() != 0)
1708 {
1709 // TODO re-factorisation
1710 int booleen = 0;
1711 if (entity->getOgreEntityPointer() && entity->getOgreEntityPointer()->getDisplaySkeleton())
1712 booleen = 1;
1713
1714 MMset(m, 0, ITOM(booleen));
1715 }
1716 else
1717 {
1718 MMset(m, 0, NIL);
1719 return 0;
1720 }
1721 }
1722 else
1723 MMset(m, 0, NIL);
1724
1725 return 0;
1726}
1727
1728
1738{
1739#ifdef SO3_DEBUG
1740 MMechostr(MSKDEBUG, "SO3ObjectHasSkeleton\n");
1741#endif
1742
1743 int n = MMget(m, 0);
1744 if (n == NIL)
1745 {
1746 MMset(m, 0, NIL);
1747 return 0;
1748 }
1749
1750 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1751 if (node == 0)
1752 {
1753 MMset(m, 0, NIL);
1754 return 0;
1755 }
1756
1757 if (node->GetNodeType() == SNode::ENTITY_TYPE_ID)
1758 {
1759 SEntity* entity = static_cast<SEntity*> (node);
1760 int booleen = 0;
1761 if (entity->GetSkeleton() != 0)
1762 booleen = 1;
1763
1764 MMset(m, 0, ITOM(booleen));
1765 }
1766 else
1767 MMset(m, 0, NIL);
1768
1769 return 0;
1770}
1771
1772
1782{
1783#ifdef SO3_DEBUG
1784 MMechostr(MSKDEBUG, "SO3ObjectIsHardwareSkinningEnabled\n");
1785#endif
1786
1787 int n = MMget(m, 0);
1788 if (n == NIL)
1789 {
1790 MMset(m, 0, NIL);
1791 return 0;
1792 }
1793
1794 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1795 if (node == 0)
1796 {
1797 MMset(m, 0, NIL);
1798 return 0;
1799 }
1800
1801 if (node->GetNodeType() == SNode::ENTITY_TYPE_ID)
1802 {
1803 SEntity* entity = static_cast<SEntity*> (node);
1804 if (entity->GetSkeleton() != 0)
1805 {
1806 //TODO re-factorisation
1807 int booleen = 0;
1808 if (entity->getOgreEntityPointer() && entity->getOgreEntityPointer()->isHardwareAnimationEnabled())
1809 booleen = 1;
1810
1811 MMset(m, 0, ITOM(booleen));
1812 }
1813 else
1814 {
1815 MMset(m, 0, NIL);
1816 return 0;
1817 }
1818 }
1819 else
1820 MMset(m, 0, NIL);
1821
1822 return 0;
1823}
1824
1825
1835{
1836#ifdef SO3_DEBUG
1837 MMechostr(MSKDEBUG, "SO3ObjectSkeletonSetBindPose\n");
1838#endif
1839
1840 int n = MMget(m, 0);
1841 if (n == NIL)
1842 {
1843 MMset(m, 0, NIL);
1844 return 0;
1845 }
1846
1847 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1848 if (node == 0)
1849 {
1850 MMset(m, 0, NIL);
1851 return 0;
1852 }
1853
1854 if (node->GetNodeType() == SNode::ENTITY_TYPE_ID)
1855 {
1856 SEntity* entity = static_cast<SEntity*> (node);
1857 if (entity->GetSkeleton() != 0)
1858 {
1859 entity->GetSkeleton()->SetBindingPose();
1860 MMset(m, 0, ITOM(1));
1861 }
1862 else
1863 {
1864 MMset(m, 0, NIL);
1865 return 0;
1866 }
1867 }
1868 else
1869 MMset(m, 0, NIL);
1870
1871 return 0;
1872}
1873
1874
1888{
1889#ifdef SO3_DEBUG
1890 MMechostr(MSKDEBUG, "SO3ObjectSkeletonGetBlendMode\n");
1891#endif
1892
1893 int n = MMget(m, 0);
1894 if (n == NIL)
1895 {
1896 MMset(m, 0, NIL);
1897 return 0;
1898 }
1899
1900 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1901 if (node == 0)
1902 {
1903 MMset(m, 0, NIL);
1904 return 0;
1905 }
1906
1907 if (node->GetNodeType() == SNode::ENTITY_TYPE_ID)
1908 {
1909 SEntity* entity = static_cast<SEntity*> (node);
1910 if (entity->GetSkeleton() != 0)
1911 {
1912 SSkeleton::SkeletonAnimationMode flag = entity->GetSkeleton()->GetBlendMode();
1913 MMset(m, 0, ITOM(flag));
1914 }
1915 else
1916 {
1917 MMset(m, 0, NIL);
1918 return 0;
1919 }
1920 }
1921 else
1922 MMset(m, 0, NIL);
1923
1924 return 0;
1925}
1926
1927
1941{
1942#ifdef SO3_DEBUG
1943 MMechostr(MSKDEBUG, "SO3ObjectSkeletonSetBlendMode\n");
1944#endif
1945
1946 int flag = MTOI(MMpull(m));
1947 int n = MMget(m, 0);
1948 if ((n == NIL) || (flag == NIL))
1949 {
1950 MMset(m, 0, NIL);
1951 return 0;
1952 }
1953
1954 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1955 if (node == 0)
1956 {
1957 MMset(m, 0, NIL);
1958 return 0;
1959 }
1960
1961 if (node->GetNodeType() == SNode::ENTITY_TYPE_ID)
1962 {
1963 SEntity* entity = static_cast<SEntity*> (node);
1964 if (entity->GetSkeleton() != 0)
1965 {
1966 entity->GetSkeleton()->SetBlendMode(static_cast<SSkeleton::SkeletonAnimationMode> (flag));
1967 MMset(m, 0, ITOM(1));
1968 }
1969 else
1970 {
1971 MMset(m, 0, NIL);
1972 return 0;
1973 }
1974 }
1975 else
1976 MMset(m, 0, NIL);
1977
1978 return 0;
1979}
1980
1981
1992{
1993#ifdef SO3_DEBUG
1994 MMechostr(MSKDEBUG, "SO3ObjectSetDisplaySkeleton\n");
1995#endif
1996
1997 int booleen = MTOI(MMpull(m));
1998 int n = MMget(m, 0);
1999 if (n == NIL)
2000 {
2001 MMset(m, 0, NIL);
2002 return 0;
2003 }
2004
2005 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2006 if (node == 0)
2007 {
2008 MMset(m, 0, NIL);
2009 return 0;
2010 }
2011
2012 if (node->GetNodeType() == SNode::ENTITY_TYPE_ID)
2013 {
2014 SEntity* entity = static_cast<SEntity*> (node);
2015 if (entity->GetSkeleton() != 0)
2016 {
2017 try
2018 {
2019 //TODO re-factorisation
2020 /*if(booleen == 0)entity->getOgreEntityPointer()->setDisplaySkeleton(true) ;
2021 else entity->getOgreEntityPointer()->setDisplaySkeleton(true) ;
2022 */
2023 }
2024 catch (Ogre::Exception &e)
2025 {
2026 MMechostr(MSKDEBUG, "An exception has occurred: %s\n", e.what());
2027 MMset(m, 0, NIL);
2028 return 0;
2029 }
2030 }
2031 else
2032 {
2033 MMset(m, 0, NIL);
2034 }
2035 }
2036 else
2037 MMset(m, 0, NIL);
2038
2039 return 0;
2040}
2041
2042
2052int SO3AnimationAddTime(mmachine m)
2053{
2054#ifdef SO3_DEBUG
2055 MMechostr(MSKDEBUG, "SO3AnimationAddTime\n");
2056#endif
2057
2058 int time = MMpull(m);
2059 int anim = MMget(m, 0);
2060 if ((anim == NIL) || (time == NIL))
2061 {
2062 MMset(m, 0, NIL);
2063 return 0;
2064 }
2065
2066 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
2067 if (animation == NULL)
2068 {
2069 MMset(m, 0, NIL);
2070 return 0;
2071 }
2072
2073 try
2074 {
2075 animation->AddTime(MTOF(time));
2076 }
2077 catch (Ogre::Exception &e)
2078 {
2079 MMechostr(MSKDEBUG, "An exception has occurred: %s\n", e.what());
2080 MMset(m, 0, NIL);
2081 return 0;
2082 }
2083 MMset(m, 0, ITOM(1));
2084 return 0;
2085}
2086
2087
2096int SO3AnimationDestroy(mmachine m)
2097{
2098#ifdef SO3_DEBUG
2099 MMechostr(MSKDEBUG, "SO3AnimationDestroy\n");
2100#endif
2101
2102 int a = MMget(m, 0);
2103 if (a == NIL)
2104 {
2105 MMset(m, 0, NIL);
2106 return 0;
2107 }
2108
2109 SAnim* anim = MMgetPointer<SAnim*>(m, MTOP(a));
2110 if (anim == NULL)
2111 {
2112 MMset(m, 0, NIL);
2113 return 0;
2114 }
2115
2116 OBJdelTM(m, SO3ANIM, a);
2117 MMset(m, 0, ITOM(1));
2118 return 0;
2119}
2120
2121
2132{
2133#ifdef SO3_DEBUG
2134 MMechostr(MSKDEBUG, "SO3AnimationGetAnimTrack\n");
2135#endif
2136
2137 int idx = MMpull(m);
2138 int anim = MMget(m, 0);
2139 if ((idx == NIL) || (anim == NIL))
2140 {
2141 MMset(m, 0, NIL);
2142 return 0;
2143 }
2144
2145 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
2146 if (animation == NULL)
2147 {
2148 MMset(m, 0, NIL);
2149 return 0;
2150 }
2151
2152 try
2153 {
2154 SAnimTrack* mTrack = animation->GetAnimationTrack(MTOI(idx));
2155 if (mTrack == NULL)
2156 {
2157 MMset(m, 0, NIL);
2158 return 0;
2159 }
2160
2161 int t = OBJfindTH(m, SO3ANIMTRACK, SCOL_PTR (mTrack));
2162 if (t != NIL)
2163 t = MMfetch(m, t, OFFOBJMAG);
2164
2165 MMset(m, 0, t);
2166 return 0;
2167 }
2168 catch (Ogre::Exception& e)
2169 {
2170 MMechostr(MSKDEBUG, "An exception has occurred: %s\n", e.what());
2171 MMset(m, 0, NIL);
2172 return 0;
2173 }
2174 MMset(m, 0, ITOM(1));
2175 return 0;
2176}
2177
2178
2190{
2191#ifdef SO3_DEBUG
2192 MMechostr(MSKDEBUG, "SO3AnimationCreateAnimTrack\n");
2193#endif
2194
2195 // two last param are deprecated
2196 MMpull(m);
2197 MMpull(m);
2198 int anim = MMpull(m);
2199 if (anim == NIL)
2200 {
2201 MMpush(m, NIL);
2202 return 0;
2203 }
2204
2205 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
2206 if (animation == NULL)
2207 {
2208 MMpush(m, NIL);
2209 return 0;
2210 }
2211
2212 try
2213 {
2214 SAnimTrack* animationTrack = animation->CreateAnimationTrack(boost::str(boost::format("%1%") % animation->GetNumAnimationsTracks()));
2215 return createAnimTrack(m, animationTrack, animation);
2216 }
2217 catch (Ogre::Exception& e)
2218 {
2219 MMechostr(MSKDEBUG, "An exception has occurred: %s\n", e.what());
2220 MMpush(m, NIL);
2221 return 0;
2222 }
2223}
2224
2225
2236{
2237#ifdef SO3_DEBUG
2238 MMechostr(MSKDEBUG, "SO3AnimationSetSkipFrame\n");
2239#endif
2240
2241 int iState = MMpull(m);
2242 int anim = MMget(m, 0);
2243 if (anim == NIL)
2244 {
2245 MMset(m, 0, NIL);
2246 return 0;
2247 }
2248
2249 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
2250 if (animation == NULL)
2251 {
2252 MMset(m, 0, NIL);
2253 return 0;
2254 }
2255
2256 bool bState = false;
2257 if ((iState != NIL) && (MTOI(iState) == 1))
2258 bState = true;
2259
2260 animation->SetSkipFrame(bState);
2261
2262 MMset(m, 0, ITOM(0));
2263 return 0;
2264}
2265
2266
2276{
2277#ifdef SO3_DEBUG
2278 MMechostr(MSKDEBUG, "SO3AnimationGetSkipFrame\n");
2279#endif
2280
2281 int anim = MMget(m, 0);
2282 if (anim == NIL)
2283 {
2284 MMset(m, 0, NIL);
2285 return 0;
2286 }
2287
2288 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
2289 if (animation == NULL)
2290 {
2291 MMset(m, 0, NIL);
2292 return 0;
2293 }
2294
2295 bool bState = animation->SkipFrame();
2296
2297 MMset(m, 0, bState ? ITOM(1) : ITOM(0));
2298 return 0;
2299}
2300
2301
2315{
2316#ifdef SO3_DEBUG
2317 MMechostr(MSKDEBUG, "SO3AnimTrackCreateSequenceKey\n");
2318#endif
2319
2320 int idecal = MMpull(m);
2321 int ipos = MMpull(m);
2322 int ilength = MMpull(m);
2323 int anim = MMpull(m);
2324 int track = MMget(m, 0);
2325 if ((anim == NIL) || (track == NIL))
2326 {
2327 MMset(m, 0, NIL);
2328 return 0;
2329 }
2330
2331 float fpos = 0.0f;
2332 if (ipos != NIL)
2333 fpos = MTOF(ipos);
2334
2335 float fdecal = 0.0f;
2336 if (idecal != NIL)
2337 fdecal = MTOF(idecal);
2338
2339 float flength = 0.0f;
2340 if (ilength != NIL)
2341 flength = MTOF(ilength);
2342
2343 SAnim* animation = MMgetPointer<SAnim*>(m, MTOP(anim));
2344 if (animation == NULL)
2345 {
2346 MMset(m, 0, NIL);
2347 return 0;
2348 }
2349
2350 SAnimTrack* curAnimTrack = MMgetPointer<SAnimTrack*>(m, MTOP(track));
2351 if (curAnimTrack == NULL)
2352 {
2353 MMset(m, 0, NIL);
2354 return 0;
2355 }
2356
2357 if (curAnimTrack->GetType() != SAnimTrack::SO3_SEQUENCE_TRACK)
2358 {
2359 MMset(m, 0, NIL);
2360 return 0;
2361 }
2362
2363 try
2364 {
2365 static_cast<SSequenceAnimationTrack*>(curAnimTrack)->AddKey(animation, flength, fpos, fdecal);
2366 }
2367 catch (Ogre::Exception)
2368 {
2369 MMechostr(MSKRUNTIME, "SO3AnimationSequenceAddAnim : Bad animation track type");
2370 MMset(m, 0, ITOM(0));
2371 return 0;
2372 }
2373
2374 MMset(m, 0, ITOM(1));
2375 return 0;
2376}
2377
2378
2396{
2397#ifdef SO3_DEBUG
2398 MMechostr(MSKDEBUG, "SO3AnimTrackGetSequenceKey\n");
2399#endif
2400
2401 int index = MMpull(m);
2402 int track = MMget(m, 0);
2403 if ((track == NIL) || (index == NIL))
2404 {
2405 MMset(m, 0, NIL);
2406 return 0;
2407 }
2408
2409 SAnimTrack* curAnimTrack = MMgetPointer<SAnimTrack*>(m, MTOP(track));
2410 if (curAnimTrack == NULL)
2411 {
2412 MMset(m, 0, NIL);
2413 return 0;
2414 }
2415
2416 if (curAnimTrack->GetType() != SAnimTrack::SO3_SEQUENCE_TRACK)
2417 {
2418 MMset(m, 0, NIL);
2419 return 0;
2420 }
2421
2422 index = MTOI(index);
2423
2424 SAnim* keyAnim = 0;
2425 float keyTime = 0.0f;
2426 float keyLength = 0.0f;
2427 float keyTrans = 0.0f;
2428 float keyDecal = 0.0f;
2429
2430 try
2431 {
2432 SSequenceAnimationTrack* track = static_cast<SSequenceAnimationTrack*>(curAnimTrack);
2433 if (!track)
2434 {
2435 MMset(m, 0, NIL);
2436 return 0;
2437 }
2438 SSequenceAnimationKey* key = track->GetKeyFromIndex(index);
2439 if (!key)
2440 {
2441 MMset(m, 0, NIL);
2442 return 0;
2443 }
2444
2445 keyAnim = key->GetAnim();
2446 keyTime = key->GetPosition();
2447 keyLength = key->GetLength();
2448 keyTrans = key->GetTransitionTime();
2449 keyDecal = key->GetDecalTime();
2450
2451 int t = OBJfindTH(m, SO3ANIM, SCOL_PTR (keyAnim));
2452 if (t != NIL)
2453 t = MMfetch(m, t, OFFOBJMAG);
2454
2455 // FINAL TUPPLE
2456 int result = MMmalloc(m, 4, TYPETAB);
2457 if (result == NIL)
2458 {
2459 MMset(m, 0, NIL);
2460 return MERRMEM;
2461 }
2462 MMstore(m, result, 0, t);
2463 MMstore(m, result, 1, FTOM(keyTime));
2464 MMstore(m, result, 2, FTOM(keyLength));
2465 MMstore(m, result, 3, FTOM(keyTrans));
2466 MMstore(m, result, 4, FTOM(keyDecal));
2467 MMset(m, 0, PTOM(result));
2468 }
2469 catch (Ogre::Exception)
2470 {
2471 MMechostr(MSKRUNTIME, "SO3AnimationSequenceAddAnim : Bad animation track type");
2472 MMset(m, 0, NIL);
2473 return 0;
2474 }
2475
2476 return 0;
2477}
2478
2479
2493{
2494#ifdef SO3_DEBUG
2495 MMechostr(MSKDEBUG, "SO3AnimTrackSetSequenceKey\n");
2496#endif
2497
2498 int idecal = MMpull(m);
2499 int ipos = MMpull(m);
2500 int ilength = MMpull(m);
2501 int index = MMpull(m);
2502 int track = MMget(m, 0);
2503 if ((index == NIL) || (track == NIL))
2504 {
2505 MMset(m, 0, NIL);
2506 return 0;
2507 }
2508
2509 index = MTOI(index);
2510
2511 float fpos = 0.0f;
2512 if (ipos != NIL)
2513 fpos = MTOF(ipos);
2514
2515 float fdecal = 0.0f;
2516 if (idecal != NIL)
2517 fdecal = MTOF(idecal);
2518
2519 float flength = 0.0f;
2520 if (ilength != NIL)
2521 flength = MTOF(ilength);
2522
2523 SAnimTrack* curAnimTrack = MMgetPointer<SAnimTrack*>(m, MTOP(track));
2524 if (curAnimTrack == NULL)
2525 {
2526 MMset(m, 0, NIL);
2527 return 0;
2528 }
2529
2530 if (curAnimTrack->GetType() != SAnimTrack::SO3_SEQUENCE_TRACK)
2531 {
2532 MMset(m, 0, NIL);
2533 return 0;
2534 }
2535
2536 try
2537 {
2538 SSequenceAnimationTrack* track = static_cast<SSequenceAnimationTrack*>(curAnimTrack);
2539 if (!track)
2540 {
2541 MMset(m, 0, NIL);
2542 return 0;
2543 }
2544 track->SetKey(index, flength, fpos, fdecal);
2545 }
2546 catch (Ogre::Exception)
2547 {
2548 MMechostr(MSKRUNTIME, "SO3AnimationSequenceAddAnim : Bad animation track type");
2549 MMset(m, 0, ITOM(0));
2550 return 0;
2551 }
2552
2553 MMset(m, 0, ITOM(1));
2554 return 0;
2555}
2556
2557
2569{
2570#ifdef SO3_DEBUG
2571 MMechostr(MSKDEBUG, "SO3AnimTrackMoveSequenceKey\n");
2572#endif
2573
2574 int nindex = MMpull(m);
2575 int index = MMpull(m);
2576 int track = MMget(m, 0);
2577 if ((index == NIL) || (nindex == NIL) || (track == NIL))
2578 {
2579 MMset(m, 0, NIL);
2580 return 0;
2581 }
2582
2583 index = MTOI(index);
2584 nindex = MTOI(nindex);
2585
2586 SAnimTrack* curAnimTrack = MMgetPointer<SAnimTrack*>(m, MTOP(track));
2587 if (curAnimTrack == NULL)
2588 {
2589 MMset(m, 0, NIL);
2590 return 0;
2591 }
2592
2593 if (curAnimTrack->GetType() != SAnimTrack::SO3_SEQUENCE_TRACK)
2594 {
2595 MMset(m, 0, NIL);
2596 return 0;
2597 }
2598
2599 try
2600 {
2601 SSequenceAnimationTrack* track = static_cast<SSequenceAnimationTrack*>(curAnimTrack);
2602 if (!track)
2603 {
2604 MMset(m, 0, NIL);
2605 return 0;
2606 }
2607 track->MoveKeyFromIndex(index, nindex);
2608 }
2609 catch (Ogre::Exception)
2610 {
2611 MMechostr(MSKRUNTIME, "SO3AnimationSequenceAddAnim : Bad animation track type");
2612 MMset(m, 0, ITOM(0));
2613 return 0;
2614 }
2615
2616 MMset(m, 0, ITOM(1));
2617 return 0;
2618}
2619
2620
2630int SO3CbAnimationEnded(mmachine m)
2631{
2632 int k = OBJaddreflex(m, SO3ANIM, SO3_ANIM_END);
2633 return k;
2634}
2635
2636
2637NativeDefinition natSO3Anim[] = {
2638 { "SO3AnimTrackGetObject", 1, "fun [SO3_ANIMTRACK] SO3_OBJECT", SO3AnimTrackGetObject },
2639 { "SO3AnimTrackCreateKey", 5, "fun [SO3_ANIMTRACK F [F F F] [F F F F] [F F F]] I", SO3AnimTrackCreateKey },
2640 { "SO3AnimTrackSetKeyTransform", 5, "fun [SO3_ANIMTRACK I [F F F] [F F F F] [F F F]] I", SO3AnimTrackSetKeyTransform },
2641 { "SO3AnimTrackGetKeyTransform", 2, "fun [SO3_ANIMTRACK I] [[F F F] [F F F F] [F F F]]", SO3AnimTrackGetKeyTransform },
2642 { "SO3AnimTrackGetNumKeys", 1, "fun [SO3_ANIMTRACK] I", SO3AnimTrackGetNumKeys },
2643 { "SO3AnimTrackGetKeyTime", 2, "fun [SO3_ANIMTRACK I] F", SO3AnimTrackGetKeyTime },
2644 { "SO3AnimTrackRemoveKey", 2, "fun [SO3_ANIMTRACK I] I", SO3AnimTrackRemoveKey },
2645 { "SO3AnimTrackOptimise", 1, "fun [SO3_ANIMTRACK] I", SO3AnimTrackOptimise },
2646 { "SO3AnimTrackRemoveAllKeys", 1, "fun [SO3_ANIMTRACK] I", SO3AnimTrackRemoveAllKeys },
2647 { "SO3AnimationGetName", 1, "fun [SO3_ANIM] S", SO3AnimationGetName },
2648 { "SO3AnimationSetLenght", 2, "fun [SO3_ANIM F] I", SO3AnimationSetLength },
2649 { "SO3AnimationSetLength", 2, "fun [SO3_ANIM F] I", SO3AnimationSetLength },
2650 { "SO3AnimationSetTimePosition", 2, "fun [SO3_ANIM F] I", SO3AnimationSetTimePosition },
2651 { "SO3AnimationSetWeight", 2, "fun [SO3_ANIM F] I", SO3AnimationSetWeight },
2652 { "SO3AnimationSetInterpMode", 2, "fun [SO3_ANIM I] I", SO3AnimationSetInterpMode },
2653 { "SO3AnimationSetRotInterpMode", 2, "fun [SO3_ANIM I] I", SO3AnimationSetRotInterpMode },
2654 { "SO3AnimationGetInterpMode", 1, "fun [SO3_ANIM] I", SO3AnimationGetInterpMode },
2655 { "SO3AnimationGetType", 1, "fun [SO3_ANIM] I", SO3AnimationGetType },
2656 { "SO3AnimTrackDestroy", 1, "fun [SO3_ANIMTRACK] I", SO3AnimTrackDestroy },
2657 { "SO3AnimationGetRotInterpMode", 1, "fun [SO3_ANIM] I", SO3AnimationGetRotInterpMode },
2658 { "SO3AnimationSetEnable", 2, "fun [SO3_ANIM I] I", SO3AnimationSetEnable },
2659 { "SO3AnimationSetPause", 2, "fun [SO3_ANIM I] I", SO3AnimationSetPause },
2660 { "SO3AnimationSetLoop", 2, "fun [SO3_ANIM I] I", SO3AnimationSetLoop },
2661 { "SO3AnimationOptimise", 2, "fun [SO3_ANIM I] I", SO3AnimationOptimise },
2662 { "SO3AnimationGetEnable", 1, "fun [SO3_ANIM] I", SO3AnimationGetEnable },
2663 { "SO3AnimationGetPause", 1, "fun [SO3_ANIM] I", SO3AnimationGetPause },
2664 { "SO3AnimationGetLoop", 1, "fun [SO3_ANIM] I", SO3AnimationGetLoop },
2665 { "SO3AnimationGetLenght", 1, "fun [SO3_ANIM] F", SO3AnimationGetLength },
2666 { "SO3AnimationGetLength", 1, "fun [SO3_ANIM] F", SO3AnimationGetLength },
2667 { "SO3AnimationGetTimePosition", 1, "fun [SO3_ANIM] F", SO3AnimationGetTimePosition },
2668 { "SO3AnimationGetWeight", 1, "fun [SO3_ANIM] F", SO3AnimationGetWeight },
2669 { "SO3AnimationHasEnded", 1, "fun [SO3_ANIM] I", SO3AnimationHasEnded },
2670 { "SO3AnimationNumOfAnimationTrack", 1, "fun [SO3_ANIM] I", SO3AnimationNumOfAnimationTrack },
2671 { "SO3ObjectSkeletonNumOfAnimations", 1, "fun [SO3_OBJECT] I", SO3ObjectSkeletonNumOfAnimations },
2672 { "SO3ObjectGetVertexAnimations", 1, "fun [SO3_OBJECT] [SO3_ANIM r1]", SO3ObjectGetAnimations },
2673 { "SO3ObjectGetAnimations", 1, "fun [SO3_OBJECT] [SO3_ANIM r1]", SO3ObjectGetAnimations },
2674 { "SO3AnimationListAnimTrack", 1, "fun [SO3_ANIM] [SO3_ANIMTRACK r1]", SO3AnimationListAnimTrack },
2675 { "SO3ObjectGetDisplaySkeleton", 1, "fun [SO3_OBJECT] I", SO3ObjectGetDisplaySkeleton },
2676 { "SO3ObjectHasSkeleton", 1, "fun [SO3_OBJECT] I", SO3ObjectHasSkeleton },
2677 { "SO3ObjectIsHardwareSkinningEnabled", 1, "fun [SO3_OBJECT] I", SO3ObjectIsHardwareSkinningEnabled },
2678 { "SO3ObjectSkeletonSetBindPose", 1, "fun [SO3_OBJECT] I", SO3ObjectSkeletonSetBindPose },
2679 { "SO3ObjectSkeletonSetBlendMode", 2, "fun [SO3_OBJECT I] I", SO3ObjectSkeletonSetBlendMode },
2680 { "SO3ObjectSkeletonGetBlendMode", 1, "fun [SO3_OBJECT] I", SO3ObjectSkeletonGetBlendMode },
2681 { "SO3ObjectSetDisplaySkeleton", 2, "fun [SO3_OBJECT I] SO3_OBJECT", SO3ObjectSetDisplaySkeleton },
2682 { "SO3AnimationAddTime", 2, "fun [SO3_ANIM F] I", SO3AnimationAddTime },
2683 { "SO3AnimationDestroy", 1, "fun [SO3_ANIM] I", SO3AnimationDestroy },
2684 { "SO3AnimationGetAnimTrack", 2, "fun [SO3_ANIM I] SO3_ANIMTRACK", SO3AnimationGetAnimTrack },
2685 { "SO3AnimationSetSpeed", 2, "fun [SO3_ANIM F] I", SO3AnimationSetSpeed },
2686 { "SO3AnimationGetSpeed", 1, "fun [SO3_ANIM] F", SO3AnimationGetSpeed },
2687 { "SO3CbAnimationEnded", 3, "fun [SO3_ANIM fun [SO3_ANIM u0] u1 u0] SO3_ANIM", SO3CbAnimationEnded },
2688 { "SO3AnimationCreateAnimTrack", 3, "fun [SO3_ANIM SO3_OBJECT I] SO3_ANIMTRACK", SO3AnimationCreateAnimTrack },
2689 { "SO3AnimationSetSkipFrame", 2, "fun [SO3_ANIM I] I", SO3AnimationSetSkipFrame },
2690 { "SO3AnimationGetSkipFrame", 1, "fun [SO3_ANIM] I", SO3AnimationGetSkipFrame },
2691 { "SO3AnimTrackCreateSequenceKey", 5, "fun [SO3_ANIMTRACK SO3_ANIM F F F] I", SO3AnimTrackCreateSequenceKey },
2692 { "SO3AnimTrackGetSequenceKey", 2, "fun [SO3_ANIMTRACK I] [SO3_ANIM F F F F]", SO3AnimTrackGetSequenceKey },
2693 { "SO3AnimTrackSetSequenceKey", 5, "fun [SO3_ANIMTRACK I F F F] I", SO3AnimTrackSetSequenceKey },
2694 { "SO3AnimTrackMoveSequenceKey", 3, "fun [SO3_ANIMTRACK I I] I", SO3AnimTrackMoveSequenceKey }
2695};
2696
2697
2698int SCOLloadAnim(mmachine m, cbmachine w)
2699{
2700 ANIMATION_END_EVENT = OBJgetUserEvent();
2702 return PKhardpak2(m, "SO3Anim.pkg", sizeof(natSO3Anim) / sizeof(natSO3Anim[0]), natSO3Anim);
2703}
2704
2705
2707{
2708 return 0;
2709}
int SCOLfreeAnim()
int SCOLloadAnim(mmachine m, cbmachine w)
int ANIMATION_END_EVENT
main include
Definition SCOLAnim.cpp:51
int getAnimationCallbackEndEvent(mmachine m, SCOL_PTR_TYPE id, SCOL_PTR_TYPE param)
C function that prepares the VM for the execution of the end animation callback.
Definition SCOLAnim.cpp:64
NativeDefinition natSO3Anim[]
MMechostr(MSKDEBUG, " > Start loading Plugin SO3Engine dll\n")
SCOL_EXPORT int cbmachine w
Definition SO3SCOL.cpp:5150
SCOL_EXPORT void SCOL_PTR_TYPE param
Definition SO3SCOL.cpp:5089
int createAnimTrack(mmachine m, SAnimTrack *curAnimTrack, SAnim *curAnim)
int SO3OBJTYPE
Definition SO3SCOL.cpp:90
int SO3ANIM
Definition SO3SCOL.cpp:92
int SO3ANIMTRACK
Definition SO3SCOL.cpp:93
int SO3AnimationSetInterpMode(mmachine m)
SO3AnimationSetInterpMode : defines interpolation mode for animation mix.
Definition SCOLAnim.cpp:714
int SO3ObjectSkeletonGetBlendMode(mmachine m)
SO3ObjectSkeletonGetBlendMode : Get the blending mode for a skeleton.
int SO3AnimationOptimise(mmachine m)
SO3AnimationOptimise : Optimize a given animation.
int SO3AnimationGetTimePosition(mmachine m)
SO3AnimationGetTimePosition : Return the time position of an animation.
int SO3AnimationSetPause(mmachine m)
SO3AnimationSetPause : Play/Pause on a given animation.
Definition SCOLAnim.cpp:988
int SO3AnimationSetSkipFrame(mmachine m)
SO3AnimationSetSkipFrame : Set the animation skip frame, this manage if the animation update is based...
int SO3AnimTrackCreateSequenceKey(mmachine m)
SO3AnimTrackCreateSequenceKey : Add an animation to an animation sequence.
int SO3ObjectSkeletonSetBlendMode(mmachine m)
SO3ObjectSkeletonGetBlendMode : defines blending mode for a skeleton.
int SO3AnimationGetSkipFrame(mmachine m)
SO3AnimationGetSkipFrame : Get the animation skip frame state.
int SO3AnimTrackSetKeyTransform(mmachine m)
SO3AnimTrackSetKeyTransform : Set a transform key for a given keyframe.
Definition SCOLAnim.cpp:221
int SO3AnimationCreateAnimTrack(mmachine m)
SO3AnimationCreateAnimTrack : Create a SO3_ANIMTRACK in Scene on a given SO3_ANIM.
int SO3AnimTrackGetKeyTime(mmachine m)
SO3AnimTrackGetKeyTime : Return the time for this key frame.
Definition SCOLAnim.cpp:415
int SO3ObjectGetAnimations(mmachine m)
SO3ObjectGetAnimations : Return the list of a node animation.
int SO3AnimTrackDestroy(mmachine m)
SO3AnimTrackDestroy : Destroy an animation Track.
Definition SCOLAnim.cpp:870
int SO3ObjectGetDisplaySkeleton(mmachine m)
SO3ObjectGetDisplaySkeleton : Return the display state for a skeleton.
int SO3ObjectIsHardwareSkinningEnabled(mmachine m)
SO3ObjectIsHardwareSkinningEnabled : Return the hardware skinning enable state for an object.
int SO3AnimTrackSetSequenceKey(mmachine m)
SO3AnimTrackSetSequenceKey : Add an animation to an animation sequence.
int SO3AnimationGetName(mmachine m)
SO3AnimationGetName : Return the name of an animation.
Definition SCOLAnim.cpp:568
int SO3AnimationSetEnable(mmachine m)
SO3AnimationSetEnable : Enable/Disable a current animation.
Definition SCOLAnim.cpp:951
int SO3AnimTrackGetKeyTransform(mmachine m)
SO3AnimTrackGetKeyTransform : Return a key transform.
Definition SCOLAnim.cpp:287
int SO3ObjectSetDisplaySkeleton(mmachine m)
SO3ObjectSetDisplaySkeleton : defines display skeleton mode for an object.
int SO3AnimTrackRemoveAllKeys(mmachine m)
SO3AnimTrackRemoveAllKeys : Remove all keys from an animation track.
Definition SCOLAnim.cpp:528
int SO3AnimationGetLength(mmachine m)
SO3AnimationGetLength : Return the length of an animation.
int SO3ObjectHasSkeleton(mmachine m)
SO3ObjectHasSkeleton : Return true if an object has a skeleton otherwiser false.
int SO3AnimationGetEnable(mmachine m)
SO3AnimationGetEnable : Get the enable state for an animation.
int SO3AnimTrackOptimise(mmachine m)
SO3AnimTrackOptimise : Optimise the animation track.
Definition SCOLAnim.cpp:494
int SO3AnimationListAnimTrack(mmachine m)
SO3AnimationListAnimTrack : Return the list of animation tracks for an animation.
int SO3AnimationGetInterpMode(mmachine m)
SO3AnimationGetInterpMode : Return the current interpolation mode for this animation.
Definition SCOLAnim.cpp:793
int SO3AnimationSetTimePosition(mmachine m)
SO3AnimationSetTimePosition :defines time position for an animation.
Definition SCOLAnim.cpp:638
int SO3AnimationAddTime(mmachine m)
SO3AnimationAddTime : Add time to an animation.
int SO3AnimationSetSpeed(mmachine m)
SO3AnimationGetTimePosition : defines speed of an animation.
int SO3AnimationGetRotInterpMode(mmachine m)
SO3AnimationGetRotInterpMode : Return the current rotation interpolation mode for this animation.
Definition SCOLAnim.cpp:915
int SO3AnimationSetWeight(mmachine m)
SO3AnimationSetWeight : defines weight of a given animation.
Definition SCOLAnim.cpp:674
int SO3AnimationNumOfAnimationTrack(mmachine m)
SO3AnimationNumOfAnimationTrack : Return the number of animation track for an animation.
int SO3ObjectSkeletonSetBindPose(mmachine m)
SO3ObjectSkeletonSetBindPose : defines bind pose on a skeleton.
int SO3AnimationGetWeight(mmachine m)
SO3AnimationGetTimePosition : Return the weight of an animation.
int SO3AnimationGetLoop(mmachine m)
SO3AnimationGetLoop : Get the loop state for an animation.
int SO3AnimationGetPause(mmachine m)
SO3AnimationGetEnable : Get the pause state for an animation.
int SO3AnimationHasEnded(mmachine m)
SO3AnimationHasEnded : Return the ended state for an animation.
int SO3CbAnimationEnded(mmachine m)
SO3CbAnimationEnded - TODO not implemented - Define the callback scol had to be called when an animat...
int SO3AnimationGetSpeed(mmachine m)
SO3AnimationGetSpeed : Return the speed of an animation.
int SO3AnimationSetLength(mmachine m)
SO3AnimationSetLength : defines length of an animation.
Definition SCOLAnim.cpp:602
int SO3AnimationSetRotInterpMode(mmachine m)
SO3AnimationSetRotInterpMode : defines rotation interpolation mode for animation mix.
Definition SCOLAnim.cpp:754
int SO3AnimTrackRemoveKey(mmachine m)
SO3AnimTrackGetObject : Remove a key frame frm an animation track.
Definition SCOLAnim.cpp:452
int SO3AnimationGetAnimTrack(mmachine m)
SO3AnimationGetAnimTrack : Return an animation track from an animation.
int SO3AnimTrackGetObject(mmachine m)
SO3AnimTrackGetObject : Return the object associated with the current animation track.
Definition SCOLAnim.cpp:89
int SO3AnimTrackCreateKey(mmachine m)
SO3AnimTrackCreateKey : Create an animation track key.
Definition SCOLAnim.cpp:155
int SO3ObjectSkeletonNumOfAnimations(mmachine m)
SO3ObjectSkeletonNumOfAnimations : Return the number of animations for a skeleton.
int SO3AnimTrackGetSequenceKey(mmachine m)
SO3AnimTrackGetSequenceKey : Add an animation to an animation sequence.
int SO3AnimationSetLoop(mmachine m)
SO3AnimationSetLoop : defines loop state for this animation.
int SO3AnimTrackGetNumKeys(mmachine m)
SO3AnimTrackGetNumKeys : Return number of keys for this animation track.
Definition SCOLAnim.cpp:380
int SO3AnimationDestroy(mmachine m)
SO3AnimationDestroy : Destroy an animation.
int SO3AnimTrackMoveSequenceKey(mmachine m)
SO3AnimTrackMoveSequenceKey : Add an animation to an animation sequence.
int SO3AnimationGetType(mmachine m)
SO3AnimationGetType : Return the current type for this animation.
Definition SCOLAnim.cpp:835