Beispiel #1
0
        public bool IsPipelineCompatible(RenderPipelineAsset renderPipelineAsset)
        {
            const string RenderPipelineAssetName = "HDRenderPipelineAsset";

            if (renderPipelineAsset == null)
            {
                return(false);
            }

            var rpType = renderPipelineAsset.GetType();

            return(RuntimeUtilities.GetAllAssemblyTypes()
                   .Where(t => t.Name == RenderPipelineAssetName)
                   .Any(t => t.IsAssignableFrom(rpType)));
        }
Beispiel #2
0
        static void ReloadDecoratorTypes()
        {
            s_AttributeDecorators.Clear();

            // Look for all the valid attribute decorators
            var types = RuntimeUtilities.GetAllAssemblyTypes()
                        .Where(
                t => t.IsSubclassOf(typeof(AttributeDecorator)) &&
                t.IsDefined(typeof(DecoratorAttribute), false) &&
                !t.IsAbstract
                );

            // Store them
            foreach (var type in types)
            {
                var attr      = type.GetAttribute <DecoratorAttribute>();
                var decorator = (AttributeDecorator)Activator.CreateInstance(type);
                s_AttributeDecorators.Add(attr.attributeType, decorator);
            }
        }
Beispiel #3
0
        public void Init(PostProcessProfile asset, SerializedObject serializedObject)
        {
            Assert.IsNotNull(asset);
            Assert.IsNotNull(serializedObject);

            this.asset         = asset;
            m_SerializedObject = serializedObject;
            m_SettingsProperty = serializedObject.FindProperty("settings");
            Assert.IsNotNull(m_SettingsProperty);

            m_EditorTypes = new Dictionary <Type, Type>();
            m_Editors     = new List <PostProcessEffectBaseEditor>();

            // Gets the list of all available postfx editors
            var editorTypes = RuntimeUtilities.GetAllAssemblyTypes()
                              .Where(
                t => t.IsSubclassOf(typeof(PostProcessEffectBaseEditor)) &&
                t.IsDefined(typeof(PostProcessEditorAttribute), false) &&
                !t.IsAbstract
                );

            // Map them to their corresponding settings type
            foreach (var editorType in editorTypes)
            {
                var attribute = editorType.GetAttribute <PostProcessEditorAttribute>();
                m_EditorTypes.Add(attribute.settingsType, editorType);
            }

            // Create editors for existing settings
            for (int i = 0; i < this.asset.settings.Count; i++)
            {
                CreateEditor(this.asset.settings[i], m_SettingsProperty.GetArrayElementAtIndex(i));
            }

            // Keep track of undo/redo to redraw the inspector when that happens
            Undo.undoRedoPerformed += OnUndoRedoPerformed;
        }