[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18686] branches/blender2.5/blender/source /blender/editors/object/object_edit.c: 2.5

Michael Fox mfoxdogg at gmail.com
Tue Jan 27 00:58:57 CET 2009


Revision: 18686
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18686
Author:   mfoxdogg
Date:     2009-01-27 00:58:56 +0100 (Tue, 27 Jan 2009)

Log Message:
-----------
  2.5
******
small commit just porting the makeparent menu to use the new menu contsruction system

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/object/object_edit.c

Modified: branches/blender2.5/blender/source/blender/editors/object/object_edit.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/object/object_edit.c	2009-01-26 23:18:27 UTC (rev 18685)
+++ branches/blender2.5/blender/source/blender/editors/object/object_edit.c	2009-01-26 23:58:56 UTC (rev 18686)
@@ -2417,7 +2417,7 @@
 	DAG_scene_sort(CTX_data_scene(C));
 	ED_anim_dag_flush_update(C);	
 	
-	BIF_undo_push("make Parent");
+	ED_undo_push(C,"make Parent");
 	
 	return OPERATOR_FINISHED;
 }
@@ -2425,31 +2425,26 @@
 static int make_parent_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	Object *ob= CTX_data_active_object(C);
-	char *str, string[256];
-	char formatstr[] = "|%s %%x%d";
+	uiMenuItem *head= uiMenuBegin("Make Parent To");
 	
-	str= string + sprintf(string, "Make Parent To %%t");
+	uiMenuContext(head, WM_OP_EXEC_DEFAULT);
+	uiMenuItemEnumO(head, "OBJECT_OT_make_parent", "type", PAR_OBJECT);
 	
 	/* ob becomes parent, make the associated menus */
 	if(ob->type==OB_ARMATURE) {
-		str += sprintf(str, formatstr, "Object", PAR_OBJECT);
-		str += sprintf(str, formatstr, "Armature Deform", PAR_ARMATURE);
-		str += sprintf(str, formatstr, "Bone", PAR_BONE);
+		uiMenuItemEnumO(head, "OBJECT_OT_make_parent", "type", PAR_ARMATURE);
+		uiMenuItemEnumO(head, "OBJECT_OT_make_parent", "type", PAR_BONE);
 	}
 	else if(ob->type==OB_CURVE) {
-		str += sprintf(str, formatstr, "Object", PAR_OBJECT);
-		str += sprintf(str, formatstr, "Curve Deform", PAR_CURVE);
-		str += sprintf(str, formatstr, "Follow Path", PAR_FOLLOW);
-		str += sprintf(str, formatstr, "Path Constraint", PAR_PATH_CONST);
+		uiMenuItemEnumO(head, "OBJECT_OT_make_parent", "type", PAR_CURVE);
+		uiMenuItemEnumO(head, "OBJECT_OT_make_parent", "type", PAR_FOLLOW);
+		uiMenuItemEnumO(head, "OBJECT_OT_make_parent", "type", PAR_PATH_CONST);
 	}
 	else if(ob->type == OB_LATTICE) {
-		str += sprintf(str, formatstr, "Object", PAR_OBJECT);
-		str += sprintf(str, formatstr, "Lattice Deform", PAR_LATTICE);
+		uiMenuItemEnumO(head, "OBJECT_OT_make_parent", "type", PAR_LATTICE);
 	}
-	else
-		str += sprintf(str, formatstr, "Object", PAR_OBJECT);
 	
-	uiPupmenuOperator(C, 0, op, "type", string);
+	uiMenuEnd(C, head);
 	
 	return OPERATOR_RUNNING_MODAL;
 }





More information about the Bf-blender-cvs mailing list