diff options
Diffstat (limited to 'source/blender/editors/space_node/drawnode.c')
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 87 |
1 files changed, 46 insertions, 41 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index a69eb254621..3beb12fbb2a 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -24,6 +24,7 @@ #include "BLI_blenlib.h" #include "BLI_math.h" +#include "BLI_system.h" #include "DNA_node_types.h" #include "DNA_object_types.h" @@ -44,9 +45,9 @@ #include "BIF_glutil.h" -#include "GPU_draw.h" #include "GPU_batch.h" #include "GPU_batch_presets.h" +#include "GPU_extensions.h" #include "GPU_immediate.h" #include "GPU_matrix.h" #include "GPU_state.h" @@ -730,37 +731,7 @@ static void node_buts_image_user(uiLayout *layout, static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiLayout *row, *col, *sub; - - uiItemR(layout, ptr, "vector_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - - col = uiLayoutColumn(row, true); - uiItemL(col, IFACE_("Location:"), ICON_NONE); - uiItemR(col, ptr, "translation", 0, "", ICON_NONE); - - col = uiLayoutColumn(row, true); - uiItemL(col, IFACE_("Rotation:"), ICON_NONE); - uiItemR(col, ptr, "rotation", 0, "", ICON_NONE); - - col = uiLayoutColumn(row, true); - uiItemL(col, IFACE_("Scale:"), ICON_NONE); - uiItemR(col, ptr, "scale", 0, "", ICON_NONE); - - row = uiLayoutRow(layout, false); - - col = uiLayoutColumn(row, true); - uiItemR(col, ptr, "use_min", 0, IFACE_("Min"), ICON_NONE); - sub = uiLayoutColumn(col, true); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_min")); - uiItemR(sub, ptr, "min", 0, "", ICON_NONE); - - col = uiLayoutColumn(row, true); - uiItemR(col, ptr, "use_max", 0, IFACE_("Max"), ICON_NONE); - sub = uiLayoutColumn(col, true); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_max")); - uiItemR(sub, ptr, "max", 0, "", ICON_NONE); + uiItemR(layout, ptr, "vector_type", 0, NULL, ICON_NONE); } static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -937,14 +908,24 @@ static void node_shader_buts_tex_wave(uiLayout *layout, bContext *UNUSED(C), Poi static void node_shader_buts_tex_musgrave(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { + uiItemR(layout, ptr, "musgrave_dimensions", 0, "", ICON_NONE); uiItemR(layout, ptr, "musgrave_type", 0, "", ICON_NONE); } static void node_shader_buts_tex_voronoi(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "coloring", 0, "", ICON_NONE); - uiItemR(layout, ptr, "distance", 0, "", ICON_NONE); + uiItemR(layout, ptr, "voronoi_dimensions", 0, "", ICON_NONE); uiItemR(layout, ptr, "feature", 0, "", ICON_NONE); + int feature = RNA_enum_get(ptr, "feature"); + if (!ELEM(feature, SHD_VORONOI_DISTANCE_TO_EDGE, SHD_VORONOI_N_SPHERE_RADIUS) && + RNA_enum_get(ptr, "voronoi_dimensions") != 1) { + uiItemR(layout, ptr, "distance", 0, "", ICON_NONE); + } +} + +static void node_shader_buts_tex_noise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "noise_dimensions", 0, "", ICON_NONE); } static void node_shader_buts_tex_pointdensity(uiLayout *layout, @@ -1017,6 +998,18 @@ static void node_shader_buts_uvmap(uiLayout *layout, bContext *C, PointerRNA *pt } } +static void node_shader_buts_vertex_color(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + PointerRNA obptr = CTX_data_pointer_get(C, "active_object"); + if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) { + PointerRNA dataptr = RNA_pointer_get(&obptr, "data"); + uiItemPointerR(layout, ptr, "layer_name", &dataptr, "vertex_colors", "", ICON_GROUP_VCOL); + } + else { + uiItemL(layout, "No mesh in active object.", ICON_ERROR); + } +} + static void node_shader_buts_uvalongstroke(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "use_tips", 0, NULL, 0); @@ -1188,7 +1181,7 @@ static void node_shader_buts_ambient_occlusion(uiLayout *layout, static void node_shader_buts_white_noise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "dimensions", 0, "", ICON_NONE); + uiItemR(layout, ptr, "noise_dimensions", 0, "", ICON_NONE); } /* only once called */ @@ -1266,6 +1259,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_NOISE: + ntype->draw_buttons = node_shader_buts_tex_noise; + break; case SH_NODE_TEX_POINTDENSITY: ntype->draw_buttons = node_shader_buts_tex_pointdensity; break; @@ -1315,6 +1311,9 @@ static void node_shader_set_butfunc(bNodeType *ntype) case SH_NODE_UVMAP: ntype->draw_buttons = node_shader_buts_uvmap; break; + case SH_NODE_VERTEX_COLOR: + ntype->draw_buttons = node_shader_buts_vertex_color; + break; case SH_NODE_UVALONGSTROKE: ntype->draw_buttons = node_shader_buts_uvalongstroke; break; @@ -2703,6 +2702,10 @@ static void node_composit_buts_denoise(uiLayout *layout, bContext *UNUSED(C), Po { #ifndef WITH_OPENIMAGEDENOISE uiItemL(layout, IFACE_("Disabled, built without OpenImageDenoise"), ICON_ERROR); +#else + if (!BLI_cpu_support_sse41()) { + uiItemL(layout, IFACE_("Disabled, CPU with SSE4.1 is required"), ICON_ERROR); + } #endif uiItemR(layout, ptr, "use_hdr", 0, NULL, ICON_NONE); @@ -3143,12 +3146,12 @@ static void node_template_properties_update(bNodeType *ntype) bNodeSocketTemplate *stemp; if (ntype->inputs) { - for (stemp = ntype->inputs; stemp->type >= 0; ++stemp) { + for (stemp = ntype->inputs; stemp->type >= 0; stemp++) { node_socket_template_properties_update(ntype, stemp); } } if (ntype->outputs) { - for (stemp = ntype->outputs; stemp->type >= 0; ++stemp) { + for (stemp = ntype->outputs; stemp->type >= 0; stemp++) { node_socket_template_properties_update(ntype, stemp); } } @@ -3769,7 +3772,7 @@ static void nodelink_batch_init(void) GPU_vertbuf_data_alloc(vbo, vcount); int v = 0; - for (int k = 0; k < 2; ++k) { + for (int k = 0; k < 2; k++) { unsigned char uv[2] = {0, 0}; float pos[2] = {0.0f, 0.0f}; float exp[2] = {0.0f, 1.0f}; @@ -3780,7 +3783,7 @@ static void nodelink_batch_init(void) } /* curve strip */ - for (int i = 0; i < LINK_RESOL; ++i) { + for (int i = 0; i < LINK_RESOL; i++) { uv[0] = 255 * (i / (float)(LINK_RESOL - 1)); uv[1] = 0; set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp); @@ -3796,7 +3799,7 @@ static void nodelink_batch_init(void) copy_v2_v2(exp, arrow_expand_axis[0]); set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp); /* arrow */ - for (int i = 0; i < 3; ++i) { + for (int i = 0; i < 3; i++) { uv[1] = 0; copy_v2_v2(pos, arrow_verts[i]); copy_v2_v2(exp, arrow_expand_axis[i]); @@ -3887,7 +3890,9 @@ static void nodelink_batch_draw(SpaceNode *snode) void nodelink_batch_start(SpaceNode *UNUSED(snode)) { - g_batch_link.enabled = true; + /* TODO: partial workaround for NVIDIA driver bug on recent GTX/RTX cards, + * that breaks instancing when using indirect draw-call (see T70011). */ + g_batch_link.enabled = !GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY); } void nodelink_batch_end(SpaceNode *snode) |