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

Brecht Van Lommel brecht at blender.org
Mon Apr 27 20:06:00 CEST 2009


Revision: 19950
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19950
Author:   blendix
Date:     2009-04-27 20:05:58 +0200 (Mon, 27 Apr 2009)

Log Message:
-----------
UI:
* Made separator item work horizontal & vertical.
* Add colon (:) automatic for int/float/enum/string.
* Added space variables to uiStyle and use them in the
  layout engine.

* Added initial World buttons by Thomas Dinges, thanks!
* Added some code for modifiers in the Object Data context.
  This will become a template though.
* Use a common poll() callback in the scripts to reduce code.

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/armature/poselib.c
    branches/blender2.5/blender/source/blender/editors/include/UI_interface.h
    branches/blender2.5/blender/source/blender/editors/interface/interface.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_api.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_handlers.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_style.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/object/object_intern.h
    branches/blender2.5/blender/source/blender/editors/object/object_ops.c
    branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c
    branches/blender2.5/blender/source/blender/editors/space_image/image_header.c
    branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_header.c
    branches/blender2.5/blender/source/blender/editors/space_text/text_header.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_userdef_types.h
    branches/blender2.5/blender/source/blender/makesrna/RNA_enum_types.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_modifier.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_scene.c

Added Paths:
-----------
    branches/blender2.5/blender/release/ui/buttons_data.py
    branches/blender2.5/blender/release/ui/buttons_world.py
    branches/blender2.5/blender/source/blender/editors/object/object_modifier.c

Added: branches/blender2.5/blender/release/ui/buttons_data.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data.py	                        (rev 0)
+++ branches/blender2.5/blender/release/ui/buttons_data.py	2009-04-27 18:05:58 UTC (rev 19950)
@@ -0,0 +1,56 @@
+
+import bpy
+
+class DataButtonsPanel(bpy.types.Panel):
+	__space_type__ = "BUTTONS_WINDOW"
+	__region_type__ = "WINDOW"
+	__context__ = "data"
+
+class DATA_PT_modifiers(DataButtonsPanel):
+	__idname__ = "DATA_PT_modifiers"
+	__label__ = "Modifiers"
+
+	def draw(self, context):
+		ob = context.active_object
+		layout = self.layout
+
+		if not ob:
+			return
+
+		layout.row()
+		layout.item_menu_enumO("OBJECT_OT_modifier_add", "type")
+
+		for md in ob.modifiers:
+			sub = layout.box()
+
+			sub.row()
+			sub.itemR(md, "expanded", text="")
+			sub.itemR(md, "name", text="")
+
+			sub.itemR(md, "render", text="")
+			sub.itemR(md, "realtime", text="")
+			sub.itemR(md, "editmode", text="")
+			sub.itemR(md, "on_cage", text="")
+
+			if md.expanded:
+				sub.row()
+				sub.itemS()
+
+				if md.type == "ARMATURE":
+					self.armature(sub, md)
+
+	def armature(self, layout, md):
+		layout.column()
+		layout.itemR(md, "object")
+		layout.row()
+		layout.itemR(md, "vertex_group")
+		layout.itemR(md, "invert")
+		layout.column_flow()
+		layout.itemR(md, "use_vertex_groups")
+		layout.itemR(md, "use_bone_envelopes")
+		layout.itemR(md, "quaternion")
+		layout.itemR(md, "b_bone_rest")
+		layout.itemR(md, "multi_modifier")
+
+bpy.types.register(DATA_PT_modifiers)
+

Modified: branches/blender2.5/blender/release/ui/buttons_objects.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_objects.py	2009-04-27 17:53:41 UTC (rev 19949)
+++ branches/blender2.5/blender/release/ui/buttons_objects.py	2009-04-27 18:05:58 UTC (rev 19950)
@@ -6,6 +6,9 @@
 	__region_type__ = "WINDOW"
 	__context__ = "object"
 
+	def poll(self, context):
+		return (context.active_object != None)
+
 class OBJECT_PT_transform(ObjectButtonsPanel):
 	__idname__ = "OBJECT_PT_transform"
 	__label__ = "Transform"
@@ -14,9 +17,6 @@
 		ob = context.active_object
 		layout = self.layout
 
-		if not ob:
-			return
-
 		layout.row()
 		layout.itemR(ob, "location")
 		layout.itemR(ob, "rotation")
@@ -30,9 +30,6 @@
 		ob = context.active_object
 		layout = self.layout
 
-		if not ob:
-			return
-
 		layout.row()
 		layout.itemR(ob, "pass_index")
 		layout.itemR(ob, "parent")
@@ -59,14 +56,8 @@
 	def draw(self, context):
 		ob = context.active_object
 		layout = self.layout
-
-		if not ob:
-			return
 			
 		layout.row()
-		layout.itemR(ob, "type", text="Object Type")
-
-		layout.row()
 		layout.itemR(ob, "max_draw_type", text="Type")
 		layout.itemR(ob, "draw_bounds_type", text="Bounds")
 
@@ -86,18 +77,15 @@
 		ob = context.active_object
 		layout = self.layout
 
-		if not ob:
-			return
-
 		layout.column()
 		layout.itemR(ob, "dupli_type", text="", expand=True)
 
 		if ob.dupli_type == "FRAMES":
 			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:")
-			layout.itemR(ob, "dupli_frames_off", text="Off:")
+			layout.itemR(ob, "dupli_frames_start", text="Start")
+			layout.itemR(ob, "dupli_frames_end", text="End")
+			layout.itemR(ob, "dupli_frames_on", text="On")
+			layout.itemR(ob, "dupli_frames_off", text="Off")
 
 class OBJECT_PT_animation(ObjectButtonsPanel):
 	__idname__ = "OBJECT_PT_animation"
@@ -107,9 +95,6 @@
 		ob = context.active_object
 		layout = self.layout
 
-		if not ob:
-			return
-
 		layout.split(number=2)
 		
 		sub = layout.sub(0)
@@ -119,7 +104,7 @@
 		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:")
+		sub.itemR(ob, "time_offset", text="Offset")
 		
 		sub = layout.sub(1)
 		sub.column()

Modified: branches/blender2.5/blender/release/ui/buttons_scene.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_scene.py	2009-04-27 17:53:41 UTC (rev 19949)
+++ branches/blender2.5/blender/release/ui/buttons_scene.py	2009-04-27 18:05:58 UTC (rev 19950)
@@ -13,9 +13,6 @@
 		scene = context.scene
 		layout = self.layout
 
-		if not scene:
-			return
-
 		rd = scene.render_data
 
 		layout.column_flow()
@@ -40,9 +37,6 @@
 		scene = context.scene
 		layout = self.layout
 
-		if not scene:
-			return
-
 		rd = scene.render_data
 
 		layout.column_flow()
@@ -70,9 +64,6 @@
 		scene = context.scene
 		layout = self.layout
 
-		if not scene:
-			return
-
 		rd = scene.render_data
 
 		layout.row()
@@ -95,9 +86,6 @@
 		scene = context.scene
 		layout = self.layout
 
-		if not scene:
-			return
-
 		rd = scene.render_data
 
 		layout.row()

Added: branches/blender2.5/blender/release/ui/buttons_world.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_world.py	                        (rev 0)
+++ branches/blender2.5/blender/release/ui/buttons_world.py	2009-04-27 18:05:58 UTC (rev 19950)
@@ -0,0 +1,130 @@
+
+import bpy
+
+class WorldButtonsPanel(bpy.types.Panel):
+	__space_type__ = "BUTTONS_WINDOW"
+	__region_type__ = "WINDOW"
+	__context__ = "world"
+
+	def poll(self, context):
+		return (context.scene.world != None)
+	
+class WORLD_PT_world(WorldButtonsPanel):
+	__label__ = "World"
+
+	def draw(self, context):
+		world = context.scene.world
+		layout = self.layout
+		
+		layout.row()
+		layout.itemR(world, "blend_sky")
+		layout.itemR(world, "paper_sky")
+		layout.itemR(world, "real_sky")
+		
+		layout.row()
+		layout.itemR(world, "horizon_color")
+		layout.itemR(world, "zenith_color")
+		layout.itemR(world, "ambient_color")
+		
+class WORLD_PT_color_correction(WorldButtonsPanel):
+	__label__ = "Color Correction"
+
+	def draw(self, context):
+		world = context.scene.world
+		layout = self.layout
+
+		layout.row()
+		layout.itemR(world, "exposure")
+		layout.itemR(world, "range")
+	
+class WORLD_PT_mist(WorldButtonsPanel):
+	__label__ = "Mist"
+
+	def draw(self, context):
+		world = context.scene.world
+		layout = self.layout
+
+		layout.row()
+		layout.itemR(world.mist, "enabled", text="Enable")
+		layout.itemR(world.mist, "falloff")
+	
+		layout.column_flow()
+		layout.itemR(world.mist, "start")
+		layout.itemR(world.mist, "depth")
+		layout.itemR(world.mist, "height")
+		layout.itemR(world.mist, "intensity")
+		
+class WORLD_PT_stars(WorldButtonsPanel):
+	__label__ = "Stars"
+
+	def draw(self, context):
+		world = context.scene.world
+		layout = self.layout
+
+		layout.row()
+		layout.itemR(world.stars, "enabled", text="Enable")
+
+		layout.column_flow()
+		layout.itemR(world.stars, "size")
+		layout.itemR(world.stars, "min_distance", text="MinDist")
+		layout.itemR(world.stars, "average_separation", text="StarDist")
+		layout.itemR(world.stars, "color_randomization", text="Colnoise")
+		
+class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
+	__label__ = "Ambient Occlusion"
+
+	def draw(self, context):
+		world = context.scene.world
+		layout = self.layout
+
+		ao = world.ambient_occlusion
+		
+		layout.row()
+		layout.itemR(ao, "enabled", text="Enable")
+
+		layout.row()
+		layout.itemR(ao, "gather_method", expand=True)
+		
+		if ao.gather_method == 'RAYTRACE':
+			layout.row()
+			layout.itemR(ao, "samples")
+			layout.itemR(ao, "distance")
+			
+			layout.row()
+			layout.itemR(ao, "sample_method")
+			if ao.sample_method == 'ADAPTIVE_QMC':
+				layout.row()
+				layout.itemR(ao, "threshold")
+				layout.itemR(ao, "adapt_to_speed")
+				
+			if ao.sample_method == 'CONSTANT_JITTERED':
+				layout.row()
+				layout.itemR(ao, "bias")
+						
+		if ao.gather_method == 'APPROXIMATE':
+			layout.row()
+			layout.itemR(ao, "passes")
+			layout.itemR(ao, "error_tolerance")
+			
+			layout.row()
+			layout.itemR(ao, "correction")
+			layout.itemR(ao, "pixel_cache")
+
+		layout.row()
+		layout.itemS()
+			
+		layout.row()
+		layout.itemR(ao, "falloff")	
+		layout.itemR(ao, "strength")
+		
+		layout.column()
+		layout.itemR(ao, "blend_mode", expand=True)
+		layout.itemR(ao, "color", expand=True)
+		layout.itemR(ao, "energy")
+	
+bpy.types.register(WORLD_PT_world)
+bpy.types.register(WORLD_PT_mist)
+bpy.types.register(WORLD_PT_stars)
+bpy.types.register(WORLD_PT_ambient_occlusion)
+bpy.types.register(WORLD_PT_color_correction)
+

Modified: branches/blender2.5/blender/source/blender/editors/armature/poselib.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/armature/poselib.c	2009-04-27 17:53:41 UTC (rev 19949)
+++ branches/blender2.5/blender/source/blender/editors/armature/poselib.c	2009-04-27 18:05:58 UTC (rev 19950)
@@ -339,7 +339,7 @@
 		uiItemIntO(layout, "Add New (Current Frame)", 0, "POSELIB_OT_pose_add", "frame", CFRA);
 		
 		/* replace existing - submenu */
-		uiItemLevel(layout, "Replace Existing...", 0, poselib_add_menu_invoke__replacemenu);
+		uiItemMenuF(layout, "Replace Existing...", 0, poselib_add_menu_invoke__replacemenu);
 	}
 	
 	uiPupMenuEnd(C, pup);

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-27 17:53:41 UTC (rev 19949)
+++ branches/blender2.5/blender/source/blender/editors/include/UI_interface.h	2009-04-27 18:05:58 UTC (rev 19950)
@@ -48,6 +48,7 @@
 struct PropertyRNA;
 struct ReportList;
 struct rcti;
+struct uiStyle;
 struct uiFontStyle;
 
 typedef struct uiBut uiBut;
@@ -532,7 +533,7 @@
 #define UI_LAYOUT_HEADER		1
 #define UI_LAYOUT_MENU			2
 
-uiLayout *uiLayoutBegin(int dir, int type, int x, int y, int size, int em);
+uiLayout *uiLayoutBegin(int dir, int type, int x, int y, int size, int em, struct uiStyle *style);
 void uiLayoutEnd(const struct bContext *C, uiBlock *block, uiLayout *layout, int *x, int *y);
 
 void uiLayoutContext(uiLayout *layout, int opcontext);
@@ -571,9 +572,9 @@
 void uiItemV(uiLayout *layout, char *name, int icon, int argval); /* value */
 void uiItemS(uiLayout *layout); /* separator */
 
-void uiItemLevel(uiLayout *layout, char *name, int icon, uiMenuCreateFunc func);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list