diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-10-16 00:43:45 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-10-16 00:43:45 +0400 |
commit | d293d74942a8f48d4de6c53f4300540bd0035c34 (patch) | |
tree | d01f136fcc85ae3dbb96ddabe74ced822163bf83 | |
parent | 9c959d98fe5b873f2538882e041f00b6cd90d7cf (diff) |
Cycles: more tweaks to get old/new shading systems working better together, for
now also made non-material/world/lamp stuff use old texture datablocks, no time
to get this fully working now. Still some python tweaks to do to ensure the right
panels show.
-rw-r--r-- | source/blender/editors/include/ED_node.h | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_add.c | 8 | ||||
-rw-r--r-- | source/blender/editors/render/render_shading.c | 24 | ||||
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 269 | ||||
-rw-r--r-- | source/blender/editors/space_buttons/buttons_texture.c | 12 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_draw.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 27 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ID.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_lamp.c | 11 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 11 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 12 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_render.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_texture.c | 13 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_world.c | 11 | ||||
-rw-r--r-- | source/blender/nodes/texture/node_texture_tree.c | 76 | ||||
-rw-r--r-- | source/blender/render/intern/source/render_texture.c | 4 |
16 files changed, 262 insertions, 226 deletions
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index f2eab51c5b9..37d2f65ee23 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -53,7 +53,7 @@ void ED_node_changed_update(struct ID *id, struct bNode *node); void ED_node_generic_update(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node); /* node_edit.c */ -void ED_node_shader_default(struct ID *id); +void ED_node_shader_default(struct Scene *scene, struct ID *id); void ED_node_composit_default(struct Scene *sce); void ED_node_texture_default(struct Tex *tex); void ED_node_link_intersect_test(struct ScrArea *sa, int test); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 8e3776e438e..39435065632 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -77,6 +77,7 @@ #include "BKE_particle.h" #include "BKE_report.h" #include "BKE_sca.h" +#include "BKE_scene.h" #include "BKE_speaker.h" #include "BKE_texture.h" @@ -701,6 +702,7 @@ static const char *get_lamp_defname(int type) static int object_lamp_add_exec(bContext *C, wmOperator *op) { + Scene *scene= CTX_data_scene(C); Object *ob; Lamp *la; int type= RNA_enum_get(op->ptr, "type"); @@ -719,8 +721,10 @@ static int object_lamp_add_exec(bContext *C, wmOperator *op) rename_id(&ob->id, get_lamp_defname(type)); rename_id(&la->id, get_lamp_defname(type)); - ED_node_shader_default(&la->id); - la->use_nodes= 1; + if(scene_use_new_shading_nodes(scene)) { + ED_node_shader_default(scene, &la->id); + la->use_nodes= 1; + } return OPERATOR_FINISHED; } diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 9ebe2014f92..4ae5f8bdde4 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -366,6 +366,7 @@ void OBJECT_OT_material_slot_copy(wmOperatorType *ot) static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) { + Scene *scene= CTX_data_scene(C); Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; PointerRNA ptr, idptr; PropertyRNA *prop; @@ -376,8 +377,11 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) } else { ma= add_material("Material"); - ED_node_shader_default(&ma->id); - ma->use_nodes= 1; + + if(scene_use_new_shading_nodes(scene)) { + ED_node_shader_default(scene, &ma->id); + ma->use_nodes= 1; + } } /* hook into UI */ @@ -421,14 +425,10 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) PropertyRNA *prop; /* add or copy texture */ - if(tex) { + if(tex) tex= copy_texture(tex); - } - else { + else tex= add_texture("Texture"); - ED_node_shader_default(&tex->id); - tex->use_nodes= 1; - } /* hook into UI */ uiIDContextProperty(C, &ptr, &prop); @@ -466,6 +466,7 @@ void TEXTURE_OT_new(wmOperatorType *ot) static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) { + Scene *scene= CTX_data_scene(C); World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data; PointerRNA ptr, idptr; PropertyRNA *prop; @@ -476,8 +477,11 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) } else { wo= add_world("World"); - ED_node_shader_default(&wo->id); - wo->use_nodes= 1; + + if(scene_use_new_shading_nodes(scene)) { + ED_node_shader_default(scene, &wo->id); + wo->use_nodes= 1; + } } /* hook into UI */ diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 4f00a5aeeb9..adcba64609e 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -234,13 +234,11 @@ static int buttons_context_path_material(ButsContextPath *path, int for_texture) if(for_texture && give_current_material_texture_node(ma)) return 1; -#if 0 ma= give_node_material(ma); if(ma) { RNA_id_pointer_create(&ma->id, &path->ptr[path->len]); path->len++; } -#endif return 1; } } @@ -371,139 +369,141 @@ static int buttons_context_path_brush(ButsContextPath *path) static int buttons_context_path_texture(ButsContextPath *path, ButsContextTexture *ct) { - PointerRNA *ptr= &path->ptr[path->len-1]; - ID *id; - - /* if we already have a (pinned) texture, we're done */ - if(RNA_struct_is_a(ptr->type, &RNA_Texture)) - return 1; - - if(!(ct && ct->user)) - return 0; - - id= ct->user->id; - - if(id) { - if(GS(id->name) == ID_BR) - buttons_context_path_brush(path); - else if(GS(id->name) == ID_MA) - buttons_context_path_material(path, 0); - else if(GS(id->name) == ID_WO) - buttons_context_path_world(path); - else if(GS(id->name) == ID_LA) - buttons_context_path_data(path, OB_LAMP); - else if(GS(id->name) == ID_PA) - buttons_context_path_particle(path); - else if(GS(id->name) == ID_OB) - buttons_context_path_object(path); - } - - if(ct->texture) { - RNA_id_pointer_create(&ct->texture->id, &path->ptr[path->len]); - path->len++; - } - - return 1; - + if(ct) { + /* new shading system */ + PointerRNA *ptr= &path->ptr[path->len-1]; + ID *id; -#if 0 - Material *ma; - Lamp *la; - Brush *br; - World *wo; - ParticleSystem *psys; - Tex *tex; - PointerRNA *ptr= &path->ptr[path->len-1]; - int orig_len = path->len; + /* if we already have a (pinned) texture, we're done */ + if(RNA_struct_is_a(ptr->type, &RNA_Texture)) + return 1; - /* if we already have a (pinned) texture, we're done */ - if(RNA_struct_is_a(ptr->type, &RNA_Texture)) { - return 1; - } - /* try brush */ - if((path->tex_ctx == SB_TEXC_BRUSH) && buttons_context_path_brush(path)) { - br= path->ptr[path->len-1].data; + if(!ct->user) + return 0; - if(br) { - tex= give_current_brush_texture(br); - - RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); + id= ct->user->id; + + if(id) { + if(GS(id->name) == ID_BR) + buttons_context_path_brush(path); + else if(GS(id->name) == ID_MA) + buttons_context_path_material(path, 0); + else if(GS(id->name) == ID_WO) + buttons_context_path_world(path); + else if(GS(id->name) == ID_LA) + buttons_context_path_data(path, OB_LAMP); + else if(GS(id->name) == ID_PA) + buttons_context_path_particle(path); + else if(GS(id->name) == ID_OB) + buttons_context_path_object(path); + } + + if(ct->texture) { + RNA_id_pointer_create(&ct->texture->id, &path->ptr[path->len]); path->len++; - return 1; } - } - /* try world */ - if((path->tex_ctx == SB_TEXC_WORLD) && buttons_context_path_world(path)) { - wo= path->ptr[path->len-1].data; - if(wo && GS(wo->id.name)==ID_WO) { - tex= give_current_world_texture(wo); - - RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); - path->len++; + return 1; + } + else { + /* old shading system */ + Material *ma; + Lamp *la; + Brush *br; + World *wo; + ParticleSystem *psys; + Tex *tex; + PointerRNA *ptr= &path->ptr[path->len-1]; + int orig_len = path->len; + + /* if we already have a (pinned) texture, we're done */ + if(RNA_struct_is_a(ptr->type, &RNA_Texture)) { return 1; } - } - /* try particles */ - if((path->tex_ctx == SB_TEXC_PARTICLES) && buttons_context_path_particle(path)) { - if(path->ptr[path->len-1].type == &RNA_ParticleSettings) { - ParticleSettings *part = path->ptr[path->len-1].data; + /* try brush */ + if((path->tex_ctx == SB_TEXC_BRUSH) && buttons_context_path_brush(path)) { + br= path->ptr[path->len-1].data; + + if(br) { + tex= give_current_brush_texture(br); - tex= give_current_particle_texture(part); - RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); - path->len++; - return 1; + RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); + path->len++; + return 1; + } } - else { - psys= path->ptr[path->len-1].data; + /* try world */ + if((path->tex_ctx == SB_TEXC_WORLD) && buttons_context_path_world(path)) { + wo= path->ptr[path->len-1].data; - if(psys && psys->part && GS(psys->part->id.name)==ID_PA) { - tex= give_current_particle_texture(psys->part); + if(wo && GS(wo->id.name)==ID_WO) { + tex= give_current_world_texture(wo); RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); path->len++; return 1; } } - } - /* try material */ - if(buttons_context_path_material(path, 1)) { - ma= path->ptr[path->len-1].data; + /* try particles */ + if((path->tex_ctx == SB_TEXC_PARTICLES) && buttons_context_path_particle(path)) { + if(path->ptr[path->len-1].type == &RNA_ParticleSettings) { + ParticleSettings *part = path->ptr[path->len-1].data; + + tex= give_current_particle_texture(part); + RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); + path->len++; + return 1; + } + else { + psys= path->ptr[path->len-1].data; - if(ma) { - tex= give_current_material_texture(ma); + if(psys && psys->part && GS(psys->part->id.name)==ID_PA) { + tex= give_current_particle_texture(psys->part); - RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); - path->len++; - return 1; + RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); + path->len++; + return 1; + } + } } - } - /* try lamp */ - if(buttons_context_path_data(path, OB_LAMP)) { - la= path->ptr[path->len-1].data; + /* try material */ + if(buttons_context_path_material(path, 1)) { + ma= path->ptr[path->len-1].data; - if(la) { - tex= give_current_lamp_texture(la); + if(ma) { + tex= give_current_material_texture(ma); - RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); - path->len++; - return 1; + RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); + path->len++; + return 1; + } } - } - /* try brushes again in case of no material, lamp, etc */ - path->len = orig_len; - if(buttons_context_path_brush(path)) { - br= path->ptr[path->len-1].data; - - if(br) { - tex= give_current_brush_texture(br); + /* try lamp */ + if(buttons_context_path_data(path, OB_LAMP)) { + la= path->ptr[path->len-1].data; + + if(la) { + tex= give_current_lamp_texture(la); + + RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); + path->len++; + return 1; + } + } + /* try brushes again in case of no material, lamp, etc */ + path->len = orig_len; + if(buttons_context_path_brush(path)) { + br= path->ptr[path->len-1].data; - RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); - path->len++; - return 1; + if(br) { + tex= give_current_brush_texture(br); + + RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); + path->len++; + return 1; + } } } -#endif /* no path to a texture possible */ return 0; @@ -747,9 +747,15 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r } else if(CTX_data_equals(member, "texture")) { ButsContextTexture *ct= sbuts->texuser; - - if(ct) + + if(ct) { + /* new shading system */ CTX_data_pointer_set(result, &ct->texture->id, &RNA_Texture, ct->texture); + } + else { + /* old shading system */ + set_pointer_type(path, result, &RNA_Texture); + } return 1; } @@ -772,7 +778,10 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r else if(CTX_data_equals(member, "texture_user")) { ButsContextTexture *ct= sbuts->texuser; - if(ct && ct->user && ct->user->ptr.data) { + if(!ct) + return 0; /* old shading system */ + + if(ct->user && ct->user->ptr.data) { ButsTextureUser *user= ct->user; CTX_data_pointer_set(result, user->ptr.id.data, user->ptr.type, user->ptr.data); } @@ -782,29 +791,36 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r else if(CTX_data_equals(member, "texture_node")) { ButsContextTexture *ct= sbuts->texuser; - if(ct && ct->user && ct->user->node) - CTX_data_pointer_set(result, &ct->user->ntree->id, &RNA_Node, ct->user->node); + if(ct) { + /* new shading system */ + if(ct->user && ct->user->node) + CTX_data_pointer_set(result, &ct->user->ntree->id, &RNA_Node, ct->user->node); - return 1; - } -#if 0 - else if(CTX_data_equals(member, "texture_node")) { - PointerRNA *ptr; + return 1; + } + else { + /* old shading system */ + PointerRNA *ptr; - if((ptr=get_pointer_type(path, &RNA_Material))) { - Material *ma= ptr->data; + if((ptr=get_pointer_type(path, &RNA_Material))) { + Material *ma= ptr->data; - if(ma) { - bNode *node= give_current_material_texture_node(ma); - CTX_data_pointer_set(result, &ma->id, &RNA_Node, node); + if(ma) { + bNode *node= give_current_material_texture_node(ma); + CTX_data_pointer_set(result, &ma->id, &RNA_Node, node); + } } - } - return 1; + return 1; + } } else if(CTX_data_equals(member, "texture_slot")) { + ButsContextTexture *ct= sbuts->texuser; PointerRNA *ptr; + if(ct) + return 0; /* new shading system */ + if((ptr=get_pointer_type(path, &RNA_Material))) { Material *ma= ptr->data; @@ -851,7 +867,6 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } -#endif else if(CTX_data_equals(member, "bone")) { set_pointer_type(path, result, &RNA_Bone); return 1; diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index dc013fc952b..dd9f3c57896 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -58,6 +58,7 @@ #include "BKE_node.h" #include "BKE_paint.h" #include "BKE_particle.h" +#include "BKE_scene.h" #include "RNA_access.h" @@ -252,6 +253,17 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts) /* gatheravailable texture users in context. runs on every draw of properties editor, before the buttons are created. */ ButsContextTexture *ct= sbuts->texuser; + Scene *scene= CTX_data_scene(C); + + if(!scene_use_new_shading_nodes(scene)) { + if(ct) { + MEM_freeN(ct); + BLI_freelistN(&ct->users); + sbuts->texuser= NULL; + } + + return; + } if(!ct) { ct= MEM_callocN(sizeof(ButsContextTexture), "ButsContextTexture"); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 1d963c5a45a..35f0cc29f96 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -108,8 +108,6 @@ void ED_node_changed_update(ID *id, bNode *node) WM_main_add_notifier(NC_LAMP|ND_LIGHTING_DRAW, id); else if(GS(id->name) == ID_WO) WM_main_add_notifier(NC_WORLD|ND_WORLD_DRAW, id); - else if(GS(id->name) == ID_TE) - WM_main_add_notifier(NC_TEXTURE|ND_NODES, id); } else if(treetype==NTREE_COMPOSIT) { NodeTagChanged(edittree, node); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index c7744263f04..2b0ce72376f 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -64,6 +64,7 @@ #include "BKE_material.h" #include "BKE_modifier.h" #include "BKE_paint.h" +#include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_texture.h" #include "BKE_report.h" @@ -279,7 +280,7 @@ bNode *node_tree_get_editgroup(bNodeTree *nodetree) /* assumes nothing being done in ntree yet, sets the default in/out node */ /* called from shading buttons or header */ -void ED_node_shader_default(ID *id) +void ED_node_shader_default(Scene *scene, ID *id) { bNode *in, *out; bNodeSocket *fromsock, *tosock; @@ -292,8 +293,15 @@ void ED_node_shader_default(ID *id) switch(GS(id->name)) { case ID_MA: ((Material*)id)->nodetree = ntree; - output_type = SH_NODE_OUTPUT_MATERIAL; - shader_type = SH_NODE_BSDF_DIFFUSE; + + if(scene_use_new_shading_nodes(scene)) { + output_type = SH_NODE_OUTPUT_MATERIAL; + shader_type = SH_NODE_BSDF_DIFFUSE; + } + else { + output_type = SH_NODE_OUTPUT; + shader_type = SH_NODE_MATERIAL; + } break; case ID_WO: ((World*)id)->nodetree = ntree; @@ -305,11 +313,6 @@ void ED_node_shader_default(ID *id) output_type = SH_NODE_OUTPUT_LAMP; shader_type = SH_NODE_EMISSION; break; - case ID_TE: - ((Tex*)id)->nodetree = ntree; - output_type = SH_NODE_OUTPUT_TEXTURE; - shader_type = SH_NODE_TEX_CLOUDS; - break; default: printf("ED_node_shader_default called on wrong ID type.\n"); return; @@ -376,9 +379,6 @@ void ED_node_composit_default(Scene *sce) /* called from shading buttons or header */ void ED_node_texture_default(Tex *tx) { - ED_node_shader_default(&tx->id); - -#if 0 bNode *in, *out; bNodeSocket *fromsock, *tosock; bNodeTemplate ntemp; @@ -406,7 +406,6 @@ void ED_node_texture_default(Tex *tx) nodeAddLink(tx->nodetree, in, fromsock, out, tosock); ntreeUpdateTree(tx->nodetree); -#endif } /* id is supposed to contain a node tree */ @@ -438,7 +437,7 @@ void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *tre } else if(idtype == ID_TE) { *ntree= ((Tex*)id)->nodetree; - if(treetype) *treetype= (*ntree)? (*ntree)->type: NTREE_SHADER; + if(treetype) *treetype= NTREE_TEXTURE; } else { if(treetype) *treetype= 0; @@ -3663,6 +3662,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) /* hook into UI */ uiIDContextProperty(C, &ptr, &prop); + if(prop) { RNA_id_pointer_create(&ntree->id, &idptr); RNA_property_pointer_set(&ptr, prop, idptr); @@ -3698,4 +3698,3 @@ void NODE_OT_new_node_tree(wmOperatorType *ot) RNA_def_enum(ot->srna, "type", nodetree_type_items, NTREE_COMPOSIT, "Tree Type", ""); RNA_def_string(ot->srna, "name", "NodeTree", MAX_ID_NAME-2, "Name", ""); } - diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 24e7594e784..cdc79e0a23f 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -485,12 +485,12 @@ static void rna_def_ID(BlenderRNA *brna) prop= RNA_def_property(srna, "recalc", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_ID_RECALC); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Recalc", "Datablock is tagged for recalculation."); + RNA_def_property_ui_text(prop, "Recalc", "Datablock is tagged for recalculation"); prop= RNA_def_property(srna, "recalc_data", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_ID_RECALC_DATA); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Recalc Data", "Datablock data is tagged for recalculation."); + RNA_def_property_ui_text(prop, "Recalc Data", "Datablock data is tagged for recalculation"); prop= RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "lib"); diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index 82d095e3510..7d585187f4f 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -148,13 +148,14 @@ static void rna_Lamp_spot_size_set(PointerRNA *ptr, float value) la->spotsize= RAD2DEGF(value); } -static void rna_Lamp_use_nodes_set(PointerRNA *ptr, int value) +static void rna_Lamp_use_nodes_update(Main *blain, Scene *scene, PointerRNA *ptr) { Lamp *la= (Lamp*)ptr->data; - la->use_nodes= value; if(la->use_nodes && la->nodetree==NULL) - ED_node_shader_default(&la->id); + ED_node_shader_default(scene, &la->id); + + rna_Lamp_update(blain, scene, ptr); } #else @@ -385,9 +386,9 @@ static void rna_def_lamp(BlenderRNA *brna) prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1); - RNA_def_property_boolean_funcs(prop, NULL, "rna_Lamp_use_nodes_set"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the lamp"); - RNA_def_property_update(prop, 0, "rna_Lamp_update"); + RNA_def_property_update(prop, 0, "rna_Lamp_use_nodes_update"); /* common */ rna_def_animdata_common(srna); diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 16b9371916f..209b27eb1ff 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -271,13 +271,14 @@ static void rna_Material_use_specular_ramp_set(PointerRNA *ptr, int value) ma->ramp_spec= add_colorband(0); } -static void rna_Material_use_nodes_set(PointerRNA *ptr, int value) +static void rna_Material_use_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Material *ma= (Material*)ptr->data; - ma->use_nodes= value; if(ma->use_nodes && ma->nodetree==NULL) - ED_node_shader_default(&ma->id); + ED_node_shader_default(scene, &ma->id); + + rna_Material_update(bmain, scene, ptr); } static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *UNUSED(C), PointerRNA *ptr, @@ -1956,9 +1957,9 @@ void RNA_def_material(BlenderRNA *brna) prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1); - RNA_def_property_boolean_funcs(prop, NULL, "rna_Material_use_nodes_set"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the material"); - RNA_def_property_update(prop, 0, "rna_Material_update"); + RNA_def_property_update(prop, 0, "rna_Material_use_nodes_update"); prop= RNA_def_property(srna, "active_node_material", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Material"); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 4cbb1c7deea..f1fe5b6a85e 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1167,6 +1167,18 @@ static void def_sh_geometry(StructRNA *srna) RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } +static void def_sh_attribute(StructRNA *srna) +{ + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeShaderAttribute", "storage"); + + prop = RNA_def_property(srna, "attribute_name", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_ui_text(prop, "Attribute Name", ""); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); +} + static void def_sh_tex_sky(StructRNA *srna) { PropertyRNA *prop; diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index ef2e97c4427..45015f491d2 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -376,7 +376,7 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REQUIRED); func= RNA_def_function(srna, "update_progress", "RE_engine_update_progress"); - prop= RNA_def_float(func, "progress", 0, 0.0f, 1.0f, "", "Percentage of render that's done.", 0.0f, 1.0f); + prop= RNA_def_float(func, "progress", 0, 0.0f, 1.0f, "", "Percentage of render that's done", 0.0f, 1.0f); RNA_def_property_flag(prop, PROP_REQUIRED); func= RNA_def_function(srna, "report", "RE_engine_report"); diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index b5e8acb76e5..61c0605c73b 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -347,6 +347,16 @@ static void rna_Texture_use_nodes_set(PointerRNA *ptr, int v) ED_node_texture_default(tex); } +static void rna_Texture_use_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Tex *tex= (Tex*)ptr->data; + + if(tex->use_nodes && tex->nodetree==NULL) + ED_node_shader_default(scene, &tex->id); + + rna_Texture_nodes_update(bmain, scene, ptr); +} + static void rna_ImageTexture_mipmap_set(PointerRNA *ptr, int value) { Tex *tex= (Tex*)ptr->data; @@ -1831,8 +1841,9 @@ static void rna_def_texture(BlenderRNA *brna) prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1); RNA_def_property_boolean_funcs(prop, NULL, "rna_Texture_use_nodes_set"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Nodes", "Make this a node-based texture"); - RNA_def_property_update(prop, 0, "rna_Texture_nodes_update"); + RNA_def_property_update(prop, 0, "rna_Texture_use_nodes_update"); prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "nodetree"); diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 0b7bf62cc27..eb797158477 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -123,13 +123,14 @@ static void rna_World_stars_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Po WM_main_add_notifier(NC_WORLD|ND_WORLD_STARS, wo); } -static void rna_World_use_nodes_set(PointerRNA *ptr, int value) +static void rna_World_use_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr) { World *wrld= (World*)ptr->data; - wrld->use_nodes= value; if(wrld->use_nodes && wrld->nodetree==NULL) - ED_node_shader_default(&wrld->id); + ED_node_shader_default(scene, &wrld->id); + + rna_World_update(bmain, scene, ptr); } #else @@ -583,9 +584,9 @@ void RNA_def_world(BlenderRNA *brna) prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1); - RNA_def_property_boolean_funcs(prop, NULL, "rna_World_use_nodes_set"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the world"); - RNA_def_property_update(prop, 0, "rna_World_update"); + RNA_def_property_update(prop, 0, "rna_World_use_nodes_update"); rna_def_lighting(brna); rna_def_world_mist(brna); diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c index 9620886f435..603aa7ceb77 100644 --- a/source/blender/nodes/texture/node_texture_tree.c +++ b/source/blender/nodes/texture/node_texture_tree.c @@ -49,7 +49,6 @@ #include "node_util.h" #include "NOD_texture.h" #include "node_texture_util.h" -#include "../shader/node_shader_util.h" #include "RE_pipeline.h" #include "RE_shader_ext.h" @@ -217,57 +216,36 @@ int ntreeTexExecTree( ShadeInput *shi, MTex *mtex ){ + TexCallData data; + float *nor= texres->nor; + int retval = TEX_INT; bNodeThreadStack *nts = NULL; bNodeTreeExec *exec= nodes->execdata; - if(nodes->type == NTREE_SHADER) { - ShaderCallData scd; - - memset(&scd, 0, sizeof(scd)); - scd.texres = texres; - scd.co = co; - scd.dxt = dxt; - scd.dyt = dyt; - - if (!exec) - exec = nodes->execdata = ntreeShaderBeginExecTree(nodes, 1); - - nts= ntreeGetThreadStack(exec, thread); - ntreeExecThreadNodes(exec, nts, &scd, thread); - ntreeReleaseThreadStack(nts); - - return TEX_INT|TEX_RGB; - } - else { - TexCallData data; - float *nor= texres->nor; - int retval = TEX_INT; - - data.co = co; - data.dxt = dxt; - data.dyt = dyt; - data.osatex = osatex; - data.target = texres; - data.do_preview = preview; - data.thread = thread; - data.which_output = which_output; - data.cfra= cfra; - data.mtex= mtex; - data.shi= shi; - - if (!exec) - exec = ntreeTexBeginExecTree(nodes, 1); - - nts= ntreeGetThreadStack(exec, thread); - ntreeExecThreadNodes(exec, nts, &data, thread); - ntreeReleaseThreadStack(nts); + data.co = co; + data.dxt = dxt; + data.dyt = dyt; + data.osatex = osatex; + data.target = texres; + data.do_preview = preview; + data.thread = thread; + data.which_output = which_output; + data.cfra= cfra; + data.mtex= mtex; + data.shi= shi; + + if (!exec) + exec = ntreeTexBeginExecTree(nodes, 1); + + nts= ntreeGetThreadStack(exec, thread); + ntreeExecThreadNodes(exec, nts, &data, thread); + ntreeReleaseThreadStack(nts); - if(texres->nor) retval |= TEX_NOR; - retval |= TEX_RGB; - /* confusing stuff; the texture output node sets this to NULL to indicate no normal socket was set - however, the texture code checks this for other reasons (namely, a normal is required for material) */ - texres->nor= nor; + if(texres->nor) retval |= TEX_NOR; + retval |= TEX_RGB; + /* confusing stuff; the texture output node sets this to NULL to indicate no normal socket was set + however, the texture code checks this for other reasons (namely, a normal is required for material) */ + texres->nor= nor; - return retval; - } + return retval; } diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 9fdfd085111..ae814f67450 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -1362,9 +1362,9 @@ int multitex_ext_safe(Tex *tex, float *texvec, TexResult *texres) { int use_nodes= tex->use_nodes, retval; - // XXX tex->use_nodes= 0; + tex->use_nodes= 0; retval= multitex_nodes(tex, texvec, NULL, NULL, 0, texres, 0, 0, NULL, NULL); - // XXX tex->use_nodes= use_nodes; + tex->use_nodes= use_nodes; return retval; } |