Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-07-21 13:23:10 +0300
committerJacques Lucke <jacques@blender.org>2022-07-21 13:23:38 +0300
commit538da79c6d17a6e660a9484c280220240b306282 (patch)
tree1b199687ae13b8a425b19a989479a9889d177d4d /source/blender/editors/object/object_modifier.cc
parentd099e0d2a4875b03c6b91c39817ffc11c4357797 (diff)
Curves: fix applying materials when applying modifier
The issue was that geometry nodes was run on the original curves, and set a pointer to an evaluated material id on it. The fix is to not mix up original and evaluated data by making sure that geometry nodes does not modify the original data.
Diffstat (limited to 'source/blender/editors/object/object_modifier.cc')
-rw-r--r--source/blender/editors/object/object_modifier.cc15
1 files changed, 6 insertions, 9 deletions
diff --git a/source/blender/editors/object/object_modifier.cc b/source/blender/editors/object/object_modifier.cc
index a3a41a5c5b1..e7cfcf48fd3 100644
--- a/source/blender/editors/object/object_modifier.cc
+++ b/source/blender/editors/object/object_modifier.cc
@@ -818,7 +818,7 @@ static bool modifier_apply_obdata(
/* Create a temporary geometry set and component. */
GeometrySet geometry_set;
geometry_set.get_component_for_write<CurveComponent>().replace(
- &curves, GeometryOwnershipType::Editable);
+ &curves, GeometryOwnershipType::ReadOnly);
ModifierEvalContext mectx = {depsgraph, ob, (ModifierApplyFlag)0};
mti->modifyGeometrySet(md_eval, &mectx, &geometry_set);
@@ -833,14 +833,11 @@ static bool modifier_apply_obdata(
.attributes_for_write()
.remove_anonymous();
- /* If the modifier's output is a different curves data-block, copy the relevant information to
- * the original. */
- if (&curves_eval != &curves) {
- blender::bke::CurvesGeometry::wrap(curves.geometry) = std::move(
- blender::bke::CurvesGeometry::wrap(curves_eval.geometry));
- Main *bmain = DEG_get_bmain(depsgraph);
- BKE_object_material_from_eval_data(bmain, ob, &curves_eval.id);
- }
+ /* Copy the relevant information to the original. */
+ blender::bke::CurvesGeometry::wrap(curves.geometry) = std::move(
+ blender::bke::CurvesGeometry::wrap(curves_eval.geometry));
+ Main *bmain = DEG_get_bmain(depsgraph);
+ BKE_object_material_from_eval_data(bmain, ob, &curves_eval.id);
}
else {
/* TODO: implement for point clouds and volumes. */