diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-01-14 18:55:44 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-01-14 18:55:44 +0300 |
commit | ca994239bc2763cf011a54411984de08ea1a413c (patch) | |
tree | 261d8cf23c59bb5ed714a2ff1cf6bb4fd8787de4 /source/blender | |
parent | 388d43d85a5d9dfc5261848c91c12dd883ea1f59 (diff) | |
parent | 39d5d11e022a39383103f1e46dd74dbf5a36a850 (diff) |
Merge branch 'blender-v2.82-release'
Diffstat (limited to 'source/blender')
6 files changed, 36 insertions, 18 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl index b9a971570df..359e6fe4cc2 100644 --- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl @@ -934,6 +934,11 @@ void main() vec3 vol_transmit, vol_scatter; volumetric_resolve(uvs, gl_FragCoord.z, vol_transmit, vol_scatter); + /* Removes part of the volume scattering that have + * already been added to the destination pixels. + * Since we do that using the blending pipeline we need to account for material transmittance. */ + vol_scatter -= vol_scatter * cl.transmittance; + outRadiance = vec4(cl.radiance * vol_transmit + vol_scatter, alpha * holdout); outTransmittance = vec4(cl.transmittance, transmit * holdout); # else diff --git a/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl b/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl index 21f8bcf1791..a2fa82d151e 100644 --- a/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl @@ -105,7 +105,7 @@ void main() vec3 wnor = normalize(normal_object_to_world(nor)); bool is_persp = (ProjectionMatrix[3][3] == 0.0); - vec3 V = (is_persp) ? normalize(ViewMatrixInverse[3].xyz - wpos) : ViewMatrix[2].xyz; + vec3 V = (is_persp) ? normalize(ViewMatrixInverse[3].xyz - wpos) : ViewMatrixInverse[2].xyz; float facing = dot(wnor, V); float facing_ratio = clamp(1.0 - facing * facing, 0.0, 1.0); @@ -120,7 +120,7 @@ void main() gl_Position.xy += wofs.xy * sizeViewportInv.xy * gl_Position.w; /* Push the vertex towards the camera. Helps a bit. */ - gl_Position.z -= facing_ratio * curvature * 1e-4; + gl_Position.z -= facing_ratio * curvature * 4.0e-5; /* Convert to screen position [0..sizeVp]. */ edgeStart = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport.xy; diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c index 0a9984762b0..7de6ee2b3b1 100644 --- a/source/blender/draw/intern/draw_cache_impl_particles.c +++ b/source/blender/draw/intern/draw_cache_impl_particles.c @@ -894,11 +894,13 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit GPU_vertbuf_data_alloc(cache->proc_uv_buf[i], cache->strands_len); GPU_vertbuf_attr_get_raw_data(cache->proc_uv_buf[i], uv_id, &uv_step[i]); + char attr_safe_name[GPU_MAX_SAFE_ATTRIB_NAME]; const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPUV, i); - uint hash = BLI_ghashutil_strhash_p(name); + GPU_vertformat_safe_attrib_name(name, attr_safe_name, GPU_MAX_SAFE_ATTRIB_NAME); + int n = 0; - BLI_snprintf(cache->uv_layer_names[i][n++], MAX_LAYER_NAME_LEN, "u%u", hash); - BLI_snprintf(cache->uv_layer_names[i][n++], MAX_LAYER_NAME_LEN, "a%u", hash); + BLI_snprintf(cache->uv_layer_names[i][n++], MAX_LAYER_NAME_LEN, "u%s", attr_safe_name); + BLI_snprintf(cache->uv_layer_names[i][n++], MAX_LAYER_NAME_LEN, "a%s", attr_safe_name); if (i == active_uv) { BLI_strncpy(cache->uv_layer_names[i][n++], "au", MAX_LAYER_NAME_LEN); @@ -913,14 +915,16 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit GPU_vertbuf_data_alloc(cache->proc_col_buf[i], cache->strands_len); GPU_vertbuf_attr_get_raw_data(cache->proc_col_buf[i], col_id, &col_step[i]); + char attr_safe_name[GPU_MAX_SAFE_ATTRIB_NAME]; const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPCOL, i); - uint hash = BLI_ghashutil_strhash_p(name); + GPU_vertformat_safe_attrib_name(name, attr_safe_name, GPU_MAX_SAFE_ATTRIB_NAME); + int n = 0; - BLI_snprintf(cache->col_layer_names[i][n++], MAX_LAYER_NAME_LEN, "c%u", hash); + BLI_snprintf(cache->col_layer_names[i][n++], MAX_LAYER_NAME_LEN, "c%s", attr_safe_name); /* We only do vcols auto name that are not overridden by uvs */ if (CustomData_get_named_layer_index(&psmd->mesh_final->ldata, CD_MLOOPUV, name) == -1) { - BLI_snprintf(cache->col_layer_names[i][n++], MAX_LAYER_NAME_LEN, "a%u", hash); + BLI_snprintf(cache->col_layer_names[i][n++], MAX_LAYER_NAME_LEN, "a%s", attr_safe_name); } if (i == active_col) { @@ -1176,10 +1180,12 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit, col_id = MEM_mallocN(sizeof(*col_id) * num_col_layers, "Col attr format"); for (int i = 0; i < num_uv_layers; i++) { + + char uuid[32], attr_safe_name[GPU_MAX_SAFE_ATTRIB_NAME]; const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPUV, i); - char uuid[32]; + GPU_vertformat_safe_attrib_name(name, attr_safe_name, GPU_MAX_SAFE_ATTRIB_NAME); - BLI_snprintf(uuid, sizeof(uuid), "u%u", BLI_ghashutil_strhash_p(name)); + BLI_snprintf(uuid, sizeof(uuid), "u%s", attr_safe_name); uv_id[i] = GPU_vertformat_attr_add(&format, uuid, GPU_COMP_F32, 2, GPU_FETCH_FLOAT); if (i == active_uv) { @@ -1187,11 +1193,12 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit, } } - for (int i = 0; i < num_uv_layers; i++) { - const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPUV, i); - char uuid[32]; + for (int i = 0; i < num_col_layers; i++) { + char uuid[32], attr_safe_name[GPU_MAX_SAFE_ATTRIB_NAME]; + const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPCOL, i); + GPU_vertformat_safe_attrib_name(name, attr_safe_name, GPU_MAX_SAFE_ATTRIB_NAME); - BLI_snprintf(uuid, sizeof(uuid), "c%u", BLI_ghashutil_strhash_p(name)); + BLI_snprintf(uuid, sizeof(uuid), "c%s", attr_safe_name); col_id[i] = GPU_vertformat_attr_add(&format, uuid, GPU_COMP_F32, 2, GPU_FETCH_FLOAT); if (i == active_col) { diff --git a/source/blender/draw/intern/draw_hair_private.h b/source/blender/draw/intern/draw_hair_private.h index 6eaba7e8811..c03b4822b1b 100644 --- a/source/blender/draw/intern/draw_hair_private.h +++ b/source/blender/draw/intern/draw_hair_private.h @@ -25,7 +25,7 @@ #define __DRAW_HAIR_PRIVATE_H__ #define MAX_LAYER_NAME_CT 4 /* u0123456789, u, au, a0123456789 */ -#define MAX_LAYER_NAME_LEN DECIMAL_DIGITS_BOUND(uint) + 2 +#define MAX_LAYER_NAME_LEN GPU_MAX_SAFE_ATTRIB_NAME + 2 #define MAX_THICKRES 2 /* see eHairType */ #define MAX_HAIR_SUBDIV 4 /* see hair_subdiv rna */ diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 98bee156090..29626fb6a8f 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1437,6 +1437,11 @@ static void region_rect_recursive( BLI_rcti_init(remainder, 0, 0, 0, 0); } + /* Fix any negative dimensions. This can happen when a quad split 3d view gets to small. (see + * T72200). BLI_rcti_init() sanitizes, making sure min values are <= max values. */ + BLI_rcti_init( + &ar->winrct, ar->winrct.xmin, ar->winrct.xmax, ar->winrct.ymin, ar->winrct.ymax); + quad++; } } @@ -2897,7 +2902,7 @@ void ED_region_info_draw(ARegion *ar, float fill_color[4], const bool full_redraw) { - ED_region_info_draw_multiline(ar, (const char *[2]){text, NULL}, fill_color, full_redraw); + ED_region_info_draw_multiline(ar, (const char * [2]){text, NULL}, fill_color, full_redraw); } #define MAX_METADATA_STR 1024 diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index ee3dceb6acd..589375530f5 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -578,7 +578,8 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad ED_sequencer_deselect_all(scene); } - if (RNA_struct_property_is_set(op->ptr, "files")) { + if (RNA_struct_property_is_set(op->ptr, "files") && + RNA_struct_property_is_set(op->ptr, "directory")) { tot_files = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); } @@ -591,7 +592,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad char dir_only[FILE_MAX]; char file_only[FILE_MAX]; - BLI_split_dir_part(seq_load.path, dir_only, sizeof(dir_only)); + RNA_string_get(op->ptr, "directory", dir_only); RNA_BEGIN (op->ptr, itemptr, "files") { Sequence *seq; |