コード例 #1
0
        public void OnSceneGUI()
        {
            if (HullPainterWindow.IsOpen())
            {
                HullPainterWindow window = HullPainterWindow.instance;

                window.OnSceneGUI();

                if (Event.current.commandName == "UndoRedoPerformed")
                {
                    window.Repaint();
                }
            }
        }
コード例 #2
0
ファイル: HullPainterEditor.cs プロジェクト: jalin0315/030
        // NB: If Gizmos are disabled then OnSceneGUI is not called
        // From 2019.1 onward the HullPainterWindow uses OnBeforeSceneGUI so this might be redundant
        // (but still needed for 2018 etc.)
        public void OnSceneGUI()
        {
            if (HullPainterWindow.IsOpen())
            {
                HullPainterWindow window = HullPainterWindow.instance;

#if !UNITY_2019_1_OR_NEWER
                window.OnSceneGUI();
#endif

                if (Event.current.commandName == "UndoRedoPerformed")
                {
                    window.Repaint();
                }
            }
        }
コード例 #3
0
ファイル: HullPainterEditor.cs プロジェクト: jalin0315/030
        public override void OnInspectorGUI()
        {
            if (technieIcon == null)
            {
                string installPath = HullPainterWindow.FindInstallPath();
                technieIcon = AssetDatabase.LoadAssetAtPath <Texture>(installPath + "TechnieIcon.png");
            }

            if (HullPainterWindow.IsOpen())
            {
                HullPainterWindow window = HullPainterWindow.instance;

                window.OnInspectorGUI();
            }

            HullPainter selectedPainter = SelectionUtil.FindSelectedHullPainter();

            if (selectedPainter != null)
            {
                if (selectedPainter.paintingData != null &&
                    selectedPainter.hullData != null)
                {
                    if (GUILayout.Button(new GUIContent("Open Hull Painter", technieIcon)))
                    {
                        EditorWindow.GetWindow(typeof(HullPainterWindow));
                    }
                }
                else
                {
                    MeshFilter srcMeshFilter = selectedPainter.gameObject.GetComponent <MeshFilter>();
                    Mesh       srcMesh       = srcMeshFilter != null ? srcMeshFilter.sharedMesh : null;
                    if (srcMesh != null)
                    {
                        CommonUi.DrawGenerateOrReconnectGui(selectedPainter.gameObject, srcMesh);
                    }
                    else
                    {
                        GUILayout.Label("No mesh on current object!");
                    }
                }
            }
        }
コード例 #4
0
        public override void OnInspectorGUI()
        {
            if (HullPainterWindow.IsOpen())
            {
                HullPainterWindow window = HullPainterWindow.instance;

                window.OnInspectorGUI();
            }

            HullPainter selectedPainter = SelectionUtil.FindSelectedHullPainter();

            if (selectedPainter != null)
            {
                if (selectedPainter.paintingData != null &&
                    selectedPainter.hullData != null)
                {
                    if (GUILayout.Button("Open Hull Painter"))
                    {
                        EditorWindow.GetWindow(typeof(HullPainterWindow));
                    }
                }
                else
                {
                    MeshFilter srcMeshFilter = selectedPainter.gameObject.GetComponent <MeshFilter>();
                    Mesh       srcMesh       = srcMeshFilter != null ? srcMeshFilter.sharedMesh : null;
                    if (srcMesh != null)
                    {
                        CommonUi.DrawGenerateOrReconnectGui(selectedPainter.gameObject, srcMesh);
                    }
                    else
                    {
                        GUILayout.Label("No mesh on current object!");
                    }
                }
            }
        }