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:
authorCampbell Barton <ideasman42@gmail.com>2012-10-04 13:43:27 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-04 13:43:27 +0400
commitc872ffd94f1b94f8da725080e53d2e5400cb3a04 (patch)
treeb6665b928faa75dc055f80d7b0cb336e1aec1680 /source/blender/blenkernel/intern/texture.c
parent753b627cb6fb92ec1b168c6ea6270eb5115911b7 (diff)
code cleanup: make the behavior of set_current_material_texture() clearer and remove redundant NULL check there. also small changes to ui_draw_but_HSVCIRCLE().
Diffstat (limited to 'source/blender/blenkernel/intern/texture.c')
-rw-r--r--source/blender/blenkernel/intern/texture.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index bdd9b424f3b..9dd83181521 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -1073,19 +1073,21 @@ void set_current_material_texture(Material *ma, Tex *newtex)
{
Tex *tex = NULL;
bNode *node;
-
- if (ma && ma->use_nodes && ma->nodetree) {
- node = nodeGetActiveID(ma->nodetree, ID_TE);
- if (node) {
- tex = (Tex *)node->id;
- id_us_min(&tex->id);
+ if ((ma->use_nodes && ma->nodetree) &&
+ (node = nodeGetActiveID(ma->nodetree, ID_TE)))
+ {
+ tex = (Tex *)node->id;
+ id_us_min(&tex->id);
+ if (newtex) {
node->id = &newtex->id;
id_us_plus(&newtex->id);
- ma = NULL;
+ }
+ else {
+ node->id = NULL;
}
}
- if (ma) {
+ else {
int act = (int)ma->texact;
tex = (ma->mtex[act]) ? ma->mtex[act]->tex : NULL;