ID property access from python for pose channels, bones and any ID objects.

The advantage with this is that global property definitions are not needed to add a property to an object.

to avoid confusion these are accessed like a dictionary (closely matching how the BGE accesses properties)

 ob["mySetting"] = 1.0

 bone["foo"] = {"one":1, "two":2.1, "three":"Three"}

 if "foo" in bone: print("prop found...")

At the moment these can also be accessed as attributes, will be changed shortly. eg.
 bone.foo == bone["foo"]
This commit is contained in:
2009-11-16 19:03:40 +00:00
parent 66dfaabb9d
commit 578950c977
4 changed files with 149 additions and 44 deletions

View File

@@ -177,6 +177,12 @@ static void bpy_init_modules( void )
{
PyObject *mod;
/* stand alone utility modules not related to blender directly */
Geometry_Init();
Mathutils_Init();
BGL_Init();
IDProp_Init_Types();
/* Needs to be first since this dir is needed for future modules */
char *modpath= BLI_gethome_folder("scripts/modules", BLI_GETHOME_ALL);
if(modpath) {
@@ -214,11 +220,6 @@ static void bpy_init_modules( void )
PyModule_AddObject(mod, "context", (PyObject *)bpy_context_module);
}
/* stand alone utility modules not related to blender directly */
Geometry_Init();
Mathutils_Init();
BGL_Init();
/* add our own modules dir, this is a python package */
bpy_import_test("bpy");
}