1

How to automatically add object to Matte objects? Right now I have to use Pick output of Cryptomatte and then use eyedropper to add all the objects I need.

Ideally, I would like to have a mapping: object -> color

enter image description here

cxnt
  • 397
  • 1
  • 5
  • 27

1 Answers1

-3

I think the best way to do this is to open up a text editor window in blender by putting your mouse on the corner of the 3d view and dragging to open it. This will open up another window and you can change the window type to text editor. Click new and you will have opened up a file. Next open up a python info window using the same procedure. You can now see what all your commands are in python. You can add objects like this by typing this into the text editor:

for i in range(10):
    *stuff*

replace stuff with the commands that you see printed in the info tab that you used to create your shape. For example, once you make a cube you see a command in the info tab called bpy.ops.mesh.primitive_cube_add(size=2, enter_editmode=False, location=(0, 0, 0)). You could then copy that command into your code to create your shapes. If you want to learn about python scripting I would recommend reading blender's python documentation.

Fateh A.
  • 155
  • 7
  • 1
    Not really a useful answer. Info editor rarely shows code which can be used as is and in most cases (with some exceptions) bpy.ops should not be used in scripts. If you do not know why in most cases using bpy.ops is not a good idea, I suggest you to follow your own advice and read the documentation. It looks like you have no idea how to add object in cryptomatte node and decided to talk about adding an object instead. But even within the scope of what you are talking about (which have nothing to do with the OP's question) there is no need create editor windows, just switch to Scripting tab. – Lissanro Rayen Oct 06 '20 at 04:34