Starting with a single cube, I have changed some properties (material, color, reflection attributes), and then duplicated the object into a dozen cubes, placing them in the scene. After rendering, I'd like to change the color of all of them. How do I do this efficently?
I have found multiple ways already:
B
, then rectangular select), join the meshes ctrl-j
, change the color, tab
into edit mode, P
to seperate the objects again. This is quite possible since the meshes of all my objects do not touch. Basics docs
Number 1 is error prone and too tedious for regular use. Number 2 is more specialized and much worse. Just selecting multiple objects and changing the value does not work because the property selections apply only to the active object which is only one of those selected.
As this is a common use case I'm probably missing the easy way. What is it?
If you just want to change one parameter for multiple objects RMB click on control(text field for example) and choose Copy to selected.
Activate 3D View: Copy Atributes Menu in User Preferences and call it with ctrl+c if you want to copy modifiers or such
http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/3D_interaction/Copy_Attributes_Menu
While I did not find the much preferred simple button or gui solution, it turned out that hacking your own Python code in Blender is easier than one might think.
The cubes I am working with are more like domino stones. Subsequently all objects looking like dominoes have a name starting with "Domino". It is very easy to alter all objects in a scene based on their name:
for o in bpy.data.objects:
if not "Domino" in o.name:
continue
o.rigid_body.mass = 500
o.rigid_body.friction = 0.4
o.rigid_body.restitution = 0.95
o.rigid_body.angular_damping = 0.2
o.rigid_body.linear_damping = 0.05
To use this code I simply opened a new window (drag the little upper right triangle icon on any existing Blender window), changed the window type to "Python Console" (lower left window type select icon), and then paste the above code into it.
The code can be edited in an external text editor. Alternatively one can open a text editor window inside Blender as well. Upon saving a scene, both the Python console and the internal text editor are stored along the 3D model which makes for a very nice workflow.
Finding the correct object names - such as bpy.data.objects["Domino.033"].rigid_body.mass
is very easy, because Blender does show these when hovering over any form entry field with the mouse pointer. If one has identified an object, use Python's dir()
function to get a list of all known methods and attributes of an object. There may be more than the gui allows to modify or use.
This was much easier than I thought. It probably explains why one can think of some complex manipulation for which there is no gui element - it's simply much easier to handle in code. I'll probably use this to duplicate and position objects along lines, circles, spirals instead of using Blender's own array attributes. It will allow for easier later position adjustments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With