/// <summary> /// The constructor for a NodeModel is used to create /// the input and output ports and specify the argument /// lacing. It gets invoked when the node is added to /// the graph from the library or through copy/paste. /// </summary> public SliderCustomNodeModel() { // When you create a UI node, you need to do the // work of setting up the ports yourself. To do this, // you can populate the InPorts and the OutPorts // collections with PortData objects describing your ports. // Nodes can have an arbitrary number of inputs and outputs. // If you want more ports, just create more PortData objects. OutPorts.Add(new PortModel(PortType.Output, this, new PortData(">", "List<Double>"))); // OutPorts.Add(new PortModel(PortType.Output, this, new PortData("max value", "returns a 0-100 double value"))); // OutPorts.Add(new PortModel(PortType.Output, this, new PortData("min value", "returns a 0-100 double value"))); // This call is required to ensure that your ports are // properly created. RegisterAllPorts(); // The arugment lacing is the way in which Dynamo handles // inputs of lists. If you don't want your node to // support argument lacing, you can set this to LacingStrategy.Disabled. ArgumentLacing = LacingStrategy.Disabled; sliderValue = 1; countValue = 1; stepValue = 1; minValue = 0; maxValue = 10; if (sliderValueCollection.Count == 0) { sliderValueCollection.Add(sliderValue); } if (sliderValueList.Count == 0) { sliderValueList.Add(sliderValue); } }
#pragma warning disable CS1591 public IfcRepresentationRefactorTransformNodeModel() { InPorts.Add( new PortModel(PortType.Input, this, new PortData("context", "Representation context", AstFactory.BuildStringNode("Body")))); InPorts.Add( new PortModel(PortType.Input, this, new PortData("author", "Author meta data", AstFactory.BuildNullNode()))); InPorts.Add( new PortModel(PortType.Input, this, new PortData("nameAddon", "Fragment name of canonical full name", AstFactory.BuildNullNode()))); InPorts.Add( new PortModel(PortType.Input, this, new PortData("logFilter", "Log reason type filtering", MapEnum(LogReason.Any)))); InPorts.Add( new PortModel(PortType.Input, this, new PortData("ifcModel", "IFC input model"))); OutPorts.Add( new PortModel(PortType.Output, this, new PortData("ifcModel", "IFC output model"))); RegisterAllPorts(); IsCancelable = true; LogReasonMask = LogReason.Changed; Selected = GetInitialOptions().First(); }
private void outports_collectionChanged(object sender, NotifyCollectionChangedEventArgs e) { //The visual height of the node is bound to preferred height. //PreferredHeight = Math.Max(inPorts.Count * 20 + 10, outPorts.Count * 20 + 10); //spacing for inputs + title space + bottom space if (e.Action == NotifyCollectionChangedAction.Add) { //create a new port view model foreach (var item in e.NewItems) { OutPorts.Add(new PortViewModel(this, item as PortModel)); } } else if (e.Action == NotifyCollectionChangedAction.Remove) { //remove the port view model whose model item is the //one passed in foreach (var item in e.OldItems) { OutPorts.Remove(OutPorts.ToList().First(x => x.PortModel == item)); } } }
protected SelectionBase( SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix) { selectionMessage = message; this.selectionType = selectionType; this.selectionObjectType = selectionObjectType; string portName = GetOutputPortName(); OutPorts.Add(new PortModel(PortType.Output, this, new PortData(portName, Resources.SelectionPortDataResultToolTip))); RegisterAllPorts(); Prefix = prefix; State = ElementState.Warning; ShouldDisplayPreviewCore = true; }
private Range(IEnumerable <PortModel> inPorts, IEnumerable <PortModel> outPorts) : base(inPorts, outPorts) { if (inPorts.Count() == 3) { inPorts.ElementAt(0).DefaultValue = startPortDefaultValue; inPorts.ElementAt(1).DefaultValue = endPortDefaultValue; inPorts.ElementAt(2).DefaultValue = stepPortDefaultValue; } else { // If information from json does not look correct, clear the default ports and add ones with default value InPorts.Clear(); InPorts.Add(new PortModel(PortType.Input, this, new PortData("start", Resources.RangePortDataStartToolTip, startPortDefaultValue))); InPorts.Add(new PortModel(PortType.Input, this, new PortData("end", Resources.RangePortDataEndToolTip, endPortDefaultValue))); InPorts.Add(new PortModel(PortType.Input, this, new PortData("step", Resources.RangePortDataStepToolTip, stepPortDefaultValue))); } if (outPorts.Count() == 0) { OutPorts.Add(new PortModel(PortType.Output, this, new PortData("seq", Resources.RangePortDataSeqToolTip))); } ArgumentLacing = LacingStrategy.Auto; SetNodeStateBasedOnConnectionAndDefaults(); }
/// <summary> /// The constructor for a NodeModel is used to create /// the input and output ports and specify the argument /// lacing. It gets invoked when the node is added to /// the graph from the library or through copy/paste. /// </summary> public ButtonCustomNodeModel() { // When you create a UI node, you need to do the // work of setting up the ports yourself. To do this, // you can populate the InPorts and the OutPorts // collections with PortData objects describing your ports. InPorts.Add(new PortModel(PortType.Input, this, new PortData("inputString", "a string value displayed on our button"))); // Nodes can have an arbitrary number of inputs and outputs. // If you want more ports, just create more PortData objects. OutPorts.Add(new PortModel(PortType.Output, this, new PortData("button value", "returns the string value displayed on our button"))); OutPorts.Add(new PortModel(PortType.Output, this, new PortData("window value", "returns the string value displayed in our window when button is pressed"))); // This call is required to ensure that your ports are // properly created. RegisterAllPorts(); // Listen for input port disconnection to trigger button UI update this.PortDisconnected += ButtonCustomNodeModel_PortDisconnected; // The arugment lacing is the way in which Dynamo handles // inputs of lists. If you don't want your node to // support argument lacing, you can set this to LacingStrategy.Disabled. ArgumentLacing = LacingStrategy.Disabled; // We create a DelegateCommand object which will be // bound to our button in our custom UI. Clicking the button // will call the ShowMessage method. ButtonCommand = new DelegateCommand(ShowMessage, CanShowMessage); // Setting our property here will trigger a // property change notification and the UI // will be updated to reflect the new value. ButtonText = defaultButtonText; WindowText = defaultWindowText; }
#pragma warning disable CS1591 public IfcPSetRemovalTransformNodeModel() { InPorts.Add(new PortModel(PortType.Input, this, new PortData("excludeSets", "List of property sets about to be removed"))); InPorts.Add(new PortModel(PortType.Input, this, new PortData("includeSets", "List of property sets about to be kept exclusively"))); InPorts.Add(new PortModel(PortType.Input, this, new PortData("caseSensitive", "Enable case sensitive matching"))); InPorts.Add(new PortModel(PortType.Input, this, new PortData("authorMetadata", "Credentials of authoring editor"))); InPorts.Add(new PortModel(PortType.Input, this, new PortData("nameAddon", "Fragment name of canonical full name"))); InPorts.Add(new PortModel(PortType.Input, this, new PortData("logFilter", "Log reason type filtering", MapEnum(LogReason.Any)))); InPorts.Add(new PortModel(PortType.Input, this, new PortData("ifcModel", "IFC input model"))); OutPorts.Add(new PortModel(PortType.Output, this, new PortData("ifcModel", "IFC output model"))); RegisterAllPorts(); IsCancelable = true; LogReasonMask = LogReason.Changed; }
public Formula() { ArgumentLacing = LacingStrategy.Auto; OutPorts.Add(new PortModel(PortType.Output, this, new PortData("", Properties.Resources.FormulaPortDataResultToolTip))); RegisterAllPorts(); }
public TestNode() { InPorts.Add(new PortModel(PortType.Input, this, new PortData("input A", "This is input A."))); OutPorts.Add(new PortModel(PortType.Output, this, new PortData("output A", "This is output A."))); RegisterAllPorts(); }
/// <summary> /// New authors data model. /// </summary> public IfcAuthorMetadataNodeModel() { OutPorts.Add(new PortModel(PortType.Output, this, new PortData("authorMetadata", "Author's metadata"))); RegisterAllPorts(); }
protected override void DeserializeCore(XmlElement nodeElement, SaveContext context) { List <XmlNode> childNodes = nodeElement.ChildNodes.Cast <XmlNode>().ToList(); if (!Controller.IsInSyncWithNode(this)) { Controller.SyncNodeWithDefinition(this); OnNodeModified(); } else if (Controller.Definition == null || Controller.Definition.IsProxy) { foreach (XmlNode subNode in childNodes) { if (subNode.Name.Equals("Outputs")) { var data = subNode.ChildNodes.Cast <XmlNode>() .Select( (outputNode, i) => new { data = new PortData(outputNode.Attributes[0].Value, Properties.Resources.ToolTipOutput + (i + 1)), idx = i }); foreach (var dataAndIdx in data) { if (OutPorts.Count > dataAndIdx.idx) { OutPorts[dataAndIdx.idx] = new PortModel(PortType.Output, this, dataAndIdx.data); } else { OutPorts.Add(new PortModel(PortType.Output, this, dataAndIdx.data)); } } } else if (subNode.Name.Equals("Inputs")) { var data = subNode.ChildNodes.Cast <XmlNode>() .Select( (inputNode, i) => new { data = new PortData(inputNode.Attributes[0].Value, Properties.Resources.ToolTipInput + (i + 1)), idx = i }); foreach (var dataAndIdx in data) { if (InPorts.Count > dataAndIdx.idx) { InPorts[dataAndIdx.idx] = new PortModel(PortType.Input, this, dataAndIdx.data); } else { InPorts.Add(new PortModel(PortType.Input, this, dataAndIdx.data)); } } } #region Legacy output support else if (subNode.Name.Equals("Output")) { var data = new PortData(subNode.Attributes[0].Value, Properties.Resources.ToolTipFunctionOutput); if (OutPorts.Any()) { OutPorts[0] = new PortModel(PortType.Output, this, data); } else { OutPorts.Add(new PortModel(PortType.Output, this, data)); } } #endregion } RegisterAllPorts(); } base.DeserializeCore(nodeElement, context); //Base implementation must be called XmlNode nameNode = childNodes.LastOrDefault(subNode => subNode.Name.Equals("Name")); if (nameNode != null && nameNode.Attributes != null) { NickName = nameNode.Attributes["value"].Value; } XmlNode descNode = childNodes.LastOrDefault(subNode => subNode.Name.Equals("Description")); if (descNode != null && descNode.Attributes != null) { Description = descNode.Attributes["value"].Value; } }
protected PythonNodeBase() { OutPorts.Add(new PortModel(PortType.Output, this, new PortData("OUT", Properties.Resources.PythonNodePortDataOutputToolTip))); ArgumentLacing = LacingStrategy.Disabled; }
public WebcamCapture() { OutPorts.Add(new PortModel(PortType.Output, this, new PortData("FileName", "Blablabla"))); RegisterAllPorts(); }
public ElementsOfType() { InPorts.Add(new PortModel(PortType.Input, this, new PortData("element class", Properties.Resources.PortDataElementTypeToolTip))); OutPorts.Add(new PortModel(PortType.Output, this, new PortData("elements", Properties.Resources.PortDataAllElementsInDocumentToolTip))); RegisterAllPorts(); }
public NodeWithFailingASTOutput() { InPorts.Add(new PortModel(PortType.Input, this, new PortData("input", "dummy input"))); OutPorts.Add(new PortModel(PortType.Output, this, new PortData("result", "dummy result"))); RegisterAllPorts(); }
public ByKeysAndValues() : base() { InPorts.Add(new PortModel(PortType.Input, this, new PortData("keys", Properties.Resources.JsonObject_Keys_Set))); InPorts.Add(new PortModel(PortType.Input, this, new PortData("values", Properties.Resources.JsonObject_Values_Set))); OutPorts.Add(new PortModel(PortType.Output, this, new PortData("jsonObject", Properties.Resources.JsonObject_Json_Get))); }
protected DSDropDownBase(string outputName) { OutPorts.Add(new PortModel(PortType.Output, this, new PortData(outputName, string.Format(Resources.DropDownPortDataResultToolTip, outputName)))); RegisterAllPorts(); PopulateItems(); }
/// <summary> /// New <see cref="IfcReportDomain"/> custom node model. /// </summary> public IfcReportDomainComposingNodeModel() { OutPorts.Add(new PortModel(PortType.Output, this, new PortData("reportDomainType", "Reporting domain filter"))); RegisterAllPorts(); Items.AddRange(Enum.GetValues(typeof(IfcReportDomain)).Cast <IfcReportDomain>()); }