Пример #1
0
        public void Reload()
        {
            //Set the remap table
            RemapTable.Clear();
            if (Skeleton.MatrixToBoneList != null)
            {
                for (int i = 0; i < Skeleton.MatrixToBoneList.Count; i++)
                {
                    RemapTable.Add(Skeleton.MatrixToBoneList[i]);
                }
            }

            foreach (var bone in Skeleton.Bones.Values)
            {
                var genericBone = new BfresBone(this)
                {
                    BoneData    = bone,
                    Name        = bone.Name,
                    ParentIndex = bone.ParentIndex,
                    Position    = new OpenTK.Vector3(
                        bone.Position.X,
                        bone.Position.Y,
                        bone.Position.Z) * GLFrameworkEngine.GLContext.PreviewScale,
                    Scale = new OpenTK.Vector3(
                        bone.Scale.X,
                        bone.Scale.Y,
                        bone.Scale.Z),
                    ParentSkeletonData = Skeleton,
                };

                if (Skeleton.FlagsScaling == SkeletonFlagsScaling.Maya)
                {
                    genericBone.UseSegmentScaleCompensate = true;
                }

                if (bone.FlagsRotation == BoneFlagsRotation.EulerXYZ)
                {
                    genericBone.EulerRotation = new OpenTK.Vector3(
                        bone.Rotation.X, bone.Rotation.Y, bone.Rotation.Z);
                }
                else
                {
                    genericBone.Rotation = new OpenTK.Quaternion(
                        bone.Rotation.X, bone.Rotation.Y,
                        bone.Rotation.Z, bone.Rotation.W);
                }

                Bones.Add(genericBone);
            }

            Reset();
        }
Пример #2
0
 public void LoadEditor(BfresBone bone)
 {
     ImGui.BeginTabBar("bone_tab");
     if (ImguiCustomWidgets.BeginTab("bone_tab", "Bone Data"))
     {
         LoadBoneTab(bone);
         ImGui.EndTabItem();
     }
     if (ImguiCustomWidgets.BeginTab("bone_tab", "User Data"))
     {
         UserDataInfoEditor.Render(bone.BoneData.UserData);
         ImGui.EndTabItem();
     }
     ImGui.EndTabBar();
 }
Пример #3
0
        static void LoadBoneTab(BfresBone bone)
        {
            var boneData = bone.BoneData;

            if (ImGui.CollapsingHeader("Bone Info", ImGuiTreeNodeFlags.DefaultOpen))
            {
                ImGuiHelper.InputFromBoolean("Visible", bone, "Visible");
                ImGuiHelper.InputFromText("Name", bone, "Name", 200);

                int index = bone.Index;
                ImGui.SameLine(); ImGui.InputInt("Index", ref index);
                var parent = bone.Parent as BfresBone;
                if (parent != null)
                {
                    var parentIndex = parent.Index;
                    ImGuiHelper.InputFromText("Parent", parent, "Name", 200, ImGuiInputTextFlags.ReadOnly);
                    ImGui.SameLine(); ImGui.InputInt("Index", ref parentIndex);
                }
            }
            if (ImGui.CollapsingHeader("Bone Transform", ImGuiTreeNodeFlags.DefaultOpen))
            {
                var transform = ImguiCustomWidgets.Transform(bone.Position, bone.EulerRotation, bone.Scale);
                if (transform.Edited)
                {
                    bone.Position = new OpenTK.Vector3(
                        transform.Position.X, transform.Position.Y, transform.Position.Z);
                    bone.Scale = new OpenTK.Vector3(
                        transform.Scale.X, transform.Scale.Y, transform.Scale.Z);
                    bone.EulerRotation = new OpenTK.Vector3(
                        transform.Rotation.X, transform.Rotation.Y, transform.Rotation.Z);
                    bone.UpdateBfresTransform();
                    bone.UpdateTransform();
                }
            }
            if (ImGui.CollapsingHeader("Billboard", ImGuiTreeNodeFlags.DefaultOpen))
            {
                ImGuiHelper.ComboFromEnum <BoneFlagsBillboard>("Type", boneData, "FlagsBillboard");
                ImGuiHelper.InputFromShort("Index", boneData, "BillboardIndex");
            }
            if (ImGui.CollapsingHeader("Matrix Indices", ImGuiTreeNodeFlags.DefaultOpen))
            {
                int smoothIndex = boneData.SmoothMatrixIndex;
                int rigidIndex  = boneData.RigidMatrixIndex;

                ImGui.InputInt("Smooth Index", ref smoothIndex);
                ImGui.InputInt("Rigid Index", ref rigidIndex);
            }
            if (ImGui.CollapsingHeader("Transform Modes", ImGuiTreeNodeFlags.DefaultOpen))
            {
                ImGui.Columns(2);

                ImGuiHelper.InputFromBoolean("Identity", boneData, "TransformIdentity");
                ImGui.NextColumn();
                ImGui.NextColumn();

                ImGuiHelper.InputFromBoolean("Rotate Translate Zero", boneData, "TransformRotateTranslateZero");
                ImGui.NextColumn();
                ImGuiHelper.InputFromBoolean("Scale One", boneData, "TransformScaleOne");
                ImGui.NextColumn();

                ImGuiHelper.InputFromBoolean("Rotate Zero", boneData, "TransformRotateZero");
                ImGui.NextColumn();
                ImGuiHelper.InputFromBoolean("Scale Uniform", boneData, "TransformScaleUniform");
                ImGui.NextColumn();

                ImGuiHelper.InputFromBoolean("Translate Zero", boneData, "TransformTranslateZero");
                ImGui.NextColumn();
                ImGuiHelper.InputFromBoolean("Scale Volume One", boneData, "TransformScaleVolumeOne");
                ImGui.NextColumn();

                ImGui.Columns(1);
            }
            if (ImGui.CollapsingHeader("Hierarchy Transform Modes", ImGuiTreeNodeFlags.DefaultOpen))
            {
                ImGui.Columns(2);

                ImGuiHelper.InputFromBoolean("Identity", boneData, "TransformCumulativeIdentity");
                ImGui.NextColumn();
                ImGui.NextColumn();

                ImGuiHelper.InputFromBoolean("Rotate Translate Zero", boneData, "TransformCumulativeRotateTranslateZero");
                ImGui.NextColumn();
                ImGuiHelper.InputFromBoolean("Scale One", boneData, "TransformCumulativeScaleOne");
                ImGui.NextColumn();

                ImGuiHelper.InputFromBoolean("Rotate Zero", boneData, "TransformCumulativeRotateZero");
                ImGui.NextColumn();
                ImGuiHelper.InputFromBoolean("Scale Uniform", boneData, "TransformCumulativeScaleUniform");
                ImGui.NextColumn();


                ImGuiHelper.InputFromBoolean("Translate Zero", boneData, "TransformCumulativeTranslateZero");
                ImGui.NextColumn();
                ImGuiHelper.InputFromBoolean("Scale Volume One", boneData, "TransformCumulativeScaleVolumeOne");
                ImGui.NextColumn();

                ImGui.Columns(1);
            }
        }