Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DYN-6633: Definedata hierarchy #15154

Merged
merged 50 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
3785210
initialize definedata model
dnenov Feb 5, 2024
93c4741
added test structure, node customization
dnenov Feb 20, 2024
9c07a73
hierarchical container, geometry tests
dnenov Feb 28, 2024
2bc7903
primitive tests done
dnenov Feb 28, 2024
1621855
ggroup
zeusongit Feb 28, 2024
33a522c
Revert "ggroup"
zeusongit Feb 28, 2024
b92a8d0
inheritance tests done
dnenov Feb 29, 2024
1d843d8
Merge remote-tracking branch 'upstream/master' into definedata-initial
dnenov Feb 29, 2024
49130b6
comments
dnenov Feb 29, 2024
8cb3a41
finished refactoring for tests
dnenov Mar 5, 2024
6761fe4
Merge remote-tracking branch 'upstream/master' into definedata-initial
dnenov Mar 5, 2024
cfd197e
refactor, comments
dnenov Mar 7, 2024
a2b023a
pass through
dnenov Mar 7, 2024
0dd95d3
inputs
dnenov Mar 12, 2024
d5d2f81
added hierarchy
dnenov Mar 12, 2024
3670a60
raw throws, onnodemodified
dnenov Mar 14, 2024
7335336
node resources
dnenov Mar 15, 2024
cf5887c
visual hierarchy
dnenov Mar 15, 2024
9e01e51
Merge remote-tracking branch 'upstream/master' into definedata-view
dnenov Mar 15, 2024
3ff098c
Merge remote-tracking branch 'upstream/master' into definedata-view
dnenov Mar 15, 2024
fa342c0
First pass
saintentropy Mar 19, 2024
7b5fe80
Add more comments
saintentropy Mar 19, 2024
f0428ac
Fix angry VM
saintentropy Mar 19, 2024
244e975
comments
dnenov Mar 19, 2024
8790a75
Merge pull request #2 from saintentropy/AddPlayerSetValue2
dnenov Mar 19, 2024
69ac4c4
don't throw if no input
dnenov Mar 19, 2024
2dc0f47
Merge branch 'definedata-view' into definedata-hierarchy
dnenov Mar 19, 2024
acbbef0
added 'select types' handling
dnenov Mar 20, 2024
8a4095e
node tests started
dnenov Mar 20, 2024
f689c16
Merge remote-tracking branch 'upstream/master' into definedata-view
dnenov Mar 20, 2024
a25b667
datatype list refactor
dnenov Mar 20, 2024
b0c46e4
comments
dnenov Mar 20, 2024
19c565b
Merge remote-tracking branch 'upstream/master' into definedata-view
dnenov Mar 20, 2024
3d029c9
Merge remote-tracking branch 'upstream/master' into definedata-view
dnenov Mar 22, 2024
98446b2
Merge remote-tracking branch 'upstream/master' into definedata-hierarchy
dnenov Apr 5, 2024
b2029d5
Merge branch 'definedata-view' into definedata-hierarchy
dnenov Apr 5, 2024
5da7e89
list handling in AutoMode
dnenov Apr 7, 2024
61fd8fc
resources update
dnenov Apr 8, 2024
e47fec3
Merge remote-tracking branch 'upstream/master' into definedata-hierarchy
dnenov Apr 17, 2024
9797db1
node lock on interaction
dnenov Apr 17, 2024
1b619f7
interaction adjustment, dynamoPlayer fix
dnenov Apr 18, 2024
395bd21
Merge remote-tracking branch 'upstream/master' into definedata-hierarchy
dnenov Apr 19, 2024
be4c558
api additions
dnenov Apr 19, 2024
50a876b
Merge remote-tracking branch 'upstream/master' into definedata-hierarchy
dnenov Apr 25, 2024
914b793
moved test to visualization tests
dnenov Apr 26, 2024
ef49bf5
Merge remote-tracking branch 'upstream/master' into definedata-hierarchy
dnenov Apr 26, 2024
c30f0bb
Revise help file
twastvedt May 7, 2024
e458549
Revise comment
twastvedt May 7, 2024
fc2de6a
Text tweaks
twastvedt May 8, 2024
118b267
Merge pull request #3 from twastvedt/definedata-hierarchy
dnenov May 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion doc/distrib/NodeHelpFiles/CoreNodeModels.DefineData.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
## In Depth

Validates and returns data from a currently or previously connected input 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 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 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.

### 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)

4 changes: 2 additions & 2 deletions src/DynamoCore/Engine/EngineController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ internal bool GenerateGraphSyncDataForCustomNode(IEnumerable<NodeModel> nodes, C
/// </summary>
/// <param name="scheduler">The scheduler on which custom node compilation
/// task can be scheduled.</param>
///
internal void ProcessPendingCustomNodeSyncData(IScheduler scheduler)
{
while (pendingCustomNodeSyncData.Count > 0)
Expand Down Expand Up @@ -438,7 +437,8 @@ private bool VerifyGraphSyncData(IEnumerable<NodeModel> nodes)

foreach (var node in nodes)
{
if (!node.IsInputNode) continue;
//Ignore inputs, nodes with input ports, and nodes derived from custom nodes.
if (!node.IsInputNode || node.InPorts.Any() || node.IsCustomFunction) continue;

twastvedt marked this conversation as resolved.
Show resolved Hide resolved
// Only one or the other of the two lists, Added or Modified, will match the node GUID if they do.
bool isAdded = false;
Expand Down
18 changes: 18 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3962,6 +3962,14 @@ To make this file into a new template, save it to a different folder, then move
<data name="DynamoXmlFileFormat" xml:space="preserve">
<value>Dynamo 1.x file format</value>
</data>
<data name="DataInputNodeModeLockTooltip" xml:space="preserve">
<value>When locked, this node only accepts the selected data type as input. When unlocked, the input can be any supported data type.</value>
<comment>Tool-tip for the padlock toggle button controlling auto/manual mode.</comment>
</data>
<data name="DataInputNodeInformationTooltip" xml:space="preserve">
<value>Toggle on if the input data contains a list.</value>
<comment>Tool-tip for info questionmark icon.</comment>
</data>
<data name="MessagePackageOlderDynamo" xml:space="preserve">
<value>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?</value>
</data>
Expand All @@ -3971,4 +3979,4 @@ To make this file into a new template, save it to a different folder, then move
<data name="MessagePackOlderDynamoLink" xml:space="preserve">
<value>#Learn more=https://primer2.dynamobim.org/1_developer_primer_intro/3_developing_for_dynamo/updating-your-packages-and-dynamo-libraries-for-dynamo-3x-net8</value>
</data>
</root>
</root>
10 changes: 9 additions & 1 deletion src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3949,6 +3949,14 @@ To make this file into a new template, save it to a different folder, then move
<data name="DynamoXmlFileFormat" xml:space="preserve">
<value>Dynamo 1.x file format</value>
</data>
<data name="DataInputNodeModeLockTooltip" xml:space="preserve">
<value>When locked, this node only accepts the selected data type as input. When unlocked, the input can be any supported data type.</value>
<comment>Tool-tip for the padlock button controlling auto/manual mode.</comment>
</data>
<data name="DataInputNodeInformationTooltip" xml:space="preserve">
<value>Toggle on if the input data contains a list.</value>
<comment>Tool-tip for info questionmark icon next to the List toggle control.</comment>
</data>
<data name="MessagePackageOlderDynamo" xml:space="preserve">
<value>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?</value>
</data>
Expand All @@ -3958,4 +3966,4 @@ To make this file into a new template, save it to a different folder, then move
<data name="MessagePackOlderDynamoLink" xml:space="preserve">
<value>#Learn more=https://primer2.dynamobim.org/1_developer_primer_intro/3_developing_for_dynamo/updating-your-packages-and-dynamo-libraries-for-dynamo-3x-net8</value>
</data>
</root>
</root>
2 changes: 2 additions & 0 deletions src/DynamoCoreWpf/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4452,6 +4452,8 @@ static Dynamo.Wpf.Properties.Resources.CustomNodePropertyWindowName.get -> strin
static Dynamo.Wpf.Properties.Resources.CustomNodePropertyWindowNameHint.get -> string
static Dynamo.Wpf.Properties.Resources.CustomNodePropertyWindowTitle.get -> string
static Dynamo.Wpf.Properties.Resources.CustomNodeTypeShortString.get -> string
static Dynamo.Wpf.Properties.Resources.DataInputNodeInformationTooltip.get -> string
static Dynamo.Wpf.Properties.Resources.DataInputNodeModeLockTooltip.get -> string
static Dynamo.Wpf.Properties.Resources.DefaultPythonEngineNone.get -> string
static Dynamo.Wpf.Properties.Resources.DeleteFailureMessageBoxTitle.get -> string
static Dynamo.Wpf.Properties.Resources.DeprecatingPackageMessageBoxTitle.get -> string
Expand Down
Loading
Loading