From 14ea0c5fccfdbd8d244758709185160e45222dc3 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 21 Jun 2017 19:24:57 +0200 Subject: Fix T51849: change Cycles clearcoat gloss to roughness. This is compatible with UE4 and more consistent with specular and transmission roughness, even if it deviates from the original Disney BRDF. --- source/blender/gpu/shaders/gpu_shader_material.glsl | 4 ++-- source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index f6b39d77dc7..a7ff8c1529f 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -2621,7 +2621,7 @@ void node_bsdf_toon(vec4 color, float size, float tsmooth, vec3 N, out vec4 resu void node_bsdf_principled(vec4 base_color, float subsurface, vec3 subsurface_radius, vec4 subsurface_color, float metallic, float specular, float specular_tint, float roughness, float anisotropic, float anisotropic_rotation, float sheen, float sheen_tint, float clearcoat, - float clearcoat_gloss, float ior, float transmission, float transmission_roughness, vec3 N, vec3 CN, vec3 T, vec3 I, out vec4 result) + float clearcoat_roughness, float ior, float transmission, float transmission_roughness, vec3 N, vec3 CN, vec3 T, vec3 I, out vec4 result) { /* ambient light */ // TODO: set ambient light to an appropriate value @@ -2725,7 +2725,7 @@ void node_bsdf_principled(vec4 base_color, float subsurface, vec3 subsurface_rad //float FH = schlick_fresnel(LdotH); // clearcoat (ior = 1.5 -> F0 = 0.04) - float Dr = GTR1(CNdotH, mix(0.1, 0.001, clearcoat_gloss)); + float Dr = GTR1(CNdotH, sqr(clearcoat_roughness)); float Fr = fresnel_dielectric_cos(LdotH, 1.5); //mix(0.04, 1.0, FH); float Gr = smithG_GGX(CNdotL, 0.25) * smithG_GGX(CNdotV, 0.25); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c index 44288db182a..e0330d110ca 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c @@ -43,7 +43,7 @@ static bNodeSocketTemplate sh_node_bsdf_principled_in[] = { { SOCK_FLOAT, 1, N_("Sheen"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Sheen Tint"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Clearcoat"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - { SOCK_FLOAT, 1, N_("Clearcoat Gloss"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Clearcoat Roughness"), 0.03f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, { SOCK_FLOAT, 1, N_("Transmission"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Transmission Roughness"),0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, -- cgit v1.2.3 From 968093ec2f6def428f25437372b1cca5a27eb209 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 21 Jun 2017 21:31:08 +0200 Subject: Fix T51862: principled shader GLSL artifacts in ortho mode. --- source/blender/gpu/shaders/gpu_shader_material.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index a7ff8c1529f..ef2060122e0 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -2630,7 +2630,7 @@ void node_bsdf_principled(vec4 base_color, float subsurface, vec3 subsurface_rad float eta = (2.0 / (1.0 - sqrt(0.08 * specular))) - 1.0; /* set the viewing vector */ - vec3 V = -normalize(I); + vec3 V = (gl_ProjectionMatrix[3][3] == 0.0) ? -normalize(I) : vec3(0.0, 0.0, 1.0); /* get the tangent */ vec3 Tangent = T; -- cgit v1.2.3 From be4b5551c7a4f0f5be1d6fc55c87c890ee0ddb27 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Thu, 22 Jun 2017 10:25:05 +0200 Subject: Fix T51863: CompositorNodeSwitchView have the wrong rna API Although the original report was about the docs, the real issue was in the API. My original commit started from a copy-paste from the Switch Node. However I don't use custom1 for thew Switch View node. The docs is slightly incomplete since it would be nice to mention the views here. Or maybe even expose them via Python. But honestly they are generated depending on the scene multi-view settings. --- source/blender/makesrna/intern/rna_nodetree.c | 8 +------- source/blender/nodes/composite/nodes/node_composite_switchview.c | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 22d07d739cd..10422c85579 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -6320,14 +6320,8 @@ static void def_cmp_switch(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } -static void def_cmp_switch_view(StructRNA *srna) +static void def_cmp_switch_view(StructRNA *UNUSED(srna)) { - PropertyRNA *prop; - - prop = RNA_def_property(srna, "check", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "custom1", 0); - RNA_def_property_ui_text(prop, "Switch", "Off: first socket, On: second socket"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } static void def_cmp_colorcorrection(StructRNA *srna) diff --git a/source/blender/nodes/composite/nodes/node_composite_switchview.c b/source/blender/nodes/composite/nodes/node_composite_switchview.c index d805cf4d87f..e0d9fa33f13 100644 --- a/source/blender/nodes/composite/nodes/node_composite_switchview.c +++ b/source/blender/nodes/composite/nodes/node_composite_switchview.c @@ -137,7 +137,6 @@ static void init_switch_view(const bContext *C, PointerRNA *ptr) cmp_node_switch_view_sanitycheck(ntree, node); } -/* custom1 = mix type */ void register_node_type_cmp_switch_view(void) { static bNodeType ntype; -- cgit v1.2.3 From bddb4de47cd6c40c94a1104f6c35528cd26c4d9b Mon Sep 17 00:00:00 2001 From: raa Date: Fri, 23 Jun 2017 11:04:58 +0300 Subject: Fix T51845 --- source/blender/blenlib/BLI_rect.h | 1 + source/blender/blenlib/intern/rct.c | 8 ++++++++ source/blender/editors/interface/interface.c | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h index 041679ef876..21b9c75ac35 100644 --- a/source/blender/blenlib/BLI_rect.h +++ b/source/blender/blenlib/BLI_rect.h @@ -97,6 +97,7 @@ void BLI_rctf_union(struct rctf *rctf1, const struct rctf *rctf2); void BLI_rcti_rctf_copy(struct rcti *dst, const struct rctf *src); void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src); void BLI_rcti_rctf_copy_floor(struct rcti *dst, const struct rctf *src); +void BLI_rcti_rctf_copy_round(struct rcti *dst, const struct rctf *src); void BLI_rctf_rotate_expand(rctf *dst, const rctf *src, const float angle); diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index fd24a00156d..e0c4cbe9990 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -693,6 +693,14 @@ void BLI_rcti_rctf_copy_floor(rcti *dst, const rctf *src) dst->ymax = floorf(src->ymax); } +void BLI_rcti_rctf_copy_round(rcti *dst, const rctf *src) +{ + dst->xmin = floorf(src->xmin + 0.5f); + dst->xmax = floorf(src->xmax + 0.5f); + dst->ymin = floorf(src->ymin + 0.5f); + dst->ymax = floorf(src->ymax + 0.5f); +} + void BLI_rctf_rcti_copy(rctf *dst, const rcti *src) { dst->xmin = src->xmin; diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 64b26406f84..2ebdf6d214e 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1337,7 +1337,7 @@ static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, u rctf rectf; ui_block_to_window_rctf(ar, block, &rectf, (but) ? &but->rect : &block->rect); - BLI_rcti_rctf_copy(rect, &rectf); + BLI_rcti_rctf_copy_round(rect, &rectf); BLI_rcti_translate(rect, -ar->winrct.xmin, -ar->winrct.ymin); } -- cgit v1.2.3 From c2d285f0ffc03a02ad6c48e30bb90063da19a976 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 23 Jun 2017 10:32:03 +0200 Subject: Grease Pencil: Fix hardcoded DKEY for continous drawing --- source/blender/editors/gpencil/gpencil_paint.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 5eacbf6f807..eb49060b629 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -162,6 +162,8 @@ typedef struct tGPsdata { bGPDbrush *brush; /* current drawing brush */ short straight[2]; /* 1: line horizontal, 2: line vertical, other: not defined, second element position */ int lock_axis; /* lock drawing to one axis */ + + short keymodifier; /* key used for invoking the operator */ } tGPsdata; /* ------ */ @@ -1940,7 +1942,7 @@ static void gpencil_draw_cancel(bContext *C, wmOperator *op) /* ------------------------------- */ -static int gpencil_draw_init(bContext *C, wmOperator *op) +static int gpencil_draw_init(bContext *C, wmOperator *op, const wmEvent *event) { tGPsdata *p; eGPencil_PaintModes paintmode = RNA_enum_get(op->ptr, "mode"); @@ -1959,6 +1961,13 @@ static int gpencil_draw_init(bContext *C, wmOperator *op) gpencil_draw_exit(C, op); return 0; } + + if (event != NULL) { + p->keymodifier = event->keymodifier; + } + else { + p->keymodifier = -1; + } /* everything is now setup ok */ return 1; @@ -2200,7 +2209,7 @@ static int gpencil_draw_exec(bContext *C, wmOperator *op) /* printf("GPencil - Starting Re-Drawing\n"); */ /* try to initialize context data needed while drawing */ - if (!gpencil_draw_init(C, op)) { + if (!gpencil_draw_init(C, op, NULL)) { if (op->customdata) MEM_freeN(op->customdata); /* printf("\tGP - no valid data\n"); */ return OPERATOR_CANCELLED; @@ -2275,7 +2284,7 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event printf("GPencil - Starting Drawing\n"); /* try to initialize context data needed while drawing */ - if (!gpencil_draw_init(C, op)) { + if (!gpencil_draw_init(C, op, event)) { if (op->customdata) MEM_freeN(op->customdata); if (G.debug & G_DEBUG) @@ -2438,7 +2447,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) * is essential for ensuring that they can quickly return to that view */ } - else if ((ELEM(event->type, DKEY)) && (event->val == KM_RELEASE)) { + else if ((ELEM(event->type, p->keymodifier)) && (event->val == KM_RELEASE)) { /* enable continuous if release D key in mid drawing */ p->scene->toolsettings->gpencil_flags |= GP_TOOL_FLAG_PAINTSESSIONS_ON; } -- cgit v1.2.3 From f51438aea0ec2f15b5a2285216d21d821bbaad79 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 24 Jun 2017 18:02:30 +0200 Subject: Fix T51792: crash calling bpy.ops.screen.animation_cancel while scrubbing. --- source/blender/editors/screen/screen_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 9dbc082c119..c99d9add432 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3756,7 +3756,7 @@ static int screen_animation_cancel_exec(bContext *C, wmOperator *op) bScreen *screen = ED_screen_animation_playing(CTX_wm_manager(C)); if (screen) { - if (RNA_boolean_get(op->ptr, "restore_frame")) { + if (RNA_boolean_get(op->ptr, "restore_frame") && screen->animtimer) { ScreenAnimData *sad = screen->animtimer->customdata; Scene *scene = CTX_data_scene(C); -- cgit v1.2.3 From ce531ed1a12edcc51b717cbc12e38e8550e8f979 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 24 Jun 2017 16:44:48 +0200 Subject: Fix T50856: crash when minimizing window on AMD / Windows. --- source/blender/windowmanager/intern/wm_draw.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'source') diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 77ffa46b990..25c6980f58e 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -926,15 +926,14 @@ void wm_draw_update(bContext *C) for (win = wm->windows.first; win; win = win->next) { #ifdef WIN32 - if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_ANY, GPU_DRIVER_ANY)) { - GHOST_TWindowState state = GHOST_GetWindowState(win->ghostwin); - - if (state == GHOST_kWindowStateMinimized) { - /* do not update minimized windows, it gives issues on intel drivers (see [#33223]) - * anyway, it seems logical to skip update for invisible windows - */ - continue; - } + GHOST_TWindowState state = GHOST_GetWindowState(win->ghostwin); + + if (state == GHOST_kWindowStateMinimized) { + /* do not update minimized windows, gives issues on Intel (see T33223) + * and AMD (see T50856). it seems logical to skip update for invisible + * window anyway. + */ + continue; } #endif if (win->drawmethod != U.wmdrawmethod) { -- cgit v1.2.3