public override SharedInstance <T, TSerializer> Edit(Rect region, GUIContent label, SharedInstance <T, TSerializer> element, fiGraphMetadata metadata) { TryEnsureScript(); if (typeof(TActual).IsGenericType) { region = EditorGUI.PrefixLabel(region, label); float ButtonRectWidth = 23; Rect buttonRect = region, objectRect = region; buttonRect.x += buttonRect.width - ButtonRectWidth; buttonRect.width = ButtonRectWidth; buttonRect.height = EditorGUIUtility.singleLineHeight; objectRect.width -= buttonRect.width; if (GUI.Button(buttonRect, new GUIContent("\u2261"))) { fiSharedInstanceSelectorWindow.Show(typeof(T), typeof(SharedInstance <T, TSerializer>), instance => { metadata.GetMetadata <SharedInstanceMetadata>().UpdatedInstance = fiOption.Just((SharedInstance <T, TSerializer>)instance); }); } fiEditorGUI.PushHierarchyMode(false); // Use the standard object property editor element = EditorChain.GetNextEditor(this).Edit(objectRect, GUIContent.none, element, metadata.Enter("ObjectReference")); fiEditorGUI.PopHierarchyMode(); } else { if (element != null) { fiEditorGUI.PushHierarchyMode(false); element.Instance = PropertyEditor.Get(typeof(T), null).FirstEditor.Edit(region, new GUIContent("Instance"), element.Instance, new fiGraphMetadataChild { Metadata = metadata }); fiEditorGUI.PopHierarchyMode(); } } var sharedInstanceMetadata = metadata.GetMetadata <SharedInstanceMetadata>(); if (sharedInstanceMetadata.UpdatedInstance.HasValue) { element = sharedInstanceMetadata.UpdatedInstance.Value; sharedInstanceMetadata.UpdatedInstance = fiOption <SharedInstance <T, TSerializer> > .Empty; GUI.changed = true; } return(element); }
public override float GetElementHeight(GUIContent label, SharedInstance <T, TSerializer> element, fiGraphMetadata metadata) { if (typeof(TActual).IsGenericType == false) { return(PropertyEditor.Get(typeof(T), null).FirstEditor.GetElementHeight(new GUIContent("Instance"), element.Instance, new fiGraphMetadataChild { Metadata = metadata })); } TryEnsureScript(); return(EditorChain.GetNextEditor(this).GetElementHeight(label, element, metadata.Enter("ObjectReference", metadata.Context))); }
public virtual TElement Edit(Rect region, GUIContent label, TElement element, fiGraphMetadata metadata) { var nextEditor = EditorChain.GetNextEditor(this); return(PropertyEditorExtensions.Edit(nextEditor, region, label, element, metadata.Enter("IPropertyEditor"))); }
public virtual float GetElementHeight(GUIContent label, TElement element, fiGraphMetadata metadata) { var nextEditor = EditorChain.GetNextEditor(this); return(PropertyEditorExtensions.GetElementHeight(nextEditor, label, element, metadata.Enter("IPropertyEditor"))); }
protected virtual float GetElementHeight(GUIContent label, TElement element, TAttribute attribute, fiGraphMetadata metadata) { var nextEditor = EditorChain.GetNextEditor(this); return(PropertyEditorExtensions.GetElementHeight(nextEditor, label, element, metadata.Enter("IAttributePropertyEditor", metadata.Context))); }