1
$\begingroup$

I have a script that sets the objects origin to the center and the lowest point in z of the object.

Everything works and I have it in my own custom tab under tools.

But how can I add it to the shortcut ctrl+shift+alt+c?

I have been able to add it other places (like the add mesh menu, although obviously not where I need it) but I cannot find any info on adding something to the set object origin menu.

Any help?

$\endgroup$
1
$\begingroup$

To adjust an existing menu, you need to start by finding the python class name of the existing menu you want to alter. You then create a function that uses the same argument list as a classes draw method and append it to the menu in bpy.types. You can see an example of this in the add object template script.

In the case of the set origin operator, the menu is created by the operator, it is based on an enum that appears to only exist in the C source code and isn't exposed to python, meaning it doesn't appear to be adjustable,

If you can't find the name of the menu, then you can create a replacement menu yourself. You would then create a shortcut that calls your menu and disable the original shortcut.

An example addon can be found here.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.