示例#1
0
        void OnEnable()
        {
            window = this;// GetWindow(typeof(TC_NodeWindow)) as TC_NodeWindow;
            autoRepaintOnSceneChange = true;
            TD.scale = 2;

            Undo.undoRedoPerformed += UndoRedoPerformed;

            // Debug.Log("Node Window OnEnable");
            // Debug.Log(Application.isPlaying);

            // if (!Application.isPlaying) TC.RefreshOutputReferences(6);
        }
        public override void OnInspectorGUI()
        {
            if (TC_Settings.instance == null)
            {
                return;
            }
            TC_NodeWindow.Keys();

            if (TC_Settings.instance.debugMode)
            {
                DrawDefaultInspector();
            }
            else
            {
                DrawCustomInspector();
            }
        }
示例#3
0
 public static void ShowWindow()
 {
     window = GetWindow(typeof(TC_NodeWindow)) as TC_NodeWindow;
     window.titleContent = new GUIContent("TC" + TC.GetVersionNumber());
 }
 public static void ShowWindow()
 {
     window = GetWindow(typeof(TC_NodeWindow)) as TC_NodeWindow;
     window.titleContent = new GUIContent("TC2");
 }
        public void DrawCustomInspector()
        {
            TC_GlobalSettings globalSettings = TC_Settings.instance.global;

            serializedObject.Update();
            global.Update();

            TD.DrawSpacer();
            TD.DrawLabelWidthUnderline("Local Settings", 14);

            EditorGUILayout.BeginVertical("Box");

            GUILayout.Space(5);

            TD.DrawProperty(masterTerrain, new GUIContent("Master Terrain", globalSettings.tooltip ? "This terrain is used for selecting the splat textures, grass textures and trees in the nodes." : ""));

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel(new GUIContent("Node Preview Image Resolution", globalSettings.tooltip ? "The resolution of the node preview images." : ""));
            previewResolution.intValue = EditorGUILayout.IntPopup(previewResolution.intValue, previewResolutionsDisplay, previewResolutions);
            EditorGUILayout.EndHorizontal();

            TD.DrawProperty(hideTerrainGroup, new GUIContent("Hide TerrainLayer GameObject"));
            if (GUI.changed)
            {
                serializedObject.ApplyModifiedProperties();
                TC_NodeWindow.DebugMode();
            }

            TD.DrawProperty(useTCRuntime);
            if (GUI.changed)
            {
                if (!useTCRuntime.boolValue)
                {
                    TC_Settings.instance.transform.parent.tag = "EditorOnly";
                }
                else
                {
                    TC_Settings.instance.transform.parent.tag = "Untagged";
                }
            }
            TD.DrawProperty(defaultTerrainHeight);
            TD.DrawProperty(generateOffset);
            // TD.DrawProperty(scrollAdd);
            EditorGUILayout.EndVertical();

            GUILayout.Space(10);
            TD.DrawSpacer();
            GUILayout.Space(10);

            TD.DrawLabelWidthUnderline("Global Settings", 14);
            GUILayout.Space(5);

            EditorGUILayout.BeginVertical("Box");
            TD.DrawProperty(tooltip);
            TD.DrawProperty(showResolutionWarnings);

            GUI.changed = false;
            Vector3 defaultTerrainSize = globalSettings.defaultTerrainSize;

            defaultTerrainSize = EditorGUILayout.Vector3Field("Default Node Size", defaultTerrainSize);
            if (GUI.changed)
            {
                Undo.RecordObject(globalSettings, "Default Terrain Size");
                globalSettings.defaultTerrainSize = defaultTerrainSize;
                EditorUtility.SetDirty(globalSettings);
            }
            EditorGUILayout.EndVertical();

            GUILayout.Space(5);

            TD.DrawLabelWidthUnderline("Trees and Objects", 12);
            EditorGUILayout.BeginVertical("Box");
            TD.DrawProperty(linkScaleToMaskDefault, new GUIContent("Link Scale To Mask Default"));
            EditorGUILayout.EndVertical();

            GUILayout.Space(5);

            TD.DrawLabelWidthUnderline("Keys", 12);

            EditorGUILayout.BeginVertical("Box");
            TD.DrawProperty(keyZoomIn);
            TD.DrawProperty(keyZoomOut);
            EditorGUILayout.EndVertical();

            TD.DrawLabelWidthUnderline("Node Colors", 12);

            EditorGUILayout.BeginVertical("Box");

            TD.DrawProperty(colLayerGroup, new GUIContent("Color Layer Group"));
            TD.DrawProperty(colLayer, new GUIContent("Color Layer"));
            TD.DrawProperty(colMaskNodeGroup, new GUIContent("Color Mask Node Group"));
            TD.DrawProperty(colMaskNode, new GUIContent("Color Mask Node"));
            TD.DrawProperty(colSelectNodeGroup, new GUIContent("Color Select Node Group"));
            TD.DrawProperty(colSelectNode, new GUIContent("Color Select Node"));
            TD.DrawProperty(colSelectItemGroup, new GUIContent("Color Select Item Group"));
            TD.DrawProperty(colSelectItem, new GUIContent("Color Select Item"));

            EditorGUILayout.EndVertical();

            GUILayout.Space(5);

            TD.DrawPropertyArray(previewColors);

            TD.DrawSpacer();

            serializedObject.ApplyModifiedProperties();
            global.ApplyModifiedProperties();
        }