diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-10-16 22:15:03 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-10-16 22:29:04 +0300 |
commit | e4f2b2be26adbb5c34231598526a270559c6e183 (patch) | |
tree | 40601b1349372904cffe619003dcc83b7011d8be /source/blender/blenkernel/intern/context.c | |
parent | e8962f90de4222d6f750d3d3478eff65490365d8 (diff) |
Workspace: Move engines to workspace and Properties Editor cleanup
Engine is not stored in WorkSpaces. That defines the "context" engine, which
is used for the entire UI.
The engine used for the poll of nodes (add node menu, new nodes when "Use Nodes")
is obtained from context.
Introduce a ViewRender struct for viewport settings that are defined for
workspaces and scene. This struct will be populated with the hand-picked
settings that can be defined per workspace as per the 2.8 design.
* use_scene_settings
* properties editor: workshop + organize context path
Use Scene Settings
==================
For viewport drawing, Workspaces have an option to use the Scene render
settings (F12) instead of the viewport settings.
This way users can quickly preview the final render settings, engine and
View Layer. This will affect all the editors in that workspace, and it will be
clearly indicated in the top-bar.
Properties Editor: Add Workspace and organize context path
==========================================================
We now have the properties of:
Scene, Scene > Layer, Scene > World, Workspace
[Scene | Workspace] > Render Layer > Object
[Scene | Workspace] > Render Layer > Object > Data
(...)
Reviewers: Campbell Barton, Julian Eisel
Differential Revision: https://developer.blender.org/D2842
Diffstat (limited to 'source/blender/blenkernel/intern/context.c')
-rw-r--r-- | source/blender/blenkernel/intern/context.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 4f1dd18b39c..bc75958ba33 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -57,6 +57,8 @@ #include "BKE_sound.h" #include "BKE_workspace.h" +#include "RE_engine.h" + #include "RNA_access.h" #ifdef WITH_PYTHON @@ -927,10 +929,36 @@ SceneLayer *CTX_data_scene_layer(const bContext *C) return sl; } else { - return BKE_scene_layer_from_workspace_get(CTX_wm_workspace(C)); + return BKE_scene_layer_from_workspace_get(CTX_data_scene(C), CTX_wm_workspace(C)); + } +} + +ViewRender *CTX_data_view_render(const bContext *C) +{ + ViewRender *view_render; + + if (ctx_data_pointer_verify(C, "view_render", (void *)&view_render)) { + return view_render; + } + else { + Scene *scene = CTX_data_scene(C); + WorkSpace *workspace = CTX_wm_workspace(C); + return BKE_viewrender_get(scene, workspace); } } +RenderEngineType *CTX_data_engine(const bContext *C) +{ + const char *engine_id; + + if (!ctx_data_pointer_verify(C, "engine", (void *)&engine_id)) { + ViewRender *view_render = CTX_data_view_render(C); + engine_id = view_render->engine_id; + } + + return RE_engines_find(engine_id); +} + /** * This is tricky. Sometimes the user overrides the render_layer * but not the scene_collection. In this case what to do? @@ -1247,7 +1275,8 @@ void CTX_data_eval_ctx(const bContext *C, EvaluationContext *eval_ctx) Scene *scene = CTX_data_scene(C); SceneLayer *scene_layer = CTX_data_scene_layer(C); + RenderEngineType *engine = CTX_data_engine(C); DEG_evaluation_context_init_from_scene(eval_ctx, - scene, scene_layer, + scene, scene_layer, engine, DAG_EVAL_VIEWPORT); } |