Created
September 5, 2019 19:57
-
-
Save alexgeek/e326645409a3e59da81b78ddaa645837 to your computer and use it in GitHub Desktop.
Link model collection in another file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| import os | |
| rig_file = bpy.data.filepath | |
| model_file = rig_file.replace('.Rig.', '.Model.') | |
| if not os.path.exists(model_file): | |
| raise Exception("Model file does not exist.") | |
| if bpy.data.collections['Model'] is not None: | |
| raise Exception("Model already linked.") | |
| print("Linking model from '{}'.".format(model_file)) | |
| bpy.ops.wm.link( | |
| directory=model_file + "/Collection/", | |
| filename='Model', | |
| link=True, | |
| instance_collections=True, | |
| autoselect=True) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment