Exemplo n.º 1
0
        protected override bool DrawWizardGUI()
        {
            EditorGUI.BeginChangeCheck();

            bool allowSceneObjects = !EditorUtility.IsPersistent(m_Terrain.terrainData); // sometimes user prefers saving terrainData with the scene file

            m_Tree = (GameObject)EditorGUILayout.ObjectField("Tree Prefab", m_Tree, typeof(GameObject), allowSceneObjects);
            if (m_Tree)
            {
                MeshRenderer meshRenderer = m_Tree.GetComponent <MeshRenderer>();
                if (meshRenderer)
                {
                    EditorGUI.BeginDisabled(true);
                    EditorGUILayout.EnumPopup("Cast Shadows", meshRenderer.shadowCastingMode);
                    EditorGUI.EndDisabled();
                }
            }
            if (!TerrainEditorUtility.IsLODTreePrototype(m_Tree))
            {
                m_BendFactor = EditorGUILayout.FloatField("Bend Factor", m_BendFactor);
            }

            bool changed = EditorGUI.EndChangeCheck();

            if (changed)
            {
                m_IsValidTree = IsValidTree(m_Tree, m_PrototypeIndex, m_Terrain);
            }
            return(changed);
        }
Exemplo n.º 2
0
        protected override bool DrawWizardGUI()
        {
            EditorGUI.BeginChangeCheck();
            this.m_Tree = (GameObject)EditorGUILayout.ObjectField("Tree Prefab", (Object)this.m_Tree, typeof(GameObject), !EditorUtility.IsPersistent((Object)this.m_Terrain.terrainData), new GUILayoutOption[0]);
            if (!TerrainEditorUtility.IsLODTreePrototype(this.m_Tree))
            {
                this.m_BendFactor = EditorGUILayout.FloatField("Bend Factor", this.m_BendFactor, new GUILayoutOption[0]);
            }
            bool flag = EditorGUI.EndChangeCheck();

            if (flag)
            {
                this.m_IsValidTree = TreeWizard.IsValidTree(this.m_Tree, this.m_PrototypeIndex, this.m_Terrain);
            }
            return(flag);
        }
Exemplo n.º 3
0
        protected override bool DrawWizardGUI()
        {
            EditorGUI.BeginChangeCheck();

            bool allowSceneObjects = !EditorUtility.IsPersistent(m_Terrain.terrainData); // sometimes user prefers saving terrainData with the scene file

            m_Tree = (GameObject)EditorGUILayout.ObjectField("Tree Prefab", m_Tree, typeof(GameObject), allowSceneObjects);
            if (!TerrainEditorUtility.IsLODTreePrototype(m_Tree))
            {
                m_BendFactor = EditorGUILayout.FloatField("Bend Factor", m_BendFactor);
            }

            bool changed = EditorGUI.EndChangeCheck();

            if (changed)
            {
                m_IsValidTree = IsValidTree(m_Tree, m_PrototypeIndex, m_Terrain);
            }
            return(changed);
        }
 internal static void RemoveTree(MenuCommand item)
 {
     Terrain context = (Terrain) item.context;
     TerrainEditorUtility.RemoveTree(context, item.userData);
 }
Exemplo n.º 5
0
 internal static void RemoveDetail(MenuCommand item)
 {
     TerrainEditorUtility.RemoveDetail((Terrain)item.context, item.userData);
 }
        internal static void RemoveSplat(MenuCommand item)
        {
            Terrain context = (Terrain)item.context;

            TerrainEditorUtility.RemoveSplatTexture(context.terrainData, item.userData);
        }
Exemplo n.º 7
0
        static internal void RemoveDetail(MenuCommand item)
        {
            Terrain terrain = (Terrain)item.context;

            TerrainEditorUtility.RemoveDetail(terrain, item.userData);
        }
Exemplo n.º 8
0
        protected override bool DrawWizardGUI()
        {
            EditorGUI.BeginChangeCheck();

            bool allowSceneObjects = !EditorUtility.IsPersistent(terrain.terrainData); // sometimes user prefers saving terrainData with the scene file

            m_Tree = (GameObject)EditorGUILayout.ObjectField("Tree Prefab", m_Tree, typeof(GameObject), allowSceneObjects);
            if (m_Tree)
            {
                MeshRenderer meshRenderer = m_Tree.GetComponent <MeshRenderer>();
                if (meshRenderer)
                {
                    EditorGUI.BeginDisabled(true);
                    EditorGUILayout.EnumPopup("Cast Shadows", meshRenderer.shadowCastingMode);
                    EditorGUI.EndDisabled();
                }
            }
            if (!TerrainEditorUtility.IsLODTreePrototype(m_Tree))
            {
                m_BendFactor = EditorGUILayout.FloatField("Bend Factor", m_BendFactor);
            }
            else
            {
                EditorGUILayout.BeginHorizontal();

                LODGroup lodGroup = m_Tree.GetComponent <LODGroup>();

                NavMeshLodIndex navMeshLodIndex = NavMeshLodIndex.Custom;
                if (m_NavMeshLod == kNavMeshLodLast)
                {
                    navMeshLodIndex = NavMeshLodIndex.Last;
                }
                else if (m_NavMeshLod == kNavMeshLodFirst)
                {
                    navMeshLodIndex = NavMeshLodIndex.First;
                }

                navMeshLodIndex = (NavMeshLodIndex)EditorGUILayout.EnumPopup("NavMesh LOD Index", navMeshLodIndex, GUILayout.MinWidth(250));

                if (navMeshLodIndex == NavMeshLodIndex.First)
                {
                    m_NavMeshLod = kNavMeshLodFirst;
                }
                else if (navMeshLodIndex == NavMeshLodIndex.Last)
                {
                    m_NavMeshLod = kNavMeshLodLast;
                }
                else
                {
                    m_NavMeshLod = EditorGUILayout.IntSlider(m_NavMeshLod, 0, Mathf.Max(0, lodGroup.lodCount - 1));
                }

                EditorGUILayout.EndHorizontal();
            }

            bool changed = EditorGUI.EndChangeCheck();

            if (changed)
            {
                m_IsValidTree = IsValidTree(m_Tree, m_PrototypeIndex, terrain);
            }
            return(changed);
        }