Fix #119350: shifting text overlay text

The issue was that the object location was taken into account twice using
`object_to_world` and `ob->loc`.

Pull Request: https://projects.blender.org/blender/blender/pulls/119378
This commit is contained in:
Jacques Lucke
2024-03-12 17:32:52 +01:00
parent 1982cad490
commit ac8835f18b

View File

@@ -106,7 +106,6 @@ static void add_attributes_to_text_cache(bke::AttributeAccessor attribute_access
static void add_instance_attributes_to_text_cache(bke::AttributeAccessor attribute_accessor,
const float4x4 &object_to_world,
float3 position,
int instance_index)
{
/* Data from instances are read as a single value from a given index. The data is converted back
@@ -114,7 +113,7 @@ static void add_instance_attributes_to_text_cache(bke::AttributeAccessor attribu
const GVArray attribute = attribute_accessor.lookup(".viewer").varray.slice(
IndexRange(instance_index, 1));
add_values_to_text_cache(attribute, {position}, object_to_world);
add_values_to_text_cache(attribute, {float3(0, 0, 0)}, object_to_world);
}
} // namespace blender::draw::overlay
@@ -129,10 +128,8 @@ void OVERLAY_viewer_attribute_text(const Object &object)
if (dupli_object->preview_instance_index >= 0) {
const bke::Instances *instances = dupli_object->preview_base_geometry->get_instances();
if (instances->attributes().contains(".viewer")) {
add_instance_attributes_to_text_cache(instances->attributes(),
object_to_world,
dupli_object->ob->loc,
dupli_object->preview_instance_index);
add_instance_attributes_to_text_cache(
instances->attributes(), object_to_world, dupli_object->preview_instance_index);
return;
}