ui:Icon Support in a UI Manager ui:Tree Layout

Moderator: Chad

User avatar
AndrewHazelden
Fusionator
Posts: 1215
Joined: Fri Apr 03, 2015 3:20 pm
Location: West Dover, Nova Scotia, Canada
Been thanked: 11 times
Contact:

ui:Icon Support in a UI Manager ui:Tree Layout

#1

Post by AndrewHazelden » Fri Jan 26, 2018 5:00 am

It would be really handy if a Fusion UI Manager "ui:Tree" list view layout was able to support the placement of full color RGB images inline in the view as ui:Icon based graphics.

I've looked at the "UITree" and "UITreeItem" entries in the Fusionscript Help Browser and I didn't see any functions listed that I think would allow me to attach a ui:Icon image to this control. It would be really nice if a ui:Icon was able to be used in the tree view layout and placed with alignment controls like I am able to do now with a ui:Button that supports an inline image attachment:

Code: Select all

      IconSize = {16,16},
      Icon = ui:Icon{ File = 'Scripts:/Reactor/InstalledAtom.png' },
      Margin = 50,
    
This WishList feature request of a Tree view element with RGB image displaying support would make capabilities possible like Lua script created asset views like a UI Manager created custom file/media browser layout with image thumbnails in a scrolling view layout, or the ability to have icons in a tree to show the ON/OFF state of an attribute like maybe an RGB image for an eye for visibility, or a padlock for locked/unlocked, etc..

I know strange things can be done with Emoji's, or even Unicode + Symbola in a hackney stop-gap fashion in some use cases but that's not what I'm after - and that alternative approach tends to not work out of the box in a cross-platfrom setting as on Linux distros I've see the Emoji approach fall apart visually on Linux installs that lack the supporting Emoji font glyphs in their installations.

The main reason for requesting this addition is for the new We Suck Less "Reactor" atom package list view so it would be able to have a clearer indication of the installed/uninstalled state of a package with a nice visual icon vs the current approach of using a checkbox that can be potentially confusing to end users and ambiguous.
Reactor Installed Packages.png
Also, I'd like to be able to use this ui:Tree based ui:Icon mode be able to make visually rich looking GUIs using UI Manager that could work similar to the DJV_View file browser dialog (reference image attached). If you wanted to succeed at this scrollable GUI building kind of task, a ui:Tree view with ui:Icon loading support is exactly how it would need to be done in Fusion 9.
DVJ-File-Dialog.png
You do not have the required permissions to view the files attached to this post.
Last edited by AndrewHazelden on Fri Jan 26, 2018 7:31 am, edited 1 time in total.

User avatar
SirEdric
Fusionator
Posts: 1583
Joined: Tue Aug 05, 2014 10:04 am
Been thanked: 52 times
Contact:

Re: ui:Icon Support in a UI Manager ui:Tree Layout

#2

Post by SirEdric » Fri Jan 26, 2018 6:42 am

Yep.
Coolness factor = 100!
There should also be an option to crop incoming images into a predefined (say 128x128) icon size...:-)

User avatar
AndrewHazelden
Fusionator
Posts: 1215
Joined: Fri Apr 03, 2015 3:20 pm
Location: West Dover, Nova Scotia, Canada
Been thanked: 11 times
Contact:

Re: ui:Icon Support in a UI Manager ui:Tree Layout

#3

Post by AndrewHazelden » Fri Jan 26, 2018 7:16 am

SirEdric wrote:
Fri Jan 26, 2018 6:42 am
Yep.
Coolness factor = 100!
There should also be an option to crop incoming images into a predefined (say 128x128) icon size...:-)
Hi SirEdric. :)

If you look at the little code chunk I posted above it showed a (slightly abstract but accurate) example of how a ui:Icon would typically be used in the UI Manager GUI building system in Fusion.

Resizing a ui:Icon Image

This following line of Lua code written below indicates that the icon image should be resized and saved in memory as a 16x16 pixel sized icon image regardless of the original image size on disk which could be much larger:

Code: Select all

IconSize = {16,16},
This will result it your button's icon being generated and saved in memory at a scaled up/down resolution to the exact dimension you expect. This is handy when you want to place the element in your own GUI layout with precise control as the image is connected and attached to the ui:Button.

This custom image sizing technique is useful when you want to preview a JPEG or PNG image on a button element that might be coming from a photo on your hard disk that is loaded and displayed dynamically in your custom UI Manager window.

The existing Fusion 9 based "ui:Button" control and ui:Icon loading features can be explored using the Button with Icon example Lua script from the main WSL UI Manager thread.

Cropping an Image?

When you say the word "crop" @SirEdric related to modifying to an icon, there are two meanings:

- Resize the image to fit the small size of a button which is covered in the example above.

OR

- If you truly want to crop the image differently, am not aware of how you would actually re-frame the composition of the ui:Icon image on the fly natively in Fusion. Like for example if you wanted to, lets say, crop a portrait 4:3 or 16:9 aspect ratio portrait or landscape orientation image down to a 1:1 aspect ratio square icon.

I think you'd likely have to do something funky in your Lua script such as using Fusion Studio's FuScript library/terminal bindings to call upon the Fusion compositing environments graphics capabilities to pre-process your footage to thumbnails that would get saved into a unique folder location inside of the %temp% folder. You would also use FuScript if you wanted do something more challenging in your UI Manager script like scan a folder full of images and use OpenColorIO to apply an EXR linear workflow gamma 1.0 color space to sRGB gamma 2.2 color space conversion as you generate the thumbnail sized preview JPG/PNG icon images.

User avatar
SirEdric
Fusionator
Posts: 1583
Joined: Tue Aug 05, 2014 10:04 am
Been thanked: 52 times
Contact:

Re: ui:Icon Support in a UI Manager ui:Tree Layout

#4

Post by SirEdric » Fri Jan 26, 2018 9:04 am

Thanks man.

I actually meant "fit", as in "Resize the image to fit the small size of a button", rather than crop.
Indeed cropping wouldn't make that much sense in this case...:-)

Cheers.

Eric.

User avatar
ChristopherNodal
Fusioneer
Posts: 165
Joined: Mon Jan 11, 2016 1:42 pm

Re: ui:Icon Support in a UI Manager ui:Tree Layout

#5

Post by ChristopherNodal » Sat Mar 17, 2018 12:49 pm

All for visual elements. Visuals is what we do. We are visual beasts.