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:
authorTon Roosendaal <ton@blender.org>2007-11-28 21:43:09 +0300
committerTon Roosendaal <ton@blender.org>2007-11-28 21:43:09 +0300
commitce52384e9f7d5dee531edf50b76a9edbe982863b (patch)
treef815dd17dfb23d205c073f3d79ee464cd3d0871c /source/blender/blenkernel/intern/material.c
parentd6ce9e4abe54e3901c963a2d63abd1195a21dd33 (diff)
Small material assigning feature:
in EditButtons, panel "Links and Materials", there's now a browse button to directly assign a material to selected faces. It does: - check if material was already in one of the 'slots' of the object - if so, then use this as index to assign - if not, then add a new slot, and assign the new index
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 49d3021090e..ed5fe58d06f 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -581,6 +581,26 @@ void assign_material(Object *ob, Material *ma, int act)
test_object_materials(ob->data);
}
+int find_material_index(Object *ob, Material *ma)
+{
+ Material ***matarar;
+ short a, *totcolp;
+
+ if(ma==NULL) return 0;
+
+ totcolp= give_totcolp(ob);
+ matarar= give_matarar(ob);
+
+ if(totcolp==NULL || matarar==NULL) return 0;
+
+ for(a=0; a<*totcolp; a++)
+ if((*matarar)[a]==ma)
+ break;
+ if(a<*totcolp)
+ return a+1;
+ return 0;
+}
+
void new_material_to_objectdata(Object *ob)
{
Material *ma;