Пример #1
0
        private void DrawSoundClipInspector(SerializedProperty selectedEventProperty, TEvent selectedEvent)
        {
            bool allowLoopingClip = !selectedEvent.Container.Looping;

            if (allowLoopingClip)
            {
                if (selectedEvent.IsContinuous())
                {
                    allowLoopingClip = false;
                }
            }

            for (int i = 0; i < selectedEvent.Container.Sounds.Length; i++)
            {
                EditorGUILayout.Space();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(selectedEventProperty.FindPropertyRelative("Container.Sounds.Array.data[" + i + "].Sound"));

                if (EditorGUILayoutExtensions.Button("Remove"))
                {
                    selectedEventProperty.FindPropertyRelative("Container.Sounds.Array.data[" + i + "]").DeleteCommand();
                    break;
                }

                EditorGUILayout.EndHorizontal();

                if (!selectedEvent.IsContinuous())
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PropertyField(selectedEventProperty.FindPropertyRelative("Container.Sounds.Array.data[" + i + "].DelayCenter"));
                    EditorGUILayout.PropertyField(selectedEventProperty.FindPropertyRelative("Container.Sounds.Array.data[" + i + "].DelayRandomization"));
                    EditorGUILayout.EndHorizontal();

                    //Disable looping next clips in a simultaneous container only.
                    if (allowLoopingClip)
                    {
                        EditorGUILayout.PropertyField(selectedEventProperty.FindPropertyRelative("Container.Sounds.Array.data[" + i + "].Looping"));

                        if (selectedEvent.Container.Sounds[i].Looping && selectedEvent.Container.ContainerType == AudioContainerType.Simultaneous)
                        {
                            allowLoopingClip = false;
                        }
                    }
                    else
                    {
                        selectedEvent.Container.Sounds[i].Looping = false;
                    }
                }
            }
        }
        private void OnGUIForAnimatorController()
        {
            using (new EditorGUILayout.HorizontalScope(GUI.skin.box))
                EditorGUILayout.LabelField("複数の Animator Controller をまとめます。");

            EditorGUILayoutExtensions.PropertyField(this, nameof(_sourceControllers));

            using (new DisabledGroup(_sourceControllers?.All(w => w == null) == true))
            {
                if (GUILayout.Button("マージする"))
                {
                    MergeAnimatorControllers(_sourceControllers);
                }
            }
        }
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            serializedObject.Update();

            showOculusHandTrackingSettings = EditorGUILayoutExtensions.FoldoutWithBoldLabel(showOculusHandTrackingSettings, oculusHandSettingsFoldoutHeader, true);
            if (showOculusHandTrackingSettings)
            {
                EditorGUI.indentLevel++;
                minConfidenceRequired.intValue = (int)(OculusApi.TrackingConfidence)EditorGUILayout.EnumPopup(confidenceContent, (OculusApi.TrackingConfidence)minConfidenceRequired.intValue);
                EditorGUI.indentLevel--;
            }

            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            serializedObject.Update();

            showLuminHandTrackingSettings = EditorGUILayoutExtensions.FoldoutWithBoldLabel(showLuminHandTrackingSettings, handTrackingFoldoutHeader);

            if (showLuminHandTrackingSettings)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(keyPointFilterLevel);
                EditorGUILayout.PropertyField(poseFilterLevel);
                EditorGUI.indentLevel--;
            }

            serializedObject.ApplyModifiedProperties();
        }
Пример #5
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            serializedObject.Update();

            EditorGUILayout.Space();

            showSimulatedHandTrackingSettings = EditorGUILayoutExtensions.FoldoutWithBoldLabel(showSimulatedHandTrackingSettings, SimulatedHandSettingsFoldoutHeader);

            if (showSimulatedHandTrackingSettings)
            {
                EditorGUI.indentLevel++;

                EditorGUILayout.LabelField("Hand Rendering Settings");
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(renderingMode);
                EditorGUILayout.Space();
                EditorGUI.indentLevel--;

                EditorGUILayout.LabelField("Hand Physics Settings");
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(handPhysicsEnabled);
                EditorGUILayout.PropertyField(useTriggers);
                EditorGUILayout.PropertyField(boundsMode);
                EditorGUILayout.Space();
                EditorGUI.indentLevel--;

                EditorGUI.indentLevel++;
                poseProfilesList.DoLayoutList();
                EditorGUILayout.Space();
                EditorGUI.indentLevel--;

                EditorGUILayout.LabelField("Simulated Poses");
                EditorGUI.indentLevel++;
                handPoseAnimationSpeed.floatValue = EditorGUILayout.Slider(handPoseAnimationSpeedLabel, handPoseAnimationSpeed.floatValue, 1, 10);
                EditorGUILayout.Space();
                EditorGUI.indentLevel--;

                EditorGUI.indentLevel--;

                serializedObject.ApplyModifiedProperties();
            }
        }
Пример #6
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            serializedObject.Update();

            pointerPoseTransform.isExpanded = EditorGUILayoutExtensions.FoldoutWithBoldLabel(pointerPoseTransform.isExpanded, foldoutHeader);
            if (pointerPoseTransform.isExpanded)
            {
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(pointerPoseTransform);
                EditorGUILayout.PropertyField(offsetStart);
                EditorGUILayout.PropertyField(offsetEnd);

                EditorGUI.indentLevel--;
            }

            serializedObject.ApplyModifiedProperties();
        }
Пример #7
0
        public override void OnInspectorGUI()
        {
            // DEPTH
            obj.Depth    = EditorGUILayout.IntSlider("Depth", obj.Depth, 0, obj.MaxDepth);
            obj.MaxDepth = EditorGUILayout.IntField("Max Depth", obj.MaxDepth);

            float relativeDepth = obj.RelativeDepth;

            EditorGUILayout.LabelField("Relative Depth (Used for calculations): " + relativeDepth);

            // SORTING
            EditorGUILayoutExtensions.Header("Sorting");
            obj.DepthOffset = EditorGUILayout.IntField("Depth Offset", obj.DepthOffset);
            EditorGUILayout.LabelField("Computed Sorting Order: " + obj.SortingOrder);

            // PROPERTIES
            EditorGUILayoutExtensions.Header("Properties");

            GUIContent colorBlendContent = new GUIContent("Color Blend Scale", "Lerp(SpriteColor, BackgroundColor, RelativeDepth * ColorBlendScale)");

            obj.ColorBlendScale = EditorGUILayout.Slider(colorBlendContent, obj.ColorBlendScale, 0.0f, 1.0f);

            float backgroundPercentage     = (relativeDepth * obj.ColorBlendScale);
            float originalSpritePercentage = 1.0f - backgroundPercentage;

            EditorGUILayout.LabelField("Color = " + originalSpritePercentage.ToPercentageString() + " Original Sprite  |  " + backgroundPercentage.ToPercentageString() + " Background");
            EditorGUILayout.Space();

            GUIContent sizeReductionContent = new GUIContent("Size Reduction Scale", "Scale = 1.0f - (SizeReductionScale * RelativeDepth)");

            obj.SizeReductionScale = EditorGUILayout.Slider(sizeReductionContent, obj.SizeReductionScale, 0.0f, 1.0f);

            float computedSize = 1.0f - (relativeDepth * obj.SizeReductionScale);

            EditorGUILayout.LabelField("Size = " + computedSize.ToPercentageString());

            if (GUI.changed)
            {
                EditorUtility.SetDirty(obj);
            }
        }
        private void OnGUIForExpressionsMenu()
        {
            using (new EditorGUILayout.HorizontalScope(GUI.skin.box))
            {
                EditorGUILayout.LabelField(@"
複数の Expressions Menu をまとめます。
なお、ルートメニューの数が合計8個を越える場合は処理を中断します。
※処理を中断した場合、エラー内容は Console に出力されます。
".Trim());
            }

            EditorGUILayoutExtensions.PropertyField(this, nameof(_sourceExpressions));

            using (new DisabledGroup(_sourceExpressions?.All(w => w == null) == true))
            {
                if (GUILayout.Button("マージする"))
                {
                    MergeExpressionsMenus(_sourceExpressions);
                }
            }
        }
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            serializedObject.Update();

            showSimulationSettings = EditorGUILayoutExtensions.FoldoutWithBoldLabel(showSimulationSettings, SimulationSettingsFoldoutHeader, true);
            if (showSimulationSettings)
            {
                EditorGUI.indentLevel++;

                EditorGUILayout.LabelField("General Settings");
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(simulatedUpdateFrequency);
                EditorGUILayout.PropertyField(controllerHideTimeout);
                EditorGUILayout.Space();
                EditorGUI.indentLevel--;

                EditorGUILayout.LabelField("Placement Settings");
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(defaultDistance);
                EditorGUILayout.PropertyField(depthMultiplier);
                EditorGUILayout.PropertyField(jitterAmount);
                EditorGUILayout.Space();
                EditorGUI.indentLevel--;

                EditorGUILayout.LabelField("Controls Settings");
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(toggleLeftPersistentKey);
                EditorGUILayout.PropertyField(leftControllerTrackedKey);
                EditorGUILayout.PropertyField(toggleRightPersistentKey);
                EditorGUILayout.PropertyField(rightControllerTrackedKey);
                EditorGUILayout.PropertyField(rotationSpeed);
                EditorGUI.indentLevel--;

                EditorGUI.indentLevel--;
            }

            serializedObject.ApplyModifiedProperties();
        }
        private void OnGUIForExpressionParameters()
        {
            using (new EditorGUILayout.HorizontalScope(GUI.skin.box))
            {
                EditorGUILayout.LabelField(@"
複数の Expression Parameters をまとめます。
なお、パラメータの数が合計16個を越えた場合は処理を中断します。
※VRChat のデフォルトパラメータは統合後も初期のもの3つのみ保持します。
※処理を中断した場合、エラー内容は Console に出力されます。
".Trim());
            }

            EditorGUILayoutExtensions.PropertyField(this, nameof(_sourceParameters));

            using (new DisabledGroup(_sourceParameters?.All(w => w == null) == true))
            {
                if (GUILayout.Button("マージする"))
                {
                    MergeExpressionParameters(_sourceParameters);
                }
            }
        }
        public override void OnInspectorGUI()
        {
            RenderHeader();
            EditorGUILayout.Space();
            configurations.isExpanded = EditorGUILayoutExtensions.FoldoutWithBoldLabel(configurations.isExpanded, new GUIContent($"{ServiceConstraint.Name} Configuration Options"));

            if (configurations.isExpanded)
            {
                serializedObject.Update();
                EditorGUILayout.Space();
                configurationList.DoLayoutList();

                if (configurations == null || configurations.arraySize == 0)
                {
                    EditorGUILayout.HelpBox($"Register a new {ServiceConstraint.Name} Configuration", MessageType.Warning);
                }

                serializedObject.ApplyModifiedProperties();
            }

            TypeReferencePropertyDrawer.CreateNewTypeOverride = null;
        }
        public override void OnInspectorGUI()
        {
            RenderHeader("Use this configuration profile to setup all of the services you would like to add to any existing profile configurations when the target platform package is installed");
            EditorGUILayout.Space();

            if (GUILayout.Button("Install Platform Service Configuration"))
            {
                EditorApplication.delayCall += () => PackageInstaller.InstallConfiguration(target as MixedRealityPlatformServiceConfigurationProfile, MixedRealityToolkit.Instance.ActiveProfile);
            }

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            serializedObject.Update();

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(platformEntries);

            if (EditorGUI.EndChangeCheck())
            {
                UpdatePlatformList();
            }

            EditorGUILayout.Space();
            configurations.isExpanded = EditorGUILayoutExtensions.FoldoutWithBoldLabel(configurations.isExpanded, new GUIContent("Configuration Options"));

            if (configurations.isExpanded)
            {
                EditorGUILayout.Space();
                configurationList.DoLayoutList();

                if (configurations == null || configurations.arraySize == 0)
                {
                    EditorGUILayout.HelpBox("Register a new Service Configuration", MessageType.Warning);
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
Пример #13
0
        private void DrawEventHeader(TEvent[] EditorEvents)
        {
            // Add or remove current event.
            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayoutExtensions.Label("Events");

            using (new EditorGUI.DisabledScope((EditorEvents != null) && (EditorEvents.Length < 1)))
            {
                if (EditorGUILayoutExtensions.Button("Remove"))
                {
                    this.MyTarget.Events = RemoveAudioEvent(EditorEvents, this.selectedEventIndex);
                }
            }

            if (EditorGUILayoutExtensions.Button("Add"))
            {
                this.MyTarget.Events = AddAudioEvent(EditorEvents);
            }

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();
        }
        public override void OnInspectorGUI()
        {
            RenderHeader("This profile defines all of the controllers and their mappings to use. Additional platform settings can also be available as well.");

            showMappingProfiles = EditorGUILayoutExtensions.FoldoutWithBoldLabel(showMappingProfiles, controllerProfilesFoldoutHeader, true);
            if (showMappingProfiles)
            {
                EditorGUILayout.Space();
                selectedMappingsViewModeTab = GUILayout.Toolbar(selectedMappingsViewModeTab, viewModeToolbarOptions);
                switch (selectedMappingsViewModeTab)
                {
                case 0:
                    DrawSimpleControllerMappingProfilesView();
                    break;

                case 1:
                    DrawAdvancedControllerMappingProfilesView();
                    break;
                }
            }

            EditorGUILayout.Space();
        }
Пример #15
0
        private bool DrawContainerInspector(SerializedProperty selectedEventProperty, TEvent selectedEvent)
        {
            bool addedSound = false;

            EditorGUILayout.PropertyField(selectedEventProperty.FindPropertyRelative("Container.ContainerType"));

            if (!selectedEvent.IsContinuous())
            {
                EditorGUILayout.PropertyField(selectedEventProperty.FindPropertyRelative("Container.Looping"));

                if (selectedEvent.Container.Looping)
                {
                    EditorGUILayout.PropertyField(selectedEventProperty.FindPropertyRelative("Container.LoopTime"));
                }
            }

            // Sounds
            EditorGUILayout.Space();

            if (selectedEvent.IsContinuous())
            {
                EditorGUILayout.PropertyField(selectedEventProperty.FindPropertyRelative("Container.CrossfadeTime"));
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Sounds");

            if (EditorGUILayoutExtensions.Button("Add"))
            {
                AddSound(selectedEvent);

                // Skip drawing sound inspector after adding a new sound.
                addedSound = true;
            }
            EditorGUILayout.EndHorizontal();
            return(addedSound);
        }
Пример #16
0
 private void RenderVariableToggles()
 {
     EditorGUILayoutExtensions.VerticalCheckBox(ref _numberToggles, 60 * _numberToggles.Length);
     EditorGUILayoutExtensions.Line();
 }
Пример #17
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            editorSettingsFoldout = EditorGUILayoutExtensions.FoldoutWithBoldLabel(editorSettingsFoldout, EditorSettingsContent);
            SessionState.SetBool(EditorSettingsFoldoutKey, editorSettingsFoldout);

            if (editorSettingsFoldout)
            {
                EditorGUI.indentLevel++;
                EditorGUI.BeginChangeCheck();

                GUI.enabled = RenderLinePreview;
                EditorGUI.BeginChangeCheck();
                LinePreviewResolution = EditorGUILayout.IntSlider("Preview Resolution", LinePreviewResolution, 2, 128);

                if (EditorGUI.EndChangeCheck())
                {
                    SessionState.SetInt(LinePreviewResolutionKey, LinePreviewResolution);
                }

                EditorGUI.BeginChangeCheck();
                DrawLinePoints = EditorGUILayout.Toggle("Draw Line Points", DrawLinePoints);

                if (EditorGUI.EndChangeCheck())
                {
                    SessionState.SetBool(DrawLinePointsKey, DrawLinePoints);
                }

                GUI.enabled = true;
                EditorGUI.BeginChangeCheck();
                DrawLineRotations = EditorGUILayout.Toggle("Draw Line Rotations", DrawLineRotations);

                if (EditorGUI.EndChangeCheck())
                {
                    SessionState.SetBool(DrawLineRotationsKey, DrawLineRotations);
                }

                if (DrawLineRotations)
                {
                    EditorGUI.BeginChangeCheck();
                    RotationArrowLength = EditorGUILayout.Slider("Rotation Arrow Length", RotationArrowLength, 0.01f, 5f);

                    if (EditorGUI.EndChangeCheck())
                    {
                        SessionState.SetFloat(RotationArrowLengthKey, RotationArrowLength);
                    }
                }

                EditorGUI.BeginChangeCheck();
                DrawLineManualUpVectors = EditorGUILayout.Toggle("Draw Manual Up Vectors", DrawLineManualUpVectors);

                if (EditorGUI.EndChangeCheck())
                {
                    SessionState.SetBool(DrawLineManualUpVectorsKey, DrawLineManualUpVectors);
                }

                if (DrawLineManualUpVectors)
                {
                    EditorGUI.BeginChangeCheck();
                    ManualUpVectorLength = EditorGUILayout.Slider("Manual Up Vector Length", ManualUpVectorLength, 1f, 10f);

                    if (EditorGUI.EndChangeCheck())
                    {
                        SessionState.SetFloat(ManualUpVectorLengthKey, ManualUpVectorLength);
                    }
                }

                if (EditorGUI.EndChangeCheck())
                {
                    SceneView.RepaintAll();
                }

                EditorGUI.indentLevel--;
            }

            if (transformMode.FoldoutWithBoldLabelPropertyField(BasicSettingsContent))
            {
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(customLineTransform);
                EditorGUILayout.PropertyField(lineStartClamp);
                EditorGUILayout.PropertyField(lineEndClamp);
                EditorGUILayout.PropertyField(loops);

                EditorGUI.indentLevel--;
            }

            if (rotationMode.FoldoutWithBoldLabelPropertyField(RotationSettingsContent))
            {
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(rotationMode);
                EditorGUILayout.PropertyField(flipUpVector);
                EditorGUILayout.PropertyField(originOffset);
                EditorGUILayout.PropertyField(velocitySearchRange);

                if (DrawLineManualUpVectors)
                {
                    manualUpVectorList.DoLayoutList();

                    if (GUILayout.Button("Normalize Up Vectors"))
                    {
                        for (int i = 0; i < manualUpVectors.arraySize; i++)
                        {
                            var manualUpVectorProperty = manualUpVectors.GetArrayElementAtIndex(i);

                            Vector3 upVector = manualUpVectorProperty.vector3Value;

                            if (upVector == Vector3.zero)
                            {
                                upVector = Vector3.up;
                            }

                            manualUpVectorProperty.vector3Value = upVector.normalized;
                        }
                    }

                    EditorGUILayout.PropertyField(manualUpVectorBlend);
                }

                EditorGUI.indentLevel--;
            }

            if (distortionMode.FoldoutWithBoldLabelPropertyField(DistortionSettingsContent))
            {
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(distortionMode);
                EditorGUILayout.PropertyField(distortionStrength);
                EditorGUILayout.PropertyField(uniformDistortionStrength);

                EditorGUI.indentLevel--;
            }

            serializedObject.ApplyModifiedProperties();
        }
    private void DrawPageNode(Node node)
    {
        if (_styles == null)
        {
            return;
        }
        GUILayout.BeginVertical(_styles[StyledElement.Box]);

        GUILayout.Label("Character", _styles[StyledElement.Label]);
        node.characterScrollPosition = GUILayout.BeginScrollView(node.characterScrollPosition);
        node.character = GUILayout.TextField(node.character, _styles[StyledElement.TextField]);
        GUILayout.EndScrollView();

        if (node.oldCharacter != node.character)
        {
            node.oldCharacter = node.character;
            node.ResetSize();
        }

        GUILayout.Label("Page Text", _styles[StyledElement.Label]);
        node.scrollPosition = GUILayout.BeginScrollView(node.scrollPosition);
        node.text           = GUILayout.TextArea(node.text, _styles[StyledElement.TextArea]);
        GUILayout.EndScrollView();
        if (node.oldText != node.text)
        {
            node.oldText = node.text;
            node.ResetSize();
        }

        GUILayout.BeginHorizontal();
        GUILayout.Label("Panel Color", _styles[StyledElement.Label]);
        node.panelColor = EditorGUILayout.ColorField(node.panelColor);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Text Speed", _styles[StyledElement.Label]);
        node.speed = EditorGUILayout.FloatField(node.speed, _styles[StyledElement.TextField]);
        GUILayout.EndHorizontal();

        GUILayout.Space(VisualNovelEditor.EditorWindowTabHeight / 2f);

        GUILayout.Label("Background", _styles[StyledElement.Label]);
        GUILayout.BeginHorizontal();
        //node.background = (Texture2D)EditorGUILayoutExtensions.ObjectFieldPlus<Texture2D>(node.background, typeof(Texture2D), false, _styles[StyledElement.ObjectField], 32134, GUILayout.Width(150f));
        node.background = (Texture2D)EditorGUILayout.ObjectField(node.background, typeof(Texture2D), false, GUILayout.Width(150f));
        EditorGUILayoutExtensions.BeginBackgroundColorGroup(new Color32(72, 72, 72, 255));

        EditorGUI.BeginDisabledGroup(!node.background);
        if (GUILayout.Button(!node.backgroundPreviewShown ? EditorGUIUtility.IconContent("icon dropdown") : new GUIContent(""), _styles[StyledElement.Button], GUILayout.Width(18f), GUILayout.Height(18f)))
        {
            node.backgroundPreviewShown = !node.backgroundPreviewShown;
        }
        EditorGUI.EndDisabledGroup();

        if (node.backgroundPreviewShown)
        {
            if (!node.background)
            {
                node.backgroundPreviewShown = false;
            }
        }

        EditorGUILayoutExtensions.EndBackgroundColorGroup();

        GUILayout.EndHorizontal();
        GUILayout.BeginVertical();
        GUILayout.Label("Character Sprite", _styles[StyledElement.Label]);
        //node.characterSprite = (Texture2D)EditorGUILayoutExtensions.ObjectFieldPlus<Texture2D>(node.characterSprite, typeof(Texture2D), false, _styles[StyledElement.ObjectField], 75342, GUILayout.Width(150f));
        node.characterSprite = (Sprite)EditorGUILayout.ObjectField(node.characterSprite, typeof(Sprite), false, GUILayout.Width(150f));
        if (node.characterSprite != null)
        {
            bool oldState = node.offsetCharacter;
            GUILayout.BeginHorizontal();
            GUILayout.Label("Offset Character Position", _styles[StyledElement.Label]);
            node.offsetCharacter = GUILayout.Toggle(node.offsetCharacter, "");
            GUILayout.EndHorizontal();
            if (oldState != node.offsetCharacter)
            {
                oldState = node.offsetCharacter;
                node.ResetSize();
            }
            if (node.offsetCharacter)
            {
                node.characterOffset = EditorGUILayout.Vector2Field("", node.characterOffset);
            }
            GUILayout.Label("Character Size", _styles[StyledElement.Label]);
            node.characterSize = EditorGUILayout.Vector2Field("", node.characterSize);
        }
        GUILayout.EndVertical();
        GUILayout.EndVertical();
    }
    private void DrawChoices(Node node, Vector2 mousePosition)
    {
        float x = node.window.center.x - (Choice.Size / 2f);
        float y = node.window.y + node.window.height + 10f;

        //foreach (Choice c in node.choices) { c.active = false; }

        for (int i = 0; i < node.choiceCount; i++)
        {
            x += Choice.Size + Choice.Padding;
            node.choices[i].bounds = new Rect(x - ((Choice.Size + Choice.Padding) / 2f) * (node.choiceCount + 1), y, Choice.Size, Choice.Size);
            node.choices[i].active = true;
            if (node.choices[i].joint != null)
            {
                node.choices[i].joint.bounds = node.choices[i].bounds;
            }
            // bool hover = node.choices[i].bounds.Contains(mousePosition);
            EditorGUI.DrawRect(node.choices[i].bounds, node.choices[i].joint.CheckForHover(mousePosition) ? Color.yellow : ColorExtensions.Orange);

            GUI.Label((i + 1) > 9 ? node.choices[i].bounds : new Rect(node.choices[i].bounds.x + 1, node.choices[i].bounds.y, node.choices[i].bounds.width, node.choices[i].bounds.height), (i + 1) + "", EditorGUILayoutExtensions.ChangeFontSettings(_styles[StyledElement.Label], Color.white, -1, TextAnchor.MiddleCenter));
        }

        UpdateChoicePaths(node);
    }
    private void DrawChoiceJoints(Node node, Vector2 mousePosition)
    {
        NodeJoint connectedJoint = null;

        foreach (NodeJoint j in node.joints)
        {
            if (j == null)
            {
                continue;
            }
            j.ownerID   = node.Index;
            j.ownerNode = node;
            if (j.IsConnected())
            {
                if (j.IsOutput)
                {
                    NodeJoint jnt = null;
                    if (j.connectionPoint.ownerNode != null)
                    {
                        jnt = j.connectionPoint.ownerNode.joints[j.connectionPoint.JointIndex];
                    }
                    else
                    {
                        jnt = VisualNovelEditor.FindJoint(j.connectionPoint.OwnerID, j.connectionPoint.JointIndex);
                    }
                    if (jnt != null)
                    {
                        //Choice c = node.FindChoiceFromJoint(j);
                        CalculateAndDrawBezier(j.bounds.center, jnt.bounds.center, j.info, jnt.info);
                    }
                }

                if (!j.isChoice)
                {
                    connectedJoint = j;
                }


                GUI.Label(new Rect(new Vector2(j.bounds.position.x + j.bounds.width + 10f, j.bounds.position.y), new Vector2(50, 50)), j.connectionPoint.OwnerID + " " + (j.IsOutput ? "OUT" : "IN"), EditorGUILayoutExtensions.ChangeTextColor(_styles[StyledElement.Label], Color.white));
            }
        }
        if (node.TopJoint == connectedJoint || connectedJoint == null)
        {
            EditorGUI.DrawRect(node.TopJoint.bounds, node.Outputting && !node.TopJoint.IsConnected() ? Color.magenta : node.TopJoint.CheckForHover(mousePosition) ? Color.yellow : Color.red);
            node.TopJoint.disabled = false;
        }
        else
        {
            if (!node.TopJoint.disabled)
            {
                node.TopJoint.disabled = true;
            }
        }
        if (node.LeftJoint == connectedJoint || connectedJoint == null)
        {
            EditorGUI.DrawRect(node.LeftJoint.bounds, node.Outputting && !node.LeftJoint.IsConnected() ? Color.magenta : node.LeftJoint.CheckForHover(mousePosition) ? Color.yellow : Color.red);
            node.LeftJoint.disabled = false;
        }
        else
        {
            if (!node.LeftJoint.disabled)
            {
                node.LeftJoint.disabled = true;
            }
        }
        if (node.RightJoint == connectedJoint || connectedJoint == null)
        {
            EditorGUI.DrawRect(node.RightJoint.bounds, node.Outputting && !node.RightJoint.IsConnected() ? Color.magenta : node.RightJoint.CheckForHover(mousePosition) ? Color.yellow : Color.red);
            node.RightJoint.disabled = false;
        }
        else
        {
            if (!node.RightJoint.disabled)
            {
                node.RightJoint.disabled = true;
            }
        }

        node.BottomJoint.disabled = true;

        DrawChoices(node, mousePosition);
    }
    private void DrawChoiceNode(Node n)
    {
        DrawPageNode(n);
        GUILayout.BeginVertical(_styles[StyledElement.Box], GUILayout.ExpandHeight(false));
        GUIStyle foldoutStyle = new GUIStyle(EditorStyles.foldout);

        n.choicesShown = EditorGUILayout.Foldout(n.choicesShown, "Choices", EditorGUILayoutExtensions.ChangeTextColor(foldoutStyle, Color.white));
        if (n.choices == null)
        {
            n.choices = new Choice[n.choiceCount];
        }
        else
        {
            if (n.choiceCount != n.oldChoiceCount)
            {
                n.oldChoiceCount = n.choiceCount;
                n.ResetSize();
            }
        }
        if (n.choicesShown)
        {
            c_canResetSize = true;
            GUILayout.BeginHorizontal();
            GUILayout.Space(8f);
            GUILayout.Label("Choice Count", _styles[StyledElement.Label]);
            n.choiceCount = EditorGUILayout.IntField(n.choiceCount, _styles[StyledElement.TextField], GUILayout.MaxWidth(30f));
            n.choiceCount = Mathf.Clamp(n.choiceCount, 1, Node.ChoiceLimit);

            if (n.choiceCount != n.oldChoiceCount && n.oldChoiceCount != 0)
            {
                //Debug.Log("CHANGE FROM " + n.oldChoiceCount + " TO " + n.choiceCount);
                n.oldChoiceCount = n.choiceCount;
                NodeJoint[] lostJoints = n.CalculateLostChoices();
                foreach (NodeJoint joint in lostJoints)
                {
                    VisualNovelEditor.ResetNodeJoint(joint);
                }
            }
            else if (n.oldChoiceCount == 0)
            {
                n.oldChoiceCount = n.choiceCount;
            }
            GUILayout.EndHorizontal();
            for (int i = 0; i < n.choiceCount; i++)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Space(8f);
                GUILayout.Label("Choice " + (i + 1), _styles[StyledElement.Label]);
                n.choices[i].choiceText = GUILayout.TextField(n.choices[i].choiceText ?? "", _styles[StyledElement.TextField], GUILayout.MaxWidth(100f), GUILayout.MaxHeight(_styles[StyledElement.TextField].fixedHeight));
                if (n.choices[i].choiceText != n.choices[i].oldChoiceText)
                {
                    n.choices[i].oldChoiceText = n.choices[i].choiceText;
                    n.ResetSize();
                }
                GUILayout.EndHorizontal();
            }
        }
        else
        {
            if (c_canResetSize)
            {
                c_canResetSize = false;
                n.ResetSize();
            }
        }
        GUILayout.EndVertical();
    }
Пример #22
0
    protected override void OnInspectorGUIDraw()
    {
        // Density
        _object.Density =
            Mathf.Clamp(
                EditorGUILayout.FloatField(
                    new GUIContent(
                        "Density",
                        "The object density in kg/m^3"
                        ),
                    _object.Density),
                0.1f,
                float.PositiveInfinity);

        // CalculateMassFromDensity
        _object.CalculateMassFromDensity =
            EditorGUILayoutExtensions.ToggleFixedWidth(
                new GUIContent(
                    "Calculate mass from density",
                    "If checked, the density value will be used, otherwise density will be approximated from the objects volume and mass"
                    ),
                _object.CalculateMassFromDensity
                );

        // Resolution
        _object.Resolution =
            EditorGUILayout.IntSlider(
                new GUIContent(
                    "Quality",
                    "The number of subdivisions to approximate the object volume with voxels. " +
                    "Value of 1 is usually enough for cube-shaped object. " +
                    "Value of 2-3 is good for most objects with regular shape. " +
                    "You may want to set this value high enough if your " +
                    "object has an irregular shape (i.e. a boat). "
                    ),
                _object.Resolution,
                1,
                15);

        // ProcessChildren
        _object.ProcessChildren =
            EditorGUILayout.Toggle(
                new GUIContent(
                    "Process children",
                    "If checked, children colliders will be included in calculations"
                    ),
                _object.ProcessChildren
                );

        _object.DragInFluid =
            Mathf.Clamp(
                EditorGUILayout.FloatField(
                    new GUIContent(
                        "Drag in fluid",
                        "The additional drag for when the object is in contact with the fluid"
                        ),
                    _object.DragInFluid
                    ),
                0f,
                float.PositiveInfinity
                );

        // AngularDragInFluid
        _object.AngularDragInFluid =
            Mathf.Clamp(
                EditorGUILayout.FloatField(
                    new GUIContent(
                        "Angular drag in fluid",
                        "The additional angular drag for when the object is in contact with the fluid"
                        ),
                    _object.AngularDragInFluid),
                0f,
                float.PositiveInfinity
                );

        // SplashForceFactor
        _object.SplashForceFactor =
            EditorGUILayout.Slider(
                new GUIContent(
                    "Splash force factor",
                    "Force multiplie factor that will be attached to the waves produced by the floating object. " +
                    "For an object of relatively small size, do not set this value high, " +
                    "as the object will bounce on his own waves endlessly. "
                    ),
                _object.SplashForceFactor,
                0f,
                50f
                );

        // MaxSplashForce
        _object.MaxSplashForce =
            EditorGUILayout.Slider(
                new GUIContent(
                    "Max splash force",
                    "The absolute maximum value of force applied to the water when creating splashes"
                    ),
                _object.MaxSplashForce,
                0f,
                50f
                );
    }
        public override void OnInspectorGUI()
        {
            RenderHeader("The Input System Profile helps developers configure input no matter what platform you're building for.");

            serializedObject.Update();
            EditorGUI.BeginChangeCheck();

            EditorGUILayout.PropertyField(focusProviderType, FocusProviderContent);
            EditorGUILayout.PropertyField(gazeProviderType, GazeProviderContent);
            EditorGUILayout.PropertyField(gazeCursorPrefab);

            EditorGUILayout.Space();

            showGlobalPointerOptions = EditorGUILayoutExtensions.FoldoutWithBoldLabel(showGlobalPointerOptions, GlobalPointerSettingsContent, true);

            if (showGlobalPointerOptions)
            {
                EditorGUILayout.HelpBox("Global pointer options applied to all controllers that support pointers. You may override these globals per controller mapping profile.", MessageType.Info);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(pointingExtent);
                EditorGUILayout.Space();
                EditorGUILayout.PropertyField(pointerRaycastLayerMasks, true);
                EditorGUILayout.Space();

                EditorGUI.BeginChangeCheck();
                EditorGUI.indentLevel--;
                var newValue = EditorGUILayout.ToggleLeft(new GUIContent(drawDebugPointingRays.displayName, drawDebugPointingRays.tooltip), drawDebugPointingRays.boolValue);
                EditorGUI.indentLevel++;

                if (EditorGUI.EndChangeCheck())
                {
                    drawDebugPointingRays.boolValue = newValue;
                }

                EditorGUILayout.Space();
                EditorGUILayout.PropertyField(debugPointingRayColors, true);
                EditorGUI.indentLevel--;
            }

            EditorGUILayout.Space();

            showGlobalHandOptions = EditorGUILayoutExtensions.FoldoutWithBoldLabel(showGlobalHandOptions, GlobalHandSettingsContent, true);

            if (showGlobalHandOptions)
            {
                EditorGUILayout.HelpBox("Global hand tracking options applied to all platforms that support hand tracking. You may override these globals per platform in the platform's hand controller data provider profile.", MessageType.Info);
                EditorGUI.indentLevel++;
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Hand Rendering Settings", EditorStyles.boldLabel);
                EditorGUILayout.PropertyField(renderingMode);
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Hand Physics Settings", EditorStyles.boldLabel);
                EditorGUILayout.PropertyField(handPhysicsEnabled);
                EditorGUILayout.PropertyField(useTriggers);
                EditorGUILayout.PropertyField(boundsMode);
                poseProfilesList.DoLayoutList();
                EditorGUI.indentLevel--;
            }

            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(inputActionsProfile);
            EditorGUILayout.PropertyField(speechCommandsProfile);
            EditorGUILayout.PropertyField(gesturesProfile);

            EditorGUILayout.Space();

            showAggregatedSimpleControllerMappingProfiles = EditorGUILayoutExtensions.FoldoutWithBoldLabel(showAggregatedSimpleControllerMappingProfiles, ShowControllerMappingsContent);

            if (showAggregatedSimpleControllerMappingProfiles)
            {
                foreach (var controllerMappingProfile in controllerMappingProfiles)
                {
                    var(dataProviderProfile, mappingProfile) = controllerMappingProfile.Value;
                    var profileEditor = CreateEditor(dataProviderProfile);

                    if (profileEditor is BaseMixedRealityControllerDataProviderProfileInspector inspector)
                    {
                        inspector.RenderControllerMappingButton(mappingProfile);
                    }
                }
            }

            serializedObject.ApplyModifiedProperties();

            if (EditorGUI.EndChangeCheck() &&
                MixedRealityToolkit.IsInitialized)
            {
                EditorApplication.delayCall += () => MixedRealityToolkit.Instance.ResetProfile(MixedRealityToolkit.Instance.ActiveProfile);
            }

            base.OnInspectorGUI();
        }
Пример #24
0
        protected virtual void OnPropertiesGUI()
        {
            var generatorType = _generator.GetType();
            var property      = _serializedGenerator.GetIterator();

            if (property.NextVisible(true))
            {
                do
                {
                    var field = generatorType.GetField(property.name);
                    if (field == null)
                    {
                        continue;
                    }
                    if (field.FieldType == typeof(OutputSlot))
                    {
                        continue;
                    }
                    if (field.FieldType == typeof(OutputSlot[]))
                    {
                        continue;
                    }
                    if (field.FieldType == typeof(List <OutputSlot>))
                    {
                        continue;
                    }
                    if (!IsInAssetGeneratorSubclass(field))
                    {
                        continue;
                    }

                    var labelAttribute = GeneralUtility.GetAttribute <LabelAttribute>(field);
                    var labelContent   = new GUIContent(
                        labelAttribute != null ? labelAttribute.text : property.displayName,
                        property.tooltip);

                    if (field.FieldType == typeof(InputSlot))
                    {
                        var input = (InputSlot)field.GetValue(property.serializedObject.targetObject);
                        if (input.isActive)
                        {
                            InputSlotEditor.OnInspectorGUI(labelContent, input, InputSlot.ShouldAutoSelect(field));
                        }
                    }
                    else if (field.FieldType == typeof(RandomnessDescriptor))
                    {
                        var randomness = (RandomnessDescriptor)field.GetValue(property.serializedObject.targetObject);
                        randomness = RandomnessDescriptorEditor.OnInspectorGUI(labelContent, randomness);
                        field.SetValue(property.serializedObject.targetObject, randomness);
                    }
                    else if (typeof(Component).IsAssignableFrom(field.FieldType))
                    {
                        field.SetValue(property.serializedObject.targetObject, EditorGUILayoutExtensions.ObjectField(labelContent, property.objectReferenceValue, field.FieldType, false));
                    }
                    else
                    {
                        EditorGUILayout.PropertyField(property, labelContent, true);
                    }
                } while (property.NextVisible(false));
            }
        }
Пример #25
0
    protected override void OnInspectorGUIDraw()
    {
        base.OnInspectorGUIDraw();

        DynamicWater _objectDW = _object as DynamicWater;

        if (_objectDW == null)
        {
            return;
        }

        // Quality
        _objectDW.Quality = EditorGUILayout.IntSlider(
            new GUIContent(
                "Quality",
                "Simulation grid resolution. " +
                "The higher the value - the more detailed the simulation will look"
                ),
            _objectDW.Quality,
            4,
            256
            );

        // Damping
        _objectDW.Damping =
            EditorGUILayout.Slider(
                new GUIContent(
                    "Damping",
                    "The higher the value, the faster the waves will dissipate. " +
                    "Optimal value for water is around 0.03. " +
                    "Value of 0 corresponds to absence of any damping, " +
                    "which could lead to simulation instability"
                    ),
                _objectDW.Damping,
                0f,
                1f
                );

        // Speed
        _objectDW.Speed =
            EditorGUILayout.Slider(
                new GUIContent(
                    "Speed",
                    "Wave propagation speed"
                    ),
                _objectDW.Speed,
                0f,
                _objectDW.MaxSpeed()
                );

        // UsePlaneCollider
        _objectDW.UsePlaneCollider =
            EditorGUILayout.Toggle(
                new GUIContent(
                    "Use plane collider",
                    "Whether to generate the static plane collider on initialization. " +
                    "Can be used for easier interaction."
                    ),
                _objectDW.UsePlaneCollider
                );

        // UpdateWhenNotVisible
        _objectDW.UpdateWhenNotVisible =
            EditorGUILayoutExtensions.ToggleFixedWidth(
                new GUIContent(
                    "Update when not visible",
                    "If checked, the simulation would be running even if the water is not visible"
                    ),
                _objectDW.UpdateWhenNotVisible
                );

        /* Obstructions */
        EditorGUILayout.HelpBox("Obstructions", MessageType.None, true);

        // UseObstructions
        _objectDW.UseObstructions =
            EditorGUILayoutExtensions.ToggleFixedWidth(
                new GUIContent(
                    "Use obstruction geometry",
                    "Whether to calculate where the simulation field is obstructed with GameObjects with tag DynamicWaterObstruction. " +
                    "This can be used to simulate complex shapes such as pond banks"
                    ),
                _objectDW.UseObstructions
                );

        // ObstructionMask
        Texture2D oldTexture = _objectDW.ObstructionMask;

        _objectDW.ObstructionMask =
            (Texture2D)EditorGUILayout.ObjectField(
                new GUIContent(
                    "Obstruction mask",
                    ""
                    ),
                _objectDW.ObstructionMask,
                typeof(Texture2D),
                false
                );
        Texture2D newTexture = _objectDW.ObstructionMask;

        if (oldTexture != newTexture)
        {
            if (!TextureImporterHelper.GetTextureIsReadable(newTexture))
            {
                if (EditorUtility.DisplayDialog(
                        "Texture not readable",
                        "This texture is not readable, which is required to use it as obstruction mask.\n" +
                        "Make the texture readable?",
                        "OK",
                        "Cancel"
                        ))
                {
                    TextureImporterHelper.SetTextureIsReadable(newTexture, true);
                }
                else
                {
                    _objectDW.ObstructionMask = null;
                }
            }
        }

        /* Advanced */
        GUILayout.Label("Advanced", EditorStylesInternal.helpBox, GUILayout.Width(130));

        // ObstructionDataErosion
        _objectDW.ObstructionDataErosion =
            EditorGUILayoutExtensions.IntSliderFixedWidth(
                new GUIContent(
                    "Obstruction data erosion",
                    "Indicates how much the obstruction field data will eroded (expanded or shrinked). " +
                    "This can be used for dealing with edge artifacts that can occur when using obstruction data"
                    ),
                _objectDW.ObstructionDataErosion,
                -10,
                10
                );

        // MeshBakeObstructionData
        _objectDW.MeshBakeObstructionData =
            EditorGUILayoutExtensions.ToggleFixedWidth(
                new GUIContent(
                    "Bake obstruction data into mesh",
                    "Whether the obstruction field data will be baked into water mesh vertex colors.\n" +
                    "In the vertex color, red channel corresponds to the additinal dampening in that point," +
                    "where value of 255 means zero dampening and value of 1 means maximum dampening.\n" +
                    "0 is a special value that corresponds to the situation when the vertex " +
                    "is fully obstructed by obstruction geometry. In this case, a value of 255" +
                    "is additionaly written to the blue channel.\n" +
                    "You can use this data for more advanced shading, for example, discard fragments that are" +
                    "fully obstructed"
                    ),
                _objectDW.MeshBakeObstructionData
                );

        /* Rendering */
        EditorGUILayout.HelpBox("Rendering", MessageType.None, true);

        // CalculateNormals
        _objectDW.CalculateNormals =
            EditorGUILayout.Toggle(
                new GUIContent(
                    "Calculate normals",
                    "Whether the water mesh normals should be calculated"
                    ),
                _objectDW.CalculateNormals
                );

        GUI.enabled = _objectDW.CalculateNormals;
        EditorGUI.indentLevel++;

        // UseFastNormals
        _objectDW.UseFastNormals =
            EditorGUILayout.Toggle(
                new GUIContent(
                    "Fast normalization",
                    "Indicates whether the fast approximate method of calculating water mesh normals should be used.\n" +
                    "Enabling this could provide a huge performance boost with the cost of a bit degraded quality. " +
                    "Especially useful on mobile devices"
                    ),
                _objectDW.UseFastNormals
                );

        EditorGUI.indentLevel--;
        GUI.enabled = true;

        // SetTangents
        _objectDW.SetTangents =
            EditorGUILayout.Toggle(
                new GUIContent(
                    "Set mesh tangents",
                    "Whether the water mesh tangents must be set (usually for bump-mapped shaders).\n" +
                    "Enabling this may sometimes result in performance drop on high " +
                    "Quality levels. It is better to turn it off in case " +
                    "your shader doesn't uses tangents"
                    ),
                _objectDW.SetTangents
                );
    }
        public override void OnInspectorGUI()
        {
            RenderHeader("This profile defines a hand pose that can be recognized at runtime and trigger input events.");

            serializedObject.Update();

            description.isExpanded = EditorGUILayoutExtensions.FoldoutWithBoldLabel(description.isExpanded, generalSettingsHeader);
            if (description.isExpanded)
            {
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(id);
                EditorGUILayout.PropertyField(description);
                EditorGUILayout.PropertyField(data);

                EditorGUI.indentLevel--;
            }

            EditorGUILayout.Space();

            isDefault.isExpanded = EditorGUILayoutExtensions.FoldoutWithBoldLabel(isDefault.isExpanded, simulationSettingsHeader);
            if (isDefault.isExpanded)
            {
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(isDefault);
                EditorGUILayout.PropertyField(keyCode);

                EditorGUI.indentLevel--;
            }

            EditorGUILayout.Space();

            didBake.isExpanded = EditorGUILayoutExtensions.FoldoutWithBoldLabel(didBake.isExpanded, bakeSettingsHeader);
            if (didBake.isExpanded)
            {
                if (!didBake.boolValue)
                {
                    EditorGUILayout.HelpBox($"This hand pose hasn't been baked yet. In order for the pose to be recognized when running your application you need to bake it," +
                                            $" which will precompute important data and save performance.", MessageType.Warning);
                }

                if (GUILayout.Button(didBake.boolValue ? updateBakeButtonContent : bakeButtonContent))
                {
                    BakePoseData();
                }
            }

            EditorGUILayout.Space();

            infoExpanded = EditorGUILayoutExtensions.FoldoutWithBoldLabel(infoExpanded, infoHeader);
            if (infoExpanded)
            {
                EditorGUI.indentLevel++;

                if (didBake.boolValue)
                {
                    EditorGUILayout.LabelField($"Baked Is Gripping:\t\t{isGripping.boolValue}");
                    EditorGUILayout.LabelField($"Baked Grip Strength:\t\t{gripStrength.floatValue}");
                    EditorGUILayout.LabelField($"Baked Thumb Curl:\t\t{fingerCurlStrengths.GetArrayElementAtIndex((int)HandFinger.Thumb).floatValue}");
                    EditorGUILayout.LabelField($"Baked Index Curl:\t\t{fingerCurlStrengths.GetArrayElementAtIndex((int)HandFinger.Index).floatValue}");
                    EditorGUILayout.LabelField($"Baked Middle Curl:\t\t{fingerCurlStrengths.GetArrayElementAtIndex((int)HandFinger.Middle).floatValue}");
                    EditorGUILayout.LabelField($"Baked Ring Curl:\t\t{fingerCurlStrengths.GetArrayElementAtIndex((int)HandFinger.Ring).floatValue}");
                    EditorGUILayout.LabelField($"Baked Little Curl:\t\t{fingerCurlStrengths.GetArrayElementAtIndex((int)HandFinger.Little).floatValue}");
                }
                else
                {
                    EditorGUILayout.HelpBox("Bake the hand pose to see baked information here.", MessageType.Info);
                }

                EditorGUI.indentLevel--;
            }

            serializedObject.ApplyModifiedProperties();
        }