XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Wed May 23, 2018 11:45 am

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Search Perfect world animation(stck)
PostPosted: Tue Aug 12, 2014 6:40 am 
Offline
ultra-n00b

Joined: Wed Jul 09, 2014 8:39 pm
Posts: 5
Has thanked: 5 times
Have thanks: 0 time
Hi

I am looking for a script to 3ds max to import animations (.stck) of Perfect World


stck.h

Code:
#pragma once

using namespace System::IO;
using namespace System::Text;

public ref struct Point3f
{
        float X;
        float Y;
        float Z;
};

public ref struct Point4f
{
        float X;
        float Y;
        float Z;
        float W;
};

public ref struct KeyPointController
{
        int StartTime;
        int EndTime;
        int StartKeyPointIndex;
        int EndKeyPointIndex;
};

public ref struct AnimatedJointKeyFrames
{
        public: int JointID;
        public: int unknown1;
        public: array<Point3f^>^ PositionKeyPoints; // vectors
        public: array<KeyPointController^>^ PositionKeyPointControllers;
        public: int unknown2;
        public: array<Point4f^>^ OrientationKeyPoints; // quaternions
        public: array<KeyPointController^>^ OrientationKeyPointControllers;
};

public ref class STCK
{
        public: STCK()
        {
        }

        protected: ~STCK()
        {
        }

        public: array<unsigned char>^ Signature; // 8 byte GBK
        public: int Version;
        public: int unknown1;
        public: int unknown2;
        public: int unknown3;
        public: array<AnimatedJointKeyFrames^>^ JointKeyFrames;

        // only for loading v1
        public: void Load(String^ File)
        {
                FileStream^ fs = File::OpenRead(File);
                BinaryReader^ br = gcnew BinaryReader(fs);

                Signature = br->ReadBytes(8);
                Version = br->ReadInt32();
                int AnimatedJointCount = br->ReadInt32();
                unknown1 = br->ReadInt32();
                unknown2 = br->ReadInt32();
                unknown3 = br->ReadInt32();

                JointKeyFrames = gcnew array<AnimatedJointKeyFrames^>(AnimatedJointCount);
                for(int b=0; b<JointKeyFrames->Length; b++)
                {
                        JointKeyFrames[b] = gcnew AnimatedJointKeyFrames();
                        JointKeyFrames[b]->JointID = br->ReadInt32();
                        int PositionKeyPointCount = br->ReadInt32();
                        int Properties1KeyPointCount = br->ReadInt32();
                        JointKeyFrames[b]->unknown1 = br->ReadInt32();
                        JointKeyFrames[b]->PositionKeyPoints = gcnew array<Point3f^>(PositionKeyPointCount);
                        for(int i=0; i<JointKeyFrames[b]->PositionKeyPoints->Length; i++)
                        {
                                JointKeyFrames[b]->PositionKeyPoints[i] = gcnew Point3f();
                                JointKeyFrames[b]->PositionKeyPoints[i]->X = br->ReadSingle();
                                JointKeyFrames[b]->PositionKeyPoints[i]->Y = br->ReadSingle();
                                JointKeyFrames[b]->PositionKeyPoints[i]->Z = br->ReadSingle();
                        }
                        JointKeyFrames[b]->PositionKeyPointControllers = gcnew array<KeyPointController^>(Properties1KeyPointCount);
                        for(int i=0; i<JointKeyFrames[b]->PositionKeyPointControllers->Length; i++)
                        {
                                JointKeyFrames[b]->PositionKeyPointControllers[i] = gcnew KeyPointController();
                                JointKeyFrames[b]->PositionKeyPointControllers[i]->StartTime = br->ReadInt32();
                                JointKeyFrames[b]->PositionKeyPointControllers[i]->EndTime = br->ReadInt32();
                                JointKeyFrames[b]->PositionKeyPointControllers[i]->StartKeyPointIndex = br->ReadInt32();
                                JointKeyFrames[b]->PositionKeyPointControllers[i]->EndKeyPointIndex = br->ReadInt32();
                        }
                        int OrientationKeyPointCount = br->ReadInt32();
                        int Properties2KeyPointCount = br->ReadInt32();
                        JointKeyFrames[b]->unknown2 = br->ReadInt32();
                        JointKeyFrames[b]->OrientationKeyPoints = gcnew array<Point4f^>(OrientationKeyPointCount);
                        for(int i=0; i<JointKeyFrames[b]->OrientationKeyPoints->Length; i++)
                        {
                                JointKeyFrames[b]->OrientationKeyPoints[i] = gcnew Point4f();
                                JointKeyFrames[b]->OrientationKeyPoints[i]->X = br->ReadSingle();
                                JointKeyFrames[b]->OrientationKeyPoints[i]->Y = br->ReadSingle();
                                JointKeyFrames[b]->OrientationKeyPoints[i]->Z = br->ReadSingle();
                                JointKeyFrames[b]->OrientationKeyPoints[i]->W = br->ReadSingle();
                        }
                        JointKeyFrames[b]->OrientationKeyPointControllers = gcnew array<KeyPointController^>(Properties2KeyPointCount);
                        for(int i=0; i<JointKeyFrames[b]->OrientationKeyPointControllers->Length; i++)
                        {
                                JointKeyFrames[b]->OrientationKeyPointControllers[i] = gcnew KeyPointController();
                                JointKeyFrames[b]->OrientationKeyPointControllers[i]->StartTime = br->ReadInt32();
                                JointKeyFrames[b]->OrientationKeyPointControllers[i]->EndTime = br->ReadInt32();
                                JointKeyFrames[b]->OrientationKeyPointControllers[i]->StartKeyPointIndex = br->ReadInt32();
                                JointKeyFrames[b]->OrientationKeyPointControllers[i]->EndKeyPointIndex = br->ReadInt32();
                        }
                }

                br->Close();
                fs->Close();
        }

        // only for saving v1
        public: void Save(String^ File)
        {
                FileStream^ fs = gcnew FileStream(File, FileMode::Create, FileAccess::Write);
                BinaryWriter^ bw = gcnew BinaryWriter(fs);

                bw->Write(Signature);
                bw->Write(Version);
                bw->Write(JointKeyFrames->Length);
                bw->Write(unknown1);
                bw->Write(unknown2);
                bw->Write(unknown3);

                for(int b=0; b<JointKeyFrames->Length; b++)
                {
                        bw->Write(JointKeyFrames[b]->JointID);
                        bw->Write(JointKeyFrames[b]->PositionKeyPoints->Length);
                        bw->Write(JointKeyFrames[b]->PositionKeyPointControllers->Length);
                        bw->Write(JointKeyFrames[b]->unknown1);
                        for(int i=0; i<JointKeyFrames[b]->PositionKeyPoints->Length; i++)
                        {
                                bw->Write(JointKeyFrames[b]->PositionKeyPoints[i]->X);
                                bw->Write(JointKeyFrames[b]->PositionKeyPoints[i]->Y);
                                bw->Write(JointKeyFrames[b]->PositionKeyPoints[i]->Z);
                        }
                        for(int i=0; i<JointKeyFrames[b]->PositionKeyPointControllers->Length; i++)
                        {
                                bw->Write(JointKeyFrames[b]->PositionKeyPointControllers[i]->StartTime);
                                bw->Write(JointKeyFrames[b]->PositionKeyPointControllers[i]->EndTime);
                                bw->Write(JointKeyFrames[b]->PositionKeyPointControllers[i]->StartKeyPointIndex);
                                bw->Write(JointKeyFrames[b]->PositionKeyPointControllers[i]->EndKeyPointIndex);
                        }
                        bw->Write(JointKeyFrames[b]->OrientationKeyPoints->Length);
                        bw->Write(JointKeyFrames[b]->OrientationKeyPointControllers->Length);
                        bw->Write(JointKeyFrames[b]->unknown2);
                        for(int i=0; i<JointKeyFrames[b]->OrientationKeyPoints->Length; i++)
                        {
                                bw->Write(JointKeyFrames[b]->OrientationKeyPoints[i]->X);
                                bw->Write(JointKeyFrames[b]->OrientationKeyPoints[i]->Y);
                                bw->Write(JointKeyFrames[b]->OrientationKeyPoints[i]->Z);
                                bw->Write(JointKeyFrames[b]->OrientationKeyPoints[i]->W);
                        }
                        for(int i=0; i<JointKeyFrames[b]->OrientationKeyPointControllers->Length; i++)
                        {
                                bw->Write(JointKeyFrames[b]->OrientationKeyPointControllers[i]->StartTime);
                                bw->Write(JointKeyFrames[b]->OrientationKeyPointControllers[i]->EndTime);
                                bw->Write(JointKeyFrames[b]->OrientationKeyPointControllers[i]->StartKeyPointIndex);
                                bw->Write(JointKeyFrames[b]->OrientationKeyPointControllers[i]->EndKeyPointIndex);
                        }
                }

                bw->Close();
                fs->Close();
        }
};


sample monster:
https://mega.co.nz/#!bAhxkLCQ!Op3VxnMyP ... 5CBH-3xjeQ


Top
 Profile  
 
 Post subject: Re: Search Perfect world animation(stck)
PostPosted: Sat Aug 16, 2014 2:15 am 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2250
Location: Nexus, searching for Jim Kirk
Has thanked: 501 times
Have thanks: 1163 times
this is the boss clenching his left fist but the last frames are looking a little bit weird.
Also I've to get rid of the hardcoded offsets I used.


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
"you can't always get things served on a silver tray"
extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip

"We are Microsoft. You will be assimilated. Resistance is Futile."


Top
 Profile  
 
 Post subject: Re: Search Perfect world animation(stck)
PostPosted: Sat Aug 16, 2014 8:32 am 
Offline
ultra-n00b

Joined: Wed Jul 09, 2014 8:39 pm
Posts: 5
Has thanked: 5 times
Have thanks: 0 time
can help you with this program converts stck to txt

https://mega.co.nz/#!3E4SnQRJ!YlP13rkoI ... KiZX0GZNJM

Here is a easy model

https://mega.co.nz/#!CVIhnAaK!6zMi0arlJ ... jVSj_EgyKw


Top
 Profile  
 
 Post subject: Re: Search Perfect world animation(stck)
PostPosted: Sat Aug 16, 2014 9:46 am 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2250
Location: Nexus, searching for Jim Kirk
Has thanked: 501 times
Have thanks: 1163 times
thx, but that's too late. :D As you can imagine I wrote a program on my own to analyse the .stck files.
The output is nearly the same:

1. c: 3 / 3 = 1
0.000000 0.000000 -0.000000
2. 38: 4 / 4 = 1
0.500000 0.500000 0.500000 0.500000
3. 64: 18 /3 = 6
0.181932 -0.317132 0.125416
0.182031 -0.317132 0.125416
0.182088 -0.317132 0.125416
0.182080 -0.317132 0.125416
0.182070 -0.317132 0.125416
0.182057 -0.317132 0.125416
4. cc: 176 / 4 = 44
0.690028 0.721725 0.038112 -0.039013
0.690290 0.721993 0.033025 -0.033692
0.690543 0.722250 0.027236 -0.027637
...

But you might translate some text for me? (used the stck with a file size of 40336 bytes from your previous sample)
(Guess ¹Ø¼üÖ¡Êý: 1 means frame count: 1 for example.)

ÎļþÍ·:MOXBKCTS
°æ±¾:1
¹Ç÷ÀÊý66
δ֪£º¡¾0¡¿¡¾43¡¿¡¾15¡¿
===========<1oh,c>=============
¹Ç÷ÀË÷Òý: 0
¹Ø¼üÖ¡Êý: 1
δ֪: 1 15
A-0 <0.000000 0.000000 -0.000000>
δ֪:0 2866 0
-------<4oh,4>-------
δ֪Ë÷Òý: 0
δ֪Ë÷ÒýÊý: 1
δ֪: 1 15
U-0: <0.500000 0.500000 0.500000 0.500000>
δ֪:0 2866 0
Áã:0
===========<7oh,4>=============
¹Ç÷ÀË÷Òý: 1
¹Ø¼üÖ¡Êý: 6
δ֪: 1 15
A-0 <0.181932 -0.317132 0.125416>
A-1 <0.182031 -0.317132 0.125416>
A-2 <0.182088 -0.317132 0.125416>
A-3 <0.182080 -0.317132 0.125416>
A-4 <0.182070 -0.317132 0.125416>
A-5 <0.182057 -0.317132 0.125416>
δ֪:333 666 0
-------<doh,8>-------
δ֪Ë÷Òý: 5
δ֪Ë÷ÒýÊý: 44
δ֪: 1 15
U-0: <0.690028 0.721725 0.038112 -0.039013>
U-1: <0.690290 0.721993 0.033025 -0.033692>
U-2: <0.690543 0.722250 0.027236 -0.027637>
...

_________________
"you can't always get things served on a silver tray"
extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip

"We are Microsoft. You will be assimilated. Resistance is Futile."


Top
 Profile  
 
 Post subject: Re: Search Perfect world animation(stck)
PostPosted: Tue Sep 09, 2014 7:04 pm 
Offline
double-veteran
double-veteran
User avatar

Joined: Sun Jul 05, 2009 2:03 am
Posts: 640
Has thanked: 70 times
Have thanks: 35 times
well this topic is interesting, here I checking some stcks and well, after see that, here we are, here translated file.

Quote:
Header: MOXBKCTS
Version: 1
Number of bones 86
Unknown: [0] [52] [15]
=========== <1oh, c> =============
Bones Index: 0
Key Frames: 1
Unknown: 115
A-0 <0.000014 -0.000099 0.000000>
Unknown: 034,660
------- <4oh, 4> -------
Unknown index: 0
Unknown index: 1
Unknown: 115
U-0: <0.497884 0.502109 0.502107 0.497882>
Unknown: 034,660
Zero: 0
=========== <7oh, 4> =============
Bones index: 1
Key Frames: 53
Unknown: 115
A-0 <2.497315 0.194873 0.013372>
A-1 <2.505276 0.194873 0.013516>
A-2 <2.512207 0.194873 0.013791>
A-3 <2.517823 0.194873 0.014172>
A-4 <2.522053 0.194873 0.014636>
A-5 <2.525032 0.194873 0.015163>
A-6 <2.527008 0.194873 0.015733>
A-7 <2.528081 0.194873 0.016324>
A-8 <2.528323 0.194873 0.016916>
A-9 <2.527961 0.194873 0.017488>
A-10 <2.527685 0.194874 0.018025>
A-11 <2.528600 0.194874 0.018512>
A-12 <2.530873 0.194874 0.018931>
A-13 <2.534093 0.194874 0.019255>
A-14 <2.538535 0.194874 0.019464>
A-15 <2.544399 0.194874 0.019540>
A-16 <2.551817 0.194874 0.019459>
A-17 <2.560909 0.194874 0.019204>
A-18 <2.572472 0.194874 0.018755>
A-19 <2.586883 0.194874 0.018099>
A-20 <2.604227 0.194874 0.017206>
A-21 <2.623814 0.194874 0.016061>
A-22 <2.649481 0.194874 0.014658>
A-23 <2.682458 0.194873 -0.011544>
A-24 <2.720797 0.194873 -0.027295>
A-25 <2.764810 0.194874 0.019332>
A-26 <2.814255 0.194874 0.083223>
A-27 <2.865808 0.194874 0.114512>
A-28 <2.919127 0.194874 0.119755>
A-29 <2.970982 0.194874 0.108651>
A-30 <3.018724 0.194874 0.084958>
A-31 <3.060284 0.194874 0.053031>
A-32 <3.094174 0.194874 0.018685>
A-33 <3.118690 0.194873 -0.011566>
A-34 <3.132865 0.194873 -0.031591>
A-35 <3.134097 0.194873 -0.037696>
A-36 <3.114017 0.194873 -0.040297>
A-37 <3.075623 0.194873 -0.041629>
A-38 <3.023687 0.194873 -0.041806>
A-39 <2.962497 0.194873 -0.040927>
A-40 <2.896643 0.194873 -0.039082>
A-41 <2.831235 0.194873 -0.036383>
A-42 <2.770960 0.194873 -0.032937>
A-43 <2.720150 0.194873 -0.028820>
A-44 <2.682165 0.194873 -0.024137>
A-45 <2.650961 0.194873 -0.019112>
A-46 <2.624242 0.194873 -0.013904>
A-47 <2.600760 0.194873 -0.008611>
A-48 <2.579709 0.194873 -0.003430>
A-49 <2.560000 0.194873 0.001492>
A-50 <2.540416 0.194873 0.006038>
A-51 <2.519846 0.194873 0.010056>
A-52 <2.497315 0.194873 0.013372>
Unknown: 034,660
------- <30oh, c> -------
Unknown Index: 52
Unknown Index: 53
Unknown: 115
U-0: <0.656047 0.748033 0.024996 0.097083>
U-1: <0.667582 0.738193 -0.021063 0.094667>
U-2: <0.679411 0.724590 -0.073075 0.089612>
U-3: <0.689160 0.708774 -0.124867 0.084292>
U-4: <0.695452 0.693345 -0.170370 0.081198>
U-5: <0.697760 0.681727 -0.203743 0.082881>
U-6: <0.695913 0.677620 -0.219312 0.091862>
U-7: <0.687626 0.687401 -0.202439 0.116913>
U-8: <0.671177 0.707830 -0.154792 0.156644>
U-9: <0.648191 0.728911 -0.095771 0.198407>
U-10: <0.624455 0.744851 -0.045944 0.230528>
U-11: <0.609585 0.754186 -0.026289 0.242731>
U-12: <0.606760 0.759817 -0.039819 0.230075>
U-13: <0.609775 0.763640 -0.071330 0.199850>
U-14: <0.614843 0.763616 -0.114191 0.160682>
U-15: <0.619013 0.758880 -0.161709 0.121549>
U-16: <0.620792 0.750462 -0.207360 0.091791>
U-17: <0.619978 0.741047 -0.244832 0.080835>
U-18: <0.618317 0.731438 -0.270067 0.098721>
U-19: <0.615945 0.719220 -0.288474 0.141833>
U-20: <0.610052 0.701686 -0.309266 0.199569>
U-21: <0.598232 0.676856 -0.341169 0.259977>
U-22: <0.546728 0.600511 -0.449412 0.372162>
U-23: <-0.443953 -0.450371 0.599508 -0.490572>
U-24: <0.292692 0.253815 -0.715348 0.581538>
U-25: <0.099440 0.032918 -0.764452 0.636114>
U-26: <-0.110365 -0.190887 -0.741146 0.634101>
U-27: <-0.295222 -0.375874 -0.665635 0.573143>
U-28: <0.453012 0.517124 0.555258 -0.468030>
U-29: <0.558810 0.617899 0.427564 -0.350886>
U-30: <0.623000 0.694262 0.280482 -0.226279>
U-31: <0.655981 0.741108 0.113263 -0.087289>
U-32: <0.653522 0.753399 -0.053203 0.049689>
U-33: <0.623977 0.738590 -0.194299 0.165488>
U-34: <0.585526 0.714308 -0.292904 0.247246>
U-35: <0.556144 0.698687 -0.343277 0.291034>
U-36: <0.531749 0.693178 -0.370147 0.315814>
U-37: <0.511858 0.696469 -0.381391 0.327831>
U-38: <0.496868 0.706937 -0.380226 0.329834>
U-39: <0.486458 0.722398 -0.369344 0.324169>
U-40: <0.480180 0.740342 -0.351226 0.312988>
U-41: <0.477577 0.758138 -0.328594 0.298618>
U-42: <0.478271 0.773535 -0.304228 0.283455>
U-43: <0.482117 0.784732 -0.280889 0.269925>
U-44: <0.489730 0.790718 -0.260051 0.259427>
U-45: <0.503846 0.794040 -0.234537 0.246235>
U-46: <0.523228 0.794912 -0.203898 0.229723>
U-47: <0.546220 0.793027 -0.168899 0.210298>
U-48: <0.570826 0.788263 -0.130999 0.188778>
U-49: <0.595378 0.780790 -0.091459 0.165914>
U-50: <0.618569 0.771015 -0.051338 0.142383>
U-51: <0.639157 0.759707 -0.011987 0.119078>
U-52: <0.656047 0.748033 0.024996 0.097083>
Unknown: 034,660
Zero: 52


Top
 Profile  
 
 Post subject: Re: Search Perfect world animation(stck)
PostPosted: Wed Sep 10, 2014 2:05 am 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2250
Location: Nexus, searching for Jim Kirk
Has thanked: 501 times
Have thanks: 1163 times
thx for translating!
Meanwhile I made some progress, here's frames 0, 3, 5 and 12 of the boss.
At frame 12 he's crossing his arms like a snakeman and I'm not sure whether that's the way he's behaving ingame
or it's just a fault in the script.

Will have to check it with the bloatfly sample.



Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
"you can't always get things served on a silver tray"
extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip

"We are Microsoft. You will be assimilated. Resistance is Futile."


Top
 Profile  
 
 Post subject: Re: Search Perfect world animation(stck)
PostPosted: Wed Sep 10, 2014 11:54 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2250
Location: Nexus, searching for Jim Kirk
Has thanked: 501 times
Have thanks: 1163 times
script seems to work for simple animations now:


Before you can view the animation you'll have to load a model (mesh, skeleton).
There's a script from zaramot here for ski and bon files:
viewtopic.php?f=16&p=94870#p94870

Then you can load the animation file (.stck)
Code:
/*
   Import PerfectWorld .stck Animation
   basic structure borrowed from Taylor Mouse
   8-16-2014
*/

/************************************************************************************************
STRUCTS
************************************************************************************************/
struct D3Bone ( ID, Name, TheBone )
struct TranslationAnimation ( BoneId, KeyFrame, Position )
struct RotationAnimation (BoneId, KeyFrame, Quaternion  )
struct ScaleAnimation (BoneId, KeyFrame, Scaling )

allBones = #()
bone_names = #()

fn GetBoneNames = (   -- from steev, 10-28-2008
    max modify mode --important! the below won't work unless you're in the modify tab
   --print geometry
    for n in geometry do
    (
        select n -- this selects the current object in the array
        if n.modifiers != undefined do
        (
            if n.modifiers[#Skin] != undefined do
            (
                sk = n.modifiers[#Skin]
                modPanel.setCurrentObject sk -- this selects the skin modifier
                numBones = skinops.getnumberbones sk
                if (numBones>0) then print ("bones found:")
                for i = 1 to numBones do
                (
                    bnName = skinops.getbonename sk i 1
               append bone_names bnName
                    format "% %'\n" i bnName               
                )
                for i = 1 to numBones do
                (
         b = D3Bone()
         b.ID = i            --> for reference only
         b.Name = bone_names[i]         -- name of the bone
         --format "%: %\n" i b.Name
         b.TheBone = GetNodeByName b.Name   -- find the bone in the scene
         append allBones b               
      )
      -- print allBones
            )
        )
    )
   return numBones  -- returns 'undefined' if no skeleton loaded!
)


/************************************************************************************************
   MAIN function
************************************************************************************************/
function ReadAniFile fName startFrame =
(
    startingFrame = 0
    startingFrame = startFrame
      
    format "-- Start reading PerfectWorld ANIMATION file --"

    stream = fOpen fname "rb"   -- Open the file for reading

    MOXB = readlong stream
    if (MOXB != 0x42584F4D) then
       throw "This doesn't seem to be a PerfectWorld file!"
    KCTS = readlong stream
    if (KCTS != 0x5354434B) then
       throw "This doesn't seem to be a PerfectWorld anim file!"
    tmp =  readlong stream
    nAllBones =  readlong stream      -- notinuse: number of all bones, 66 for Boss, but only 53 are used for his upper body
   --nBones = 53   -- Boss
   --nBones = 31   -- BloatFly
   
    /* Frame data*/
    Frame_cnt = #()
    Frame_offs = #()
    allTranslations = #()
    allRotations = #()

    for i=1 to nBones do   /* handle BONES */
    (
       tmp =  readlong stream
       unk =  readlong stream ; print unk
       tmp =  readlong stream ; tmp =  readlong stream
       if (i != 1) then (
          ID =  readlong stream ; -- format "ID %\n" ID
       )      
       Frame_cnt = readlong stream
       tmp =  readlong stream ; unk =  readlong stream ; format "% %\n" tmp unk  -- 01 000000 0F 000000

       -- Read the translation data structure
        --print ("@ trans: 0x"+ bit.intAsHex(ftell stream) as string)      
       for fd=1 to Frame_cnt do
       (
          tran = TranslationAnimation()
          tran.BoneId = i
          tran.KeyFrame = i*200-10      -- 200 seems to work good for the boss
          tran.Position = [ReadFloat stream, ReadFloat stream, ReadFloat stream]

          append allTranslations tran
       )

       tmp =  readlong stream
       unk =  readlong stream ; print unk
       tmp =  readlong stream ; tmp =  readlong stream
       Frame_cnt = readlong stream
       tmp =  readlong stream ; unk =  readlong stream ; format "% %\n" tmp unk  -- 01 000000 0F 000000
   
       /* ROTATION */
       -- Read the rotation data structure
        --print ("@ rot: 0x"+ bit.intAsHex(ftell stream) as string)      
       for fd=1 to Frame_cnt do
       (
          rot = RotationAnimation()
          rot.BoneId = i
          rot.KeyFrame = i*200-10
          x = ReadFloat stream
          y = ReadFloat stream
          z = ReadFloat stream
          w = ReadFloat stream
         
          rot.Quaternion = quat x y z w
   
          append allRotations rot
       )

    )
    --print allTranslations
    --print allRotations

   --echo "-- DONE READING ANI FILE --\n"
   --echo "-- APPLYING ANIMATION TO THE BONES --\n"
   
   --Apply the Rotation
   prevQ = quat 1 -- set a starting rotation
   prevB = 1
   for i=1 to allRotations.count do
   (
      b = allBones[allRotations[i].BoneId].TheBone
      if(b == undefined) then continue
      
      t = allRotations[i].KeyFrame + startingFrame
      q = allRotations[i].Quaternion

      with animate on
      (
         at time t (
            b.assumeskinpose()
            local mtrx = matrix3 1
            rotate mtrx (inverse q)
            mtrx.row4 = b.pos
            if b.parent != undefined then(
               mtrx = mtrx * b.parent.transform
            )
            b.transform = mtrx
            deleteKey b.position.controller (numKeys b.position.controller)
            deleteKey b.scale.controller (numKeys b.scale.controller)
         )
      )
      
   )

   -- Apply the Translation
   for i=1 to allTranslations.count do
   (
      b = allBones[allTranslations[i].BoneId].TheBone
      t = allTranslations[i].KeyFrame + startingFrame
      pos = allTranslations[i].Position

      with animate on
         at time t
            in coordsys parent b.position = pos
   )
   
   fClose stream
)

-- entry point --

ClearListener()
nBones = GetBoneNames()
if (nBones == undefined) then (
   messagebox "load ski and bon file before! (mesh and skeleton)"
   throw "load ski and bon file before! (mesh and skeleton)"
)
else format "nBones: %\n" nBones

fname = getOpenFileName \
caption:"3D Model" \
types:"3D Model (*.*)|*.stck" \
historyCategory:"3D Model"

ReadAniFile fName 10
max create mode
Didn't have a walking anim sample - so this has to be tested.
Don't blame me, it's my first animation max script. I took the basic structure from one of Taylormouse's scripts.

You'll also notify that I used fn GetBoneNames (from steev which I modified).
Would have made more sense to get the bone's names directly from the bon file but that file is used
by zaramot's script, too. So I got the names from the scene.


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
"you can't always get things served on a silver tray"
extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip

"We are Microsoft. You will be assimilated. Resistance is Futile."


Top
 Profile  
 
 Post subject: Re: Search Perfect world animation(stck)
PostPosted: Thu Sep 11, 2014 2:12 am 
Offline
double-veteran
double-veteran
User avatar

Joined: Sun Jul 05, 2009 2:03 am
Posts: 640
Has thanked: 70 times
Have thanks: 35 times
well many thanks for support it, thats wonderful, after download I go to test it and no work, the animation loaded but anyway it show like skin fucked or something like that, here I upload a video showing it, if you can take a look, grateful.

http://www.youtube.com/watch?v=V5HYOLzfsyE


Top
 Profile  
 
 Post subject: Re: Search Perfect world animation(stck)
PostPosted: Thu Sep 11, 2014 6:54 am 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2250
Location: Nexus, searching for Jim Kirk
Has thanked: 501 times
Have thanks: 1163 times
Is that 3dsmax 2013? They changed the sorting of the bone names for example. Thus many scripts for max 2009 don't work correctly.
Otherwise I would need the ski, bon and the stck file (3 or 4 other stcks would be nice).

_________________
"you can't always get things served on a silver tray"
extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip

"We are Microsoft. You will be assimilated. Resistance is Futile."


Top
 Profile  
 
 Post subject: Re: Search Perfect world animation(stck)
PostPosted: Fri Sep 12, 2014 2:32 am 
Offline
double-veteran
double-veteran
User avatar

Joined: Sun Jul 05, 2009 2:03 am
Posts: 640
Has thanked: 70 times
Have thanks: 35 times
shakotay2 wrote:
Is that 3dsmax 2013? They changed the sorting of the bone names for example. Thus many scripts for max 2009 don't work correctly.
Otherwise I would need the ski, bon and the stck file (3 or 4 other stcks would be nice).
yeah you right is max2013, I have 9 and 2013, but well in 2 max got same error, so well here samples mate, many thanks for all.

http://puu.sh/bvntf/5bd5a15464.7z


Top
 Profile  
 
 Post subject: Re: Search Perfect world animation(stck)
PostPosted: Fri Sep 12, 2014 11:34 am 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2250
Location: Nexus, searching for Jim Kirk
Has thanked: 501 times
Have thanks: 1163 times
I got an ogre whose right shoulder plate is rotating. That's not the way it's meant to be, I'm pretty sure. :D

Sadly I don't have any idea about the cause atm.

Interestingly nothing changes when
for i=1 to allRotations.count do

is replaced by
for i=1 to 1 do

edit: upps, seems the animation buffer from previous run wasn't cleared

_________________
"you can't always get things served on a silver tray"
extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip

"We are Microsoft. You will be assimilated. Resistance is Futile."


Top
 Profile  
 
 Post subject: Re: Search Perfect world animation(stck)
PostPosted: Thu Oct 02, 2014 10:40 pm 
Offline
double-veteran
double-veteran
User avatar

Joined: Sun Jul 05, 2009 2:03 am
Posts: 640
Has thanked: 70 times
Have thanks: 35 times
hello and sorry for become again, today I install perfecto world and don't have chance to got it working? don't know why? I try all methods and no work, I load model + bones and when press in script it try load animation for default but won't open a pop up to search for wich animation we can open and I got erro.

-- Error occurred in anonymous codeblock; filename: C:\Users\GAMEMASTER\AppData\Local\Autodesk\3dsMax\2013 - 64bit\ENU\usermacros\DragAndDrop-Macro2.mcr; position: 6428; line: 192
-- Frame:
-- fname: undefined
>> MAXScript MacroScript Error Exception:
-- Runtime error: load ski and bon file before! (mesh and skeleton) <<

it say load first ski and bon but I have loaded there, and anyway always give same error.


Top
 Profile  
 
 Post subject: Re: Search Perfect world animation(stck)
PostPosted: Fri Oct 03, 2014 1:24 am 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2250
Location: Nexus, searching for Jim Kirk
Has thanked: 501 times
Have thanks: 1163 times
did you try using max2009?

(what's this DragAndDrop-Macro2.mcr script? It's not delivered with max2013, is it?)

_________________
"you can't always get things served on a silver tray"
extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip

"We are Microsoft. You will be assimilated. Resistance is Futile."


Top
 Profile  
 
 Post subject: Re: Search Perfect world animation(stck)
PostPosted: Fri Oct 03, 2014 10:40 pm 
Offline
double-veteran
double-veteran
User avatar

Joined: Sun Jul 05, 2009 2:03 am
Posts: 640
Has thanked: 70 times
Have thanks: 35 times
shakotay2 wrote:
did you try using max2009?

(what's this DragAndDrop-Macro2.mcr script? It's not delivered with max2013, is it?)
no I don't try in max 2009 because I don't have, I try in Max9, 2010 and 2013, and this issue about dragn you mean is toolbar script, anyway I try using this shortcut in toolbar or too runing script but anyway same error, so no idea whats going on here, always give same error.


Top
 Profile  
 
 Post subject: Re: Search Perfect world animation(stck)
PostPosted: Sat Oct 04, 2014 4:32 am 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2250
Location: Nexus, searching for Jim Kirk
Has thanked: 501 times
Have thanks: 1163 times
are you still able to load the ogre animation or does that fail, too?

_________________
"you can't always get things served on a silver tray"
extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip

"We are Microsoft. You will be assimilated. Resistance is Futile."


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: Google [Bot], rlarhk123, santax and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group