Draw Manager: Add center-color for linked/multiuser objects
Draws a blue center circle for library objects. As with regular drawing, this uses a hard-coded color.
This commit is contained in:
@@ -33,6 +33,14 @@
|
||||
|
||||
#include "draw_common.h"
|
||||
|
||||
|
||||
#if 0
|
||||
#define UI_COLOR_RGB_FROM_U8(r, g, b, v4) \
|
||||
ARRAY_SET_ITEMS(v4, (float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f, 1.0)
|
||||
#endif
|
||||
#define UI_COLOR_RGBA_FROM_U8(r, g, b, a, v4) \
|
||||
ARRAY_SET_ITEMS(v4, (float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f, (float)a / 255.0f)
|
||||
|
||||
/* Colors & Constant */
|
||||
GlobalsUboStorage ts;
|
||||
struct GPUUniformBuffer *globals_ubo = NULL;
|
||||
@@ -47,6 +55,8 @@ void DRW_globals_update(void)
|
||||
UI_GetThemeColor4fv(TH_GROUP_ACTIVE, ts.colorGroupActive);
|
||||
UI_GetThemeColorShade4fv(TH_GROUP_ACTIVE, -25, ts.colorGroupSelect);
|
||||
UI_GetThemeColor4fv(TH_GROUP, ts.colorGroup);
|
||||
UI_COLOR_RGBA_FROM_U8(0x88, 0xFF, 0xFF, 155, ts.colorLibrarySelect);
|
||||
UI_COLOR_RGBA_FROM_U8(0x55, 0xCC, 0xCC, 155, ts.colorLibrary);
|
||||
UI_GetThemeColor4fv(TH_LAMP, ts.colorLamp);
|
||||
UI_GetThemeColor4fv(TH_SPEAKER, ts.colorSpeaker);
|
||||
UI_GetThemeColor4fv(TH_CAMERA, ts.colorCamera);
|
||||
|
@@ -45,6 +45,8 @@ typedef struct GlobalsUboStorage {
|
||||
float colorGroupActive[4];
|
||||
float colorGroupSelect[4];
|
||||
float colorGroup[4];
|
||||
float colorLibrarySelect[4];
|
||||
float colorLibrary[4];
|
||||
float colorLamp[4];
|
||||
float colorSpeaker[4];
|
||||
float colorCamera[4];
|
||||
|
@@ -155,6 +155,8 @@ typedef struct g_data{
|
||||
DRWShadingGroup *center_active;
|
||||
DRWShadingGroup *center_selected;
|
||||
DRWShadingGroup *center_deselected;
|
||||
DRWShadingGroup *center_selected_lib;
|
||||
DRWShadingGroup *center_deselected_lib;
|
||||
|
||||
/* Camera */
|
||||
DRWShadingGroup *camera;
|
||||
@@ -715,6 +717,16 @@ static void OBJECT_cache_init(void *vedata)
|
||||
grp = DRW_shgroup_point_batch_create(sh, psl->ob_center);
|
||||
DRW_shgroup_uniform_vec4(grp, "color", ts.colorDeselect, 1);
|
||||
stl->g_data->center_deselected = grp;
|
||||
|
||||
/* Select (library) */
|
||||
grp = DRW_shgroup_point_batch_create(sh, psl->ob_center);
|
||||
DRW_shgroup_uniform_vec4(grp, "color", ts.colorLibrarySelect, 1);
|
||||
stl->g_data->center_selected_lib = grp;
|
||||
|
||||
/* Deselect (library) */
|
||||
grp = DRW_shgroup_point_batch_create(sh, psl->ob_center);
|
||||
DRW_shgroup_uniform_vec4(grp, "color", ts.colorLibrary, 1);
|
||||
stl->g_data->center_deselected_lib = grp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1047,12 +1059,32 @@ static void DRW_shgroup_relationship_lines(OBJECT_StorageList *stl, Object *ob)
|
||||
|
||||
static void DRW_shgroup_object_center(OBJECT_StorageList *stl, Object *ob)
|
||||
{
|
||||
const bool is_library = ob->id.us > 1 || ID_IS_LINKED_DATABLOCK(ob);
|
||||
DRWShadingGroup *shgroup;
|
||||
|
||||
if ((ob->base_flag & BASE_SELECTED) != 0) {
|
||||
DRW_shgroup_dynamic_call_add(stl->g_data->center_selected, ob->obmat[3]);
|
||||
if (is_library) {
|
||||
shgroup = stl->g_data->center_selected_lib;
|
||||
}
|
||||
else {
|
||||
shgroup = stl->g_data->center_selected;
|
||||
}
|
||||
}
|
||||
else if (0) {
|
||||
DRW_shgroup_dynamic_call_add(stl->g_data->center_deselected, ob->obmat[3]);
|
||||
else {
|
||||
#if 0
|
||||
shgroup = stl->g_data->center_deselected;
|
||||
if (is_library) {
|
||||
shgroup = stl->g_data->center_deselected_lib;
|
||||
}
|
||||
else {
|
||||
shgroup = stl->g_data->center_deselected;
|
||||
}
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
DRW_shgroup_dynamic_call_add(shgroup, ob->obmat[3]);
|
||||
}
|
||||
|
||||
static void OBJECT_cache_populate(void *vedata, Object *ob)
|
||||
|
Reference in New Issue
Block a user