Пример #1
0
        internal void linkObjects(RMX_Object o)
        {
            // find parent
            if (!string.IsNullOrEmpty(o.Parent))
            {
                foreach (var parent in Model.Objects)
                {
                    if (o.Parent == parent.Name)
                    {
                        Parent = parent;
                        break;
                    }
                }
                if (Parent == null) Debug.ThrowError("SoftwareObject", "Failed to find Parent: " + o.Parent);
            }

            // find armature object
            if (o.ArmatureObject != null)
            {
                foreach (var action in Model.Objects)
                {
                    if (o.ArmatureObject.Name == action.Name)
                    {
                        ArmatureObject = (SoftwareObjectArmature)action;
                        break;
                    }
                }
                if (ArmatureObject == null) Debug.ThrowError("SoftwareObject", "Failed to find ArmatureObject: " + o.ArmatureObject.Name);
            }
        }
 public SoftwareObjectArmature(SoftwareModel model, RMX_Object o)
     : base(model, o)
 {
     // find armature
     foreach (var armature in model.Armatures)
     {
         if (o.Armature.Name == armature.Name)
         {
             Armature = armature;
             break;
         }
     }
     if (Armature == null) Debug.ThrowError("SoftwareObjectArmature", "Failed to find Armature: " + o.Armature.Name);
 }
Пример #3
0
        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));
                }
            }
        }
Пример #4
0
 public SoftwareObjectArmature(SoftwareModel model, RMX_Object o)
     : base(model, o)
 {
     // find armature
     foreach (var armature in model.Armatures)
     {
         if (o.Armature.Name == armature.Name)
         {
             Armature = armature;
             break;
         }
     }
     if (Armature == null)
     {
         Debug.ThrowError("SoftwareObjectArmature", "Failed to find Armature: " + o.Armature.Name);
     }
 }
Пример #5
0
        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));
                }
            }
        }
Пример #6
0
        public SoftwareObjectMesh(SoftwareModel model, RMX_Object o)
            : base(model, o)
        {
            if (o.Mesh != null)
            {
                foreach (var mesh in model.Meshes)
                {
                    if (o.Mesh.Name == mesh.Name)
                    {
                        Mesh = mesh;
                        break;
                    }
                }

                if (Mesh == null)
                {
                    Debug.ThrowError("SoftwareObjectMesh", "Failed to find mesh");
                }
            }
            else
            {
                Debug.ThrowError("SoftwareObjectMesh", "RMX_Object be linked to a Mesh object");
            }
        }
Пример #7
0
        internal void linkObjects(RMX_Object o)
        {
            // find parent
            if (!string.IsNullOrEmpty(o.Parent))
            {
                foreach (var parent in Model.Objects)
                {
                    if (o.Parent == parent.Name)
                    {
                        Parent = parent;
                        break;
                    }
                }
                if (Parent == null)
                {
                    Debug.ThrowError("SoftwareObject", "Failed to find Parent: " + o.Parent);
                }
            }

            // find armature object
            if (o.ArmatureObject != null)
            {
                foreach (var action in Model.Objects)
                {
                    if (o.ArmatureObject.Name == action.Name)
                    {
                        ArmatureObject = (SoftwareObjectArmature)action;
                        break;
                    }
                }
                if (ArmatureObject == null)
                {
                    Debug.ThrowError("SoftwareObject", "Failed to find ArmatureObject: " + o.ArmatureObject.Name);
                }
            }
        }