[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17337] branches/etch-a-ton/source/blender : Sketch retargetting.
Martin Poirier
theeth at yahoo.com
Wed Nov 5 21:15:32 CET 2008
Revision: 17337
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17337
Author: theeth
Date: 2008-11-05 21:15:32 +0100 (Wed, 05 Nov 2008)
Log Message:
-----------
Sketch retargetting. Templating from other armature objects.
Moving stuff home, saving doesn't work ok yet, will finish this later today, demo video when done.
Also a couple of bug fixes for crashing and some text reformulation and the like.
Modified Paths:
--------------
branches/etch-a-ton/source/blender/blenlib/intern/graph.c
branches/etch-a-ton/source/blender/blenloader/intern/readfile.c
branches/etch-a-ton/source/blender/include/BIF_editarmature.h
branches/etch-a-ton/source/blender/makesdna/DNA_scene_types.h
branches/etch-a-ton/source/blender/src/drawview.c
branches/etch-a-ton/source/blender/src/editarmature.c
branches/etch-a-ton/source/blender/src/editarmature_retarget.c
branches/etch-a-ton/source/blender/src/editarmature_sketch.c
Modified: branches/etch-a-ton/source/blender/blenlib/intern/graph.c
===================================================================
--- branches/etch-a-ton/source/blender/blenlib/intern/graph.c 2008-11-05 17:38:31 UTC (rev 17336)
+++ branches/etch-a-ton/source/blender/blenlib/intern/graph.c 2008-11-05 20:15:32 UTC (rev 17337)
@@ -1033,6 +1033,11 @@
BNode *node;
BArc *arc;
+ if (root_node == NULL)
+ {
+ return;
+ }
+
if (BLI_isGraphCyclic(graph))
{
return;
Modified: branches/etch-a-ton/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/etch-a-ton/source/blender/blenloader/intern/readfile.c 2008-11-05 17:38:31 UTC (rev 17336)
+++ branches/etch-a-ton/source/blender/blenloader/intern/readfile.c 2008-11-05 20:15:32 UTC (rev 17337)
@@ -3549,6 +3549,8 @@
sce->radio= newdataadr(fd, sce->radio);
sce->toolsettings= newdataadr(fd, sce->toolsettings);
+
+ sce->toolsettings->skgen_template = newdataadr(fd, sce->toolsettings->skgen_template);
sce->sculptdata.session= NULL;
/* SculptData textures */
Modified: branches/etch-a-ton/source/blender/include/BIF_editarmature.h
===================================================================
--- branches/etch-a-ton/source/blender/include/BIF_editarmature.h 2008-11-05 17:38:31 UTC (rev 17336)
+++ branches/etch-a-ton/source/blender/include/BIF_editarmature.h 2008-11-05 20:15:32 UTC (rev 17337)
@@ -73,8 +73,16 @@
/* duplicate method */
void preEditBoneDuplicate(struct ListBase *editbones);
EditBone *duplicateEditBone(EditBone *curBone, struct ListBase *editbones, struct Object *ob);
-void updateDuplicateSubtarget(EditBone *dupBone, struct Object *ob);
+void updateDuplicateSubtarget(EditBone *dupBone, struct ListBase *editbones, struct Object *ob);
+/* duplicate method (cross objects */
+
+/* editbones is the target list */
+EditBone *duplicateEditBoneObjects(EditBone *curBone, struct ListBase *editbones, struct Object *src_ob, struct Object *dst_ob);
+
+/* editbones is the source list */
+void updateDuplicateSubtargetObjects(EditBone *dupBone, struct ListBase *editbones, struct Object *src_ob, struct Object *dst_ob);
+
/* -- */
float rollBoneToVector(EditBone *bone, float new_up_axis[3]);
Modified: branches/etch-a-ton/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/etch-a-ton/source/blender/makesdna/DNA_scene_types.h 2008-11-05 17:38:31 UTC (rev 17336)
+++ branches/etch-a-ton/source/blender/makesdna/DNA_scene_types.h 2008-11-05 20:15:32 UTC (rev 17337)
@@ -443,6 +443,7 @@
char skgen_multi_level;
/* Skeleton Sketching */
+ struct Object *skgen_template;
char bone_sketching;
char bone_sketching_convert;
char skgen_subdivision_number;
Modified: branches/etch-a-ton/source/blender/src/drawview.c
===================================================================
--- branches/etch-a-ton/source/blender/src/drawview.c 2008-11-05 17:38:31 UTC (rev 17336)
+++ branches/etch-a-ton/source/blender/src/drawview.c 2008-11-05 20:15:32 UTC (rev 17337)
@@ -2338,12 +2338,20 @@
yco -= 20;
uiBlockEndAlign(block);
+
+ yco -= 10;
+ uiBlockBeginAlign(block);
+ uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_DIFF, "OB:", 10, yco, 150, 19, &G.scene->toolsettings->skgen_template, "Template Object");
+ yco -= 20;
+
uiDefButF(block, NUM, B_DIFF, "Ang:", 10, yco, 50,19, &G.scene->toolsettings->skgen_retarget_angle_weight, 0, 10, 1, 0, "Angle Weight");
uiDefButF(block, NUM, B_DIFF, "Len:", 60, yco, 50,19, &G.scene->toolsettings->skgen_retarget_length_weight, 0, 10, 1, 0, "Length Weight");
uiDefButF(block, NUM, B_DIFF, "Dist:", 110,yco, 50,19, &G.scene->toolsettings->skgen_retarget_distance_weight, 0, 10, 1, 0, "Distance Weight");
yco -= 20;
+ uiBlockEndAlign(block);
+
if(yco < 0) uiNewPanelHeight(block, height-yco);
}
}
Modified: branches/etch-a-ton/source/blender/src/editarmature.c
===================================================================
--- branches/etch-a-ton/source/blender/src/editarmature.c 2008-11-05 17:38:31 UTC (rev 17336)
+++ branches/etch-a-ton/source/blender/src/editarmature.c 2008-11-05 20:15:32 UTC (rev 17337)
@@ -2197,13 +2197,12 @@
return ebo;
}
-
-static EditBone *get_named_editbone(char *name)
+static EditBone *get_named_editbone_from_list(char *name, ListBase *editbones)
{
EditBone *eBone;
if (name) {
- for (eBone=G.edbo.first; eBone; eBone=eBone->next) {
+ for (eBone=editbones->first; eBone; eBone=eBone->next) {
if (!strcmp(name, eBone->name))
return eBone;
}
@@ -2212,6 +2211,11 @@
return NULL;
}
+static EditBone *get_named_editbone(char *name)
+{
+ return get_named_editbone_from_list(name, &G.edbo);
+}
+
/* Call this before doing any duplications
* */
void preEditBoneDuplicate(ListBase *editbones)
@@ -2225,7 +2229,11 @@
}
}
-void updateDuplicateSubtarget(EditBone *dupBone, Object *ob)
+/*
+ * Note: When duplicating cross objects, editbones here is the list of bones
+ * from the SOURCE object but ob is the DESTINATION object
+ * */
+void updateDuplicateSubtargetObjects(EditBone *dupBone, ListBase *editbones, Object *src_ob, Object *dst_ob)
{
/* If an edit bone has been duplicated, lets
* update it's constraints if the subtarget
@@ -2236,7 +2244,7 @@
bConstraint *curcon;
ListBase *conlist;
- if ( (chan = verify_pose_channel(ob->pose, dupBone->name)) ) {
+ if ( (chan = verify_pose_channel(dst_ob->pose, dupBone->name)) ) {
if ( (conlist = &chan->constraints) ) {
for (curcon = conlist->first; curcon; curcon=curcon->next) {
/* does this constraint have a subtarget in
@@ -2250,8 +2258,9 @@
cti->get_constraint_targets(curcon, &targets);
for (ct= targets.first; ct; ct= ct->next) {
- if ((ct->tar == G.obedit) && (ct->subtarget[0])) {
- oldtarget = get_named_editbone(ct->subtarget);
+ if ((ct->tar == src_ob) && (ct->subtarget[0])) {
+ ct->tar = dst_ob; /* update target */
+ oldtarget = get_named_editbone_from_list(ct->subtarget, editbones);
if (oldtarget) {
/* was the subtarget bone duplicated too? If
* so, update the constraint to point at the
@@ -2273,8 +2282,14 @@
}
}
-EditBone *duplicateEditBone(EditBone *curBone, ListBase *editbones, Object *ob)
+void updateDuplicateSubtarget(EditBone *dupBone, ListBase *editbones, Object *ob)
{
+ updateDuplicateSubtargetObjects(dupBone, editbones, ob, ob);
+}
+
+
+EditBone *duplicateEditBoneObjects(EditBone *curBone, ListBase *editbones, Object *src_ob, Object *dst_ob)
+{
EditBone *eBone = MEM_callocN(sizeof(EditBone), "addup_editbone");
/* Copy data from old bone to new bone */
@@ -2289,11 +2304,11 @@
/* Lets duplicate the list of constraints that the
* current bone has.
*/
- if (ob->pose) {
+ if (src_ob->pose) {
bPoseChannel *chanold, *channew;
ListBase *listold, *listnew;
- chanold = verify_pose_channel(ob->pose, curBone->name);
+ chanold = verify_pose_channel(src_ob->pose, curBone->name);
if (chanold) {
listold = &chanold->constraints;
if (listold) {
@@ -2301,7 +2316,7 @@
* yet as the new bones created here are still 'EditBones' not 'Bones'.
*/
channew =
- verify_pose_channel(ob->pose, eBone->name);
+ verify_pose_channel(dst_ob->pose, eBone->name);
if (channew) {
/* copy transform locks */
channew->protectflag = chanold->protectflag;
@@ -2327,14 +2342,14 @@
}
}
- /* --------------------WARNING--------------------
- *
- * need to call static void updateDuplicateSubtarget(EditBone *dupBone) at some point
- * */
-
return eBone;
}
+EditBone *duplicateEditBone(EditBone *curBone, ListBase *editbones, Object *ob)
+{
+ return duplicateEditBoneObjects(curBone, editbones, ob, ob);
+}
+
void adduplicate_armature(void)
{
bArmature *arm= G.obedit->data;
@@ -2448,7 +2463,7 @@
/* Lets try to fix any constraint subtargets that might
have been duplicated */
- updateDuplicateSubtarget(eBone, OBACT);
+ updateDuplicateSubtarget(eBone, &G.edbo, OBACT);
}
}
}
Modified: branches/etch-a-ton/source/blender/src/editarmature_retarget.c
===================================================================
--- branches/etch-a-ton/source/blender/src/editarmature_retarget.c 2008-11-05 17:38:31 UTC (rev 17336)
+++ branches/etch-a-ton/source/blender/src/editarmature_retarget.c 2008-11-05 20:15:32 UTC (rev 17337)
@@ -398,7 +398,7 @@
}
/************************************** CLONING TEMPLATES **********************************************/
-static RigControl *cloneControl(RigGraph *rg, RigControl *src_ctrl, GHash *ptr_hash)
+static RigControl *cloneControl(RigGraph *rg, RigGraph *src_rg, RigControl *src_ctrl, GHash *ptr_hash)
{
RigControl *ctrl;
@@ -411,7 +411,7 @@
ctrl->flag = src_ctrl->flag;
- ctrl->bone = duplicateEditBone(src_ctrl->bone, rg->editbones, rg->ob);
+ ctrl->bone = duplicateEditBoneObjects(src_ctrl->bone, rg->editbones, src_rg->ob, rg->ob);
ctrl->bone->flag &= ~(BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL|BONE_ACTIVE);
BLI_ghash_insert(ptr_hash, src_ctrl->bone, ctrl->bone);
@@ -420,7 +420,7 @@
return ctrl;
}
-static RigArc *cloneArc(RigGraph *rg, RigArc *src_arc, GHash *ptr_hash)
+static RigArc *cloneArc(RigGraph *rg, RigGraph *src_rg, RigArc *src_arc, GHash *ptr_hash)
{
RigEdge *src_edge;
RigArc *arc;
@@ -452,7 +452,7 @@
if (src_edge->bone != NULL)
{
- edge->bone = duplicateEditBone(src_edge->bone, rg->editbones, rg->ob);
+ edge->bone = duplicateEditBoneObjects(src_edge->bone, rg->editbones, src_rg->ob, rg->ob);
edge->bone->flag &= ~(BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL|BONE_ACTIVE);
BLI_ghash_insert(ptr_hash, src_edge->bone, edge->bone);
}
@@ -463,7 +463,7 @@
return arc;
}
-static RigGraph *cloneRigGraph(RigGraph *src)
+static RigGraph *cloneRigGraph(RigGraph *src, ListBase *editbones, Object *ob)
{
GHash *ptr_hash;
RigNode *node;
@@ -475,10 +475,11 @@
rg = newRigGraph();
- rg->ob = src->ob;
- rg->editbones = src->editbones;
+ rg->ob = ob;
+ rg->editbones = editbones;
preEditBoneDuplicate(rg->editbones); /* prime bones for duplication */
+ preEditBoneDuplicate(src->editbones); /* prime bones for duplication */
/* Clone nodes */
for (node = src->nodes.first; node; node = node->next)
@@ -492,13 +493,13 @@
/* Clone arcs */
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list