[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21861] branches/blender2.5/blender: 2.5: Various Fixes

Brecht Van Lommel brecht at blender.org
Fri Jul 24 18:41:12 CEST 2009


Revision: 21861
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21861
Author:   blendix
Date:     2009-07-24 18:41:12 +0200 (Fri, 24 Jul 2009)

Log Message:
-----------
2.5: Various Fixes

* Fix crash loading particle AnimData. This crashed many BBB
  files. If you have a .blend file that crashes when loading
  it in 2.5, please mail me, I'd like to know.

* Image window zoom ratio did not work correct with py 2.x.
* Other minor fixes for image window RNA.

* Buttons window now remembers the tab that was last clicked
  by the user, even if that tab is no longer available due
  to context, and then enable the tab again if the context
  for it is back.
* Cleaned up buttons space DNA a bit, removing unused vars.

* Armature bone rename outside edit mode did not call right
  function yet.
* Armature layers are now editable even if lib linked. This
  is useful for proxies. For this purpose a PROP_LIB_EXCEPTION
  flag was added. Need to think over proxy / RNA a bit though,
  not sure what the requirements are yet.
* Parent to Armature Deform now has options to create vertex
  groups, instead of always creating them.

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/space_image.py
    branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
    branches/blender2.5/blender/source/blender/editors/armature/editarmature.c
    branches/blender2.5/blender/source/blender/editors/include/ED_armature.h
    branches/blender2.5/blender/source/blender/editors/object/object_edit.c
    branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c
    branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_context.c
    branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_header.c
    branches/blender2.5/blender/source/blender/editors/space_buttons/space_buttons.c
    branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_space_types.h
    branches/blender2.5/blender/source/blender/makesrna/RNA_types.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_armature.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_scene.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c

Modified: branches/blender2.5/blender/release/ui/space_image.py
===================================================================
--- branches/blender2.5/blender/release/ui/space_image.py	2009-07-24 15:27:59 UTC (rev 21860)
+++ branches/blender2.5/blender/release/ui/space_image.py	2009-07-24 16:41:12 UTC (rev 21861)
@@ -32,7 +32,7 @@
 
 		for a, b in ratios:
 			text = "Zoom %d:%d" % (a, b)
-			layout.item_floatO("image.view_zoom_ratio", "ratio", a/b, text=text)
+			layout.item_floatO("image.view_zoom_ratio", "ratio", a/float(b), text=text)
 
 		layout.itemS()
 
@@ -225,34 +225,6 @@
 
 		layout.template_ID(sima, "image", new="image.new")
 
-		"""
-		/* image select */
-
-		pinflag= (show_render)? 0: UI_ID_PIN;
-		xco= uiDefIDPoinButs(block, CTX_data_main(C), NULL, (ID*)sima->image, ID_IM, &sima->pin, xco, yco,
-			sima_idpoin_handle, UI_ID_BROWSE|UI_ID_BROWSE_RENDER|UI_ID_RENAME|UI_ID_ADD_NEW|UI_ID_OPEN|UI_ID_DELETE|pinflag);
-		xco += 8;
-		"""
-
-		"""
-		if(ima && !ELEM3(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE, IMA_SRC_VIEWER) && ima->ok) {
-			/* XXX this should not be a static var */
-			static int headerbuttons_packdummy;
-			
-			headerbuttons_packdummy = 0;
-
-			if (ima->packedfile) {
-				headerbuttons_packdummy = 1;
-			}
-			if (ima->packedfile && ibuf && (ibuf->userflags & IB_BITMAPDIRTY))
-				uiDefIconButBitI(block, TOG, 1, 0 /* XXX B_SIMA_REPACK */, ICON_UGLYPACKAGE,	xco,yco,XIC,YIC, &headerbuttons_packdummy, 0, 0, 0, 0, "Re-Pack this image as PNG");
-			else
-				uiDefIconButBitI(block, TOG, 1, 0 /* XXX B_SIMAPACKIMA */, ICON_PACKAGE,	xco,yco,XIC,YIC, &headerbuttons_packdummy, 0, 0, 0, 0, "Pack/Unpack this image");
-				
-			xco+= XIC+8;
-		}
-		"""
-
 		# uv editing
 		if show_uvedit:
 			uvedit = sima.uv_editor
@@ -294,7 +266,8 @@
 			if ima.type == "COMPOSITE" and ima.source in ("MOVIE", "SEQUENCE"):
 				row.itemO("image.play_composite", icon="ICON_PLAY")
 		
-		layout.itemR(sima, "update_automatically", text="")
+		if show_uvedit or sima.image_painting:
+			layout.itemR(sima, "update_automatically", text="")
 
 class IMAGE_PT_game_properties(bpy.types.Panel):
 	__space_type__ = "IMAGE_EDITOR"

Modified: branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c	2009-07-24 15:27:59 UTC (rev 21860)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c	2009-07-24 16:41:12 UTC (rev 21861)
@@ -4345,9 +4345,10 @@
 					}
 					else if(sl->spacetype==SPACE_BUTS) {
 						SpaceButs *sbuts= (SpaceButs *)sl;
-						sbuts->lockpoin= NULL;
 						sbuts->ri= NULL;
 						sbuts->pinid= newlibadr(fd, sc->id.lib, sbuts->pinid);
+						sbuts->mainbo= sbuts->mainb;
+						sbuts->mainbuser= sbuts->mainb;
 						if(main->versionfile<132)
 							butspace_version_132(sbuts);
 					}
@@ -4556,7 +4557,6 @@
 				}
 				else if(sl->spacetype==SPACE_BUTS) {
 					SpaceButs *sbuts= (SpaceButs *)sl;
-					sbuts->lockpoin= NULL;
 					sbuts->pinid = restore_pointer_by_name(newmain, sbuts->pinid, 0);
 					//XXX if (sbuts->ri) sbuts->ri->curtile = 0;
 				}
@@ -6267,7 +6267,6 @@
 	}
 
 	if(main->versionfile <= 191) {
-		bScreen *sc= main->screen.first;
 		Object *ob= main->object.first;
 		Material *ma = main->mat.first;
 
@@ -6283,22 +6282,6 @@
 			/*ob->quat[1]= 1.0f;*/ /* quats arnt used yet */
 			ob= ob->id.next;
 		}
-
-		while(sc) {
-			ScrArea *sa= sc->areabase.first;
-			while(sa) {
-				SpaceLink *sl= sa->spacedata.first;
-				while(sl) {
-					if(sl->spacetype==SPACE_BUTS) {
-						SpaceButs *sbuts= (SpaceButs*) sl;
-						sbuts->scaflag= BUTS_SENS_LINK|BUTS_SENS_ACT|BUTS_CONT_ACT|BUTS_ACT_ACT|BUTS_ACT_LINK;
-					}
-					sl= sl->next;
-				}
-				sa= sa->next;
-			}
-			sc= sc->id.next;
-		}
 	}
 
 	if(main->versionfile <= 193) {
@@ -9764,7 +9747,8 @@
 	expand_doit(fd, mainvar, part->eff_group);
 	expand_doit(fd, mainvar, part->bb_ob);
 	
-	expand_animdata(fd, mainvar, part->adt);
+	if(part->adt)
+		expand_animdata(fd, mainvar, part->adt);
 }
 
 static void expand_group(FileData *fd, Main *mainvar, Group *group)

Modified: branches/blender2.5/blender/source/blender/editors/armature/editarmature.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/armature/editarmature.c	2009-07-24 15:27:59 UTC (rev 21860)
+++ branches/blender2.5/blender/source/blender/editors/armature/editarmature.c	2009-07-24 16:41:12 UTC (rev 21861)
@@ -4614,44 +4614,28 @@
 	MEM_freeN(verts);
 }
 
-void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par)
+void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mode)
 {
 	/* Lets try to create some vertex groups 
 	 * based on the bones of the parent armature.
 	 */
 	bArmature *arm= par->data;
-	short mode;
 
-	/* Prompt the user on whether/how they want the vertex groups
-	 * added to the child mesh */
-    mode= pupmenu("Create Vertex Groups? %t|"
-				  "Don't Create Groups %x1|"
-				  "Name Groups %x2|"
-                  "Create From Envelopes %x3|"
-				  "Create From Bone Heat %x4|");
-	
-	mode= 3; // XXX
-	
-	switch (mode) {
-	case 2:
+	if(mode == ARM_GROUPS_NAME) {
 		/* Traverse the bone list, trying to create empty vertex 
 		 * groups cooresponding to the bone.
 		 */
-		bone_looper(ob, arm->bonebase.first, NULL,
-					add_defgroup_unique_bone);
+		bone_looper(ob, arm->bonebase.first, NULL, add_defgroup_unique_bone);
+
 		if (ob->type == OB_MESH)
 			create_dverts(ob->data);
-		
-		break;
-	
-	case 3:
-	case 4:
+	}
+	else if(mode == ARM_GROUPS_ENVELOPE || mode == ARM_GROUPS_AUTO) {
 		/* Traverse the bone list, trying to create vertex groups 
 		 * that are populated with the vertices for which the
 		 * bone is closest.
 		 */
-		add_verts_to_dgroups(scene, ob, par, (mode == 4), 0);
-		break;
+		add_verts_to_dgroups(scene, ob, par, (mode == ARM_GROUPS_AUTO), 0);
 	}
 } 
 /* ************* Clear Pose *****************************/

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_armature.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_armature.h	2009-07-24 15:27:59 UTC (rev 21860)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_armature.h	2009-07-24 16:41:12 UTC (rev 21861)
@@ -112,9 +112,14 @@
 
 void transform_armature_mirror_update(struct Object *obedit);
 void clear_armature(struct Scene *scene, struct Object *ob, char mode);
-void create_vgroups_from_armature(struct Scene *scene, struct Object *ob, struct Object *par);
 void docenter_armature (struct Scene *scene, struct View3D *v3d, struct Object *ob, int centermode);
 
+#define ARM_GROUPS_NAME		1
+#define ARM_GROUPS_ENVELOPE	2
+#define ARM_GROUPS_AUTO		3
+
+void create_vgroups_from_armature(struct Scene *scene, struct Object *ob, struct Object *par, int mode);
+
 void auto_align_armature(struct Scene *scene, struct View3D *v3d, short mode);
 void unique_editbone_name(struct ListBase *ebones, char *name, EditBone *bone); /* if bone is already in list, pass it as param to ignore it */
 void ED_armature_bone_rename(struct bArmature *arm, char *oldnamep, char *newnamep);

Modified: branches/blender2.5/blender/source/blender/editors/object/object_edit.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/object/object_edit.c	2009-07-24 15:27:59 UTC (rev 21860)
+++ branches/blender2.5/blender/source/blender/editors/object/object_edit.c	2009-07-24 16:41:12 UTC (rev 21861)
@@ -2753,19 +2753,25 @@
 
 /* ******************** make parent operator *********************** */
 
-#define PAR_OBJECT		0
-#define PAR_ARMATURE	1
-#define PAR_BONE		2
-#define PAR_CURVE		3
-#define PAR_FOLLOW		4
-#define PAR_PATH_CONST	5
-#define PAR_LATTICE		6
-#define PAR_VERTEX		7
-#define PAR_TRIA		8
+#define PAR_OBJECT				0
+#define PAR_ARMATURE			1
+#define PAR_ARMATURE_NAME		2
+#define PAR_ARMATURE_ENVELOPE	3
+#define PAR_ARMATURE_AUTO		4
+#define PAR_BONE				5
+#define PAR_CURVE				6
+#define PAR_FOLLOW				7
+#define PAR_PATH_CONST			8
+#define PAR_LATTICE				9
+#define PAR_VERTEX				10
+#define PAR_TRIA				11
 
 static EnumPropertyItem prop_make_parent_types[] = {
 	{PAR_OBJECT, "OBJECT", 0, "Object", ""},
 	{PAR_ARMATURE, "ARMATURE", 0, "Armature Deform", ""},
+	{PAR_ARMATURE_NAME, "ARMATURE_NAME", 0, "   With Empty Groups", ""},
+	{PAR_ARMATURE_AUTO, "ARMATURE_AUTO", 0, "   With Automatic Weights", ""},
+	{PAR_ARMATURE_ENVELOPE, "ARMATURE_ENVELOPE", 0, "   With Envelope Weights", ""},
 	{PAR_BONE, "BONE", 0, "Bone", ""},
 	{PAR_CURVE, "CURVE", 0, "Curve Deform", ""},
 	{PAR_FOLLOW, "FOLLOW", 0, "Follow Path", ""},
@@ -2809,6 +2815,7 @@
 	Object *par= CTX_data_active_object(C);
 	bPoseChannel *pchan= NULL;
 	int partype= RNA_enum_get(op->ptr, "type");
+	int pararm= ELEM4(partype, PAR_ARMATURE, PAR_ARMATURE_NAME, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO);
 	
 	par->recalc |= OB_RECALC_OB;
 	
@@ -2880,24 +2887,20 @@
 					ob->loc[0] = vec[0];
 					ob->loc[1] = vec[1];
 				}
-				else if(partype==PAR_ARMATURE && ob->type==OB_MESH && par->type == OB_ARMATURE) {
+				else if(pararm && ob->type==OB_MESH && par->type == OB_ARMATURE) {
+					if(partype == PAR_ARMATURE_NAME)
+						create_vgroups_from_armature(scene, ob, par, ARM_GROUPS_NAME);
+					else if(partype == PAR_ARMATURE_ENVELOPE)
+						create_vgroups_from_armature(scene, ob, par, ARM_GROUPS_ENVELOPE);
+					else if(partype == PAR_ARMATURE_AUTO)
+						create_vgroups_from_armature(scene, ob, par, ARM_GROUPS_AUTO);
 					
-					if(1) {
-						/* Prompt the user as to whether he wants to
-						* add some vertex groups based on the bones
-						* in the parent armature.
-						*/
-						create_vgroups_from_armature(scene, ob, par);
-						
-						/* get corrected inverse */
-						ob->partype= PAROBJECT;
-						what_does_parent(scene, ob, &workob);
-						
-						ob->partype= PARSKEL;
-					}
-					else
-						what_does_parent(scene, ob, &workob);
+					/* get corrected inverse */
+					ob->partype= PAROBJECT;
+					what_does_parent(scene, ob, &workob);
 					
+					ob->partype= PARSKEL;
+
 					Mat4Invert(ob->parentinv, workob.obmat);
 				}
 				else {
@@ -2908,7 +2911,7 @@
 				
 				ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
 				
-				if( ELEM3(partype, PAR_CURVE, PAR_ARMATURE, PAR_LATTICE) )

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list