[Bf-blender-cvs] [ef8a3d6] wiggly-widgets: Big refactor commit.
Antony Riakiotakis
noreply at git.blender.org
Tue Dec 9 21:03:57 CET 2014
Commit: ef8a3d65f1e6e0e40849e966bb54503ca38eb3e2
Author: Antony Riakiotakis
Date: Mon Dec 8 20:27:39 2014 +0100
Branches: wiggly-widgets
https://developer.blender.org/rBef8a3d65f1e6e0e40849e966bb54503ca38eb3e2
Big refactor commit.
* Minor cleanup - propname does not need to be stored anymore.
* Code to support modal widgetmap registration for operators - still
untested, but will be tested soon on sequencer cage widget
* Widgets take parameters to initialize property slots that are used for
feedback or control.
Cage now uses this to feed offset/scale to different properties.
* Initialize common properties during widget registration.
===================================================================
M release/scripts/startup/bl_ui/space_node.py
M source/blender/blenloader/intern/versioning_270.c
M source/blender/editors/object/object_lamp.c
M source/blender/editors/space_node/drawnode.c
M source/blender/editors/space_node/node_edit.c
M source/blender/editors/space_node/node_view.c
M source/blender/editors/space_node/space_node.c
M source/blender/editors/space_sequencer/sequencer_view.c
M source/blender/editors/space_view3d/space_view3d.c
M source/blender/makesdna/DNA_space_types.h
M source/blender/makesdna/DNA_widget_types.h
M source/blender/makesrna/RNA_access.h
M source/blender/makesrna/intern/rna_space.c
M source/blender/makesrna/intern/rna_wm.c
M source/blender/windowmanager/WM_api.h
M source/blender/windowmanager/WM_types.h
M source/blender/windowmanager/intern/wm_event_system.c
M source/blender/windowmanager/intern/wm_generic_widgets.c
M source/blender/windowmanager/intern/wm_operators.c
M source/blender/windowmanager/intern/wm_widgets.c
M source/blender/windowmanager/wm.h
M source/blender/windowmanager/wm_event_system.h
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py
index 4cc72f1..eb8fbe0 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -386,8 +386,7 @@ class NODE_PT_backdrop(Panel):
col = layout.column(align=True)
col.label(text="Offset:")
- col.prop(snode, "backdrop_x", text="X")
- col.prop(snode, "backdrop_y", text="Y")
+ col.prop(snode, "backdrop_offset", text="")
col.operator("node.backimage_move", text="Move")
layout.operator("node.backimage_fit", text="Fit")
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 0011b68..f05e19b 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -445,7 +445,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_NODE) {
SpaceNode *snode = (SpaceNode *)sl;
- snode->backdrop.scalex = 1.0;
+ snode->backdrop_zoom = 1.0;
}
}
}
diff --git a/source/blender/editors/object/object_lamp.c b/source/blender/editors/object/object_lamp.c
index 3e955d9..f60c8f3 100644
--- a/source/blender/editors/object/object_lamp.c
+++ b/source/blender/editors/object/object_lamp.c
@@ -223,13 +223,13 @@ void WIDGETGROUP_lamp_draw(const struct bContext *C, struct wmWidgetGroup *wgrou
PointerRNA ptr;
float dir[3];
- widget = WIDGET_arrow_new(wgroup, WIDGET_ARROW_STYLE_INVERTED, NULL);
+ widget = WIDGET_arrow_new(wgroup, WIDGET_ARROW_STYLE_INVERTED);
WIDGET_arrow_set_color(widget, color_lamp);
RNA_pointer_create(&la->id, &RNA_Lamp, la, &ptr);
WM_widget_set_origin(widget, ob->obmat[3]);
- WM_widget_property(widget, &ptr, "spot_size");
+ WM_widget_property(widget, ARROW_SLOT_OFFSET_WORLD_SPACE, &ptr, "spot_size");
negate_v3_v3(dir, ob->obmat[2]);
WIDGET_arrow_set_direction(widget, dir);
}
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index b19bc67..c7337f6 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -2051,8 +2051,8 @@ static void node_composit_backdrop_viewer(SpaceNode *snode, ImBuf *backdrop, bNo
if (node->custom1 == 0) {
const float backdropWidth = backdrop->x;
const float backdropHeight = backdrop->y;
- const float cx = x + snode->backdrop.scalex * backdropWidth * node->custom3;
- const float cy = y + snode->backdrop.scalex * backdropHeight * node->custom4;
+ const float cx = x + snode->backdrop_zoom * backdropWidth * node->custom3;
+ const float cy = y + snode->backdrop_zoom * backdropHeight * node->custom4;
glColor3f(1.0, 1.0, 1.0);
@@ -2083,17 +2083,17 @@ static void node_composit_backdrop_boxmask(SpaceNode *snode, ImBuf *backdrop, bN
glColor3f(1.0, 1.0, 1.0);
- cx = x + snode->backdrop.scalex * backdropWidth * boxmask->x;
- cy = y + snode->backdrop.scalex * backdropHeight * boxmask->y;
+ cx = x + snode->backdrop_zoom * backdropWidth * boxmask->x;
+ cy = y + snode->backdrop_zoom * backdropHeight * boxmask->y;
- x1 = cx - (cosine * halveBoxWidth + sine * halveBoxHeight) * snode->backdrop.scalex;
- x2 = cx - (cosine * -halveBoxWidth + sine * halveBoxHeight) * snode->backdrop.scalex;
- x3 = cx - (cosine * -halveBoxWidth + sine * -halveBoxHeight) * snode->backdrop.scalex;
- x4 = cx - (cosine * halveBoxWidth + sine * -halveBoxHeight) * snode->backdrop.scalex;
- y1 = cy - (-sine * halveBoxWidth + cosine * halveBoxHeight) * snode->backdrop.scalex;
- y2 = cy - (-sine * -halveBoxWidth + cosine * halveBoxHeight) * snode->backdrop.scalex;
- y3 = cy - (-sine * -halveBoxWidth + cosine * -halveBoxHeight) * snode->backdrop.scalex;
- y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->backdrop.scalex;
+ x1 = cx - (cosine * halveBoxWidth + sine * halveBoxHeight) * snode->backdrop_zoom;
+ x2 = cx - (cosine * -halveBoxWidth + sine * halveBoxHeight) * snode->backdrop_zoom;
+ x3 = cx - (cosine * -halveBoxWidth + sine * -halveBoxHeight) * snode->backdrop_zoom;
+ x4 = cx - (cosine * halveBoxWidth + sine * -halveBoxHeight) * snode->backdrop_zoom;
+ y1 = cy - (-sine * halveBoxWidth + cosine * halveBoxHeight) * snode->backdrop_zoom;
+ y2 = cy - (-sine * -halveBoxWidth + cosine * halveBoxHeight) * snode->backdrop_zoom;
+ y3 = cy - (-sine * -halveBoxWidth + cosine * -halveBoxHeight) * snode->backdrop_zoom;
+ y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->backdrop_zoom;
glBegin(GL_LINE_LOOP);
glVertex2f(x1, y1);
@@ -2121,17 +2121,17 @@ static void node_composit_backdrop_ellipsemask(SpaceNode *snode, ImBuf *backdrop
glColor3f(1.0, 1.0, 1.0);
- cx = x + snode->backdrop.scalex * backdropWidth * ellipsemask->x;
- cy = y + snode->backdrop.scalex * backdropHeight * ellipsemask->y;
+ cx = x + snode->backdrop_zoom * backdropWidth * ellipsemask->x;
+ cy = y + snode->backdrop_zoom * backdropHeight * ellipsemask->y;
- x1 = cx - (cosine * halveBoxWidth + sine * halveBoxHeight) * snode->backdrop.scalex;
- x2 = cx - (cosine * -halveBoxWidth + sine * halveBoxHeight) * snode->backdrop.scalex;
- x3 = cx - (cosine * -halveBoxWidth + sine * -halveBoxHeight) * snode->backdrop.scalex;
- x4 = cx - (cosine * halveBoxWidth + sine * -halveBoxHeight) * snode->backdrop.scalex;
- y1 = cy - (-sine * halveBoxWidth + cosine * halveBoxHeight) * snode->backdrop.scalex;
- y2 = cy - (-sine * -halveBoxWidth + cosine * halveBoxHeight) * snode->backdrop.scalex;
- y3 = cy - (-sine * -halveBoxWidth + cosine * -halveBoxHeight) * snode->backdrop.scalex;
- y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->backdrop.scalex;
+ x1 = cx - (cosine * halveBoxWidth + sine * halveBoxHeight) * snode->backdrop_zoom;
+ x2 = cx - (cosine * -halveBoxWidth + sine * halveBoxHeight) * snode->backdrop_zoom;
+ x3 = cx - (cosine * -halveBoxWidth + sine * -halveBoxHeight) * snode->backdrop_zoom;
+ x4 = cx - (cosine * halveBoxWidth + sine * -halveBoxHeight) * snode->backdrop_zoom;
+ y1 = cy - (-sine * halveBoxWidth + cosine * halveBoxHeight) * snode->backdrop_zoom;
+ y2 = cy - (-sine * -halveBoxWidth + cosine * halveBoxHeight) * snode->backdrop_zoom;
+ y3 = cy - (-sine * -halveBoxWidth + cosine * -halveBoxHeight) * snode->backdrop_zoom;
+ y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->backdrop_zoom;
glBegin(GL_LINE_LOOP);
@@ -3057,8 +3057,8 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b
/* almost #wmOrtho2_region_pixelspace, but no +1 px */
wmOrtho2_pixelspace(ar->winx, ar->winy);
- x = (ar->winx - snode->backdrop.scalex * ibuf->x) / 2 + snode->backdrop.ofx;
- y = (ar->winy - snode->backdrop.scalex * ibuf->y) / 2 + snode->backdrop.ofy;
+ x = (ar->winx - snode->backdrop_zoom * ibuf->x) / 2 + snode->backdrop_offset[0];
+ y = (ar->winy - snode->backdrop_zoom * ibuf->y) / 2 + snode->backdrop_offset[1];
if (ibuf->rect || ibuf->rect_float) {
unsigned char *display_buffer = NULL;
@@ -3079,7 +3079,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b
else ofs = 3;
#endif
- glPixelZoom(snode->backdrop.scalex, snode->backdrop.scalex);
+ glPixelZoom(snode->backdrop_zoom, snode->backdrop_zoom);
/* swap bytes, so alpha is most significant one, then just draw it as luminance int */
glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT,
@@ -3090,7 +3090,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b
else if (snode->flag & SNODE_SHOW_ALPHA) {
display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle);
- glPixelZoom(snode->backdrop.scalex, snode->backdrop.scalex);
+ glPixelZoom(snode->backdrop_zoom, snode->backdrop_zoom);
/* swap bytes, so alpha is most significant one, then just draw it as luminance int */
#ifdef __BIG_ENDIAN__
glPixelStorei(GL_UNPACK_SWAP_BYTES, 1);
@@ -3105,7 +3105,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b
else if (snode->flag & SNODE_USE_ALPHA) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glPixelZoom(snode->backdrop.scalex, snode->backdrop.scalex);
+ glPixelZoom(snode->backdrop_zoom, snode->backdrop_zoom);
glaDrawImBuf_glsl_ctx(C, ibuf, x, y, GL_NEAREST);
@@ -3113,7 +3113,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b
glDisable(GL_BLEND);
}
else {
- glPixelZoom(snode->backdrop.scalex, snode->backdrop.scalex);
+ glPixelZoom(snode->backdrop_zoom, snode->backdrop_zoom);
glaDrawImBuf_glsl_ctx(C, ibuf, x, y, GL_NEAREST);
@@ -3144,10 +3144,10 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b
rcti pixel_border;
UI_ThemeColor(TH_ACTIVE);
BLI_rcti_init(&pixel_border,
- x + snode->backdrop.scalex * viewer_border->xmin * ibuf->x,
- x + snode->backdrop.scalex * viewer_border->xmax * ibuf->x,
- y + snode->backdrop.scalex * viewer_border->ymin * ibuf->y,
- y + snode->backdrop.scalex * viewer_border->ymax * ibuf->y);
+ x + snode->backdrop_zoom * viewer_border->xmin * ibuf->x,
+ x + snode->backdrop_zoom * viewer_border->xmax * ibuf->x,
+ y + snode->backdrop_zoom * viewer_border->ymin * ibuf->y,
+ y + snode->backdrop_zoom * viewer_border->ymax * ibuf->y);
glaDrawBorderCorners(&pixel_border, 1.0f, 1.0f);
}
}
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 6474e3c..9d6c7d7 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -2442,11 +2442,11 @@ static void viewer_border_corner_to_backdrop(SpaceNode *snode, ARegion *ar, int
{
float bufx, bufy;
- bufx = back
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list