Ejemplo n.º 1
0
        protected void DoOpenEndedInspector <U>(SerializedProperty isOpenEndedProperty) where U : PathEditorTool <T>
        {
            serializedObject.Update();

            using (var check = new EditorGUI.ChangeCheckScope())
            {
                EditorGUILayout.PropertyField(isOpenEndedProperty);

                if (check.changed)
                {
                    if (EditorToolManager.IsActiveTool <U>() && EditorToolManager.IsAvailable <U>())
                    {
                        var paths = EditorToolManager.GetEditorTool <U>().paths;

                        foreach (var path in paths)
                        {
                            path.undoObject.RegisterUndo("Set Open Ended");
                            path.isOpenEnded = isOpenEndedProperty.boolValue;
                        }
                    }
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 2
0
 protected void DoSnappingInspector <U>() where U : PathEditorTool <T>
 {
     if (EditorToolManager.IsActiveTool <U>() && EditorToolManager.IsAvailable <U>())
     {
         var tool = EditorToolManager.GetEditorTool <U>();
         tool.enableSnapping = EditorGUILayout.Toggle(Contents.snappingLabel, tool.enableSnapping);
     }
 }
Ejemplo n.º 3
0
        protected void DoPathInspector <U>() where U : PathEditorTool <T>
        {
            if (EditorToolManager.IsActiveTool <U>() && EditorToolManager.IsAvailable <U>())
            {
                var paths = EditorToolManager.GetEditorTool <U>().paths;

                CreateCachedEditor(paths, null, ref m_CachedEditor);

                if (m_CachedEditor == null) //Needed to avoid a nullref on exiting playmode
                {
                    return;
                }

                using (var check = new EditorGUI.ChangeCheckScope())
                {
                    m_CachedEditor.OnInspectorGUI();

                    if (check.changed)
                    {
                        EditorToolManager.GetEditorTool <U>().SetShapes();
                    }
                }
            }
        }