UI: Add icons to Object data-block search template
Add object type icons to the object data-block search menu, makes it easier to distinguish at a glance the objet type other than by their name. See PR for screenshots. Pull Request: https://projects.blender.org/blender/blender/pulls/148135
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
struct Collection;
|
struct Collection;
|
||||||
struct ID;
|
struct ID;
|
||||||
struct ImBuf;
|
struct ImBuf;
|
||||||
|
struct Object;
|
||||||
struct PointerRNA;
|
struct PointerRNA;
|
||||||
struct PreviewImage;
|
struct PreviewImage;
|
||||||
struct Scene;
|
struct Scene;
|
||||||
@@ -110,6 +111,7 @@ int UI_icon_from_rnaptr(const bContext *C, PointerRNA *ptr, int rnaicon, bool bi
|
|||||||
int UI_icon_from_idcode(int idcode);
|
int UI_icon_from_idcode(int idcode);
|
||||||
int UI_icon_from_library(const ID *id);
|
int UI_icon_from_library(const ID *id);
|
||||||
int UI_icon_from_object_mode(int mode);
|
int UI_icon_from_object_mode(int mode);
|
||||||
|
int UI_icon_from_object_type(const Object *object);
|
||||||
int UI_icon_color_from_collection(const Collection *collection);
|
int UI_icon_color_from_collection(const Collection *collection);
|
||||||
|
|
||||||
void UI_icon_text_overlay_init_from_count(IconTextOverlay *text_overlay,
|
void UI_icon_text_overlay_init_from_count(IconTextOverlay *text_overlay,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "DNA_dynamicpaint_types.h"
|
#include "DNA_dynamicpaint_types.h"
|
||||||
#include "DNA_gpencil_legacy_types.h"
|
#include "DNA_gpencil_legacy_types.h"
|
||||||
#include "DNA_grease_pencil_types.h"
|
#include "DNA_grease_pencil_types.h"
|
||||||
|
#include "DNA_object_force_types.h"
|
||||||
#include "DNA_screen_types.h"
|
#include "DNA_screen_types.h"
|
||||||
#include "DNA_sequence_types.h"
|
#include "DNA_sequence_types.h"
|
||||||
|
|
||||||
@@ -1917,6 +1918,9 @@ int ui_id_icon_get(const bContext *C, ID *id, const bool big)
|
|||||||
case ID_SCR:
|
case ID_SCR:
|
||||||
iconid = ui_id_screen_get_icon(C, id);
|
iconid = ui_id_screen_get_icon(C, id);
|
||||||
break;
|
break;
|
||||||
|
case ID_OB:
|
||||||
|
iconid = UI_icon_from_object_type((Object *)id);
|
||||||
|
break;
|
||||||
case ID_GR:
|
case ID_GR:
|
||||||
iconid = UI_icon_color_from_collection((Collection *)id);
|
iconid = UI_icon_color_from_collection((Collection *)id);
|
||||||
break;
|
break;
|
||||||
@@ -2128,6 +2132,56 @@ int UI_icon_from_object_mode(const int mode)
|
|||||||
return ICON_NONE;
|
return ICON_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int UI_icon_from_object_type(const Object *object)
|
||||||
|
{
|
||||||
|
switch (object->type) {
|
||||||
|
case OB_LAMP:
|
||||||
|
return ICON_OUTLINER_OB_LIGHT;
|
||||||
|
case OB_MESH:
|
||||||
|
return ICON_OUTLINER_OB_MESH;
|
||||||
|
case OB_CAMERA:
|
||||||
|
return ICON_OUTLINER_OB_CAMERA;
|
||||||
|
case OB_CURVES_LEGACY:
|
||||||
|
return ICON_OUTLINER_OB_CURVE;
|
||||||
|
case OB_MBALL:
|
||||||
|
return ICON_OUTLINER_OB_META;
|
||||||
|
case OB_LATTICE:
|
||||||
|
return ICON_OUTLINER_OB_LATTICE;
|
||||||
|
case OB_ARMATURE:
|
||||||
|
return ICON_OUTLINER_OB_ARMATURE;
|
||||||
|
case OB_FONT:
|
||||||
|
return ICON_OUTLINER_OB_FONT;
|
||||||
|
case OB_SURF:
|
||||||
|
return ICON_OUTLINER_OB_SURFACE;
|
||||||
|
case OB_SPEAKER:
|
||||||
|
return ICON_OUTLINER_OB_SPEAKER;
|
||||||
|
case OB_LIGHTPROBE:
|
||||||
|
return ICON_OUTLINER_OB_LIGHTPROBE;
|
||||||
|
case OB_CURVES:
|
||||||
|
return ICON_OUTLINER_OB_CURVES;
|
||||||
|
case OB_POINTCLOUD:
|
||||||
|
return ICON_OUTLINER_OB_POINTCLOUD;
|
||||||
|
case OB_VOLUME:
|
||||||
|
return ICON_OUTLINER_OB_VOLUME;
|
||||||
|
case OB_EMPTY:
|
||||||
|
if (object->instance_collection && (object->transflag & OB_DUPLICOLLECTION)) {
|
||||||
|
return ICON_OUTLINER_OB_GROUP_INSTANCE;
|
||||||
|
}
|
||||||
|
else if (object->empty_drawtype == OB_EMPTY_IMAGE) {
|
||||||
|
return ICON_OUTLINER_OB_IMAGE;
|
||||||
|
}
|
||||||
|
else if (object->pd && object->pd->forcefield) {
|
||||||
|
return ICON_OUTLINER_OB_FORCE_FIELD;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ICON_OUTLINER_OB_EMPTY;
|
||||||
|
}
|
||||||
|
case OB_GREASE_PENCIL:
|
||||||
|
return ICON_OUTLINER_OB_GREASEPENCIL;
|
||||||
|
}
|
||||||
|
return ICON_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
int UI_icon_color_from_collection(const Collection *collection)
|
int UI_icon_color_from_collection(const Collection *collection)
|
||||||
{
|
{
|
||||||
int icon = ICON_OUTLINER_COLLECTION;
|
int icon = ICON_OUTLINER_COLLECTION;
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
#include "DNA_gpencil_legacy_types.h"
|
#include "DNA_gpencil_legacy_types.h"
|
||||||
#include "DNA_light_types.h"
|
#include "DNA_light_types.h"
|
||||||
#include "DNA_lightprobe_types.h"
|
#include "DNA_lightprobe_types.h"
|
||||||
#include "DNA_object_force_types.h"
|
|
||||||
#include "DNA_object_types.h"
|
#include "DNA_object_types.h"
|
||||||
#include "DNA_scene_types.h"
|
#include "DNA_scene_types.h"
|
||||||
#include "DNA_sequence_types.h"
|
#include "DNA_sequence_types.h"
|
||||||
@@ -2442,54 +2441,7 @@ static void outliner_draw_warning_column(uiBlock *block,
|
|||||||
static BIFIconID tree_element_get_icon_from_id(const ID *id)
|
static BIFIconID tree_element_get_icon_from_id(const ID *id)
|
||||||
{
|
{
|
||||||
if (GS(id->name) == ID_OB) {
|
if (GS(id->name) == ID_OB) {
|
||||||
const Object *ob = (Object *)id;
|
return UI_icon_from_object_type((Object *)id);
|
||||||
switch (ob->type) {
|
|
||||||
case OB_LAMP:
|
|
||||||
return ICON_OUTLINER_OB_LIGHT;
|
|
||||||
case OB_MESH:
|
|
||||||
return ICON_OUTLINER_OB_MESH;
|
|
||||||
case OB_CAMERA:
|
|
||||||
return ICON_OUTLINER_OB_CAMERA;
|
|
||||||
case OB_CURVES_LEGACY:
|
|
||||||
return ICON_OUTLINER_OB_CURVE;
|
|
||||||
case OB_MBALL:
|
|
||||||
return ICON_OUTLINER_OB_META;
|
|
||||||
case OB_LATTICE:
|
|
||||||
return ICON_OUTLINER_OB_LATTICE;
|
|
||||||
case OB_ARMATURE:
|
|
||||||
return ICON_OUTLINER_OB_ARMATURE;
|
|
||||||
case OB_FONT:
|
|
||||||
return ICON_OUTLINER_OB_FONT;
|
|
||||||
case OB_SURF:
|
|
||||||
return ICON_OUTLINER_OB_SURFACE;
|
|
||||||
case OB_SPEAKER:
|
|
||||||
return ICON_OUTLINER_OB_SPEAKER;
|
|
||||||
case OB_LIGHTPROBE:
|
|
||||||
return ICON_OUTLINER_OB_LIGHTPROBE;
|
|
||||||
case OB_CURVES:
|
|
||||||
return ICON_OUTLINER_OB_CURVES;
|
|
||||||
case OB_POINTCLOUD:
|
|
||||||
return ICON_OUTLINER_OB_POINTCLOUD;
|
|
||||||
case OB_VOLUME:
|
|
||||||
return ICON_OUTLINER_OB_VOLUME;
|
|
||||||
case OB_EMPTY:
|
|
||||||
if (ob->instance_collection && (ob->transflag & OB_DUPLICOLLECTION)) {
|
|
||||||
return ICON_OUTLINER_OB_GROUP_INSTANCE;
|
|
||||||
}
|
|
||||||
else if (ob->empty_drawtype == OB_EMPTY_IMAGE) {
|
|
||||||
return ICON_OUTLINER_OB_IMAGE;
|
|
||||||
}
|
|
||||||
else if (ob->pd && ob->pd->forcefield) {
|
|
||||||
return ICON_OUTLINER_OB_FORCE_FIELD;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ICON_OUTLINER_OB_EMPTY;
|
|
||||||
}
|
|
||||||
case OB_GREASE_PENCIL:
|
|
||||||
return ICON_OUTLINER_OB_GREASEPENCIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ICON_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO(sergey): Casting to short here just to handle ID_NLA which is
|
/* TODO(sergey): Casting to short here just to handle ID_NLA which is
|
||||||
|
|||||||
Reference in New Issue
Block a user