예제 #1
0
        void OnEnable()
        {
            string installPath = FindInstallPath();

            addHullIcon = AssetDatabase.LoadAssetAtPath <Texture> (installPath + "AddHullIcon.png");
            errorIcon   = AssetDatabase.LoadAssetAtPath <Texture> (installPath + "ErrorIcon.png");
            deleteIcon  = AssetDatabase.LoadAssetAtPath <Texture> (installPath + "DeleteIcon.png");

            paintOnIcon  = AssetDatabase.LoadAssetAtPath <Texture> (installPath + "PaintOnIcon.png");
            paintOffIcon = AssetDatabase.LoadAssetAtPath <Texture> (installPath + "PaintOffIcon.png");

            triggerOnIcon  = AssetDatabase.LoadAssetAtPath <Texture> (installPath + "TriggerOnIcon.png");
            triggerOffIcon = AssetDatabase.LoadAssetAtPath <Texture> (installPath + "TriggerOffIcon.png");

            Texture icon = AssetDatabase.LoadAssetAtPath <Texture> (installPath + "TechnieIcon.png");

#if UNITY_5_0
            this.title = "Hull Painter";
#else
            this.titleContent = new GUIContent("Hull Painter", icon, "Technie Hull Painter");
#endif

            sceneManipulator = new SceneManipulator();

            isOpen   = true;
            instance = this;
        }
예제 #2
0
        void OnDestroy()
        {
            //	Debug.Log("WINDOW.OnDestroy");

            SceneView.onSceneGUIDelegate -= this.OnSceneGUI;

            sceneManipulator.Destroy();
            sceneManipulator = null;

            isOpen   = false;
            instance = null;
        }
        public void OnSceneGUI()
        {
            if (HullPainterWindow.IsOpen())
            {
                HullPainterWindow window = HullPainterWindow.instance;

                window.OnSceneGUI();

                if (Event.current.commandName == "UndoRedoPerformed")
                {
                    window.Repaint();
                }
            }
        }
예제 #4
0
        // 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();
                }
            }
        }
예제 #5
0
        void OnEnable()
        {
            string installPath = FindInstallPath();

            dividerColour = new Color(116.0f / 255.0f, 116.0f / 255.0f, 116.0f / 255.0f);

            addHullIcon = AssetDatabase.LoadAssetAtPath <Texture> (installPath + "AddHullIcon.png");
            errorIcon   = AssetDatabase.LoadAssetAtPath <Texture> (installPath + "ErrorIcon.png");
            deleteIcon  = AssetDatabase.LoadAssetAtPath <Texture> (installPath + "DeleteIcon.png");

            paintOnIcon  = AssetDatabase.LoadAssetAtPath <Texture> (installPath + "PaintOnIcon.png");
            paintOffIcon = AssetDatabase.LoadAssetAtPath <Texture> (installPath + "PaintOffIcon.png");

            triggerOnIcon  = AssetDatabase.LoadAssetAtPath <Texture> (installPath + "TriggerOnIcon.png");
            triggerOffIcon = AssetDatabase.LoadAssetAtPath <Texture> (installPath + "TriggerOffIcon.png");

            isChildIcon  = AssetDatabase.LoadAssetAtPath <Texture>(installPath + "TriggerOnIcon.png");
            nonChildIcon = AssetDatabase.LoadAssetAtPath <Texture>(installPath + "TriggerOffIcon.png");

            preciseBrushIcon = AssetDatabase.LoadAssetAtPath <Texture>(installPath + "PreciseBrushIcon.png");
            smallBrushIcon   = AssetDatabase.LoadAssetAtPath <Texture>(installPath + "SmallBrushIcon.png");
            mediumBrushIcon  = AssetDatabase.LoadAssetAtPath <Texture>(installPath + "MediumBrushIcon.png");
            largeBrushIcon   = AssetDatabase.LoadAssetAtPath <Texture>(installPath + "LargeBrushIcon.png");

            pipetteIcon = AssetDatabase.LoadAssetAtPath <Texture>(installPath + "PipetteIcon.png");

            hullVisibleIcon   = AssetDatabase.LoadAssetAtPath <Texture>(installPath + "HullVisibleIcon.png");
            hullInvisibleIcon = AssetDatabase.LoadAssetAtPath <Texture>(installPath + "HullInvisibleIcon.png");

            toolsIcons   = AssetDatabase.LoadAssetAtPath <Texture>(installPath + "ToolsIcon.png");
            hullsIcon    = AssetDatabase.LoadAssetAtPath <Texture>(installPath + "HullIcon.png");
            settingsIcon = AssetDatabase.LoadAssetAtPath <Texture>(installPath + "SettingsIcon.png");
            assetsIcon   = AssetDatabase.LoadAssetAtPath <Texture>(installPath + "AssetsIcon.png");

            Texture icon = AssetDatabase.LoadAssetAtPath <Texture> (installPath + "TechnieIcon.png");

#if UNITY_5_0
            this.title = "Hull Painter";
#else
            this.titleContent = new GUIContent("Hull Painter", icon, "Technie Hull Painter");
#endif

            sceneManipulator = new SceneManipulator();

            isOpen   = true;
            instance = this;
        }
예제 #6
0
        void OnDestroy()
        {
#if UNITY_2019_1_OR_NEWER
            SceneView.duringSceneGui -= this.OnSceneGUI;
            SceneView.beforeSceneGui -= this.OnBeforeSceneGUI;
#else
            SceneView.onSceneGUIDelegate -= this.OnSceneGUI;
#endif

            if (sceneManipulator != null)
            {
                sceneManipulator.Destroy();
                sceneManipulator = null;
            }

            isOpen   = false;
            instance = null;
        }
예제 #7
0
        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!");
                    }
                }
            }
        }
        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!");
                    }
                }
            }
        }