To imitate [Center New] button (other method)

http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_pythonresizerot.htm#centernew

JMS,

I can’t get it to work in Blender 2.36. Could you comment on the code on what it is doing so maybe I can spot how to wedge it into my python plugin? Thank you!

Sorry but it does not works with the official blender 2.36, only with the cvs version after the 2005/05/09 or with blender 2.37 .

JMS,

I doesn’t work with 2.37 either! The whole object is displaced, including the center. Too bad, I need this feature now.

I would implement it in a more straight forward way (I tried) by substracting to each vert the center of the bounding box, then doing a setLocation to the object to where such bounding-box center is, but it results in the same output as your script.

Any help appreciated.

I don’t understand your problem, this script does exactly what it has to do under blender 2.37 : it imitates the Center New Button and it gives same results, mouvements and values . It also works if the mesh is parented to an another object .

You’re right, it works! But only if called over the object after linking it to the scene. This little detail was it all.

Ok, I see the problem now …