(Update) Clean Projet
This commit is contained in:
@@ -0,0 +1,137 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine.UIElements;
|
||||
using PrefabStageUtility = UnityEditor.SceneManagement.PrefabStageUtility;
|
||||
|
||||
namespace StylizedWater3
|
||||
{
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(AlignToWater))]
|
||||
public class AlignToWaterInspector : Editor
|
||||
{
|
||||
AlignToWater script;
|
||||
|
||||
SerializedProperty heightInterface;
|
||||
|
||||
SerializedProperty followTarget;
|
||||
|
||||
SerializedProperty surfaceSize;
|
||||
|
||||
SerializedProperty heightOffset;
|
||||
SerializedProperty rollAmount;
|
||||
|
||||
SerializedProperty rotation;
|
||||
SerializedProperty smoothing;
|
||||
|
||||
private bool isRiver;
|
||||
private bool wavesEnabled;
|
||||
|
||||
private string proSkinPrefix => EditorGUIUtility.isProSkin ? "d_" : "";
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
script = (AlignToWater)target;
|
||||
|
||||
heightInterface = serializedObject.FindProperty("heightInterface");
|
||||
|
||||
followTarget = serializedObject.FindProperty("followTarget");
|
||||
|
||||
surfaceSize = serializedObject.FindProperty("surfaceSize");
|
||||
|
||||
heightOffset = serializedObject.FindProperty("heightOffset");
|
||||
rollAmount = serializedObject.FindProperty("rollAmount");
|
||||
|
||||
rotation = serializedObject.FindProperty("rotation");
|
||||
smoothing = serializedObject.FindProperty("smoothing");
|
||||
|
||||
ValidateMaterial();
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
UI.DrawHeader();
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Space(EditorGUIUtility.labelWidth);
|
||||
AlignToWater.EnableInEditor =
|
||||
GUILayout.Toggle(AlignToWater.EnableInEditor, new GUIContent(" Run in edit-mode (global)", EditorGUIUtility.IconContent(
|
||||
(AlignToWater.EnableInEditor ? "animationvisibilitytoggleon" : "animationvisibilitytoggleoff")).image), "Button");
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
if (script.rigidbody)
|
||||
{
|
||||
EditorGUILayout.HelpBox("RigidBody attachment detected! A fair reminder that this is not a physics-compatible component." +
|
||||
"\n\n" +
|
||||
"Physics will be overriden and its position and rotation will be set directly." +
|
||||
"\nVertical forces applied to it will cause visible jittering.", MessageType.Warning);
|
||||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUILayout.PropertyField(heightInterface);
|
||||
|
||||
//UI.DrawNotification(isRiver, "Material has river mode enabled, buoyancy only works for flat water bodies", MessageType.Error);
|
||||
//UI.DrawNotification(!wavesEnabled && !isRiver, "Material used on the water object does not have waves enabled.", MessageType.Error);
|
||||
|
||||
/*
|
||||
if (script.waterObject && script.waterObject.material)
|
||||
{
|
||||
UI.DrawNotification((script.waterObject.material.GetFloat("_WorldSpaceUV") == 0f), "Material must use world-projected UV", "Change", ()=> script.waterObject.material.SetFloat("_WorldSpaceUV", 1f), MessageType.Error);
|
||||
}
|
||||
*/
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.PropertyField(surfaceSize);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.PropertyField(followTarget);
|
||||
EditorGUILayout.PropertyField(heightOffset);
|
||||
EditorGUILayout.PropertyField(rollAmount);
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
|
||||
EditorGUILayout.PropertyField(rotation);
|
||||
EditorGUILayout.PropertyField(smoothing);
|
||||
|
||||
UI.DrawNotification(smoothing.floatValue == 0f && script.rigidbody, "Smoothing is required to mitigate jittering of the RigidBody", MessageType.Warning);
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
ValidateMaterial();
|
||||
}
|
||||
|
||||
UI.DrawFooter();
|
||||
}
|
||||
|
||||
private void ValidateMaterial()
|
||||
{
|
||||
/*
|
||||
if (script.waterObject && script.waterObject.material)
|
||||
{
|
||||
if (script.waterObject.material != script.waterObject.meshRenderer.sharedMaterial) script.waterObject.material = script.waterObject.meshRenderer.sharedMaterial;
|
||||
|
||||
wavesEnabled = WaveParameters.WavesEnabled(script.waterObject.material);
|
||||
isRiver = script.waterObject.material.IsKeywordEnabled(ShaderParams.Keywords.River);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e47e6ece236452443bf1418a01d87491
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 148978298399363526, guid: 0000000000000000d000000000000000, type: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Editor/Inspectors/AlignToWaterInspector.cs
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,92 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace StylizedWater3
|
||||
{
|
||||
[CustomEditor(typeof(OceanFollowBehaviour))]
|
||||
public class OceanFollowBehaviourInspector : Editor
|
||||
{
|
||||
private SerializedProperty material;
|
||||
private SerializedProperty enableInEditMode;
|
||||
private SerializedProperty followTarget;
|
||||
|
||||
private bool isvalidSetup;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
material = serializedObject.FindProperty("material");
|
||||
enableInEditMode = serializedObject.FindProperty("enableInEditMode");
|
||||
followTarget = serializedObject.FindProperty("followTarget");
|
||||
|
||||
isvalidSetup = ((OceanFollowBehaviour)target).InvalidSetup();
|
||||
}
|
||||
|
||||
private bool materialChanged;
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
UI.DrawHeader();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
UI.DrawNotification(isvalidSetup, "This component has an invalid set up, one or more references went missing." +
|
||||
"\n\nThis component must not be added manually." +
|
||||
"\n\nInstead go to GameObject->3D Object->Water->Ocean to create an ocean",
|
||||
MessageType.Error);
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Space(EditorGUIUtility.labelWidth);
|
||||
OceanFollowBehaviour.ShowWireFrame = GUILayout.Toggle(OceanFollowBehaviour.ShowWireFrame, new GUIContent(" Show Wireframe", EditorGUIUtility.IconContent((OceanFollowBehaviour.ShowWireFrame ? "animationvisibilitytoggleon" : "animationvisibilitytoggleoff")).image), "Button");
|
||||
}
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
materialChanged = false;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(material);
|
||||
|
||||
if (EditorGUI.EndChangeCheck()) materialChanged = true;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(material.objectReferenceValue == null);
|
||||
if (GUILayout.Button("Edit", EditorStyles.miniButton, GUILayout.Width(50f)))
|
||||
{
|
||||
Selection.activeObject = material.objectReferenceValue;
|
||||
//StylizedWaterEditor.PopUpMaterialEditor.Create(material.objectReferenceValue);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
EditorGUILayout.Separator();
|
||||
|
||||
EditorGUILayout.PropertyField(enableInEditMode);
|
||||
EditorGUILayout.PropertyField(followTarget);
|
||||
if (followTarget.objectReferenceValue == null)
|
||||
{
|
||||
EditorGUILayout.HelpBox("None assigned. The actively rendering camera will be automatically followed", MessageType.Info);
|
||||
}
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (materialChanged)
|
||||
{
|
||||
OceanFollowBehaviour component = (OceanFollowBehaviour)target;
|
||||
component.ApplyMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
UI.DrawFooter();
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d01f8235914f45d2b896c0384d978acc
|
||||
timeCreated: 1729594576
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Editor/Inspectors/OceanFollowBehaviourInspector.cs
|
||||
uploadId: 895866
|
||||
+361
@@ -0,0 +1,361 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.XR;
|
||||
|
||||
namespace StylizedWater3
|
||||
{
|
||||
[CustomEditor(typeof(PlanarReflectionRenderer))]
|
||||
public class PlanarReflectionRendererInspector : Editor
|
||||
{
|
||||
private PlanarReflectionRenderer renderer;
|
||||
|
||||
//Rendering
|
||||
private SerializedProperty rotatable;
|
||||
private SerializedProperty cullingMask;
|
||||
private SerializedProperty rendererIndex;
|
||||
private SerializedProperty offset;
|
||||
private SerializedProperty includeSkybox;
|
||||
private SerializedProperty enableFog;
|
||||
private SerializedProperty enableInSceneView;
|
||||
|
||||
//Quality
|
||||
private SerializedProperty renderShadows;
|
||||
private SerializedProperty renderScale;
|
||||
private SerializedProperty maximumLODLevel;
|
||||
|
||||
private SerializedProperty waterObjects;
|
||||
private SerializedProperty moveWithTransform;
|
||||
|
||||
private Bounds curBounds;
|
||||
private bool waterLayerError;
|
||||
|
||||
private bool previewReflection
|
||||
{
|
||||
get => EditorPrefs.GetBool("SWS2_PREVIEW_REFLECTION_ENABLED", true);
|
||||
set => EditorPrefs.SetBool("SWS2_PREVIEW_REFLECTION_ENABLED", value);
|
||||
}
|
||||
private RenderTexture previewTexture;
|
||||
|
||||
#if URP
|
||||
private void OnEnable()
|
||||
{
|
||||
PipelineUtilities.RefreshRendererList();
|
||||
|
||||
renderer = (PlanarReflectionRenderer)target;
|
||||
|
||||
rotatable = serializedObject.FindProperty("rotatable");
|
||||
cullingMask = serializedObject.FindProperty("cullingMask");
|
||||
rendererIndex = serializedObject.FindProperty("rendererIndex");
|
||||
offset = serializedObject.FindProperty("offset");
|
||||
includeSkybox = serializedObject.FindProperty("includeSkybox");
|
||||
enableFog = serializedObject.FindProperty("enableFog");
|
||||
enableInSceneView = serializedObject.FindProperty("enableInSceneView");
|
||||
renderShadows = serializedObject.FindProperty("renderShadows");
|
||||
renderScale = serializedObject.FindProperty("renderScale");
|
||||
maximumLODLevel = serializedObject.FindProperty("maximumLODLevel");
|
||||
waterObjects = serializedObject.FindProperty("waterObjects");
|
||||
moveWithTransform = serializedObject.FindProperty("moveWithTransform");
|
||||
|
||||
if (renderer.waterObjects.Count == 0 && WaterObject.Instances.Count == 1)
|
||||
{
|
||||
renderer.waterObjects.Add(WaterObject.Instances[0]);
|
||||
renderer.RecalculateBounds();
|
||||
renderer.EnableMaterialReflectionSampling();
|
||||
|
||||
EditorUtility.SetDirty(target);
|
||||
serializedObject.ApplyModifiedPropertiesWithoutUndo();
|
||||
}
|
||||
|
||||
ValidateWaterObjectLayer();
|
||||
|
||||
curBounds = renderer.CalculateBounds();
|
||||
|
||||
RenderPipelineManager.endCameraRendering += OnEndCameraRendering;
|
||||
}
|
||||
|
||||
private Camera currentCamera;
|
||||
private string currentCameraName;
|
||||
private bool waterObjectsVisible;
|
||||
|
||||
private void OnEndCameraRendering(ScriptableRenderContext context, Camera camera)
|
||||
{
|
||||
if (!previewReflection) return;
|
||||
|
||||
if (renderer.InvalidContext(camera)) return;
|
||||
|
||||
currentCamera = camera;
|
||||
|
||||
waterObjectsVisible = renderer.WaterObjectsVisible(currentCamera);
|
||||
|
||||
previewTexture = renderer.TryGetReflectionTexture(currentCamera);
|
||||
currentCameraName = currentCamera.name;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
RenderPipelineManager.endCameraRendering -= OnEndCameraRendering;
|
||||
}
|
||||
#endif
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
#if !URP
|
||||
UI.DrawNotification("The Universal Render Pipeline package v" + AssetInfo.MIN_URP_VERSION + " or newer is not installed", MessageType.Error);
|
||||
#else
|
||||
UI.DrawHeader();
|
||||
|
||||
if (ShaderUtil.anythingCompiling)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Rendering is temporarily paused, while the editor finishes compiling shaders", MessageType.Info);
|
||||
}
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Space(EditorGUIUtility.labelWidth);
|
||||
previewReflection =
|
||||
GUILayout.Toggle(previewReflection, new GUIContent(" Preview reflection", EditorGUIUtility.IconContent(
|
||||
(previewReflection ? "animationvisibilitytoggleon" : "animationvisibilitytoggleoff")).image), "Button");
|
||||
}
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Space(EditorGUIUtility.labelWidth);
|
||||
EditorGUILayout.LabelField("Status: " + (waterObjectsVisible && currentCamera ? $"Rendering (camera: {currentCamera.name})" : "Not rendering (water not in view for any camera)"), EditorStyles.miniLabel);
|
||||
}
|
||||
|
||||
UI.DrawNotification(PipelineUtilities.VREnabled(), "Not supported with VR rendering", MessageType.Error);
|
||||
|
||||
UI.DrawNotification(PlanarReflectionRenderer.AllowReflections == false, "Reflections have been globally disabled by an external script", MessageType.Warning);
|
||||
|
||||
serializedObject.Update();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUILayout.LabelField("Rendering", EditorStyles.boldLabel);
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
UI.DrawRendererProperty(rendererIndex);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
renderer.SetRendererIndex(rendererIndex.intValue);
|
||||
}
|
||||
|
||||
//Default renderer
|
||||
if (rendererIndex.intValue == 0)
|
||||
{
|
||||
UI.DrawNotification("\n" +
|
||||
"Using the default renderer for reflections is strongly discouraged." +
|
||||
"\n\nMost (if not all) render features, such as third-party post processing effects, will also render for the reflection." +
|
||||
"\n\nThis can lead to rendering artefacts and negatively impacts overall performance." +
|
||||
"\n", MessageType.Warning);
|
||||
|
||||
//If there are no other renderers to assign, suggest to auto-create one
|
||||
UI.DrawNotification(PipelineUtilities.rendererIndexList.Length <= 2, "It is highly recommend to create a separate empty renderer", "Create and assign", CreateRenderer, MessageType.None);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
EditorGUILayout.PropertyField(cullingMask);
|
||||
|
||||
EditorGUILayout.PropertyField(includeSkybox);
|
||||
EditorGUILayout.PropertyField(enableFog);
|
||||
if(enableFog.boolValue) EditorGUILayout.HelpBox("Unity's built-in fog does not support oblique projections. Expect incorrect fog shading on tall objects or large triangles", MessageType.Warning);
|
||||
EditorGUILayout.PropertyField(enableInSceneView);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.PropertyField(rotatable);
|
||||
EditorGUILayout.PropertyField(offset);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.LabelField("Quality", EditorStyles.boldLabel);
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(renderShadows);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
renderer.ToggleShadows(renderShadows.boolValue);
|
||||
}
|
||||
EditorGUILayout.PropertyField(renderScale);
|
||||
EditorGUILayout.PropertyField(maximumLODLevel);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.LabelField("Target water objects", EditorStyles.boldLabel);
|
||||
EditorGUILayout.PropertyField(moveWithTransform, new GUIContent("Move bounds with transform", moveWithTransform.tooltip));
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(waterObjects);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
curBounds = renderer.CalculateBounds();
|
||||
}
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.FlexibleSpace();
|
||||
if(GUILayout.Button(new GUIContent("Auto-find", "Assigns all active water objects currently in the scene"), EditorStyles.miniButton))
|
||||
{
|
||||
renderer.waterObjects = new List<WaterObject>(WaterObject.Instances);
|
||||
|
||||
renderer.RecalculateBounds();
|
||||
curBounds = renderer.bounds;
|
||||
renderer.EnableMaterialReflectionSampling();
|
||||
|
||||
ValidateWaterObjectLayer();
|
||||
|
||||
EditorUtility.SetDirty(target);
|
||||
}
|
||||
if(GUILayout.Button("Clear", EditorStyles.miniButton))
|
||||
{
|
||||
renderer.ToggleMaterialReflectionSampling(false);
|
||||
renderer.waterObjects.Clear();
|
||||
renderer.RecalculateBounds();
|
||||
|
||||
EditorUtility.SetDirty(target);
|
||||
}
|
||||
}
|
||||
|
||||
if (renderer.waterObjects != null)
|
||||
{
|
||||
UI.DrawNotification(renderer.waterObjects.Count == 0, "Assign at least one Water Object", MessageType.Info);
|
||||
|
||||
if (renderer.waterObjects.Count > 0)
|
||||
{
|
||||
UI.DrawNotification(curBounds.size != renderer.bounds.size || (moveWithTransform.boolValue == false && curBounds.center != renderer.bounds.center), "Water objects have changed or moved, bounds needs to be recalculated", "Recalculate",() => RecalculateBounds(), MessageType.Error);
|
||||
}
|
||||
|
||||
UI.DrawNotification(waterLayerError, "One or more Water Objects aren't on the \"Water\" layer.\n\nThis causes recursive reflections", "Fix", () => SetObjectsOnWaterLayer(), MessageType.Error);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
UI.DrawFooter();
|
||||
}
|
||||
|
||||
#if URP
|
||||
|
||||
private void CreateRenderer()
|
||||
{
|
||||
int index = -1;
|
||||
string path = "";
|
||||
|
||||
PipelineUtilities.CreateAndAssignNewRenderer(out index, out path);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
rendererIndex.intValue = index;
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
serializedObject.Update();
|
||||
|
||||
renderer.SetRendererIndex(rendererIndex.intValue);
|
||||
|
||||
if (path != string.Empty)
|
||||
{
|
||||
Debug.Log("New renderer created at path <i>" + path + "</i>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool HasPreviewGUI()
|
||||
{
|
||||
return previewReflection && previewTexture;
|
||||
}
|
||||
|
||||
public override bool RequiresConstantRepaint()
|
||||
{
|
||||
return HasPreviewGUI();
|
||||
}
|
||||
|
||||
public override GUIContent GetPreviewTitle()
|
||||
{
|
||||
return currentCamera ? new GUIContent(currentCameraName + " reflection") : new GUIContent("Reflection");
|
||||
}
|
||||
|
||||
public override void OnPreviewSettings()
|
||||
{
|
||||
if (HasPreviewGUI() == false) return;
|
||||
|
||||
GUILayout.Label($"Resolution ({previewTexture.width}x{previewTexture.height})");
|
||||
}
|
||||
|
||||
private bool drawAlpha;
|
||||
|
||||
public override void OnPreviewGUI(Rect r, GUIStyle background)
|
||||
{
|
||||
if (drawAlpha)
|
||||
{
|
||||
EditorGUI.DrawTextureAlpha(r, previewTexture, ScaleMode.ScaleToFit);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.DrawTexture(r, previewTexture, ScaleMode.ScaleToFit, false);
|
||||
}
|
||||
|
||||
Rect btnRect = r;
|
||||
btnRect.x += 10f;
|
||||
btnRect.y += 10f;
|
||||
btnRect.width = 150f;
|
||||
btnRect.height = 20f;
|
||||
|
||||
drawAlpha = GUI.Toggle(btnRect, drawAlpha, new GUIContent(" Alpha channel"));
|
||||
}
|
||||
|
||||
private void ValidateWaterObjectLayer()
|
||||
{
|
||||
if (renderer.waterObjects == null) return;
|
||||
|
||||
waterLayerError = false;
|
||||
int layerID = LayerMask.NameToLayer("Water");
|
||||
|
||||
foreach (WaterObject obj in renderer.waterObjects)
|
||||
{
|
||||
//Is not on "Water" layer?
|
||||
if (obj.gameObject.layer != layerID)
|
||||
{
|
||||
waterLayerError = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetObjectsOnWaterLayer()
|
||||
{
|
||||
int layerID = LayerMask.NameToLayer("Water");
|
||||
|
||||
foreach (WaterObject obj in renderer.waterObjects)
|
||||
{
|
||||
//Is not on "Water" layer?
|
||||
if (obj.gameObject.layer != layerID)
|
||||
{
|
||||
obj.gameObject.layer = layerID;
|
||||
EditorUtility.SetDirty(obj);
|
||||
}
|
||||
}
|
||||
|
||||
waterLayerError = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
private void RecalculateBounds()
|
||||
{
|
||||
#if URP
|
||||
renderer.RecalculateBounds();
|
||||
curBounds = renderer.bounds;
|
||||
EditorUtility.SetDirty(target);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ddec133f70260bb4aa7800414c2ba3c1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Editor/Inspectors/PlanarReflectionRendererInspector.cs
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,157 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#if URP
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace StylizedWater3
|
||||
{
|
||||
[CustomEditor(typeof(StylizedWaterRenderFeature))]
|
||||
public partial class RenderFeatureEditor : Editor
|
||||
{
|
||||
private StylizedWaterRenderFeature renderFeature;
|
||||
|
||||
private SerializedProperty screenSpaceReflectionSettings;
|
||||
|
||||
private SerializedProperty allowDirectionalCaustics;
|
||||
|
||||
private SerializedProperty heightPrePassSettings;
|
||||
private SerializedProperty terrainHeightPrePassSettings;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
renderFeature = (StylizedWaterRenderFeature)target;
|
||||
|
||||
screenSpaceReflectionSettings = serializedObject.FindProperty("screenSpaceReflectionSettings");
|
||||
|
||||
allowDirectionalCaustics = serializedObject.FindProperty("allowDirectionalCaustics");
|
||||
|
||||
heightPrePassSettings = serializedObject.FindProperty("heightPrePassSettings");
|
||||
#if SWS_DEV
|
||||
terrainHeightPrePassSettings = serializedObject.FindProperty("terrainHeightPrePassSettings");
|
||||
#endif
|
||||
|
||||
EnableFlowMapEditor();
|
||||
DynamicEffectsOnEnable();
|
||||
UnderwaterRenderingOnEnable();
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
EditorGUILayout.LabelField($"Version {AssetInfo.INSTALLED_VERSION}", EditorStyles.miniLabel);
|
||||
|
||||
if (GUILayout.Button(new GUIContent(" Documentation", EditorGUIUtility.FindTexture("_Help"))))
|
||||
{
|
||||
Application.OpenURL(AssetInfo.DOC_URL);
|
||||
}
|
||||
if (GUILayout.Button(new GUIContent(" Debugger", EditorGUIUtility.IconContent("Profiler.Rendering").image, "Inspect the render buffer outputs")))
|
||||
{
|
||||
RenderTargetDebuggerWindow.Open();
|
||||
}
|
||||
|
||||
}
|
||||
EditorGUILayout.Space();
|
||||
|
||||
UI.DrawNotification(PipelineUtilities.RenderGraphEnabled() == false, "Render Graph is disabled, functionality on this render feature will not be functional", "Enable", () =>
|
||||
{
|
||||
PipelineUtilities.SetRenderGraphCompatibilityMode(false);
|
||||
}, MessageType.Error);
|
||||
|
||||
serializedObject.Update();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
UI.DrawNotification(renderFeature.heightReadbackCS == null, "A compute shader is not assigned to the render feature. Do not add render features in Play mode!", "Attempt fix", () =>
|
||||
{
|
||||
renderFeature.VerifyReferences();
|
||||
}, MessageType.Error);
|
||||
|
||||
EditorGUILayout.PropertyField(allowDirectionalCaustics);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.PropertyField(screenSpaceReflectionSettings);
|
||||
|
||||
if (renderFeature.screenSpaceReflectionSettings.reflectEverything && screenSpaceReflectionSettings.isExpanded)
|
||||
{
|
||||
UI.DrawNotification("Enabling this option bypasses failed reflection ray filtering." +
|
||||
"\n\nReflection artefacts are to be expected!", MessageType.Warning);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.PropertyField(heightPrePassSettings);
|
||||
if (heightPrePassSettings.isExpanded)
|
||||
{
|
||||
HeightPrePass.Settings settings = ((StylizedWaterRenderFeature)target).heightPrePassSettings;
|
||||
|
||||
string statsText = "";
|
||||
|
||||
statsText += $"Current resolution: {PlanarProjection.CalculateResolution(settings.range, settings.cellsPerUnit, 16, settings.maxResolution)}px\n";
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Space(EditorGUIUtility.labelWidth);
|
||||
EditorGUILayout.HelpBox(statsText, MessageType.None);
|
||||
}
|
||||
|
||||
EditorGUILayout.HelpBox("This will pre-render all the height (including any displacement effects) of all water objects (on the Water layer!) into a buffer. Allowing other shaders to access this information." +
|
||||
"\n\nSee the Height.hlsl shader library for the API, or use the \"Sample Water Height\" Sub-graph in Shader Graph." +
|
||||
"\n\nThis is for advanced users, and Water Decals and the \"GPU Async Readback\" height readback API makes use of this", MessageType.Info);
|
||||
if (HeightQuerySystem.RequiresHeightPrepass)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Height Pre-pass is forcible enabled at the moment, because there are height queries being issued from script.", MessageType.Info);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.LabelField("GPU Height Queries", EditorStyles.boldLabel);
|
||||
HeightQuerySystem.DISABLE_IN_EDIT_MODE = EditorGUILayout.Toggle("Forced Disable In Edit-mode", HeightQuerySystem.DISABLE_IN_EDIT_MODE);
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
EditorGUILayout.LabelField("");
|
||||
|
||||
if (GUILayout.Button(new GUIContent(" Inspect Queries", EditorGUIUtility.FindTexture("_Help"))))
|
||||
{
|
||||
HeightQuerySystemEditor.HeightQueryInspector.Open();
|
||||
}
|
||||
}
|
||||
|
||||
#if SWS_DEV
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.PropertyField(terrainHeightPrePassSettings);
|
||||
#endif
|
||||
EditorGUILayout.Space();
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
DrawFlowMapEditor();
|
||||
DynamicEffectsOnInspectorGUI();
|
||||
UnderwaterRenderingOnInspectorGUI();
|
||||
|
||||
UI.DrawFooter();
|
||||
}
|
||||
|
||||
partial void EnableFlowMapEditor();
|
||||
partial void DrawFlowMapEditor();
|
||||
|
||||
partial void DynamicEffectsOnEnable();
|
||||
partial void DynamicEffectsOnInspectorGUI();
|
||||
|
||||
partial void UnderwaterRenderingOnEnable();
|
||||
partial void UnderwaterRenderingOnInspectorGUI();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b8b99303c66f4b4691ee9f596f1a3bf
|
||||
timeCreated: 1701084026
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Editor/Inspectors/RenderFeatureEditor.cs
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,114 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace StylizedWater3
|
||||
{
|
||||
[CustomEditor(typeof(WaterGrid))]
|
||||
public class CreateWaterGridInspector : Editor
|
||||
{
|
||||
private WaterGrid script;
|
||||
|
||||
private SerializedProperty material;
|
||||
private SerializedProperty followSceneCamera;
|
||||
private SerializedProperty autoAssignCamera;
|
||||
private SerializedProperty followTarget;
|
||||
|
||||
private SerializedProperty scale;
|
||||
private SerializedProperty vertexDistance;
|
||||
private SerializedProperty rowsColumns;
|
||||
|
||||
private int vertexCount;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
script = (WaterGrid) target;
|
||||
script.m_rowsColumns = script.rowsColumns;
|
||||
|
||||
material = serializedObject.FindProperty("material");
|
||||
followSceneCamera = serializedObject.FindProperty("followSceneCamera");
|
||||
autoAssignCamera = serializedObject.FindProperty("autoAssignCamera");
|
||||
followTarget = serializedObject.FindProperty("followTarget");
|
||||
|
||||
scale = serializedObject.FindProperty("scale");
|
||||
vertexDistance = serializedObject.FindProperty("vertexDistance");
|
||||
rowsColumns = serializedObject.FindProperty("rowsColumns");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
UI.DrawHeader();
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Space(EditorGUIUtility.labelWidth);
|
||||
WaterGrid.DisplayGrid = GUILayout.Toggle(WaterGrid.DisplayGrid , new GUIContent(" Display Grid", EditorGUIUtility.IconContent((WaterGrid.DisplayGrid ? "animationvisibilitytoggleon" : "animationvisibilitytoggleoff")).image), "Button");
|
||||
WaterGrid.DisplayWireframe = GUILayout.Toggle(WaterGrid.DisplayWireframe, new GUIContent(" Show Wireframe", EditorGUIUtility.IconContent((WaterGrid.DisplayWireframe ? "animationvisibilitytoggleon" : "animationvisibilitytoggleoff")).image), "Button");
|
||||
}
|
||||
|
||||
serializedObject.Update();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUILayout.LabelField("Appearance", EditorStyles.boldLabel);
|
||||
EditorGUILayout.PropertyField(material);
|
||||
if(material.objectReferenceValue == null) EditorGUILayout.HelpBox("A material must be assigned", MessageType.Error);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.LabelField("Movement", EditorStyles.boldLabel);
|
||||
|
||||
EditorGUILayout.PropertyField(followSceneCamera);
|
||||
using (new EditorGUI.DisabledScope(autoAssignCamera.boolValue))
|
||||
{
|
||||
EditorGUILayout.PropertyField(followTarget);
|
||||
}
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField(autoAssignCamera);
|
||||
EditorGUI.indentLevel--;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.LabelField("Grid geometry", EditorStyles.boldLabel);
|
||||
|
||||
EditorGUILayout.PropertyField(scale, GUILayout.MaxWidth(EditorGUIUtility.labelWidth + 95f));
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
EditorGUILayout.PrefixLabel(rowsColumns.displayName);
|
||||
using (new EditorGUI.DisabledScope(rowsColumns.intValue <= 0))
|
||||
{
|
||||
if (GUILayout.Button("-", EditorStyles.miniButtonLeft, GUILayout.Width(25f)))
|
||||
{
|
||||
rowsColumns.intValue--;
|
||||
}
|
||||
}
|
||||
EditorGUILayout.PropertyField(rowsColumns, GUIContent.none, GUILayout.MaxWidth(40f));
|
||||
if (GUILayout.Button("+", EditorStyles.miniButtonRight, GUILayout.Width(25f)))
|
||||
{
|
||||
rowsColumns.intValue++;
|
||||
}
|
||||
EditorGUILayout.LabelField($"= {rowsColumns.intValue * rowsColumns.intValue} tiles", EditorStyles.miniLabel);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.PropertyField(vertexDistance, new GUIContent("Min. vertex distance", vertexDistance.tooltip));
|
||||
vertexCount = Mathf.FloorToInt(((scale.floatValue / rowsColumns.intValue) / vertexDistance.floatValue) * ((scale.floatValue / rowsColumns.intValue) / vertexDistance.floatValue));
|
||||
//EditorGUILayout.HelpBox($"Vertex count: {vertexCount}", MessageType.None);
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
//Executed here since objects can't be destroyed from OnValidate
|
||||
script.Recreate();
|
||||
}
|
||||
|
||||
UI.DrawFooter();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b340d2e902f13d1438eb157b2904daa3
|
||||
timeCreated: 1680100927
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Editor/Inspectors/WaterGridInspector.cs
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,169 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEditor.AssetImporters;
|
||||
using UnityEngine;
|
||||
|
||||
namespace StylizedWater3
|
||||
{
|
||||
[CustomEditor(typeof(WaterMeshImporter))]
|
||||
public class WaterMeshImporterInspector: ScriptedImporterEditor
|
||||
{
|
||||
private SerializedProperty waterMesh;
|
||||
|
||||
private SerializedProperty shape;
|
||||
|
||||
private SerializedProperty scale;
|
||||
private SerializedProperty UVTiling;
|
||||
|
||||
private SerializedProperty vertexDistance;
|
||||
|
||||
private SerializedProperty noise;
|
||||
private SerializedProperty boundsPadding;
|
||||
|
||||
private WaterMeshImporter importer;
|
||||
|
||||
private bool autoApplyChanges;
|
||||
private bool previewInSceneView
|
||||
{
|
||||
get => EditorPrefs.GetBool("SWS2_PREVIEW_WATER_MESH_ENABLED", true);
|
||||
set => EditorPrefs.SetBool("SWS2_PREVIEW_WATER_MESH_ENABLED", value);
|
||||
}
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
|
||||
importer = (WaterMeshImporter)target;
|
||||
|
||||
waterMesh = serializedObject.FindProperty("waterMesh");
|
||||
|
||||
shape = waterMesh.FindPropertyRelative("shape");
|
||||
scale = waterMesh.FindPropertyRelative("scale");
|
||||
UVTiling = waterMesh.FindPropertyRelative("UVTiling");
|
||||
vertexDistance = waterMesh.FindPropertyRelative("vertexDistance");
|
||||
noise = waterMesh.FindPropertyRelative("noise");
|
||||
boundsPadding = waterMesh.FindPropertyRelative("boundsPadding");
|
||||
|
||||
SceneView.duringSceneGui += OnSceneGUI;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
UI.DrawHeader();
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Space(EditorGUIUtility.labelWidth);
|
||||
previewInSceneView =
|
||||
GUILayout.Toggle(previewInSceneView, new GUIContent(" Preview in scene view", EditorGUIUtility.IconContent(
|
||||
(previewInSceneView ? "animationvisibilitytoggleon" : "animationvisibilitytoggleoff")).image), "Button");
|
||||
}
|
||||
if (previewInSceneView && WaterObject.Instances.Count > 0)
|
||||
{
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Space(EditorGUIUtility.labelWidth);
|
||||
EditorGUILayout.HelpBox($"Drawing on WaterObject instances in the scene ({WaterObject.Instances.Count})", MessageType.None);
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
serializedObject.Update();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUILayout.PropertyField(shape);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.PropertyField(scale);
|
||||
EditorGUILayout.PropertyField(vertexDistance);
|
||||
|
||||
int subdivisions = Mathf.FloorToInt(scale.floatValue / vertexDistance.floatValue);
|
||||
int vertexCount = Mathf.FloorToInt(subdivisions * subdivisions);
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Space(EditorGUIUtility.labelWidth);
|
||||
|
||||
EditorGUILayout.HelpBox($"Vertex count: {vertexCount:N1}", MessageType.None);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.PropertyField(UVTiling);
|
||||
EditorGUILayout.PropertyField(noise);
|
||||
EditorGUILayout.PropertyField(boundsPadding);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
autoApplyChanges = EditorGUILayout.Toggle("Auto-apply changes", autoApplyChanges);
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (autoApplyChanges && HasModified())
|
||||
{
|
||||
this.SaveChanges();
|
||||
|
||||
//importer = (WaterMeshImporter)target;
|
||||
}
|
||||
}
|
||||
|
||||
this.ApplyRevertGUI();
|
||||
|
||||
UI.DrawFooter();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
SceneView.duringSceneGui -= OnSceneGUI;
|
||||
}
|
||||
|
||||
private Material mat;
|
||||
private void OnSceneGUI(SceneView obj)
|
||||
{
|
||||
if (!previewInSceneView)
|
||||
{
|
||||
GL.wireframe = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mat)
|
||||
{
|
||||
mat = new Material(Shader.Find("Unlit/Color"));
|
||||
mat.color = new Color(0,0,0, 0.25f);
|
||||
mat.mainTexture = Texture2D.whiteTexture;
|
||||
}
|
||||
mat.SetPass(0);
|
||||
|
||||
if (importer.waterMesh.mesh)
|
||||
{
|
||||
GL.wireframe = true;
|
||||
if (WaterObject.Instances.Count > 0)
|
||||
{
|
||||
foreach (WaterObject waterObject in WaterObject.Instances)
|
||||
{
|
||||
Graphics.DrawMeshNow(importer.waterMesh.mesh, waterObject.transform.localToWorldMatrix);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SceneView.lastActiveSceneView)
|
||||
{
|
||||
//Position in view
|
||||
Vector3 position = SceneView.lastActiveSceneView.camera.transform.position + (SceneView.lastActiveSceneView.camera.transform.forward * importer.waterMesh.scale * 0.5f);
|
||||
|
||||
Graphics.DrawMeshNow(importer.waterMesh.mesh, position, Quaternion.identity);
|
||||
}
|
||||
}
|
||||
GL.wireframe = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97fbcf08a16d4498b8d18b0ce8df5fee
|
||||
timeCreated: 1728821855
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Editor/Inspectors/WaterMeshImporterInspector.cs
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,149 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
#if URP
|
||||
using UnityEngine.Rendering.Universal;
|
||||
#endif
|
||||
|
||||
namespace StylizedWater3
|
||||
{
|
||||
[CustomEditor(typeof(WaterObject))]
|
||||
[CanEditMultipleObjects]
|
||||
public class WaterObjectInspector : Editor
|
||||
{
|
||||
private WaterObject component;
|
||||
|
||||
private SerializedProperty material;
|
||||
private SerializedProperty meshFilter;
|
||||
private SerializedProperty meshRenderer;
|
||||
|
||||
private bool depthTextureRequired;
|
||||
private bool opaqueTextureRequired;
|
||||
|
||||
private bool showInstances
|
||||
{
|
||||
get => SessionState.GetBool("WATEROBJECT_SHOW_INSTANCES", false);
|
||||
set => SessionState.SetBool("WATEROBJECT_SHOW_INSTANCES", value);
|
||||
}
|
||||
|
||||
private Texture icon;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
component = (WaterObject)target;
|
||||
|
||||
icon = Resources.Load<Texture>("water-object-icon");
|
||||
|
||||
material = serializedObject.FindProperty("material");
|
||||
meshFilter = serializedObject.FindProperty("meshFilter");
|
||||
meshRenderer = serializedObject.FindProperty("meshRenderer");
|
||||
|
||||
CheckMaterial();
|
||||
}
|
||||
|
||||
private void CheckMaterial()
|
||||
{
|
||||
#if URP
|
||||
if (UniversalRenderPipeline.asset == null || component.material == null) return;
|
||||
|
||||
depthTextureRequired = UniversalRenderPipeline.asset.supportsCameraDepthTexture == false && component.material.GetFloat("_DisableDepthTexture") == 0f;
|
||||
opaqueTextureRequired = UniversalRenderPipeline.asset.supportsCameraOpaqueTexture == false && component.material.GetFloat("_RefractionOn") == 1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
#if URP
|
||||
if (UniversalRenderPipeline.asset)
|
||||
{
|
||||
UI.DrawNotification(
|
||||
depthTextureRequired,
|
||||
"Depth texture is disabled, but is required for the water material",
|
||||
"Enable",
|
||||
() =>
|
||||
{
|
||||
StylizedWaterEditor.EnableDepthTexture();
|
||||
CheckMaterial();
|
||||
},
|
||||
MessageType.Error);
|
||||
|
||||
UI.DrawNotification(
|
||||
opaqueTextureRequired,
|
||||
"Opaque texture is disabled, but is required for the water material",
|
||||
"Enable",
|
||||
() =>
|
||||
{
|
||||
StylizedWaterEditor.EnableOpaqueTexture();
|
||||
CheckMaterial();
|
||||
},
|
||||
MessageType.Error);
|
||||
}
|
||||
#endif
|
||||
|
||||
EditorGUILayout.HelpBox("This component provides a means for other scripts to identify and find water bodies", MessageType.None);
|
||||
|
||||
|
||||
UI.DrawNotification(component.gameObject.layer != LayerMask.NameToLayer("Water"), "Object is not on the \"Water\" layer. This means it won't work with height readback operations", "Fix", () =>
|
||||
{
|
||||
component.gameObject.layer = LayerMask.NameToLayer("Water");
|
||||
}, MessageType.Warning);
|
||||
|
||||
EditorGUILayout.LabelField("References (Read only)", EditorStyles.boldLabel);
|
||||
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
{
|
||||
EditorGUILayout.PropertyField(material);
|
||||
EditorGUILayout.PropertyField(meshFilter);
|
||||
EditorGUILayout.PropertyField(meshRenderer);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
//In case the material was changed on the attached Mesh Renderer, reflect the change
|
||||
foreach (Object currentTarget in targets)
|
||||
{
|
||||
WaterObject water = (WaterObject)currentTarget;
|
||||
water.FetchWaterMaterial();
|
||||
}
|
||||
|
||||
if (WaterObject.Instances.Count > 1)
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
|
||||
showInstances = EditorGUILayout.BeginFoldoutHeaderGroup(showInstances, $"Instances ({WaterObject.Instances.Count})");
|
||||
|
||||
if (showInstances)
|
||||
{
|
||||
this.Repaint();
|
||||
|
||||
using (new EditorGUILayout.VerticalScope(EditorStyles.textArea))
|
||||
{
|
||||
foreach (WaterObject obj in WaterObject.Instances)
|
||||
{
|
||||
var rect = EditorGUILayout.BeginHorizontal(EditorStyles.miniLabel);
|
||||
|
||||
if (rect.Contains(Event.current.mousePosition))
|
||||
{
|
||||
EditorGUIUtility.AddCursorRect(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 27, 27), MouseCursor.Link);
|
||||
EditorGUI.DrawRect(rect, Color.gray * (EditorGUIUtility.isProSkin ? 0.66f : 0.20f));
|
||||
}
|
||||
|
||||
if (GUILayout.Button(new GUIContent(" " + obj.name, icon), EditorStyles.miniLabel, GUILayout.Height(20f)))
|
||||
{
|
||||
EditorGUIUtility.PingObject(obj);
|
||||
Selection.activeGameObject = obj.gameObject;
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9bef468d6b3e196468eb63fc634d8dca
|
||||
timeCreated: 1685014300
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Editor/Inspectors/WaterObjectInspector.cs
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,381 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
using UnityEditor.AssetImporters;
|
||||
|
||||
namespace StylizedWater3
|
||||
{
|
||||
[CustomEditor(typeof(WaterShaderImporter))]
|
||||
[CanEditMultipleObjects]
|
||||
public class WaterShaderImporterEditor : ScriptedImporterEditor
|
||||
{
|
||||
private WaterShaderImporter importer;
|
||||
|
||||
private SerializedProperty template;
|
||||
|
||||
private SerializedProperty settings;
|
||||
|
||||
private SerializedProperty shaderName;
|
||||
private SerializedProperty hidden;
|
||||
private SerializedProperty type;
|
||||
|
||||
private SerializedProperty autoIntegration;
|
||||
private SerializedProperty fogIntegration;
|
||||
|
||||
private SerializedProperty lightCookies;
|
||||
private SerializedProperty additionalLightCaustics;
|
||||
private SerializedProperty additionalLightTranslucency;
|
||||
private SerializedProperty singleCausticsLayers;
|
||||
|
||||
private SerializedProperty customIncludeDirectives;
|
||||
private SerializedProperty additionalPasses;
|
||||
|
||||
private SerializedProperty configurationState;
|
||||
|
||||
private bool underwaterRenderingInstalled;
|
||||
private bool dynamicEffectsInstalled;
|
||||
private FogIntegration.Integration firstIntegration;
|
||||
private bool curvedWorldInstalled;
|
||||
|
||||
private bool showDependencies;
|
||||
|
||||
private ShaderData shaderData;
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
|
||||
underwaterRenderingInstalled = StylizedWaterEditor.UnderwaterRenderingInstalled();
|
||||
dynamicEffectsInstalled = StylizedWaterEditor.DynamicEffectsInstalled();
|
||||
firstIntegration = FogIntegration.GetFirstInstalled();
|
||||
curvedWorldInstalled = StylizedWaterEditor.CurvedWorldInstalled(out var _);
|
||||
|
||||
importer = (WaterShaderImporter)target;
|
||||
|
||||
template = serializedObject.FindProperty("template");
|
||||
|
||||
settings = serializedObject.FindProperty("settings");
|
||||
//settings.isExpanded = true;
|
||||
|
||||
shaderName = settings.FindPropertyRelative("shaderName");
|
||||
hidden = settings.FindPropertyRelative("hidden");
|
||||
type = settings.FindPropertyRelative("type");
|
||||
|
||||
lightCookies = settings.FindPropertyRelative("lightCookies");
|
||||
additionalLightCaustics = settings.FindPropertyRelative("additionalLightCaustics");
|
||||
additionalLightTranslucency = settings.FindPropertyRelative("additionalLightTranslucency");
|
||||
singleCausticsLayers = settings.FindPropertyRelative("singleCausticsLayer");
|
||||
|
||||
autoIntegration = settings.FindPropertyRelative("autoIntegration");
|
||||
fogIntegration = settings.FindPropertyRelative("fogIntegration");
|
||||
|
||||
customIncludeDirectives = settings.FindPropertyRelative("customIncludeDirectives");
|
||||
additionalPasses = settings.FindPropertyRelative("additionalPasses");
|
||||
|
||||
configurationState = serializedObject.FindProperty("configurationState");
|
||||
|
||||
Shader shader = importer.GetShader();
|
||||
if (shader != null)
|
||||
{
|
||||
shaderData = ShaderUtil.GetShaderData(shader);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool HasPreviewGUI()
|
||||
{
|
||||
//Hide the useless sphere preview :)
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
//base.OnInspectorGUI();
|
||||
Color defaultColor = GUI.contentColor;
|
||||
|
||||
UI.DrawHeader();
|
||||
|
||||
Shader shader = AssetDatabase.LoadAssetAtPath<Shader>(importer.assetPath);
|
||||
if (shader == null)
|
||||
{
|
||||
UI.DrawNotification("Shader failed to compile, try to manually recompile it now.", MessageType.Error);
|
||||
}
|
||||
|
||||
UI.DrawNotification(EditorSettings.asyncShaderCompilation == false, "Asynchronous shader compilation is disabled in the Editor settings." +
|
||||
"\n\n" +
|
||||
"This will very likely cause the editor to crash when trying to compile this shader (D3D11 Swapchain error).", "Enable", () =>
|
||||
{
|
||||
EditorSettings.asyncShaderCompilation = true;
|
||||
}, MessageType.Error);
|
||||
|
||||
if (GUILayout.Button(new GUIContent(" Recompile", EditorGUIUtility.IconContent("RotateTool").image), GUILayout.MinHeight(30f)))
|
||||
{
|
||||
importer.Reimport();
|
||||
return;
|
||||
}
|
||||
|
||||
GUILayout.Space(-2f);
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
using (new EditorGUI.DisabledGroupScope(shader == null))
|
||||
{
|
||||
if (GUILayout.Button(new GUIContent(" Show Generated Code", EditorGUIUtility.IconContent("align_horizontally_left_active").image), EditorStyles.miniButtonLeft, GUILayout.Height(28f)))
|
||||
{
|
||||
GenericMenu menu = new GenericMenu();
|
||||
|
||||
menu.AddItem(new GUIContent("With tessellation"), false, () => OpenGeneratedCode(true));
|
||||
menu.AddItem(new GUIContent("Without tessellation"), false, () => OpenGeneratedCode(false));
|
||||
|
||||
menu.ShowAsContext();
|
||||
}
|
||||
if (GUILayout.Button(new GUIContent("Clear cache", "Unity's shader compiler will cache the compiled shader, and internally use that." +
|
||||
"\n\nThis may result in seemingly false-positive shader errors. Such as in the case of importing the shader, before the URP shader libraries are." +
|
||||
"\n\nClearing the cache gives the compiler a kick, and makes the shader properly represent the current state of the project/dependencies."), EditorStyles.miniButtonRight, GUILayout.Height(28f)))
|
||||
{
|
||||
importer.ClearCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
serializedObject.Update();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUILayout.PropertyField(template);
|
||||
|
||||
if (template.objectReferenceValue == null) EditorGUILayout.HelpBox("• Template is assumed to be in the contents of the file itself", MessageType.None);
|
||||
//EditorGUILayout.LabelField(importer.GetTemplatePath(), EditorStyles.miniLabel);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.LabelField("Settings", EditorStyles.boldLabel);
|
||||
EditorGUILayout.PropertyField(shaderName);
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField(hidden);
|
||||
EditorGUI.indentLevel--;
|
||||
|
||||
EditorGUILayout.PropertyField(type);
|
||||
|
||||
if (type.intValue == (int)WaterShaderImporter.WaterShaderSettings.ShaderType.WaterSurface)
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.LabelField("Integrations", EditorStyles.boldLabel);
|
||||
|
||||
EditorGUILayout.PropertyField(autoIntegration, new GUIContent("Automatic detection", autoIntegration.tooltip));
|
||||
if (autoIntegration.boolValue)
|
||||
{
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.LabelField("Fog post-processing", GUILayout.MaxWidth(EditorGUIUtility.labelWidth));
|
||||
EditorGUI.indentLevel--;
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope(EditorStyles.textField))
|
||||
{
|
||||
GUI.contentColor = Color.green;
|
||||
EditorGUILayout.LabelField(firstIntegration.name);
|
||||
|
||||
GUI.contentColor = defaultColor;
|
||||
}
|
||||
}
|
||||
|
||||
if (curvedWorldInstalled)
|
||||
{
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.LabelField("Curved World 2020", GUILayout.MaxWidth(EditorGUIUtility.labelWidth));
|
||||
EditorGUI.indentLevel--;
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope(EditorStyles.textField))
|
||||
{
|
||||
GUI.contentColor = Color.green;
|
||||
EditorGUILayout.LabelField("Installed");
|
||||
GUI.contentColor = defaultColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.PropertyField(fogIntegration);
|
||||
}
|
||||
if (curvedWorldInstalled) EditorGUILayout.HelpBox("Curved World integration must be manually activated through minor code changes, see documentation.", MessageType.Info);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.LabelField("Functionality support", EditorStyles.boldLabel);
|
||||
|
||||
EditorGUILayout.PropertyField(lightCookies);
|
||||
EditorGUILayout.PropertyField(additionalLightCaustics);
|
||||
EditorGUILayout.PropertyField(additionalLightTranslucency);
|
||||
EditorGUILayout.PropertyField(singleCausticsLayers);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.LabelField("Extensions", EditorStyles.boldLabel);
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
EditorGUILayout.LabelField("Underwater Rendering", GUILayout.MaxWidth(EditorGUIUtility.labelWidth));
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope(EditorStyles.textField))
|
||||
{
|
||||
if (underwaterRenderingInstalled)
|
||||
{
|
||||
GUI.contentColor = Color.green;
|
||||
EditorGUILayout.LabelField("Installed");
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.contentColor = new Color(1f, 0.65f, 0f);
|
||||
EditorGUILayout.LabelField("(Not installed)");
|
||||
}
|
||||
|
||||
GUI.contentColor = defaultColor;
|
||||
}
|
||||
}
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
EditorGUILayout.LabelField("Dynamic Effects", GUILayout.MaxWidth(EditorGUIUtility.labelWidth));
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope(EditorStyles.textField))
|
||||
{
|
||||
if (dynamicEffectsInstalled)
|
||||
{
|
||||
GUI.contentColor = Color.green;
|
||||
EditorGUILayout.LabelField("Installed");
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.contentColor = new Color(1f, 0.65f, 0f);
|
||||
EditorGUILayout.LabelField("(Not installed)");
|
||||
}
|
||||
|
||||
GUI.contentColor = defaultColor;
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.PropertyField(customIncludeDirectives);
|
||||
if (customIncludeDirectives.isExpanded)
|
||||
{
|
||||
EditorGUILayout.HelpBox("These are defined in a HLSLINCLUDE block and apply to all passes" +
|
||||
"\nMay be used to insert custom code.", MessageType.Info);
|
||||
}
|
||||
EditorGUILayout.PropertyField(additionalPasses);
|
||||
if (additionalPasses.isExpanded)
|
||||
{
|
||||
EditorGUILayout.LabelField("Compiled passes:", EditorStyles.miniBoldLabel);
|
||||
if (shaderData != null)
|
||||
{
|
||||
ShaderData.Subshader subShader = shaderData.GetSubshader(0);
|
||||
int passCount = subShader.PassCount;
|
||||
for (int i = 0; i < passCount; i++)
|
||||
{
|
||||
EditorGUILayout.LabelField($"{i}: {subShader.GetPass(i).Name}", EditorStyles.miniLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
//Force the parameter to a matching value.
|
||||
//This way, if the "auto-integration" option is used, the .meta file will be changed when using the shader in a package, spanning different projects.
|
||||
//When switching a different project, the file will be seen as changed and will be re-imported, in turn applying the project-specific integration.
|
||||
if (autoIntegration.boolValue)
|
||||
{
|
||||
fogIntegration.intValue = (int)firstIntegration.asset;
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
this.ApplyRevertGUI();
|
||||
|
||||
showDependencies = EditorGUILayout.BeginFoldoutHeaderGroup(showDependencies, $"Dependencies ({importer.dependencies.Count})");
|
||||
|
||||
if (showDependencies)
|
||||
{
|
||||
this.Repaint();
|
||||
|
||||
using (new EditorGUILayout.VerticalScope(EditorStyles.textArea))
|
||||
{
|
||||
foreach (string dependency in importer.dependencies)
|
||||
{
|
||||
var rect = EditorGUILayout.BeginHorizontal(EditorStyles.miniLabel);
|
||||
|
||||
if (rect.Contains(Event.current.mousePosition))
|
||||
{
|
||||
EditorGUIUtility.AddCursorRect(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 27, 27), MouseCursor.Link);
|
||||
EditorGUI.DrawRect(rect, Color.gray * (EditorGUIUtility.isProSkin ? 0.66f : 0.20f));
|
||||
}
|
||||
|
||||
if (GUILayout.Button(dependency == string.Empty ? new GUIContent(" (Missing)", EditorGUIUtility.IconContent("console.warnicon.sml").image) : new GUIContent(" " + dependency, EditorGUIUtility.IconContent("TextAsset Icon").image),
|
||||
EditorStyles.miniLabel, GUILayout.Height(20f)))
|
||||
{
|
||||
if (dependency != string.Empty)
|
||||
{
|
||||
TextAsset file = AssetDatabase.LoadAssetAtPath<TextAsset>(dependency);
|
||||
|
||||
EditorGUIUtility.PingObject(file);
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.HelpBox("Should any of these files be modified/moved/deleted, this shader will also re-import", MessageType.Info);
|
||||
}
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
|
||||
//EditorGUILayout.PropertyField(configurationState);
|
||||
|
||||
UI.DrawFooter();
|
||||
|
||||
if (shader)
|
||||
{
|
||||
UI.DrawNotification(ShaderUtil.ShaderHasError(shader), "Errors may be false-positives due to caching", "Clear cache", () => importer.ClearCache(true), MessageType.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGeneratedCode(bool tessellation)
|
||||
{
|
||||
importer = (WaterShaderImporter)target;
|
||||
|
||||
string filePath = $"{Application.dataPath.Replace("Assets", string.Empty)}Temp/{importer.settings.shaderName}(Generated Code).shader";
|
||||
|
||||
string templatePath = importer.GetTemplatePath();
|
||||
string[] lines = File.ReadAllLines(templatePath);
|
||||
|
||||
string code = TemplateParser.CreateShaderCode(importer.GetTemplatePath(), ref lines, importer, tessellation);
|
||||
File.WriteAllText(filePath, code);
|
||||
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
Debug.LogError(string.Format("Path {0} doesn't exists", filePath));
|
||||
return;
|
||||
}
|
||||
|
||||
string externalScriptEditor = ScriptEditorUtility.GetExternalScriptEditor();
|
||||
if (externalScriptEditor != "internal")
|
||||
{
|
||||
InternalEditorUtility.OpenFileAtLineExternal(filePath, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Application.OpenURL("file://" + filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e59f1c83d0548634b871a63644021f94
|
||||
timeCreated: 1691138447
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Editor/Inspectors/WaterShaderImporterEditor.cs
|
||||
uploadId: 895866
|
||||
Reference in New Issue
Block a user