Beispiel #1
0
 private void ResetShaderSettings(GrassSettings grassSettings, GrassManager grassManager)
 {
     if (grassSettings == null)
     {
         return;
     }
     if (grassSettings.useAuto)
     {
         if (grassManager == null)
         {
             return;
         }
         EditorUtility.SetDirty(grassSettings);
         AssetDatabase.SaveAssets();
         grassManager.CorrectShaderSettings();
         grassManager.CorrectGrassMaterialSettings();
         if (grassManager.grassMaterial != null)
         {
             grassManager.grassMaterial.SetMaterialToGrass();
         }
     }
     else
     {
         EditorUtility.SetDirty(grassSettings);
         AssetsManager.SetGrassShaderSettings(true, grassSettings.useSimple, grassSettings.useFull);
     }
 }
Beispiel #2
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            myTarget = target as GrassManager;
            Undo.RecordObject(myTarget, "Update in " + myTarget.name);

            if (FindObjectsOfType <GrassManager>().Length > 1)
            {
                EditorGUILayout.HelpBox(multipleGrassManagersWarning, MessageType.Error);
                Debug.LogError(multipleGrassManagersWarning);
            }

            EditorGUI.BeginChangeCheck();
            ShowGUI();
            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(myTarget);
            }
            serializedObject.ApplyModifiedProperties();


            if (IsCorrectScriptType() == false)
            {
                SetCorrectScript();
            }
        }
Beispiel #3
0
        private void ReloadShadersAndSettings()
        {
            GrassSettings grassSettings = AssetsManager.GetGrassSettings();
            GrassManager  grassManager  = FindObjectOfType <GrassManager>();

            Shader.SetGlobalTexture("_GrassDepthTex", Texture2D.blackTexture);
            ResetShaderSettings(grassSettings, grassManager);

            AssetsManager.ResetGrassPhysicsSettings();
            AssetsManager.ReimportGrassPhysicsShaders();
            AssetDatabase.Refresh();
        }