0
$\begingroup$

I have few imported objects from outside blend file. I can add a property to every object (imported or not). But after reloading a file, only property from local objects are saved. How can I save linked file, with properties added from the main file?

Before save file:

import bpy
bpy.types.Object.myproperty = bpy.props.StringProperty(default='Empty')

for i,j in enumerate(bpy.data.objects):
    j.myproperty = str(i)

for i in bpy.data.objects:   
    library = i.library.filepath if i.library else None 
    print(i.name, library, i.myproperty)

Result:

Camera None 0
Cube None 1
Lamp None 2
zapBook None 3
zapBook //assets/books/books.blend 4
pages //assets/books/books.blend 5

After saving and loading file:

import bpy
for i in bpy.data.objects:   
    library = i.library.filepath if i.library else None 
    print(i.name, library, i.myproperty)

Result:

Camera None 0
Cube None 1
Lamp None 2
zapBook None 3
zapBook //assets/books/books.blend Empty
pages //assets/books/books.blend Empty
$\endgroup$
  • $\begingroup$ Is that impossible? $\endgroup$ – Piotr Kowalczyk Apr 2 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.