diff options
author | Jacques Lucke <jacques@blender.org> | 2020-09-25 13:45:30 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-09-25 13:45:30 +0300 |
commit | d15e8bdaa3343cf97a74f918b2570e66fb7abfa0 (patch) | |
tree | 95f478c8ff44705c0de9c6f99720c7a74d23addb /source/blender/editors | |
parent | f057e92ae29ba15895ff489ef1ec0de8dc3f4cbc (diff) |
Modifiers: add icon field to ModifierTypeInfo
With this change `outliner_draw.c` does not have to be
edited anymore when a new modifier is added.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D8998
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 163 |
1 files changed, 6 insertions, 157 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 9e805e2052f..1160a5b926c 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -2137,163 +2137,12 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te) if (ob->type != OB_GPENCIL) { ModifierData *md = BLI_findlink(&ob->modifiers, tselem->nr); - switch ((ModifierType)md->type) { - case eModifierType_Subsurf: - data.icon = ICON_MOD_SUBSURF; - break; - case eModifierType_Armature: - data.icon = ICON_MOD_ARMATURE; - break; - case eModifierType_Lattice: - data.icon = ICON_MOD_LATTICE; - break; - case eModifierType_Curve: - data.icon = ICON_MOD_CURVE; - break; - case eModifierType_Build: - data.icon = ICON_MOD_BUILD; - break; - case eModifierType_Mirror: - data.icon = ICON_MOD_MIRROR; - break; - case eModifierType_Decimate: - data.icon = ICON_MOD_DECIM; - break; - case eModifierType_Wave: - data.icon = ICON_MOD_WAVE; - break; - case eModifierType_Hook: - data.icon = ICON_HOOK; - break; - case eModifierType_Softbody: - data.icon = ICON_MOD_SOFT; - break; - case eModifierType_Boolean: - data.icon = ICON_MOD_BOOLEAN; - break; - case eModifierType_ParticleSystem: - data.icon = ICON_MOD_PARTICLES; - break; - case eModifierType_ParticleInstance: - data.icon = ICON_MOD_PARTICLES; - break; - case eModifierType_EdgeSplit: - data.icon = ICON_MOD_EDGESPLIT; - break; - case eModifierType_Array: - data.icon = ICON_MOD_ARRAY; - break; - case eModifierType_UVProject: - case eModifierType_UVWarp: /* TODO, get own icon */ - data.icon = ICON_MOD_UVPROJECT; - break; - case eModifierType_Displace: - data.icon = ICON_MOD_DISPLACE; - break; - case eModifierType_Shrinkwrap: - data.icon = ICON_MOD_SHRINKWRAP; - break; - case eModifierType_Cast: - data.icon = ICON_MOD_CAST; - break; - case eModifierType_MeshDeform: - case eModifierType_SurfaceDeform: - data.icon = ICON_MOD_MESHDEFORM; - break; - case eModifierType_Bevel: - data.icon = ICON_MOD_BEVEL; - break; - case eModifierType_Smooth: - case eModifierType_LaplacianSmooth: - case eModifierType_CorrectiveSmooth: - data.icon = ICON_MOD_SMOOTH; - break; - case eModifierType_SimpleDeform: - data.icon = ICON_MOD_SIMPLEDEFORM; - break; - case eModifierType_Mask: - data.icon = ICON_MOD_MASK; - break; - case eModifierType_Cloth: - data.icon = ICON_MOD_CLOTH; - break; - case eModifierType_Explode: - data.icon = ICON_MOD_EXPLODE; - break; - case eModifierType_Collision: - case eModifierType_Surface: - data.icon = ICON_MOD_PHYSICS; - break; - case eModifierType_Fluidsim: /* deprecated, old fluid modifier */ - data.icon = ICON_MOD_FLUIDSIM; - break; - case eModifierType_Multires: - data.icon = ICON_MOD_MULTIRES; - break; - case eModifierType_Fluid: - data.icon = ICON_MOD_FLUID; - break; - case eModifierType_Solidify: - data.icon = ICON_MOD_SOLIDIFY; - break; - case eModifierType_Screw: - data.icon = ICON_MOD_SCREW; - break; - case eModifierType_Remesh: - data.icon = ICON_MOD_REMESH; - break; - case eModifierType_WeightVGEdit: - case eModifierType_WeightVGMix: - case eModifierType_WeightVGProximity: - data.icon = ICON_MOD_VERTEX_WEIGHT; - break; - case eModifierType_DynamicPaint: - data.icon = ICON_MOD_DYNAMICPAINT; - break; - case eModifierType_Ocean: - data.icon = ICON_MOD_OCEAN; - break; - case eModifierType_Warp: - data.icon = ICON_MOD_WARP; - break; - case eModifierType_Skin: - data.icon = ICON_MOD_SKIN; - break; - case eModifierType_Triangulate: - data.icon = ICON_MOD_TRIANGULATE; - break; - case eModifierType_MeshCache: - data.icon = ICON_MOD_MESHDEFORM; /* XXX, needs own icon */ - break; - case eModifierType_MeshSequenceCache: - data.icon = ICON_MOD_MESHDEFORM; /* XXX, needs own icon */ - break; - case eModifierType_Wireframe: - data.icon = ICON_MOD_WIREFRAME; - break; - case eModifierType_Weld: - data.icon = ICON_AUTOMERGE_OFF; /* XXX, needs own icon */ - break; - case eModifierType_LaplacianDeform: - data.icon = ICON_MOD_MESHDEFORM; /* XXX, needs own icon */ - break; - case eModifierType_DataTransfer: - data.icon = ICON_MOD_DATA_TRANSFER; - break; - case eModifierType_NormalEdit: - case eModifierType_WeightedNormal: - data.icon = ICON_MOD_NORMALEDIT; - break; - case eModifierType_Simulation: - data.icon = ICON_PHYSICS; /* TODO: Use correct icon. */ - break; - /* Default */ - case eModifierType_None: - case eModifierType_ShapeKey: - - case NUM_MODIFIER_TYPES: - data.icon = ICON_DOT; - break; + const ModifierTypeInfo *modifier_type = BKE_modifier_get_info(md->type); + if (modifier_type != NULL) { + data.icon = modifier_type->icon; + } + else { + data.icon = ICON_DOT; } } else { |