diff --git a/doc/distrib/NodeHelpFiles/CoreNodeModels.DefineData.md b/doc/distrib/NodeHelpFiles/CoreNodeModels.DefineData.md index 024c5ac2f74..4648c0aac85 100644 --- a/doc/distrib/NodeHelpFiles/CoreNodeModels.DefineData.md +++ b/doc/distrib/NodeHelpFiles/CoreNodeModels.DefineData.md @@ -1,25 +1,23 @@ ## In Depth -The Define Data node validates the data type of incoming data. It can be used to ensure local data is of the desired type and is also designed to be used as an input or output node, declaring the type of data a graph expects or provides. Currently the node supports a selection of commonly used Dynamo data types, for example 'String', 'Point', or 'Boolean'. For the full list of supported data types, expand the dropdown menu of the node. +The Define Data node validates the data type of incoming data. It can be used to ensure local data is of the desired type and is also designed to be used as an input or output node, declaring the type of data a graph expects or provides. The node supports a selection of commonly used Dynamo data types, for example 'String', 'Point', or 'Boolean'. The full list of supported data types is available in the drop-down menu of the node. ### Behavior -The node validates the data coming in from the input port based on the setting of the **Data Type** dropdown and **List** toggle (see below for details). If the validation is successful, the output of the node is the same as the input. If the validation is not successful, the node will enter a **Warning** state with a null output. +The node validates the data coming in from the input port based on the setting of the drop-down menu and the **List** toggle (see below for details). If the validation is successful, the output of the node is the same as the input. If the validation is not successful, the node will enter a warning state with a null output. -The node has four controls: -- **>** input - Connect to an upstream node to validate its data type. -- **Data Type** dropdown - When the form is unlocked, set a data type for validation. When the form is locked, the data type is chosen based on incoming data. -- **List** toggle - When enabled, the node expects incoming data to be a single flat list containing items of the selected data type. When disabled, the node expects a single item of the selected data type. -- **Lock** toggle - When disabled, the **Data Type** dropdown and **List** toggle controls accept user input to set the type of data expected. When enabled, the node will validate* the incoming data, disable the controls, and set their value based on the data connected to the node's input port. +The node has four inputs: +- The "**>**" input - Connect to an upstream node to validate the type of its data. +- The **drop-down** menu - Shows the expected data type. When the form is unlocked, set a data type for validation. When the form is locked, the data type is chosen automatically based on incoming data. Data is valid if its type matches the shown type exactly or if its type is a child of the shown type (e.g. If the drop-down is set to "Curve", objects of type "Rectangle", "Line", etc. are valid). +- The **List** toggle - When on, the node expects incoming data to be a single flat list containing items of a valid data type (see above). When off, the node expects a single item of a valid data type. +- The **Lock** toggle - When off/unlocked, the drop-down menu and the **List** toggle controls accept user input to set the type of data expected. When on/locked, the node will validate* the incoming data, disable the controls, and set their value based on the data connected to the node's input port. -* Data validity - the data is recognized by Dynamo (any of the **Data Type** dropdown values) and the data is either a single object or a list of homogeneous values, or a list of values with a common, supported, parent type. - -When set as an input the node can optionally use upstream nodes to set the default value for the input. A run of the graph will cache the Define Data node's value for use when running the graph externally, for example with the Engine Node. - -In the example below, the first group of 'DefineData' nodes have an unlocked UI - the node correctly validates the Number input provided, while rejecting the String input. The second group showcases a node with locked UI - the node automatically adjusts the **Data Type** dropdown and **List** toggle to match the input - in this case a list of integers. +### Use as an input node +When set as an input ("Is Input" in the node's context menu) the node can optionally use upstream nodes to set the default value for the input. A run of the graph will cache the Define Data node's value for use when running the graph externally, for example with the Engine Node. --- ## Example File +In the example below, the first group of "DefineData" nodes have an unlocked UI. The node correctly validates the Number input provided while rejecting the String input. The second group contains a node with locked UI. The node automatically adjusts the drop-down and the **List** toggle to match the input, in this case a list of integers. ![Define_Data](./CoreNodeModels.DefineData_img.jpg) \ No newline at end of file diff --git a/src/DynamoCore/Engine/EngineController.cs b/src/DynamoCore/Engine/EngineController.cs index fa6e8e9090b..00677531611 100644 --- a/src/DynamoCore/Engine/EngineController.cs +++ b/src/DynamoCore/Engine/EngineController.cs @@ -389,7 +389,6 @@ internal bool GenerateGraphSyncDataForCustomNode(IEnumerable nodes, C /// /// The scheduler on which custom node compilation /// task can be scheduled. - /// internal void ProcessPendingCustomNodeSyncData(IScheduler scheduler) { while (pendingCustomNodeSyncData.Count > 0) @@ -438,10 +437,8 @@ private bool VerifyGraphSyncData(IEnumerable nodes) foreach (var node in nodes) { - if (!node.IsInputNode) continue; - - //We also don't want any nodes that have input ports or are derived from custom nodes. - if (node.InPorts.Any() || node.IsCustomFunction) continue; + //Ignore inputs, nodes with input ports, and nodes derived from custom nodes. + if (!node.IsInputNode || node.InPorts.Any() || node.IsCustomFunction) continue; // Only one or the other of the two lists, Added or Modified, will match the node GUID if they do. bool isAdded = false; diff --git a/src/DynamoCoreWpf/Properties/Resources.resx b/src/DynamoCoreWpf/Properties/Resources.resx index 216425a9476..23d22dd786d 100644 --- a/src/DynamoCoreWpf/Properties/Resources.resx +++ b/src/DynamoCoreWpf/Properties/Resources.resx @@ -3951,11 +3951,11 @@ To make this file into a new template, save it to a different folder, then move When locked, this node only accepts the selected data type as input. When unlocked, the input can be any supported data type. - Tool-tip for the padlock toggle button controlling auto/manual mode. + Tool-tip for the padlock button controlling auto/manual mode. Toggle on if the input data contains a list. - Tool-tip for info questionmark icon. + Tool-tip for info questionmark icon next to the List toggle control. This package or one of its dependencies were created for a previous version of Dynamo. It may not work in this version. Do you want to continue? diff --git a/src/Libraries/CoreNodeModels/DefineData.cs b/src/Libraries/CoreNodeModels/DefineData.cs index fcb8c427efd..b02eff7d777 100644 --- a/src/Libraries/CoreNodeModels/DefineData.cs +++ b/src/Libraries/CoreNodeModels/DefineData.cs @@ -172,7 +172,7 @@ public override IEnumerable BuildOutputAst(List>(DSCore.Data.IsSupportedDataNodeType); var funtionInputs = new List { inputAstNodes[0], - AstFactory.BuildStringNode((Items[SelectedIndex].Item as Data. DataNodeDynamoType).Type.ToString()), + AstFactory.BuildStringNode((Items[SelectedIndex].Item as Data.DataNodeDynamoType).Type.ToString()), AstFactory.BuildBooleanNode(IsList), AstFactory.BuildBooleanNode(IsAutoMode), AstFactory.BuildStringNode(PlayerValue) diff --git a/src/Libraries/CoreNodeModels/Properties/Resources.Designer.cs b/src/Libraries/CoreNodeModels/Properties/Resources.Designer.cs index 161f460e1fc..36d16407d18 100644 --- a/src/Libraries/CoreNodeModels/Properties/Resources.Designer.cs +++ b/src/Libraries/CoreNodeModels/Properties/Resources.Designer.cs @@ -295,7 +295,7 @@ public static string DateTimeDescription { } /// - /// Looks up a localized string similar to Validates and returns data from a currently or previously connected node. + /// Looks up a localized string similar to Validates the data type of an input and returns it. /// public static string DefineDataDescription { get { @@ -304,7 +304,7 @@ public static string DefineDataDescription { } /// - /// Looks up a localized string similar to Select Types. + /// Looks up a localized string similar to Select Data Type. /// public static string DefineDataDisplayValueMessage { get { diff --git a/src/Libraries/CoreNodeModels/Properties/Resources.en-US.resx b/src/Libraries/CoreNodeModels/Properties/Resources.en-US.resx index 77cf48e757c..dcf7a16c40f 100644 --- a/src/Libraries/CoreNodeModels/Properties/Resources.en-US.resx +++ b/src/Libraries/CoreNodeModels/Properties/Resources.en-US.resx @@ -665,7 +665,7 @@ In Generative Design workflows, this node should be used to control and block th gate;stop;data - Validates and returns data from a currently or previously connected node + Validates the data type of an input and returns it Input data to be validated. Refer to drop-down for list of allowed types diff --git a/src/Libraries/CoreNodeModels/Properties/Resources.resx b/src/Libraries/CoreNodeModels/Properties/Resources.resx index b7dd367097c..aa29f8e175d 100644 --- a/src/Libraries/CoreNodeModels/Properties/Resources.resx +++ b/src/Libraries/CoreNodeModels/Properties/Resources.resx @@ -665,7 +665,7 @@ In Generative Design workflows, this node should be used to control and block th gate;stop;data - Validates and returns data from a currently or previously connected node + Validates the data type of an input and returns it Input data to be validated. Refer to drop-down for list of allowed types diff --git a/test/ViewExtensionLibraryTests/resources/libraryItems.json b/test/ViewExtensionLibraryTests/resources/libraryItems.json index 000019d8571..dc1e19d2e27 100644 --- a/test/ViewExtensionLibraryTests/resources/libraryItems.json +++ b/test/ViewExtensionLibraryTests/resources/libraryItems.json @@ -5934,7 +5934,7 @@ "contextData": "DefineData", "parameters": null, "itemType": "query", - "keywords": "Data.DefineData, Input/Output, definedata" + "keywords": "Data.DefineData, Input, Output, definedata" } ] }