Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_node/drawnode.c')
-rw-r--r--source/blender/editors/space_node/drawnode.c111
1 files changed, 77 insertions, 34 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 7f35884cb65..b23834b7746 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -937,6 +937,27 @@ static void node_shader_buts_tex_voronoi(uiLayout *layout, bContext *UNUSED(C),
uiItemR(layout, ptr, "coloring", 0, "", ICON_NONE);
}
+static void node_shader_buts_tex_pointdensity(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ bNode *node = ptr->data;
+ NodeShaderTexPointDensity *shader_point_density = node->storage;
+
+ uiItemR(layout, ptr, "point_source", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
+
+ if (node->id && shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) {
+ PointerRNA dataptr;
+ RNA_id_pointer_create((ID *)node->id, &dataptr);
+ uiItemPointerR(layout, ptr, "particle_system", &dataptr, "particle_systems", NULL, ICON_NONE);
+ }
+
+ uiItemR(layout, ptr, "space", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "radius", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "interpolation", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "resolution", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "color_source", 0, NULL, ICON_NONE);
+}
+
static void node_shader_buts_tex_coord(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "object", 0, NULL, 0);
@@ -962,6 +983,22 @@ static void node_shader_buts_uvmap(uiLayout *layout, bContext *C, PointerRNA *pt
}
}
+static void node_shader_buts_openvdb(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+ PointerRNA scene = CTX_data_pointer_get(C, "scene");
+ if (scene.data) {
+ PointerRNA cscene = RNA_pointer_get(&scene, "cycles");
+ if (cscene.data && RNA_enum_get(&cscene, "device") == 1)
+ uiItemL(layout, IFACE_("OpenVDB is not supported on GPU"), ICON_NONE);
+ }
+
+ uiItemR(layout, ptr, "filename", 0, "", 0);
+ uiItemR(layout, ptr, "sampling", 0, "", 0);
+ uiItemR(layout, ptr, "source", 0, "", 0);
+
+ UNUSED_VARS(C);
+}
+
static void node_shader_buts_uvalongstroke(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "use_tips", 0, NULL, 0);
@@ -1170,6 +1207,9 @@ static void node_shader_set_butfunc(bNodeType *ntype)
case SH_NODE_TEX_VORONOI:
ntype->draw_buttons = node_shader_buts_tex_voronoi;
break;
+ case SH_NODE_TEX_POINTDENSITY:
+ ntype->draw_buttons = node_shader_buts_tex_pointdensity;
+ break;
case SH_NODE_TEX_COORD:
ntype->draw_buttons = node_shader_buts_tex_coord;
break;
@@ -1212,6 +1252,9 @@ static void node_shader_set_butfunc(bNodeType *ntype)
case SH_NODE_OUTPUT_LINESTYLE:
ntype->draw_buttons = node_buts_output_linestyle;
break;
+ case SH_NODE_OPENVDB:
+ ntype->draw_buttons = node_shader_buts_openvdb;
+ break;
}
}
@@ -2173,8 +2216,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_zoom * backdropWidth * node->custom3;
+ const float cy = y + snode->backdrop_zoom * backdropHeight * node->custom4;
glColor3f(1.0, 1.0, 1.0);
@@ -2205,17 +2248,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_zoom * backdropWidth * boxmask->x;
+ cy = y + snode->backdrop_zoom * 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_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);
@@ -2243,17 +2286,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_zoom * backdropWidth * ellipsemask->x;
+ cy = y + snode->backdrop_zoom * 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_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);
@@ -3188,8 +3231,8 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b
glaDefine2DArea(&ar->winrct);
wmOrtho2_region_pixelspace(ar);
- 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_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;
@@ -3210,7 +3253,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_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,
@@ -3221,7 +3264,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_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);
@@ -3236,17 +3279,17 @@ 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_zoom, snode->backdrop_zoom);
- glaDrawImBuf_glsl_ctx(C, ibuf, x, y, GL_NEAREST);
+ glaDrawImBuf_glsl_ctx(C, ibuf, x, y, GL_NEAREST, 1.0f);
glPixelZoom(1.0f, 1.0f);
glDisable(GL_BLEND);
}
else {
- glPixelZoom(snode->zoom, snode->zoom);
+ glPixelZoom(snode->backdrop_zoom, snode->backdrop_zoom);
- glaDrawImBuf_glsl_ctx(C, ibuf, x, y, GL_NEAREST);
+ glaDrawImBuf_glsl_ctx(C, ibuf, x, y, GL_NEAREST, 1.0f);
glPixelZoom(1.0f, 1.0f);
}
@@ -3275,10 +3318,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_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);
}
}