public override void SetProperty(DesignerPropertyInfo property, object obj) { base.SetProperty(property, obj); object value = property.GetValue(obj); if (value != null) { setProperty(value, property.Attribute.DisplayName, property.Attribute.HasFlags(DesignerProperty.DesignerFlags.ReadOnly), obj); } else { update(); } }
private List <MethodDef> getMethods() { List <MethodDef> methods = new List <MethodDef>(); if (typeComboBox.SelectedIndex > -1) { Nodes.Behavior behavior = GetBehavior(); AgentType agentType = Plugin.GetInstanceAgentType(_currentNames[typeComboBox.SelectedIndex], behavior, _agentType); if (agentType != null) { // get the linked method to filter MethodDef linkedMethod = null; bool linkBroken; DesignerPropertyInfo linkedProp = _property.Attribute.GetLinkedProperty(_object, out linkBroken); object prop = linkedProp.GetValue(_object); if (prop != null && prop is MethodDef) { linkedMethod = prop as MethodDef; } DesignerMethodEnum attrMethod = _property.Attribute as DesignerMethodEnum; #if USE_NOOP IList <MethodDef> methods = new List <MethodDef>(); methods.Add(MethodDef.Noop); IList <MethodDef> agentMethods = agentType.GetMethods(attrMethod.MethodType, ValueTypes.All, linkedMethod); foreach (MethodDef m in agentMethods) { methods.Add(m); } #else if (attrMethod != null) { methods.AddRange(agentType.GetMethods(attrMethod.MethodType, attrMethod.MethodReturnType, linkedMethod)); } else { DesignerRightValueEnum attrMethodRV = _property.Attribute as DesignerRightValueEnum; if (attrMethodRV != null) { methods.AddRange(agentType.GetMethods(attrMethodRV.MethodType, ValueTypes.All, linkedMethod)); } } #endif//#if USE_NOOP } } return(methods); }
public override void SetProperty(DesignerPropertyInfo property, object obj) { base.SetProperty(property, obj); object value = property.GetValue(obj); if (value != null) { setProperty(value, property.Attribute.DisplayName, property.Attribute.HasFlags(DesignerProperty.DesignerFlags.ReadOnly), obj); } else { update(); } }
public void SetupCastSettings(object obj) { if (obj != null && obj is Behaviac.Design.Nodes.Node) { Behaviac.Design.Nodes.Node assignNode = obj as Behaviac.Design.Nodes.Node; if (assignNode != null) { bool bCasting = assignNode.IsCasting; if (bCasting) { DesignerPropertyInfo leftPropInfo = DesignerProperty.GetDesignerProperty(assignNode.GetType(), "Opl"); VariableDef opl = (VariableDef)leftPropInfo.GetValue(assignNode); Type leftType = opl.ValueType; // if number if (Plugin.IsIntergerNumberType(leftType) || Plugin.IsFloatType(leftType)) { this.ValueType = ValueTypes.Int | ValueTypes.Float; this.FilterType = null; } else if (Plugin.IsRefType(leftType)) { //ref type/pointer type this.ValueType = ValueTypes.RefType; this.FilterType = leftType; } else { // } } } } }
public Param(DesignerPropertyInfo property, object obj) { _paramInfo = null; _property = property; _object = obj; _value = property.GetValue(obj); _nativeType = (_value != null) ? Plugin.GetNativeTypeName(_value.GetType()) : string.Empty; DesignerProperty pattr = property.Attribute; _displayName = pattr.DisplayName; _description = pattr.Description; _attribute = pattr; _bParamFromStruct = true; }