[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19754] branches/blender2.5/blender: UI:

Brecht Van Lommel brecht at blender.org
Thu Apr 16 14:17:58 CEST 2009


Revision: 19754
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19754
Author:   blendix
Date:     2009-04-16 14:17:58 +0200 (Thu, 16 Apr 2009)

Log Message:
-----------
UI:
* Don't call generic layout hints templates anymore, i.e.
  TemplateRow becomes Row, etc.
* Added more general layout nesting, using uiLayoutSplit()
  and uiLayoutBox() functions, for which the sublayouts
  can then be accessed using uiLayoutSub(), to put items
  in those sublayouts.
* Some steps to make the layout decisions, like which items
  to put in which columns, independent of the width of the
  window or the text in the buttons. We want the layout to
  be stable under resizes and translations.
* Added an "expand" parameter to uiItemR, used now to expand
  enums into a row instead of using a menu.

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/buttons_objects.py
    branches/blender2.5/blender/release/ui/buttons_scene.py
    branches/blender2.5/blender/source/blender/editors/include/UI_interface.h
    branches/blender2.5/blender/source/blender/editors/interface/interface_api.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_utils.c
    branches/blender2.5/blender/source/blender/editors/space_text/text_header.c

Modified: branches/blender2.5/blender/release/ui/buttons_objects.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_objects.py	2009-04-16 10:45:21 UTC (rev 19753)
+++ branches/blender2.5/blender/release/ui/buttons_objects.py	2009-04-16 12:17:58 UTC (rev 19754)
@@ -11,7 +11,7 @@
 		if not ob:
 			return
 
-		layout.template_row()
+		layout.row()
 		layout.itemR(ob, "location")
 		layout.itemR(ob, "rotation")
 		layout.itemR(ob, "scale")
@@ -27,24 +27,24 @@
 		if not ob:
 			return
 
-		layout.template_row()
+		layout.row()
 		layout.itemR(ob, "pass_index")
 		layout.itemR(ob, "parent")
 
-		# layout.template_left_right()
+		# layout.left_right()
 		# layout.itemO("OBJECT_OT_add_group");
 
 		for group in bpy.data.groups:
 			if ob in group.objects:
-				sublayout = layout.template_stack()
+				sub = layout.box()
 
-				sublayout.template_left_right()
-				sublayout.itemR(group, "name")
-				# sublayout.itemO("OBJECT_OT_remove_group")
+				sub.split(number=2, lr=True)
+				sub.sub(0).itemR(group, "name")
+				# sub.sub(1).itemO("OBJECT_OT_remove_group")
 
-				sublayout.template_row()
-				sublayout.itemR(group, "layer")
-				sublayout.itemR(group, "dupli_offset")
+				sub.row()
+				sub.itemR(group, "layer")
+				sub.itemR(group, "dupli_offset")
 
 class OBJECT_PT_display(bpy.types.Panel):
 	__label__ = "Display"
@@ -57,11 +57,11 @@
 		if not ob:
 			return
 
-		layout.template_row()
+		layout.row()
 		layout.itemR(ob, "max_draw_type", text="Type")
 		layout.itemR(ob, "draw_bounds_type", text="Bounds")
 
-		layout.template_column_flow(2)
+		layout.column_flow()
 		layout.itemR(ob, "draw_name", text="Name")
 		layout.itemR(ob, "draw_axis", text="Axis")
 		layout.itemR(ob, "draw_wire", text="Wire")
@@ -80,11 +80,11 @@
 		if not ob:
 			return
 
-		layout.template_column()
-		layout.itemR(ob, "dupli_type", text="")
+		layout.column()
+		layout.itemR(ob, "dupli_type", text="", expand=True)
 
 		if ob.dupli_type == "FRAMES":
-			layout.template_column_flow(2)
+			layout.column_flow()
 			layout.itemR(ob, "dupli_frames_start", text="Start:")
 			layout.itemR(ob, "dupli_frames_end", text="End:")
 			layout.itemR(ob, "dupli_frames_on", text="On:")
@@ -101,21 +101,23 @@
 		if not ob:
 			return
 
-		layout.template_column()
+		layout.split(number=2)
 		
-		layout.template_slot("COLUMN_1")
-		layout.itemL(text="Time Offset:")
-		layout.itemR(ob, "time_offset_edit", text="Edit")
-		layout.itemR(ob, "time_offset_particle", text="Particle")
-		layout.itemR(ob, "time_offset_parent", text="Parent")
-		layout.itemR(ob, "slow_parent")
-		layout.itemR(ob, "time_offset", text="Offset:")
+		sub = layout.sub(0)
+		sub.column()
+		sub.itemL(text="Time Offset:")
+		sub.itemR(ob, "time_offset_edit", text="Edit")
+		sub.itemR(ob, "time_offset_particle", text="Particle")
+		sub.itemR(ob, "time_offset_parent", text="Parent")
+		sub.itemR(ob, "slow_parent")
+		sub.itemR(ob, "time_offset", text="Offset:")
 		
-		layout.template_slot("COLUMN_2")
-		layout.itemL(text="Tracking:")
-		layout.itemR(ob, "track_axis", text="Axis")
-		layout.itemR(ob, "up_axis", text="Up Axis")
-		layout.itemR(ob, "track_rotation", text="Rotation")
+		sub = layout.sub(1)
+		sub.column()
+		sub.itemL(text="Tracking:")
+		sub.itemR(ob, "track_axis", text="Axis")
+		sub.itemR(ob, "up_axis", text="Up Axis")
+		sub.itemR(ob, "track_rotation", text="Rotation")
 
 bpy.ui.addPanel(OBJECT_PT_transform, "BUTTONS_WINDOW", "WINDOW")
 bpy.ui.addPanel(OBJECT_PT_groups, "BUTTONS_WINDOW", "WINDOW")

Modified: branches/blender2.5/blender/release/ui/buttons_scene.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_scene.py	2009-04-16 10:45:21 UTC (rev 19753)
+++ branches/blender2.5/blender/release/ui/buttons_scene.py	2009-04-16 12:17:58 UTC (rev 19754)
@@ -14,7 +14,7 @@
 
 		rd = scene.render_data
 
-		layout.template_column_flow(2)
+		layout.column_flow()
 		layout.itemR(rd, "render_shadows", text="Shadows")
 		layout.itemR(rd, "render_sss", text="SSS")
 		layout.itemR(rd, "render_envmaps", text="EnvMap")
@@ -22,7 +22,7 @@
 		layout.itemR(rd, "render_raytracing", text="Ray Tracing")
 		layout.itemR(rd, "octree_resolution")
 
-		layout.template_row()
+		layout.row()
 		layout.itemR(rd, "alpha_mode")
 
 class RENDER_PT_image(bpy.types.Panel):
@@ -38,13 +38,13 @@
 
 		rd = scene.render_data
 
-		layout.template_column_flow(2)
+		layout.column_flow()
 		layout.itemR(rd, "resolution_x", text="SizeX")
 		layout.itemR(rd, "resolution_x", text="SizeY")
 		layout.itemR(rd, "pixel_aspect_x", text="AspX")
 		layout.itemR(rd, "pixel_aspect_y", text="AspY")
 
-		layout.template_row()
+		layout.row()
 		layout.itemR(rd, "crop_to_border")
 
 class RENDER_PT_antialiasing(bpy.types.Panel):
@@ -60,7 +60,7 @@
 
 		rd = scene.render_data
 
-		layout.template_column_flow(2)
+		layout.column_flow()
 		layout.itemR(rd, "antialiasing", text="Enable")
 		layout.itemR(rd, "antialiasing_samples", text="Samples")
 		layout.itemR(rd, "pixel_filter")
@@ -79,42 +79,42 @@
 
 		rd = scene.render_data
 
-		layout.template_row()
+		layout.row()
 		layout.itemO("SCREEN_OT_render", text="RENDER", icon=0) # ICON_SCENE
 		#layout.itemO("SCREEN_OT_render", text="ANIM", icon=0) # "anim", 1
 
-		layout.template_row()
+		layout.row()
 		layout.itemR(scene, "start_frame", text="Start")
 		layout.itemR(scene, "end_frame", text="End")
 		layout.itemR(scene, "current_frame", text="Frame")
 
-		layout.template_row()
+		layout.row()
 		layout.itemR(rd, "do_composite")
 		layout.itemR(rd, "do_sequence")
 
-		layout.template_row()
+		layout.row()
 		layout.itemL(text="General")
 
-		layout.template_row()
+		layout.row()
 		layout.itemR(rd, "resolution_percentage", text="Size ")
 		layout.itemR(rd, "dither_intensity")
 
-		layout.template_row()
+		layout.row()
 		layout.itemR(rd, "parts_x")
 		layout.itemR(rd, "parts_y")
 
-		layout.template_row()
+		layout.row()
 		layout.itemR(rd, "threads")
 		layout.itemR(rd, "threads_mode")
 
-		layout.template_row()
+		layout.row()
 		layout.itemR(rd, "fields", text="Fields")
 		layout.itemR(rd, "field_order", text="Order")
 		layout.itemR(rd, "fields_still", text="Still")
 
-		layout.template_row()
+		layout.row()
 		layout.itemL(text="Extra:")
-		layout.template_row()
+		layout.row()
 		layout.itemR(rd, "border", text="Border Render")
 		layout.itemR(rd, "panorama")
 

Modified: branches/blender2.5/blender/source/blender/editors/include/UI_interface.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/UI_interface.h	2009-04-16 10:45:21 UTC (rev 19753)
+++ branches/blender2.5/blender/source/blender/editors/include/UI_interface.h	2009-04-16 12:17:58 UTC (rev 19754)
@@ -557,37 +557,24 @@
 
 typedef struct uiLayout uiLayout;
 
-uiLayout *uiLayoutBegin(int dir, int x, int y, int w, int h);
+uiLayout *uiLayoutBegin(int dir, int x, int y, int size, int em);
 void uiLayoutContext(uiLayout *layout, int opcontext);
 void uiLayoutEnd(const struct bContext *C, uiBlock *block, uiLayout *layout, int *x, int *y);
 
-/* vertical button templates */
-#define UI_TSLOT_COLUMN_1	0
-#define UI_TSLOT_COLUMN_2	1
-#define UI_TSLOT_COLUMN_3	2
-#define UI_TSLOT_COLUMN_4	3
-#define UI_TSLOT_COLUMN_5	4
-#define UI_TSLOT_COLUMN_MAX	5
+/* layout specifiers */
+void uiLayoutRow(uiLayout *layout);
+void uiLayoutColumn(uiLayout *layout);
+void uiLayoutColumnFlow(uiLayout *layout, int number);
+void uiLayoutSplit(uiLayout *layout, int number, int lr);
+uiLayout *uiLayoutBox(uiLayout *layout);
+uiLayout *uiLayoutSub(uiLayout *layout, int n);
 
-#define UI_TSLOT_LR_LEFT	0
-#define UI_TSLOT_LR_RIGHT	1
-
-void uiTemplateLeftRight(uiLayout *layout);
-void uiTemplateRow(uiLayout *layout);
-void uiTemplateColumn(uiLayout *layout);
-void uiTemplateColumnFlow(uiLayout *layout, int columns);
-uiLayout *uiTemplateStack(uiLayout *layout);
-
-/* horizontal header templates */
-#define UI_TSLOT_HEADER		0
-
+/* templates */
 void uiTemplateHeaderMenus(uiLayout *layout);
 void uiTemplateHeaderButtons(uiLayout *layout);
 void uiTemplateHeaderID(uiLayout *layout, struct PointerRNA *ptr, char *propname, int flag, uiIDPoinFunc func);
 void uiTemplateSetColor(uiLayout *layout, int color);
 
-void uiTemplateSlot(uiLayout *layout, int slot);
-
 /* items */
 void uiItemO(uiLayout *layout, char *name, int icon, char *opname);
 void uiItemEnumO(uiLayout *layout, char *name, int icon, char *opname, char *propname, int value);
@@ -598,8 +585,8 @@
 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);
 
-void uiItemR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname);
-void uiItemFullR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, struct PropertyRNA *prop, int index);
+void uiItemR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, int expand);
+void uiItemFullR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int expand);
 
 void uiItemL(uiLayout *layout, char *name, int icon);
 

Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_api.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_api.c	2009-04-16 10:45:21 UTC (rev 19753)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_api.c	2009-04-16 12:17:58 UTC (rev 19754)
@@ -45,39 +45,32 @@
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	static EnumPropertyItem slot_items[]= {
-		{0, "DEFAULT", "Default", ""},
-		{UI_TSLOT_COLUMN_1, "COLUMN_1", "Column 1", ""},
-		{UI_TSLOT_COLUMN_2, "COLUMN_2", "Column 2", ""},
-		{UI_TSLOT_COLUMN_3, "COLUMN_3", "Column 3", ""},
-		{UI_TSLOT_COLUMN_4, "COLUMN_4", "Column 4", ""},
-		{UI_TSLOT_COLUMN_5, "COLUMN_5", "Column 5", ""},
-		{UI_TSLOT_LR_LEFT, "LEFT", "Left", ""},
-		{UI_TSLOT_LR_RIGHT, "RIGHT", "Right", ""},
-		{0, NULL, NULL, NULL}
-	};
+	/* simple layout specifiers */
+	func= RNA_def_function(srna, "row", "uiLayoutRow");
+	func= RNA_def_function(srna, "column", "uiLayoutColumn");
+	func= RNA_def_function(srna, "column_flow", "uiLayoutColumnFlow");

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list