예제 #1
0
        /** Gui drawn if the selected object does not have a valid and initialised hull painter on it
         */
        private void DrawInactiveGui()
        {
            if (Selection.transforms.Length == 1)
            {
                // Have a single scene selection, is it viable?

                GameObject       selectedObject = Selection.transforms[0].gameObject;
                MeshFilter       srcMesh        = SelectionUtil.FindSelectedMeshFilter();
                HullPainterChild child          = SelectionUtil.FindSelectedHullPainterChild();

                if (srcMesh != null)
                {
                    GUILayout.Space(10);
                    GUILayout.Label("Generate an asset to start painting:");
                    CommonUi.DrawGenerateOrReconnectGui(selectedObject, srcMesh.sharedMesh);
                }
                else if (child != null)
                {
                    GUILayout.Space(10);
                    GUILayout.Label("Child hulls are not edited directly - select the parent to continue painting this hull");
                }
                else
                {
                    // No mesh filter, might have a hull painter (or not)

                    GUILayout.Space(10);
                    GUILayout.Label("To start painting, select a single scene object");
                    GUILayout.Label("The object must contain a MeshFilter");

                    GUILayout.Space(10);
                    GUILayout.Label("No MeshFilter on selected object", EditorStyles.centeredGreyMiniLabel);
                }
            }
            else
            {
                // No single scene selection
                // Could be nothing selected
                // Could be multiple selection
                // Could be an asset in the project selected

                GUILayout.Space(10);
                GUILayout.Label("To start painting, select a single scene object");
                GUILayout.Label("The object must contain a MeshFilter");

                if (GUILayout.Button("Open quick start guide"))
                {
                    string projectPath = Application.dataPath.Replace("Assets", "");
                    string docsPdf     = projectPath + FindInstallPath() + "Technie Collider Creator Readme.pdf";
                    Application.OpenURL(docsPdf);
                }
            }
        }
예제 #2
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!");
                    }
                }
            }
        }
예제 #3
0
        /** Gui drawn if the selected object does not have a valid and initialised hull painter on it
         */
        private void DrawInactiveGui()
        {
            if (Selection.transforms.Length == 1)
            {
                // Have a single scene selection, is it viable?

                GameObject selectedObject = Selection.transforms[0].gameObject;
                MeshFilter srcMesh        = SelectionUtil.FindSelectedMeshFilter();

                if (srcMesh != null)
                {
                    GUILayout.Space(10);
                    GUILayout.Label("Generate an asset to start painting:");
                    CommonUi.DrawGenerateOrReconnectGui(selectedObject, srcMesh.sharedMesh);
                }
                else
                {
                    // No mesh filter, might have a hull painter (or not)

                    GUILayout.Space(10);
                    GUILayout.Label("To start painting, select a single scene object");
                    GUILayout.Label("The object must contain a MeshFilter");

                    GUILayout.Space(10);
                    GUILayout.Label("No MeshFilter on selected object", EditorStyles.centeredGreyMiniLabel);
                }
            }
            else
            {
                // No single scene selection
                // Could be nothing selected
                // Could be multiple selection
                // Could be an asset in the project selected

                GUILayout.Space(10);
                GUILayout.Label("To start painting, select a single scene object");
                GUILayout.Label("The object must contain a MeshFilter");
            }
        }
        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!");
                    }
                }
            }
        }