Advanced Usage¶
Macro Sets¶
Macro sets are collections of recorded macros. Sets are stored in the active Blender file as text data. Each macro set may contain one or multiple entries of recorded macros. See a sample of a macro set below.
How do macro sets work?¶
Macro sets are stored in python dictionary format. When macros are recorded or recalled, the extension will write to, or read from the relevant dictionary. The items in the dictionary contain information on recorded values.
'''Sample Macros Dictionary'''
macros_dict['macro_1'] = {
'val_info': 'frame_current',
'prop_name': 'frame_current',
'prop_path': 'bpy.context.scene',
'val_type': 'int',
'val_default': '1',
'val_min': '0',
'val_max': '250',
'val_array': 'False',
'val_path': 'bpy.context.scene.frame_current',
'full_path': 'bpy.context.scene.frame_current = 1'}
macros_dict['macro_2'] = {
'val_info': 'frame_end',
'prop_name': 'frame_end',
'prop_path': 'bpy.context.scene',
'val_type': 'int',
'val_default': '250',
'val_min': '0',
'val_max': '250',
'val_array': 'False',
'val_path': 'bpy.context.scene.frame_end',
'full_path': 'bpy.context.scene.frame_end = 250'}
Dictionary items¶
Below follows some information on individual macro entry components.
# The unique identifier, or key for the entry.
# This value must be unique and be prefixed with macro_
# The extension will automatically generate a unique number for each entry
macros_dict['macro_1'] = {
# The text shown in the dropdown
# This can be edited to any identifiable name
'val_info': 'frame_current',
# This is used to identify the property in the Blender interface
# Changing this might result in an error.
'prop_name': 'frame_current',
'prop_path': 'bpy.context.scene',
# The val_type item contains the value type, all values must match this type.
'val_type': 'int',
# The default value as set initially
# Value type must match the val_type entry as below
'val_default': '1',
# The min and max values as set initially
# Value type must match the val_type entry as below
'val_min': '0',
'val_max': '250',
# These items are needed by the extension to recall and randomize values
'val_path': 'bpy.context.scene.frame_current',
'val_array': 'False',
'full_path': 'bpy.context.scene.frame_current = 1'}
Manually Importing Macro Sets¶
The suggested method of importing sets is via the extras panel. However, there are two other methods of importing macro sets into the active Blender file.
To import single macro sets, use the File > Append command and select a single macro set in the Texts folder of the chosen .blend file.
Macro sets can also be saved and loaded from the Text Editor in Blender.
After manually appending/loading a macro set, be sure to refresh the Macro Player.
Do not use the Run Script command in the Text Editor to run macro sets. The saved preset files can only be run through the extension panel by using the Recall Macro/Recall Macros functions.
Manually editing a macro set¶
Though it is recommended to edit entries using the panel in the 3D View, manually editing the text block might offer a more flexible way to build and edit macro sets.
Record or import a new macro set.
Open the Text Editor Area and select the desired macro set to be edited, in this example it’s named “mac_Timeline”.
Let’s change some values on the first entry “macro_1”. See the code block below for updated values. Note that some values should not be edited as shown in the Dictionary items section above.
Warning
When manually editing values using the Text Editor, be sure to use the correct type of values.
For example, if the item “val_type” is ‘int’ then it uses integer values. Only use integer values for the val_default, val_main, and val_max items.
macros_dict['macro_1'] = { 'val_info': 'The Current Frame', # Updated the info line 'prop_name': 'frame_current', 'prop_path': 'bpy.context.scene', 'val_type': 'int', 'val_default': '10', # Updated from 1 to 10 'val_min': '10', # Updated from 0 to 10 'val_max': '50', # Updated from 250 to 50 'val_array': 'False', 'val_path': 'bpy.context.scene.frame_current', 'full_path': 'bpy.context.scene.frame_current = 1'}
Now test the new values by clicking on Recall Set in the macro sets panel. If the val_info was updated, then first refresh the Macro Entry dropdown.
Move/Copy entries between macro sets¶
Moving/Copying entries between sets is possible by manually copying/cutting > pasting entries using Blender’s built in text editor.
Open the Text Editor and select the first set containing the entry to be moved/copied using the Browse Text to be linked button.
Highlight the full entry to be moved/copied including any indents. Highlight the entire line from the text macros_dict[‘macro_# to the line containing the text ‘full_path’
Warning
It is important to preseve formatting for entries, including any indents.
Copy (CTRL + C) or cut (CTRL + X) the selected entry.
Open the second macro set by using the Browse Text to be linked button.
Paste (CTRL + V) the copied entry on the last line of the second macro set.
If necessary, renumber the macros in the new set to be unique. For example, if the pasted macro has the id: [‘macro_2’] and there already exists a [‘macro_2’] in the set. Then either renumber the original or the pasted macro entry to something unique like [‘macro_3’] - if that number is not taken already.
Include a blank last line.
Now test the second macro set by selecting it in the dropdown and clicking on Recall Set in the macro sets panel.