Depsgraph: Store Scene in depsgraph struct
This way we can retrieve the scene from depsgraph that were not created from a G.main (e.g., when doing material thumbnail preview render).
This commit is contained in:
parent
b43200a120
commit
05243a633a
|
@ -70,6 +70,9 @@ namespace DEG {
|
|||
|
||||
void DepsgraphRelationBuilder::build_scene(Main *bmain, Scene *scene)
|
||||
{
|
||||
/* XXX store scene to access from DAG_get_scene */
|
||||
m_graph->scene = scene;
|
||||
|
||||
if (scene->set) {
|
||||
build_scene(bmain, scene->set);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ struct GHash;
|
|||
struct GSet;
|
||||
struct PointerRNA;
|
||||
struct PropertyRNA;
|
||||
struct Scene;
|
||||
|
||||
namespace DEG {
|
||||
|
||||
|
@ -173,6 +174,8 @@ struct Depsgraph {
|
|||
SpinLock lock;
|
||||
|
||||
// XXX: additional stuff like eval contexts, mempools for allocating nodes from, etc.
|
||||
|
||||
Scene *scene; /* XXX: We really shouldn't do that, but it's required for shader preview */
|
||||
};
|
||||
|
||||
} // namespace DEG
|
||||
|
|
|
@ -76,14 +76,8 @@ short DEG_get_eval_flags_for_id(Depsgraph *graph, ID *id)
|
|||
|
||||
Scene *DAG_get_scene(Depsgraph *graph)
|
||||
{
|
||||
Main *bmain = G.main;
|
||||
LINKLIST_FOREACH (Scene*, scene, &bmain->scene) {
|
||||
if (scene->depsgraph == graph) {
|
||||
/* Got the scene! */
|
||||
return scene;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
|
||||
return deg_graph->scene;
|
||||
}
|
||||
|
||||
SceneLayer *DAG_get_scene_layer(Depsgraph *graph)
|
||||
|
|
Loading…
Reference in New Issue