Exemplo n.º 1
0
            public static float GetElementHeight(Type objType, MemberInfo attrs, GUIContent label, object obj, fiGraphMetadataChild metadata, params Type[] skippedEditors)
            {
                if (VerifyBinding("PropertyEditor.GetElementHeight", _Bindings._PropertyEditor_GetElementHeight)) {
                    return _Bindings._PropertyEditor_GetElementHeight(objType, attrs, label, obj, metadata, skippedEditors);
                }

                return 0;
            }
Exemplo n.º 2
0
            public static object Edit(Type objType, MemberInfo attrs, Rect rect, GUIContent label, object obj, fiGraphMetadataChild metadata, params Type[] skippedEditors)
            {
                if (VerifyBinding("PropertyEditor.Edit", _Bindings._PropertyEditor_Edit)) {
                    return _Bindings._PropertyEditor_Edit(objType, attrs, rect, label, obj, metadata, skippedEditors);
                }

                return obj;
            }
Exemplo n.º 3
0
            public static object EditSkipUntilNot(Type[] skipUntilNot, Type objType, MemberInfo attrs, Rect rect, GUIContent label, object obj, fiGraphMetadataChild metadata)
            {
                if (VerifyBinding("PropertyEditor.EditSkipUntilNot", _Bindings._PropertyEditor_EditSkipUntilNot)) {
                    return _Bindings._PropertyEditor_EditSkipUntilNot(skipUntilNot, objType, attrs, rect, label, obj, metadata);
                }

                return obj;
            }
Exemplo n.º 4
0
 /// <summary>
 /// Draws a GUI for editing the given property and returns the updated value. This does
 /// *not* write the updated value to a container.
 /// </summary>
 public static object EditPropertyDirect(Rect region, InspectedProperty property, object propertyValue, fiGraphMetadataChild metadataChild)
 {
     return(EditPropertyDirect(region, property, propertyValue, metadataChild, null));
 }
 private static float GetItemHeight(UnityObject item, fiGraphMetadataChild metadata)
 {
     return EditorStyles.label.CalcHeight(GUIContent.none, 100);
 }
Exemplo n.º 6
0
        /// <summary>
        /// Draws a GUI for editing the given property and returns the updated
        /// value. This does
        /// *not* write the updated value to a container.
        /// </summary>
        /// <param name="context">
        /// An optional context that the property value came from. If this is not
        /// given, then a prefab context menu will not be displayable.
        /// </param>
        public static object EditPropertyDirect(Rect region, InspectedProperty property, object propertyValue, fiGraphMetadataChild metadataChild, object context)
        {
            fiGraphMetadata metadata = metadataChild.Metadata;

            // Show a "revert to prefab" value context-menu if possible
            if (context != null) {
                RevertPrefabContextMenu(region, context, property);
            }

            // get the label / tooltip
            GUIContent label = new GUIContent(property.DisplayName,
                                              InspectorTooltipAttribute.GetTooltip(property.MemberInfo));

            var editorChain = PropertyEditor.Get(property.StorageType, property.MemberInfo);
            IPropertyEditor editor = editorChain.FirstEditor;

            EditorGUI.BeginDisabledGroup(property.CanWrite == false);
            propertyValue = editor.Edit(region, label, propertyValue, metadata.Enter("EditProperty", metadata.Context));
            EditorGUI.EndDisabledGroup();

            return propertyValue;
        }
Exemplo n.º 7
0
        public static float EditPropertyHeightDirect(InspectedProperty property, object propertyValue, fiGraphMetadataChild metadataChild)
        {
            fiGraphMetadata metadata = metadataChild.Metadata;

            var editor = PropertyEditor.Get(property.StorageType, property.MemberInfo).FirstEditor;

            GUIContent propertyLabel = new GUIContent(property.DisplayName);

            // Either the foldout is active or we are not displaying a foldout.
            // Either way, we want to report the full height of the property.
            return editor.GetElementHeight(propertyLabel, propertyValue, metadata.Enter("EditProperty", metadata.Context));
        }
Exemplo n.º 8
0
            public static float GetElementHeight(Type objType, MemberInfo attrs, GUIContent label, object obj, fiGraphMetadataChild metadata, params Type[] skippedEditors)
            {
                if (VerifyBinding("PropertyEditor.GetElementHeight", _Bindings._PropertyEditor_GetElementHeight))
                {
                    return(_Bindings._PropertyEditor_GetElementHeight(objType, attrs, label, obj, metadata, skippedEditors));
                }

                return(0);
            }
Exemplo n.º 9
0
            public static object EditSkipUntilNot(Type[] skipUntilNot, Type objType, MemberInfo attrs, Rect rect, GUIContent label, object obj, fiGraphMetadataChild metadata)
            {
                if (VerifyBinding("PropertyEditor.EditSkipUntilNot", _Bindings._PropertyEditor_EditSkipUntilNot))
                {
                    return(_Bindings._PropertyEditor_EditSkipUntilNot(skipUntilNot, objType, attrs, rect, label, obj, metadata));
                }

                return(obj);
            }
Exemplo n.º 10
0
        public static float EditPropertyHeight(object container, InspectedProperty property, fiGraphMetadataChild metadata)
        {
            object propertyValue = property.Read(container);

            return(EditPropertyHeightDirect(property, propertyValue, metadata));
        }
Exemplo n.º 11
0
            public static object Edit(Type objType, MemberInfo attrs, Rect rect, GUIContent label, object obj, fiGraphMetadataChild metadata, params Type[] skippedEditors)
            {
                if (VerifyBinding("PropertyEditor.Edit", _Bindings._PropertyEditor_Edit))
                {
                    return(_Bindings._PropertyEditor_Edit(objType, attrs, rect, label, obj, metadata, skippedEditors));
                }

                return(obj);
            }
Exemplo n.º 12
0
        public static float EditPropertyHeightDirect(InspectedProperty property, object propertyValue, fiGraphMetadataChild metadataChild)
        {
            fiGraphMetadata metadata = metadataChild.Metadata;

            var editor = PropertyEditor.Get(property.StorageType, property.MemberInfo).FirstEditor;

            GUIContent propertyLabel = new GUIContent(property.DisplayName);

            // Either the foldout is active or we are not displaying a foldout. Either way, we want
            // to report the full height of the property.
            return(editor.GetElementHeight(propertyLabel, propertyValue, metadata.Enter("EditProperty")));
        }
Exemplo n.º 13
0
        public static void EditProperty(Rect region, object container, InspectedProperty property, fiGraphMetadataChild metadata)
        {
            EditorGUI.BeginChangeCheck();

            object propertyValue = property.Read(container);
            object updatedValue  = EditPropertyDirect(region, property, propertyValue, metadata, container);

            if (EditorGUI.EndChangeCheck())
            {
                property.Write(container, updatedValue);

                // Make sure we propagate the changes up the edit stack. For example, if this property
                // is on a struct on a struct, then the top-level struct will not get modified without
                // propagation of the change check.
                GUI.changed = true;
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Draws a GUI for editing the given property and returns the updated value. This does
        /// *not* write the updated value to a container.
        /// </summary>
        /// <param name="context">An optional context that the property value came from. If this is not given, then a prefab context menu will not be displayable.</param>
        public static object EditPropertyDirect(Rect region, InspectedProperty property, object propertyValue, fiGraphMetadataChild metadataChild, object context)
        {
            fiGraphMetadata metadata = metadataChild.Metadata;

            // Show a "revert to prefab" value context-menu if possible
            if (context != null)
            {
                RevertPrefabContextMenu(region, context, property);
            }

            // get the label / tooltip
            var        tooltip = fsPortableReflection.GetAttribute <InspectorTooltipAttribute>(property.MemberInfo);
            GUIContent label   = new GUIContent(property.DisplayName, tooltip != null ? tooltip.Tooltip : "");

            var             editorChain = PropertyEditor.Get(property.StorageType, property.MemberInfo);
            IPropertyEditor editor      = editorChain.FirstEditor;

            EditorGUI.BeginDisabledGroup(property.CanWrite == false);
            propertyValue = editor.Edit(region, label, propertyValue, metadata.Enter("EditProperty"));
            EditorGUI.EndDisabledGroup();

            return(propertyValue);
        }
Exemplo n.º 15
0
            public static float GetElementHeightSkipUntilNot(Type[] skipUntilNot, Type objType, MemberInfo attrs, GUIContent label, object obj, fiGraphMetadataChild metadata)
            {
                if (VerifyBinding("PropertyEditor.GetElementHeightSkipUntilNot", _Bindings._PropertyEditor_GetElementHeightSkipUntilNot)) {
                    return _Bindings._PropertyEditor_GetElementHeightSkipUntilNot(skipUntilNot, objType, attrs, label, obj, metadata);
                }

                return 0;
            }
Exemplo n.º 16
0
            public static float GetElementHeightSkipUntilNot(Type[] skipUntilNot, Type objType, MemberInfo attrs, GUIContent label, object obj, fiGraphMetadataChild metadata)
            {
                if (VerifyBinding("PropertyEditor.GetElementHeightSkipUntilNot", _Bindings._PropertyEditor_GetElementHeightSkipUntilNot))
                {
                    return(_Bindings._PropertyEditor_GetElementHeightSkipUntilNot(skipUntilNot, objType, attrs, label, obj, metadata));
                }

                return(0);
            }
Exemplo n.º 17
0
 /// <summary>
 /// Draws a GUI for editing the given property and returns the updated
 /// value. This does
 /// *not* write the updated value to a container.
 /// </summary>
 public static object EditPropertyDirect(Rect region, InspectedProperty property, object propertyValue, fiGraphMetadataChild metadataChild)
 {
     return EditPropertyDirect(region, property, propertyValue, metadataChild, null);
 }
 private static string DrawItem(Rect position, string item, fiGraphMetadataChild metadata)
 {
     return EditorGUI.TextField(position, item);
 }
Exemplo n.º 19
0
 public static float EditPropertyHeight(object container, InspectedProperty property, fiGraphMetadataChild metadata)
 {
     object propertyValue = property.Read(container);
     return EditPropertyHeightDirect(property, propertyValue, metadata);
 }
 private static UnityObject DrawItem(Rect position, UnityObject item, fiGraphMetadataChild metadata)
 {
     return EditorGUI.ObjectField(position, item, typeof(UnityObject),
         /*allowSceneObjects:*/true);
 }
Exemplo n.º 21
0
        public static void EditProperty(Rect region, object container, InspectedProperty property, fiGraphMetadataChild metadata)
        {
            EditorGUI.BeginChangeCheck();

            object propertyValue = property.Read(container);
            object updatedValue = EditPropertyDirect(region, property, propertyValue, metadata, container);

            if (EditorGUI.EndChangeCheck()) {
                property.Write(container, updatedValue);

                // Make sure we propagate the changes up the edit stack. For
                // example, if this property is on a struct on a struct, then the
                // top-level struct will not get modified without propagation of
                // the change check.
                GUI.changed = true;
            }
        }
 protected TItem DrawItem(Rect rect, TItem element, fiGraphMetadataChild metadata)
 {
     return(_itemEditor.FirstEditor.Edit(rect, GUIContent.none, element, metadata));
 }