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.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index bea0e33da9a..ea317956255 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -38,6 +38,7 @@
#include "DNA_anim_types.h"
#include "DNA_curve_types.h"
+#include "DNA_group_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -214,7 +215,7 @@ Material *BKE_material_add(const char *name)
init_material(ma);
- return ma;
+ return ma;
}
/* XXX keep synced with next function */
@@ -903,7 +904,7 @@ short find_material_index(Object *ob, Material *ma)
break;
if (a < *totcolp)
return a + 1;
- return 0;
+ return 0;
}
int object_add_material_slot(Object *ob)
@@ -969,7 +970,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
ma->ambr = ma->amb * amb[0];
ma->ambg = ma->amb * amb[1];
ma->ambb = ma->amb * amb[2];
- }
+ }
/* will become or-ed result of all node modes */
ma->mode_l = ma->mode;
ma->mode_l &= ~MA_SHLESS;
@@ -980,6 +981,17 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
/* parses the geom+tex nodes */
if (ma->nodetree && ma->use_nodes)
ntreeShaderGetTexcoMode(ma->nodetree, r_mode, &ma->texco, &ma->mode_l);
+
+ /* local group override */
+ if ((ma->shade_flag & MA_GROUP_LOCAL) && ma->id.lib && ma->group && ma->group->id.lib) {
+ Group *group;
+
+ for (group = G.main->group.first; group; group = group->id.next) {
+ if (!group->id.lib && strcmp(group->id.name, ma->group->id.name) == 0) {
+ ma->group = group;
+ }
+ }
+ }
}
static void init_render_nodetree(bNodeTree *ntree, Material *basemat, int r_mode, float *amb)
@@ -1147,7 +1159,7 @@ void material_drivers_update(Scene *scene, Material *ma, float ctime)
/* ****************** */
#if 0 /* UNUSED */
-static char colname_array[125][20]= {
+static char colname_array[125][20] = {
"Black", "DarkRed", "HalfRed", "Red", "Red",
"DarkGreen", "DarkOlive", "Brown", "Chocolate", "OrangeRed",
"HalfGreen", "GreenOlive", "DryOlive", "Goldenrod", "DarkOrange",
@@ -1603,7 +1615,7 @@ static int encode_tfaceflag(MTFace *tf, int convertall)
/* calculate the flag */
int flag = tf->mode;
- /* options that change the material offline render */
+ /* options that change the material offline render */
if (!convertall) {
flag &= ~TF_OBCOL;
}
@@ -1627,7 +1639,7 @@ static int encode_tfaceflag(MTFace *tf, int convertall)
/* set the material options based in the tface flag */
static void decode_tfaceflag(Material *ma, int flag, int convertall)
{
- int alphablend;
+ int alphablend;
GameSettings *game = &ma->game;
/* flag is shifted in 1 to make 0 != no flag yet (see encode_tfaceflag) */
@@ -1786,13 +1798,13 @@ static short convert_tfacenomaterial(Main *main, Mesh *me, MTFace *tf, int flag)
* for now store the flag into the material and change light/tex/collision
* store the flag as a negative number */
ma->game.flag = -flag;
- id_us_min((ID *)ma);
+ id_us_min((ID *)ma);
}
else printf("Error: Unable to create Material \"%s\" for Mesh \"%s\".", idname + 2, me->id.name + 2);
}
/* set as converted, no need to go bad to this face */
- tf->mode |= TF_CONVERTED;
+ tf->mode |= TF_CONVERTED;
return mat_nr;
}
@@ -1845,7 +1857,7 @@ static void convert_tfacematerial(Main *main, Material *ma)
if (mat_new) {
/* rename the material*/
strcpy(mat_new->id.name, idname);
- id_us_min((ID *)mat_new);
+ id_us_min((ID *)mat_new);
mat_nr = mesh_addmaterial(me, mat_new);
decode_tfaceflag(mat_new, flag, 1);
@@ -2033,7 +2045,7 @@ int do_version_tface(Main *main, int fileload)
nowarning = 0;
}
else
- convert_tfacematerial(main, ma); continue;
+ convert_tfacematerial(main, ma); continue;
}
/* no conflicts in this material - 90% of cases