Cleanup: Remove unnecessary unique_ptr usage for Line Art runtime

There is no need for this to be a unique pointer, the set can just be
stored directly.

Pull Request: https://projects.blender.org/blender/blender/pulls/131632
This commit is contained in:
Hans Goudey
2024-12-09 14:30:59 -05:00
committed by Gitea
parent 7baa22b49d
commit 363bc88ee7
4 changed files with 8 additions and 21 deletions

View File

@@ -95,14 +95,7 @@ static void copy_data(const ModifierData *md, ModifierData *target, const int fl
GreasePencilLineartModifierData *target_lmd =
reinterpret_cast<GreasePencilLineartModifierData *>(target);
target_lmd->runtime = MEM_new<LineartModifierRuntime>(__func__);
LineartModifierRuntime *target_runtime = target_lmd->runtime;
blender::Set<const Object *> *object_dependencies = source_runtime->object_dependencies.get();
if (object_dependencies) {
target_runtime->object_dependencies = std::make_unique<blender::Set<const Object *>>(
object_dependencies);
}
target_lmd->runtime = MEM_new<LineartModifierRuntime>(__func__, *source_runtime);
}
static void free_data(ModifierData *md)
@@ -184,20 +177,14 @@ static void update_depsgraph(ModifierData *md, const ModifierUpdateDepsgraphCont
if (!runtime) {
runtime = MEM_new<LineartModifierRuntime>(__func__);
lmd->runtime = runtime;
runtime->object_dependencies = nullptr;
}
Set<const Object *> *object_dependencies = runtime->object_dependencies.get();
if (!object_dependencies) {
runtime->object_dependencies = std::make_unique<Set<const Object *>>();
object_dependencies = runtime->object_dependencies.get();
}
Set<const Object *> &object_dependencies = runtime->object_dependencies;
object_dependencies.clear();
object_dependencies->clear();
add_this_collection(
*ctx->scene->master_collection, ctx, DAG_EVAL_VIEWPORT, *object_dependencies);
add_this_collection(*ctx->scene->master_collection, ctx, DAG_EVAL_VIEWPORT, object_dependencies);
/* No need to add any non-geometry objects into `lmd->object_dependencies` because we won't be
* loading */
* loading... */
if (lmd->calculation_flags & MOD_LINEART_USE_CUSTOM_CAMERA && lmd->source_camera) {
DEG_add_object_relation(
ctx->node, lmd->source_camera, DEG_OB_COMP_TRANSFORM, "Line Art Modifier");

View File

@@ -30,7 +30,7 @@ struct LineartModifierRuntime {
/* This list is constructed during `update_depsgraph()` call, and stays valid until the next
* update. This way line art can load objects from this list instead of iterating over all
* objects that may or may not have finished evaluating. */
std::unique_ptr<blender::Set<const Object *>> object_dependencies;
blender::Set<const Object *> object_dependencies;
};
struct LineartStaticMemPoolNode {

View File

@@ -5094,7 +5094,7 @@ bool MOD_lineart_compute_feature_lines_v3(Depsgraph *depsgraph,
lineart_main_get_view_vector(ld);
LineartModifierRuntime *runtime = reinterpret_cast<LineartModifierRuntime *>(lmd.runtime);
blender::Set<const Object *> *included_objects = runtime ? runtime->object_dependencies.get() :
blender::Set<const Object *> *included_objects = runtime ? &runtime->object_dependencies :
nullptr;
lineart_main_load_geometries(depsgraph,

View File

@@ -1252,7 +1252,7 @@ bool lineart_main_try_generate_shadow_v3(Depsgraph *depsgraph,
lineart_main_get_view_vector(ld);
LineartModifierRuntime *runtime = reinterpret_cast<LineartModifierRuntime *>(lmd->runtime);
blender::Set<const Object *> *included_objects = runtime ? runtime->object_dependencies.get() :
blender::Set<const Object *> *included_objects = runtime ? &runtime->object_dependencies :
nullptr;
lineart_main_load_geometries(depsgraph,