[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24606] trunk/blender: - in pose mode, pose bone properties are edited rather then armature bone

Campbell Barton ideasman42 at gmail.com
Tue Nov 17 13:54:29 CET 2009


Revision: 24606
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24606
Author:   campbellbarton
Date:     2009-11-17 13:54:29 +0100 (Tue, 17 Nov 2009)

Log Message:
-----------
- in pose mode, pose bone properties are edited rather then armature bone
- new id property array method convert_to_pyobject()
- editing an array in the UI broke
- fixed for own error when updating ID prop api

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/rna_prop_ui.py
    trunk/blender/release/scripts/ui/properties_data_bone.py
    trunk/blender/source/blender/python/generic/IDProp.c

Modified: trunk/blender/release/scripts/modules/rna_prop_ui.py
===================================================================
--- trunk/blender/release/scripts/modules/rna_prop_ui.py	2009-11-17 12:21:41 UTC (rev 24605)
+++ trunk/blender/release/scripts/modules/rna_prop_ui.py	2009-11-17 12:54:29 UTC (rev 24606)
@@ -70,6 +70,8 @@
     for key, val in items:
         row = layout.row()
         convert_to_pyobject = getattr(val, "convert_to_pyobject", None)
+        
+        val_orig = val
         if convert_to_pyobject:
             val_draw = val = val.convert_to_pyobject()
             val_draw = str(val_draw)
@@ -96,7 +98,9 @@
             split = box.split(percentage=0.75)
             row = split.row()
             row.itemL(text=key)
-            if convert_to_pyobject:
+            
+            # explicit exception for arrays
+            if convert_to_pyobject and not hasattr(val_orig, "len"):
                 row.itemL(text=val_draw)
             else:
                 row.itemR(rna_item, key, text="")

Modified: trunk/blender/release/scripts/ui/properties_data_bone.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_bone.py	2009-11-17 12:21:41 UTC (rev 24605)
+++ trunk/blender/release/scripts/ui/properties_data_bone.py	2009-11-17 12:54:29 UTC (rev 24606)
@@ -281,10 +281,13 @@
     def draw(self, context):
         import rna_prop_ui
         # reload(rna_prop_ui)
+        obj = context.object
+        if obj and obj.mode == 'POSE':
+            item = "active_pchan"
+        else:
+            item = "active_bone"
         
-        rna_prop_ui.draw(self.layout, context, "active_bone")
-        
-        
+        rna_prop_ui.draw(self.layout, context, item)
 
 bpy.types.register(BONE_PT_context_bone)
 bpy.types.register(BONE_PT_transform)

Modified: trunk/blender/source/blender/python/generic/IDProp.c
===================================================================
--- trunk/blender/source/blender/python/generic/IDProp.c	2009-11-17 12:21:41 UTC (rev 24605)
+++ trunk/blender/source/blender/python/generic/IDProp.c	2009-11-17 12:54:29 UTC (rev 24606)
@@ -346,7 +346,7 @@
 
 static int BPy_IDGroup_Map_SetItem(BPy_IDProperty *self, PyObject *key, PyObject *val)
 {
-	BPy_Wrap_SetMapItem(self->prop, key, val);
+	return BPy_Wrap_SetMapItem(self->prop, key, val);
 }
 
 static PyObject *BPy_IDGroup_SpawnIterator(BPy_IDProperty *self)
@@ -478,7 +478,7 @@
 }
 
 /* utility function */
-static BPy_IDGroup_CorrectListLen(IDProperty *prop, PyObject *seq, int len)
+static void BPy_IDGroup_CorrectListLen(IDProperty *prop, PyObject *seq, int len)
 {
 	int i, j;
 
@@ -753,6 +753,17 @@
 	{NULL, NULL, NULL, NULL, NULL},
 };
 
+static PyObject *BPy_IDArray_ConvertToPy(BPy_IDArray *self)
+{
+	return BPy_IDGroup_MapDataToPy(self->prop);
+}
+
+static PyMethodDef BPy_IDArray_methods[] = {
+	{"convert_to_pyobject", (PyCFunction)BPy_IDArray_ConvertToPy, METH_NOARGS,
+		"return a purely python version of the group."},
+	{0, NULL, 0, NULL}
+};
+
 static int BPy_IDArray_Len(BPy_IDArray *self)
 {
 	return self->prop->len;
@@ -893,7 +904,7 @@
 	NULL,                       /* iternextfunc tp_iternext; */
 
   /*** Attribute descriptor and subclassing stuff ***/
-	NULL,                       /* struct PyMethodDef *tp_methods; */
+	BPy_IDArray_methods,		/* struct PyMethodDef *tp_methods; */
 	NULL,                       /* struct PyMemberDef *tp_members; */
 	BPy_IDArray_getseters,       /* struct PyGetSetDef *tp_getset; */
 	NULL,                       /* struct _typeobject *tp_base; */





More information about the Bf-blender-cvs mailing list