Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/material.c')
-rw-r--r--source/blender/blenkernel/intern/material.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 391af8b96ab..1382b863637 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -366,6 +366,26 @@ static void material_data_index_remove_id(ID *id, short index)
}
}
+bool BKE_object_material_slot_used(ID *id, short actcol)
+{
+ /* ensure we don't try get materials from non-obdata */
+ BLI_assert(OB_DATA_SUPPORT_ID(GS(id->name)));
+
+ switch (GS(id->name)) {
+ case ID_ME:
+ return BKE_mesh_material_index_used((Mesh *)id, actcol - 1);
+ case ID_CU:
+ return BKE_curve_material_index_used((Curve *)id, actcol - 1);
+ case ID_MB:
+ /* meta-elems don't have materials atm */
+ return false;
+ case ID_GD:
+ return BKE_gpencil_material_index_used((bGPdata *)id, actcol - 1);
+ default:
+ return false;
+ }
+}
+
static void material_data_index_clear_id(ID *id)
{
/* ensure we don't try get materials from non-obdata */