Changeset View
Changeset View
Standalone View
Standalone View
io_import_scene_unreal_psa_psk.py
| Context not available. | |||||
| print ("Importing file: ", infile) | print ("Importing file: ", infile) | ||||
| pskfile = open(infile,'rb') | pskfile = open(infile,'rb') | ||||
| if (DEBUGLOG): | if DEBUGLOG: | ||||
| logpath = infile.replace(".psk", ".txt") | logpath = infile.replace(".psk", ".txt") | ||||
| print("logpath:",logpath) | print("logpath:",logpath) | ||||
| logf = open(logpath,'w') | logf = open(logpath,'w') | ||||
| def printlog(strdata): | def printlog(strdata): | ||||
| if (DEBUGLOG): | if DEBUGLOG: | ||||
| logf.write(strdata) | logf.write(strdata) | ||||
| objName = infile.split('\\')[-1].split('.')[0] | objName = infile.split('\\')[-1].split('.')[0] | ||||
| Context not available. | |||||
| bni_dict[createbone.name] = createbone.bone_index | bni_dict[createbone.name] = createbone.bone_index | ||||
| #w,x,y,z | #w,x,y,z | ||||
| if (counter == 0):#main parent | if counter == 0: # main parent | ||||
| createbone.bindmat = mathutils.Quaternion((indata[7], -indata[4], -indata[5], -indata[6])).to_matrix() | createbone.bindmat = mathutils.Quaternion((indata[7], -indata[4], -indata[5], -indata[6])).to_matrix() | ||||
| createbone.origmat = mathutils.Quaternion((indata[7], -indata[4], -indata[5], -indata[6])).to_matrix() | createbone.origmat = mathutils.Quaternion((indata[7], -indata[4], -indata[5], -indata[6])).to_matrix() | ||||
| else: | else: | ||||
| Context not available. | |||||
| for armbone in bone: | for armbone in bone: | ||||
| temp_name = armbone[0][:30] | temp_name = armbone[0][:30] | ||||
| #print ("BONE NAME: ", len(temp_name)) | #print ("BONE NAME: ", len(temp_name)) | ||||
| temp_name=str((temp_name)) | temp_name = str(temp_name) | ||||
| #temp_name = temp_name[1] | #temp_name = temp_name[1] | ||||
| #print ("BONE NAME: ", temp_name) | #print ("BONE NAME: ", temp_name) | ||||
| bonecount += 1 | bonecount += 1 | ||||
| Context not available. | |||||
| TmpCol = VtxCol[RWghts[n + 1][1]] | TmpCol = VtxCol[RWghts[n + 1][1]] | ||||
| Tmsh.faces[x].col.append(NMesh.Col(TmpCol[0], TmpCol[1], TmpCol[2], 0)) | Tmsh.faces[x].col.append(NMesh.Col(TmpCol[0], TmpCol[1], TmpCol[2], 0)) | ||||
| """ | """ | ||||
| if (DEBUGLOG): | if DEBUGLOG: | ||||
| logf.close() | logf.close() | ||||
| #================================================================================================== | #================================================================================================== | ||||
| #Building Mesh | #Building Mesh | ||||
| Context not available. | |||||
| print ("Importing file: ", filename) | print ("Importing file: ", filename) | ||||
| psafile = open(filename,'rb') | psafile = open(filename,'rb') | ||||
| debug = True | debug = True | ||||
| if (debug): | if debug: | ||||
| logpath = filename.replace(".psa", ".txt") | logpath = filename.replace(".psa", ".txt") | ||||
| print("logpath:", logpath) | print("logpath:", logpath) | ||||
| logf = open(logpath, 'w') | logf = open(logpath, 'w') | ||||
| def printlog(strdata): | def printlog(strdata): | ||||
| if (debug): | if debug: | ||||
| logf.write(strdata) | logf.write(strdata) | ||||
| def printlogplus(name, data): | def printlogplus(name, data): | ||||
| if (debug): | if debug: | ||||
| logf.write(str(name) + '\n') | logf.write(str(name) + '\n') | ||||
| if isinstance(data, bytes): | if isinstance(data, bytes): | ||||
| logf.write(str(bytes.decode(data).strip(bytes.decode(b'\x00')))) | logf.write(str(bytes.decode(data).strip(bytes.decode(b'\x00')))) | ||||
| Context not available. | |||||
| printlogplus('TypeFlag', indata[1]) | printlogplus('TypeFlag', indata[1]) | ||||
| printlogplus('DataSize', indata[2]) | printlogplus('DataSize', indata[2]) | ||||
| printlogplus('DataCount', indata[3]) | printlogplus('DataCount', indata[3]) | ||||
| if(Raw_Key_Nums != indata[3]): | if Raw_Key_Nums != indata[3]: | ||||
| print('error! Raw_Key_Nums Inconsistent') | print('error! Raw_Key_Nums Inconsistent') | ||||
| return | return | ||||
| #Raw keys Data | #Raw keys Data | ||||
| Context not available. | |||||
| break | break | ||||
| context.scene.frame_set(0) | context.scene.frame_set(0) | ||||
| if(debug): | if debug: | ||||
| logf.close() | logf.close() | ||||
| class IMPORT_OT_psa(bpy.types.Operator): | class IMPORT_OT_psa(bpy.types.Operator): | ||||
| Context not available. | |||||
| print("NAME:",objd.name," TYPE:",objd.type) | print("NAME:",objd.name," TYPE:",objd.type) | ||||
| if objd.type == "ARMATURE": | if objd.type == "ARMATURE": | ||||
| print(dir(objd)) | print(dir(objd)) | ||||
| print((objd.data.name)) | print(objd.data.name) | ||||
| return{'FINISHED'} | return{'FINISHED'} | ||||
| def menu_func(self, context): | def menu_func(self, context): | ||||
| Context not available. | |||||