(06-19-2013, 06:35 AM)SoulofDeity Wrote: [ -> ] (06-18-2013, 09:31 PM)RodLima Wrote: [ -> ]Quote:btw RodLima, I forgot to mention that you can make the animations import a lot faster if you buffer segment 7. that's how the model itself imports so fast.
Um, but the normal models that don't use the segment_07 took same time to import, I think it take some time because blender uses only one core to do the python Transforms
that shouldn't be a problem at all. if the script can convert / export 20+ textures and locate / import 21 + display lists, texture / position / and skin all of them instantaneously, there's no reason why a few matrix instructions should cause it to lag out so badly. All modern games execute hundreds of matrix instructions a second.
The only thing that should cause such a bad lag is if you're using file operations. Aside from segment_07, are you using the already buffered data for segment_05/06, or are you using a file handle?
EDIT:
As far as arrays in python go, its simple.
Code:
myarray = [] # initialize an empty array
myarray = [0, 2, 3] #initialize an array
myarray[0] = 1 # assign an element
myarray[1:] # this is a slice of just [2, 3]
myarray[:1] # this is a slice of just [1, 2]
myarray[:-1] # this is a slice of just [1, 2]
myarray.append(4) # add 1 item to an array
myarray.extend([4]) # add items from another array to this array
offset = 0
val = unpack_from(">L", myarray, offset)[0] # read a big endian unsigned long value (long = 32 bit) from the array
# unpack_from returns a tuple. the first argument is the format specifier where:
# > = big endian, < = little endian
# capital letter = unsigned, lowercase letter = signed
# B = byte, H = halfword (16-bit, 2 bytes) L = long (32-bit, 4 bytes)
# if you did unpack_from(">LLL", myarray, offset), it would return a tuple with 3 items because 3 L's
# how to buffer a file
file = open(filename, 'rb')
myarray = file.read()
file.close()
Ok nice, I'm using the segment data that you had made
Looking at your code I believe it is the first thing done
Code:
if self.loadOtherSegments:
for i in range(16):
f3dzex.setSegment(i, fpath + "/segment_%02X.zdata" % i)
And I'd learned how to extend and add to a list, and what the unpack_from means, after all I'd made it work, I just wish that it was more like C or UnrealScript that has a Rotator structure already made.
Code:
// An orthogonal rotation in 3d space.
struct immutable Rotator
{
var() int Pitch, Yaw, Roll;
};
Code:
self.offsetAnims = []
self.offsetAnims.extend([i])
self.offsetAnims[self.animTotal] = (0x06 << 24) | i
self.animTotal += 1
this part is done fast.
since you load a Link's walk anime that has 20 frames and it took about 3 sec to load, and the Link's biggest anime 365 frames and it took about 60 sec to load and at this point the code only acess the self.offsetAnims[] array already defined and some unpack_from calls. That is really fast, if you blockcomment the transforms code, and load Link anime 33 - 365 frames, it takes about 0.5 sec to load.
So, the part that take time IS the transform thing, rotate 20 joints for Link on 3 axes each on a for loop is not cheap to a single CPU core, I know there is constant joints and it could be skipped, but don't care about it.
if you look at my code, you wiil see how I did it and will realise that 80% of my code I just copied from zanime64 and zsaten, and a lot of thing could have been done another way.
But again, I know that you just want to help, but I'm done whit this, like I said before it was my first and last python code, don't want to mess with
python never again, I'm comfortable with C, C++, java, UnrealScript etc...
don't like to code something that if you had an invisible TAB or Space, it keep throwing error at our face!
And I did not made the anime part for anyone, it was just to me, I'm not comfortable on ask thing to anyone, so did not wanted to bother you, I'd made it only to dump Link's animes, and I already done this, 573 animes dumped, and put it to UDK as .PSA animes.
As you said
Quote:Not trying to dump the workload on anyone else, but if any python programmers wanna patch it up
and someone PM me askin for it, so I'd uploaded it.
Some day at the past, I was really considering on make some C code to Read Only the Link's rotation bones so I could manually set it on maya, how much time it would cost to me? More that some secs that is for sure.
And thanks to your project, the final result was infinitely better than I could ever dreamed.
I know it is slow, but I'm not in a hurry.
Thanks.