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>2010-12-19 23:12:12 +0300
committerTon Roosendaal <ton@blender.org>2010-12-19 23:12:12 +0300
commitb8e47fd160c4474032468390b40ca238381b560f (patch)
treeb4402ac43ec39cad0b6627227cb042adb430f128 /source/blender/blenkernel/intern/material.c
parent7899765836d42037f685ee9c506d959997559cde (diff)
Bugfix #25301
Preview render for node shaders broke, caused by localizing materials last week, to prevent thread crashes. Fixed now. Also added a temp fix to draw color-management corrected node previews default. Will follow scene setting tomorrow. Also: SSS in nodes doesn't render yet. Was issue in 2.4 too...
Diffstat (limited to 'source/blender/blenkernel/intern/material.c')
-rw-r--r--source/blender/blenkernel/intern/material.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 30df1887077..cac41e457a6 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -44,6 +44,7 @@
#include "DNA_scene_types.h"
#include "BLI_math.h"
+#include "BLI_listbase.h"
#include "BKE_animsys.h"
#include "BKE_displist.h"
@@ -196,6 +197,7 @@ Material *add_material(const char *name)
return ma;
}
+/* XXX keep synced with next function */
Material *copy_material(Material *ma)
{
Material *man;
@@ -227,6 +229,38 @@ Material *copy_material(Material *ma)
return man;
}
+/* XXX (see above) material copy without adding to main dbase */
+Material *localize_material(Material *ma)
+{
+ Material *man;
+ int a;
+
+ man= copy_libblock(ma);
+ BLI_remlink(&G.main->mat, man);
+
+ for(a=0; a<MAX_MTEX; a++) {
+ if(ma->mtex[a]) {
+ man->mtex[a]= MEM_mallocN(sizeof(MTex), "copymaterial");
+ memcpy(man->mtex[a], ma->mtex[a], sizeof(MTex));
+ /* free_material decrements! */
+ id_us_plus((ID *)man->mtex[a]->tex);
+ }
+ }
+
+ if(ma->ramp_col) man->ramp_col= MEM_dupallocN(ma->ramp_col);
+ if(ma->ramp_spec) man->ramp_spec= MEM_dupallocN(ma->ramp_spec);
+
+ if (ma->preview) man->preview = BKE_previewimg_copy(ma->preview);
+
+ if(ma->nodetree) {
+ man->nodetree= ntreeLocalize(ma->nodetree);
+ }
+
+ man->gpumaterial.first= man->gpumaterial.last= NULL;
+
+ return man;
+}
+
void make_local_material(Material *ma)
{
Main *bmain= G.main;