i should just cut to the chase, i am reworking the psk geneator that was produced by z3r0 d… and i am having problems with the code that i use when i use the struct for the psk files… i just used the struct provided here… https://blenderartists.org/forum/viewtopic.php?t=23177
here is the segment of code i am havin trouble with.( limited to what is actually needed.
my code for bones…
for Currentbone in range(len(bonelist)):
bonename = bonelist[Currentbone].getName() # names teh current bone based on what number the bone is.
bone_loc = bonelist[Currentbone].getLoc() # sets the location of the bone what bone number it is.
bone_head = bonelist[Currentbone].getHead()
bone_tail = bonelist[Currentbone].getTail()
bone_quat = bonelist[Currentbone].getQuat()
bone_parent = bonelist[Currentbone].getParent()
bone_size = bonelist[Currentbone].getSize()
## math involving bone length, based on the head and tail locations.
bonelengthpa = abs((abs(bone_head.x) + abs(bone_head.y) + abs(bone_head.z))-(abs(bone_Tail.z)+abs(bone_Tail.x) + abs(bone_Tail.y))
# materials[Tcount]=VMaterial()
rig[Currentbone] = VBone()
rig[Currentbone].Flags = 0
rig[Currentbone].NumChildren = 0
rig[Currentbone].Name = bonename
rig[Currentbone].Flags = 0
rig[Currentbone].NumChildren = 1
rig[Currentbone].ParentIndex = 0 # this is the root bone
rig[Currentbone].BonePos.Position = bone_tail
rig[Currentbone].BonePos.Orientation = bone_quat
rig[Currentbone].BonePos.Length = bonelengthpa
rig[Currentbone].BonePos.Size = bone_size
file_out.write(rig[Currentbone].toString())
Currentbone += 1
the problem is at line 247:
rig[Currentbone] = VBone()
^
the error is invalid syntax
and this is the original code i had to work with… his example.
ef bonedata(file_out, themesh, therig):
boneheader = VChunkHeader()
boneheader.ChunkID = "REFSKELT"
boneheader.TypeFlag = 1999801
boneheader.DataCount = 2
boneheader.DataSize = sizeof(VBone)
file_out.write(boneheader.toString())
bones = [VBone(), VBone()]
bones[0].Name="joint1"
bones[0].Flags = 0
bones[0].NumChildren = 1
bones[0].ParentIndex = 0 # this is the root bone
bones[0].BonePos.Position.X = 0
bones[0].BonePos.Position.Y = 0
bones[0].BonePos.Position.Z = 0
# what is the y axis as a quaternoin?
bones[0].BonePos.Orientation.X = -0.5
bones[0].BonePos.Orientation.Y = 0.5
bones[0].BonePos.Orientation.Z = 0.5
bones[0].BonePos.Orientation.W = 0.5
bones[0].BonePos.Length = 10
bones[0].BonePos.XSize = 0
bones[0].BonePos.YSize = 1
bones[0].BonePos.ZSize = 0
bones[1].Name="joint2"
bones[1].Flags = 0
bones[1].NumChildren = 0
bones[1].ParentIndex = 0
bones[1].BonePos.Position.X = 0
bones[1].BonePos.Position.Y = 10
bones[1].BonePos.Position.Z = 10
# what is the y axis as a quaternoin?
bones[1].BonePos.Orientation.X = 0
bones[1].BonePos.Orientation.Y = 1
bones[1].BonePos.Orientation.Z = 0
bones[1].BonePos.Orientation.W = 0
bones[1].BonePos.Length = 10
bones[1].BonePos.XSize = 1
bones[1].BonePos.YSize = 1
bones[1].BonePos.ZSize = 1