public SoftwareObject(SoftwareModel model, RMX_Object o)
{
Model = model;
Name = o.Name;
// transform
foreach (var input in o.Transform.Inputs)
{
switch (input.Type)
{
case "EulerRotation": Rotation = new Vector3(input.Values[0], input.Values[1], input.Values[2]); break;
case "Scale": Scale = new Vector3(input.Values[0], input.Values[1], input.Values[2]); break;
case "Position": Position = new Vector3(input.Values[0], input.Values[1], input.Values[2]); break;
default: Debug.ThrowError("SoftwareMesh", "Unsuported Transform Type: " + input.Type); break;
}
}
// find action
if (o.DefaultAction != null)
{
foreach (var action in model.Actions)
{
if (o.DefaultAction.Name == action.Name)
{
DefaultAction = action;
break;
}
}
if (DefaultAction == null) Debug.ThrowError("SoftwareObjectArmature", "Failed to find Action: " + o.DefaultAction.Name);
}
// bone groups
BoneGroups = new List<SoftwareObjectBoneGroup>();
if (o.BoneGroups != null)
{
foreach (var bonegroup in o.BoneGroups.BoneGroups)
{
BoneGroups.Add(new SoftwareObjectBoneGroup(bonegroup));
}
}
}