Ejemplo n.º 1
0
        public PostProcessorInspector(PostProcessor postProcessor)
        {
            _postProcessor = postProcessor;
            _inspectors    = TypeInspectorUtils.GetInspectableProperties(postProcessor);

            // if we are a Material<T>, we need to fix the duplicate Effect due to the "new T effect"
            if (ReflectionUtils.IsGenericTypeOrSubclassOfGenericType(_postProcessor.GetType()))
            {
                var didFindEffectInspector = false;
                for (var i = 0; i < _inspectors.Count; i++)
                {
                    var isEffectInspector = _inspectors[i] is Nez.ImGuiTools.TypeInspectors.EffectInspector;
                    if (isEffectInspector)
                    {
                        if (didFindEffectInspector)
                        {
                            _inspectors.RemoveAt(i);
                            break;
                        }
                        didFindEffectInspector = true;
                    }
                }
            }

            for (var i = 0; i < _inspectors.Count; i++)
            {
                var effectInspector = _inspectors[i] as Nez.ImGuiTools.TypeInspectors.EffectInspector;
                if (effectInspector != null)
                {
                    effectInspector.AllowsEffectRemoval = false;
                }
            }
        }
Ejemplo n.º 2
0
        public ComponentInspector(ECComponent component)
        {
            _component  = component;
            _inspectors = TypeInspectorUtils.GetInspectableProperties(component);

            if (_component.GetType().IsGenericType)
            {
                var genericType = _component.GetType().GetGenericArguments()[0].Name;
                _name = $"{_component.GetType().BaseType.Name}<{genericType}>";
            }
            else
            {
                _name = _component.GetType().Name;
            }

            var methods = TypeInspectorUtils.GetAllMethodsWithAttribute <InspectorDelegateAttribute>(_component.GetType());

            foreach (var method in methods)
            {
                // only allow zero param methods
                if (method.GetParameters().Length == 0)
                {
                    _componentDelegateMethods.Add((Action)Delegate.CreateDelegate(typeof(Action), _component, method));
                }
            }
        }
Ejemplo n.º 3
0
        public override void Initialize()
        {
            // we need something to inspect here so if we have a null object create a new one
            object obj = GetValue();

            if (obj == null && _valueType.GetConstructor(Type.EmptyTypes) != null)
            {
                obj = Activator.CreateInstance(_valueType);
            }

            if (obj != null)
            {
                _inspectors = TypeInspectorUtils.GetInspectableProperties(obj);
            }
            else
            {
                _inspectors = new List <AbstractTypeInspector>();
            }
        }
Ejemplo n.º 4
0
 public PostProcessorInspector(PostProcessor postProcessor)
 {
     _postProcessor = postProcessor;
     _inspectors    = TypeInspectorUtils.getInspectableProperties(postProcessor);
 }
Ejemplo n.º 5
0
 public override void Initialize()
 {
     this.obj        = GetValue <T>();
     this.inspectors = TypeInspectorUtils.GetInspectableProperties(this.obj);
 }
Ejemplo n.º 6
0
 ObjInspectorSpawn(object obj)
 {
     this.obj        = obj;
     this.inspectors = TypeInspectorUtils.GetInspectableProperties(obj);
 }
Ejemplo n.º 7
0
 public ComponentInspector(Component component)
 {
     _component  = component;
     _inspectors = TypeInspectorUtils.getInspectableProperties(component);
 }