diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/geometry_component_curve.cc | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 1 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 1 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_cryptomatte.c | 10 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_private.h | 1 | ||||
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 25 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_layer_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 7 |
8 files changed, 24 insertions, 29 deletions
diff --git a/source/blender/blenkernel/intern/geometry_component_curve.cc b/source/blender/blenkernel/intern/geometry_component_curve.cc index 0b80ff5acdf..598c61fd877 100644 --- a/source/blender/blenkernel/intern/geometry_component_curve.cc +++ b/source/blender/blenkernel/intern/geometry_component_curve.cc @@ -555,7 +555,8 @@ static void point_attribute_materialize(Span<Span<T>> data, else { int spline_index = 0; for (const int dst_index : mask) { - while (offsets[spline_index] < dst_index) { + /* Skip splines that don't have any control points in the mask. */ + while (dst_index >= offsets[spline_index + 1]) { spline_index++; } @@ -599,7 +600,8 @@ static void point_attribute_materialize_to_uninitialized(Span<Span<T>> data, else { int spline_index = 0; for (const int dst_index : mask) { - while (offsets[spline_index] < dst_index) { + /* Skip splines that don't have any control points in the mask. */ + while (dst_index >= offsets[spline_index + 1]) { spline_index++; } diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index e51442b705d..6aa8e78c4f6 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -183,6 +183,7 @@ static ViewLayer *view_layer_add(const char *name) view_layer->passflag = SCE_PASS_COMBINED; view_layer->pass_alpha_threshold = 0.5f; view_layer->cryptomatte_levels = 6; + view_layer->cryptomatte_flag = VIEW_LAYER_CRYPTOMATTE_ACCURATE; BKE_freestyle_config_init(&view_layer->freestyle_config); return view_layer; diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index f82b7970a60..888bd244007 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -1435,6 +1435,7 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) { view_layer->cryptomatte_levels = 6; + view_layer->cryptomatte_flag = VIEW_LAYER_CRYPTOMATTE_ACCURATE; } } } diff --git a/source/blender/draw/engines/eevee/eevee_cryptomatte.c b/source/blender/draw/engines/eevee/eevee_cryptomatte.c index 4c9ce9dbd65..1b8e967e38f 100644 --- a/source/blender/draw/engines/eevee/eevee_cryptomatte.c +++ b/source/blender/draw/engines/eevee/eevee_cryptomatte.c @@ -139,6 +139,8 @@ void EEVEE_cryptomatte_renderpasses_init(EEVEE_Data *vedata) g_data->cryptomatte_session = session; g_data->render_passes |= EEVEE_RENDER_PASS_CRYPTOMATTE | EEVEE_RENDER_PASS_VOLUME_LIGHT; + g_data->cryptomatte_accurate_mode = (view_layer->cryptomatte_flag & + VIEW_LAYER_CRYPTOMATTE_ACCURATE) != 0; } } @@ -403,6 +405,7 @@ void EEVEE_cryptomatte_output_accumulate(EEVEE_ViewLayerData *UNUSED(sldata), EE { EEVEE_FramebufferList *fbl = vedata->fbl; EEVEE_StorageList *stl = vedata->stl; + EEVEE_PrivateData *g_data = stl->g_data; EEVEE_EffectsInfo *effects = stl->effects; EEVEE_PassList *psl = vedata->psl; const DRWContextState *draw_ctx = DRW_context_state_get(); @@ -410,9 +413,10 @@ void EEVEE_cryptomatte_output_accumulate(EEVEE_ViewLayerData *UNUSED(sldata), EE const int cryptomatte_levels = view_layer->cryptomatte_levels; const int current_sample = effects->taa_current_sample; - /* Render samples used by cryptomatte are limited to the number of cryptomatte levels. This will - * reduce the overhead of downloading the GPU buffer and integrating it into the accum buffer. */ - if (current_sample < cryptomatte_levels) { + /* In accurate mode all render samples are evaluated. In inaccurate mode this is limited to the + * number of cryptomatte levels. This will reduce the overhead of downloading the GPU buffer and + * integrating it into the accum buffer. */ + if (g_data->cryptomatte_accurate_mode || current_sample < cryptomatte_levels) { static float clear_color[4] = {0.0}; GPU_framebuffer_bind(fbl->cryptomatte_fb); GPU_framebuffer_clear_color(fbl->cryptomatte_fb, clear_color); diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index eae5d161cc3..f51b4fa0127 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -1042,6 +1042,7 @@ typedef struct EEVEE_PrivateData { int aov_hash; int num_aovs_used; struct CryptomatteSession *cryptomatte_session; + bool cryptomatte_accurate_mode; EEVEE_CryptomatteSample *cryptomatte_accum_buffer; float *cryptomatte_download_buffer; diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index d32e947d688..1fb8132852a 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -922,19 +922,6 @@ static void prepare_filter_asset_library(const FileList *filelist, FileListFilte } /** - * Copy a string from source to `dest`, but prefix and suffix it with a single space. - * Assumes `dest` has at least space enough for the two spaces. - */ -static void tag_copy_with_spaces(char *dest, const char *source, const size_t dest_size) -{ - BLI_assert(dest_size > 2); - const size_t source_length = BLI_strncpy_rlen(dest + 1, source, dest_size - 2); - dest[0] = ' '; - dest[source_length + 1] = ' '; - dest[source_length + 2] = '\0'; -} - -/** * Return whether at least one tag matches the search filter. * Tags are searched as "entire words", so instead of searching for "tag" in the * filter string, this function searches for " tag ". Assumes the search filter @@ -949,9 +936,7 @@ static void tag_copy_with_spaces(char *dest, const char *source, const size_t de static bool asset_tag_matches_filter(const char *filter_search, const AssetMetaData *asset_data) { LISTBASE_FOREACH (const AssetTag *, asset_tag, &asset_data->tags) { - char tag_name[MAX_NAME + 2]; /* sizeof(AssetTag::name) + 2 */ - tag_copy_with_spaces(tag_name, asset_tag->name, sizeof(tag_name)); - if (BLI_strcasestr(filter_search, tag_name) != NULL) { + if (BLI_strcasestr(asset_tag->name, filter_search) != NULL) { return true; } } @@ -982,13 +967,7 @@ static bool is_filtered_asset(FileListInternEntry *file, FileListFilter *filter) if (BLI_strcasestr(file->name, filter_search + 1) != NULL) { return true; } - - /* Replace the asterisks with spaces, so that we can do matching on " sometag "; that way - * an artist searching for "redder" doesn't result in a match for the tag "red". */ - filter_search[string_length - 1] = ' '; - filter_search[0] = ' '; - - return asset_tag_matches_filter(filter_search, asset_data); + return asset_tag_matches_filter(filter_search + 1, asset_data); } static bool is_filtered_lib_type(FileListInternEntry *file, diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h index 520f989452c..63e4597150c 100644 --- a/source/blender/makesdna/DNA_layer_types.h +++ b/source/blender/makesdna/DNA_layer_types.h @@ -68,7 +68,7 @@ typedef enum eViewLayerCryptomatteFlags { VIEW_LAYER_CRYPTOMATTE_OBJECT = (1 << 0), VIEW_LAYER_CRYPTOMATTE_MATERIAL = (1 << 1), VIEW_LAYER_CRYPTOMATTE_ASSET = (1 << 2), - /* VIEW_LAYER_CRYPTOMATTE_ACCURATE = (1 << 3), */ /* DEPRECATED */ + VIEW_LAYER_CRYPTOMATTE_ACCURATE = (1 << 3), } eViewLayerCryptomatteFlags; #define VIEW_LAYER_CRYPTOMATTE_ALL \ (VIEW_LAYER_CRYPTOMATTE_OBJECT | VIEW_LAYER_CRYPTOMATTE_MATERIAL | VIEW_LAYER_CRYPTOMATTE_ASSET) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 3468cab9eea..c69a69290f9 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -4166,6 +4166,13 @@ void rna_def_view_layer_common(BlenderRNA *brna, StructRNA *srna, const bool sce prop, "Cryptomatte Levels", "Sets how many unique objects can be distinguished per pixel"); RNA_def_property_ui_range(prop, 2.0, 16.0, 2.0, 0.0); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); + + prop = RNA_def_property(srna, "use_pass_cryptomatte_accurate", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cryptomatte_flag", VIEW_LAYER_CRYPTOMATTE_ACCURATE); + RNA_def_property_boolean_default(prop, true); + RNA_def_property_ui_text( + prop, "Cryptomatte Accurate", "Generate a more accurate cryptomatte pass"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); } prop = RNA_def_property(srna, "use_solid", PROP_BOOLEAN, PROP_NONE); |