diff options
author | Ton Roosendaal <ton@blender.org> | 2009-05-03 17:22:26 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-05-03 17:22:26 +0400 |
commit | 56b8ce2ec17ea555dc2042ab3d843384b9d1e7cd (patch) | |
tree | 4f108dba85f95516fc3f9d430a0ea9e079d9b586 /source/blender/src/editnode.c | |
parent | c35299363fe411537f4e579e9c449233a4e6b412 (diff) |
Bugfix 18671 revisted
Node editor didn't support editing non-material texture node trees.
Campbell pointed me to fact it's been used already, like for brush
painting. However, this only worked via linking the texture to a
material... hackish stuff.
Now the Node Editor supports all other Textures too, with three extra
icon buttons to define which.
- Active Object: for textures linked to Materials or Lamps
- World: textures from Scene world.
- Brush: textures from active Brush
The latter can only be set and used when in Paint or Sculpt mode:
- Paint mode: in Image window, Paint Tool panel, set active brush
- Sculpt mode: in EditButtons, Texture panel, select empty slot, add texture.
Note that refreshes of previews in Node Editor is not always happening on
switching contextes. Just click a socket to refresh view.
Diffstat (limited to 'source/blender/src/editnode.c')
-rw-r--r-- | source/blender/src/editnode.c | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/source/blender/src/editnode.c b/source/blender/src/editnode.c index f5de20891b4..f0046a960e9 100644 --- a/source/blender/src/editnode.c +++ b/source/blender/src/editnode.c @@ -35,6 +35,7 @@ #include "MEM_guardedalloc.h" #include "DNA_action_types.h" +#include "DNA_brush_types.h" #include "DNA_color_types.h" #include "DNA_image_types.h" #include "DNA_ipo_types.h" @@ -583,13 +584,41 @@ void snode_set_context(SpaceNode *snode) snode->nodetree= G.scene->nodetree; } else if(snode->treetype==NTREE_TEXTURE) { - if(ob) { - Tex *tx= give_current_texture(ob, ob->actcol); - if(tx) { - snode->from= (ID*)ob; /* please check this; i have no idea what 'from' is. */ - snode->id= &tx->id; - snode->nodetree= tx->nodetree; + Tex *tx= NULL; + + if(snode->texfrom==SNODE_TEX_OBJECT) { + if(ob) { + tx= give_current_texture(ob, ob->actcol); + snode->from= (ID *)ob; + } + } + else if(snode->texfrom==SNODE_TEX_WORLD) { + tx= give_current_world_texture(); + snode->from= (ID *)G.scene->world; + } + else { + MTex *mtex= NULL; + + if(G.f & G_SCULPTMODE) { + SculptData *sd= &G.scene->sculptdata; + if(sd->texact != -1) + mtex= sd->mtex[sd->texact]; } + else { + Brush *br= G.scene->toolsettings->imapaint.brush; + if(br) + mtex= br->mtex[br->texact]; + } + + if(mtex) { + snode->from= (ID *)G.scene; + tx= mtex->tex; + } + } + + if(tx) { + snode->id= &tx->id; + snode->nodetree= tx->nodetree; } } |