[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13494] trunk/blender/source/blender: == Bone Groups - Outliner Support ==
Joshua Leung
aligorith at gmail.com
Thu Jan 31 10:59:06 CET 2008
Revision: 13494
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13494
Author: aligorith
Date: 2008-01-31 10:59:05 +0100 (Thu, 31 Jan 2008)
Log Message:
-----------
== Bone Groups - Outliner Support ==
Bone groups are now drawn in the Outliner. The active group can be set from there, and groups can be renamed.
(Hah... that was easy)
Modified Paths:
--------------
trunk/blender/source/blender/include/BIF_outliner.h
trunk/blender/source/blender/src/outliner.c
Modified: trunk/blender/source/blender/include/BIF_outliner.h
===================================================================
--- trunk/blender/source/blender/include/BIF_outliner.h 2008-01-31 09:36:59 UTC (rev 13493)
+++ trunk/blender/source/blender/include/BIF_outliner.h 2008-01-31 09:59:05 UTC (rev 13494)
@@ -78,6 +78,8 @@
#define TSE_LINKED_MAT 22
/* NOTE, is used for light group */
#define TSE_LINKED_LAMP 23
+#define TSE_POSEGRP_BASE 24
+#define TSE_POSEGRP 25
/* outliner search flags */
#define OL_FIND 0
Modified: trunk/blender/source/blender/src/outliner.c
===================================================================
--- trunk/blender/source/blender/src/outliner.c 2008-01-31 09:36:59 UTC (rev 13493)
+++ trunk/blender/source/blender/src/outliner.c 2008-01-31 09:59:05 UTC (rev 13494)
@@ -642,6 +642,21 @@
if(pchan->next) pchan->next->prev= pchan;
}
}
+
+ /* Pose Groups */
+ if(ob->pose->agroups.first) {
+ bActionGroup *agrp;
+ TreeElement *ten;
+ TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_POSEGRP_BASE, 0);
+ int a= 0;
+
+ tenla->name= "Bone Groups";
+ for (agrp=ob->pose->agroups.first; agrp; agrp=agrp->next, a++) {
+ ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSEGRP, a);
+ ten->name= agrp->name;
+ ten->directdata= agrp;
+ }
+ }
}
outliner_add_element(soops, &te->subtree, ob->ipo, te, 0, 0);
@@ -961,7 +976,7 @@
outliner_free_tree(&soops->tree);
outliner_storage_cleanup(soops);
-
+
/* clear ob id.new flags */
for(ob= G.main->object.first; ob; ob= ob->id.next) ob->id.newid= NULL;
@@ -1691,6 +1706,24 @@
return 0;
}
+static int tree_element_active_posegroup(TreeElement *te, TreeStoreElem *tselem, int set)
+{
+ Object *ob= (Object *)tselem->id;
+
+ if(set) {
+ if (ob->pose) {
+ ob->pose->active_group= te->index+1;
+ allqueue(REDRAWBUTSEDIT, 0);
+ }
+ }
+ else {
+ if(ob==OBACT && ob->pose) {
+ if (ob->pose->active_group== te->index+1) return 1;
+ }
+ }
+ return 0;
+}
+
static int tree_element_active_posechannel(TreeElement *te, TreeStoreElem *tselem, int set)
{
Object *ob= (Object *)tselem->id;
@@ -1872,6 +1905,8 @@
return tree_element_active_constraint(te, tselem, set);
case TSE_R_LAYER:
return tree_element_active_renderlayer(te, tselem, set);
+ case TSE_POSEGRP:
+ return tree_element_active_posegroup(te, tselem, set);
}
return 0;
}
@@ -1991,7 +2026,7 @@
if(event==LEFTMOUSE) {
if (G.qual == LR_CTRLKEY) {
- if(ELEM8(tselem->type, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
+ if(ELEM9(tselem->type, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
error("Cannot edit builtin name");
else if(tselem->id->lib) {
error_libdata();
@@ -2977,6 +3012,8 @@
BIF_icon_draw(x, y, ICON_LAMP_DEHLT); break;
case TSE_LINKED_MAT:
BIF_icon_draw(x, y, ICON_MATERIAL_DEHLT); break;
+ case TSE_POSEGRP_BASE:
+ BIF_icon_draw(x, y, ICON_VERTEXSEL); break;
#ifdef WITH_VERSE
case ID_VS:
@@ -3566,6 +3603,15 @@
allqueue(REDRAWVIEW3D, 1);
allqueue(REDRAWBUTSEDIT, 0);
break;
+ case TSE_POSEGRP:
+ {
+ Object *ob= (Object *)tselem->id; // id = object
+ bActionGroup *grp= te->directdata;
+
+ BLI_uniquename(&ob->pose->agroups, grp, "Group", offsetof(bActionGroup, name), 32);
+ allqueue(REDRAWBUTSEDIT, 0);
+ }
+ break;
case TSE_R_LAYER:
allqueue(REDRAWOOPS, 0);
allqueue(REDRAWBUTSSCENE, 0);
More information about the Bf-blender-cvs
mailing list