[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22677] branches/blender2.5/blender: 2.5: layout.itemO now returns OperatorProperties to be filled in,

Brecht Van Lommel brecht at blender.org
Fri Aug 21 14:57:47 CEST 2009


Revision: 22677
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22677
Author:   blendix
Date:     2009-08-21 14:57:47 +0200 (Fri, 21 Aug 2009)

Log Message:
-----------
2.5: layout.itemO now returns OperatorProperties to be filled in,
when passing properties=True as argument.

Other changes:
* uiItemR, uiItemFullR, uiItemFullO now accept a flag argument rather
  than multiple different "boolean" arguments, but still exposed as
  booleans to python.
* Fix RNA to support setting PROP_RNAPTR for return values.

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/space_view3d.py
    branches/blender2.5/blender/source/blender/editors/animation/fmodifier_ui.c
    branches/blender2.5/blender/source/blender/editors/include/UI_interface.h
    branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_templates.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_utils.c
    branches/blender2.5/blender/source/blender/editors/object/object_edit.c
    branches/blender2.5/blender/source/blender/editors/physics/ed_fluidsim.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_header.c
    branches/blender2.5/blender/source/blender/editors/space_file/file_panels.c
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_header.c
    branches/blender2.5/blender/source/blender/editors/space_nla/nla_buttons.c
    branches/blender2.5/blender/source/blender/editors/space_nla/nla_header.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_toolbar.c
    branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_ui_api.c

Modified: branches/blender2.5/blender/release/ui/space_view3d.py
===================================================================
--- branches/blender2.5/blender/release/ui/space_view3d.py	2009-08-21 12:49:21 UTC (rev 22676)
+++ branches/blender2.5/blender/release/ui/space_view3d.py	2009-08-21 12:57:47 UTC (rev 22677)
@@ -157,8 +157,14 @@
 		
 		layout.itemS()
 		
-		layout.view3d_select_posemenu()
+		props = layout.itemO("pose.select_hierarchy", properties=True, text="Extend Parent")
+		props.extend = True
+		props.direction = 'PARENT'
 
+		props = layout.itemO("pose.select_hierarchy", properties=True, text="Extend Child")
+		props.extend = True
+		props.direction = 'CHILD'
+
 class VIEW3D_MT_select_PARTICLE(bpy.types.Menu):
 	__space_type__ = "VIEW_3D"
 	__label__ = "Select"
@@ -327,13 +333,19 @@
 
 		layout.itemS()
 		
-		layout.item_enumO("armature.select_hierarchy", "direction", 'PARENT')
-		layout.item_enumO("armature.select_hierarchy", "direction", 'CHILD')
+		layout.item_enumO("armature.select_hierarchy", "direction", 'PARENT', text="Parent")
+		layout.item_enumO("armature.select_hierarchy", "direction", 'CHILD', text="Child")
 		
 		layout.itemS()
 		
-		layout.view3d_select_armaturemenu()
+		props = layout.itemO("armature.select_hierarchy", properties=True, text="Extend Parent")
+		props.extend = True
+		props.direction = 'PARENT'
 
+		props = layout.itemO("armature.select_hierarchy", properties=True, text="Extend Child")
+		props.extend = True
+		props.direction = 'CHILD'
+
 class VIEW3D_MT_select_FACE(bpy.types.Menu):# XXX no matching enum
 	__space_type__ = "VIEW_3D"
 	__label__ = "Select"

Modified: branches/blender2.5/blender/source/blender/editors/animation/fmodifier_ui.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/fmodifier_ui.c	2009-08-21 12:49:21 UTC (rev 22676)
+++ branches/blender2.5/blender/source/blender/editors/animation/fmodifier_ui.c	2009-08-21 12:57:47 UTC (rev 22677)
@@ -258,14 +258,14 @@
 	
 	/* add the settings */
 	col= uiLayoutColumn(layout, 1);
-		uiItemR(col, "", 0, &ptr, "type", 0, 0, 0);
-		uiItemR(col, NULL, 0, &ptr, "additive", 0, 0, 1);
+		uiItemR(col, "", 0, &ptr, "type", 0);
+		uiItemR(col, NULL, 0, &ptr, "additive", UI_ITEM_R_TOGGLE);
 	
 	col= uiLayoutColumn(layout, 0); // no grouping for now
-		uiItemR(col, NULL, 0, &ptr, "amplitude", 0, 0, 0);
-		uiItemR(col, NULL, 0, &ptr, "phase_multiplier", 0, 0, 0);
-		uiItemR(col, NULL, 0, &ptr, "phase_offset", 0, 0, 0);
-		uiItemR(col, NULL, 0, &ptr, "value_offset", 0, 0, 0);
+		uiItemR(col, NULL, 0, &ptr, "amplitude", 0);
+		uiItemR(col, NULL, 0, &ptr, "phase_multiplier", 0);
+		uiItemR(col, NULL, 0, &ptr, "phase_offset", 0);
+		uiItemR(col, NULL, 0, &ptr, "value_offset", 0);
 }
 
 /* --------------- */
@@ -287,14 +287,14 @@
 	/* before range */
 	col= uiLayoutColumn(split, 1);
 	uiItemL(col, "Before:", 0);
-	uiItemR(col, "", 0, &ptr, "before_mode", 0, 0, 0);
-	uiItemR(col, NULL, 0, &ptr, "before_cycles", 0, 0, 0);
+	uiItemR(col, "", 0, &ptr, "before_mode", 0);
+	uiItemR(col, NULL, 0, &ptr, "before_cycles", 0);
 		
 	/* after range */
 	col= uiLayoutColumn(split, 1);
 	uiItemL(col, "After:", 0);
-	uiItemR(col, "", 0, &ptr, "after_mode", 0, 0, 0);
-	uiItemR(col, NULL, 0, &ptr, "after_cycles", 0, 0, 0);
+	uiItemR(col, "", 0, &ptr, "after_mode", 0);
+	uiItemR(col, NULL, 0, &ptr, "after_cycles", 0);
 }
 
 /* --------------- */
@@ -309,20 +309,20 @@
 	RNA_pointer_create(id, &RNA_FModifierNoise, fcm, &ptr);
 	
 	/* blending mode */
-	uiItemR(layout, NULL, 0, &ptr, "modification", 0, 0, 0);
+	uiItemR(layout, NULL, 0, &ptr, "modification", 0);
 	
 	/* split into 2 columns */
 	split= uiLayoutSplit(layout, 0.5f);
 	
 	/* col 1 */
 	col= uiLayoutColumn(split, 0);
-	uiItemR(col, NULL, 0, &ptr, "size", 0, 0, 0);
-	uiItemR(col, NULL, 0, &ptr, "strength", 0, 0, 0);
+	uiItemR(col, NULL, 0, &ptr, "size", 0);
+	uiItemR(col, NULL, 0, &ptr, "strength", 0);
 	
 	/* col 2 */
 	col= uiLayoutColumn(split, 0);
-	uiItemR(col, NULL, 0, &ptr, "phase", 0, 0, 0);
-	uiItemR(col, NULL, 0, &ptr, "depth", 0, 0, 0);
+	uiItemR(col, NULL, 0, &ptr, "phase", 0);
+	uiItemR(col, NULL, 0, &ptr, "depth", 0);
 }
 
 /* --------------- */
@@ -503,11 +503,11 @@
 	/* general settings */
 	col= uiLayoutColumn(layout, 1);
 		uiItemL(col, "Envelope:", 0);
-		uiItemR(col, NULL, 0, &ptr, "reference_value", 0, 0, 0);
+		uiItemR(col, NULL, 0, &ptr, "reference_value", 0);
 		
 		row= uiLayoutRow(col, 1);
-			uiItemR(row, "Min", 0, &ptr, "default_minimum", 0, 0, 0);
-			uiItemR(row, "Max", 0, &ptr, "default_maximum", 0, 0, 0);
+			uiItemR(row, "Min", 0, &ptr, "default_minimum", 0);
+			uiItemR(row, "Max", 0, &ptr, "default_maximum", 0);
 			
 	/* control points header */
 	// TODO: move this control-point control stuff to using the new special widgets for lists
@@ -559,13 +559,13 @@
 		
 		/* x-minimum */
 		col= uiLayoutColumn(split, 1);
-		uiItemR(col, NULL, 0, &ptr, "use_minimum_x", 0, 0, 0);
-		uiItemR(col, NULL, 0, &ptr, "minimum_x", 0, 0, 0);
+		uiItemR(col, NULL, 0, &ptr, "use_minimum_x", 0);
+		uiItemR(col, NULL, 0, &ptr, "minimum_x", 0);
 			
 		/* y-minimum*/
 		col= uiLayoutColumn(split, 1);
-		uiItemR(col, NULL, 0, &ptr, "use_minimum_y", 0, 0, 0);
-		uiItemR(col, NULL, 0, &ptr, "minimum_y", 0, 0, 0);
+		uiItemR(col, NULL, 0, &ptr, "use_minimum_y", 0);
+		uiItemR(col, NULL, 0, &ptr, "minimum_y", 0);
 	}
 	
 	/* row 2: minimum */
@@ -577,13 +577,13 @@
 		
 		/* x-minimum */
 		col= uiLayoutColumn(split, 1);
-		uiItemR(col, NULL, 0, &ptr, "use_maximum_x", 0, 0, 0);
-		uiItemR(col, NULL, 0, &ptr, "maximum_x", 0, 0, 0);
+		uiItemR(col, NULL, 0, &ptr, "use_maximum_x", 0);
+		uiItemR(col, NULL, 0, &ptr, "maximum_x", 0);
 			
 		/* y-minimum*/
 		col= uiLayoutColumn(split, 1);
-		uiItemR(col, NULL, 0, &ptr, "use_maximum_y", 0, 0, 0);
-		uiItemR(col, NULL, 0, &ptr, "maximum_y", 0, 0, 0);
+		uiItemR(col, NULL, 0, &ptr, "use_maximum_y", 0);
+		uiItemR(col, NULL, 0, &ptr, "maximum_y", 0);
 	}
 }
 

Modified: branches/blender2.5/blender/source/blender/editors/include/UI_interface.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/UI_interface.h	2009-08-21 12:49:21 UTC (rev 22676)
+++ branches/blender2.5/blender/source/blender/editors/include/UI_interface.h	2009-08-21 12:57:47 UTC (rev 22677)
@@ -585,16 +585,21 @@
 #define UI_LAYOUT_ALIGN_CENTER	2
 #define UI_LAYOUT_ALIGN_RIGHT	3
 
+#define UI_ITEM_O_RETURN_PROPS	1
+#define UI_ITEM_R_EXPAND		2
+#define UI_ITEM_R_SLIDER		4
+#define UI_ITEM_R_TOGGLE		8
+
 uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int size, int em, struct uiStyle *style);
 void uiBlockSetCurLayout(uiBlock *block, uiLayout *layout);
 void uiBlockLayoutResolve(const struct bContext *C, uiBlock *block, int *x, int *y);
 
 uiBlock *uiLayoutGetBlock(uiLayout *layout);
 
-void uiLayoutSetOperatorContext(uiLayout *layout, int opcontext);
 void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv);
 void uiLayoutSetContextPointer(uiLayout *layout, char *name, struct PointerRNA *ptr);
 
+void uiLayoutSetOperatorContext(uiLayout *layout, int opcontext);
 void uiLayoutSetActive(uiLayout *layout, int active);
 void uiLayoutSetEnabled(uiLayout *layout, int enabled);
 void uiLayoutSetRedAlert(uiLayout *layout, int redalert);
@@ -641,8 +646,6 @@
 void uiTemplateOperatorSearch(uiLayout *layout);
 void uiTemplateHeader3D(uiLayout *layout, struct bContext *C);
 void uiTemplate_view3d_select_metaballmenu(uiLayout *layout, struct bContext *C);
-void uiTemplate_view3d_select_armaturemenu(uiLayout *layout, struct bContext *C);
-void uiTemplate_view3d_select_posemenu(uiLayout *layout, struct bContext *C);
 void uiTemplate_view3d_select_faceselmenu(uiLayout *layout, struct bContext *C);
 void uiTemplateTextureImage(uiLayout *layout, struct bContext *C, struct Tex *tex);
 
@@ -664,10 +667,10 @@
 void uiItemIntO(uiLayout *layout, char *name, int icon, char *opname, char *propname, int value);
 void uiItemFloatO(uiLayout *layout, char *name, int icon, char *opname, char *propname, float value);
 void uiItemStringO(uiLayout *layout, char *name, int icon, char *opname, char *propname, char *value);
-void uiItemFullO(uiLayout *layout, char *name, int icon, char *idname, struct IDProperty *properties, int context);
+PointerRNA uiItemFullO(uiLayout *layout, char *name, int icon, char *idname, struct IDProperty *properties, int context, int flag);
 
-void uiItemR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, int expand, int slider, int toggle);
-void uiItemFullR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int expand, int slider, int toggle);
+void uiItemR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, int flag);
+void uiItemFullR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int flag);
 void uiItemEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, int value);
 void uiItemEnumR_string(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, char *value);
 void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, char *propname);

Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c	2009-08-21 12:49:21 UTC (rev 22676)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c	2009-08-21 12:57:47 UTC (rev 22677)
@@ -535,7 +535,7 @@
 }
 
 /* operator items */
-void uiItemFullO(uiLayout *layout, char *name, int icon, char *idname, IDProperty *properties, int context)
+PointerRNA uiItemFullO(uiLayout *layout, char *name, int icon, char *idname, IDProperty *properties, int context, int flag)
 {
 	uiBlock *block= layout->root->block;
 	wmOperatorType *ot= WM_operatortype_find(idname, 0);
@@ -544,7 +544,7 @@
 
 	if(!ot) {
 		ui_item_disabled(layout, idname);
-		return;
+		return PointerRNA_NULL;
 	}
 
 	if(!name)
@@ -565,10 +565,21 @@
 		but= uiDefButO(block, BUT, ot->idname, context, (char*)name, 0, 0, w, UI_UNIT_Y, NULL);
 
 	/* assign properties */
-	if(properties) {

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list