Object→Action→Settings

When writing addons for Blender 2.5x, it is recommended to follow the convention “select object, perform action, then adjust settings”. That is, instead of entering settings for the operator before invoking it (and trying to guess what the effect is going to be, guessing wrong, and having to undo and try again), you can play around with them after invoking the operator, and get immediate feedback on the right settings to achieve the effect you want.

I have added a page to the 2.5x scripting section in the “Blender 3D: Noob to Pro” Wikibook explaining how to implement this here
http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Advanced_Tutorials/Python_Scripting/Object,_Action,_Settings_New.

By the way, the included scripts in the Blender source tree (at least as of revision 33956, the last one I checked out from a couple of days ago) implement this in a much more convoluted way, involving replacing the data of a previously-created object according to the setting of a magic hidden “edit” property. This is all completely unnecessary now, and in fact that “edit” property no longer works.

As part of this, it is usual to add a UI item to invoke your operator to an existing Blender menu, panel or window header. But the way to do this is not documented anywhere. The above example shows you how to add a new item to the Add→Mesh menu via the undocumented bpy.types.INFO_MT_mesh_add object; I have now added a table listing all such objects that I believe you can use in the same way.

Thanks so much for your work on that 2.5x scripting section. I’m just starting to write some Blender scripts and found information like this hard to find.