예제 #1
0
        public bool Content()
        {
            var hasChanged = false;

            hasChanged |= ImGuiEx.EnumRadioButtonGroup(ref renderMode);
            NewLine();

            int curDepth = 0;

            for (int i = 0; i < Skeleton.Bones.Count; i++)
            {
                if (curDepth < boneDepths[i])
                {
                    continue;
                }
                while (curDepth > boneDepths[i])
                {
                    curDepth--;
                    TreePop();
                }

                var flags = (i == highlightedBoneI ? ImGuiTreeNodeFlags.Selected : 0) |
                            ImGuiTreeNodeFlags.OpenOnDoubleClick | ImGuiTreeNodeFlags.OpenOnArrow |
                            ImGuiTreeNodeFlags.DefaultOpen;
                if (TreeNodeEx($"Bone {i} \"{Skeleton.UserIds[i]}\"", flags))
                {
                    curDepth++;
                }
                if (IsItemClicked() && i != highlightedBoneI)
                {
                    HighlightBone(i);
                    hasChanged = true;
                }
            }
            while (curDepth > 0)
            {
                curDepth--;
                TreePop();
            }

            return(hasChanged);
        }
예제 #2
0
        private void HandleHeadIKContent()
        {
            if (description == null || body == null)
            {
                return;
            }
            if (description.headBoneID < 0)
            {
                Text("This actor has no head.");
                return;
            }

            ImGuiEx.EnumRadioButtonGroup(ref headIKMode);
            var newValue = (description.headBoneID, camera.Location.GlobalPosition);

            body.singleIK = headIKMode switch
            {
                HeadIKMode.Disabled => null,
                HeadIKMode.Enabled => newValue,
                HeadIKMode.Frozen => body.singleIK ?? newValue,
                _ => throw new NotImplementedException("Unimplemented head IK mode")
            };
        }
    }