diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_blender_version.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_context.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_scene.h | 13 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_workspace.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/context.c | 18 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 100 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/workspace.c | 10 |
10 files changed, 25 insertions, 133 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 1e970291c01..0c22edc5430 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -28,7 +28,7 @@ * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 280 -#define BLENDER_SUBVERSION 6 +#define BLENDER_SUBVERSION 7 /* Several breakages with 270, e.g. constraint deg vs rad */ #define BLENDER_MINVERSION 270 #define BLENDER_MINSUBVERSION 6 diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 3d722f5324e..8a478a7ae59 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -259,7 +259,6 @@ struct Scene *CTX_data_scene(const bContext *C); struct LayerCollection *CTX_data_layer_collection(const bContext *C); struct SceneCollection *CTX_data_scene_collection(const bContext *C); struct ViewLayer *CTX_data_view_layer(const bContext *C); -struct ViewRender *CTX_data_view_render(const bContext *C); struct RenderEngineType *CTX_data_engine_type(const bContext *C); struct ToolSettings *CTX_data_tool_settings(const bContext *C); diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index aa09e2fd5c3..2907b568c00 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -283,7 +283,7 @@ typedef struct bNodeTreeType { /* callbacks */ void (*free_cache)(struct bNodeTree *ntree); void (*free_node_cache)(struct bNodeTree *ntree, struct bNode *node); - void (*foreach_nodeclass)(struct ViewRender *view_render, void *calldata, bNodeClassCallback func); /* iteration over all node classes */ + void (*foreach_nodeclass)(struct Scene *scene, void *calldata, bNodeClassCallback func); /* iteration over all node classes */ /* Check visibility in the node editor */ int (*poll)(const struct bContext *C, struct bNodeTreeType *ntreetype); /* Select a node tree from the context */ diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 8036673cbdf..75392c42bf3 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -173,19 +173,6 @@ int BKE_render_preview_pixel_size(const struct RenderData *r); /**********************************/ -struct ViewRender *BKE_viewrender_get(struct Scene *scene, struct WorkSpace *workspace); -void BKE_viewrender_init(struct ViewRender *view_render); -void BKE_viewrender_free(struct ViewRender *view_render); -void BKE_viewrender_copy(struct ViewRender *view_render_dst, const struct ViewRender *view_render_src); -bool BKE_viewrender_use_new_shading_nodes(const struct ViewRender *view_render); -bool BKE_viewrender_use_shading_nodes_custom(const struct ViewRender *view_render); -bool BKE_viewrender_use_world_space_shading(const struct ViewRender *view_render); -bool BKE_viewrender_use_spherical_stereo(const struct ViewRender *view_render); -bool BKE_viewrender_uses_blender_internal(const struct ViewRender *view_render); -bool BKE_viewrender_uses_blender_eevee(const struct ViewRender *view_render); - -/**********************************/ - double BKE_scene_unit_scale(const struct UnitSettings *unit, const int unit_type, double value); /* multiview */ diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 1a0e61b0dd6..c0116f6dd56 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -437,9 +437,9 @@ enum { typedef struct ImBuf *(*SequencerDrawView)( struct Depsgraph *depsgraph, struct Scene *scene, - struct ViewLayer *view_layer, struct RenderEngineType *engine_type, + struct ViewLayer *view_layer, int drawtype, struct Object *camera, int width, int height, - unsigned int flag, unsigned int draw_flags, int drawtype, int alpha_mode, + unsigned int flag, unsigned int draw_flags, int alpha_mode, int samples, const char *viewname, struct GPUOffScreen *ofs, char err_out[256]); extern SequencerDrawView sequencer_view3d_cb; diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h index 3d28b66dd20..5dee6b8c44f 100644 --- a/source/blender/blenkernel/BKE_workspace.h +++ b/source/blender/blenkernel/BKE_workspace.h @@ -109,8 +109,6 @@ struct WorkSpaceLayout *BKE_workspace_hook_layout_for_workspace_get( void BKE_workspace_hook_layout_for_workspace_set( struct WorkSpaceInstanceHook *hook, struct WorkSpace *workspace, struct WorkSpaceLayout *layout) ATTR_NONNULL(); -struct ViewRender *BKE_workspace_view_render_get(struct WorkSpace *workspace) GETTER_ATTRS; - /* flags */ bool BKE_workspace_use_scene_settings_get(const struct WorkSpace *workspace) GETTER_ATTRS; void BKE_workspace_use_scene_settings_set(struct WorkSpace *workspace, bool value) SETTER_ATTRS; diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 351e43706dd..f5a0d4e7c60 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -930,24 +930,10 @@ ViewLayer *CTX_data_view_layer(const bContext *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_type(const bContext *C) { - ViewRender *view_render = CTX_data_view_render(C); - return RE_engines_find(view_render->engine_id); + Scene *scene = CTX_data_scene(C); + return RE_engines_find(scene->r.engine); } /** diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index e68d1db3e4a..51a4e8bfd66 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -744,7 +744,7 @@ void BKE_scene_init(Scene *sce) sce->r.ffcodecdata.audio_bitrate = 192; sce->r.ffcodecdata.audio_channels = 2; - BKE_viewrender_init(&sce->view_render); + BLI_strncpy(sce->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(sce->r.engine)); sce->audio.distance_model = 2.0f; sce->audio.doppler_factor = 1.0f; @@ -1280,21 +1280,19 @@ static bool check_rendered_viewport_visible(Main *bmain) wmWindow *window; for (window = wm->windows.first; window != NULL; window = window->next) { const bScreen *screen = BKE_workspace_active_screen_get(window->workspace_hook); - WorkSpace *workspace = BKE_workspace_active_get(window->workspace_hook); Scene *scene = window->scene; - ViewRender *view_render = BKE_viewrender_get(scene, workspace); - ScrArea *area; - RenderEngineType *type = RE_engines_find(view_render->engine_id); - if ((type->draw_engine != NULL) || (type->render_to_view == NULL)) { + RenderEngineType *type = RE_engines_find(scene->r.engine); + + if (type->draw_engine || !type->render_to_view) { continue; } - const bool use_legacy = (type->flag & RE_USE_LEGACY_PIPELINE) != 0; - for (area = screen->areabase.first; area != NULL; area = area->next) { + + for (ScrArea *area = screen->areabase.first; area != NULL; area = area->next) { View3D *v3d = area->spacedata.first; if (area->spacetype != SPACE_VIEW3D) { continue; } - if (v3d->drawtype == OB_RENDER || !use_legacy) { + if (v3d->drawtype == OB_RENDER) { return true; } } @@ -1529,34 +1527,37 @@ next_set: bool BKE_scene_use_new_shading_nodes(const Scene *scene) { - return BKE_viewrender_use_new_shading_nodes(&scene->view_render); + const RenderEngineType *type = RE_engines_find(scene->r.engine); + return (type && type->flag & RE_USE_SHADING_NODES); } bool BKE_scene_use_shading_nodes_custom(Scene *scene) { - return BKE_viewrender_use_shading_nodes_custom(&scene->view_render); + RenderEngineType *type = RE_engines_find(scene->r.engine); + return (type && type->flag & RE_USE_SHADING_NODES_CUSTOM); } bool BKE_scene_use_world_space_shading(Scene *scene) { - RenderEngineType *type = RE_engines_find(scene->view_render.engine_id); + const RenderEngineType *type = RE_engines_find(scene->r.engine); return ((scene->r.mode & R_USE_WS_SHADING) || (type && (type->flag & RE_USE_SHADING_NODES))); } bool BKE_scene_use_spherical_stereo(Scene *scene) { - return BKE_viewrender_use_spherical_stereo(&scene->view_render); + RenderEngineType *type = RE_engines_find(scene->r.engine); + return (type && type->flag & RE_USE_SPHERICAL_STEREO); } bool BKE_scene_uses_blender_internal(const Scene *scene) { - return BKE_viewrender_uses_blender_internal(&scene->view_render); + return STREQ(scene->r.engine, RE_engine_id_BLENDER_RENDER); } bool BKE_scene_uses_blender_eevee(const Scene *scene) { - return BKE_viewrender_uses_blender_eevee(&scene->view_render); + return STREQ(scene->r.engine, RE_engine_id_BLENDER_EEVEE); } void BKE_scene_base_flag_to_objects(ViewLayer *view_layer) @@ -1661,75 +1662,6 @@ int BKE_render_preview_pixel_size(const RenderData *r) return r->preview_pixel_size; } -/* ***************************************************** */ -/* render engine settings */ - -ViewRender *BKE_viewrender_get(Scene *scene, WorkSpace *workspace) -{ - if (workspace == NULL || BKE_workspace_use_scene_settings_get(workspace)) { - return &scene->view_render; - } - return BKE_workspace_view_render_get(workspace); -} - -/** - * Initialize a static created struct for WorkSpace and Scene to store the viewport - * related drawing data. - */ -void BKE_viewrender_init(ViewRender *view_render) -{ - BLI_strncpy(view_render->engine_id, RE_engine_id_BLENDER_EEVEE, sizeof(view_render->engine_id)); -} - -/** - * Do not free ViewRender itself since it's not even allocated. - */ -void BKE_viewrender_free(ViewRender *UNUSED(view_render)) -{ - /* Do nothing. */ -} - -/** - * Copy used by libblock copying. - */ -void BKE_viewrender_copy(ViewRender *to, const ViewRender *from) -{ - *to = *from; -} - -bool BKE_viewrender_use_new_shading_nodes(const ViewRender *view_render) -{ - RenderEngineType *type = RE_engines_find(view_render->engine_id); - return (type && type->flag & RE_USE_SHADING_NODES); -} - -bool BKE_viewrender_use_shading_nodes_custom(const ViewRender *view_render) -{ - RenderEngineType *type = RE_engines_find(view_render->engine_id); - return (type && type->flag & RE_USE_SHADING_NODES_CUSTOM); -} - -bool BKE_viewrender_use_spherical_stereo(const ViewRender *view_render) -{ - const char *engine_id = view_render->engine_id; - RenderEngineType *type = RE_engines_find(engine_id); - return (type && type->flag & RE_USE_SPHERICAL_STEREO); -} - -bool BKE_viewrender_uses_blender_internal(const ViewRender *view_render) -{ - const char *engine_id = view_render->engine_id; - return STREQ(engine_id, RE_engine_id_BLENDER_RENDER); -} - -bool BKE_viewrender_uses_blender_eevee(const ViewRender *view_render) -{ - const char *engine_id = view_render->engine_id; - return STREQ(engine_id, RE_engine_id_BLENDER_EEVEE); -} - -/* ***************************************************** */ - /* Apply the needed correction factor to value, based on unit_type (only length-related are affected currently) * and unit->scale_length. */ diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 4f8e4b0b842..f7871c0fa0b 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3333,14 +3333,14 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq context->scene->r.seq_prev_type = 3 /* == OB_SOLID */; /* opengl offscreen render */ - RenderEngineType *engine_type = RE_engines_find(scene->view_render.engine_id); depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); BKE_scene_graph_update_for_newframe(depsgraph, context->bmain); ibuf = sequencer_view3d_cb( /* set for OpenGL render (NULL when scrubbing) */ - depsgraph, scene, view_layer, engine_type, + depsgraph, scene, view_layer, + context->scene->r.seq_prev_type, camera, width, height, IB_rect, - draw_flags, context->scene->r.seq_prev_type, + draw_flags, scene->r.alphamode, context->gpu_samples, viewname, context->gpu_offscreen, err_out); if (ibuf == NULL) { diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c index 466848fa6b1..8de62f82c1b 100644 --- a/source/blender/blenkernel/intern/workspace.c +++ b/source/blender/blenkernel/intern/workspace.c @@ -171,8 +171,6 @@ void BKE_workspace_free(WorkSpace *workspace) BLI_freelistN(&workspace->owner_ids); BLI_freelistN(&workspace->layouts); - - BKE_viewrender_free(&workspace->view_render); } /** @@ -442,14 +440,6 @@ void BKE_workspace_hook_layout_for_workspace_set( workspace_relation_ensure_updated(&workspace->hook_layout_relations, hook, layout); } -/** - * Get the render engine of a workspace, to be used in the viewport. - */ -ViewRender *BKE_workspace_view_render_get(WorkSpace *workspace) -{ - return &workspace->view_render; -} - /* Flags */ bool BKE_workspace_use_scene_settings_get(const WorkSpace *workspace) { |