\r
public skeleton()\r
{\r
- mBones = new Dictionary<string, Bone>(Bone.mBones); //copy from the static defines\r
+\r
+ mBones = new Dictionary<string, Bone>();\r
+\r
+ foreach (Bone src in Bone.mBones.Values)\r
+ {\r
+ Bone newbone = new Bone(src);\r
+ mBones.Add(newbone.name, newbone);\r
+ }\r
+\r
+ //rebuild the skeleton structure on the new copy\r
+ foreach (Bone src in mBones.Values)\r
+ {\r
+ if (src.mParentBone != null)\r
+ {\r
+ src.parent = mBones[src.mParentBone];\r
+ }\r
+ }\r
\r
//FUDGE\r
if (mUpperMeshMapping.Count == 0)\r
private Vector3 mDeltaPos;\r
private Quaternion mDeltaRot;\r
\r
+ public string mParentBone = null;\r
+\r
public Bone()\r
{\r
}\r
orig_rot = source.orig_rot;\r
orig_scale = source.orig_scale;\r
\r
+ mParentBone = source.mParentBone;\r
+\r
mDeformMatrix = new Matrix4(source.mDeformMatrix);\r
}\r
\r
//TODO piviot\r
\r
b.parent = parent;\r
-\r
if (parent != null)\r
+ {\r
+ b.mParentBone = parent.name;\r
parent.children.Add(b);\r
+ } \r
\r
mBones.Add(b.name, b);\r
mIndexedBones.Add(boneaddindex++, b);\r