Cleanup: DRW: Remove unused functions and variables
This commit is contained in:
@@ -275,142 +275,6 @@ void DRW_globals_free() {}
|
||||
|
||||
/* ******************************************** COLOR UTILS ************************************ */
|
||||
|
||||
int DRW_object_wire_theme_get(Object *ob, ViewLayer *view_layer, float **r_color)
|
||||
{
|
||||
/* TODO: FINISH. */
|
||||
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
const bool is_edit = (draw_ctx->object_mode & OB_MODE_EDIT) && (ob->mode & OB_MODE_EDIT);
|
||||
BKE_view_layer_synced_ensure(draw_ctx->scene, view_layer);
|
||||
const Base *base = BKE_view_layer_active_base_get(view_layer);
|
||||
const bool active = base && ((ob->base_flag & BASE_FROM_DUPLI) ?
|
||||
(DRW_object_get_dupli_parent(ob) == base->object) :
|
||||
(base->object == ob));
|
||||
|
||||
/* confusing logic here, there are 2 methods of setting the color
|
||||
* 'colortab[colindex]' and 'theme_id', colindex overrides theme_id.
|
||||
*
|
||||
* NOTE: no theme yet for 'colindex'. */
|
||||
int theme_id = is_edit ? TH_WIRE_EDIT : TH_WIRE;
|
||||
|
||||
if (is_edit) {
|
||||
/* fallback to TH_WIRE */
|
||||
}
|
||||
else if (((G.moving & G_TRANSFORM_OBJ) != 0) && ((ob->base_flag & BASE_SELECTED) != 0)) {
|
||||
theme_id = TH_TRANSFORM;
|
||||
}
|
||||
else {
|
||||
/* Sets the 'theme_id' or fallback to wire */
|
||||
if ((ob->base_flag & BASE_SELECTED) != 0) {
|
||||
theme_id = (active) ? TH_ACTIVE : TH_SELECT;
|
||||
}
|
||||
else {
|
||||
switch (ob->type) {
|
||||
case OB_LAMP:
|
||||
theme_id = TH_LIGHT;
|
||||
break;
|
||||
case OB_SPEAKER:
|
||||
theme_id = TH_SPEAKER;
|
||||
break;
|
||||
case OB_CAMERA:
|
||||
theme_id = TH_CAMERA;
|
||||
break;
|
||||
case OB_EMPTY:
|
||||
theme_id = TH_EMPTY;
|
||||
break;
|
||||
case OB_LIGHTPROBE:
|
||||
/* TODO: add light-probe color. */
|
||||
theme_id = TH_EMPTY;
|
||||
break;
|
||||
default:
|
||||
/* fallback to TH_WIRE */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (r_color != nullptr) {
|
||||
if (UNLIKELY(ob->base_flag & BASE_FROM_SET)) {
|
||||
*r_color = G_draw.block.color_wire;
|
||||
}
|
||||
else {
|
||||
switch (theme_id) {
|
||||
case TH_WIRE_EDIT:
|
||||
*r_color = G_draw.block.color_wire_edit;
|
||||
break;
|
||||
case TH_ACTIVE:
|
||||
*r_color = G_draw.block.color_active;
|
||||
break;
|
||||
case TH_SELECT:
|
||||
*r_color = G_draw.block.color_select;
|
||||
break;
|
||||
case TH_TRANSFORM:
|
||||
*r_color = G_draw.block.color_transform;
|
||||
break;
|
||||
case TH_SPEAKER:
|
||||
*r_color = G_draw.block.color_speaker;
|
||||
break;
|
||||
case TH_CAMERA:
|
||||
*r_color = G_draw.block.color_camera;
|
||||
break;
|
||||
case TH_EMPTY:
|
||||
*r_color = G_draw.block.color_empty;
|
||||
break;
|
||||
case TH_LIGHT:
|
||||
*r_color = G_draw.block.color_light;
|
||||
break;
|
||||
default:
|
||||
*r_color = G_draw.block.color_wire;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return theme_id;
|
||||
}
|
||||
|
||||
float *DRW_color_background_blend_get(int theme_id)
|
||||
{
|
||||
/* XXX This is very stupid, better find something more general. */
|
||||
|
||||
static float colors[11][4];
|
||||
float *ret;
|
||||
|
||||
switch (theme_id) {
|
||||
case TH_WIRE_EDIT:
|
||||
ret = colors[0];
|
||||
break;
|
||||
case TH_ACTIVE:
|
||||
ret = colors[1];
|
||||
break;
|
||||
case TH_SELECT:
|
||||
ret = colors[2];
|
||||
break;
|
||||
case TH_TRANSFORM:
|
||||
ret = colors[5];
|
||||
break;
|
||||
case TH_SPEAKER:
|
||||
ret = colors[6];
|
||||
break;
|
||||
case TH_CAMERA:
|
||||
ret = colors[7];
|
||||
break;
|
||||
case TH_EMPTY:
|
||||
ret = colors[8];
|
||||
break;
|
||||
case TH_LIGHT:
|
||||
ret = colors[9];
|
||||
break;
|
||||
default:
|
||||
ret = colors[10];
|
||||
break;
|
||||
}
|
||||
|
||||
UI_GetThemeColorBlendShade4fv(theme_id, TH_BACK, 0.5, 0, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void DRW_evaluate_weight_to_color(const float weight, float result[4])
|
||||
{
|
||||
if (U.flag & USER_CUSTOM_RANGE) {
|
||||
|
||||
@@ -37,13 +37,6 @@ BLI_STATIC_ASSERT_ALIGN(GlobalsUboStorage, 16)
|
||||
void DRW_globals_update();
|
||||
void DRW_globals_free();
|
||||
|
||||
/**
|
||||
* Get the wire color theme_id of an object based on its state
|
||||
* \a r_color is a way to get a pointer to the static color var associated
|
||||
*/
|
||||
int DRW_object_wire_theme_get(Object *ob, ViewLayer *view_layer, float **r_color);
|
||||
float *DRW_color_background_blend_get(int theme_id);
|
||||
|
||||
/* draw_hair.cc */
|
||||
|
||||
/**
|
||||
@@ -114,8 +107,5 @@ struct DRW_Global {
|
||||
|
||||
GPUTexture *ramp;
|
||||
GPUTexture *weight_ramp;
|
||||
|
||||
GPUUniformBuf *view_ubo;
|
||||
GPUUniformBuf *clipping_ubo;
|
||||
};
|
||||
extern DRW_Global G_draw;
|
||||
|
||||
@@ -482,15 +482,6 @@ static void drw_manager_init(DRWManager *dst, GPUViewport *viewport, const int s
|
||||
ED_view3d_init_mats_rv3d(dst->draw_ctx.object_edit, rv3d);
|
||||
}
|
||||
|
||||
if (G_draw.view_ubo == nullptr) {
|
||||
G_draw.view_ubo = GPU_uniformbuf_create_ex(sizeof(ViewMatrices), nullptr, "G_draw.view_ubo");
|
||||
}
|
||||
|
||||
if (G_draw.clipping_ubo == nullptr) {
|
||||
G_draw.clipping_ubo = GPU_uniformbuf_create_ex(
|
||||
sizeof(float4) * 6, nullptr, "G_draw.clipping_ubo");
|
||||
}
|
||||
|
||||
memset(dst->object_instance_data, 0x0, sizeof(dst->object_instance_data));
|
||||
}
|
||||
|
||||
@@ -2949,8 +2940,6 @@ void DRW_engines_free()
|
||||
DST.debug = nullptr;
|
||||
|
||||
GPU_UBO_FREE_SAFE(G_draw.block_ubo);
|
||||
GPU_UBO_FREE_SAFE(G_draw.view_ubo);
|
||||
GPU_UBO_FREE_SAFE(G_draw.clipping_ubo);
|
||||
GPU_TEXTURE_FREE_SAFE(G_draw.ramp);
|
||||
GPU_TEXTURE_FREE_SAFE(G_draw.weight_ramp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user