[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22694] branches/blender2.5/blender/source /blender: Hook Modifier Bugfixes:

Joshua Leung aligorith at gmail.com
Sat Aug 22 06:11:18 CEST 2009


Revision: 22694
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22694
Author:   aligorith
Date:     2009-08-22 06:11:17 +0200 (Sat, 22 Aug 2009)

Log Message:
-----------
Hook Modifier Bugfixes:

Fixed some typos made in previous commit. Hook Modifier should now work correctly again (and also for newly added Hook relationships)

Notes:
* To add a hook, you currently need to perform the following steps
1) add modifier from menu (no operator in EditMode)
2) specify the object (and/or bone to use as the hook target)
3a) in EditMode, select the vertices you wish to be affected by the hook, and press 'Assign'
3b) alternatively, fill in the vertex-group field for the Vertex Group which contains the vertices to be affected
4) press 'Reset' (to make sure hook will behave correctly)
5) optionally, also press 'Recenter' if the hook position isn't right...

* BUG ALERT (Brecht/Ton): it is impossible to clear the vertexgroup/bone fields once you have assigned some value. Doing backspace+enter (or any other variation) will always result in the first item in the search menu being used.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/modifier.c
    branches/blender2.5/blender/source/blender/editors/object/object_edit.c
    branches/blender2.5/blender/source/blender/editors/object/object_modifier.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/modifier.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/modifier.c	2009-08-22 03:10:52 UTC (rev 22693)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/modifier.c	2009-08-22 04:11:17 UTC (rev 22694)
@@ -5657,7 +5657,7 @@
 {
 	HookModifierData *hmd = (HookModifierData*) md;
 	bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget);
-	float vec[3], mat[4][4], dmat[4][4], imat[4][4];
+	float vec[3], mat[4][4], dmat[4][4];
 	int i;
 	DerivedMesh *dm = derivedData;
 	
@@ -5670,8 +5670,8 @@
 		/* just object target */
 		Mat4CpyMat4(dmat, hmd->object->obmat);
 	}
-	Mat4Invert(imat, dmat);
-	Mat4MulSerie(mat, imat, dmat, hmd->parentinv,
+	Mat4Invert(ob->imat, ob->obmat);
+	Mat4MulSerie(mat, ob->imat, dmat, hmd->parentinv,
 		     NULL, NULL, NULL, NULL, NULL);
 
 	/* vertex indices? */
@@ -5728,7 +5728,8 @@
 				}
 			}
 		}
-	} else {	/* vertex group hook */
+	} 
+	else if(hmd->name[0]) {	/* vertex group hook */
 		bDeformGroup *curdef;
 		Mesh *me = ob->data;
 		int index = 0;

Modified: branches/blender2.5/blender/source/blender/editors/object/object_edit.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/object/object_edit.c	2009-08-22 03:10:52 UTC (rev 22693)
+++ branches/blender2.5/blender/source/blender/editors/object/object_edit.c	2009-08-22 04:11:17 UTC (rev 22694)
@@ -1384,9 +1384,11 @@
 		modifier_free(md);
 	}
 	else if(mode==5) { /* select */
+		// FIXME: this is now OBJECT_OT_hook_select
 		object_hook_select(obedit, hmd);
 	}
 	else if(mode==6) { /* clear offset */
+		// FIXME: this is now OBJECT_OT_hook_reset operator
 		where_is_object(scene, ob);	/* ob is hook->parent */
 
 		Mat4Invert(ob->imat, ob->obmat);
@@ -1398,7 +1400,26 @@
 	DAG_scene_sort(scene);
 }
 
+void add_hook_menu(Scene *scene, View3D *v3d)
+{
+	Object *obedit= scene->obedit;  // XXX get from context
+	int mode;
+	
+	if(obedit==NULL) return;
+	
+	if(modifiers_findByType(obedit, eModifierType_Hook))
+		mode= pupmenu("Hooks %t|Add, To New Empty %x1|Add, To Selected Object %x2|Remove... %x3|Reassign... %x4|Select... %x5|Clear Offset...%x6");
+	else
+		mode= pupmenu("Hooks %t|Add, New Empty %x1|Add, To Selected Object %x2");
 
+	if(mode<1) return;
+		
+	/* do operations */
+	add_hook(scene, v3d, mode);
+}
+
+
+
 /* use this when the loc/size/rot of the parent has changed but the children should stay in the same place
  * apply-size-rot or object center for eg */
 static void ignore_parent_tx(Scene *scene, Object *ob ) 
@@ -1416,25 +1437,6 @@
 	}
 }
 
-
-void add_hook_menu(Scene *scene, View3D *v3d)
-{
-	Object *obedit= scene->obedit;  // XXX get from context
-	int mode;
-	
-	if(obedit==NULL) return;
-	
-	if(modifiers_findByType(obedit, eModifierType_Hook))
-		mode= pupmenu("Hooks %t|Add, To New Empty %x1|Add, To Selected Object %x2|Remove... %x3|Reassign... %x4|Select... %x5|Clear Offset...%x6");
-	else
-		mode= pupmenu("Hooks %t|Add, New Empty %x1|Add, To Selected Object %x2");
-
-	if(mode<1) return;
-		
-	/* do operations */
-	add_hook(scene, v3d, mode);
-}
-
 /* ******************** clear parent operator ******************* */
 
 static EnumPropertyItem prop_clear_parent_types[] = {

Modified: branches/blender2.5/blender/source/blender/editors/object/object_modifier.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/object/object_modifier.c	2009-08-22 03:10:52 UTC (rev 22693)
+++ branches/blender2.5/blender/source/blender/editors/object/object_modifier.c	2009-08-22 04:11:17 UTC (rev 22694)
@@ -865,7 +865,7 @@
 			Mat4MulMat4(mat, pchan->pose_mat, hmd->object->obmat);
 			
 			Mat4Invert(imat, mat);
-			Mat4MulSerie(hmd->parentinv, imat, mat, NULL, NULL, NULL, NULL, NULL, NULL);
+			Mat4MulSerie(hmd->parentinv, imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
 		}
 		else {
 			Mat4Invert(hmd->object->imat, hmd->object->obmat);





More information about the Bf-blender-cvs mailing list