How can I manipulate textures and materials with HtmlDialog?

Hi guys,

I need to create a HtmlDialog to colorize and add textures. I searched a lot, but I didn’t find nothing that would help me :frowning:

I have this HtmlDialog to create this feature:

Where do I start?

I saw this post, it’s almost what I need: https://forums.sketchup.com/t/thumbnail-cache-for-htmldialog-with-many-images/35038

How can I manipulate textures and materials with HtmlDialog?

You don’t use the HtmlDialog itself to manipulate textures. It only display the UI.
Manipulation of the model and textures must be done with Ruby. So you need to wire up action callbacks from the webdialog to tell Ruby to perform the manipulation.

As with SketchUp 2018 you can use Sketchup::ImageRep to manipulate textures on pixel level.

That being said, you mention colorization - which SketchUp support without you having to perform the pixel manipulation yourself. For that you use the Sketchup::Material class.

It’s a little unclear exactly what you are looking to do - so I cannot recommend which direction to do. If you can elaborate more in what and - why then we can assist further.

Also, we just uploaded some example of using HtmlDialog; GitHub - SketchUp/htmldialog-examples: Examples of using SketchUp Ruby API's UI::HtmlDialog class
One of the examples demonstrate how to display material info and then how to adjust some parameters.

1 Like

Thanks ever so much! That is quite enough :grinning:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.