How to apply an addon to the last selected object ?

Hi, trying to adapt this feature for faster usage http://topologyguides.com/post/163096515095/decals

use it with addon ice tools
what i did get


. How to apply addon to the last selected object ?



with the help of this script you can do such things quickly, whith one click

[ATTACH=CONFIG]497423[/ATTACH][ATTACH=CONFIG]497424[/ATTACH] if make this script, it will possible to do for one click

Hi,

Just wondering if you’ve come across the bpy.context.selected_objects attribute? It is a python list of all currently selected objects in the scene. It doesn’t work the way you want it too if I am reading you correctly, but it can be the starting point for what you want to do. I have done something similar in an addon I am working on.

The basic elements of the solution to do this are:

  1. Either use a handler or modal operator to run a script when the user changes their selection of objects in any way.

  2. The script its self contains a collection of what has been selected in the order it has been selected.

  3. you can use a modal operator that runs whenever there is a mouse event, check to see if there is a change to the bpy.context.selected collection

  4. the code to check would need to store what has been selected somwhere, perhaps in a property or you could create a variable/property inside the operator its self. You need to do this since the collection is going to need to persist throughout blender’s runtime. Normally a scripts state only lasts for the time its being executed and then its gone.

That is the short version, let me know if this sounds like what you want and I can perhaps help you get it working?