Fix #120680: add node tree update operation after adding new views
The Switch View node cannot be automatically updated when new views are added. This is because there is no tree update operation after adding new views. This patch simply fix it by tag the node tree and update it. Pull Request: https://projects.blender.org/blender/blender/pulls/120685
This commit is contained in:
committed by
Jacques Lucke
parent
382131fef2
commit
c727bf3f76
@@ -51,6 +51,7 @@
|
||||
#include "BKE_main.hh"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_tree_update.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_report.hh"
|
||||
#include "BKE_scene.hh"
|
||||
@@ -1830,6 +1831,7 @@ static bool render_view_remove_poll(bContext *C)
|
||||
|
||||
static int render_view_add_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Main* bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
BKE_scene_add_render_view(scene, nullptr);
|
||||
@@ -1837,6 +1839,9 @@ static int render_view_add_exec(bContext *C, wmOperator * /*op*/)
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
|
||||
|
||||
BKE_ntree_update_tag_id_changed(bmain, &scene->id);
|
||||
ED_node_tree_propagate_change(C, bmain, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
@@ -1862,6 +1867,7 @@ void SCENE_OT_render_view_add(wmOperatorType *ot)
|
||||
|
||||
static int render_view_remove_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Main* bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
SceneRenderView *rv = static_cast<SceneRenderView *>(
|
||||
BLI_findlink(&scene->r.views, scene->r.actview));
|
||||
@@ -1872,6 +1878,9 @@ static int render_view_remove_exec(bContext *C, wmOperator * /*op*/)
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
|
||||
|
||||
BKE_ntree_update_tag_id_changed(bmain, &scene->id);
|
||||
ED_node_tree_propagate_change(C, bmain, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user