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>2011-03-03 21:53:07 +0300
committerTon Roosendaal <ton@blender.org>2011-03-03 21:53:07 +0300
commit18afcbcb7db513fa9e27d8245ead3401570eb44e (patch)
tree672cb683045c6c88a55e2e82a020fe97fd281567 /source/blender/blenkernel
parent3c184def72693e319253c31896b385c297183778 (diff)
bugfix #26267
ImageWindow + 3D view texture paint + texture preview render + texture nodes. Threading hell! But it works now :)
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_texture.h1
-rw-r--r--source/blender/blenkernel/intern/node.c12
-rw-r--r--source/blender/blenkernel/intern/texture.c38
3 files changed, 43 insertions, 8 deletions
diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h
index e6a21ec3966..c8fa7a5e81f 100644
--- a/source/blender/blenkernel/BKE_texture.h
+++ b/source/blender/blenkernel/BKE_texture.h
@@ -81,6 +81,7 @@ void default_mtex(struct MTex *mtex);
struct MTex *add_mtex(void);
struct MTex *add_mtex_id(struct ID *id, int slot);
struct Tex *copy_texture(struct Tex *tex);
+struct Tex *localize_texture(struct Tex *tex);
void make_local_texture(struct Tex *tex);
void autotexname(struct Tex *tex);
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 2767c5ed42b..3cc2c673e8e 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1188,6 +1188,12 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree)
newtree= MEM_dupallocN(ntree);
copy_libblock_data(&newtree->id, &ntree->id, TRUE); /* copy animdata and ID props */
}
+
+ /* in case a running nodetree is copied */
+ newtree->init &= ~(NTREE_EXEC_INIT);
+ newtree->threadstack= NULL;
+ newtree->stack= NULL;
+
newtree->nodes.first= newtree->nodes.last= NULL;
newtree->links.first= newtree->links.last= NULL;
@@ -2771,8 +2777,8 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
/* ********** copy composite tree entirely, to allow threaded exec ******************* */
/* ***************** do NOT execute this in a thread! ****************** */
-/* returns localized composite tree for execution in threads */
-/* local tree then owns all compbufs */
+/* returns localized tree for execution in threads */
+/* local tree then owns all compbufs (for composite) */
bNodeTree *ntreeLocalize(bNodeTree *ntree)
{
bNodeTree *ltree;
@@ -2886,7 +2892,7 @@ void ntreeLocalSync(bNodeTree *localtree, bNodeTree *ntree)
}
}
}
- else if(ntree->type==NTREE_SHADER) {
+ else if(ELEM(ntree->type, NTREE_SHADER, NTREE_TEXTURE)) {
/* copy over contents of previews */
for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
if(node_exists(ntree, lnode->new_node)) {
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index db841a89da9..5199bbd0f06 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -480,11 +480,13 @@ int colorband_element_remove(struct ColorBand *coba, int index)
void free_texture(Tex *tex)
{
free_plugin_tex(tex->plugin);
+
if(tex->coba) MEM_freeN(tex->coba);
if(tex->env) BKE_free_envmap(tex->env);
if(tex->pd) BKE_free_pointdensity(tex->pd);
if(tex->vd) BKE_free_voxeldata(tex->vd);
BKE_free_animdata((struct ID *)tex);
+
BKE_previewimg_free(&tex->preview);
BKE_icon_delete((struct ID*)tex);
tex->id.icon_id = 0;
@@ -750,10 +752,6 @@ Tex *copy_texture(Tex *tex)
if(texn->type==TEX_IMAGE) id_us_plus((ID *)texn->ima);
else texn->ima= NULL;
-#if 0 // XXX old animation system
- id_us_plus((ID *)texn->ipo);
-#endif // XXX old animation system
-
if(texn->plugin) {
texn->plugin= MEM_dupallocN(texn->plugin);
open_plugin_tex(texn->plugin);
@@ -768,12 +766,42 @@ Tex *copy_texture(Tex *tex)
if(tex->nodetree) {
ntreeEndExecTree(tex->nodetree);
- texn->nodetree= ntreeCopyTree(tex->nodetree); /* 0 == full new tree */
+ texn->nodetree= ntreeCopyTree(tex->nodetree);
}
return texn;
}
+/* texture copy without adding to main dbase */
+Tex *localize_texture(Tex *tex)
+{
+ Tex *texn;
+
+ texn= copy_libblock(tex);
+ BLI_remlink(&G.main->tex, texn);
+
+ /* image texture: free_texture also doesn't decrease */
+
+ if(texn->plugin) {
+ texn->plugin= MEM_dupallocN(texn->plugin);
+ open_plugin_tex(texn->plugin);
+ }
+
+ if(texn->coba) texn->coba= MEM_dupallocN(texn->coba);
+ if(texn->env) texn->env= BKE_copy_envmap(texn->env);
+ if(texn->pd) texn->pd= MEM_dupallocN(texn->pd);
+ if(texn->vd) texn->vd= MEM_dupallocN(texn->vd);
+
+ texn->preview = NULL;
+
+ if(tex->nodetree) {
+ texn->nodetree= ntreeLocalize(tex->nodetree);
+ }
+
+ return texn;
+}
+
+
/* ------------------------------------------------------------------------- */
void make_local_texture(Tex *tex)