Fixes #28599: Wrong re-assigning of layers in RenderLayer comp nodes when deleting a render layer.

Also added the check of comp nodetree of all scenes, as others might also use that scene in their compositing!
This commit is contained in:
Bastien Montagne 2011-09-12 17:27:02 +00:00
parent 124d16aa14
commit 71f9397541

@ -529,7 +529,7 @@ void SCENE_OT_render_layer_add(wmOperatorType *ot)
static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op)) static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
{ {
Scene *scene= CTX_data_scene(C); Scene *scene = CTX_data_scene(C), *sce;
SceneRenderLayer *rl; SceneRenderLayer *rl;
int act= scene->r.actlay; int act= scene->r.actlay;
@ -542,10 +542,11 @@ static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
scene->r.actlay= 0; scene->r.actlay= 0;
if(scene->nodetree) { for(sce = CTX_data_main(C)->scene.first; sce; sce = sce->id.next) {
if(sce->nodetree) {
bNode *node; bNode *node;
for(node= scene->nodetree->nodes.first; node; node= node->next) { for(node = sce->nodetree->nodes.first; node; node = node->next) {
if(node->type==CMP_NODE_R_LAYERS && node->id==NULL) { if(node->type==CMP_NODE_R_LAYERS && (Scene*)node->id==scene) {
if(node->custom1==act) if(node->custom1==act)
node->custom1= 0; node->custom1= 0;
else if(node->custom1>act) else if(node->custom1>act)
@ -553,6 +554,7 @@ static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
} }
} }
} }
}
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);