public override bool CanDrawProperty(InspectorProperty property)
        {
            if (!NodeEditor.InNodeEditor)
            {
                return(false);
            }

            var parent = property.ParentValueProperty;

            if (parent == null)
            {
                parent = property.Tree.SecretRootProperty;
            }

            if (parent.ChildResolver is INodePortResolver)
            {
                var          resolver = parent.ChildResolver as INodePortResolver;
                NodePortInfo portInfo = resolver.GetNodePortInfo(property.Name);
                if (portInfo != null)
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }

            if (property.ChildResolver is GroupPropertyResolver)
            {
                return(false);
            }

            return(property.GetAttribute <DontFoldAttribute>() == null);
        }
Example #2
0
        protected override bool CanDrawNodePort(INodePortResolver portResolver, NodePortInfo nodePortInfo, InspectorProperty property)
        {
            if (!base.CanDrawNodePort(portResolver, nodePortInfo, property))
            {
                return(false);
            }

            if (property.GetAttribute <HideConnectionLabelAttribute>() != null)
            {
                return(false);
            }

            return(property.Parent != null && property.Parent.ChildResolver is IDynamicDataNodePropertyPortResolver);
        }
        public override bool CanProcessSelfAttributes(InspectorProperty property)
        {
            if (!NodeEditor.InNodeEditor)
            {
                if (property.GetAttribute <HideOutsideNodeEditorAttribute>() != null)
                {
                    return(true);
                }

                if (typeof(T).GetCustomAttribute <HideOutsideNodeEditorAttribute>() != null)
                {
                    return(true);
                }
            }

            return(false);
        }
        private T GetColumnAttribute <T>(InspectorProperty col)
            where T : Attribute
        {
            T colAttr;

            if (col.Info.PropertyType == PropertyType.Group)
            {
                colAttr = EnumerateGroupMembers(col)
                          .Select(c => c.Info.GetAttribute <T>())
                          .FirstOrDefault(c => c != null);
            }
            else
            {
                colAttr = col.GetAttribute <T>();
            }

            return(colAttr);
        }
Example #5
0
        void IDefinesGenericMenuItems.PopulateGenericMenu(InspectorProperty property, GenericMenu genericMenu)
        {
            if (property.ValueEntry.WeakSmartValue == null)
            {
                return;
            }

            var resolver = property.ChildResolver as ICollectionResolver;

            bool isReadOnly = resolver.IsReadOnly;

            var  config       = property.GetAttribute <ListDrawerSettingsAttribute>();
            bool isEditable   = isReadOnly == false && property.ValueEntry.IsEditable && (config == null || (!config.IsReadOnlyHasValue) || (config.IsReadOnlyHasValue && config.IsReadOnly == false));
            bool pasteElement = isEditable && Clipboard.CanPaste(resolver.ElementType);
            bool clearList    = isEditable && property.Children.Count > 0;

            //if (genericMenu.GetItemCount() > 0 && (pasteElement || clearList))
            //{
            //    genericMenu.AddSeparator(null);
            //}

            if (pasteElement)
            {
                genericMenu.AddItem(new GUIContent("Paste Element"), false, () =>
                {
                    (property.ChildResolver as ICollectionResolver).QueueAdd(new object[] { Clipboard.Paste() });
                    GUIHelper.RequestRepaint();
                });
            }

            if (clearList)
            {
                genericMenu.AddItem(new GUIContent("Clear Collection"), false, () =>
                {
                    (property.ChildResolver as ICollectionResolver).QueueClear();
                    GUIHelper.RequestRepaint();
                });
            }
            else
            {
                genericMenu.AddDisabledItem(new GUIContent("Clear Collection"));
            }
        }
    private ECheckState CalculateCheckState(InspectorProperty property, InspectorProperty pPropertyChild)
    {
        ECheckState eCheckState;

        if (Check_IsFill_Member(property, pPropertyChild))
        {
            eCheckState = ECheckState.Checked;
        }
        else
        {
            var pAttribute = pPropertyChild.GetAttribute <ChildRequireComponentAttribute>();
            if (pAttribute != null && pAttribute.bIsPrint_OnNotFound_GetComponent == false)
            {
                eCheckState = ECheckState.NotYet;
            }
            else
            {
                eCheckState = ECheckState.Fail;
            }
        }

        return(eCheckState);
    }
 protected override bool CanDrawNodePort(INodePortResolver portResolver, NodePortInfo nodePortInfo, InspectorProperty property)
 {
     return(property.GetAttribute <DisplayDynamicPortsAttribute>().ShowRemoveButton);
 }