[Help] how to extract Rappelz character animations

07/10/2023 15:57 hassuny#16
Quote:
Originally Posted by Anothers View Post
I don't know how to explain, but I did a proper research and wrote the python NAF Reader without knowing python.

If anyone knows how to script or animate in Blender can use this code.
Like I said, this is reader only.
You will add their functionality.
What exactly do you want to know about this NAF?


NAF Reader With Python(It was made without knowing Python. Sorry if your eyes bleed.)
thanks, what version of blender supports python 3.10?

and what do you mean by "adding functionality?"
07/11/2023 11:39 Masumichan#17
Quote:
Originally Posted by hassuny View Post
thanks, what version of blender supports python 3.10?

and what do you mean by "adding functionality?"
This is simply to import the data into blender, You can use this to set the keyframes yourself, What I recommend doing instead as this is probably too hard if you don't know how to program hit up someone called AOR and see if he's willing to sell some animations as I'm pretty sure he's got it figured out
07/11/2023 18:26 hassuny#18
Quote:
Originally Posted by Masumichan View Post
This is simply to import the data into blender, You can use this to set the keyframes yourself, What I recommend doing instead as this is probably too hard if you don't know how to program hit up someone called AOR and see if he's willing to sell some animations as I'm pretty sure he's got it figured out
thanks for replying, I know how to program but I don't know how to script with Blender. My aim is to extract models and animations and use them in unity3d.

what do you mean by "You can use this to set the keyframes yourself"?
Do you mean creating new animations? if that is so I'm not interested in creating new animations.
07/11/2023 19:55 Masumichan#19
Quote:
Originally Posted by hassuny View Post
thanks for replying, I know how to program but I don't know how to script with Blender. My aim is to extract models and animations and use them in unity3d.

what do you mean by "You can use this to set the keyframes yourself"?
Do you mean creating new animations? if that is so I'm not interested in creating new animations.
Keyframes are points in the timeline which indicate a rotation or location changing at a certain time point
07/11/2023 21:41 hassuny#20
Quote:
Originally Posted by Masumichan View Post
Keyframes are points in the timeline which indicate a rotation or location changing at a certain time point
I got you.

Now I tried the script with Blender 2.78, and it did not work. do you know which version of Blender this Naf script (by Zone) works with?
07/12/2023 01:30 omgkllz#21
Quote:
Originally Posted by hassuny View Post
I got you.

Now I tried the script with Blender 2.78, and it did not work. do you know which version of Blender this Naf script (by Zone) works with?
I have the official animations on unity and what I can tell you is that the first thing to do will be to convert the naf DIFK to naf BTRF, 90%+ of the character animations are in difk.
Please contact me for more information and to see if I can help you. I'm not often on epvp, so don't be surprised if I don't answer directly.
07/12/2023 15:39 hassuny#22
Quote:
Originally Posted by omgkllz View Post
I have the official animations on unity and what I can tell you is that the first thing to do will be to convert the naf DIFK to naf BTRF, 90%+ of the character animations are in difk.
Please contact me for more information and to see if I can help you. I'm not often on epvp, so don't be surprised if I don't answer directly.
thank you very much, I will send you pm.
07/13/2023 14:29 hassuny#23
Quote:
Originally Posted by Anothers View Post
I don't know how to explain, but I did a proper research and wrote the python NAF Reader without knowing python.

If anyone knows how to script or animate in Blender can use this code.
Like I said, this is reader only.
You will add their functionality.
What exactly do you want to know about this NAF?


NAF Reader With Python(It was made without knowing Python. Sorry if your eyes bleed.)
what version of blender supports python 3.10?
07/15/2023 16:42 hassuny#24
up up
07/22/2023 11:07 hassuny#25
Quote:
Originally Posted by Anothers View Post
I don't know how to explain, but I did a proper research and wrote the python NAF Reader without knowing python.

If anyone knows how to script or animate in Blender can use this code.
Like I said, this is reader only.
You will add their functionality.
What exactly do you want to know about this NAF?


NAF Reader With Python(It was made without knowing Python. Sorry if your eyes bleed.)
when I tried the script on (btrf) animation I got this error message!

07/24/2023 22:24 Anothers#26
Quote:
Originally Posted by hassuny View Post
when I tried the script on (btrf) animation I got this error message!

You can do it with this but I'm not sure it's exactly correct.
You add functions.

Blender 3.0 NAF Reader

Code:
#Writed By ZONE
import bpy
import uuid
import struct
import mathutils

class NAF():
    def __init__(self):
        self.BTRF = ""
        self.header_size = 0
        self.major_version = 0
        self.minor_version = 0
        self.header_pos = 0
       
     
def ReadFixedString(file):
    test = ""
    while True:
        c = file.read(1)
        lw = int.from_bytes(c, "big")
        sd = c.decode('utf-8')
        if lw == 0:
            break
        test += str(sd)
    return test


def readGuid(file, sdw):
    print(sdw)
    tewa = []
    for x in range(sdw):
        w = file.read(16)
        dsw = uuid.UUID(bytes=w)
        tewa.append(dsw)
    return tewa

def ReadInt(file):
    return struct.unpack("i",file.read(4))[0]


def ReadBTRF(file):
    return struct.unpack("4s",file.read(4))[0].decode()
    

def ReadShort(file):
    return struct.unpack("h",file.read(2))[0]

def ReadFloat(file):
    return struct.unpack("f",file.read(4))[0]
    

def ProcessFile():
    file_path = "C:\\asm_cbt_attack01_c_biped.naf"
    with open(file_path,"rb") as file:
        E = NAF()
        
        E.BTRF = ReadBTRF(file)
        E.header_size = ReadInt(file)
        E.major_version = ReadShort(file)
        E.minor_version = ReadShort(file)
        E.header_pos = ReadInt(file)
        header_naf_pos = E.header_size + 8
        
        file.seek(header_naf_pos)
        print(file.tell())
        
        GUIDSIZE = ReadInt(file)
        print("GUID SİZE",GUIDSIZE)
        sz = int(GUIDSIZE / 18)
        GuidSizeList = readGuid(file,sz)
        print(GuidSizeList)        
        header_naf_pos = header_naf_pos + int(GUIDSIZE) + 4
        file.seek(header_naf_pos)
        print("Current Pos",file.tell())
        
        ls = ReadInt(file)
        stringArray = []
        string_count = ReadInt(file)
        for s in range(string_count):
            strings = ReadFixedString(file)
            stringArray.append(strings)
        print(stringArray)
        header_naf_pos = header_naf_pos + int(ls) + 4
        file.seek(header_naf_pos)
        print("Current Pos",file.tell())
        
        next_header_pos = ReadInt(file)
        
        block_num = ReadInt(file)
        
        for b in range(block_num):
            file.read(3)
            types = file.read(1)
            block_size = ReadInt(file)
            temp_index = ReadShort(file)
            guidTableIndex = GuidSizeList[b]
            if guidTableIndex == uuid.UUID('21e0bc81-76ad-6f34-9c7d-19885fd118b6'):
                version = ReadInt(file)
                print("Version",version)
            if guidTableIndex == uuid.UUID('6b29f9e8-ddb9-8040-8bc7-6c69e0aa3feb'):
                bone_counts = ReadInt(file)
                channel_count = ReadInt(file)
                ani_channel_index = ReadShort(file)
                Bone_GUID = GuidSizeList[ani_channel_index - 1]
                if Bone_GUID == uuid.UUID('37c1b381-b8b2-b040-a3ad-d149467f5932'):
                    channel_name = ReadInt(file)
                    channel_flag = ReadInt(file)
                    channel_time_span = ReadInt(file)
                    channel_frame_rate = ReadInt(file)
                    bone_ani_size = ReadInt(file)
                    file.read(4)
                    file.read(4)
                    bone_ani_index = ReadShort(file)
                    Bone_Ani_GUID = GuidSizeList[bone_ani_index-1]
                    if Bone_Ani_GUID == uuid.UUID('de4443b8-b6a1-a74a-afd6-22ca8a4b0cee'):
                        bCount = ReadInt(file)
                        
                        for bk in range(bCount):
                            file.read(4)
                            boneSName = ReadInt(file)
                            boneName = stringArray[bk]
                            print("Bone Name : ", boneName)
                            
                            parent_id = ReadInt(file)
                            parentName = stringArray[parent_id]
                            file.read(64) #Bone TM
                            flag = ReadInt(file)
                            
                            pos_time_size = int(ReadInt(file) / 4)
                            file.read(1)
                            posTimeArray = []
                            for ps in range(pos_time_size):
                                pos_time = ReadInt(file)
                                posTimeArray.append(pos_time)
                            
                            print("POS Time Array ",posTimeArray)
                            
                            posKeyArray = []
                            pos_key_size = int(ReadInt(file) / 12)
                            file.read(1)
                            for pk in range(pos_key_size):
                                x = ReadFloat(file)
                                y = ReadFloat(file)
                                z = ReadFloat(file)
                                matk = mathutils.Vector((x,y,z))
                                posKeyArray.append(matk)
                                
                            print("Pos Key Array",posKeyArray)
                            
                            rotTimeArray = []
                            rot_time_size = int(ReadInt(file) / 4)
                            file.read(1)
                            for rt in range(rot_time_size):
                                rot_time = ReadInt(file)
                                rotTimeArray.append(rot_time)
                                
                            print("Rot Time Array",rotTimeArray)
                            rotKeyArray = []
                            rot_key_size = int(ReadInt(file) / 16)
                            file.read(1)
                            for rk in range(rot_key_size):
                                x = ReadFloat(file)    
                                y = ReadFloat(file)    
                                z = ReadFloat(file)    
                                w = ReadFloat(file)
                                mats = mathutils.Quaternion([w,x,y,z])
                                mats.invert()
                                rotKeyArray.append(mats)
                                
                            print("Rot Key Array",rotKeyArray)
                                  
                            child_size = int(ReadInt(file) / 4)
                            file.read(1)
                            for cz in range(child_size):
                                child_index_array = ReadInt(file)
                                                                         
ProcessFile()
07/25/2023 20:54 hassuny#27
Quote:
Originally Posted by Anothers View Post
You can do it with this but I'm not sure it's exactly correct.
You add functions.

Blender 3.0 NAF Reader

Code:
#Writed By ZONE
import bpy
import uuid
import struct
import mathutils

class NAF():
    def __init__(self):
        self.BTRF = ""
        self.header_size = 0
        self.major_version = 0
        self.minor_version = 0
        self.header_pos = 0
       
     
def ReadFixedString(file):
    test = ""
    while True:
        c = file.read(1)
        lw = int.from_bytes(c, "big")
        sd = c.decode('utf-8')
        if lw == 0:
            break
        test += str(sd)
    return test


def readGuid(file, sdw):
    print(sdw)
    tewa = []
    for x in range(sdw):
        w = file.read(16)
        dsw = uuid.UUID(bytes=w)
        tewa.append(dsw)
    return tewa

def ReadInt(file):
    return struct.unpack("i",file.read(4))[0]


def ReadBTRF(file):
    return struct.unpack("4s",file.read(4))[0].decode()
    

def ReadShort(file):
    return struct.unpack("h",file.read(2))[0]

def ReadFloat(file):
    return struct.unpack("f",file.read(4))[0]
    

def ProcessFile():
    file_path = "C:\\asm_cbt_attack01_c_biped.naf"
    with open(file_path,"rb") as file:
        E = NAF()
        
        E.BTRF = ReadBTRF(file)
        E.header_size = ReadInt(file)
        E.major_version = ReadShort(file)
        E.minor_version = ReadShort(file)
        E.header_pos = ReadInt(file)
        header_naf_pos = E.header_size + 8
        
        file.seek(header_naf_pos)
        print(file.tell())
        
        GUIDSIZE = ReadInt(file)
        print("GUID SİZE",GUIDSIZE)
        sz = int(GUIDSIZE / 18)
        GuidSizeList = readGuid(file,sz)
        print(GuidSizeList)        
        header_naf_pos = header_naf_pos + int(GUIDSIZE) + 4
        file.seek(header_naf_pos)
        print("Current Pos",file.tell())
        
        ls = ReadInt(file)
        stringArray = []
        string_count = ReadInt(file)
        for s in range(string_count):
            strings = ReadFixedString(file)
            stringArray.append(strings)
        print(stringArray)
        header_naf_pos = header_naf_pos + int(ls) + 4
        file.seek(header_naf_pos)
        print("Current Pos",file.tell())
        
        next_header_pos = ReadInt(file)
        
        block_num = ReadInt(file)
        
        for b in range(block_num):
            file.read(3)
            types = file.read(1)
            block_size = ReadInt(file)
            temp_index = ReadShort(file)
            guidTableIndex = GuidSizeList[b]
            if guidTableIndex == uuid.UUID('21e0bc81-76ad-6f34-9c7d-19885fd118b6'):
                version = ReadInt(file)
                print("Version",version)
            if guidTableIndex == uuid.UUID('6b29f9e8-ddb9-8040-8bc7-6c69e0aa3feb'):
                bone_counts = ReadInt(file)
                channel_count = ReadInt(file)
                ani_channel_index = ReadShort(file)
                Bone_GUID = GuidSizeList[ani_channel_index - 1]
                if Bone_GUID == uuid.UUID('37c1b381-b8b2-b040-a3ad-d149467f5932'):
                    channel_name = ReadInt(file)
                    channel_flag = ReadInt(file)
                    channel_time_span = ReadInt(file)
                    channel_frame_rate = ReadInt(file)
                    bone_ani_size = ReadInt(file)
                    file.read(4)
                    file.read(4)
                    bone_ani_index = ReadShort(file)
                    Bone_Ani_GUID = GuidSizeList[bone_ani_index-1]
                    if Bone_Ani_GUID == uuid.UUID('de4443b8-b6a1-a74a-afd6-22ca8a4b0cee'):
                        bCount = ReadInt(file)
                        
                        for bk in range(bCount):
                            file.read(4)
                            boneSName = ReadInt(file)
                            boneName = stringArray[bk]
                            print("Bone Name : ", boneName)
                            
                            parent_id = ReadInt(file)
                            parentName = stringArray[parent_id]
                            file.read(64) #Bone TM
                            flag = ReadInt(file)
                            
                            pos_time_size = int(ReadInt(file) / 4)
                            file.read(1)
                            posTimeArray = []
                            for ps in range(pos_time_size):
                                pos_time = ReadInt(file)
                                posTimeArray.append(pos_time)
                            
                            print("POS Time Array ",posTimeArray)
                            
                            posKeyArray = []
                            pos_key_size = int(ReadInt(file) / 12)
                            file.read(1)
                            for pk in range(pos_key_size):
                                x = ReadFloat(file)
                                y = ReadFloat(file)
                                z = ReadFloat(file)
                                matk = mathutils.Vector((x,y,z))
                                posKeyArray.append(matk)
                                
                            print("Pos Key Array",posKeyArray)
                            
                            rotTimeArray = []
                            rot_time_size = int(ReadInt(file) / 4)
                            file.read(1)
                            for rt in range(rot_time_size):
                                rot_time = ReadInt(file)
                                rotTimeArray.append(rot_time)
                                
                            print("Rot Time Array",rotTimeArray)
                            rotKeyArray = []
                            rot_key_size = int(ReadInt(file) / 16)
                            file.read(1)
                            for rk in range(rot_key_size):
                                x = ReadFloat(file)    
                                y = ReadFloat(file)    
                                z = ReadFloat(file)    
                                w = ReadFloat(file)
                                mats = mathutils.Quaternion([w,x,y,z])
                                mats.invert()
                                rotKeyArray.append(mats)
                                
                            print("Rot Key Array",rotKeyArray)
                                  
                            child_size = int(ReadInt(file) / 4)
                            file.read(1)
                            for cz in range(child_size):
                                child_index_array = ReadInt(file)
                                                                         
ProcessFile()
thnx, It worked without problems. but I don't know how to add functions to apply the animations data to the character :(:confused:
07/28/2023 15:14 hassuny#28
up up
07/28/2023 21:07 Masumichan#29
Not to sound like a douche, But I really don't think anyone is going to give you a fully working work flow for free, Unless you're willing to put in the effort yourself I'm pretty sure you probably wont get it.
07/29/2023 07:08 hassuny#30
Quote:
Originally Posted by Masumichan View Post
Not to sound like a douche, But I really don't think anyone is going to give you a fully working work flow for free, Unless you're willing to put in the effort yourself I'm pretty sure you probably wont get it.
I agree with you and appreciate your advice. nevertheless, I got a lot of information from this thread.