[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28983] trunk/blender: = misc small stuff =

Campbell Barton ideasman42 at gmail.com
Tue May 25 19:04:32 CEST 2010


Revision: 28983
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28983
Author:   campbellbarton
Date:     2010-05-25 19:04:32 +0200 (Tue, 25 May 2010)

Log Message:
-----------
= misc small stuff =
- own mistake in scene help text.
- rename properties to have users as the prefix for better ordering.
- use fixed height for stamp, gives better aligned text.

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/bpy_types.py
    trunk/blender/release/scripts/ui/properties_object.py
    trunk/blender/source/blender/blenkernel/intern/image.c
    trunk/blender/source/creator/creator.c

Modified: trunk/blender/release/scripts/modules/bpy_types.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_types.py	2010-05-25 15:35:34 UTC (rev 28982)
+++ trunk/blender/release/scripts/modules/bpy_types.py	2010-05-25 17:04:32 UTC (rev 28983)
@@ -38,6 +38,16 @@
         return new_context
 
 
+class Group(bpy_types.ID):
+    __slots__ = ()
+
+    @property
+    def users_dupli_object(self):
+        """The dupli group this group is used in, XXX, TODO, WHY DOESNT THIS WORK???"""
+        import bpy
+        return tuple(obj for obj in bpy.data.objects if self == obj.dupli_object)
+
+
 class Object(bpy_types.ID):
     __slots__ = ()
 
@@ -48,18 +58,16 @@
         return tuple(child for child in bpy.data.objects if child.parent == self)
 
     @property
-    def group_users(self):
+    def users_group(self):
         """The groups this object is in"""
         import bpy
-        name = self.name
-        return tuple(group for group in bpy.data.groups if name in group.objects)
+        return tuple(group for group in bpy.data.groups if self in group.objects[:])
 
     @property
-    def scene_users(self):
+    def users_scene(self):
         """The scenes this object is in"""
         import bpy
-        name = self.name
-        return tuple(scene for scene in bpy.data.scenes if name in scene.objects)
+        return tuple(scene for scene in bpy.data.scenes if self in scene.objects[:])
 
 
 class _GenericBone:

Modified: trunk/blender/release/scripts/ui/properties_object.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_object.py	2010-05-25 15:35:34 UTC (rev 28982)
+++ trunk/blender/release/scripts/ui/properties_object.py	2010-05-25 17:04:32 UTC (rev 28983)
@@ -182,7 +182,7 @@
                 col.prop(group, "dupli_offset", text="")
 
                 prop = col.operator("wm.context_set_value", text="From Cursor")
-                prop.path = "object.group_users[%d].dupli_offset" % index
+                prop.path = "object.users_group[%d].dupli_offset" % index
                 prop.value = value
                 index += 1
 

Modified: trunk/blender/source/blender/blenkernel/intern/image.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/image.c	2010-05-25 15:35:34 UTC (rev 28982)
+++ trunk/blender/source/blender/blenkernel/intern/image.c	2010-05-25 17:04:32 UTC (rev 28983)
@@ -982,6 +982,7 @@
 	struct StampData stamp_data;
 	float w, h, pad;
 	int x, y;
+	float h_fixed;
 	
 	if (!rect && !rectf)
 		return;
@@ -998,16 +999,24 @@
 	BLF_buffer_col(mono, scene->r.fg_stamp[0], scene->r.fg_stamp[1], scene->r.fg_stamp[2], 1.0);
 	pad= BLF_width(mono, "--");
 
+	/* use 'h_fixed' rather then 'h', aligns better */
+	// BLF_width_and_height(mono, "^|/_AgPpJjlYy", &w, &h_fixed);
+	{
+		rctf box;
+		BLF_boundbox(mono, "^|/_AgPpJjlYy", &box);
+		h_fixed= box.ymax - box.ymin;
+	}
+
 	x= 0;
 	y= height;
 
 	if (stamp_data.file[0]) {
 		/* Top left corner */
-		BLF_width_and_height(mono, stamp_data.file, &w, &h);
+		BLF_width_and_height(mono, stamp_data.file, &w, &h); h= h_fixed;
 		y -= h;
 
 		/* also a little of space to the background. */
-		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y-3, w+3, y+h+3);
+		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y-3, w+3, y+h+2);
 
 		/* and draw the text. */
 		BLF_position(mono, x, y, 0.0);
@@ -1019,11 +1028,11 @@
 
 	/* Top left corner, below File */
 	if (stamp_data.note[0]) {
-		BLF_width_and_height(mono, stamp_data.note, &w, &h);
+		BLF_width_and_height(mono, stamp_data.note, &w, &h); h= h_fixed;
 		y -= h;
 
 		/* and space for background. */
-		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-2, w+3, y+h+2);
+		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-3, w+3, y+h+2);
 
 		BLF_position(mono, x, y+1, 0.0);
 		BLF_draw_buffer(mono, stamp_data.note);
@@ -1034,11 +1043,11 @@
 	
 	/* Top left corner, below File (or Note) */
 	if (stamp_data.date[0]) {
-		BLF_width_and_height(mono, stamp_data.date, &w, &h);
+		BLF_width_and_height(mono, stamp_data.date, &w, &h); h= h_fixed;
 		y -= h;
 
 		/* and space for background. */
-		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-3, w+3, y+h+3);
+		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-3, w+3, y+h+2);
 
 		BLF_position(mono, x, y, 0.0);
 		BLF_draw_buffer(mono, stamp_data.date);
@@ -1049,11 +1058,11 @@
 
 	/* Top left corner, below File, Date or Note */
 	if (stamp_data.rendertime[0]) {
-		BLF_width_and_height(mono, stamp_data.rendertime, &w, &h);
+		BLF_width_and_height(mono, stamp_data.rendertime, &w, &h); h= h_fixed;
 		y -= h;
 
 		/* and space for background. */
-		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-3, w+3, y+h+3);
+		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-3, w+3, y+h+2);
 
 		BLF_position(mono, x, y, 0.0);
 		BLF_draw_buffer(mono, stamp_data.rendertime);
@@ -1064,10 +1073,10 @@
 
 	/* Bottom left corner, leaving space for timing */
 	if (stamp_data.marker[0]) {
-		BLF_width_and_height(mono, stamp_data.marker, &w, &h);
+		BLF_width_and_height(mono, stamp_data.marker, &w, &h); h= h_fixed;
 
 		/* extra space for background. */
-		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, w+2, y+h+3);
+		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, w+2, y+h+2);
 
 		/* and pad the text. */
 		BLF_position(mono, x, y+3, 0.0);
@@ -1079,10 +1088,10 @@
 	
 	/* Left bottom corner */
 	if (stamp_data.time[0]) {
-		BLF_width_and_height(mono, stamp_data.time, &w, &h);
+		BLF_width_and_height(mono, stamp_data.time, &w, &h); h= h_fixed;
 
 		/* extra space for background */
-		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+3);
+		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2);
 
 		/* and pad the text. */
 		BLF_position(mono, x, y+3, 0.0);
@@ -1093,10 +1102,10 @@
 	}
 	
 	if (stamp_data.frame[0]) {
-		BLF_width_and_height(mono, stamp_data.frame, &w, &h);
+		BLF_width_and_height(mono, stamp_data.frame, &w, &h); h= h_fixed;
 
 		/* extra space for background. */
-		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+3);
+		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2);
 
 		/* and pad the text. */
 		BLF_position(mono, x, y+3, 0.0);
@@ -1107,22 +1116,22 @@
 	}
 
 	if (stamp_data.camera[0]) {
-		BLF_width_and_height(mono, stamp_data.camera, &w, &h);
+		BLF_width_and_height(mono, stamp_data.camera, &w, &h); h= h_fixed;
 
 		/* extra space for background. */
-		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+3);
+		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2);
 		BLF_position(mono, x, y+3, 0.0);
 		BLF_draw_buffer(mono, stamp_data.camera);
 	}
 	
 	if (stamp_data.scene[0]) {
-		BLF_width_and_height(mono, stamp_data.scene, &w, &h);
+		BLF_width_and_height(mono, stamp_data.scene, &w, &h); h= h_fixed;
 
 		/* Bottom right corner, with an extra space because blenfont is too strict! */
 		x= width - w - 2;
 
 		/* extra space for background. */
-		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+3, y+h+3);
+		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+3, y+h+2);
 
 		/* and pad the text. */
 		BLF_position(mono, x, y+3, 0.0);
@@ -1130,14 +1139,14 @@
 	}
 	
 	if (stamp_data.strip[0]) {
-		BLF_width_and_height(mono, stamp_data.scene, &w, &h);
+		BLF_width_and_height(mono, stamp_data.scene, &w, &h); h= h_fixed;
 
 		/* Top right corner, with an extra space because blenfont is too strict! */
 		x= width - w - pad;
 		y= height - h;
 
 		/* extra space for background. */
-		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y-3, x+w+pad, y+h+3);
+		buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y-3, x+w+pad, y+h+2);
 
 		BLF_position(mono, x, y, 0.0);
 		BLF_draw_buffer(mono, stamp_data.strip);

Modified: trunk/blender/source/creator/creator.c
===================================================================
--- trunk/blender/source/creator/creator.c	2010-05-25 15:35:34 UTC (rev 28982)
+++ trunk/blender/source/creator/creator.c	2010-05-25 17:04:32 UTC (rev 28983)
@@ -947,7 +947,7 @@
 	BLI_argsAdd(ba, 4, "-g", NULL, game_doc, set_ge_parameters, syshandle);
 	BLI_argsAdd(ba, 4, "-f", "--render-frame", "<frame>\n\tRender frame <frame> and save it", render_frame, C);
 	BLI_argsAdd(ba, 4, "-a", "--render-anim", "\n\tRender frames from start to end (inclusive)", render_animation, C);
-	BLI_argsAdd(ba, 4, "-S", "--scene", "<frame>\n\tSet the active scene <name> for rendering", set_scene, NULL);
+	BLI_argsAdd(ba, 4, "-S", "--scene", "<name>\n\tSet the active scene <name> for rendering", set_scene, NULL);
 	BLI_argsAdd(ba, 4, "-s", "--frame-start", "<frame>\n\tSet start to frame <frame> (use before the -a argument)", set_start_frame, C);
 	BLI_argsAdd(ba, 4, "-e", "--frame-end", "<frame>\n\tSet end to frame <frame> (use before the -a argument)", set_end_frame, C);
 	BLI_argsAdd(ba, 4, "-j", "--frame-jump", "<frames>\n\tSet number of frames to step forward after each rendered frame", set_skip_frame, C);





More information about the Bf-blender-cvs mailing list