// Class Attribute
[NodeName("MyNodeModel")]
public class MyNewNodeModel : NodeModel
// or
// Constructor
public ButtonCustomNodeModel()
{
this.Name = "MyNodeModel";
}
节点将位于以下目录下的附加模块中:
SampleLibraryUI/Examples/MyNodeModel
还可以通过在类或构造函数中使用 NodeCategory 属性来覆盖该类别,如下所示。
// Class Attribute
[NodeCategory("NewSampleLibraryUI.Examples")]
// or
// Constructor
public ButtonCustomNodeModel()
{
this.Category = "NewSampleLibraryUI.Examples";
}
节点现在将位于以下目录下的附加模块中:
NewSampleLibraryUI/Examples/MyNodeModel
ZeroTouch
默认情况下,ZeroTouch 库也根据类结构进行组织。
namespace MyZTLibrary
public class Utilities
{
public double doubleValue(double num)
{
return num * 2;
}
}
自定义节点是在创建节点(使用新的“自定义节点”对话框)期间根据指定的 Category Name 组织的。
警告!
在节点名称或类别中使用点表示法将产生其他嵌套的子类别。. 将用作分隔符来确定其他层次结构。这是 Dynamo 2.0 库中的新行为。
类别名称可以稍后在 .dyf 文件(XML 或 JSON)中更新
{
"Uuid": "85066088-1616-40b1-96e1-c33e685c6948",
"IsCustomNode": true,
"Category": "MyCustomNodes.Utilities.Actions",
"Description": "This is an example custom nodes.",
"Name": "doubleValue",
"ElementResolver": {
"ResolutionMap": {}
},...
<Workspace Version="1.3.0.0000" X="100" Y="100" zoom="1.0000000" Description="This is an example custom nodes." Category="MyCustomNodes.Utilities.Actions" Name="doubleValue" ID="85066088-1616-40b1-96e1-c33e685c6948">
namespace SampleLibraryUI.Examples
{
[NodeName("Drop Down Example")]
[NodeDescription("An example drop down node.")]
[IsDesignScriptCompatible]
[AlsoKnownAs("SampleLibraryUI.Examples.DropDownExample")]
public class DropDownExampleRENAMED : DSDropDownBase
{
...
}
{