当我们使用link,从别的blend文件中链接一个collection过来的时候
其实是创建了一个empty物体,并且把它的instancing设置为collection
image.png

代码

image.png
image.png

使用Jsonfile 来储存参数
image.png

  1. import json
  2. json_fname = bpy.path.abspath('//assets.json')
  3. with open(json_fname) as infile:
  4. link_info = json.load(infile)
  5. json_colls = link_info['collections']
  6. location_y = 0
  7. step_y = 2.0
  8. for coll_name , coll_info in json_colls.items():
  9. link_to = ensure_collection_exist(content.scene,coll_name)
  10. for file_and_prifix in coll_info['link']:
  11. filepath = file_and_prefix['file']
  12. prefix = file_and_prefix['prefix']
  13. link_to_scene(filepath,prefix,link_to,location_y)
  14. location_y += step_y;