2011-05-19 11:34:11 +00:00
|
|
|
/*
|
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
2011-08-12 18:24:17 +00:00
|
|
|
/** \file blender/editors/render/render_update.c
|
2011-05-19 11:34:11 +00:00
|
|
|
* \ingroup edrend
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
#include "DNA_lamp_types.h"
|
|
|
|
|
#include "DNA_material_types.h"
|
2012-12-18 12:42:13 +00:00
|
|
|
#include "DNA_meshdata_types.h"
|
2011-05-19 11:34:11 +00:00
|
|
|
#include "DNA_node_types.h"
|
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
|
#include "DNA_space_types.h"
|
|
|
|
|
#include "DNA_view3d_types.h"
|
2017-10-16 18:37:37 -02:00
|
|
|
#include "DNA_workspace_types.h"
|
2011-05-19 11:34:11 +00:00
|
|
|
#include "DNA_world_types.h"
|
2013-05-17 16:46:59 +00:00
|
|
|
#include "DNA_windowmanager_types.h"
|
2011-05-19 11:34:11 +00:00
|
|
|
|
2017-09-25 20:07:02 +02:00
|
|
|
#include "DRW_engine.h"
|
|
|
|
|
|
2014-11-22 14:39:53 +01:00
|
|
|
#include "BLI_listbase.h"
|
2011-11-28 14:55:35 +00:00
|
|
|
#include "BLI_threads.h"
|
2011-05-19 11:34:11 +00:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
|
|
|
|
|
#include "BKE_context.h"
|
2012-12-18 13:25:23 +00:00
|
|
|
#include "BKE_DerivedMesh.h"
|
2011-05-19 11:34:11 +00:00
|
|
|
#include "BKE_icons.h"
|
2017-03-30 11:18:57 +02:00
|
|
|
#include "BKE_layer.h"
|
2011-05-19 11:34:11 +00:00
|
|
|
#include "BKE_main.h"
|
|
|
|
|
#include "BKE_material.h"
|
|
|
|
|
#include "BKE_node.h"
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 17:21:31 +00:00
|
|
|
#include "BKE_paint.h"
|
2015-08-27 12:10:01 +02:00
|
|
|
#include "BKE_scene.h"
|
2017-10-16 18:37:37 -02:00
|
|
|
#include "BKE_workspace.h"
|
2011-05-19 11:34:11 +00:00
|
|
|
|
2017-04-03 15:38:00 +02:00
|
|
|
#include "GPU_lamp.h"
|
2011-05-19 11:34:11 +00:00
|
|
|
#include "GPU_material.h"
|
2012-12-18 12:42:13 +00:00
|
|
|
#include "GPU_buffers.h"
|
2011-05-19 11:34:11 +00:00
|
|
|
|
2011-11-02 18:20:53 +00:00
|
|
|
#include "RE_engine.h"
|
2012-11-09 23:54:58 +00:00
|
|
|
#include "RE_pipeline.h"
|
2011-11-02 18:20:53 +00:00
|
|
|
|
2011-08-15 12:07:52 +00:00
|
|
|
#include "ED_node.h"
|
2011-05-19 11:34:11 +00:00
|
|
|
#include "ED_render.h"
|
2015-03-17 12:02:10 +05:00
|
|
|
#include "ED_view3d.h"
|
2011-05-19 11:34:11 +00:00
|
|
|
|
2017-11-28 13:04:21 +01:00
|
|
|
#include "DEG_depsgraph.h"
|
|
|
|
|
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
#include "WM_api.h"
|
|
|
|
|
|
2012-03-29 22:42:32 +00:00
|
|
|
#include "render_intern.h" // own include
|
2011-05-19 11:34:11 +00:00
|
|
|
|
2012-11-29 19:04:33 +00:00
|
|
|
extern Material defmaterial;
|
|
|
|
|
|
2011-11-02 18:20:53 +00:00
|
|
|
/***************************** Render Engines ********************************/
|
|
|
|
|
|
2017-11-28 13:04:21 +01:00
|
|
|
void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int updated)
|
2011-11-02 18:20:53 +00:00
|
|
|
{
|
|
|
|
|
/* viewport rendering update on data changes, happens after depsgraph
|
|
|
|
|
* updates if there was any change. context is set to the 3d view */
|
2017-11-28 13:04:21 +01:00
|
|
|
Main *bmain = update_ctx->bmain;
|
|
|
|
|
Scene *scene = update_ctx->scene;
|
2017-11-28 16:42:58 +01:00
|
|
|
ViewLayer *view_layer = update_ctx->view_layer;
|
2011-11-28 14:55:35 +00:00
|
|
|
bContext *C;
|
2013-05-17 16:46:59 +00:00
|
|
|
wmWindowManager *wm;
|
|
|
|
|
wmWindow *win;
|
2014-04-01 11:34:00 +11:00
|
|
|
static bool recursive_check = false;
|
2011-11-28 14:55:35 +00:00
|
|
|
|
|
|
|
|
/* don't do this render engine update if we're updating the scene from
|
2012-03-03 16:31:46 +00:00
|
|
|
* other threads doing e.g. rendering or baking jobs */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!BLI_thread_is_main())
|
2011-11-28 14:55:35 +00:00
|
|
|
return;
|
|
|
|
|
|
2012-10-15 21:12:58 +00:00
|
|
|
/* don't call this recursively for frame updates */
|
2012-10-21 07:58:38 +00:00
|
|
|
if (recursive_check)
|
2012-10-15 21:12:58 +00:00
|
|
|
return;
|
2014-11-22 14:39:53 +01:00
|
|
|
|
|
|
|
|
/* Do not call if no WM available, see T42688. */
|
|
|
|
|
if (BLI_listbase_is_empty(&bmain->wm))
|
|
|
|
|
return;
|
|
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
recursive_check = true;
|
2012-10-15 21:12:58 +00:00
|
|
|
|
2012-03-29 22:42:32 +00:00
|
|
|
C = CTX_create();
|
2011-11-28 14:55:35 +00:00
|
|
|
CTX_data_main_set(C, bmain);
|
|
|
|
|
CTX_data_scene_set(C, scene);
|
|
|
|
|
|
|
|
|
|
CTX_wm_manager_set(C, bmain->wm.first);
|
2013-05-17 16:46:59 +00:00
|
|
|
wm = bmain->wm.first;
|
|
|
|
|
|
|
|
|
|
for (win = wm->windows.first; win; win = win->next) {
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
bScreen *sc = WM_window_get_active_screen(win);
|
2013-05-17 16:46:59 +00:00
|
|
|
ScrArea *sa;
|
|
|
|
|
ARegion *ar;
|
|
|
|
|
|
|
|
|
|
CTX_wm_window_set(C, win);
|
2017-10-16 18:37:37 -02:00
|
|
|
WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook);
|
|
|
|
|
ViewRender *view_render = BKE_viewrender_get(win->scene, workspace);
|
|
|
|
|
|
2012-03-29 22:42:32 +00:00
|
|
|
for (sa = sc->areabase.first; sa; sa = sa->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (sa->spacetype != SPACE_VIEW3D)
|
2011-11-02 18:20:53 +00:00
|
|
|
continue;
|
|
|
|
|
|
2012-03-29 22:42:32 +00:00
|
|
|
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
2017-11-28 16:42:58 +01:00
|
|
|
if (ar->regiontype != RGN_TYPE_WINDOW) {
|
2011-11-02 18:20:53 +00:00
|
|
|
continue;
|
2017-11-28 16:42:58 +01:00
|
|
|
}
|
|
|
|
|
RegionView3D *rv3d = ar->regiondata;
|
|
|
|
|
RenderEngine *engine = rv3d->render_engine;
|
2013-06-09 11:57:50 +00:00
|
|
|
/* call update if the scene changed, or if the render engine
|
|
|
|
|
* tagged itself for update (e.g. because it was busy at the
|
|
|
|
|
* time of the last update) */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (engine && (updated || (engine->flag & RE_ENGINE_DO_UPDATE))) {
|
Blender Internal Render in viewport
Because of our release soon, feature has been added behind the Debug Menu.
CTRL+ALT+D and set it to -1. Or commandline --debug-value -1.
When debug set to -1, you can put the viewport to 'render' mode, just like
for Cycles. Notes for testers: (and please no bugs in tracker for this :)
- It renders without AA, MBlur, Panorama, Sequence, Composite
- Only active render layer gets rendered. Select another layer will re-render.
- But yes: it works for FreeStyle renders!
- Also does great for local view.
- BI is not well suited for incremental renders on view changes. This only
works for non-raytrace scenes, or zoom in ortho or camera mode, or for
Material changes. In most cases a full re-render is being done.
- ESC works to stop the preview render.
- Borders render as well. (CTRL+B)
- Force a refresh with arrow key left/right. A lot of settings don't trigger
re-render yet.
Tech notes:
- FreeStyle is adding a lot of temp objects/meshes in the Main database. This
caused DepsGraph to trigger changes (and redraws). I've prepended the names
for these temp objects with char number 27 (ESC), and made these names be
ignored for tag update checking.
- Fixed some bugs that were noticable with such excessive re-renders, like
for opening file window, quit during renders.
2013-04-16 17:39:20 +00:00
|
|
|
|
2011-11-02 18:20:53 +00:00
|
|
|
CTX_wm_screen_set(C, sc);
|
|
|
|
|
CTX_wm_area_set(C, sa);
|
|
|
|
|
CTX_wm_region_set(C, ar);
|
|
|
|
|
|
|
|
|
|
engine->flag &= ~RE_ENGINE_DO_UPDATE;
|
|
|
|
|
engine->type->view_update(engine, C);
|
2017-09-25 20:07:02 +02:00
|
|
|
|
|
|
|
|
}
|
2017-11-28 16:42:58 +01:00
|
|
|
else {
|
|
|
|
|
RenderEngineType *engine_type = RE_engines_find(view_render->engine_id);
|
|
|
|
|
if ((engine_type->flag & RE_USE_LEGACY_PIPELINE) == 0) {
|
|
|
|
|
if (updated) {
|
|
|
|
|
DRW_notify_view_update(
|
|
|
|
|
(&(DRWUpdateContext){
|
|
|
|
|
.bmain = bmain,
|
2018-01-16 15:38:44 +01:00
|
|
|
.depsgraph = update_ctx->depsgraph,
|
2017-11-28 16:42:58 +01:00
|
|
|
.scene = scene,
|
|
|
|
|
.view_layer = view_layer,
|
|
|
|
|
.ar = ar,
|
|
|
|
|
.v3d = (View3D *)sa->spacedata.first,
|
|
|
|
|
.engine_type = engine_type
|
|
|
|
|
}));
|
|
|
|
|
}
|
2017-09-25 20:07:02 +02:00
|
|
|
}
|
2011-11-02 18:20:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-28 14:55:35 +00:00
|
|
|
CTX_free(C);
|
2012-10-15 21:12:58 +00:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
recursive_check = false;
|
2011-11-02 18:20:53 +00:00
|
|
|
}
|
|
|
|
|
|
2015-03-17 12:02:10 +05:00
|
|
|
void ED_render_engine_area_exit(Main *bmain, ScrArea *sa)
|
2011-11-02 18:20:53 +00:00
|
|
|
{
|
2012-04-26 12:30:37 +00:00
|
|
|
/* clear all render engines in this area */
|
2011-11-02 18:20:53 +00:00
|
|
|
ARegion *ar;
|
2015-03-17 12:02:10 +05:00
|
|
|
wmWindowManager *wm = bmain->wm.first;
|
2011-11-02 18:20:53 +00:00
|
|
|
|
2012-04-26 12:30:37 +00:00
|
|
|
if (sa->spacetype != SPACE_VIEW3D)
|
|
|
|
|
return;
|
2011-11-02 18:20:53 +00:00
|
|
|
|
2012-04-26 12:30:37 +00:00
|
|
|
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
2012-05-15 12:14:03 +00:00
|
|
|
if (ar->regiontype != RGN_TYPE_WINDOW || !(ar->regiondata))
|
2012-04-26 12:30:37 +00:00
|
|
|
continue;
|
2015-03-17 12:02:10 +05:00
|
|
|
ED_view3d_stop_render_preview(wm, ar);
|
2011-11-02 18:20:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-26 12:30:37 +00:00
|
|
|
void ED_render_engine_changed(Main *bmain)
|
|
|
|
|
{
|
|
|
|
|
/* on changing the render engine type, clear all running render engines */
|
2017-11-28 13:04:21 +01:00
|
|
|
for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
|
|
|
|
|
for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
|
2015-03-17 12:02:10 +05:00
|
|
|
ED_render_engine_area_exit(bmain, sa);
|
2017-11-28 13:04:21 +01:00
|
|
|
}
|
|
|
|
|
}
|
2012-11-09 23:54:58 +00:00
|
|
|
RE_FreePersistentData();
|
2017-11-28 13:04:21 +01:00
|
|
|
/* Inform all render engines and draw managers. */
|
|
|
|
|
DEGEditorUpdateContext update_ctx = {NULL};
|
|
|
|
|
update_ctx.bmain = bmain;
|
|
|
|
|
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
|
|
|
|
update_ctx.scene = scene;
|
2018-02-15 14:15:55 +01:00
|
|
|
LISTBASE_FOREACH(ViewLayer *, view_layer, &scene->view_layers) {
|
2018-01-16 15:37:52 +01:00
|
|
|
/* TDODO(sergey): Iterate over depsgraphs instead? */
|
|
|
|
|
update_ctx.depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
|
2017-11-28 13:04:21 +01:00
|
|
|
update_ctx.view_layer = view_layer;
|
|
|
|
|
ED_render_id_flush_update(&update_ctx, &scene->id);
|
|
|
|
|
}
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
if (scene->nodetree) {
|
|
|
|
|
ntreeCompositUpdateRLayers(scene->nodetree);
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-04-26 12:30:37 +00:00
|
|
|
}
|
|
|
|
|
|
2011-05-19 11:34:11 +00:00
|
|
|
/***************************** Updates ***********************************
|
2017-08-16 11:52:27 +02:00
|
|
|
* ED_render_id_flush_update gets called from DEG_id_tag_update, to do *
|
2012-04-22 11:54:53 +00:00
|
|
|
* editor level updates when the ID changes. when these ID blocks are in *
|
|
|
|
|
* the dependency graph, we can get rid of the manual dependency checks */
|
2011-05-19 11:34:11 +00:00
|
|
|
|
Blender Internal Render in viewport
Because of our release soon, feature has been added behind the Debug Menu.
CTRL+ALT+D and set it to -1. Or commandline --debug-value -1.
When debug set to -1, you can put the viewport to 'render' mode, just like
for Cycles. Notes for testers: (and please no bugs in tracker for this :)
- It renders without AA, MBlur, Panorama, Sequence, Composite
- Only active render layer gets rendered. Select another layer will re-render.
- But yes: it works for FreeStyle renders!
- Also does great for local view.
- BI is not well suited for incremental renders on view changes. This only
works for non-raytrace scenes, or zoom in ortho or camera mode, or for
Material changes. In most cases a full re-render is being done.
- ESC works to stop the preview render.
- Borders render as well. (CTRL+B)
- Force a refresh with arrow key left/right. A lot of settings don't trigger
re-render yet.
Tech notes:
- FreeStyle is adding a lot of temp objects/meshes in the Main database. This
caused DepsGraph to trigger changes (and redraws). I've prepended the names
for these temp objects with char number 27 (ESC), and made these names be
ignored for tag update checking.
- Fixed some bugs that were noticable with such excessive re-renders, like
for opening file window, quit during renders.
2013-04-16 17:39:20 +00:00
|
|
|
static void render_engine_flag_changed(Main *bmain, int update_flag)
|
|
|
|
|
{
|
|
|
|
|
bScreen *sc;
|
|
|
|
|
ScrArea *sa;
|
|
|
|
|
ARegion *ar;
|
|
|
|
|
|
|
|
|
|
for (sc = bmain->screen.first; sc; sc = sc->id.next) {
|
|
|
|
|
for (sa = sc->areabase.first; sa; sa = sa->next) {
|
|
|
|
|
if (sa->spacetype != SPACE_VIEW3D)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
|
|
|
|
RegionView3D *rv3d;
|
|
|
|
|
|
|
|
|
|
if (ar->regiontype != RGN_TYPE_WINDOW)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
rv3d = ar->regiondata;
|
|
|
|
|
if (rv3d->render_engine)
|
|
|
|
|
rv3d->render_engine->update_flag |= update_flag;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-19 11:34:11 +00:00
|
|
|
static int mtex_use_tex(MTex **mtex, int tot, Tex *tex)
|
|
|
|
|
{
|
|
|
|
|
int a;
|
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!mtex)
|
2011-05-19 11:34:11 +00:00
|
|
|
return 0;
|
|
|
|
|
|
2012-03-29 22:42:32 +00:00
|
|
|
for (a = 0; a < tot; a++)
|
2012-03-24 06:38:07 +00:00
|
|
|
if (mtex[a] && mtex[a]->tex == tex)
|
2011-05-19 11:34:11 +00:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int nodes_use_tex(bNodeTree *ntree, Tex *tex)
|
|
|
|
|
{
|
|
|
|
|
bNode *node;
|
|
|
|
|
|
2012-03-29 22:42:32 +00:00
|
|
|
for (node = ntree->nodes.first; node; node = node->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->id) {
|
2012-03-29 22:42:32 +00:00
|
|
|
if (node->id == (ID *)tex) {
|
2011-05-19 11:34:11 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (GS(node->id->name) == ID_MA) {
|
2012-03-29 22:42:32 +00:00
|
|
|
if (mtex_use_tex(((Material *)node->id)->mtex, MAX_MTEX, tex))
|
2011-11-23 15:16:41 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
2012-03-29 22:42:32 +00:00
|
|
|
else if (node->type == NODE_GROUP) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (nodes_use_tex((bNodeTree *)node->id, tex))
|
2011-05-19 11:34:11 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-23 15:16:41 +00:00
|
|
|
static int nodes_use_material(bNodeTree *ntree, Material *ma)
|
|
|
|
|
{
|
|
|
|
|
bNode *node;
|
|
|
|
|
|
2012-03-29 22:42:32 +00:00
|
|
|
for (node = ntree->nodes.first; node; node = node->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->id) {
|
2012-03-29 22:42:32 +00:00
|
|
|
if (node->id == (ID *)ma) {
|
2011-11-23 15:16:41 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
2012-03-29 22:42:32 +00:00
|
|
|
else if (node->type == NODE_GROUP) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (nodes_use_material((bNodeTree *)node->id, ma))
|
2011-11-23 15:16:41 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void material_changed(Main *bmain, Material *ma)
|
2011-05-19 11:34:11 +00:00
|
|
|
{
|
2011-11-23 15:16:41 +00:00
|
|
|
Material *parent;
|
2012-12-18 12:42:13 +00:00
|
|
|
Object *ob;
|
|
|
|
|
Scene *scene;
|
2014-04-01 11:34:00 +11:00
|
|
|
int texture_draw = false;
|
2011-11-23 15:16:41 +00:00
|
|
|
|
2011-05-19 11:34:11 +00:00
|
|
|
/* icons */
|
2015-05-11 16:29:12 +02:00
|
|
|
BKE_icon_changed(BKE_icon_id_ensure(&ma->id));
|
2011-05-19 11:34:11 +00:00
|
|
|
|
2017-07-21 14:20:30 +02:00
|
|
|
/* glsl */
|
2017-12-15 10:45:20 +01:00
|
|
|
if (ma->id.recalc & ID_RECALC) {
|
2017-07-21 14:20:30 +02:00
|
|
|
if (!BLI_listbase_is_empty(&ma->gpumaterial)) {
|
|
|
|
|
GPU_material_free(&ma->gpumaterial);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-23 15:16:41 +00:00
|
|
|
/* find node materials using this */
|
2012-03-29 22:42:32 +00:00
|
|
|
for (parent = bmain->mat.first; parent; parent = parent->id.next) {
|
2012-10-07 09:48:59 +00:00
|
|
|
if (parent->use_nodes && parent->nodetree && nodes_use_material(parent->nodetree, ma)) {
|
|
|
|
|
/* pass */
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2011-11-23 15:16:41 +00:00
|
|
|
|
2015-05-11 16:29:12 +02:00
|
|
|
BKE_icon_changed(BKE_icon_id_ensure(&parent->id));
|
2011-11-23 15:16:41 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (parent->gpumaterial.first)
|
2014-11-24 17:18:56 +01:00
|
|
|
GPU_material_free(&parent->gpumaterial);
|
2011-11-23 15:16:41 +00:00
|
|
|
}
|
2012-12-18 12:42:13 +00:00
|
|
|
|
|
|
|
|
/* find if we have a scene with textured display */
|
2012-12-18 13:25:23 +00:00
|
|
|
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
|
|
|
|
|
if (scene->customdata_mask & CD_MASK_MTFACE) {
|
2014-04-01 11:34:00 +11:00
|
|
|
texture_draw = true;
|
2012-12-18 13:25:23 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-12-18 12:42:13 +00:00
|
|
|
|
|
|
|
|
/* find textured objects */
|
2015-03-31 11:42:39 +02:00
|
|
|
if (texture_draw) {
|
2012-12-18 12:42:13 +00:00
|
|
|
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
|
|
|
|
DerivedMesh *dm = ob->derivedFinal;
|
|
|
|
|
Material ***material = give_matarar(ob);
|
|
|
|
|
short a, *totmaterial = give_totcolp(ob);
|
|
|
|
|
|
|
|
|
|
if (dm && totmaterial && material) {
|
|
|
|
|
for (a = 0; a < *totmaterial; a++) {
|
|
|
|
|
if ((*material)[a] == ma) {
|
|
|
|
|
GPU_drawobject_free(dm);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-19 11:34:11 +00:00
|
|
|
}
|
|
|
|
|
|
2012-11-24 14:50:40 +00:00
|
|
|
static void lamp_changed(Main *bmain, Lamp *la)
|
|
|
|
|
{
|
|
|
|
|
Object *ob;
|
|
|
|
|
|
|
|
|
|
/* icons */
|
2015-05-11 16:29:12 +02:00
|
|
|
BKE_icon_changed(BKE_icon_id_ensure(&la->id));
|
2012-11-24 14:50:40 +00:00
|
|
|
|
|
|
|
|
/* glsl */
|
|
|
|
|
for (ob = bmain->object.first; ob; ob = ob->id.next)
|
|
|
|
|
if (ob->data == la && ob->gpulamp.first)
|
|
|
|
|
GPU_lamp_free(ob);
|
|
|
|
|
|
2012-11-29 19:04:33 +00:00
|
|
|
if (defmaterial.gpumaterial.first)
|
2014-11-24 17:18:56 +01:00
|
|
|
GPU_material_free(&defmaterial.gpumaterial);
|
2012-11-24 14:50:40 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-18 12:42:13 +00:00
|
|
|
static int material_uses_texture(Material *ma, Tex *tex)
|
|
|
|
|
{
|
|
|
|
|
if (mtex_use_tex(ma->mtex, MAX_MTEX, tex))
|
2014-04-01 11:34:00 +11:00
|
|
|
return true;
|
2012-12-18 12:42:13 +00:00
|
|
|
else if (ma->use_nodes && ma->nodetree && nodes_use_tex(ma->nodetree, tex))
|
2014-04-01 11:34:00 +11:00
|
|
|
return true;
|
2012-12-18 12:42:13 +00:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
return false;
|
2012-12-18 12:42:13 +00:00
|
|
|
}
|
|
|
|
|
|
2011-05-19 11:34:11 +00:00
|
|
|
static void texture_changed(Main *bmain, Tex *tex)
|
|
|
|
|
{
|
|
|
|
|
Material *ma;
|
|
|
|
|
Lamp *la;
|
|
|
|
|
World *wo;
|
2011-08-15 12:07:52 +00:00
|
|
|
Scene *scene;
|
2017-11-23 13:51:49 -02:00
|
|
|
ViewLayer *view_layer;
|
2012-12-18 12:42:13 +00:00
|
|
|
Object *ob;
|
2011-08-15 12:07:52 +00:00
|
|
|
bNode *node;
|
2014-04-11 11:25:41 +10:00
|
|
|
bool texture_draw = false;
|
2011-05-19 11:34:11 +00:00
|
|
|
|
|
|
|
|
/* icons */
|
2015-05-11 16:29:12 +02:00
|
|
|
BKE_icon_changed(BKE_icon_id_ensure(&tex->id));
|
2011-05-19 11:34:11 +00:00
|
|
|
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 17:21:31 +00:00
|
|
|
/* paint overlays */
|
2017-03-30 11:18:57 +02:00
|
|
|
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
|
2017-11-23 13:51:49 -02:00
|
|
|
for (view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
|
2018-04-05 18:20:27 +02:00
|
|
|
BKE_paint_invalidate_overlay_tex(scene, view_layer, tex);
|
2017-03-30 11:18:57 +02:00
|
|
|
}
|
|
|
|
|
}
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 17:21:31 +00:00
|
|
|
|
2011-05-19 11:34:11 +00:00
|
|
|
/* find materials */
|
2012-03-29 22:42:32 +00:00
|
|
|
for (ma = bmain->mat.first; ma; ma = ma->id.next) {
|
2012-12-18 12:42:13 +00:00
|
|
|
if (!material_uses_texture(ma, tex))
|
2012-10-07 09:48:59 +00:00
|
|
|
continue;
|
2011-05-19 11:34:11 +00:00
|
|
|
|
2015-05-11 16:29:12 +02:00
|
|
|
BKE_icon_changed(BKE_icon_id_ensure(&ma->id));
|
2011-05-19 11:34:11 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ma->gpumaterial.first)
|
2014-11-24 17:18:56 +01:00
|
|
|
GPU_material_free(&ma->gpumaterial);
|
2011-05-19 11:34:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* find lamps */
|
2012-03-29 22:42:32 +00:00
|
|
|
for (la = bmain->lamp.first; la; la = la->id.next) {
|
2012-10-07 09:48:59 +00:00
|
|
|
if (mtex_use_tex(la->mtex, MAX_MTEX, tex)) {
|
2012-11-24 14:50:40 +00:00
|
|
|
lamp_changed(bmain, la);
|
2012-10-07 09:48:59 +00:00
|
|
|
}
|
|
|
|
|
else if (la->nodetree && nodes_use_tex(la->nodetree, tex)) {
|
2012-11-24 14:50:40 +00:00
|
|
|
lamp_changed(bmain, la);
|
2012-10-07 09:48:59 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2011-05-19 11:34:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* find worlds */
|
2012-03-29 22:42:32 +00:00
|
|
|
for (wo = bmain->world.first; wo; wo = wo->id.next) {
|
2012-10-07 09:48:59 +00:00
|
|
|
if (mtex_use_tex(wo->mtex, MAX_MTEX, tex)) {
|
|
|
|
|
/* pass */
|
|
|
|
|
}
|
|
|
|
|
else if (wo->nodetree && nodes_use_tex(wo->nodetree, tex)) {
|
|
|
|
|
/* pass */
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2011-05-19 11:34:11 +00:00
|
|
|
|
2015-05-11 16:29:12 +02:00
|
|
|
BKE_icon_changed(BKE_icon_id_ensure(&wo->id));
|
2014-11-24 17:18:56 +01:00
|
|
|
|
|
|
|
|
if (wo->gpumaterial.first)
|
|
|
|
|
GPU_material_free(&wo->gpumaterial);
|
2011-05-19 11:34:11 +00:00
|
|
|
}
|
2011-08-15 12:07:52 +00:00
|
|
|
|
|
|
|
|
/* find compositing nodes */
|
2012-03-29 22:42:32 +00:00
|
|
|
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (scene->use_nodes && scene->nodetree) {
|
2012-03-29 22:42:32 +00:00
|
|
|
for (node = scene->nodetree->nodes.first; node; node = node->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->id == &tex->id)
|
2013-03-18 16:34:57 +00:00
|
|
|
ED_node_tag_update_id(&scene->id);
|
2011-08-15 12:07:52 +00:00
|
|
|
}
|
|
|
|
|
}
|
2012-12-18 12:42:13 +00:00
|
|
|
|
|
|
|
|
if (scene->customdata_mask & CD_MASK_MTFACE)
|
2014-04-01 11:34:00 +11:00
|
|
|
texture_draw = true;
|
2012-12-18 12:42:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* find textured objects */
|
2015-03-31 11:42:39 +02:00
|
|
|
if (texture_draw) {
|
2012-12-18 12:42:13 +00:00
|
|
|
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
|
|
|
|
DerivedMesh *dm = ob->derivedFinal;
|
|
|
|
|
Material ***material = give_matarar(ob);
|
|
|
|
|
short a, *totmaterial = give_totcolp(ob);
|
|
|
|
|
|
|
|
|
|
if (dm && totmaterial && material) {
|
|
|
|
|
for (a = 0; a < *totmaterial; a++) {
|
2013-01-24 08:49:48 +00:00
|
|
|
if (ob->matbits && ob->matbits[a])
|
|
|
|
|
ma = ob->mat[a];
|
|
|
|
|
else
|
|
|
|
|
ma = (*material)[a];
|
|
|
|
|
|
|
|
|
|
if (ma && material_uses_texture(ma, tex)) {
|
2012-12-18 12:42:13 +00:00
|
|
|
GPU_drawobject_free(dm);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-08-15 12:07:52 +00:00
|
|
|
}
|
2011-05-19 11:34:11 +00:00
|
|
|
}
|
|
|
|
|
|
2017-06-29 18:56:38 +02:00
|
|
|
static void world_changed(Main *UNUSED(bmain), World *wo)
|
2011-05-19 11:34:11 +00:00
|
|
|
{
|
|
|
|
|
/* icons */
|
2015-05-11 16:29:12 +02:00
|
|
|
BKE_icon_changed(BKE_icon_id_ensure(&wo->id));
|
2017-06-04 12:08:34 +02:00
|
|
|
|
|
|
|
|
/* XXX temporary flag waiting for depsgraph proper tagging */
|
|
|
|
|
wo->update_flag = 1;
|
2017-07-21 14:20:30 +02:00
|
|
|
|
|
|
|
|
/* glsl */
|
2017-12-15 10:45:20 +01:00
|
|
|
if (wo->id.recalc & ID_RECALC) {
|
2017-07-21 14:20:30 +02:00
|
|
|
if (!BLI_listbase_is_empty(&defmaterial.gpumaterial)) {
|
|
|
|
|
GPU_material_free(&defmaterial.gpumaterial);
|
|
|
|
|
}
|
|
|
|
|
if (!BLI_listbase_is_empty(&wo->gpumaterial)) {
|
|
|
|
|
GPU_material_free(&wo->gpumaterial);
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-05-19 11:34:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void image_changed(Main *bmain, Image *ima)
|
|
|
|
|
{
|
|
|
|
|
Tex *tex;
|
|
|
|
|
|
|
|
|
|
/* icons */
|
2015-05-11 16:29:12 +02:00
|
|
|
BKE_icon_changed(BKE_icon_id_ensure(&ima->id));
|
2011-05-19 11:34:11 +00:00
|
|
|
|
|
|
|
|
/* textures */
|
2012-03-29 22:42:32 +00:00
|
|
|
for (tex = bmain->tex.first; tex; tex = tex->id.next)
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tex->ima == ima)
|
2011-05-19 11:34:11 +00:00
|
|
|
texture_changed(bmain, tex);
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-06 15:12:06 +02:00
|
|
|
static void scene_changed(Main *bmain, Scene *scene)
|
2011-05-19 11:34:11 +00:00
|
|
|
{
|
|
|
|
|
Object *ob;
|
|
|
|
|
|
|
|
|
|
/* glsl */
|
2018-04-05 18:20:27 +02:00
|
|
|
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
|
|
|
|
if (ob->mode & OB_MODE_TEXTURE_PAINT) {
|
|
|
|
|
BKE_texpaint_slots_refresh_object(scene, ob);
|
|
|
|
|
BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
|
|
|
|
|
GPU_drawobject_free(ob->derivedFinal);
|
2014-10-06 15:12:06 +02:00
|
|
|
}
|
|
|
|
|
}
|
2011-05-19 11:34:11 +00:00
|
|
|
}
|
|
|
|
|
|
2017-11-28 13:04:21 +01:00
|
|
|
void ED_render_id_flush_update(const DEGEditorUpdateContext *update_ctx, ID *id)
|
2011-05-19 11:34:11 +00:00
|
|
|
{
|
2012-11-07 16:27:18 +00:00
|
|
|
/* this can be called from render or baking thread when a python script makes
|
|
|
|
|
* changes, in that case we don't want to do any editor updates, and making
|
|
|
|
|
* GPU changes is not possible because OpenGL only works in the main thread */
|
2017-11-28 13:04:21 +01:00
|
|
|
if (!BLI_thread_is_main()) {
|
2012-11-07 16:27:18 +00:00
|
|
|
return;
|
2017-11-28 13:04:21 +01:00
|
|
|
}
|
|
|
|
|
Main *bmain = update_ctx->bmain;
|
2017-11-28 17:05:52 +01:00
|
|
|
/* Internal ID update handlers. */
|
2012-03-29 22:42:32 +00:00
|
|
|
switch (GS(id->name)) {
|
2011-05-19 11:34:11 +00:00
|
|
|
case ID_MA:
|
2012-03-29 22:42:32 +00:00
|
|
|
material_changed(bmain, (Material *)id);
|
Blender Internal Render in viewport
Because of our release soon, feature has been added behind the Debug Menu.
CTRL+ALT+D and set it to -1. Or commandline --debug-value -1.
When debug set to -1, you can put the viewport to 'render' mode, just like
for Cycles. Notes for testers: (and please no bugs in tracker for this :)
- It renders without AA, MBlur, Panorama, Sequence, Composite
- Only active render layer gets rendered. Select another layer will re-render.
- But yes: it works for FreeStyle renders!
- Also does great for local view.
- BI is not well suited for incremental renders on view changes. This only
works for non-raytrace scenes, or zoom in ortho or camera mode, or for
Material changes. In most cases a full re-render is being done.
- ESC works to stop the preview render.
- Borders render as well. (CTRL+B)
- Force a refresh with arrow key left/right. A lot of settings don't trigger
re-render yet.
Tech notes:
- FreeStyle is adding a lot of temp objects/meshes in the Main database. This
caused DepsGraph to trigger changes (and redraws). I've prepended the names
for these temp objects with char number 27 (ESC), and made these names be
ignored for tag update checking.
- Fixed some bugs that were noticable with such excessive re-renders, like
for opening file window, quit during renders.
2013-04-16 17:39:20 +00:00
|
|
|
render_engine_flag_changed(bmain, RE_ENGINE_UPDATE_MA);
|
2011-05-19 11:34:11 +00:00
|
|
|
break;
|
|
|
|
|
case ID_TE:
|
2012-03-29 22:42:32 +00:00
|
|
|
texture_changed(bmain, (Tex *)id);
|
2011-05-19 11:34:11 +00:00
|
|
|
break;
|
|
|
|
|
case ID_WO:
|
2012-03-29 22:42:32 +00:00
|
|
|
world_changed(bmain, (World *)id);
|
2011-05-19 11:34:11 +00:00
|
|
|
break;
|
|
|
|
|
case ID_LA:
|
2012-03-29 22:42:32 +00:00
|
|
|
lamp_changed(bmain, (Lamp *)id);
|
2011-05-19 11:34:11 +00:00
|
|
|
break;
|
|
|
|
|
case ID_IM:
|
2012-03-29 22:42:32 +00:00
|
|
|
image_changed(bmain, (Image *)id);
|
2011-05-19 11:34:11 +00:00
|
|
|
break;
|
|
|
|
|
case ID_SCE:
|
2012-03-29 22:42:32 +00:00
|
|
|
scene_changed(bmain, (Scene *)id);
|
Blender Internal Render in viewport
Because of our release soon, feature has been added behind the Debug Menu.
CTRL+ALT+D and set it to -1. Or commandline --debug-value -1.
When debug set to -1, you can put the viewport to 'render' mode, just like
for Cycles. Notes for testers: (and please no bugs in tracker for this :)
- It renders without AA, MBlur, Panorama, Sequence, Composite
- Only active render layer gets rendered. Select another layer will re-render.
- But yes: it works for FreeStyle renders!
- Also does great for local view.
- BI is not well suited for incremental renders on view changes. This only
works for non-raytrace scenes, or zoom in ortho or camera mode, or for
Material changes. In most cases a full re-render is being done.
- ESC works to stop the preview render.
- Borders render as well. (CTRL+B)
- Force a refresh with arrow key left/right. A lot of settings don't trigger
re-render yet.
Tech notes:
- FreeStyle is adding a lot of temp objects/meshes in the Main database. This
caused DepsGraph to trigger changes (and redraws). I've prepended the names
for these temp objects with char number 27 (ESC), and made these names be
ignored for tag update checking.
- Fixed some bugs that were noticable with such excessive re-renders, like
for opening file window, quit during renders.
2013-04-16 17:39:20 +00:00
|
|
|
render_engine_flag_changed(bmain, RE_ENGINE_UPDATE_OTHER);
|
2011-05-19 11:34:11 +00:00
|
|
|
break;
|
|
|
|
|
default:
|
Blender Internal Render in viewport
Because of our release soon, feature has been added behind the Debug Menu.
CTRL+ALT+D and set it to -1. Or commandline --debug-value -1.
When debug set to -1, you can put the viewport to 'render' mode, just like
for Cycles. Notes for testers: (and please no bugs in tracker for this :)
- It renders without AA, MBlur, Panorama, Sequence, Composite
- Only active render layer gets rendered. Select another layer will re-render.
- But yes: it works for FreeStyle renders!
- Also does great for local view.
- BI is not well suited for incremental renders on view changes. This only
works for non-raytrace scenes, or zoom in ortho or camera mode, or for
Material changes. In most cases a full re-render is being done.
- ESC works to stop the preview render.
- Borders render as well. (CTRL+B)
- Force a refresh with arrow key left/right. A lot of settings don't trigger
re-render yet.
Tech notes:
- FreeStyle is adding a lot of temp objects/meshes in the Main database. This
caused DepsGraph to trigger changes (and redraws). I've prepended the names
for these temp objects with char number 27 (ESC), and made these names be
ignored for tag update checking.
- Fixed some bugs that were noticable with such excessive re-renders, like
for opening file window, quit during renders.
2013-04-16 17:39:20 +00:00
|
|
|
render_engine_flag_changed(bmain, RE_ENGINE_UPDATE_OTHER);
|
2011-05-19 11:34:11 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Blender Internal Render in viewport
Because of our release soon, feature has been added behind the Debug Menu.
CTRL+ALT+D and set it to -1. Or commandline --debug-value -1.
When debug set to -1, you can put the viewport to 'render' mode, just like
for Cycles. Notes for testers: (and please no bugs in tracker for this :)
- It renders without AA, MBlur, Panorama, Sequence, Composite
- Only active render layer gets rendered. Select another layer will re-render.
- But yes: it works for FreeStyle renders!
- Also does great for local view.
- BI is not well suited for incremental renders on view changes. This only
works for non-raytrace scenes, or zoom in ortho or camera mode, or for
Material changes. In most cases a full re-render is being done.
- ESC works to stop the preview render.
- Borders render as well. (CTRL+B)
- Force a refresh with arrow key left/right. A lot of settings don't trigger
re-render yet.
Tech notes:
- FreeStyle is adding a lot of temp objects/meshes in the Main database. This
caused DepsGraph to trigger changes (and redraws). I've prepended the names
for these temp objects with char number 27 (ESC), and made these names be
ignored for tag update checking.
- Fixed some bugs that were noticable with such excessive re-renders, like
for opening file window, quit during renders.
2013-04-16 17:39:20 +00:00
|
|
|
|
|
|
|
|
void ED_render_internal_init(void)
|
|
|
|
|
{
|
2014-10-28 12:49:04 +01:00
|
|
|
RenderEngineType *ret = RE_engines_find(RE_engine_id_BLENDER_RENDER);
|
Blender Internal Render in viewport
Because of our release soon, feature has been added behind the Debug Menu.
CTRL+ALT+D and set it to -1. Or commandline --debug-value -1.
When debug set to -1, you can put the viewport to 'render' mode, just like
for Cycles. Notes for testers: (and please no bugs in tracker for this :)
- It renders without AA, MBlur, Panorama, Sequence, Composite
- Only active render layer gets rendered. Select another layer will re-render.
- But yes: it works for FreeStyle renders!
- Also does great for local view.
- BI is not well suited for incremental renders on view changes. This only
works for non-raytrace scenes, or zoom in ortho or camera mode, or for
Material changes. In most cases a full re-render is being done.
- ESC works to stop the preview render.
- Borders render as well. (CTRL+B)
- Force a refresh with arrow key left/right. A lot of settings don't trigger
re-render yet.
Tech notes:
- FreeStyle is adding a lot of temp objects/meshes in the Main database. This
caused DepsGraph to trigger changes (and redraws). I've prepended the names
for these temp objects with char number 27 (ESC), and made these names be
ignored for tag update checking.
- Fixed some bugs that were noticable with such excessive re-renders, like
for opening file window, quit during renders.
2013-04-16 17:39:20 +00:00
|
|
|
|
2013-07-08 22:26:10 +00:00
|
|
|
ret->view_update = render_view3d_update;
|
2017-04-25 18:02:18 +02:00
|
|
|
ret->render_to_view = render_view3d_draw;
|
Blender Internal Render in viewport
Because of our release soon, feature has been added behind the Debug Menu.
CTRL+ALT+D and set it to -1. Or commandline --debug-value -1.
When debug set to -1, you can put the viewport to 'render' mode, just like
for Cycles. Notes for testers: (and please no bugs in tracker for this :)
- It renders without AA, MBlur, Panorama, Sequence, Composite
- Only active render layer gets rendered. Select another layer will re-render.
- But yes: it works for FreeStyle renders!
- Also does great for local view.
- BI is not well suited for incremental renders on view changes. This only
works for non-raytrace scenes, or zoom in ortho or camera mode, or for
Material changes. In most cases a full re-render is being done.
- ESC works to stop the preview render.
- Borders render as well. (CTRL+B)
- Force a refresh with arrow key left/right. A lot of settings don't trigger
re-render yet.
Tech notes:
- FreeStyle is adding a lot of temp objects/meshes in the Main database. This
caused DepsGraph to trigger changes (and redraws). I've prepended the names
for these temp objects with char number 27 (ESC), and made these names be
ignored for tag update checking.
- Fixed some bugs that were noticable with such excessive re-renders, like
for opening file window, quit during renders.
2013-04-16 17:39:20 +00:00
|
|
|
|
|
|
|
|
}
|