I would like to reset the string property in the toolbar every time I hit the "Object" in the Add.
In short, this is the code I'm using:
class primitive_object_add(bpy.types.Operator):
bl_idname = "mesh.primitive_object_add"
bl_label = "Add an object"
bl_options = {'REGISTER', 'UNDO'}
img_str = StringProperty(name="Image Name (example: name.png)", description="desc here", default="", subtype='FILE_PATH')
def execute(self, context):
#code here
def menu_func(self, context):
self.layout.operator("mesh.primitive_object_add", text="Object", icon='OBJECT_DATA')
def register():
bpy.utils.register_module(__name__)
bpy.types.INFO_MT_mesh_add.append(menu_func)
def unregister():
bpy.utils.unregister_module(__name__)
bpy.types.INFO_MT_mesh_add.remove(menu_func)
if __name__ == "__main__":
register()
I've tried using self.img_str = ""
However if I'm not fully sure where I could put this in the code to have it run when I press "Object"
premitive_minecraft_item_add()
where you initiate a call to this operator and pass the arguments ( including this string ) $\endgroup$bpy.ops.mesh.primitive_object_add(img_str = "some string")
$\endgroup$