Пример #1
0
        int RenderInjectionPoint(PostProcessEvent evt, PostProcessRenderContext context, string marker, int releaseTargetAfterUse = -1)
        {
            int tempTarget       = m_TargetPool.Get();
            var finalDestination = context.destination;

            var cmd = context.command;

            context.GetScreenSpaceTemporaryRT(cmd, tempTarget, 0, context.sourceFormat);
            context.destination = tempTarget;
            RenderList(sortedBundles[evt], context, marker);
            context.source      = tempTarget;
            context.destination = finalDestination;

            if (releaseTargetAfterUse > -1)
            {
                cmd.ReleaseTemporaryRT(releaseTargetAfterUse);
            }

            return(tempTarget);
        }
        int RenderInjectionPoint(PostProcessEvent evt, PostProcessRenderContext context, string marker, int releaseTargetAfterUse = -1)
        {
            int tempTarget       = m_TargetPool.Get();
            var finalDestination = context.destination;

            var cmd = context.command;

            cmd.GetTemporaryRT(tempTarget, context.width, context.height, 24, FilterMode.Bilinear, context.sourceFormat);
            context.destination = tempTarget;
            RenderList(sortedBundles[evt], context, marker);
            context.source      = tempTarget;
            context.destination = finalDestination;

            if (releaseTargetAfterUse > -1)
            {
                cmd.ReleaseTemporaryRT(releaseTargetAfterUse);
            }

            return(tempTarget);
        }
Пример #3
0
        private void UpdateBundleSortList(List <SerializedBundleRef> sortedList, PostProcessEvent evt)
        {
            // First get all effects associated with the injection point
            var effects = m_Bundles
                          .Where(kvp => kvp.Value.attribute.eventType == evt && !kvp.Value.attribute.builtinEffect)
                          .Select(kvp => kvp.Value)
                          .ToList();

            // Remove types that don't exist anymore
            sortedList.RemoveAll(x =>
            {
                var searchStr = x.assemblyQualifiedName;
                return(!effects.Exists(b => b.settings.GetType().AssemblyQualifiedName == searchStr));
            });

            // Add new ones
            foreach (var effect in effects)
            {
                var typeName = effect.settings.GetType().AssemblyQualifiedName;

                if (!sortedList.Exists(b => b.assemblyQualifiedName == typeName))
                {
                    var sbr = new SerializedBundleRef {
                        assemblyQualifiedName = typeName
                    };
                    sortedList.Add(sbr);
                }
            }

            // Link internal references
            foreach (var effect in sortedList)
            {
                var typeName = effect.assemblyQualifiedName;
                var bundle   = effects.Find(b => b.settings.GetType().AssemblyQualifiedName == typeName);
                effect.bundle = bundle;
            }
        }
Пример #4
0
        void OnGUI()
        {
            if (m_pathButtonStyle == null)
            {
                m_pathButtonStyle = "minibutton";
            }

            m_scrollPos = EditorGUILayout.BeginScrollView(m_scrollPos, GUILayout.Height(position.height));

            EditorGUILayout.BeginVertical(m_contentStyle);
            EditorGUI.BeginChangeCheck();
            m_currentShader = EditorGUILayout.ObjectField("Shader", m_currentShader, typeof(Shader), false) as Shader;
            if (EditorGUI.EndChangeCheck())
            {
                GetInitialInfo(m_currentShader);
            }

            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("Path and Filename");
            EditorGUILayout.BeginHorizontal();
            m_pathButtonContent.text = m_folderPath;
            Vector2 buttonSize = m_pathButtonStyle.CalcSize(m_pathButtonContent);

            if (GUILayout.Button(m_pathButtonContent, m_pathButtonStyle, GUILayout.MaxWidth(Mathf.Min(position.width * 0.5f, buttonSize.x))))
            {
                string folderpath = EditorUtility.OpenFolderPanel("Save Texture Array to folder", "Assets/", "");
                folderpath = FileUtil.GetProjectRelativePath(folderpath);
                if (string.IsNullOrEmpty(folderpath))
                {
                    m_folderPath = "Assets/";
                }
                else
                {
                    m_folderPath = folderpath + "/";
                }
            }

            m_settingsClassName = EditorGUILayout.TextField(m_settingsClassName, GUILayout.ExpandWidth(true));

            EditorGUILayout.LabelField(".cs", GUILayout.MaxWidth(40));
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Separator();

            m_menuEntry = EditorGUILayout.TextField("Name", m_menuEntry);

            EditorGUILayout.Separator();

            m_eventType = (PostProcessEvent)EditorGUILayout.EnumPopup("Event Type", m_eventType);

            EditorGUILayout.Separator();

            m_tooltipsFoldout = EditorGUILayout.Foldout(m_tooltipsFoldout, "Tooltips");
            if (m_tooltipsFoldout)
            {
                EditorGUI.indentLevel++;
                for (int i = 0; i < m_tooltips.Count; i++)
                {
                    m_tooltips[i].Tooltip = EditorGUILayout.TextField(m_tooltips[i].Name, m_tooltips[i].Tooltip);
                }
                EditorGUI.indentLevel--;
            }

            EditorGUILayout.Separator();

            if (GUILayout.Button("Build"))
            {
                string propertiesDecl = string.Empty;
                string propertiesSet  = string.Empty;
                GetShaderInfoFromShaderAsset(ref propertiesDecl, ref propertiesSet);
                string template = PPSFullTemplate;
                template = template.Replace(PPSRendererClass, m_rendererClassName);
                template = template.Replace(PPSSettingsClass, m_settingsClassName);
                template = template.Replace(PPSEventType, m_eventType.ToString());
                template = template.Replace(PPSPropertiesDecl, propertiesDecl);
                template = template.Replace(PPSPropertySet, propertiesSet);
                template = template.Replace(PPSMenuEntry, m_menuEntry);
                template = template.Replace(PPSShader, m_currentShader.name);
                string path = m_folderPath + m_settingsClassName + ".cs";
                IOUtils.SaveTextfileToDisk(template, path, false);
                AssetDatabase.Refresh();
            }

            EditorGUILayout.EndVertical();
            EditorGUILayout.EndScrollView();
            m_draggableArea.size = position.size;
            m_dragAndDropTool.TestDragAndDrop(m_draggableArea);
        }
Пример #5
0
 public UbarBehavior(Shader ubarShader, PostProcessEvent ubarPostProcessEvent)
 {
     shader           = ubarShader;
     postProcessEvent = ubarPostProcessEvent;
 }