DYN-9702: Add definition folder and dyf#17201
Conversation
add a Definitions folder for custom node .dyf files, similar to how templates are already shipped from doc/distrib/Templates. The new Curve_Validate.dyf file is copied into the build output definitions folder, and Dynamo now includes that shipped folder when scanning for custom node definitions at startup. DynamoCore.csproj now treats doc/distrib/Definitions as a source folder for shipped custom node definitions and copies it to the runtime definitions folder. PathManager.DefinitionDirectories now includes the shipped definitions folder if it exists, while keeping the existing user/package definition paths unchanged. The related test now allows the extra shipped definitions path when that folder is present.
There was a problem hiding this comment.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-9702
|
There was a problem hiding this comment.
Pull request overview
This PR adds support for shipping a custom node definition (Curve_Validate.dyf) with Dynamo by introducing a new doc/distrib/Definitions source folder, copying those assets into the build output, and extending PathManager.DefinitionDirectories to include the shipped runtime definitions folder when present.
Changes:
- Adds a new shipped definitions source folder and includes
Curve_Validate.dyf. - Updates
DynamoCore.csprojto copy shipped definitions into the build output underdefinitions/. - Updates
PathManager.DefinitionDirectories(and its related test) to include the shipped runtime definitions folder when it exists.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/Libraries/PackageManagerTests/PackageLoaderTests.cs | Updates a PathManager-related test to account for an additional optional definitions directory. |
| src/DynamoCore/DynamoCore.csproj | Adds DefinitionFiles items and copies them to $(OutputPath)definitions\... during build. |
| src/DynamoCore/Configuration/PathManager.cs | Extends DefinitionDirectories to append a common/runtime definitions directory when present. |
| doc/distrib/Definitions/Curve_Validate.dyf | Adds the shipped custom node definition to be included in runtime definitions. |
| var commonDefinitions = Path.Combine(pathManager.CommonDataDirectory, PathManager.DefinitionsDirectoryName); | ||
| var expectedDefinitionDirectoryCount = Directory.Exists(commonDefinitions) ? 3 : 2; |
There was a problem hiding this comment.
I think I was going to make a similar comment. But maybe my analysis is wrong. When this test runs in the CI pipeline, the directory is created by the CI process and should always return 3, right? ... When does it return 2? When testing locally?
And if the CI fails to create the dir, won't the assert still pass with a value of 2?
What happens if we ever add another directory or want to remove one? Does the test suddenly start failing? Probably an easy fix though.
| "TypeName": "bool", | ||
| "TypeRank": 0, | ||
| "DefaultValue": "false", | ||
| "Description": "Closed rule\ntrue = closed curves allowed\nfalse = open curves allowed" |
There was a problem hiding this comment.
Good catch by copilot here. The description should indicate only closed curved accepted. It reads like if the parameter is true, both closed and open curves are accepted
| }, | ||
| { | ||
| "Id": "a4e7bab50f804226a58b34748879b6eb", | ||
| "Title": "ADDITIONAL COMMENTS\n_____________________________________________________ \n\nCustom nodes are typically found in the Add-ons section of the Library.\r\nThis custom node is located under:\r\nAdd-ons → Standards → Curve → Curve_Validate\r\n\r\nIf it does not appear:\r\n\r\nCheck that the .dyf file is in your custom nodes folder\r\n\r\nGo to:\r\nPackages → Package Manager → Package Settings → Package/Lirary Search Paths\r\nVerify the folder path is listed or add a new path\r\nRestart Dynamo after adding new custom nodes\n", |
jasonstratton
left a comment
There was a problem hiding this comment.
Just address the Copilot comments and it is good.
| var commonDefinitions = Path.Combine(pathManager.CommonDataDirectory, PathManager.DefinitionsDirectoryName); | ||
| var expectedDefinitionDirectoryCount = Directory.Exists(commonDefinitions) ? 3 : 2; |
There was a problem hiding this comment.
I think I was going to make a similar comment. But maybe my analysis is wrong. When this test runs in the CI pipeline, the directory is created by the CI process and should always return 3, right? ... When does it return 2? When testing locally?
And if the CI fails to create the dir, won't the assert still pass with a value of 2?
What happens if we ever add another directory or want to remove one? Does the test suddenly start failing? Probably an easy fix though.
| "TypeName": "bool", | ||
| "TypeRank": 0, | ||
| "DefaultValue": "false", | ||
| "Description": "Closed rule\ntrue = closed curves allowed\nfalse = open curves allowed" |
There was a problem hiding this comment.
Good catch by copilot here. The description should indicate only closed curved accepted. It reads like if the parameter is true, both closed and open curves are accepted



Purpose
This PR addresses DYN-9702.
This update adds the .dyf file used by the custom node template introduced in DYN-9927(#16861). The code changes ensure that Curve_Validate.dyf ships with Dynamo as a proper custom node definition, making it available from the Add-ons section of the Dynamo library when starting.
changes :
Declarations
Check these if you believe they are true
Release Notes
Curve_Validate.dyf is now shipped as a custom node definition, appears in the Dynamo library under Add-ons, and is available for Make a Custom Node.dyn template introduced in DYN-9927
Reviewers
@zeusongit
@DynamoDS/eidos
FYIs
@dnenov
@johnpierson
@jnealb
@jasonstratton