source: OGRE/trunk/ogrenew/Tools/3dsmaxExport/scripts/ogre/lib/OgreSkeletonLib_addmissingkeys.ms @ 657

Revision 657, 1.7 KB checked in by mattausch, 18 years ago (diff)

added ogre dependencies and patched ogre sources

Line 
1-- add key to Position tracks.
2function addPosK obj time =
3(
4        local posContr,subPosContr,i ;
5        posContr = obj.pos.controller ;
6        subPosContr = getXYZControllers posContr ;
7        for i = 1 to 3 do
8        (
9                addNewKey subPosContr[i] time ;
10        )
11)
12
13-- add key to Rotation tracks.
14function addRotK obj time =
15(
16        local rotContr,subRotContr,i ;
17        rotContr = obj.rotation.controller ;
18        subRotContr = getXYZControllers rotContr ;
19        for i = 1 to 3 do
20        (
21                addNewKey subRotContr[i] time ;
22        )
23)
24
25
26-------------------------------------------------------------------------------
27-- add keys for example in position track when there are some in rotation track
28-------------------------------------------------------------------------------
29
30function addMissingKeys obj =
31(
32        local rotContr,posContr,nRotKeys,nPosKeys
33       
34        rotContr = obj.rotation.controller ;
35        posContr = obj.pos.controller ;
36        subRotContr = getXYZControllers rotContr ;
37        subPosContr = getXYZControllers posContr ;
38        nRotKeys = #() ;
39        nPosKeys = #() ;
40       
41        if (subRotContr[1] != undefined and subPosContr[1] != undefined) then
42        (
43                nRotKeys[1] = numKeys subRotContr[1] ;
44                nRotKeys[2] = numKeys subRotContr[2] ;
45                nRotKeys[3] = numKeys subRotContr[3] ;
46       
47                nPosKeys[1] = numKeys subPosContr[1] ;
48                nPosKeys[2] = numKeys subPosContr[2] ;
49                nPosKeys[3] = numKeys subPosContr[3] ;
50       
51       
52                for i=1 to 3 do -- i = controller index
53                (
54                        for n = 1 to numKeys subRotContr[i] do -- n = number of keys
55                        (
56                                for j=1 to n do  -- j = key index
57                                (
58                                        t = (getKey subRotContr[1] j).time ;
59                                        addRotK obj t ;
60                                        addPosK obj t ;
61                                )
62                        )
63               
64                        for n = 1 to numKeys subPosContr[i] do -- n = number of keys
65                        (
66                                for j=1 to n do  -- j = key index
67                                (
68                                        t = (getKey subPosContr[1] j).time ;
69                                        addRotK obj t ;
70                                        addPosK obj t ;
71                                )
72                        )       
73                )
74        )
75)
Note: See TracBrowser for help on using the repository browser.