= 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.
This commit is contained in:
Campbell Barton 2010-05-25 17:04:32 +00:00
parent 13f1ce8bdc
commit 1bd58bdbf4
4 changed files with 45 additions and 28 deletions

@ -38,6 +38,16 @@ class Context(StructRNA):
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 @@ class Object(bpy_types.ID):
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:

@ -182,7 +182,7 @@ class OBJECT_PT_groups(ObjectButtonsPanel):
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

@ -982,6 +982,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
struct StampData stamp_data;
float w, h, pad;
int x, y;
float h_fixed;
if (!rect && !rectf)
return;
@ -998,16 +999,24 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
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 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
/* 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 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
/* 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 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
/* 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 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
/* 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 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
/* 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 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
}
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 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
}
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 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
}
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);

@ -947,7 +947,7 @@ void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
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);