Cleanup: Overlay: Remove global DST access through DRW_text_cache_ensure

This commit is contained in:
Clément Foucault
2024-12-05 20:03:05 +01:00
parent 9c7e18f515
commit 568d45a90d
3 changed files with 4 additions and 5 deletions

View File

@@ -1516,7 +1516,6 @@ static void draw_bone_name(const Armatures::DrawContext *ctx,
const UnifiedBonePtr bone,
const eBone_Flag boneflag)
{
DRWTextStore *dt = DRW_text_cache_ensure();
uchar color[4];
float vec[3];
@@ -1538,7 +1537,7 @@ static void draw_bone_name(const Armatures::DrawContext *ctx,
mid_v3_v3v3(vec, head, tail);
mul_m4_v3(ctx->ob->object_to_world().ptr(), vec);
DRW_text_cache_add(dt,
DRW_text_cache_add(ctx->dt,
vec,
is_pose ? pchan->name : eBone->name,
is_pose ? strlen(pchan->name) : strlen(eBone->name),

View File

@@ -444,6 +444,7 @@ class Armatures : Overlay {
Armatures::BoneBuffers *bone_buf = nullptr;
Resources *res = nullptr;
DRWTextStore *dt = nullptr;
/* Not a theme, this is an override. */
const float *const_color = nullptr;
@@ -474,6 +475,7 @@ class Armatures : Overlay {
ctx.ob = ob_ref.object;
ctx.ob_ref = &ob_ref;
ctx.res = &res;
ctx.dt = state.dt;
ctx.draw_mode = draw_mode;
ctx.drawtype = eArmature_Drawtype(arm->drawtype);

View File

@@ -513,9 +513,7 @@ class Cameras : Overlay {
}
if ((v3d->flag2 & V3D_SHOW_BUNDLENAME) && !is_selection) {
DRWTextStore *dt = DRW_text_cache_ensure();
DRW_text_cache_add(dt,
DRW_text_cache_add(state.dt,
bundle_mat[3],
track->name,
strlen(track->name),