Automatically launch a tool just by selecting an object?

Hi guys!

It’s possible in Blender to automatically launch a tool just by selecting an object?

I mean: imagine select a CUBE, and then, automatically having the Modal Rotate enabled for it.

Or imagine select a CONE, and then, automatically having the Modal Move enabled for it.

Thanks!

Moved to Coding Python Support
I think you could use the msgbus to get a selection event but i’d wait for some more answer coming from experts.

2 Likes

I see you’re talking about creating something with Python, right?

I was referring to whether there was some interface element already created (or some addon) that would allow you to do this directly.

But any suggestion will be welcome! :slight_smile:

In Modo there is a utility that allows to assign simple commands to easily manipulate the rigs (attached screenshot). And I just wanted to know if in Blender we have something similar.

THANKS!

No there’s nothing like that right out of the box in blender. Its just as @BG_Division says, technically this could be done with an addon. Cant rule out that such an addon already exists, but havent stumbled across something like that.

2 Likes

I think that it will be possible with some line of python, yes. I do not have deep knowledge of external add-on, often I like to build myself simple tools/addon for what I need (but I’m an enthusiast, not a pro coder). Just now I’d like to go more in deep on this because I’ll need something like this for my addon under construction.
These link could be very useful for a start (but msgbus is not very well documented, unfortunately):

1 Like

Thanks for your help, guys!

No problem: I can live with that, not a drama, at all! :grinning:

Just select my objects/empties and then press “G” or “R” to Move or Rotate quickly, without having to think or worry too much, thanks to the channel locks and limits that I can easily define.

2 Likes

Anyway I’ll try to do something in the next few days, if it leads to something that doesn’t blow up the PC I’ll share something… :grimacing:

1 Like

Yeahh! Thank you soooo much! :grinning:

Remember that msgbus or app handler type internal subscription will always activate the transform tool when you select an object, even when you intend to do something else with the the object.

1 Like

Yes. It would be necessary for a hypothetical addon enabling this functionality to provide a checkbox to enable and disable it at will.

The good thing about this mechanism is that, when you already have a perfectly rigged model, you can select each part and not have to think if the movement assigned to that particular element is translation, rotation or scale. You just click and move the mouse.

1 Like

The application definitely has its practical uses, but the real challenge lies in implementing it in an intelligent manner. Going beyond just the basic features will require a much more complex approach. Since each object and object type would need to be handled uniquely, and users will have to set up these specific configurations for every scene they use. It needs a really good UX design to be useful.

1 Like

Here my test, a bit late but here we are.
My intent here was to trigger the ‘selection object’ event to automatically launch different tools (grab, scale and rotate) depending on which object is selected and without the need to use any G, S or R key.
I used msgbus and there is choice to enable and disable this functionality. When it is enabled, at the moment selecting the Cone it will launch the Rotation tool, the Sphere the Grab tool and the Cube the Scale tool (everything is hard coded but it will be simple to go further and improving UI to let the user make his own custom choices and preferences). When you disable the functionality everything will be as default.
This could be a base to improve, let me know if I understand your question in the right way.
Anyway I learned something new that it will be useful for my stuff.

1 Like

Exactly, yes, that’s it! It’s very good. I think you have the first stage of what could be an interesting add-on.

What is important is that the mechanism used “respects” the possible limits that we may have introduced in each object. Let me explain:

Imagine that we want the CUBE to only be able to ROTATE and that it can only do so on the X axis (because we have blocked the other two axes) and also, it can only rotate between -30º and 60º.

Well: once that cube is selected, without having to press anything (as seen in the video) it is important that the limitations are met: that it can only rotate on the X axis between -30º and 60º

In this way, when we have a relatively complex rig and we are in the animation phase, we can click on each object or empty that can be animated and not worry about whether that object should only move, rotate or scale (nor on which axis or how many degrees). We simply “click and move the mouse”.

I don’t know if I have managed to explain myself.

Of course, it is important that the command associated with each object (Move, Rotate or Scale) can be deactivated if at any time we want to go back and make some changes to the model or the setup…

Big thanks for your efforts! :grinning:

1 Like

Yes, it’s very clear.
I’ll continue trying to improve it because I like the ‘subject’ and it allow me to continue learn something new.
I’ll be back (as Terminator usually say :sunglasses:) with some update!

1 Like

YEAHH! Looking for to your news on this!

Some day I will try to put my hands in the scripting side of Blender dusting off my old and poor Python knowledge… But for the moment I have LOT of other things to learn here and there.

Big thanks again! :slight_smile:

Small update on the current state of the “AutoTool” experiment.
I hope this very short video can show something understandable, but it is not possible to upload a longer one (5 MB limit) and I do not have a YT account. “AutoTool” can be enabled and disabled at will (when opening Blender it will always be disabled automatically) and it only works if you are in OBJECT or POSE mode. A warning message will be displayed in the panel while “AutoTool” is enabled (I would also add a larger message in the 3D view).
There is a PREFERENCES panel that allows you to dynamically create lists of objects that will be affected by the tool itself for GRAB, SCALE or ROTATE. Obviously the same object cannot be present in multiple lists (there is a control that does not allow it).
Currently the logic behind the lists uses the object names: it checks the suffixes so if you add a Cube, a Cube.001 and a Cube.002 to the list the tool will only add 1 Cube to the list and handle all Cubes in the scene.
You can Show/Hide all panels inside PREFERENCES.
While “AutoTool” is running and an object in the lists is selected, the tool it was assigned to is automatically started.
All types of CONSTRAINTS assigned to the object are respected.

It make sense?

1 Like

Wow! Thanks for your work, BG!

I think that more or less, I understand it.

You move each object to the correspondent “List” (to Grab, Rotate or Scale), right?

But the limits for the translation, rotation and scale amounts are defined per-object, right?

And this is persistent between sessions? I mean: if you move a CONE to the list to be SCALED. Once you close and open Blender, this is stored? Or all those lists becomes empty?

I recorded a small video to show how this works in Modo. It’s much more limited than I remembered. In fact it only works with Locators (Empties) and not with regular geometry. In Modo there is not such thing like in Blender, where you click-and-move immediately. It only calls the corresponding gizmo.

YT VIDEO - HOW THIS WORKS IN MODO

What you are achieving is fantastic, even better than in Modo, since you can use over any object, right? (also empties?)

Exactly.

Yes, it was the first idea came in my mind. But this logic can be changed.

Yes.

This is a thing that could be implemented in minutes. I’d add the choice to have both options,

Yes, but I have to test it because didn’t try it.

1 Like

Yeah! I think that this could be a nice addon/helper to animate, since with it you can forget about what tool needs to be invoked (Grab, Rotate or Scale) every time you select an object. The system does this, automatically, for you.

Thanks for your efforts! :slight_smile: