diff options
author | William Reynish <billrey@me.com> | 2019-06-04 19:10:47 +0300 |
---|---|---|
committer | William Reynish <billrey@me.com> | 2019-06-04 19:10:47 +0300 |
commit | e388cd8bb4b5dd309de0e603e529ee99348e3b19 (patch) | |
tree | 0a0fd845a8c18892c6720e4cdeba195ffe2fd58c /source/blender/editors | |
parent | 636751bb36097e57c191652575ed6394b6dae105 (diff) |
UI: Add icons to Constraints
Each constraint now has a unique icon, just like modifiers.
Icons are designed by Andrzej Ambroż & Alessio Monti, with user input.
Patch by Alessio Monti.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/UI_icons.h | 54 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 20 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 124 |
3 files changed, 155 insertions, 43 deletions
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h index 048f30bdf26..f9e9e342ee5 100644 --- a/source/blender/editors/include/UI_icons.h +++ b/source/blender/editors/include/UI_icons.h @@ -493,33 +493,33 @@ DEF_ICON(HOLDOUT_ON) DEF_ICON(INDIRECT_ONLY_OFF) DEF_ICON(INDIRECT_ONLY_ON) -/* EMPTY */ -DEF_ICON_BLANK(501) -DEF_ICON_BLANK(502) -DEF_ICON_BLANK(503) -DEF_ICON_BLANK(504) -DEF_ICON_BLANK(505) -DEF_ICON_BLANK(506) -DEF_ICON_BLANK(507) -DEF_ICON_BLANK(508) -DEF_ICON_BLANK(509) -DEF_ICON_BLANK(510) -DEF_ICON_BLANK(511) -DEF_ICON_BLANK(512) -DEF_ICON_BLANK(513) -DEF_ICON_BLANK(514) -DEF_ICON_BLANK(515) -DEF_ICON_BLANK(516) -DEF_ICON_BLANK(517) -DEF_ICON_BLANK(518) -DEF_ICON_BLANK(519) -DEF_ICON_BLANK(520) -DEF_ICON_BLANK(521) -DEF_ICON_BLANK(522) -DEF_ICON_BLANK(523) -DEF_ICON_BLANK(524) -DEF_ICON_BLANK(525) -DEF_ICON_BLANK(526) +/* CONSTRAINTS */ +DEF_ICON_MODIFIER(CON_CAMERASOLVER) +DEF_ICON_MODIFIER(CON_FOLLOWTRACK) +DEF_ICON_MODIFIER(CON_OBJECTSOLVER) +DEF_ICON_MODIFIER(CON_LOCLIKE) +DEF_ICON_MODIFIER(CON_ROTLIKE) +DEF_ICON_MODIFIER(CON_SIZELIKE) +DEF_ICON_MODIFIER(CON_TRANSLIKE) +DEF_ICON_MODIFIER(CON_DISTLIMIT) +DEF_ICON_MODIFIER(CON_LOCLIMIT) +DEF_ICON_MODIFIER(CON_ROTLIMIT) +DEF_ICON_MODIFIER(CON_SIZELIMIT) +DEF_ICON_MODIFIER(CON_SAMEVOL) +DEF_ICON_MODIFIER(CON_TRANSFORM) +DEF_ICON_MODIFIER(CON_TRANSFORM_CACHE) +DEF_ICON_MODIFIER(CON_CLAMPTO) +DEF_ICON_MODIFIER(CON_KINEMATIC) +DEF_ICON_MODIFIER(CON_LOCKTRACK) +DEF_ICON_MODIFIER(CON_SPLINEIK) +DEF_ICON_MODIFIER(CON_STRETCHTO) +DEF_ICON_MODIFIER(CON_TRACKTO) +DEF_ICON_MODIFIER(CON_ARMATURE) +DEF_ICON_MODIFIER(CON_CHILDOF) +DEF_ICON_MODIFIER(CON_FLOOR) +DEF_ICON_MODIFIER(CON_FOLLOWPATH) +DEF_ICON_MODIFIER(CON_PIVOT) +DEF_ICON_MODIFIER(CON_SHRINKWRAP) /* MODIFIERS */ DEF_ICON_MODIFIER(MODIFIER_DATA) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 33602818fd4..b1d404e8ab4 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2441,24 +2441,12 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) /* open/close */ UI_block_emboss_set(block, UI_EMBOSS_NONE); - uiItemR(row, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + uiItemR(row, &ptr, "show_expanded", 0, "", ICON_NONE); + + /* constraint-type icon */ + uiItemL(row, "", RNA_struct_ui_icon(ptr.type)); UI_block_emboss_set(block, UI_EMBOSS); - /* name */ - uiDefBut(block, - UI_BTYPE_LABEL, - 0, - typestr, - xco + 0.5f * UI_UNIT_X, - yco, - 5 * UI_UNIT_X, - 0.9f * UI_UNIT_Y, - NULL, - 0.0, - 0.0, - 0.0, - 0.0, - ""); if (con->flag & CONSTRAINT_DISABLE) { uiLayoutSetRedAlert(row, true); diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index d994152ba67..8c02c828313 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -31,6 +31,7 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" +#include "DNA_constraint_types.h" #include "BLI_math.h" #include "BLI_blenlib.h" @@ -1856,6 +1857,129 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te) case TSE_LINKED_PSYS: data.icon = ICON_PARTICLES; break; + case TSE_CONSTRAINT: { + Object *ob = (Object *)tselem->id; + + /* + * I wasn't able to get the correct pose channel per bone + * so for now, to avoid Blender to crash, every time an armature goes in pose mode + * the icon will be a dot as before. + * There is also a problem with the update of the outliner, if the order + * of the constraints change. + */ + + if (ob->mode & OB_MODE_POSE) { /*placeholder filter for testing*/ + /* + bPoseChannel *pchan = BLI_findlink(&ob->pose->chanbase, 0); + + bConstraint *con = BLI_findlink(&pchan->constraints, tselem->nr-1000); + + switch ((eBConstraint_Types)con->type) { + case CONSTRAINT_TYPE_SIZELIKE: + data.icon = ICON_CON_SIZELIKE; + break; + default: + data.icon = ICON_DOT; + break; + }*/ + data.icon = ICON_DOT; + } + else { + bConstraint *con = BLI_findlink(&ob->constraints, tselem->nr); + + switch ((eBConstraint_Types)con->type) { + case CONSTRAINT_TYPE_CAMERASOLVER: + data.icon = ICON_CON_CAMERASOLVER; + break; + case CONSTRAINT_TYPE_FOLLOWTRACK: + data.icon = ICON_CON_FOLLOWTRACK; + break; + case CONSTRAINT_TYPE_OBJECTSOLVER: + data.icon = ICON_CON_OBJECTSOLVER; + break; + case CONSTRAINT_TYPE_LOCLIKE: + data.icon = ICON_CON_LOCLIKE; + break; + case CONSTRAINT_TYPE_ROTLIKE: + data.icon = ICON_CON_ROTLIKE; + break; + case CONSTRAINT_TYPE_SIZELIKE: + data.icon = ICON_CON_SIZELIKE; + break; + case CONSTRAINT_TYPE_TRANSLIKE: + data.icon = ICON_CON_TRANSLIKE; + break; + case CONSTRAINT_TYPE_DISTLIMIT: + data.icon = ICON_CON_DISTLIMIT; + break; + case CONSTRAINT_TYPE_LOCLIMIT: + data.icon = ICON_CON_LOCLIMIT; + break; + case CONSTRAINT_TYPE_ROTLIMIT: + data.icon = ICON_CON_ROTLIMIT; + break; + case CONSTRAINT_TYPE_SIZELIMIT: + data.icon = ICON_CON_SIZELIMIT; + break; + case CONSTRAINT_TYPE_SAMEVOL: + data.icon = ICON_CON_SAMEVOL; + break; + case CONSTRAINT_TYPE_TRANSFORM: + data.icon = ICON_CON_TRANSFORM; + break; + case CONSTRAINT_TYPE_TRANSFORM_CACHE: + data.icon = ICON_MOD_MESHDEFORM; + break; + case CONSTRAINT_TYPE_CLAMPTO: + data.icon = ICON_CON_CLAMPTO; + break; + case CONSTRAINT_TYPE_DAMPTRACK: + data.icon = ICON_CON_TRACKTO; + break; + case CONSTRAINT_TYPE_KINEMATIC: + data.icon = ICON_CON_KINEMATIC; + break; + case CONSTRAINT_TYPE_LOCKTRACK: + data.icon = ICON_CON_LOCKTRACK; + break; + case CONSTRAINT_TYPE_SPLINEIK: + data.icon = ICON_CON_SPLINEIK; + break; + case CONSTRAINT_TYPE_STRETCHTO: + data.icon = ICON_CON_STRETCHTO; + break; + case CONSTRAINT_TYPE_TRACKTO: + data.icon = ICON_CON_TRACKTO; + break; + case CONSTRAINT_TYPE_ACTION: + data.icon = ICON_ACTION; + break; + case CONSTRAINT_TYPE_ARMATURE: + data.icon = ICON_MOD_ARMATURE; + break; + case CONSTRAINT_TYPE_CHILDOF: + data.icon = ICON_CON_CHILDOF; + break; + case CONSTRAINT_TYPE_MINMAX: + data.icon = ICON_CON_FLOOR; + break; + case CONSTRAINT_TYPE_FOLLOWPATH: + data.icon = ICON_CON_FOLLOWPATH; + break; + case CONSTRAINT_TYPE_PIVOT: + data.icon = ICON_CON_PIVOT; + break; + case CONSTRAINT_TYPE_SHRINKWRAP: + data.icon = ICON_CON_SHRINKWRAP; + break; + + case NUM_CONSTRAINT_TYPES: + data.icon = ICON_DOT; + break; + } + } + } + break; case TSE_MODIFIER: { Object *ob = (Object *)tselem->id; if (ob->type != OB_GPENCIL) { |