문제

If you look at the following line of python code:

bpy.ops.object.particle_system_add({"object":bpy.data.objects[2]})

you see that in the parameters there is something enclosed in braces. Can anyone tell me what the braces are for (generically anyway)? I haven't really seen this type of syntax in python and I can't find any documentation on it.

Any help is greatly appreciated. Thank you.

도움이 되었습니까?

해결책

From the docs:

Dictionaries can be created by placing a comma-separated list of key: value pairs within braces, for example: {'jack': 4098, 'sjoerd': 4127} or {4098: 'jack', 4127: 'sjoerd'}, or by the dict constructor.

다른 팁

The braces create a dictionary. particle_system_add seems to be accepting a dictionary as its argument.

It's a dictionary.

It's just a dictionary with a single key/value pair of "object" as the key and whatever bpy.data.objects[2] evaluates to as the value.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top