using object properties

I was writing a script this weekend and I wanted to store some information with the objects in my scene. My first thought was to use object properties so I opened Blender and the API and tried it out…

The first problem I had was that there is no documentation on how to make a property object. No Blender.Object.NewProperty(), no prop = Blender.Object.Property() etc. So I read back and forth for a while and found that Object.object.addProperty() seemed to create properties. It doesn’t return them though so you need to use obj.getProperty(‘name’) to get the actual object. Also the arguments you give to addProperty are undocumented. I looked at the source and it seems it takes one to three arguments:

obj.addProperty(property_object) -> documented
obj.addProperty(‘name’,‘type’) -> undocumented
obj.addProperty(‘name’,value,‘type’) -> undocumented

These seem to work, but I’ve had problems with some of the things I am trying to do. If anyone knows how to use object properties, or has working examples I would appreciate the help. As it is now I will just use the registry to store my data, the registry fits better for this application anyway.

I know this post is old but THANKS A LOT!!!

Your info was very useful! :smiley:

Un Saludo

I apologize for resurrecting an old thread, but I’m having issues with this as well.

I can’t, for the life of me, figure out object properties. So, if anyone could shed any light on it I’d greatly appreciate it.

Object.addProperty(name_str, data, (optional)type_str)
where type_str = ‘BOOL’, ‘INT’, ‘FLOAT’, ‘TIME’, ‘STRING’
Property = Object.getProperty
[Property, …] = Object.getAllProperties()
Object.removeProperty(Property or name_str)

Property object have the following methods:

You can have different properties appended to the object:
BOOL = boolean true or false (may take 1/0 as input though not sure)
INT = whole number
FLOAT = decimal number
TIME = decimal number
STRING = character string

writing documentation for this is on the TODO list :confused: