[Bf-blender-cvs] [b0f5313] wiggly-widgets: Hook up the new DNA data to the node edtior. Now the backdrop supports 2D interaction (scale still pending)
Antony Riakiotakis
noreply at git.blender.org
Fri Dec 5 15:19:03 CET 2014
Commit: b0f53133c1bd1c39b206bd5858d174b91272bb99
Author: Antony Riakiotakis
Date: Fri Dec 5 15:18:49 2014 +0100
Branches: wiggly-widgets
https://developer.blender.org/rBb0f53133c1bd1c39b206bd5858d174b91272bb99
Hook up the new DNA data to the node edtior. Now the backdrop supports
2D interaction (scale still pending)
===================================================================
M source/blender/blenkernel/BKE_blender.h
M source/blender/blenloader/intern/versioning_260.c
M source/blender/blenloader/intern/versioning_270.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/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/intern/wm_generic_widgets.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 4c333c8..8cd4e25 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 272
-#define BLENDER_SUBVERSION 2
+#define BLENDER_SUBVERSION 3
/* 262 was the last editmesh release but it has compatibility code for bmesh data */
#define BLENDER_MINVERSION 270
#define BLENDER_MINSUBVERSION 5
diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c
index 7e5127a..28d70fc 100644
--- a/source/blender/blenloader/intern/versioning_260.c
+++ b/source/blender/blenloader/intern/versioning_260.c
@@ -2285,7 +2285,6 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main)
if (!MAIN_VERSION_ATLEAST(main, 268, 4)) {
- bScreen *sc;
Object *ob;
for (ob = main->object.first; ob; ob = ob->id.next) {
@@ -2315,26 +2314,6 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main)
}
}
- /*
- * FIX some files have a zoom level of 0, and was checked during the drawing of the node space
- *
- * We moved this check to the do versions to be sure the value makes any sense.
- */
- for (sc = main->screen.first; sc; sc = sc->id.next) {
- ScrArea *sa;
- for (sa = sc->areabase.first; sa; sa = sa->next) {
- SpaceLink *sl;
- for (sl = sa->spacedata.first; sl; sl = sl->next) {
- if (sl->spacetype == SPACE_NODE) {
- SpaceNode *snode = (SpaceNode *)sl;
- if (snode->zoom < 0.02f) {
- snode->zoom = 1.0;
- }
- }
- }
- }
- }
-
for (ob = main->object.first; ob; ob = ob->id.next) {
bSensor *sens;
bTouchSensor *ts;
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 372a0b0..f2718f5 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -435,4 +435,21 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
}
}
}
+
+ if (!MAIN_VERSION_ATLEAST(main, 272, 3)) {
+ bScreen *sc;
+ for (sc = main->screen.first; sc; sc = sc->id.next) {
+ ScrArea *sa;
+ for (sa = sc->areabase.first; sa; sa = sa->next) {
+ SpaceLink *sl;
+ 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.scalex = 1.0;
+ }
+ }
+ }
+ }
+ }
}
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index d03f980..b19bc67 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->zoom * backdropWidth * node->custom3;
- const float cy = y + snode->zoom * backdropHeight * node->custom4;
+ const float cx = x + snode->backdrop.scalex * backdropWidth * node->custom3;
+ const float cy = y + snode->backdrop.scalex * 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->zoom * backdropWidth * boxmask->x;
- cy = y + snode->zoom * backdropHeight * boxmask->y;
+ cx = x + snode->backdrop.scalex * backdropWidth * boxmask->x;
+ cy = y + snode->backdrop.scalex * backdropHeight * boxmask->y;
- x1 = cx - (cosine * halveBoxWidth + sine * halveBoxHeight) * snode->zoom;
- x2 = cx - (cosine * -halveBoxWidth + sine * halveBoxHeight) * snode->zoom;
- x3 = cx - (cosine * -halveBoxWidth + sine * -halveBoxHeight) * snode->zoom;
- x4 = cx - (cosine * halveBoxWidth + sine * -halveBoxHeight) * snode->zoom;
- y1 = cy - (-sine * halveBoxWidth + cosine * halveBoxHeight) * snode->zoom;
- y2 = cy - (-sine * -halveBoxWidth + cosine * halveBoxHeight) * snode->zoom;
- y3 = cy - (-sine * -halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom;
- y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom;
+ 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;
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->zoom * backdropWidth * ellipsemask->x;
- cy = y + snode->zoom * backdropHeight * ellipsemask->y;
+ cx = x + snode->backdrop.scalex * backdropWidth * ellipsemask->x;
+ cy = y + snode->backdrop.scalex * backdropHeight * ellipsemask->y;
- x1 = cx - (cosine * halveBoxWidth + sine * halveBoxHeight) * snode->zoom;
- x2 = cx - (cosine * -halveBoxWidth + sine * halveBoxHeight) * snode->zoom;
- x3 = cx - (cosine * -halveBoxWidth + sine * -halveBoxHeight) * snode->zoom;
- x4 = cx - (cosine * halveBoxWidth + sine * -halveBoxHeight) * snode->zoom;
- y1 = cy - (-sine * halveBoxWidth + cosine * halveBoxHeight) * snode->zoom;
- y2 = cy - (-sine * -halveBoxWidth + cosine * halveBoxHeight) * snode->zoom;
- y3 = cy - (-sine * -halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom;
- y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom;
+ 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;
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->zoom * ibuf->x) / 2 + snode->xof;
- y = (ar->winy - snode->zoom * ibuf->y) / 2 + snode->yof;
+ x = (ar->winx - snode->backdrop.scalex * ibuf->x) / 2 + snode->backdrop.ofx;
+ y = (ar->winy - snode->backdrop.scalex * ibuf->y) / 2 + snode->backdrop.ofy;
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->zoom, snode->zoom);
+ glPixelZoom(snode->backdrop.scalex, snode->backdrop.scalex);
/* 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->zoom, snode->zoom);
+ glPixelZoom(snode->backdrop.scalex, snode->backdrop.scalex);
/* 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->zoom, snode->zoom);
+ glPixelZoom(snode->backdrop.scalex, snode->backdrop.scalex);
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->zoom, snode->zoom);
+ glPixelZoom(snode->backdrop.scalex, snode->backdrop.scalex);
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->zoom * viewer_border->xmin * ibuf->x,
- x + snode->zoom * viewer_border->xmax * ibuf->x,
- y + snode->zoom * viewer_border->ymin * ibuf->y,
- y + snode->zoom * viewer_border->ymax * ibuf->y);
+ 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);
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_
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list