Пример #1
0
            public void Content()
            {
                bool hasChanged = false;

                if (ImGuiEx.Hyperlink("Model", SceneModel.filename))
                {
                    var fullPath = new FilePath("resources/models/models").Combine(SceneModel.filename + ".dff");
                    diContainer.GetTag <OpenDocumentSet>().OpenWith <ModelViewer>(fullPath);
                }
                var color = SceneModel.color.ToFColor();

                ColorEdit4("Color", ref color, ImGuiColorEditFlags.NoPicker);
                NewLine();

                var pos      = Location.LocalPosition;
                var rotEuler = Location.LocalRotation.ToEuler() * 180.0f / MathF.PI;

                hasChanged |= DragFloat3("Position", ref pos);
                hasChanged |= DragFloat3("Rotation", ref rotEuler);
                NewLine();

                SliderFloat("Ambient", ref SceneModel.surfaceProps.ambient, -1f, 1f);
                SliderFloat("Specular", ref SceneModel.surfaceProps.specular, -1f, 1f);
                SliderFloat("Diffuse", ref SceneModel.surfaceProps.diffuse, -1f, 1f);
                Checkbox("Use cached models", ref SceneModel.useCachedModels);
                SliderInt("Wiggle Speed", ref SceneModel.wiggleAmpl, 0, 4);
                Checkbox("Is only visual", ref SceneModel.isVisualOnly);

                NewLine();
                var behaviorType = SceneBehaviour?.type ?? BehaviourType.Unknown;

                ImGuiEx.EnumCombo("Behavior", ref behaviorType);

                if (hasChanged)
                {
                    rotEuler = (rotEuler * MathF.PI / 180.0f) - Location.LocalRotation.ToEuler();
                    Location.LocalPosition  = pos;
                    Location.LocalRotation *= Quaternion.CreateFromYawPitchRoll(rotEuler.Y, rotEuler.X, rotEuler.Z);
                    diContainer.GetTag <FramebufferArea>().IsDirty = true;
                }
            }
Пример #2
0
        private void HandleInfoContent()
        {
            void ModelLink(string label, string?modelName)
            {
                bool isEnabled = modelName != null && modelName.Length > 0;

                if (ImGuiEx.Hyperlink(label, isEnabled ? modelName ! : "<none>", true, isEnabled))
                {
                    diContainer.GetTag <OpenDocumentSet>().OpenWith <ModelViewer>("resources/models/actorsex/" + modelName);
                }
            }

            ModelLink("Body: ", description?.body.model);
            Text($"Body animations: {description?.body.animations.Length ?? 0}");
            Text($"Body bones: {body?.skeleton.Bones.Count ?? 0}");

            NewLine();
            ModelLink("Wings: ", description?.wings.model);
            Text($"Wings animations: {description?.wings.animations.Length ?? 0}");
            Text($"Wings bones: {wings?.skeleton.Bones.Count ?? 0}");

            NewLine();
            void BoneLink(string label, int?boneIdx)
            {
                if (ImGuiEx.Hyperlink(label, boneIdx?.ToString() ?? "<none>", false, boneIdx != null))
                {
                    body?.skeletonRenderer.HighlightBone(boneIdx !.Value);
                    fbArea.IsDirty = true;
                    if (body != null && body.skeletonRenderer.RenderMode == DebugSkeletonRenderMode.Invisible)
                    {
                        body.skeletonRenderer.RenderMode = DebugSkeletonRenderMode.Bones;
                    }
                }
            }

            BoneLink("Head bone: ", description?.headBoneID);
            BoneLink("Effect bone: ", description?.effectBoneID);
            BoneLink("Wing attach bone: ", description?.attachWingsToBone);
        }