Important information: this site is currently scheduled to go offline indefinitely by end of the year.

Importing .STCK animation - We need your help!

Post questions about game models here, or help out others!
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4291
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1151 times
Been thanked: 2244 times

Re: Importing .STCK animation - We need your help!

Post by shakotay2 »

well, thank you, too. Seems it's similar with Perfect World's .stck files.
I did care for the "simple" ones only.

Maybe you can find a Saint Seiya .stck where at least the frame counts for all odd blocknumbers
(or all even numbers) are constant (and != 1)?
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
User avatar
CriticalError
double-veteran
double-veteran
Posts: 678
Joined: Sun Jul 05, 2009 2:03 am
Has thanked: 104 times
Been thanked: 41 times

Re: Importing .STCK animation - We need your help!

Post by CriticalError »

here a small tip of stck structure.

文件头:MOXBKCTS
版本:2
骨骼数41
未知:【0】【150】【30】
===========<1oh,c>=============
骨骼索引: 0
关键帧数: 1
未知: 1 30
A-0 <0.000000 0.000000 0.000000>
未知:5000 1 65536
-------<4oh,4>-------
未知索引: 65536
未知索引数: 1966080
未知: 65536 65536
U-0: <0.000000 -1.#QNAN0 0.000000 0.000000>
U-1: <0.000000 0.000000 0.000000 0.000000>
U-2: <0.000000 1.124843 0.957760 -0.000000>
U-3: <1.124745 0.957871 -0.000000 1.124457>
U-4: <0.958196 -0.000000 1.123989 0.958723>
U-5: <-0.000000 1.123354 0.959440 -0.000000>
U-6: <1.122561 0.960335 -0.000000 1.121622>
U-7: <0.961394 -0.000000 1.120547 0.962607>
U-8: <-0.000000 1.119347 0.963960 -0.000000>
U-9: <1.118034 0.965442 -0.000000 1.116617>
U-10: <0.967040 -0.000000 1.115108 0.968742>
U-11: <-0.000000 1.113518 0.970536 -0.000000>
U-12: <1.111857 0.972409 -0.000000 1.110137>
U-13: <0.974350 -0.000000 1.108368 0.976346>
U-14: <-0.000000 1.106560 0.978385 -0.000000>
U-15: <1.104737 0.980442 -0.000000 1.102875>
U-16: <0.982543 -0.000000 1.101030 0.984624>
U-17: <-0.000000 1.099168 0.986725 -0.000000>
U-18: <1.097344 0.988782 -0.000000 1.095525>
U-19: <0.990834 -0.000000 1.093766 0.992819>
U-20: <-0.000000 1.092034 0.994772 -0.000000>
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4291
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1151 times
Been thanked: 2244 times

Re: Importing .STCK animation - We need your help!

Post by shakotay2 »

where is the news compared to this thread? viewtopic.php?f=16&t=11776&hilit=perfect+world+.stck

btw: one difference between the "none constant" .stck of Perfect World and Saint Seiya are these indices:
Running_stck_indices.jpg
In run.stck from Natasha I've found a sequence which fulfills the needs I asked for above:
95. 1
96. 23
97. 1
98. 23
99. 1
100. 23
101. 1
102. 23
103. 1
104. 23
105. 1
106. 23
107. 1
108. 23
109. 1
110. 23
111. 1
112. 23
113. 1
114. 23
115. 1
116. 23
117. 1
118. 23
119. 1
120. 23
121. 1
122. 23
123. 1
124. 23
125. 1
126. 23

But it's a little bit too short.
You do not have the required permissions to view the files attached to this post.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
asdasd123
beginner
Posts: 22
Joined: Sun Jun 14, 2015 4:07 pm
Has thanked: 13 times
Been thanked: 3 times

Re: Importing .STCK animation - We need your help!

Post by asdasd123 »

shakotay2 wrote:But it's a little bit too short.
I haven't found anything too big yet, but take a look at those animations from Mouses, specially his Repulse.stck.

17 seems to repeat twice, don't know how much that meatters:

18. 17
19. 1
20. 17
21. 1
22. 17
23. 1
24. 17
25. 1
26. 17
27. 1
28. 17
29. 1
30. 17
31. 1
32. 17
33. 1
34. 17
35. 1
36. 17
37. 1
38. 17
39. 1
40. 17
41. 1
42. 17
43. 1
44. 1
45. 17
46. 17

47. 1
48. 17
49. 1
50. 17
51. 1
52. 17
53. 1
54. 17
55. 1
56. 17
57. 1
58. 17
59. 1
60. 17
61. 1
62. 17
63. 1
64. 17
65. 1
66. 17
67. 1
68. 17
69. 1
70. 17
71. 1
72. 1
73. 17
74. 17

75. 1
76. 17
77. 1
78. 17
79. 1

http://www.mediafire.com/download/6ydqt ... Mouses.rar --- 337 kb
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4291
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1151 times
Been thanked: 2244 times

Re: Importing .STCK animation - We need your help!

Post by shakotay2 »

asdasd123 wrote:17 seems to repeat twice, don't know how much that meatters:
great! Doesn't matter, I guess. That's a very good starting point, imho. Will try to adjust the script - but don't expect too much. And don't expect it too soon. (:

edit: well, forget everything what I said about frame interpolating and none constant frame counts.
True is: - the script simply reads the frames depending on the frame count, no matter whether counts vary
- 3dsmax seems to create (interpolate/copy?) missing frames automatically

Only problem is that we seem to have constant transitions because frames are just copied:
mouseMove.JPG
here's the script which was tested with Repulse.stck for mouse only!

Code: Select all

/*
	Import Saint Seiya .stck Animation
	basic structure borrowed from Taylor Mouse
	1-17-2016; only tested with Repulse.stck from mouse

	(Exit_cnt: quickhack because the former script could handle one geometry only)
   
	(renaming of folders might be required if there are problems with asian characters)
*/

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

allBones = #()
bone_names = #()
Exit_cnt = 0

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:")
                    Exit_cnt += 1
                    if Exit_cnt==2 then return numBones
                )

                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 nBones 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!"
    anim_cnt =  readlong stream
    nAllBones =  readlong stream		-- notinuse: number of all bones
	--nBones = 60	-- Natasha
    
    /* Frame data*/
    Frame_cnt = #()
    Frame_offs = #()
    allTranslations = #()
    allRotations = #()

    for i=1 to nBones do	/* handle BONES */
    (
	    tmp =  readlong stream -- 00000000
	    unk =  readlong stream ; --print unk 10 000000
	    unk =  readlong stream ; tmp =  readlong stream -- 1E 000000 00000000
	    if (i != 1) then (
		    ID =  readlong stream ; -- format "ID %\n" ID
	    )
		else 	ID = 9999
	    Frame_cnt = readlong stream
	    tmp =  readlong stream ; unk =  readlong stream ;

 	    -- 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  -- 00000000
	    unk =  readlong stream ; --print unk   0x0215= 533
	    tmp =  readlong stream ; tmp =  readlong stream
	    Frame_cnt = readlong stream	
	    tmp =  readlong stream ; unk =  readlong stream ; 
    
	    /* 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)"
	exit -- the script should terminate here
)
else format "nBones: %\n" nBones

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

ReadAniFile fName nBones 10  -- uups, forgot nBones as a parameter
max create mode
The anims appear and Floating hit 1 perform similar to Repulse. Not sure if that's what it should be. :cry:
You do not have the required permissions to view the files attached to this post.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
asdasd123
beginner
Posts: 22
Joined: Sun Jun 14, 2015 4:07 pm
Has thanked: 13 times
Been thanked: 3 times

Re: Importing .STCK animation - We need your help!

Post by asdasd123 »

shakotay2 wrote:here's the script which was tested with Repulse.stck for mouse only!
Thank you, thank you, thank you! This is such a great advance! (: :) (: :) (: :)
Yesterday was my birthday and I'm really, really happy just by seeing some movement :D :D :D
shakotay2 wrote:The anims appear and Floating hit 1 perform similar to Repulse. Not sure if that's what it should be. :cry:
Yup, I've tested with other animations (like walk and run) and either the model only moves with his head/arms, or I get "unable to convert. undefinded to type: float"
I'm uploading a new model with known animations and the model with the error

Also I've noticed something that maybe will help (or maybe you've already noticed).
Most (but not all) models seem to have a number of frames equal to twice the number of bones. Eg: 44 bones = 88 frames
Maybe every two frames should be rotation and transition of a certain bone, the trick would be knowing what bone is it (maybe the .STCK on the main folder is for that)

http://www.mediafire.com/download/46gun ... /Misty.rar --- 331 kb --- "unable to convert. undefinded to type: float"
http://www.mediafire.com/download/its2x ... /Shina.rar --- 363 kb --- model with know animations
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4291
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1151 times
Been thanked: 2244 times

Re: Importing .STCK animation - We need your help!

Post by shakotay2 »

asdasd123 wrote:Maybe every two frames should be rotation and transition of a certain bone,
that's true for most animation formats (you did not look into the script, did you? :D )
btw: wouldn't call it "frames", it's animation data blocks. One frame in the transition data block, 17 frames in the rotation data block
the trick would be knowing what bone is it (maybe the .STCK on the main folder is for that)
the bone's list is logged in the Listener
or I get "unable to convert. undefinded to type: float"
that's animations with the index list I mentioned before (see picture in one of the previous posts)
Maybe it's sufficient to just skip them by inserting some dummy reads.
(nope, for _Walk.stck it's a little bit harder)

The indices are very likely to be the keyposes - so not a good idea to ignore them.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
asdasd123
beginner
Posts: 22
Joined: Sun Jun 14, 2015 4:07 pm
Has thanked: 13 times
Been thanked: 3 times

Re: Importing .STCK animation - We need your help!

Post by asdasd123 »

shakotay2 wrote:that's true for most animation formats (you did not look into the script, did you? :D )
kkkkk did not. In fact ... i struggle reading code :(
shakotay2 wrote:that's animations with the index list I mentioned before (see picture in one of the previous posts)
Maybe it's sufficient to just skip them by inserting some dummy reads.
(nope, for _Walk.stck it's a little bit harder)

The indices are very likely to be the keyposes - so not a good idea to ignore them.
Alright, what can I do to help ? :D
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4291
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1151 times
Been thanked: 2244 times

Re: Importing .STCK animation - We need your help!

Post by shakotay2 »

cross fingers? :wink:

Well, I'm stuck atm and this ate way too much of my lifetime today.

The rotations are no quaternions in Misty's _Walk.stck. So I ignored them as well as those indices.
As a consequence for so much ignorance Misty's just shrinking vertically instead of walking:
Misty_Walk.JPG
btw: wish you a Happy Birthday, subsequently! But no presents any more, I fear.
(Rotations will be the last thing I'll try ...)
You do not have the required permissions to view the files attached to this post.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
asdasd123
beginner
Posts: 22
Joined: Sun Jun 14, 2015 4:07 pm
Has thanked: 13 times
Been thanked: 3 times

Re: Importing .STCK animation - We need your help!

Post by asdasd123 »

(sorry for not answering sooner, i was in the hospital, broke my ankle)
shakotay2 wrote:cross fingers? :wink:
Alright, they are crossed
shakotay2 wrote:btw: wish you a Happy Birthday, subsequently! But no presents any more, I fear.
(Rotations will be the last thing I'll try ...)
Believe me, your efforts so far have been one of the best gifts I've recieved this year :D :D

Even if you can't figure it out, I'm really thankfull for your desire to help. :mrgreen:

Really, thank you! :D :D :D :D
Lynix
advanced
Posts: 42
Joined: Wed Jul 01, 2015 3:11 pm
Has thanked: 2 times
Been thanked: 20 times

Re: Importing .STCK animation - We need your help!

Post by Lynix »


--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.BoneId].TheBone
if(b == undefined) then continue

t = allRotations.KeyFrame + startingFrame
q = allRotations.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.BoneId].TheBone
t = allTranslations.KeyFrame + startingFrame
pos = allTranslations.Position

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

fClose stream
)


for i=1 to keyframes do

(
Frame+=10
at time Frame
(
animate on
(
--> BASE TRANSLATION (Bip01)
--> BASE ROTATION (Bip01)

for j=2 to bonecount do
(
--> PARENT (J) TRANSLATION
--> PARENT (J) ROTATION
)

)
)
)

this template also works in max to make a bonesystem animated with keyframes and with different Speed between each keyframe played
KamixSama
ultra-n00b
Posts: 1
Joined: Sat Jan 28, 2017 7:11 am

Re: Importing .STCK animation - We need your help!

Post by KamixSama »

Hi XeNTaxX Member

and @shakotay2

i was asking for a animatin import script (3dsmax) (.stck) files...
i saw some threads on this forum about importing .stck files.

and i wil be very happy if someone have a working import script :)
darksimonus
beginner
Posts: 30
Joined: Sat May 01, 2010 8:57 pm

Re: Importing .STCK animation - We need your help!

Post by darksimonus »

it s possible to import animation stck in 3dsmax?
Post Reply