[Bf-blender-cvs] [e0f16bd] master: Cleanup: use BKE naming convention for object materials

Campbell Barton noreply at git.blender.org
Wed Jul 20 21:57:59 CEST 2016


Commit: e0f16bdcc2892036aadb56ced343045822070aaa
Author: Campbell Barton
Date:   Thu Jul 21 05:56:12 2016 +1000
Branches: master
https://developer.blender.org/rBe0f16bdcc2892036aadb56ced343045822070aaa

Cleanup: use BKE naming convention for object materials

Also remove unused 'material_from' function (which isn't very useful).

===================================================================

M	source/blender/blenkernel/BKE_material.h
M	source/blender/blenkernel/intern/material.c
M	source/blender/editors/render/render_shading.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h
index bbe104c..ddead79 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -78,15 +78,13 @@ enum {
 };
 
 struct Material *give_current_material(struct Object *ob, short act);
-struct ID *material_from(struct Object *ob, short act);
 void assign_material_id(struct ID *id, struct Material *ma, short act);
 void assign_material(struct Object *ob, struct Material *ma, short act, int assign_type);
 void assign_matarar(struct Object *ob, struct Material ***matar, short totcol);
 
-short find_material_index(struct Object *ob, struct Material *ma);
-
-bool object_add_material_slot(struct Object *ob);
-bool object_remove_material_slot(struct Object *ob);
+short BKE_object_material_slot_find_index(struct Object *ob, struct Material *ma);
+bool  BKE_object_material_slot_add(struct Object *ob);
+bool  BKE_object_material_slot_remove(struct Object *ob);
 
 void BKE_texpaint_slot_refresh_cache(struct Scene *scene, struct Material *ma);
 void BKE_texpaint_slots_refresh_object(struct Scene *scene, struct Object *ob);
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 75fa42f..0387a63 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -569,18 +569,6 @@ Material *give_current_material(Object *ob, short act)
 	return ma;
 }
 
-ID *material_from(Object *ob, short act)
-{
-
-	if (ob == NULL) return NULL;
-
-	if (ob->totcol == 0) return ob->data;
-	if (act == 0) act = 1;
-
-	if (ob->matbits[act - 1]) return (ID *)ob;
-	else return ob->data;
-}
-
 Material *give_node_material(Material *ma)
 {
 	if (ma && ma->use_nodes && ma->nodetree) {
@@ -886,7 +874,7 @@ void assign_matarar(struct Object *ob, struct Material ***matar, short totcol)
 	int actcol_orig = ob->actcol;
 	short i;
 
-	while (object_remove_material_slot(ob)) {}
+	while (BKE_object_material_slot_remove(ob)) {}
 
 	/* now we have the right number of slots */
 	for (i = 0; i < totcol; i++)
@@ -899,7 +887,7 @@ void assign_matarar(struct Object *ob, struct Material ***matar, short totcol)
 }
 
 
-short find_material_index(Object *ob, Material *ma)
+short BKE_object_material_slot_find_index(Object *ob, Material *ma)
 {
 	Material ***matarar;
 	short a, *totcolp;
@@ -919,7 +907,7 @@ short find_material_index(Object *ob, Material *ma)
 	return 0;
 }
 
-bool object_add_material_slot(Object *ob)
+bool BKE_object_material_slot_add(Object *ob)
 {
 	if (ob == NULL) return false;
 	if (ob->totcol >= MAXMAT) return false;
@@ -1201,7 +1189,7 @@ void material_drivers_update(Scene *scene, Material *ma, float ctime)
 	ma->id.tag &= ~LIB_TAG_DOIT;
 }
 
-bool object_remove_material_slot(Object *ob)
+bool BKE_object_material_slot_remove(Object *ob)
 {
 	Material *mao, ***matarar;
 	Object *obt;
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index c3f8313..5865a93 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -102,7 +102,7 @@ static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
 	if (!ob)
 		return OPERATOR_CANCELLED;
 	
-	object_add_material_slot(ob);
+	BKE_object_material_slot_add(ob);
 
 	if (ob->mode & OB_MODE_TEXTURE_PAINT) {
 		Scene *scene = CTX_data_scene(C);
@@ -145,7 +145,7 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 	
-	object_remove_material_slot(ob);
+	BKE_object_material_slot_remove(ob);
 
 	if (ob->mode & OB_MODE_TEXTURE_PAINT) {
 		Scene *scene = CTX_data_scene(C);




More information about the Bf-blender-cvs mailing list