private static void ResetGUID(MenuCommand command) { if (command.context is not RaymarchBase rmBase) { return; } rmBase.guid.ResetGUID(); RaymarchShaderGen.GenerateRaymarchShader(); }
protected override void DrawInspector() { EditorGUILayout.LabelField("Operation Function", BoldLabelStyle); EditorGUI.BeginChangeCheck(); Target.operation.ShaderFeatureAsset = (OperationShaderFeatureAsset)EditorGUILayout.ObjectField(GUIContent.none, Target.operation.ShaderFeatureAsset, typeof(OperationShaderFeatureAsset), false); if (EditorGUI.EndChangeCheck()) { RaymarchShaderGen.GenerateRaymarchShader(); } Target.operation = ShaderFeature <OperationShaderFeatureAsset> .Editor.ShaderVariableField( new GUIContent("Operation Variables"), Target.operation); }
public static void UpdateAllRaymarchScenes() { if (Application.isPlaying) { Debug.LogError("Cannot update all raymarch scenes while playing!"); } Debug.Log("Updating all raymarch scenes"); string[] guids = AssetDatabase.FindAssets($"t:{nameof(SceneAsset)}", null); List <string> scenePaths = new List <string>(guids.Length); scenePaths.AddRange(guids.Select(AssetDatabase.GUIDToAssetPath)); Scene currentScene = SceneManager.GetActiveScene(); string currentScenePath = string.Empty; foreach (var path in scenePaths) { // NOTE(WSWhitehouse): Ignore scenes that are located in the packages if (path.StartsWith("Packages/")) { continue; } Scene openScene = EditorSceneManager.OpenScene(path); if (openScene.name == currentScene.name) { currentScenePath = path; } if (RaymarchScene.Get() == null) { continue; } RaymarchShaderGen.GenerateRaymarchShader(); } if (!string.IsNullOrEmpty(currentScenePath)) { EditorSceneManager.OpenScene(currentScenePath); } }
public override void SignalShaderFeatureUpdated() { base.SignalShaderFeatureUpdated(); RaymarchShaderGen.GenerateUtilShader <MaterialShaderFeatureAsset>("MaterialFunctions"); }
private static void ForceRenderScene() { RaymarchShaderGen.ForceRenderScene(); }
[MenuItem("Raymarching/Force Render Scene %#z")] // shortcut: Ctrl + Shift + Z public static void ForceRenderScene() { RaymarchShaderGen.ForceRenderScene(); }
[MenuItem("Raymarching/Generate Raymarch Shader %#x")] // shortcut: Ctrl + Shift + X public static void GenerateRaymarchShader() { RaymarchShaderGen.GenerateRaymarchShader(); }