Open enzyme69 opened 6 years ago
Creating multiple modifier combo for bunch of objects:
import bpy
obs = bpy.context.selected_objects
for ob in list(obs):
ob.modifiers.new("blah1", "REMESH")
ob.modifiers.new("blah2", "WIREFRAME")
ob.modifiers.new("blah3", "SUBSURF")
For a single object, you can always run operators with ACTIVE OBJECT selected.. for example: A Combo of creating Remesh - Wireframe - Subsurf and few modification:
import bpy
bpy.ops.object.modifier_add(type='REMESH')
bpy.ops.object.modifier_add(type='WIREFRAME')
bpy.ops.object.modifier_add(type='SUBSURF')
bpy.context.object.modifiers["Wireframe"].use_relative_offset = True
bpy.context.object.modifiers["Wireframe"].thickness = 0.02038
bpy.context.object.modifiers["Remesh"].octree_depth = 3
bpy.context.object.modifiers["Remesh"].mode = 'SMOOTH'
Blender Operators documentations: https://docs.blender.org/api/blender_python_api_2_76_1/bpy.ops.html
SV Macro good read: https://github.com/nortikin/sverchok/wiki/Macros https://github.com/nortikin/sverchok/issues/1538 https://github.com/nortikin/sverchok/issues/1537
Related "Script Node Lite": https://github.com/nortikin/sverchok/issues/942
Ideally: Macros or a series of commands operators can become a button and can work on multiple objects, regardless. This is definitely possible with some special arrangement.
In general, BPY OPS is a good start to make snippet of MACROS. There are many occasions when instead of using the BPY OPS, we simply use the object "methods".
Creating a new modifier "REMESH" for bunch of objects