I have a small problem. I couldn't find anything even close to it in the blender stack exchange website.
I have a python code for duplicating the selected mesh as many times as specified by the user in a slider.
Now, if the user decreases the amount of steps in the slider, and tries to "Regenerate" (my button for duplicating), I want the extra meshes to delete themselves. I find no way of doing so. I tried finding the command for Ctrl+Z in the internet, but apparently, there is no such thing.
Is there any way to do this? If not, can anyone suggest an alternative?
This is my code currently:
scene = context.scene
myprops = context.scene.my_props
loc_x = myprops.x_location
loc_y = myprops.y_location
loc_z = myprops.z_location
steps = myprops.steps_counter
steps_done = 0
while steps_done<steps:
obj = bpy.context.active_object
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(loc_x, loc_y, loc_z), "orient_axis_ortho":'X', "orient_type":'GLOBAL', "orient_matrix":((1, 0, 0), (0, 1, 0), (0, 0, 1)), "orient_matrix_type":'GLOBAL', "constraint_axis":(False, False, False), "mirror":False, "use_proportional_edit":False, "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "use_proportional_connected":False, "use_proportional_projected":False, "snap":False, "snap_elements":{'INCREMENT'}, "use_snap_project":False, "snap_target":'CLOSEST', "use_snap_self":True, "use_snap_edit":True, "use_snap_nonedit":True, "use_snap_selectable_only":False, "use_snap_to_same_target":False, "snap_face_nearest_steps":1, "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "gpencil_strokes":False, "cursor_transform":False, "texture_space":False, "remove_on_cancel":False, "view2d_edge_pan":False, "release_confirm":False, "use_accurate":False, "use_automerge_and_split":False})
steps_done = steps_done + 1
I pass this code through an operator and link that operator to a button which does it for me.
ctrl + z
you should have looked for ùndo, which is the funktion assoziated withctrl + z
$\endgroup$