python 3.x - How do I change the same parameter on multiple objects efficiently in Blender? -


starting single cube, have changed properties (material, color, reflection attributes), , duplicated object dozen cubes, placing them in scene. after rendering, i'd change color of of them. how do efficently?

i have found multiple ways already:

  1. in object mode, select objects (b, rectangular select), join meshes ctrl-j, change color, tab edit mode, p seperate objects again. quite possible since meshes of objects not touch. basics docs
  2. someone wrote python script similar stuff, here

number 1 error prone , tedious regular use. number 2 more specialized , worse. selecting multiple objects , changing value not work because property selections apply active object 1 of selected.

as common use case i'm missing easy way. it?

while did not find preferred simple button or gui solution, turned out hacking own python code in blender easier 1 might think.

the cubes working more domino stones. subsequently objects looking dominoes have name starting "domino". easy alter objects in scene based on 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 code opened new window (drag little upper right triangle icon on existing blender window), changed window type "python console" (lower left window type select icon), , paste above code it.

the code can edited in external text editor. alternatively 1 can open text editor window inside blender well. upon saving scene, both python console , internal text editor stored along 3d model makes nice workflow.

finding correct object names - such bpy.data.objects["domino.033"].rigid_body.mass easy, because blender show these when hovering on form entry field mouse pointer. if 1 has identified object, use python's dir() function list of known methods , attributes of object. there may more gui allows modify or use.

this easier thought. explains why 1 can think of complex manipulation there no gui element - it's easier handle in code. i'll use duplicate , position objects along lines, circles, spirals instead of using blender's own array attributes. allow easier later position adjustments.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -