private static void Bind(VisualElement element, SerializedObjectUpdateWrapper objWrapper, SerializedProperty parentProperty) { IBindable field = element as IBindable; using (var evt = SerializedObjectBindEvent.GetPooled(objWrapper.obj)) { if (SendBindingEvent(evt, element)) { return; } } if (field != null) { if (!string.IsNullOrEmpty(field.bindingPath)) { var foundProperty = BindPropertyWithParent(field, objWrapper, parentProperty); if (foundProperty != null) { parentProperty = foundProperty; } } } for (int i = 0; i < element.shadow.childCount; ++i) { Bind(element.shadow[i], objWrapper, parentProperty); } }
private void Reset(SerializedObjectBindEvent evt) { Clear(); var bindObject = evt.bindObject; if (bindObject == null) { return; } switch (mode) { case Mode.Normal: { var customInspector = CreateCustomInspector(bindObject); if (customInspector != null) { shadow.Add(customInspector); } else { CreateDefaultInspector(bindObject); } break; } case Mode.Default: { CreateDefaultInspector(bindObject); break; } case Mode.Custom: case Mode.IMGUI: { var customInspector = CreateCustomInspector(bindObject); if (customInspector != null) { shadow.Add(customInspector); } else { shadow.Add(new Label("No custom inspector found and Inspector.Mode is set to Custom.")); } break; } } }