Custom NodeModel Node Category Icon Dynamo 2.x

dynamo

#1

Hi all,

Maybe I didn’t query the forum properly, but just in case I actually did, I will ask the question anyway.

How do you change the icon of a NodeCategory? I have my packages nested under a specific custom category. At the moment it seems to be picking up one of the icons from the latest nodes added and using it as the icon for the category. What is the proper way to override this behaviour.

Please note that my Project name does not include the category as the Namespace but I am defining it explicitly using the Node category attribute i.e [NodeCategory("MyCategory.MyNstedPackage")]

Many thanks in advance,
M


#2

Try to read this wiki page @ DynamoDS Github


#3

Hi @erfajo,

Thanks for the prompt reply. I don’t think this wiki page covers what I am asking for. Would you care to elaborate if you have more experience on the matter.

What I’m aiming for is to control the NodeCategory icon.

Hope this makes sense.

Cheers
M


#4

So you are not asking for how to do it for ZeroTouch nodes?

To get the “default” icon you can follow this instruction. This also covers icons for Custom Nodes…

This is how my package looks like… it includes both ZT and few CN nodes…


#5

Hi @erfajo,

Cheer for this. I went through this page previously. I believe the answer lies somewhere between these lines.

Can please confirm if your namespace is Orchad and then you have the nested packages underneath. Lets say Orchad.Applications.

Because in my case the namespace is Something and the category is something I define only in the CN attributes.

Also can you please confirm the name of your “default” icon. Just in case I am missing something in the naming.

Many thanks for all the help

Best
M


#6

When I started out only having a package of Custom Nodes I followed the information given at that page, that did it. Likewise, when I changed my package into a ZeroTouch I followed the other guide.
However in .Net you can have methods with different signatures and for interface lists, dictionaries etc. I had to ask for “how to do that”. This is now explained in the guide as well.

So it is pretty much, do what the guides tell you, and you are good to go.

Default icon name must be…
DefaultCustomNode.Large (.png)
DefaultCustomNode.Small (.png)

this is very clearly written under the image of publishing a package!

NB! Default icon

You can add default icon, if you want to use 1 icon for all custom nodes. You have to make all steps, described above. But name of your icon should be DefaultCustomNode.Small

continuing in the following paragraph that explains how a large icon must be named…

NB! Large icon

You can also add a large icon (used when tool-tip dialog pops up) by following all of the above steps but naming your images/resources with the following name: Custom-node-ID.Large and Custom-node-ID.Large.png


#7

Hi again.

Thanks once more for the prompt reply.

Nope… This does not cut it. I’m pretty confident that I can read, understand and use instructions.
I am not using the GUIDs to name my individual node resources as the article states, but I am using the Namespace.Class.Large.png and Namespace.Class.Small.png template and they work fine.

Even if I remove all my resources leave only the DefaultCustomNode.Large.png and DefaultCustomNode.Small resources, and debug the catefory icon still doesn’t appear.

My guess is that it has to do with my assembly naming. As I mentioned previously the name of the category where these custom nodes are nested is not part of the assembly name or a corresponding namespace.
Also it includes special characters. :slight_smile:

Also I have notice that on the article you’ve embedded the customisation.dll is created before build whereas on this one https://github.com/DynamoDS/Dynamo/wiki/Add-Icons-for-a-Zero-Touch-Assembly-or-NodeModel-assembly is created after build.

Any other ideas from the Dynamo Team @Michael_Kirschner2 @Racel_Williams

Cheers
M


#8

Whether it is before built or after doesn’t really matter since it is a process not dependent on the assembly compiling… as long as the resource file is present.

I have a sample ZT project there can be downloaded from Github, but it is nearly the same as the one you can get from DynamoDS Github… this works.

  <Target Name="BeforeBuild">
    <!-- Get System.Drawing.dll -->
    <GetReferenceAssemblyPaths TargetFrameworkMoniker=".NETFramework, Version=v2.0">
      <Output TaskParameter="FullFrameworkReferenceAssemblyPaths" PropertyName="FrameworkAssembliesPath" />
    </GetReferenceAssemblyPaths>
    <!-- Generate Node customization dll -->
    <GenerateResource UseSourcePath="true" Sources="$(ProjectDir)\Internals\ZeroTouchCoreImages.resx" OutputResources="$(ProjectDir)\Internals\ZeroTouchCoreImages.resources" References="$(FrameworkAssembliesPath)System.Drawing.dll" />
    <AL TargetType="library" EmbedResources="$(ProjectDir)\Internals\ZeroTouchCoreImages.resources" OutputAssembly="$(OutDir)ZeroTouchCore.customization.dll" />
    <!-- Generate Package customization dll -->
    <GenerateResource UseSourcePath="true" Sources="$(ProjectDir)\Internals\PackageImages.resx" OutputResources="$(ProjectDir)\Internals\PackageImages.resources" References="$(FrameworkAssembliesPath)System.Drawing.dll" />
    <AL TargetType="library" EmbedResources="$(ProjectDir)\Internals\PackageImages.resources" OutputAssembly="$(OutDir)Package.customization.dll" />
  </Target>

and a screenshot from VS

this follows also the DynamoDS descrition here


#9

Hi @erfajo,

I think I will just try to troubleshoot this on a simple template project as a separate exercise and will post any findings here.

Thanks for the help. I will wait to see whether the rest of the crew has something to add.

Cheers
M


#10

Ok,

I’ve found a workaround to this. I’m not sure whether this is the correct way to do it, but it seems to be working on @erfajo’s library as well, (judging from his previous snapshot)

So, apparently the category picks up the icon from the first class in the library. See attached.
This is something that works for me at the moment, but I am eager to find out the proper way of doing this.

Cheers
M


#11

This is only true if there is some kind of error… in that case, it takes an icon not necessarily the first.

In the attached issue I had problems loading Custom Nodes. This had also an influence on the icons loaded, which I have solved by making my own executable installer there installs different versions meant for Dynamo respectively Dynamo Sandbox.

This made me aware that any kind of error loading you assembly will end in unwanted behavior also according to your icons.

However, you sounds like you know better than me… so keep on your trial and error and see if you can fix it.


#12

Apologies,

I didn’t explain it properly.
It picks up the icon of the first in alphabetical order node/class visible to dynamo.so if I were to rename the first node to “What” instead of “About” it would pick up the icon from the ColorCompare node.

Thanks for all the help regardless, the snapshot of your library gave me the idea for the workaround.

Best,
M


#13

I experienced the same issue. Also did the workaround and that works, but it would be better if there is a good way to set the icon for ZT packages.

Any ideas anyone?


#14

This is a coder problem slightly beyond this forum… try instead DynamoDS Github page

try to see this issue


#15

Thanks for pointing this thread out @erfajo.

It basically confirms that the “About” node workaround is still the most credible solution.

best,
M