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

Package icons do not show up in library #10669

Closed
ksobon opened this issue May 18, 2020 · 6 comments · Fixed by #11063
Closed

Package icons do not show up in library #10669

ksobon opened this issue May 18, 2020 · 6 comments · Fixed by #11063
Labels
2.x Issues related to 2.x versions of Dynamo. bug developer experience more high-level issues that are more specific to individuals actively developing on Dynamo. needs investigation Needs looked into further. tracked

Comments

@ksobon
Copy link

ksobon commented May 18, 2020

Dynamo version

image

Operating system

Windows 10

What did you do?

Added Package.Images.dll to provide icons for custom nodes that are *dyf based.

What did you expect to see?

Small/Large icons show up in the library.

What did you see instead?

Only Large icons come through.

image

Just FYI, this used to work before in older versions of Dynamo. I have a PackageImages.resx in the project and a post build routine that wraps it into a customization. Everything following your instructions from the WIKI pages. What's confusing is that clearly the customization DLL is doing some part of the job, because the Large icons show up properly. Small icons have the exact same name (guid.Small.png) and are embedded just the same way. They are 32px in size just like recommended. I don't see anything here.

Ideas?

@ksobon
Copy link
Author

ksobon commented May 21, 2020

@alfarok any idea. It looks like you were the last one updating icons documentation on the wiki. Sorry for dragging you back into this from the confines of generative design.

@erfajo
Copy link

erfajo commented May 21, 2020

This might not be a solution, it is more an idea that might help you.
I have a compile factory supporting code from .net 4.6 (for backward compatibility test), 4.7, 4.72, and 4.8 supporting dynamo 1.3, 2.0, 2.3, and 2.5. For all of them, I have isolated my icons in a separate icon project inside the individual solutions... this gives me the advantage, that I don't have to change anything besides the overall .net support when updating towards newer version of dynamo. This gives me no errors and icons are working as they always have done.

@alfarok
Copy link
Contributor

alfarok commented May 21, 2020

Hey @ksobon! I haven't looked at anything related to Dynamo icons in a while but remember it always being a battle. I have used the process you described for zerotouch and nodemodel libraries but not with custom nodes. Can you point me to the doc you are describing?

I also see this on the wiki updated in Febuary

@erfajo
Copy link

erfajo commented May 22, 2020

Can I ask @alfarok
Why do write in the wiki that icons should be "Embedded in .resx"?

It was annoying me for a long time that icons should be embedded, since update of icons was a cumbersome job... So I examined why this should be necessary, and it wasn't. However, I am also using the .net framework used in the solution (e.g. 4.7)

<GetReferenceAssemblyPaths TargetFrameworkMoniker=".NETFramework, Version=v4.7">
  <Output TaskParameter="FullFrameworkReferenceAssemblyPaths" PropertyName="FrameworkAssembliesPath" />
</GetReferenceAssemblyPaths>

So I stopped embedding, and icons worked perfectly... and icons became much more updatable!

@alfarok
Copy link
Contributor

alfarok commented May 22, 2020

It probably was done historically for OOTB nodes so that the icons were embedded resources in the executable. This probably translated to 3rd party development from how it was being done internally but can likely be done several ways. I believe the article @ksobon is referring to was specifically for OOTB nodes since there is a slightly different process.

@erfajo
Copy link

erfajo commented May 23, 2020

Thanks @alfarok

I dont know if this can help you @ksobon , but this is how my files looks like for Dynamo 2.3, and they work as expected.

First, since I have isolated icons in a separate project, is the only references needed the below two.

<ItemGroup>
  <Reference Include="System" />
  <Reference Include="System.Drawing" />
</ItemGroup>

I am also doing the compilation "BeforeBuild" due to I am using MSBuildTasks to set the assemblies version. In the wiki it is recommended to use "AfterBuild", and if you set your version hardcoded, then go for this.

<Target Name="BeforeBuild">
  <!-- Get System.Drawing.dll -->
  <GetReferenceAssemblyPaths TargetFrameworkMoniker=".NETFramework, Version=v4.7.2">
    <Output TaskParameter="FullFrameworkReferenceAssemblyPaths" PropertyName="FrameworkAssembliesPath" />
  </GetReferenceAssemblyPaths>

  <!-- Orchid.Revit.Images customization dll -->
  <GenerateResource SdkToolsPath="$(TargetFrameworkSDKToolsDirectory)" UseSourcePath="true" Sources="$(ProjectDir)\OrchidRB.Images.resx" OutputResources="$(ProjectDir)\obj\Debug\OrchidRBImages.resources" References="$(FrameworkAssembliesPath)System.Drawing.dll" />
  <AL SdkToolsPath="$(TargetFrameworkSDKToolsDirectory)" TargetType="library" EmbedResources="$(ProjectDir)\obj\Debug\OrchidRBImages.resources" OutputAssembly="$(OutDir)OrchidRB.customization.dll" Title="Orchid Dynamo Revit Node Icons" Description="Icon library for Dynamo" ProductName="Orchid" Copyright="Copyright(c) 2014, Erik Falck Jørgensen" Version="$(Major).$(Minor).$(Revision).$(Build)" />

  <!-- the other customization files, five in all -->
  ...
</Target>

Be aware, if you have used the wiki recommendations, will your resources (the resx file) point towards .net 2.0. This can be tweaked using search and replace. Replace 2.0.0.0 with 4.0.0.0

<data name="Orchid.About.Orchid.Large" type="System.Resources.ResXFileRef, System.Windows.Forms">
  <value>orchidrevit\about\orchid.about.orchid.large.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>

_

AND what could be important. In 1.3/2.0 is Document denoted as var. In 2.1 and later must var be changed to Document, if the node has two or more signatures taking document as input!

e.g.
Orchid.RevitProject.Elements.Element.ById.var-int.Small
Orchid.RevitProject.Elements.Element.ById.Document-int.Small
_

By the way, my icons are 64px for the small icons and 256px for the large icons. I am aware that only 32px/128px is needed, but in my opinion icons looks better in the 2.0 series in 64px/256px. In the 1.3 series is 64px/256px not a good idea, but this version is obsolete anyway.
However, working with icon design is another topic... I mention it because sizes aren't any problem, as long as naming follows the wiki.

@mjkkirschner mjkkirschner added bug developer experience more high-level issues that are more specific to individuals actively developing on Dynamo. 2.x Issues related to 2.x versions of Dynamo. needs investigation Needs looked into further. labels May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Issues related to 2.x versions of Dynamo. bug developer experience more high-level issues that are more specific to individuals actively developing on Dynamo. needs investigation Needs looked into further. tracked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants