1
$\begingroup$

I'm finding that I repeat many actions and would like to know what the best strategy is to make those actions easier to do to speed up my work flow.

I'm looking for an answer that makes things geometrically shorter distance to achieve the actions and use less physical energy overall.

For example, is there a plug in I should know about? Should I create a custom mappings for shortcuts? Etc.

$\endgroup$

1 Answer 1

3
$\begingroup$

If you are willing to do a bit of Python scripting, it actually isn't that hard, assuming that you don't have to do anything that involves modifying specific vertices in Edit Mode. For my example script, I will do these three actions:

  1. Duplicate the object and move it 2 Blender Units in the +X direction,
  2. Scale it by a factor of 2 along the Z axis.
  3. Apply the scale.

You can do whatever actions apply to you.

First, set up the viewport. Split the view and pull up a text editor. Create a new text file and name it script.py. At the top of the screen, hover over the bottom of the Info bar (the one with the File, Edit, etc. menus). Your cursor should become vertical resizing arrows. Drag the Info bar down to reveal the Python Report Console.

enter image description here

Next, we need to set up our Python script. In the text editor, type

import bpy

Now, do the first step of our composite action (in this case, duplicate the object and move it). In the Report Console, you will see a new entry has popped up. Right click it, press Ctrl + C (or Cmd + C), and then paste it into a new line in the text editor. My code now looks like this:

import bpy

bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(2, 0, 0), "constraint_axis":(True, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "gpencil_strokes":False, "texture_space":False, "remove_on_cancel":False, "release_confirm":False})

Now we just need to repeat that process for the remaining steps. Note: The blocks of code in the Report Console don't automatically deselect. We can use this to our advantage, though and copy and paste multiple lines at once. Once I got all of my code copied to the script, it looked like this:

import bpy

bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(2, 0, 0), "constraint_axis":(True, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "gpencil_strokes":False, "texture_space":False, "remove_on_cancel":False, "release_confirm":False})
bpy.ops.transform.resize(value=(1, 1, 2), constraint_axis=(False, False, True), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)

Now, I can just select the object I want to duplicate, press "Run Script", and Blender performs all the actions I put there. This should work for most workflows.

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .