static void CheckRenderPipeline()
        {
            RenderPipeline    rpInUnity = UnityInfo.GetCurrentRenderPipelineInUse();
            ShapesImportState inst      = Instance;

            if (inst == null)
            {
                Debug.LogWarning("Failed to detect render pipeline - Shapes will retry on the next script recompile");
                return;                 // I guess some weird import order shenan happened? :c
            }

            RenderPipeline rpShapesShaders = inst.currentShaderRP;

            if (rpInUnity != rpShapesShaders)
            {
                string rpStr = rpInUnity.ToString();
                if (rpInUnity == RenderPipeline.Legacy)
                {
                    rpStr = "the built-in render pipeline";
                }
                string desc = $"Looks like you're using {rpStr}!\nShapes will now regenerate all shaders, it might take a lil while~";
                EditorUtility.DisplayDialog("Shapes", desc, "ok");
                CodegenShaders.GenerateShadersAndMaterials();
            }
        }
Exemplo n.º 2
0
 void AdvancedSettings()
 {
     using (ShapesUI.Group) {
         GUILayout.Label("Advanced", EditorStyles.boldLabel);
         if (ShapesUI.CenteredButton(new GUIContent("Regenerate Shaders & Materials", "Generates all shaders and materials in Shapes")))
         {
             CodegenShaders.GenerateShadersAndMaterials();
         }
         if (ShapesUI.CenteredButton(new GUIContent("Regenerate Draw Overloads", "Regenerates all Draw.X overload functions to DrawOverloads.cs")))
         {
             CodegenDrawOverloads.GenerateDrawOverloadsScript();
         }
     }
 }
Exemplo n.º 3
0
        static void ForceSetRpSecondPass(RenderPipeline targetRP)
        {
            // makes sure all shaders are compiled to a specific render pipeline
            RenderPipeline rpShapesShaders = Instance.currentShaderRP;

            if (rpShapesShaders != targetRP)
            {
                CodegenShaders.GenerateShadersAndMaterials(targetRP);
            }

            if (targetRP == RenderPipeline.URP)
            {
                string msg = "In order for immediate mode drawing to work, URP render data needs the shapes render features. Would you like to open Shapes settings to make sure immediate mode drawing is supported?";
                if (EditorUtility.DisplayDialog("URP render features", msg, "yes", "no, I don't need IM drawing"))
                {
                    MenuItems.OpenCsharpSettings();
                }
            }

            // also on second pass
            MakeSureSampleMaterialsAreValid();
        }
Exemplo n.º 4
0
 void AdvancedSettings()
 {
     using (ShapesUI.Group) {
         GUILayout.Label("Advanced", EditorStyles.boldLabel);
         if (ShapesUI.CenteredButton(new GUIContent("Regenerate Shaders & Materials", "Generates all shaders and materials in Shapes")))
         {
             CodegenShaders.GenerateShadersAndMaterials(UnityInfo.GetCurrentRenderPipelineInUse());
         }
         if (ShapesUI.CenteredButton(new GUIContent("Regenerate Draw Overloads", "Regenerates all Draw.X overload functions to DrawOverloads.cs")))
         {
             CodegenDrawOverloads.GenerateDrawOverloadsScript();
         }
         if (ShapesUI.CenteredButton(new GUIContent("Regenerate Component Interfaces", "Regenerates all Shape component interfaces")))
         {
             CodegenInterfaces.Generate();
         }
         if (ShapesUI.CenteredButton(new GUIContent("Regenerate IM meta MPBs", "Regenerates all meta-material property blocks for each shape, based on their shader parameters in the core.cginc files")))
         {
             CodegenMpbs.Generate();
         }
     }
 }
Exemplo n.º 5
0
        static void CheckRenderPipeline()
        {
            RenderPipeline    rpInUnity = UnityInfo.GetCurrentRenderPipelineInUse();
            ShapesImportState inst      = Instance;

            if (inst == null)
            {
                Debug.LogWarning("Failed to detect render pipeline - Shapes will retry on the next script recompile");
                return;                 // I guess some weird import order shenan happened? :c
            }

            // set up preprocessor defines, this will also indirectly trigger a second pass of this whole method
            EnsurePreprocessorsAreDefined(rpInUnity);

            // makes sure all shaders are compiled to a specific render pipeline
            RenderPipeline rpShapesShaders = inst.currentShaderRP;

            if (rpInUnity != rpShapesShaders)
            {
                string rpStr = rpInUnity.ToString();
                if (rpInUnity == RenderPipeline.Legacy)
                {
                    rpStr = "the built-in render pipeline";
                }
                string desc = $"Looks like you're using {rpStr}!\nShapes will now regenerate all shaders, it might take a lil while~";
                EditorUtility.DisplayDialog("Shapes", desc, "ok");
                CodegenShaders.GenerateShadersAndMaterials();
            }

            // second pass check - make sure URP forward renderer has the custom Shapes pass in it
                        #if SHAPES_URP
            EnsureShapesPassExistsInTheUrpRenderer();
                        #endif

            // also on second pass
            MakeSureSampleMaterialsAreValid();
        }
Exemplo n.º 6
0
 public static void GenerateShadersAndMaterials() => CodegenShaders.GenerateShadersAndMaterials();