You can create custom property associated to a data type like this:

bpy.types.Objects.MyProperty = bpy.props.IntProperty ()

So now all objects have this interger property and it's entrered value is saved with the blendfile. Same thing with Scene , NodeTree , Nodes ... etc.

But where I can save a value available for the entire blendfile? Not associated to something can be added or removed from the blendfile by the user. A kind of top node in the datablock. I find a place but not really sure it's a good idea:

bpy.types.WindowManager.MyProperty = bpy.props.IntProperty ()

I can retrieve it to:

bpy.data.windowmanager ['WinMan'].MyProperty

Thanks a lot !

  • $\begingroup$ Think you'll find WindowManager properties aren't saved with the blend file. $\endgroup$ – batFINGER Feb 8 '17 at 4:32

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.