Пример #1
0
 internal void Init(SplineMesh e, SplineMesh.Channel.MeshDefinition d)
 {
     minSize    = new Vector2(482, 180);
     extrude    = e;
     definition = d;
     if (definition.mesh != null)
     {
         titleContent = new GUIContent("Configure " + definition.mesh.name);
     }
     else
     {
         titleContent = new GUIContent("Configure Mesh");
     }
 }
Пример #2
0
        void MeshRow(SplineMesh.Channel channel, int index)
        {
            SplineMesh.Channel.MeshDefinition definition = channel.GetMesh(index);
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(15);
            if (definition.mesh == null)
            {
                GUILayout.Box("NULL", EditorStyles.helpBox, GUILayout.MinWidth(200));
            }
            else
            {
                GUILayout.Box(definition.mesh.name, EditorStyles.helpBox, GUILayout.MinWidth(200));
            }
            EditorGUILayout.EndHorizontal();
            Rect rect = GUILayoutUtility.GetLastRect();

            if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition))
            {
                if (Event.current.button == 0)
                {
                    definitionWindow = EditorWindow.GetWindow <MeshDefinitionWindow>(true);
                    definitionWindow.Init((SplineMesh)target, definition);
                }

                if (Event.current.button == 1)
                {
                    GenericMenu menu = new GenericMenu();
                    menu.AddItem(new GUIContent("Duplicate"), false, OnDuplicateMesh, new MeshLink(index, channel));
                    if (index == 0)
                    {
                        menu.AddDisabledItem(new GUIContent("Move Up"));
                    }
                    else
                    {
                        menu.AddItem(new GUIContent("Move Up"), false, OnMoveMeshUp, new MeshLink(index, channel));
                    }
                    if (index == channel.GetMeshCount() - 1)
                    {
                        menu.AddDisabledItem(new GUIContent("Move Down"));
                    }
                    else
                    {
                        menu.AddItem(new GUIContent("Move Down"), false, OnMoveMeshDown, new MeshLink(index, channel));
                    }
                    menu.AddSeparator("");
                    menu.AddItem(new GUIContent("Delete"), false, OnDeleteMesh, new MeshLink(index, channel));
                    menu.ShowAsContext();
                }
            }
        }