protected override void CloneProperties(Node newnode) { base.CloneProperties(newnode); ActionBuild act= (ActionBuild)newnode; act._type= _type; }
protected override void CloneProperties(Node newnode) { base.CloneProperties(newnode); ActionFocusClosest act= (ActionFocusClosest)newnode; act._type= _type; }
protected override void CloneProperties(Node newnode) { base.CloneProperties(newnode); ConditionFocusIs cond= (ConditionFocusIs)newnode; cond._type= _type; }
protected override void CloneProperties(Node newnode) { base.CloneProperties(newnode); DecoratorLoop dec= (DecoratorLoop)newnode; dec._count= _count; }
protected override void CloneProperties(Node newnode) { base.CloneProperties(newnode); ConditionHasNeedleWithLessServantsThan cond= (ConditionHasNeedleWithLessServantsThan)newnode; cond._servants= _servants; }
void item_Click(object sender, EventArgs e) { MenuItem item = (MenuItem)sender; Type editorType = (Type)item.Tag; Label label = (Label)item.Parent.Tag; DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag; Debug.Check(_selectedObject == editor.SelectedObject); FlexibleProperty flexProp = (FlexibleProperty)editor.Property.Property.GetValue(_selectedObject, null); flexProp.ChangeEditor(editorType); Nodes.Node node = _selectedObject as Nodes.Node; if (node != null) { node.OnPropertyValueChanged(true); } Events.Event evnt = _selectedObject as Events.Event; if (evnt != null) { evnt.OnPropertyValueChanged(true); } SelectedObject = _selectedObject; }
protected override void CloneProperties(Node newnode) { base.CloneProperties(newnode); ConditionHasLessThan cond= (ConditionHasLessThan)newnode; cond._type= _type; cond._count= _count; }
protected override void CloneProperties(Brainiac.Design.Nodes.Node newnode) { base.CloneProperties(newnode); CompoundTask node = (CompoundTask)newnode; node._methodType = _methodType; }
protected override void CloneProperties(Brainiac.Design.Nodes.Node newnode) { base.CloneProperties(newnode); Method node = (Method)newnode; node._methodType = _methodType; }
public override bool AddChild(Node node, int index) { // check if we we may add the node if(_children.Count >=_maxCount || _isReadOnly) return false; node._connector= this; _children.Insert(index, node); _connectedChildren.RequiresRebuild(); AddSubItem(node, index); return true; }
/// <summary> /// Returns the first NodeViewData which is associated with the given node. Notice that there might be other NodeViewDatas which are ignored. /// </summary> /// <param name="node">The node you want to get the NodeViewData for.</param> /// <returns>Returns the first NodeViewData found.</returns> public virtual NodeViewData FindNodeViewData(Node node) { // check if this is a fitting view if(_node ==node) return this; // search the children foreach(NodeViewData child in _children) { NodeViewData result= child.FindNodeViewData(node); if(result !=null) return result; } return null; }
public override bool AddChild(Node node) { // check if we can accept the node if(_child ==null && !_isReadOnly) { node._connector= this; _child= node; _connectedChildren.RequiresRebuild(); AddSubItem(node); return true; } return false; }
protected override void ExportConstructorAndProperties(System.IO.StreamWriter file, Node node, string indent, string nodeName, string classname) { // get all the properties that need to be exported IList<DesignerPropertyInfo> properties= node.GetDesignerProperties(); // generate the list of parameters string parameters= string.Empty; for(int p= 0; p <properties.Count; ++p) { if(!properties[p].Attribute.HasFlags(DesignerProperty.DesignerFlags.NoExport)) parameters+= properties[p].GetExportValue(node) +", "; } // remove the comma if(parameters !=string.Empty) parameters= parameters.Substring(0, parameters.Length -2); // create a new instance of the node file.Write( string.Format("{0}\t{2} {1} = new {2}({3});\r\n", indent, nodeName, classname, parameters) ); }
private void listView_DoubleClick(object sender, EventArgs e) { // check if there is an item selected if (listView.SelectedItems.Count < 1) { return; } // check if this item has a node connected to it. The no-errors message doesn't Nodes.Node node = listView.SelectedItems[0].Tag as Nodes.Node; if (node == null) { return; } // show the behaviour and select the node. NodeViewData nvd = _behaviorTreeList.ShowNode(node); Debug.Check(nvd != null); _behaviorTreeView.SelectedNode = nvd; }
void item_Click(object sender, EventArgs e) { MenuItem item = (MenuItem)sender; Type editorType = (Type)item.Tag; Label label = null; //(Label)item.Parent.Tag; DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag; Debug.Check(_selectedObject == editor.SelectedObject); Nodes.Node node = _selectedObject as Nodes.Node; if (node != null) { node.OnPropertyValueChanged(true); } Attachments.Attachment attach = _selectedObject as Attachments.Attachment; if (attach != null) { attach.OnPropertyValueChanged(true); } SelectedObject = _selectedObject; }
public override int GetChildIndex(Node node) { return _child ==node ? 0 : -1; }
public override void ClearChildrenInternal() { _child= null; _connectedChildren.RequiresRebuild(); ClearSubItems(); }
public override void ClearChildren() { // clear the child and its connector if(_child !=null) { _child._connector= null; _child= null; } _connectedChildren.RequiresRebuild(); ClearSubItems(); }
/// <summary> /// Internally used by CloneBranch. /// </summary> /// <param name="newparent">The parent the clone children will be added to.</param> private void CloneChildNodes(Node newparent) { // we may not clone children of a referenced behavior if(newparent is ReferencedBehaviorNode) return; // for every connector... foreach(Connector connector in _children.Connectors) { // find the one from the new node... Connector localconn= newparent.GetConnector(connector.Identifier); Debug.Check(localconn !=null); // and duplicate its children into the new node's connector for(int i= 0; i <connector.ChildCount; ++i) { Node child= connector.GetChild(i); Node newchild= (Node)child.Clone(); newparent.AddChild(localconn, newchild); // do this for the children as well child.CloneChildNodes(newchild); } } }
/// <summary> /// Removes a child node. /// </summary> /// <param name="connector">The connector the child is attached to.</param> /// <param name="node">The child node we want to remove.</param> public virtual void RemoveChild(Connector connector, Node node) { Debug.Check(connector !=null && _children.HasConnector(connector)); if(!connector.RemoveChild(node)) throw new Exception(Resources.ExceptionNodeIsNoChild); node._parent= null; BehaviorWasModified(); }
/// <summary> /// Add a new child node. /// </summary> /// <param name="connector">The connector the node will be added to. Use null for default connector.</param> /// <param name="node">The node you want to append.</param> /// <param name="index">The index of the new node.</param> /// <returns>Returns true if the child could be added.</returns> public virtual bool AddChild(Connector connector, Node node, int index) { Debug.Check(connector !=null && _children.HasConnector(connector)); if(!connector.AcceptsChildren(1)) throw new Exception(Resources.ExceptionNodeHasTooManyChildren); if(!connector.AddChild(node, index)) return false; node._parent= this; BehaviorWasModified(); return true; }
/// <summary> /// Returns if a given noe is a sibling of this node. /// </summary> /// <param name="sibling">The assumed sibling we want to check.</param> /// <returns>Returns true if the given node is a sibling of this node.</returns> public bool IsSibling(Node sibling) { if(_parent ==null) return false; return _parent.Children.Contains(sibling); }
/// <summary> /// Returns if the given node is the parent of this node and it is its last child. /// </summary> /// <param name="node">The parent we want to check if this is its last child.</param> /// <returns>Returns true if this node is the last child of the given node.</returns> public bool IsLastChildOf(Node parent) { if(parent ==null || parent.Children.Count <1) return false; return parent.Children[parent.Children.Count -1] ==this; }
public override bool RemoveChild(Node node) { // check if we can remove the node if(!_isReadOnly && _children.Remove(node)) { node._connector= null; _connectedChildren.RequiresRebuild(); RemoveSubItem(node); return true; } return false; }
/// <summary> /// Checks if a node can be adopted by this one. /// </summary> /// <param name="child">The node we want to adopt.</param> /// <returns>Returns true if this node can adopt the given child.</returns> public bool CanAdoptNode(Node child) { return _children.CanAdoptNode(child); }
/// <summary> /// Used to duplicate all properties. Any property added must be duplicated here as well. /// </summary> /// <param name="newnode">The new node which is supposed to get a copy of the properties.</param> protected virtual void CloneProperties(Node newnode) { foreach(Node.SubItem sub in _subItems) { Node.SubItem newsub= sub.Clone(newnode); if(newsub !=null) newnode.AddSubItem(newsub); } }
/// <summary> /// Creates a new subitem which can show a property on the node. /// </summary> /// <param name="owner">The node whose property we want to show. MUST be the same as the one the subitem belongs to.</param> /// <param name="property">The property we want to show.</param> /// <param name="att">The attribute associated with the property.</param> public SubItemProperty(Node owner, PropertyInfo property, DesignerProperty att) : base(null, null, __font, Brushes.White, Alignment.Center, false) { _owner= owner; _property= property; _attribute= att; }
public override bool AddChild(Node node, int index) { // we only have one child, the index does not matter to us return AddChild(node); }
public override SubItem Clone(Node newnode) { // this subitem is automatically added it does not need to be duplicated return null; }
public bool CanAdoptChildren(Node parentNode) { return _children.DefaultConnector !=null && _children.DefaultConnector.AcceptsChildren(parentNode.Children.Count); }
/// <summary> /// Copies all the event handlers from one node to this one. /// </summary> /// <param name="from">Then node you want to copy the event handlers from.</param> protected virtual void CopyEventHandlers(Node from) { WasModified= from.WasModified; }
public override int GetChildIndex(Node node) { return _children.IndexOf(node); }
/// <summary> /// Gets a connector of the node by a child connected to it. /// </summary> /// <param name="child">The child of the connector we are looking for.</param> /// <returns>Returns null if no connector could be found.</returns> public Connector GetConnector(Node child) { return _children.GetConnector(child); }
public EventDesign(Node node) : base(node, Resources.EventDesign, Resources.EventDesignDesc) { }
/// <summary> /// Add a new child node. /// </summary> /// <param name="connector">The connector the node will be added to. Use null for default connector.</param> /// <param name="node">The node you want to append.</param> /// <returns>Returns true if the child could be added.</returns> public virtual bool AddChild(Connector connector, Node node) { if(!AddChildNotModified(connector, node)) return false; // behaviours must be saved BehaviorWasModified(); return true; }