Hey everyone! I’m working on a SketchUp plugin for applying materials, and I’d like to use the original material selection window instead of creating a custom one.
The main issue is that when I select a material, SketchUp automatically activates the PaintTool, which interferes with my plugin’s functionality by essentially deactivating it.
Here are the methods I’ve already tried:
Using ToolsObserver to detect and override PaintTool activation.
Implementing a custom MaterialsObserver to intercept material selection.
Using a timer to continuously check and reactivate my tool.
Using PickHelper to create a custom material application process.
Unfortunately, none of these approaches have worked, and I still can’t stop the PaintTool from activating during the standard material selection process.
…like all other developers who needs to deal with material selection UI is a best way- and I guess: This is the way.
The user uses the material selection UI because he knows that the Paint Bucket (Material Tool) will be selected. “Knock it out of his hand” is not an expected behaviour. This is a wrong approach.
Perhaps good to know: The #onMaterialSetCurrent method is invoked whenever a different material is selected in the Materials dialog. The materials parameter might be Nil when the material is picked from the materials libraries and not yet added to the model.
It’s a good start, but you can’t avoid creating your own UI if you also want to use materials “outside” the model.