This commit adds supports for per-ID properties to blender. See http://mediawiki.blender.org/index.php/BlenderDev/ID_Property for more information on how it all works. ID properties are accesable by python; but note that bindings have only been added to Object and Material thus far. However adding more bindings is easy and I plan on adding several more hopefully within an hour of this inital commit. A generic UI panel is also planned, that will go wherever its needed; for example in the material buttons, editing buttons, etc. I'll likely submit the initial code for that as a patch, though, so matt and ton and others can go over it and make sure it's all good. :) VERY important, if you intend to use ID properties please go to http://mediawiki.blender.org/index.php/BlenderDev/PropertyStandards and start writing the appropriate standards for it.
65 lines
1.6 KiB
Python
65 lines
1.6 KiB
Python
class IDProperty:
|
|
"""
|
|
The IDProperty wrapper type
|
|
===========================
|
|
@ivar name: the name of the property
|
|
@ivar type: the property type (is read-only)
|
|
@ivar data: the property's data.
|
|
"""
|
|
|
|
class IDGroup:
|
|
"""
|
|
The IDGroup wrapper type
|
|
========================
|
|
This type supports both iteration and the []
|
|
operator to get child ID properties.
|
|
|
|
You can also add new properties using the [] operator.
|
|
For example:
|
|
|
|
group['a float!'] = 0.0
|
|
group['an int!'] = 0
|
|
group['a string!'] = "hi!"
|
|
group['an array!'] = [0, 0, 1.0, 0] #note that any floats in the list
|
|
#makes the whole list a float array.
|
|
group['a subgroup!] = {"float": 0.0, "an int": 1.0, "an array": [1, 2], \
|
|
"another subgroup": {"a": 0.0, "str": "bleh"}}
|
|
|
|
you also do del group['item']
|
|
"""
|
|
|
|
def newProperty(type, name, array_type="Float", val=""):
|
|
"""
|
|
This function creates a new child ID property in the group.
|
|
@type type: an int or a string
|
|
@param type: The ID property type. Can be:
|
|
"String" or Blender.IDPropTypes['String']
|
|
"Int" or Blender.IDPropTypes['Int']
|
|
"Float" or Blender.IDPropTypes['Float']
|
|
"Array" or Blender.IDPropTypes['Array']
|
|
"Group" or Blender.IDPropTypes['Group']
|
|
"""
|
|
|
|
def deleteProperty(prop):
|
|
"""
|
|
deletes a property, takes either a name or a reference
|
|
as an argument.
|
|
"""
|
|
|
|
class IDArray:
|
|
"""
|
|
The IDArray wrapper type
|
|
========================
|
|
|
|
@ivar type: returns the type of the array, can be either IDP_Int or IDP_Float
|
|
"""
|
|
|
|
def __getitem__(self):
|
|
pass
|
|
|
|
def __setitem__(self):
|
|
pass
|
|
|
|
def __len__(self):
|
|
pass
|
|
|