Example #1
0
 void DrawNullMaterial()
 {
     if (NezImGui.CenteredButton("Create Material", 0.5f, ImGui.GetStyle().IndentSpacing * 0.5f))
     {
         var material = new Material();
         SetValue(material);
         _inspectors = TypeInspectorUtils.GetInspectableProperties(material);
     }
 }
Example #2
0
        public override void Initialize()
        {
            base.Initialize();

            var effect = GetValue <Effect>();

            _name += $" ({effect.GetType().Name})";

            var inspectors = TypeInspectorUtils.GetInspectableProperties(effect);

            foreach (var inspector in inspectors)
            {
                // we dont need the Name field. It serves no purpose.
                if (inspector.Name != "Name")
                {
                    _inspectors.Add(inspector);
                }
            }
        }
Example #3
0
        public override void Initialize()
        {
            base.Initialize();

            _wantsIndentWhenDrawn = true;

            var material = GetValue <Material>();

            if (material == null)
            {
                return;
            }

            // fetch our inspectors and let them know who their parent is
            _inspectors = TypeInspectorUtils.GetInspectableProperties(material);

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

                        didFindEffectInspector = true;
                    }
                }
            }
        }