2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2010-03-08 16:36:53 +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.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* 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) 2008 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/render/render_internal.c
|
|
|
|
* \ingroup edrend
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
#include <math.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
2015-06-30 14:47:31 +10:00
|
|
|
#include "BLI_listbase.h"
|
|
|
|
#include "BLI_rect.h"
|
|
|
|
#include "BLI_timecode.h"
|
2010-03-28 13:45:19 +00:00
|
|
|
#include "BLI_math.h"
|
2014-06-24 14:23:33 +06:00
|
|
|
#include "BLI_threads.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2013-06-24 22:41:24 +00:00
|
|
|
#include "PIL_time.h"
|
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2013-03-10 16:55:01 +00:00
|
|
|
|
2013-05-15 08:25:42 +00:00
|
|
|
#include "DNA_object_types.h"
|
2010-03-08 16:36:53 +00:00
|
|
|
#include "DNA_scene_types.h"
|
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
|
|
|
#include "DNA_view3d_types.h"
|
2013-05-12 19:01:23 +00:00
|
|
|
#include "DNA_userdef_types.h"
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2016-04-24 22:42:41 +10:00
|
|
|
#include "BKE_blender_undo.h"
|
|
|
|
#include "BKE_blender_version.h"
|
2015-04-06 10:40:12 -03:00
|
|
|
#include "BKE_camera.h"
|
2010-03-08 16:36:53 +00:00
|
|
|
#include "BKE_context.h"
|
2014-01-01 16:59:38 +06:00
|
|
|
#include "BKE_colortools.h"
|
2010-03-08 16:36:53 +00:00
|
|
|
#include "BKE_global.h"
|
|
|
|
#include "BKE_image.h"
|
2017-10-16 17:15:03 -02:00
|
|
|
#include "BKE_layer.h"
|
2010-08-13 14:29:56 +00:00
|
|
|
#include "BKE_library.h"
|
2010-03-08 16:36:53 +00:00
|
|
|
#include "BKE_main.h"
|
2010-12-17 17:06:36 +00:00
|
|
|
#include "BKE_node.h"
|
Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
(see below) or values are even possible to run or change.
This prevents any kind of "destructive" action performed
from user while rendering.
- Locks interface refresh for regions which does have lock
set to truth in their template. Currently it's just a 3D
viewport, but in the future more regions could be considered
unsafe, or we could want to lock different parts of
interface when doing different jobs.
This is needed because 3D viewport could be using or changing
the same data as renderer currently uses, leading to threading
conflict.
Notifiers are still allowed to handle, so render progress is
seen on the screen, but would need to doublecheck on this, in
terms some notifiers could be changing the data.
For now interface locking happens for render job only in case
"Lock Interface" checkbox is enabled.
Other tools like backing would also benefit of this option.
It is possible to mark operator as safe to be used in locked
interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
template flags.
This bit is completely handled by wm_evem_system, not
with operator run routines, so it's still possible to
run operators from drivers and handlers.
Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
|
|
|
#include "BKE_object.h"
|
2010-03-08 16:36:53 +00:00
|
|
|
#include "BKE_report.h"
|
2010-08-08 16:47:58 +00:00
|
|
|
#include "BKE_sequencer.h"
|
2011-03-25 17:11:32 +00:00
|
|
|
#include "BKE_screen.h"
|
2011-04-19 06:37:29 +00:00
|
|
|
#include "BKE_scene.h"
|
2017-10-16 17:15:03 -02:00
|
|
|
#include "BKE_workspace.h"
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2017-06-08 10:14:53 +02:00
|
|
|
#include "DEG_depsgraph.h"
|
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
#include "WM_api.h"
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
|
|
#include "ED_object.h"
|
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
|
|
|
#include "ED_render.h"
|
|
|
|
#include "ED_screen.h"
|
2014-01-20 14:11:12 +01:00
|
|
|
#include "ED_util.h"
|
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
|
|
|
#include "ED_view3d.h"
|
2010-03-08 16:36:53 +00:00
|
|
|
|
|
|
|
#include "RE_pipeline.h"
|
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
|
|
|
#include "RE_engine.h"
|
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
#include "IMB_colormanagement.h"
|
2010-03-08 16:36:53 +00:00
|
|
|
#include "IMB_imbuf_types.h"
|
|
|
|
|
2017-02-24 11:11:43 +01:00
|
|
|
#include "GPU_shader.h"
|
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
|
|
|
|
|
|
|
#include "BIF_gl.h"
|
|
|
|
#include "BIF_glutil.h"
|
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
#include "RNA_define.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "render_intern.h"
|
|
|
|
|
2011-05-19 11:34:11 +00:00
|
|
|
/* Render Callbacks */
|
2013-01-22 02:21:21 +00:00
|
|
|
static int render_break(void *rjv);
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2014-01-01 16:59:38 +06:00
|
|
|
typedef struct RenderJob {
|
|
|
|
Main *main;
|
|
|
|
Scene *scene;
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer;
|
2014-05-02 14:52:19 +02:00
|
|
|
Scene *current_scene;
|
2017-11-03 14:36:49 +01:00
|
|
|
/* TODO(sergey): Should not be needed once engine will have own
|
|
|
|
* depsgraph and copy-on-write will be implemented.
|
|
|
|
*/
|
|
|
|
Depsgraph *depsgraph;
|
2014-01-01 16:59:38 +06:00
|
|
|
Render *re;
|
|
|
|
struct Object *camera_override;
|
|
|
|
int lay_override;
|
|
|
|
bool v3d_override;
|
2014-04-01 11:34:00 +11:00
|
|
|
bool anim, write_still;
|
2014-01-01 16:59:38 +06:00
|
|
|
Image *image;
|
|
|
|
ImageUser iuser;
|
|
|
|
bool image_outdated;
|
|
|
|
short *stop;
|
|
|
|
short *do_update;
|
|
|
|
float *progress;
|
|
|
|
ReportList *reports;
|
|
|
|
int orig_layer;
|
|
|
|
int last_layer;
|
|
|
|
ScrArea *sa;
|
|
|
|
ColorManagedViewSettings view_settings;
|
|
|
|
ColorManagedDisplaySettings display_settings;
|
2017-05-08 17:43:32 +02:00
|
|
|
bool supports_glsl_draw;
|
Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
(see below) or values are even possible to run or change.
This prevents any kind of "destructive" action performed
from user while rendering.
- Locks interface refresh for regions which does have lock
set to truth in their template. Currently it's just a 3D
viewport, but in the future more regions could be considered
unsafe, or we could want to lock different parts of
interface when doing different jobs.
This is needed because 3D viewport could be using or changing
the same data as renderer currently uses, leading to threading
conflict.
Notifiers are still allowed to handle, so render progress is
seen on the screen, but would need to doublecheck on this, in
terms some notifiers could be changing the data.
For now interface locking happens for render job only in case
"Lock Interface" checkbox is enabled.
Other tools like backing would also benefit of this option.
It is possible to mark operator as safe to be used in locked
interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
template flags.
This bit is completely handled by wm_evem_system, not
with operator run routines, so it's still possible to
run operators from drivers and handlers.
Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
|
|
|
bool interface_locked;
|
2014-01-01 16:59:38 +06:00
|
|
|
} RenderJob;
|
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
/* called inside thread! */
|
2015-04-06 10:40:12 -03:00
|
|
|
static void image_buffer_rect_update(RenderJob *rj, RenderResult *rr, ImBuf *ibuf, ImageUser *iuser, volatile rcti *renrect, const char *viewname)
|
2010-03-08 16:36:53 +00:00
|
|
|
{
|
2014-01-01 16:59:38 +06:00
|
|
|
Scene *scene = rj->scene;
|
2014-04-27 00:22:49 +10:00
|
|
|
const float *rectf = NULL;
|
2010-03-08 16:36:53 +00:00
|
|
|
int ymin, ymax, xmin, xmax;
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
int rymin, rxmin;
|
2013-12-17 23:42:38 +06:00
|
|
|
int linear_stride, linear_offset_x, linear_offset_y;
|
2014-01-01 16:59:38 +06:00
|
|
|
ColorManagedViewSettings *view_settings;
|
|
|
|
ColorManagedDisplaySettings *display_settings;
|
2013-12-17 23:42:38 +06:00
|
|
|
|
2014-03-13 13:25:07 +06:00
|
|
|
/* Exception for exr tiles -- display buffer conversion happens here,
|
|
|
|
* NOT in the color management pipeline.
|
|
|
|
*/
|
|
|
|
if (ibuf->userflags & IB_DISPLAY_BUFFER_INVALID &&
|
|
|
|
rr->do_exr_tile == false)
|
|
|
|
{
|
2013-12-17 23:42:38 +06:00
|
|
|
/* The whole image buffer it so be color managed again anyway. */
|
|
|
|
return;
|
|
|
|
}
|
2010-03-08 16:36:53 +00:00
|
|
|
|
|
|
|
/* if renrect argument, we only refresh scanlines */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (renrect) {
|
2012-10-23 03:38:26 +00:00
|
|
|
/* if (ymax == recty), rendering of layer is ready, we should not draw, other things happen... */
|
2012-03-29 22:42:32 +00:00
|
|
|
if (rr->renlay == NULL || renrect->ymax >= rr->recty)
|
2010-03-08 16:36:53 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* xmin here is first subrect x coord, xmax defines subrect width */
|
|
|
|
xmin = renrect->xmin + rr->crop;
|
2010-04-15 10:28:32 +00:00
|
|
|
xmax = renrect->xmax - xmin + rr->crop;
|
2012-03-29 22:42:32 +00:00
|
|
|
if (xmax < 2)
|
2011-05-19 11:34:11 +00:00
|
|
|
return;
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-03-29 22:42:32 +00:00
|
|
|
ymin = renrect->ymin + rr->crop;
|
|
|
|
ymax = renrect->ymax - ymin + rr->crop;
|
|
|
|
if (ymax < 2)
|
2010-03-08 16:36:53 +00:00
|
|
|
return;
|
2012-03-24 02:51:46 +00:00
|
|
|
renrect->ymin = renrect->ymax;
|
2010-03-08 16:36:53 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
xmin = ymin = rr->crop;
|
2012-03-29 22:42:32 +00:00
|
|
|
xmax = rr->rectx - 2 * rr->crop;
|
|
|
|
ymax = rr->recty - 2 * rr->crop;
|
2010-03-08 16:36:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* xmin ymin is in tile coords. transform to ibuf */
|
2012-03-29 22:42:32 +00:00
|
|
|
rxmin = rr->tilerect.xmin + xmin;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (rxmin >= ibuf->x) return;
|
2012-03-29 22:42:32 +00:00
|
|
|
rymin = rr->tilerect.ymin + ymin;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (rymin >= ibuf->y) return;
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (rxmin + xmax > ibuf->x)
|
2012-03-29 22:42:32 +00:00
|
|
|
xmax = ibuf->x - rxmin;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (rymin + ymax > ibuf->y)
|
2012-03-29 22:42:32 +00:00
|
|
|
ymax = ibuf->y - rymin;
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (xmax < 1 || ymax < 1) return;
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2013-12-17 23:42:38 +06:00
|
|
|
/* The thing here is, the logic below (which was default behavior
|
|
|
|
* of how rectf is acquiring since forever) gives float buffer for
|
|
|
|
* composite output only. This buffer can not be used for other
|
|
|
|
* passes obviously.
|
|
|
|
*
|
|
|
|
* We might try finding corresponding for pass buffer in render result
|
|
|
|
* (which is actually missing when rendering with Cycles, who only
|
|
|
|
* writes all the passes when the tile is finished) or use float
|
|
|
|
* buffer from image buffer as reference, which is easier to use and
|
|
|
|
* contains all the data we need anyway.
|
|
|
|
* - sergey -
|
|
|
|
*/
|
|
|
|
/* TODO(sergey): Need to check has_combined here? */
|
2015-09-09 19:41:46 +05:00
|
|
|
if (iuser->pass == 0) {
|
2015-04-29 11:26:30 -03:00
|
|
|
RenderView *rv;
|
2015-10-24 01:01:10 +11:00
|
|
|
const int view_id = BKE_scene_multiview_view_id_get(&scene->r, viewname);
|
2015-04-29 11:26:30 -03:00
|
|
|
rv = RE_RenderViewGetById(rr, view_id);
|
|
|
|
|
2013-12-17 23:42:38 +06:00
|
|
|
/* find current float rect for display, first case is after composite... still weak */
|
2015-04-29 11:26:30 -03:00
|
|
|
if (rv->rectf)
|
|
|
|
rectf = rv->rectf;
|
|
|
|
else {
|
|
|
|
if (rv->rect32) {
|
2013-12-17 23:42:38 +06:00
|
|
|
/* special case, currently only happens with sequencer rendering,
|
|
|
|
* which updates the whole frame, so we can only mark display buffer
|
|
|
|
* as invalid here (sergey)
|
|
|
|
*/
|
|
|
|
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
2015-04-06 10:40:12 -03:00
|
|
|
if (rr->renlay == NULL) return;
|
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
|
|
|
rectf = RE_RenderLayerGetPass(rr->renlay, RE_PASSNAME_COMBINED, viewname);
|
2013-12-17 23:42:38 +06:00
|
|
|
}
|
2010-03-08 16:36:53 +00:00
|
|
|
}
|
2013-12-17 23:42:38 +06:00
|
|
|
if (rectf == NULL) return;
|
2011-05-19 11:34:11 +00:00
|
|
|
|
2013-12-17 23:42:38 +06:00
|
|
|
rectf += 4 * (rr->rectx * ymin + xmin);
|
|
|
|
linear_stride = rr->rectx;
|
|
|
|
linear_offset_x = rxmin;
|
|
|
|
linear_offset_y = rymin;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
rectf = ibuf->rect_float;
|
|
|
|
linear_stride = ibuf->x;
|
|
|
|
linear_offset_x = 0;
|
|
|
|
linear_offset_y = 0;
|
|
|
|
}
|
2013-04-02 17:28:37 +00:00
|
|
|
|
2014-01-01 16:59:38 +06:00
|
|
|
if (rr->do_exr_tile) {
|
|
|
|
/* We don't support changing color management settings during rendering
|
|
|
|
* when using Save Buffers option.
|
|
|
|
*/
|
|
|
|
view_settings = &rj->view_settings;
|
|
|
|
display_settings = &rj->display_settings;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
view_settings = &scene->view_settings;
|
|
|
|
display_settings = &scene->display_settings;
|
|
|
|
}
|
|
|
|
|
2013-12-17 23:42:38 +06:00
|
|
|
IMB_partial_display_buffer_update(ibuf, rectf, NULL,
|
|
|
|
linear_stride, linear_offset_x, linear_offset_y,
|
2014-01-01 16:59:38 +06:00
|
|
|
view_settings, display_settings,
|
|
|
|
rxmin, rymin, rxmin + xmax, rymin + ymax,
|
|
|
|
rr->do_exr_tile);
|
2010-03-08 16:36:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ****************************** render invoking ***************** */
|
|
|
|
|
|
|
|
/* set callbacks, exported to sequence render too.
|
2012-03-03 16:31:46 +00:00
|
|
|
* Only call in foreground (UI) renders. */
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
static void screen_render_view_layer_set(wmOperator *op, Main *mainp, Scene **scene, ViewLayer **view_layer)
|
2011-10-23 17:52:20 +00:00
|
|
|
{
|
|
|
|
/* single layer re-render */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (RNA_struct_property_is_set(op->ptr, "scene")) {
|
2011-10-23 17:52:20 +00:00
|
|
|
Scene *scn;
|
2012-03-29 22:42:32 +00:00
|
|
|
char scene_name[MAX_ID_NAME - 2];
|
2011-10-23 17:52:20 +00:00
|
|
|
|
|
|
|
RNA_string_get(op->ptr, "scene", scene_name);
|
|
|
|
scn = (Scene *)BLI_findstring(&mainp->scene, scene_name, offsetof(ID, name) + 2);
|
|
|
|
|
|
|
|
if (scn) {
|
|
|
|
/* camera switch wont have updated */
|
2012-03-29 22:42:32 +00:00
|
|
|
scn->r.cfra = (*scene)->r.cfra;
|
2012-05-05 14:33:36 +00:00
|
|
|
BKE_scene_camera_switch_update(scn);
|
2011-10-23 17:52:20 +00:00
|
|
|
|
|
|
|
*scene = scn;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (RNA_struct_property_is_set(op->ptr, "layer")) {
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *rl;
|
2011-10-23 17:52:20 +00:00
|
|
|
char rl_name[RE_MAXNAME];
|
|
|
|
|
|
|
|
RNA_string_get(op->ptr, "layer", rl_name);
|
2017-11-22 10:52:39 -02:00
|
|
|
rl = (ViewLayer *)BLI_findstring(&(*scene)->view_layers, rl_name, offsetof(ViewLayer, name));
|
2011-10-23 17:52:20 +00:00
|
|
|
|
|
|
|
if (rl)
|
2017-11-22 10:52:39 -02:00
|
|
|
*view_layer = rl;
|
2011-10-23 17:52:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
/* executes blocking render */
|
|
|
|
static int screen_render_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2012-03-29 22:42:32 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer = NULL;
|
2017-11-09 11:20:17 +01:00
|
|
|
Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
2011-11-01 14:51:44 +00:00
|
|
|
Render *re;
|
2010-03-27 15:35:34 +00:00
|
|
|
Image *ima;
|
2012-03-29 22:42:32 +00:00
|
|
|
View3D *v3d = CTX_wm_view3d(C);
|
|
|
|
Main *mainp = CTX_data_main(C);
|
2013-09-12 12:09:14 +00:00
|
|
|
unsigned int lay_override;
|
2014-01-28 03:52:21 +11:00
|
|
|
const bool is_animation = RNA_boolean_get(op->ptr, "animation");
|
|
|
|
const bool is_write_still = RNA_boolean_get(op->ptr, "write_still");
|
2012-03-29 22:42:32 +00:00
|
|
|
struct Object *camera_override = v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
|
2010-11-16 14:40:46 +00:00
|
|
|
|
2011-11-01 14:51:44 +00:00
|
|
|
/* custom scene and single layer re-render */
|
2017-11-22 10:52:39 -02:00
|
|
|
screen_render_view_layer_set(op, mainp, &scene, &view_layer);
|
2011-11-01 14:51:44 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
|
2012-10-26 17:32:50 +00:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected");
|
2010-11-16 14:40:46 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2017-09-12 11:27:22 +05:00
|
|
|
re = RE_NewSceneRender(scene);
|
2017-05-18 14:47:44 +02:00
|
|
|
RE_SetDepsgraph(re, CTX_data_depsgraph(C));
|
2013-09-12 12:09:14 +00:00
|
|
|
lay_override = (v3d && v3d->lay != scene->lay) ? v3d->lay : 0;
|
2011-11-01 14:51:44 +00:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
G.is_break = false;
|
2013-01-22 02:21:21 +00:00
|
|
|
RE_test_break_cb(re, NULL, render_break);
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-03-29 22:42:32 +00:00
|
|
|
ima = BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
|
2010-03-27 15:35:34 +00:00
|
|
|
BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
|
2015-11-30 00:51:30 +01:00
|
|
|
BKE_image_backup_render(scene, ima, true);
|
2010-03-27 15:35:34 +00:00
|
|
|
|
2010-08-08 16:47:58 +00:00
|
|
|
/* cleanup sequencer caches before starting user triggered render.
|
2012-04-22 11:54:53 +00:00
|
|
|
* otherwise, invalidated cache entries can make their way into
|
|
|
|
* the output rendering. We can't put that into RE_BlenderFrame,
|
|
|
|
* since sequence rendering can call that recursively... (peter) */
|
2012-08-08 11:56:58 +00:00
|
|
|
BKE_sequencer_cache_cleanup();
|
2010-08-08 16:47:58 +00:00
|
|
|
|
2011-06-28 16:25:07 +00:00
|
|
|
RE_SetReports(re, op->reports);
|
|
|
|
|
2014-06-24 14:23:33 +06:00
|
|
|
BLI_begin_threaded_malloc();
|
2012-03-24 06:38:07 +00:00
|
|
|
if (is_animation)
|
2013-09-12 12:09:14 +00:00
|
|
|
RE_BlenderAnim(re, mainp, scene, camera_override, lay_override, scene->r.sfra, scene->r.efra, scene->r.frame_step);
|
2010-03-08 16:36:53 +00:00
|
|
|
else
|
2017-11-22 10:52:39 -02:00
|
|
|
RE_BlenderFrame(re, mainp, scene, view_layer, camera_override, lay_override, scene->r.cfra, is_write_still);
|
2014-06-24 14:23:33 +06:00
|
|
|
BLI_end_threaded_malloc();
|
2010-08-01 12:47:49 +00:00
|
|
|
|
2011-06-28 16:25:07 +00:00
|
|
|
RE_SetReports(re, NULL);
|
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
// no redraw needed, we leave state as we entered it
|
2017-11-22 10:52:39 -02:00
|
|
|
ED_update_for_newframe(mainp, scene, view_layer, depsgraph);
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-03-29 22:42:32 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, scene);
|
2010-03-08 16:36:53 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void render_freejob(void *rjv)
|
|
|
|
{
|
2012-03-29 22:42:32 +00:00
|
|
|
RenderJob *rj = rjv;
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2014-01-01 16:59:38 +06:00
|
|
|
BKE_color_managed_view_settings_free(&rj->view_settings);
|
2010-03-08 16:36:53 +00:00
|
|
|
MEM_freeN(rj);
|
|
|
|
}
|
|
|
|
|
2010-03-27 15:35:34 +00:00
|
|
|
/* str is IMA_MAX_RENDER_TEXT in size */
|
2014-12-05 21:56:29 +05:00
|
|
|
static void make_renderinfo_string(const RenderStats *rs,
|
|
|
|
const Scene *scene,
|
|
|
|
const bool v3d_override,
|
|
|
|
const char *error,
|
|
|
|
char *str)
|
2010-03-08 16:36:53 +00:00
|
|
|
{
|
2012-03-29 22:42:32 +00:00
|
|
|
char info_time_str[32]; // used to be extern to header_info.c
|
2010-05-04 12:31:24 +00:00
|
|
|
uintptr_t mem_in_use, mmap_in_use, peak_memory;
|
|
|
|
float megs_used_memory, mmap_used_memory, megs_peak_memory;
|
2012-03-29 22:42:32 +00:00
|
|
|
char *spos = str;
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-03-29 22:42:32 +00:00
|
|
|
mem_in_use = MEM_get_memory_in_use();
|
|
|
|
mmap_in_use = MEM_get_mapped_memory_in_use();
|
2010-05-04 12:31:24 +00:00
|
|
|
peak_memory = MEM_get_peak_memory();
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-03-29 22:42:32 +00:00
|
|
|
megs_used_memory = (mem_in_use - mmap_in_use) / (1024.0 * 1024.0);
|
|
|
|
mmap_used_memory = (mmap_in_use) / (1024.0 * 1024.0);
|
|
|
|
megs_peak_memory = (peak_memory) / (1024.0 * 1024.0);
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2013-06-24 22:41:24 +00:00
|
|
|
/* local view */
|
2013-06-25 10:44:30 +00:00
|
|
|
if (rs->localview)
|
2013-07-12 16:33:30 +00:00
|
|
|
spos += sprintf(spos, "%s | ", IFACE_("3D Local View"));
|
|
|
|
else if (v3d_override)
|
|
|
|
spos += sprintf(spos, "%s | ", IFACE_("3D View"));
|
2013-06-24 22:41:24 +00:00
|
|
|
|
|
|
|
/* frame number */
|
2013-03-10 16:55:01 +00:00
|
|
|
spos += sprintf(spos, IFACE_("Frame:%d "), (scene->r.cfra));
|
2012-06-04 16:09:51 +00:00
|
|
|
|
2013-06-24 22:41:24 +00:00
|
|
|
/* previous and elapsed time */
|
2015-06-30 14:47:31 +10:00
|
|
|
BLI_timecode_string_from_time_simple(info_time_str, sizeof(info_time_str), rs->lastframetime);
|
2013-06-24 22:41:24 +00:00
|
|
|
|
|
|
|
if (rs->infostr && rs->infostr[0]) {
|
|
|
|
if (rs->lastframetime != 0.0)
|
|
|
|
spos += sprintf(spos, IFACE_("| Last:%s "), info_time_str);
|
|
|
|
else
|
|
|
|
spos += sprintf(spos, "| ");
|
|
|
|
|
2015-06-30 14:47:31 +10:00
|
|
|
BLI_timecode_string_from_time_simple(info_time_str, sizeof(info_time_str), PIL_check_seconds_timer() - rs->starttime);
|
2013-06-24 22:41:24 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
spos += sprintf(spos, "| ");
|
|
|
|
|
|
|
|
spos += sprintf(spos, IFACE_("Time:%s "), info_time_str);
|
|
|
|
|
|
|
|
/* statistics */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (rs->statstr) {
|
2013-06-25 10:44:30 +00:00
|
|
|
if (rs->statstr[0]) {
|
2013-06-24 22:41:24 +00:00
|
|
|
spos += sprintf(spos, "| %s ", rs->statstr);
|
2013-06-25 10:44:30 +00:00
|
|
|
}
|
2010-03-08 16:36:53 +00:00
|
|
|
}
|
|
|
|
else {
|
2013-06-24 22:41:24 +00:00
|
|
|
if (rs->totvert || rs->totface || rs->tothalo || rs->totstrand || rs->totlamp)
|
|
|
|
spos += sprintf(spos, "| ");
|
|
|
|
|
2013-03-10 16:55:01 +00:00
|
|
|
if (rs->totvert) spos += sprintf(spos, IFACE_("Ve:%d "), rs->totvert);
|
|
|
|
if (rs->totface) spos += sprintf(spos, IFACE_("Fa:%d "), rs->totface);
|
|
|
|
if (rs->tothalo) spos += sprintf(spos, IFACE_("Ha:%d "), rs->tothalo);
|
|
|
|
if (rs->totstrand) spos += sprintf(spos, IFACE_("St:%d "), rs->totstrand);
|
|
|
|
if (rs->totlamp) spos += sprintf(spos, IFACE_("La:%d "), rs->totlamp);
|
2012-11-05 08:04:57 +00:00
|
|
|
|
|
|
|
if (rs->mem_peak == 0.0f)
|
2013-06-24 22:41:24 +00:00
|
|
|
spos += sprintf(spos, IFACE_("| Mem:%.2fM (%.2fM, Peak %.2fM) "),
|
2013-03-10 16:55:01 +00:00
|
|
|
megs_used_memory, mmap_used_memory, megs_peak_memory);
|
2012-11-05 08:04:57 +00:00
|
|
|
else
|
2013-06-24 22:41:24 +00:00
|
|
|
spos += sprintf(spos, IFACE_("| Mem:%.2fM, Peak: %.2fM "), rs->mem_used, rs->mem_peak);
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (rs->curfield)
|
2013-03-10 16:55:01 +00:00
|
|
|
spos += sprintf(spos, IFACE_("Field %d "), rs->curfield);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (rs->curblur)
|
2013-03-10 16:55:01 +00:00
|
|
|
spos += sprintf(spos, IFACE_("Blur %d "), rs->curblur);
|
2010-03-08 16:36:53 +00:00
|
|
|
}
|
|
|
|
|
2013-06-24 22:41:24 +00:00
|
|
|
/* full sample */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (rs->curfsa)
|
2013-03-10 16:55:01 +00:00
|
|
|
spos += sprintf(spos, IFACE_("| Full Sample %d "), rs->curfsa);
|
2011-06-12 13:35:17 +00:00
|
|
|
|
2013-06-24 22:41:24 +00:00
|
|
|
/* extra info */
|
2014-12-05 21:56:29 +05:00
|
|
|
if (rs->infostr && rs->infostr[0]) {
|
2012-03-29 22:42:32 +00:00
|
|
|
spos += sprintf(spos, "| %s ", rs->infostr);
|
2014-12-05 21:56:29 +05:00
|
|
|
}
|
|
|
|
else if (error && error[0]) {
|
|
|
|
spos += sprintf(spos, "| %s ", error);
|
|
|
|
}
|
2010-03-08 16:36:53 +00:00
|
|
|
|
|
|
|
/* very weak... but 512 characters is quite safe */
|
2012-03-29 22:42:32 +00:00
|
|
|
if (spos >= str + IMA_MAX_RENDER_TEXT)
|
2012-03-31 00:59:17 +00:00
|
|
|
if (G.debug & G_DEBUG)
|
|
|
|
printf("WARNING! renderwin text beyond limit\n");
|
2010-03-08 16:36:53 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void image_renderinfo_cb(void *rjv, RenderStats *rs)
|
|
|
|
{
|
2012-03-29 22:42:32 +00:00
|
|
|
RenderJob *rj = rjv;
|
2010-03-27 15:35:34 +00:00
|
|
|
RenderResult *rr;
|
|
|
|
|
2012-03-29 22:42:32 +00:00
|
|
|
rr = RE_AcquireResultRead(rj->re);
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (rr) {
|
2010-07-05 09:31:24 +00:00
|
|
|
/* malloc OK here, stats_draw is not in tile threads */
|
2012-03-29 22:42:32 +00:00
|
|
|
if (rr->text == NULL)
|
|
|
|
rr->text = MEM_callocN(IMA_MAX_RENDER_TEXT, "rendertext");
|
2010-07-05 09:31:24 +00:00
|
|
|
|
2014-12-05 21:56:29 +05:00
|
|
|
make_renderinfo_string(rs, rj->scene, rj->v3d_override,
|
|
|
|
rr->error, rr->text);
|
2010-07-05 09:31:24 +00:00
|
|
|
}
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2010-03-27 15:35:34 +00:00
|
|
|
RE_ReleaseResult(rj->re);
|
2010-03-08 16:36:53 +00:00
|
|
|
|
|
|
|
/* make jobs timer to send notifier */
|
2014-04-01 11:34:00 +11:00
|
|
|
*(rj->do_update) = true;
|
2010-03-08 16:36:53 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-05-27 08:22:16 +00:00
|
|
|
static void render_progress_update(void *rjv, float progress)
|
|
|
|
{
|
2012-03-29 22:42:32 +00:00
|
|
|
RenderJob *rj = rjv;
|
2010-05-27 08:22:16 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (rj->progress && *rj->progress != progress) {
|
2010-05-27 08:22:16 +00:00
|
|
|
*rj->progress = progress;
|
2011-12-07 11:29:24 +00:00
|
|
|
|
|
|
|
/* make jobs timer to send notifier */
|
2014-04-01 11:34:00 +11:00
|
|
|
*(rj->do_update) = true;
|
2011-12-07 11:29:24 +00:00
|
|
|
}
|
2010-05-27 08:22:16 +00:00
|
|
|
}
|
|
|
|
|
2013-12-17 23:42:38 +06:00
|
|
|
/* Not totally reliable, but works fine in most of cases and
|
|
|
|
* in worst case would just make it so extra color management
|
|
|
|
* for the whole render result is applied (which was already
|
|
|
|
* happening already).
|
|
|
|
*/
|
|
|
|
static void render_image_update_pass_and_layer(RenderJob *rj, RenderResult *rr, ImageUser *iuser)
|
|
|
|
{
|
|
|
|
wmWindowManager *wm;
|
|
|
|
ScrArea *first_sa = NULL, *matched_sa = NULL;
|
|
|
|
|
|
|
|
/* image window, compo node users */
|
|
|
|
for (wm = rj->main->wm.first; wm && matched_sa == NULL; wm = wm->id.next) { /* only 1 wm */
|
|
|
|
wmWindow *win;
|
|
|
|
for (win = wm->windows.first; win && matched_sa == NULL; 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
|
|
|
const bScreen *screen = WM_window_get_active_screen(win);
|
|
|
|
|
|
|
|
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
2013-12-17 23:42:38 +06:00
|
|
|
if (sa->spacetype == SPACE_IMAGE) {
|
|
|
|
SpaceImage *sima = sa->spacedata.first;
|
2014-04-11 16:17:59 +06:00
|
|
|
// sa->spacedata might be empty when toggling fullscreen mode.
|
|
|
|
if (sima != NULL && sima->image == rj->image) {
|
2013-12-17 23:42:38 +06:00
|
|
|
if (first_sa == NULL) {
|
|
|
|
first_sa = sa;
|
|
|
|
}
|
|
|
|
if (sa == rj->sa) {
|
|
|
|
matched_sa = sa;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (matched_sa == NULL) {
|
|
|
|
matched_sa = first_sa;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (matched_sa) {
|
|
|
|
SpaceImage *sima = matched_sa->spacedata.first;
|
|
|
|
RenderResult *main_rr = RE_AcquireResultRead(rj->re);
|
|
|
|
|
|
|
|
/* TODO(sergey): is there faster way to get the layer index? */
|
|
|
|
if (rr->renlay) {
|
|
|
|
int layer = BLI_findstringindex(&main_rr->layers,
|
|
|
|
(char *)rr->renlay->name,
|
|
|
|
offsetof(RenderLayer, name));
|
|
|
|
if (layer != rj->last_layer) {
|
|
|
|
sima->iuser.layer = layer;
|
|
|
|
rj->last_layer = layer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-09 19:41:46 +05:00
|
|
|
iuser->pass = sima->iuser.pass;
|
2013-12-17 23:42:38 +06:00
|
|
|
iuser->layer = sima->iuser.layer;
|
|
|
|
|
|
|
|
RE_ReleaseResult(rj->re);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrect)
|
|
|
|
{
|
2012-03-29 22:42:32 +00:00
|
|
|
RenderJob *rj = rjv;
|
|
|
|
Image *ima = rj->image;
|
2010-03-08 16:36:53 +00:00
|
|
|
ImBuf *ibuf;
|
|
|
|
void *lock;
|
2015-04-06 10:40:12 -03:00
|
|
|
const char *viewname = RE_GetActiveRenderView(rj->re);
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2010-04-01 12:51:24 +00:00
|
|
|
/* only update if we are displaying the slot being rendered */
|
2013-09-03 20:59:24 +00:00
|
|
|
if (ima->render_slot != ima->last_render_slot) {
|
|
|
|
rj->image_outdated = true;
|
2010-04-01 12:51:24 +00:00
|
|
|
return;
|
2013-09-03 20:59:24 +00:00
|
|
|
}
|
|
|
|
else if (rj->image_outdated) {
|
|
|
|
/* update entire render */
|
|
|
|
rj->image_outdated = false;
|
|
|
|
BKE_image_signal(ima, NULL, IMA_SIGNAL_COLORMANAGE);
|
2014-04-01 11:34:00 +11:00
|
|
|
*(rj->do_update) = true;
|
2013-09-03 20:59:24 +00:00
|
|
|
return;
|
|
|
|
}
|
2014-03-05 17:42:48 +01:00
|
|
|
|
|
|
|
if (rr == NULL)
|
|
|
|
return;
|
|
|
|
|
2013-09-03 20:59:24 +00:00
|
|
|
/* update part of render */
|
2013-12-17 23:42:38 +06:00
|
|
|
render_image_update_pass_and_layer(rj, rr, &rj->iuser);
|
2012-03-29 22:42:32 +00:00
|
|
|
ibuf = BKE_image_acquire_ibuf(ima, &rj->iuser, &lock);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ibuf) {
|
2013-12-17 23:42:38 +06:00
|
|
|
/* Don't waste time on CPU side color management if
|
|
|
|
* image will be displayed using GLSL.
|
2014-01-01 16:59:38 +06:00
|
|
|
*
|
|
|
|
* Need to update rect if Save Buffers enabled because in
|
|
|
|
* this case GLSL doesn't have original float buffer to
|
|
|
|
* operate with.
|
2013-12-17 23:42:38 +06:00
|
|
|
*/
|
2014-01-01 16:59:38 +06:00
|
|
|
if (rr->do_exr_tile ||
|
2017-05-08 17:43:32 +02:00
|
|
|
!rj->supports_glsl_draw ||
|
2014-01-01 16:59:38 +06:00
|
|
|
ibuf->channels == 1 ||
|
2013-12-17 23:42:38 +06:00
|
|
|
U.image_draw_method != IMAGE_DRAW_METHOD_GLSL)
|
|
|
|
{
|
2015-04-06 10:40:12 -03:00
|
|
|
image_buffer_rect_update(rj, rr, ibuf, &rj->iuser, renrect, viewname);
|
2013-12-17 23:42:38 +06:00
|
|
|
}
|
2014-03-05 17:42:48 +01:00
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
/* make jobs timer to send notifier */
|
2014-04-01 11:34:00 +11:00
|
|
|
*(rj->do_update) = true;
|
2010-03-08 16:36:53 +00:00
|
|
|
}
|
2012-11-15 15:59:58 +00:00
|
|
|
BKE_image_release_ibuf(ima, ibuf, lock);
|
2010-03-08 16:36:53 +00:00
|
|
|
}
|
|
|
|
|
2014-05-02 14:52:19 +02:00
|
|
|
static void current_scene_update(void *rjv, Scene *scene)
|
|
|
|
{
|
|
|
|
RenderJob *rj = rjv;
|
|
|
|
rj->current_scene = scene;
|
|
|
|
rj->iuser.scene = scene;
|
|
|
|
}
|
|
|
|
|
2010-05-27 08:22:16 +00:00
|
|
|
static void render_startjob(void *rjv, short *stop, short *do_update, float *progress)
|
2010-03-08 16:36:53 +00:00
|
|
|
{
|
2012-03-29 22:42:32 +00:00
|
|
|
RenderJob *rj = rjv;
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-03-29 22:42:32 +00:00
|
|
|
rj->stop = stop;
|
|
|
|
rj->do_update = do_update;
|
|
|
|
rj->progress = progress;
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2011-06-28 16:25:07 +00:00
|
|
|
RE_SetReports(rj->re, rj->reports);
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (rj->anim)
|
2013-09-12 12:09:14 +00:00
|
|
|
RE_BlenderAnim(rj->re, rj->main, rj->scene, rj->camera_override, rj->lay_override, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step);
|
2010-03-08 16:36:53 +00:00
|
|
|
else
|
2017-11-22 10:52:39 -02:00
|
|
|
RE_BlenderFrame(rj->re, rj->main, rj->scene, rj->view_layer, rj->camera_override, rj->lay_override, rj->scene->r.cfra, rj->write_still);
|
2011-06-28 16:25:07 +00:00
|
|
|
|
|
|
|
RE_SetReports(rj->re, NULL);
|
2010-03-08 16:36:53 +00:00
|
|
|
}
|
|
|
|
|
2013-12-17 23:42:38 +06:00
|
|
|
static void render_image_restore_layer(RenderJob *rj)
|
|
|
|
{
|
|
|
|
wmWindowManager *wm;
|
|
|
|
|
|
|
|
/* image window, compo node users */
|
|
|
|
for (wm = rj->main->wm.first; wm; wm = wm->id.next) { /* only 1 wm */
|
|
|
|
wmWindow *win;
|
|
|
|
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
|
|
|
const bScreen *screen = WM_window_get_active_screen(win);
|
|
|
|
|
|
|
|
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
2013-12-17 23:42:38 +06:00
|
|
|
if (sa == rj->sa) {
|
|
|
|
if (sa->spacetype == SPACE_IMAGE) {
|
|
|
|
SpaceImage *sima = sa->spacedata.first;
|
|
|
|
sima->iuser.layer = rj->orig_layer;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-15 10:28:32 +00:00
|
|
|
static void render_endjob(void *rjv)
|
|
|
|
{
|
2012-03-29 22:42:32 +00:00
|
|
|
RenderJob *rj = rjv;
|
2010-11-03 11:14:02 +00:00
|
|
|
|
|
|
|
/* this render may be used again by the sequencer without the active 'Render' where the callbacks
|
|
|
|
* would be re-assigned. assign dummy callbacks to avoid referencing freed renderjobs bug [#24508] */
|
|
|
|
RE_InitRenderCB(rj->re);
|
2010-08-13 14:29:56 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (rj->main != G.main)
|
2013-12-30 13:25:27 +11:00
|
|
|
BKE_main_free(rj->main);
|
2010-08-13 14:29:56 +00:00
|
|
|
|
2010-11-02 09:34:32 +00:00
|
|
|
/* else the frame will not update for the original value */
|
2013-06-10 13:53:38 +00:00
|
|
|
if (rj->anim && !(rj->scene->r.scemode & R_NO_FRAME_UPDATE)) {
|
2012-06-01 15:05:30 +00:00
|
|
|
/* possible this fails of loading new file while rendering */
|
|
|
|
if (G.main->wm.first) {
|
2017-11-22 10:52:39 -02:00
|
|
|
ED_update_for_newframe(G.main, rj->scene, rj->view_layer, rj->depsgraph);
|
2012-06-01 15:05:30 +00:00
|
|
|
}
|
|
|
|
}
|
2010-11-02 09:34:32 +00:00
|
|
|
|
2011-02-07 16:41:57 +00:00
|
|
|
/* XXX above function sets all tags in nodes */
|
2011-10-19 17:08:35 +00:00
|
|
|
ntreeCompositClearTags(rj->scene->nodetree);
|
2011-02-07 16:41:57 +00:00
|
|
|
|
2011-02-07 18:09:27 +00:00
|
|
|
/* potentially set by caller */
|
|
|
|
rj->scene->r.scemode &= ~R_NO_FRAME_UPDATE;
|
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
if (rj->view_layer) {
|
2011-10-19 17:08:35 +00:00
|
|
|
nodeUpdateID(rj->scene->nodetree, &rj->scene->id);
|
2012-03-29 22:42:32 +00:00
|
|
|
WM_main_add_notifier(NC_NODE | NA_EDITED, rj->scene);
|
2010-12-17 17:06:36 +00:00
|
|
|
}
|
Bunch of fixes for GLSL display transform
- GLSL shader wasn't aware of alpha predivide option,
always assuming alpha is straight. Gave wrong results
when displaying transparent float buffers.
- GLSL display wasn't aware of float buffers with number
of channels different from 4, crashing when trying to
display image with different number of channels.
This required a bit larger changes, namely now it's
possible to pass format (GL_RGB, GL_RGBAm GL_LUMINANCE)
to glaDrawPixelsTex, This also implied adding format to
glaDrawPixelsAuto and modifying all places where this
functions are called.
Now GLSL will handle both 3 and 4 channels buffers,
single channel images are handled by CPU.
- Replaced hack for render result displaying with a bit
different hack.
Namely CPU conversion will happen only during render,
once render is done GLSL would be used for displaying
render result on a screen.
This is so because of the way renderer updates parts
of the image -- it happens without respect to active
render layer in image user. This is harmless because
only display buffer is modifying, but this is tricky
because we don't have original buffer opened during
rendering.
One more related fix here was about when rendering
multiple layers, wrong image would be displaying when
rendering is done. Added a signal to invalidate
display buffer once rendering is done (only happens
when using multiple layers). This solves issue with
wrong buffer stuck on the display when using regular
CPU display space transform and if GLSL is available
it'll make image displayed with a GLSL shader.
- As an additional change, byte buffers now also uses
GLSL display transform.
So now only dutehr and RGB curves are stoppers for
using GLSL for all kind of display transforms.
2013-04-03 15:59:54 +00:00
|
|
|
|
2013-12-17 23:42:38 +06:00
|
|
|
if (rj->sa) {
|
|
|
|
render_image_restore_layer(rj);
|
|
|
|
}
|
|
|
|
|
2010-04-15 10:28:32 +00:00
|
|
|
/* XXX render stability hack */
|
2014-04-01 11:34:00 +11:00
|
|
|
G.is_rendering = false;
|
2013-06-25 10:44:30 +00:00
|
|
|
WM_main_add_notifier(NC_SCENE | ND_RENDER_RESULT, NULL);
|
Bunch of fixes for GLSL display transform
- GLSL shader wasn't aware of alpha predivide option,
always assuming alpha is straight. Gave wrong results
when displaying transparent float buffers.
- GLSL display wasn't aware of float buffers with number
of channels different from 4, crashing when trying to
display image with different number of channels.
This required a bit larger changes, namely now it's
possible to pass format (GL_RGB, GL_RGBAm GL_LUMINANCE)
to glaDrawPixelsTex, This also implied adding format to
glaDrawPixelsAuto and modifying all places where this
functions are called.
Now GLSL will handle both 3 and 4 channels buffers,
single channel images are handled by CPU.
- Replaced hack for render result displaying with a bit
different hack.
Namely CPU conversion will happen only during render,
once render is done GLSL would be used for displaying
render result on a screen.
This is so because of the way renderer updates parts
of the image -- it happens without respect to active
render layer in image user. This is harmless because
only display buffer is modifying, but this is tricky
because we don't have original buffer opened during
rendering.
One more related fix here was about when rendering
multiple layers, wrong image would be displaying when
rendering is done. Added a signal to invalidate
display buffer once rendering is done (only happens
when using multiple layers). This solves issue with
wrong buffer stuck on the display when using regular
CPU display space transform and if GLSL is available
it'll make image displayed with a GLSL shader.
- As an additional change, byte buffers now also uses
GLSL display transform.
So now only dutehr and RGB curves are stoppers for
using GLSL for all kind of display transforms.
2013-04-03 15:59:54 +00:00
|
|
|
|
|
|
|
/* Partial render result will always update display buffer
|
|
|
|
* for first render layer only. This is nice because you'll
|
|
|
|
* see render progress during rendering, but it ends up in
|
|
|
|
* wrong display buffer shown after rendering.
|
|
|
|
*
|
|
|
|
* The code below will mark display buffer as invalid after
|
|
|
|
* rendering in case multiple layers were rendered, which
|
|
|
|
* ensures display buffer matches render layer after
|
|
|
|
* rendering.
|
|
|
|
*
|
|
|
|
* Perhaps proper way would be to toggle active render
|
|
|
|
* layer in image editor and job, so we always display
|
|
|
|
* layer being currently rendered. But this is not so much
|
|
|
|
* trivial at this moment, especially because of external
|
|
|
|
* engine API, so lets use simple and robust way for now
|
|
|
|
* - sergey -
|
|
|
|
*/
|
2017-11-22 10:52:39 -02:00
|
|
|
if (rj->scene->view_layers.first != rj->scene->view_layers.last ||
|
2013-09-05 19:56:49 +00:00
|
|
|
rj->image_outdated)
|
|
|
|
{
|
Bunch of fixes for GLSL display transform
- GLSL shader wasn't aware of alpha predivide option,
always assuming alpha is straight. Gave wrong results
when displaying transparent float buffers.
- GLSL display wasn't aware of float buffers with number
of channels different from 4, crashing when trying to
display image with different number of channels.
This required a bit larger changes, namely now it's
possible to pass format (GL_RGB, GL_RGBAm GL_LUMINANCE)
to glaDrawPixelsTex, This also implied adding format to
glaDrawPixelsAuto and modifying all places where this
functions are called.
Now GLSL will handle both 3 and 4 channels buffers,
single channel images are handled by CPU.
- Replaced hack for render result displaying with a bit
different hack.
Namely CPU conversion will happen only during render,
once render is done GLSL would be used for displaying
render result on a screen.
This is so because of the way renderer updates parts
of the image -- it happens without respect to active
render layer in image user. This is harmless because
only display buffer is modifying, but this is tricky
because we don't have original buffer opened during
rendering.
One more related fix here was about when rendering
multiple layers, wrong image would be displaying when
rendering is done. Added a signal to invalidate
display buffer once rendering is done (only happens
when using multiple layers). This solves issue with
wrong buffer stuck on the display when using regular
CPU display space transform and if GLSL is available
it'll make image displayed with a GLSL shader.
- As an additional change, byte buffers now also uses
GLSL display transform.
So now only dutehr and RGB curves are stoppers for
using GLSL for all kind of display transforms.
2013-04-03 15:59:54 +00:00
|
|
|
void *lock;
|
|
|
|
Image *ima = rj->image;
|
|
|
|
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, &rj->iuser, &lock);
|
|
|
|
|
|
|
|
if (ibuf)
|
|
|
|
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
|
|
|
|
|
|
|
|
BKE_image_release_ibuf(ima, ibuf, lock);
|
|
|
|
}
|
Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
(see below) or values are even possible to run or change.
This prevents any kind of "destructive" action performed
from user while rendering.
- Locks interface refresh for regions which does have lock
set to truth in their template. Currently it's just a 3D
viewport, but in the future more regions could be considered
unsafe, or we could want to lock different parts of
interface when doing different jobs.
This is needed because 3D viewport could be using or changing
the same data as renderer currently uses, leading to threading
conflict.
Notifiers are still allowed to handle, so render progress is
seen on the screen, but would need to doublecheck on this, in
terms some notifiers could be changing the data.
For now interface locking happens for render job only in case
"Lock Interface" checkbox is enabled.
Other tools like backing would also benefit of this option.
It is possible to mark operator as safe to be used in locked
interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
template flags.
This bit is completely handled by wm_evem_system, not
with operator run routines, so it's still possible to
run operators from drivers and handlers.
Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
|
|
|
|
|
|
|
/* Finally unlock the user interface (if it was locked). */
|
|
|
|
if (rj->interface_locked) {
|
|
|
|
Scene *scene;
|
|
|
|
|
|
|
|
/* Interface was locked, so window manager couldn't have been changed
|
|
|
|
* and using one from Global will unlock exactly the same manager as
|
|
|
|
* was locked before running the job.
|
|
|
|
*/
|
|
|
|
WM_set_locked_interface(G.main->wm.first, false);
|
|
|
|
|
|
|
|
/* We've freed all the derived caches before rendering, which is
|
|
|
|
* effectively the same as if we re-loaded the file.
|
|
|
|
*
|
|
|
|
* So let's not try being smart here and just reset all updated
|
|
|
|
* scene layers and use generic DAG_on_visible_update.
|
|
|
|
*/
|
|
|
|
for (scene = G.main->scene.first; scene; scene = scene->id.next) {
|
|
|
|
scene->lay_updated = 0;
|
|
|
|
}
|
|
|
|
|
2017-06-08 10:14:53 +02:00
|
|
|
DEG_on_visible_update(G.main, false);
|
Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
(see below) or values are even possible to run or change.
This prevents any kind of "destructive" action performed
from user while rendering.
- Locks interface refresh for regions which does have lock
set to truth in their template. Currently it's just a 3D
viewport, but in the future more regions could be considered
unsafe, or we could want to lock different parts of
interface when doing different jobs.
This is needed because 3D viewport could be using or changing
the same data as renderer currently uses, leading to threading
conflict.
Notifiers are still allowed to handle, so render progress is
seen on the screen, but would need to doublecheck on this, in
terms some notifiers could be changing the data.
For now interface locking happens for render job only in case
"Lock Interface" checkbox is enabled.
Other tools like backing would also benefit of this option.
It is possible to mark operator as safe to be used in locked
interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
template flags.
This bit is completely handled by wm_evem_system, not
with operator run routines, so it's still possible to
run operators from drivers and handlers.
Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
|
|
|
}
|
2010-04-15 10:28:32 +00:00
|
|
|
}
|
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
/* called by render, check job 'stop' value or the global */
|
|
|
|
static int render_breakjob(void *rjv)
|
|
|
|
{
|
2012-03-29 22:42:32 +00:00
|
|
|
RenderJob *rj = rjv;
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-08-08 18:37:06 +00:00
|
|
|
if (G.is_break)
|
2010-03-08 16:36:53 +00:00
|
|
|
return 1;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (rj->stop && *(rj->stop))
|
2010-03-08 16:36:53 +00:00
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-01-22 02:21:21 +00:00
|
|
|
/* for exec() when there is no render job
|
|
|
|
* note: this wont check for the escape key being pressed, but doing so isnt threadsafe */
|
|
|
|
static int render_break(void *UNUSED(rjv))
|
|
|
|
{
|
|
|
|
if (G.is_break)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-03-25 17:11:32 +00:00
|
|
|
/* runs in thread, no cursor setting here works. careful with notifiers too (malloc conflicts) */
|
|
|
|
/* maybe need a way to get job send notifer? */
|
Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
(see below) or values are even possible to run or change.
This prevents any kind of "destructive" action performed
from user while rendering.
- Locks interface refresh for regions which does have lock
set to truth in their template. Currently it's just a 3D
viewport, but in the future more regions could be considered
unsafe, or we could want to lock different parts of
interface when doing different jobs.
This is needed because 3D viewport could be using or changing
the same data as renderer currently uses, leading to threading
conflict.
Notifiers are still allowed to handle, so render progress is
seen on the screen, but would need to doublecheck on this, in
terms some notifiers could be changing the data.
For now interface locking happens for render job only in case
"Lock Interface" checkbox is enabled.
Other tools like backing would also benefit of this option.
It is possible to mark operator as safe to be used in locked
interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
template flags.
This bit is completely handled by wm_evem_system, not
with operator run routines, so it's still possible to
run operators from drivers and handlers.
Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
|
|
|
static void render_drawlock(void *rjv, int lock)
|
2011-03-25 17:11:32 +00:00
|
|
|
{
|
Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
(see below) or values are even possible to run or change.
This prevents any kind of "destructive" action performed
from user while rendering.
- Locks interface refresh for regions which does have lock
set to truth in their template. Currently it's just a 3D
viewport, but in the future more regions could be considered
unsafe, or we could want to lock different parts of
interface when doing different jobs.
This is needed because 3D viewport could be using or changing
the same data as renderer currently uses, leading to threading
conflict.
Notifiers are still allowed to handle, so render progress is
seen on the screen, but would need to doublecheck on this, in
terms some notifiers could be changing the data.
For now interface locking happens for render job only in case
"Lock Interface" checkbox is enabled.
Other tools like backing would also benefit of this option.
It is possible to mark operator as safe to be used in locked
interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
template flags.
This bit is completely handled by wm_evem_system, not
with operator run routines, so it's still possible to
run operators from drivers and handlers.
Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
|
|
|
RenderJob *rj = rjv;
|
|
|
|
|
|
|
|
/* If interface is locked, renderer callback shall do nothing. */
|
|
|
|
if (!rj->interface_locked) {
|
|
|
|
BKE_spacedata_draw_locks(lock);
|
|
|
|
}
|
2011-03-25 17:11:32 +00:00
|
|
|
}
|
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
/* catch esc */
|
2013-03-13 09:03:46 +00:00
|
|
|
static int screen_render_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
2010-03-08 16:36:53 +00:00
|
|
|
{
|
2012-08-01 19:22:04 +00:00
|
|
|
Scene *scene = (Scene *) op->customdata;
|
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
/* no running blender, remove handler and pass through */
|
2012-08-15 10:23:06 +00:00
|
|
|
if (0 == WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER)) {
|
2012-03-29 22:42:32 +00:00
|
|
|
return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
|
2010-04-15 10:28:32 +00:00
|
|
|
}
|
2010-03-08 16:36:53 +00:00
|
|
|
|
|
|
|
/* running render */
|
|
|
|
switch (event->type) {
|
|
|
|
case ESCKEY:
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
return OPERATOR_PASS_THROUGH;
|
|
|
|
}
|
|
|
|
|
2013-10-30 23:08:53 +00:00
|
|
|
static void screen_render_cancel(bContext *C, wmOperator *op)
|
2013-09-23 19:35:21 +00:00
|
|
|
{
|
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
Scene *scene = (Scene *) op->customdata;
|
|
|
|
|
|
|
|
/* kill on cancel, because job is using op->reports */
|
|
|
|
WM_jobs_kill_type(wm, scene, WM_JOB_TYPE_RENDER);
|
|
|
|
}
|
|
|
|
|
2017-10-16 17:15:03 -02:00
|
|
|
static void clean_viewport_memory_base(Base *base)
|
|
|
|
{
|
|
|
|
if ((base->flag & BASE_VISIBLED) == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Object *object = base->object;
|
|
|
|
|
|
|
|
if (object->id.tag & LIB_TAG_DOIT) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
object->id.tag &= ~LIB_TAG_DOIT;
|
|
|
|
if (RE_allow_render_generic_object(object)) {
|
|
|
|
BKE_object_free_derived_caches(object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-15 14:40:41 +01:00
|
|
|
static void clean_viewport_memory(Main *bmain, Scene *scene)
|
Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
(see below) or values are even possible to run or change.
This prevents any kind of "destructive" action performed
from user while rendering.
- Locks interface refresh for regions which does have lock
set to truth in their template. Currently it's just a 3D
viewport, but in the future more regions could be considered
unsafe, or we could want to lock different parts of
interface when doing different jobs.
This is needed because 3D viewport could be using or changing
the same data as renderer currently uses, leading to threading
conflict.
Notifiers are still allowed to handle, so render progress is
seen on the screen, but would need to doublecheck on this, in
terms some notifiers could be changing the data.
For now interface locking happens for render job only in case
"Lock Interface" checkbox is enabled.
Other tools like backing would also benefit of this option.
It is possible to mark operator as safe to be used in locked
interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
template flags.
This bit is completely handled by wm_evem_system, not
with operator run routines, so it's still possible to
run operators from drivers and handlers.
Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
|
|
|
{
|
|
|
|
Scene *sce_iter;
|
2017-02-15 14:40:41 +01:00
|
|
|
Base *base;
|
Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
(see below) or values are even possible to run or change.
This prevents any kind of "destructive" action performed
from user while rendering.
- Locks interface refresh for regions which does have lock
set to truth in their template. Currently it's just a 3D
viewport, but in the future more regions could be considered
unsafe, or we could want to lock different parts of
interface when doing different jobs.
This is needed because 3D viewport could be using or changing
the same data as renderer currently uses, leading to threading
conflict.
Notifiers are still allowed to handle, so render progress is
seen on the screen, but would need to doublecheck on this, in
terms some notifiers could be changing the data.
For now interface locking happens for render job only in case
"Lock Interface" checkbox is enabled.
Other tools like backing would also benefit of this option.
It is possible to mark operator as safe to be used in locked
interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
template flags.
This bit is completely handled by wm_evem_system, not
with operator run routines, so it's still possible to
run operators from drivers and handlers.
Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
|
|
|
|
2017-10-16 17:15:03 -02:00
|
|
|
/* Tag all the available objects. */
|
|
|
|
BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, true);
|
Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
(see below) or values are even possible to run or change.
This prevents any kind of "destructive" action performed
from user while rendering.
- Locks interface refresh for regions which does have lock
set to truth in their template. Currently it's just a 3D
viewport, but in the future more regions could be considered
unsafe, or we could want to lock different parts of
interface when doing different jobs.
This is needed because 3D viewport could be using or changing
the same data as renderer currently uses, leading to threading
conflict.
Notifiers are still allowed to handle, so render progress is
seen on the screen, but would need to doublecheck on this, in
terms some notifiers could be changing the data.
For now interface locking happens for render job only in case
"Lock Interface" checkbox is enabled.
Other tools like backing would also benefit of this option.
It is possible to mark operator as safe to be used in locked
interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
template flags.
This bit is completely handled by wm_evem_system, not
with operator run routines, so it's still possible to
run operators from drivers and handlers.
Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
|
|
|
|
2017-10-16 17:15:03 -02:00
|
|
|
/* Go over all the visible objects. */
|
|
|
|
for (wmWindowManager *wm = bmain->wm.first; wm; wm = wm->id.next) {
|
|
|
|
for (wmWindow *win = wm->windows.first; win; win = win->next) {
|
|
|
|
WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook);
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer = BKE_view_layer_from_workspace_get(scene, workspace);
|
Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
(see below) or values are even possible to run or change.
This prevents any kind of "destructive" action performed
from user while rendering.
- Locks interface refresh for regions which does have lock
set to truth in their template. Currently it's just a 3D
viewport, but in the future more regions could be considered
unsafe, or we could want to lock different parts of
interface when doing different jobs.
This is needed because 3D viewport could be using or changing
the same data as renderer currently uses, leading to threading
conflict.
Notifiers are still allowed to handle, so render progress is
seen on the screen, but would need to doublecheck on this, in
terms some notifiers could be changing the data.
For now interface locking happens for render job only in case
"Lock Interface" checkbox is enabled.
Other tools like backing would also benefit of this option.
It is possible to mark operator as safe to be used in locked
interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
template flags.
This bit is completely handled by wm_evem_system, not
with operator run routines, so it's still possible to
run operators from drivers and handlers.
Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
for (base = view_layer->object_bases.first; base; base = base->next) {
|
2017-10-16 17:15:03 -02:00
|
|
|
clean_viewport_memory_base(base);
|
|
|
|
}
|
Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
(see below) or values are even possible to run or change.
This prevents any kind of "destructive" action performed
from user while rendering.
- Locks interface refresh for regions which does have lock
set to truth in their template. Currently it's just a 3D
viewport, but in the future more regions could be considered
unsafe, or we could want to lock different parts of
interface when doing different jobs.
This is needed because 3D viewport could be using or changing
the same data as renderer currently uses, leading to threading
conflict.
Notifiers are still allowed to handle, so render progress is
seen on the screen, but would need to doublecheck on this, in
terms some notifiers could be changing the data.
For now interface locking happens for render job only in case
"Lock Interface" checkbox is enabled.
Other tools like backing would also benefit of this option.
It is possible to mark operator as safe to be used in locked
interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
template flags.
This bit is completely handled by wm_evem_system, not
with operator run routines, so it's still possible to
run operators from drivers and handlers.
Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
|
|
|
}
|
2017-10-16 17:15:03 -02:00
|
|
|
}
|
Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
(see below) or values are even possible to run or change.
This prevents any kind of "destructive" action performed
from user while rendering.
- Locks interface refresh for regions which does have lock
set to truth in their template. Currently it's just a 3D
viewport, but in the future more regions could be considered
unsafe, or we could want to lock different parts of
interface when doing different jobs.
This is needed because 3D viewport could be using or changing
the same data as renderer currently uses, leading to threading
conflict.
Notifiers are still allowed to handle, so render progress is
seen on the screen, but would need to doublecheck on this, in
terms some notifiers could be changing the data.
For now interface locking happens for render job only in case
"Lock Interface" checkbox is enabled.
Other tools like backing would also benefit of this option.
It is possible to mark operator as safe to be used in locked
interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
template flags.
This bit is completely handled by wm_evem_system, not
with operator run routines, so it's still possible to
run operators from drivers and handlers.
Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
|
|
|
|
2017-12-04 17:19:34 +11:00
|
|
|
for (SETLOOPER_SET_ONLY(scene, sce_iter, base)) {
|
2017-10-16 17:15:03 -02:00
|
|
|
clean_viewport_memory_base(base);
|
Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
(see below) or values are even possible to run or change.
This prevents any kind of "destructive" action performed
from user while rendering.
- Locks interface refresh for regions which does have lock
set to truth in their template. Currently it's just a 3D
viewport, but in the future more regions could be considered
unsafe, or we could want to lock different parts of
interface when doing different jobs.
This is needed because 3D viewport could be using or changing
the same data as renderer currently uses, leading to threading
conflict.
Notifiers are still allowed to handle, so render progress is
seen on the screen, but would need to doublecheck on this, in
terms some notifiers could be changing the data.
For now interface locking happens for render job only in case
"Lock Interface" checkbox is enabled.
Other tools like backing would also benefit of this option.
It is possible to mark operator as safe to be used in locked
interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
template flags.
This bit is completely handled by wm_evem_system, not
with operator run routines, so it's still possible to
run operators from drivers and handlers.
Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
/* using context, starts job */
|
2013-03-13 09:03:46 +00:00
|
|
|
static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
2010-03-08 16:36:53 +00:00
|
|
|
{
|
|
|
|
/* new render clears all callbacks */
|
2010-08-13 14:29:56 +00:00
|
|
|
Main *mainp;
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer = NULL;
|
2012-03-29 22:42:32 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2018-01-29 14:56:16 +01:00
|
|
|
RenderEngineType *re_type = RE_engines_find(scene->view_render.engine_id);
|
2010-03-08 16:36:53 +00:00
|
|
|
Render *re;
|
2012-08-15 10:03:29 +00:00
|
|
|
wmJob *wm_job;
|
2010-03-08 16:36:53 +00:00
|
|
|
RenderJob *rj;
|
|
|
|
Image *ima;
|
2011-02-07 16:41:57 +00:00
|
|
|
int jobflag;
|
2013-09-13 13:34:12 +00:00
|
|
|
const bool is_animation = RNA_boolean_get(op->ptr, "animation");
|
|
|
|
const bool is_write_still = RNA_boolean_get(op->ptr, "write_still");
|
|
|
|
const bool use_viewport = RNA_boolean_get(op->ptr, "use_viewport");
|
|
|
|
View3D *v3d = use_viewport ? CTX_wm_view3d(C) : NULL;
|
2012-03-29 22:42:32 +00:00
|
|
|
struct Object *camera_override = v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
|
2011-11-03 17:06:12 +00:00
|
|
|
const char *name;
|
2013-12-17 23:42:38 +06:00
|
|
|
ScrArea *sa;
|
2018-01-29 14:56:16 +01:00
|
|
|
|
|
|
|
/* XXX FIXME If engine is an OpenGL engine do not run modal.
|
|
|
|
* This is a problem for animation rendering since you cannot abort them.
|
|
|
|
* This also does not open an image editor space. */
|
|
|
|
if (RE_engine_is_opengl(re_type)) {
|
|
|
|
return screen_render_exec(C, op);
|
|
|
|
}
|
2010-11-16 14:40:46 +00:00
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
/* only one render job at a time */
|
2012-08-15 10:23:06 +00:00
|
|
|
if (WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER))
|
2010-03-08 16:36:53 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
2014-02-26 14:56:27 +01:00
|
|
|
if (RE_force_single_renderlayer(scene))
|
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, NULL);
|
|
|
|
|
|
|
|
if (!RE_is_rendering_allowed(scene, camera_override, op->reports)) {
|
2010-11-03 13:10:09 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
|
2012-10-26 17:32:50 +00:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected");
|
2010-11-16 14:40:46 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2010-11-16 14:40:46 +00:00
|
|
|
|
2012-10-29 17:41:19 +00:00
|
|
|
/* stop all running jobs, except screen one. currently previews frustrate Render */
|
|
|
|
WM_jobs_kill_all_except(CTX_wm_manager(C), CTX_wm_screen(C));
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2010-08-13 14:29:56 +00:00
|
|
|
/* get main */
|
2012-08-08 18:21:54 +00:00
|
|
|
if (G.debug_value == 101) {
|
2010-08-13 14:29:56 +00:00
|
|
|
/* thread-safety experiment, copy main from the undo buffer */
|
2012-03-29 22:42:32 +00:00
|
|
|
mainp = BKE_undo_get_main(&scene);
|
2010-08-13 14:29:56 +00:00
|
|
|
}
|
|
|
|
else
|
2012-03-29 22:42:32 +00:00
|
|
|
mainp = CTX_data_main(C);
|
2010-08-13 14:29:56 +00:00
|
|
|
|
2010-04-05 07:57:05 +00:00
|
|
|
/* cancel animation playback */
|
2012-05-25 12:56:29 +00:00
|
|
|
if (ED_screen_animation_playing(CTX_wm_manager(C)))
|
2010-07-19 11:25:23 +00:00
|
|
|
ED_screen_animation_play(C, 0, 0);
|
2010-04-05 07:57:05 +00:00
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
/* handle UI stuff */
|
|
|
|
WM_cursor_wait(1);
|
|
|
|
|
2014-01-20 14:11:12 +01:00
|
|
|
/* flush sculpt and editmode changes */
|
|
|
|
ED_editors_flush_edits(C, true);
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2010-08-08 16:47:58 +00:00
|
|
|
/* cleanup sequencer caches before starting user triggered render.
|
2012-04-22 11:54:53 +00:00
|
|
|
* otherwise, invalidated cache entries can make their way into
|
|
|
|
* the output rendering. We can't put that into RE_BlenderFrame,
|
|
|
|
* since sequence rendering can call that recursively... (peter) */
|
2012-08-08 11:56:58 +00:00
|
|
|
BKE_sequencer_cache_cleanup();
|
2010-08-08 16:47:58 +00:00
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
// store spare
|
|
|
|
// get view3d layer, local layer, make this nice api call to render
|
|
|
|
// store spare
|
|
|
|
|
|
|
|
/* ensure at least 1 area shows result */
|
2015-10-07 00:27:27 +11:00
|
|
|
sa = render_view_open(C, event->x, event->y, op->reports);
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-03-29 22:42:32 +00:00
|
|
|
jobflag = WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS;
|
2011-02-07 16:41:57 +00:00
|
|
|
|
2011-10-23 17:52:20 +00:00
|
|
|
/* custom scene and single layer re-render */
|
2017-11-22 10:52:39 -02:00
|
|
|
screen_render_view_layer_set(op, mainp, &scene, &view_layer);
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (RNA_struct_property_is_set(op->ptr, "layer"))
|
2011-02-07 16:41:57 +00:00
|
|
|
jobflag |= WM_JOB_SUSPEND;
|
2010-03-08 16:36:53 +00:00
|
|
|
|
|
|
|
/* job custom data */
|
2012-03-29 22:42:32 +00:00
|
|
|
rj = MEM_callocN(sizeof(RenderJob), "render job");
|
|
|
|
rj->main = mainp;
|
|
|
|
rj->scene = scene;
|
2014-05-02 14:52:19 +02:00
|
|
|
rj->current_scene = rj->scene;
|
2017-11-22 10:52:39 -02:00
|
|
|
rj->view_layer = view_layer;
|
2017-11-03 14:36:49 +01:00
|
|
|
/* TODO(sergey): Render engine should be using own depsgraph. */
|
|
|
|
rj->depsgraph = CTX_data_depsgraph(C);
|
2011-04-30 04:29:36 +00:00
|
|
|
rj->camera_override = camera_override;
|
2013-09-12 12:09:14 +00:00
|
|
|
rj->lay_override = 0;
|
2012-03-29 22:42:32 +00:00
|
|
|
rj->anim = is_animation;
|
|
|
|
rj->write_still = is_write_still && !is_animation;
|
|
|
|
rj->iuser.scene = scene;
|
|
|
|
rj->iuser.ok = 1;
|
|
|
|
rj->reports = op->reports;
|
2013-12-17 23:42:38 +06:00
|
|
|
rj->orig_layer = 0;
|
|
|
|
rj->last_layer = 0;
|
|
|
|
rj->sa = sa;
|
2017-05-08 17:43:32 +02:00
|
|
|
rj->supports_glsl_draw = IMB_colormanagement_support_glsl_draw(&scene->view_settings);
|
2013-12-17 23:42:38 +06:00
|
|
|
|
2014-01-01 16:59:38 +06:00
|
|
|
BKE_color_managed_display_settings_copy(&rj->display_settings, &scene->display_settings);
|
|
|
|
BKE_color_managed_view_settings_copy(&rj->view_settings, &scene->view_settings);
|
|
|
|
|
2013-12-17 23:42:38 +06:00
|
|
|
if (sa) {
|
|
|
|
SpaceImage *sima = sa->spacedata.first;
|
|
|
|
rj->orig_layer = sima->iuser.layer;
|
|
|
|
}
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-12-01 07:58:27 +00:00
|
|
|
if (v3d) {
|
2013-09-12 12:09:14 +00:00
|
|
|
if (scene->lay != v3d->lay) {
|
|
|
|
rj->lay_override = v3d->lay;
|
2013-07-12 16:33:30 +00:00
|
|
|
rj->v3d_override = true;
|
|
|
|
}
|
2013-07-12 20:31:30 +00:00
|
|
|
else if (camera_override && camera_override != scene->camera)
|
2013-07-12 16:33:30 +00:00
|
|
|
rj->v3d_override = true;
|
2012-11-29 19:04:33 +00:00
|
|
|
|
2012-12-01 07:58:27 +00:00
|
|
|
if (v3d->localvd)
|
2013-11-27 20:18:02 +01:00
|
|
|
rj->lay_override |= v3d->localvd->lay;
|
2012-11-29 19:04:33 +00:00
|
|
|
}
|
|
|
|
|
Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
(see below) or values are even possible to run or change.
This prevents any kind of "destructive" action performed
from user while rendering.
- Locks interface refresh for regions which does have lock
set to truth in their template. Currently it's just a 3D
viewport, but in the future more regions could be considered
unsafe, or we could want to lock different parts of
interface when doing different jobs.
This is needed because 3D viewport could be using or changing
the same data as renderer currently uses, leading to threading
conflict.
Notifiers are still allowed to handle, so render progress is
seen on the screen, but would need to doublecheck on this, in
terms some notifiers could be changing the data.
For now interface locking happens for render job only in case
"Lock Interface" checkbox is enabled.
Other tools like backing would also benefit of this option.
It is possible to mark operator as safe to be used in locked
interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
template flags.
This bit is completely handled by wm_evem_system, not
with operator run routines, so it's still possible to
run operators from drivers and handlers.
Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
|
|
|
/* Lock the user interface depending on render settings. */
|
|
|
|
if (scene->r.use_lock_interface) {
|
|
|
|
WM_set_locked_interface(CTX_wm_manager(C), true);
|
|
|
|
|
|
|
|
/* Set flag interface need to be unlocked.
|
|
|
|
*
|
|
|
|
* This is so because we don't have copy of render settings
|
|
|
|
* accessible from render job and copy is needed in case
|
|
|
|
* of non-locked rendering, so we wouldn't try to unlock
|
|
|
|
* anything if option was initially unset but then was
|
|
|
|
* enabled during rendering.
|
|
|
|
*/
|
|
|
|
rj->interface_locked = true;
|
|
|
|
|
|
|
|
/* Clean memory used by viewport? */
|
2017-02-15 14:40:41 +01:00
|
|
|
clean_viewport_memory(rj->main, scene);
|
Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
(see below) or values are even possible to run or change.
This prevents any kind of "destructive" action performed
from user while rendering.
- Locks interface refresh for regions which does have lock
set to truth in their template. Currently it's just a 3D
viewport, but in the future more regions could be considered
unsafe, or we could want to lock different parts of
interface when doing different jobs.
This is needed because 3D viewport could be using or changing
the same data as renderer currently uses, leading to threading
conflict.
Notifiers are still allowed to handle, so render progress is
seen on the screen, but would need to doublecheck on this, in
terms some notifiers could be changing the data.
For now interface locking happens for render job only in case
"Lock Interface" checkbox is enabled.
Other tools like backing would also benefit of this option.
It is possible to mark operator as safe to be used in locked
interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
template flags.
This bit is completely handled by wm_evem_system, not
with operator run routines, so it's still possible to
run operators from drivers and handlers.
Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
|
|
|
}
|
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
/* setup job */
|
2012-03-29 22:42:32 +00:00
|
|
|
if (RE_seq_render_active(scene, &scene->r)) name = "Sequence Render";
|
|
|
|
else name = "Render";
|
2011-11-03 17:06:12 +00:00
|
|
|
|
2012-08-15 10:03:29 +00:00
|
|
|
wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag, WM_JOB_TYPE_RENDER);
|
|
|
|
WM_jobs_customdata_set(wm_job, rj, render_freejob);
|
|
|
|
WM_jobs_timer(wm_job, 0.2, NC_SCENE | ND_RENDER_RESULT, 0);
|
|
|
|
WM_jobs_callbacks(wm_job, render_startjob, NULL, NULL, render_endjob);
|
2010-03-08 16:36:53 +00:00
|
|
|
|
|
|
|
/* get a render result image, and make sure it is empty */
|
2012-03-29 22:42:32 +00:00
|
|
|
ima = BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
|
2010-03-08 16:36:53 +00:00
|
|
|
BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
|
2015-11-30 00:51:30 +01:00
|
|
|
BKE_image_backup_render(rj->scene, ima, true);
|
2012-03-29 22:42:32 +00:00
|
|
|
rj->image = ima;
|
2010-03-08 16:36:53 +00:00
|
|
|
|
|
|
|
/* setup new render */
|
2017-09-12 11:27:22 +05:00
|
|
|
re = RE_NewSceneRender(scene);
|
2010-03-08 16:36:53 +00:00
|
|
|
RE_test_break_cb(re, rj, render_breakjob);
|
2011-03-25 17:11:32 +00:00
|
|
|
RE_draw_lock_cb(re, rj, render_drawlock);
|
2013-12-17 23:42:38 +06:00
|
|
|
RE_display_update_cb(re, rj, image_rect_update);
|
2014-05-02 14:52:19 +02:00
|
|
|
RE_current_scene_update_cb(re, rj, current_scene_update);
|
2010-03-08 16:36:53 +00:00
|
|
|
RE_stats_draw_cb(re, rj, image_renderinfo_cb);
|
2010-05-27 08:22:16 +00:00
|
|
|
RE_progress_cb(re, rj, render_progress_update);
|
2017-04-25 16:18:24 +02:00
|
|
|
RE_SetDepsgraph(re, CTX_data_depsgraph(C));
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-03-29 22:42:32 +00:00
|
|
|
rj->re = re;
|
2014-04-01 11:34:00 +11:00
|
|
|
G.is_break = false;
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-08-01 19:22:04 +00:00
|
|
|
/* store actual owner of job, so modal operator could check for it,
|
|
|
|
* the reason of this is that active scene could change when rendering
|
2012-08-24 23:22:34 +00:00
|
|
|
* several layers from compositor [#31800]
|
2012-08-01 19:22:04 +00:00
|
|
|
*/
|
|
|
|
op->customdata = scene;
|
|
|
|
|
2012-08-15 10:03:29 +00:00
|
|
|
WM_jobs_start(CTX_wm_manager(C), wm_job);
|
2010-03-08 16:36:53 +00:00
|
|
|
|
|
|
|
WM_cursor_wait(0);
|
2012-03-29 22:42:32 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, scene);
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-08-08 18:37:06 +00:00
|
|
|
/* we set G.is_rendering here already instead of only in the job, this ensure
|
2012-03-03 16:31:46 +00:00
|
|
|
* main loop or other scene updates are disabled in time, since they may
|
|
|
|
* have started before the job thread */
|
2014-04-01 11:34:00 +11:00
|
|
|
G.is_rendering = true;
|
2010-04-15 10:28:32 +00:00
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
/* add modal handler for ESC */
|
|
|
|
WM_event_add_modal_handler(C, op);
|
|
|
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* contextual render, using current scene, view3d? */
|
|
|
|
void RENDER_OT_render(wmOperatorType *ot)
|
|
|
|
{
|
2012-11-29 19:04:33 +00:00
|
|
|
PropertyRNA *prop;
|
|
|
|
|
2010-03-08 16:36:53 +00:00
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Render";
|
|
|
|
ot->description = "Render active scene";
|
|
|
|
ot->idname = "RENDER_OT_render";
|
2010-03-08 16:36:53 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->invoke = screen_render_invoke;
|
|
|
|
ot->modal = screen_render_modal;
|
2013-09-23 19:35:21 +00:00
|
|
|
ot->cancel = screen_render_cancel;
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = screen_render_exec;
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
/*ot->poll = ED_operator_screenactive;*/ /* this isn't needed, causes failer in background mode */
|
2010-03-08 16:36:53 +00:00
|
|
|
|
2017-10-29 02:09:57 +13:00
|
|
|
prop = RNA_def_boolean(ot->srna, "animation", 0, "Animation", "Render files from the animation range of this scene");
|
|
|
|
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
2010-11-16 14:40:46 +00:00
|
|
|
RNA_def_boolean(ot->srna, "write_still", 0, "Write Image", "Save rendered the image to the output path (used only when animation is disabled)");
|
2017-10-29 02:09:57 +13:00
|
|
|
prop = RNA_def_boolean(ot->srna, "use_viewport", 0, "Use 3D Viewport", "When inside a 3D viewport, use layers and camera of the viewport");
|
|
|
|
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
2014-01-16 21:43:22 +11:00
|
|
|
prop = RNA_def_string(ot->srna, "layer", NULL, RE_MAXNAME, "Render Layer", "Single render layer to re-render (used only when animation is disabled)");
|
2012-11-29 19:04:33 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
2014-01-16 21:43:22 +11:00
|
|
|
prop = RNA_def_string(ot->srna, "scene", NULL, MAX_ID_NAME - 2, "Scene", "Scene to render, current scene if not specified");
|
2012-11-29 19:04:33 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
2010-03-08 16:36:53 +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
|
|
|
|
|
|
|
/* ************** preview for 3d viewport ***************** */
|
|
|
|
|
|
|
|
#define PR_UPDATE_VIEW 1
|
|
|
|
#define PR_UPDATE_RENDERSIZE 2
|
|
|
|
#define PR_UPDATE_MATERIAL 4
|
2013-07-08 22:26:10 +00:00
|
|
|
#define PR_UPDATE_DATABASE 8
|
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
|
|
|
|
|
|
|
typedef struct RenderPreview {
|
|
|
|
/* from wmJob */
|
|
|
|
void *owner;
|
|
|
|
short *stop, *do_update;
|
2013-07-08 17:56:51 +00:00
|
|
|
wmJob *job;
|
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
|
|
|
|
|
|
|
Scene *scene;
|
2018-01-18 15:58:02 +01:00
|
|
|
Depsgraph *depsgraph;
|
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
|
|
|
ScrArea *sa;
|
|
|
|
ARegion *ar;
|
|
|
|
View3D *v3d;
|
|
|
|
RegionView3D *rv3d;
|
|
|
|
Main *bmain;
|
|
|
|
RenderEngine *engine;
|
|
|
|
|
2013-05-17 11:13:46 +00:00
|
|
|
float viewmat[4][4];
|
2014-06-19 16:21:17 +06:00
|
|
|
|
2014-07-09 19:02:07 +06:00
|
|
|
int start_resolution_divider;
|
2014-06-19 16:21:17 +06:00
|
|
|
int resolution_divider;
|
2014-08-19 19:36:49 +06:00
|
|
|
bool has_freestyle;
|
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
|
|
|
} RenderPreview;
|
|
|
|
|
2018-01-18 15:58:02 +01:00
|
|
|
static int render_view3d_disprect(Scene *scene, const Depsgraph *depsgraph,
|
|
|
|
ARegion *ar, View3D *v3d, RegionView3D *rv3d, rcti *disprect)
|
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
|
|
|
{
|
|
|
|
/* copied code from view3d_draw.c */
|
|
|
|
rctf viewborder;
|
|
|
|
int draw_border;
|
|
|
|
|
|
|
|
if (rv3d->persp == RV3D_CAMOB)
|
|
|
|
draw_border = (scene->r.mode & R_BORDER) != 0;
|
|
|
|
else
|
|
|
|
draw_border = (v3d->flag2 & V3D_RENDER_BORDER) != 0;
|
|
|
|
|
|
|
|
if (draw_border) {
|
|
|
|
if (rv3d->persp == RV3D_CAMOB) {
|
2018-01-18 15:58:02 +01:00
|
|
|
ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &viewborder, false);
|
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
|
|
|
|
|
|
|
disprect->xmin = viewborder.xmin + scene->r.border.xmin * BLI_rctf_size_x(&viewborder);
|
|
|
|
disprect->ymin = viewborder.ymin + scene->r.border.ymin * BLI_rctf_size_y(&viewborder);
|
|
|
|
disprect->xmax = viewborder.xmin + scene->r.border.xmax * BLI_rctf_size_x(&viewborder);
|
|
|
|
disprect->ymax = viewborder.ymin + scene->r.border.ymax * BLI_rctf_size_y(&viewborder);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
disprect->xmin = v3d->render_border.xmin * ar->winx;
|
|
|
|
disprect->xmax = v3d->render_border.xmax * ar->winx;
|
|
|
|
disprect->ymin = v3d->render_border.ymin * ar->winy;
|
|
|
|
disprect->ymax = v3d->render_border.ymax * ar->winy;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
BLI_rcti_init(disprect, 0, 0, 0, 0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-04-17 01:16:23 +00:00
|
|
|
/* returns true if OK */
|
2018-01-18 15:58:02 +01:00
|
|
|
static bool render_view3d_get_rects(
|
|
|
|
const Depsgraph *depsgraph,
|
|
|
|
ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewplane, RenderEngine *engine,
|
|
|
|
float *r_clipsta, float *r_clipend, float *r_pixsize, bool *r_ortho)
|
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-04-17 01:16:23 +00:00
|
|
|
if (ar->winx < 4 || ar->winy < 4) return false;
|
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
|
|
|
|
2018-01-18 15:58:02 +01:00
|
|
|
*r_ortho = ED_view3d_viewplane_get(depsgraph, v3d, rv3d, ar->winx, ar->winy, viewplane, r_clipsta, r_clipend, r_pixsize);
|
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
|
|
|
|
|
|
|
engine->resolution_x = ar->winx;
|
|
|
|
engine->resolution_y = ar->winy;
|
|
|
|
|
2013-04-17 01:16:23 +00:00
|
|
|
return true;
|
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-08-20 18:55:41 +00:00
|
|
|
static bool render_view3d_is_valid(RenderPreview *rp)
|
|
|
|
{
|
|
|
|
return (rp->rv3d->render_engine != NULL);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* called by renderer, checks job value */
|
|
|
|
static int render_view3d_break(void *rpv)
|
|
|
|
{
|
|
|
|
RenderPreview *rp = rpv;
|
|
|
|
|
|
|
|
if (G.is_break)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
/* during render, rv3d->engine can get freed */
|
2013-08-20 18:55:41 +00:00
|
|
|
if (render_view3d_is_valid(rp) == false) {
|
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
|
|
|
*rp->stop = 1;
|
2013-08-20 18:55:41 +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
|
|
|
|
|
|
|
return *(rp->stop);
|
|
|
|
}
|
|
|
|
|
2013-12-17 23:42:38 +06:00
|
|
|
static void render_view3d_display_update(void *rpv, RenderResult *UNUSED(rr), volatile struct rcti *UNUSED(rect))
|
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
|
|
|
{
|
|
|
|
RenderPreview *rp = rpv;
|
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
*(rp->do_update) = true;
|
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_view3d_renderinfo_cb(void *rjp, RenderStats *rs)
|
|
|
|
{
|
|
|
|
RenderPreview *rp = rjp;
|
|
|
|
|
|
|
|
/* during render, rv3d->engine can get freed */
|
2013-07-16 11:42:07 +00:00
|
|
|
if (rp->rv3d->render_engine == NULL) {
|
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
|
|
|
*rp->stop = 1;
|
2013-07-16 11:42:07 +00:00
|
|
|
}
|
2013-07-16 12:22:31 +00:00
|
|
|
else {
|
2014-12-05 21:56:29 +05:00
|
|
|
make_renderinfo_string(rs, rp->scene, false, NULL, rp->engine->text);
|
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
|
|
|
|
|
|
|
/* make jobs timer to send notifier */
|
2014-04-01 11:34:00 +11:00
|
|
|
*(rp->do_update) = true;
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-09 17:57:32 +06:00
|
|
|
BLI_INLINE void rcti_scale_coords(rcti *scaled_rect, const rcti *rect,
|
|
|
|
const float scale)
|
|
|
|
{
|
|
|
|
scaled_rect->xmin = rect->xmin * scale;
|
|
|
|
scaled_rect->ymin = rect->ymin * scale;
|
|
|
|
scaled_rect->xmax = rect->xmax * scale;
|
|
|
|
scaled_rect->ymax = rect->ymax * scale;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void render_update_resolution(Render *re, const RenderPreview *rp,
|
|
|
|
bool use_border, const rcti *clip_rect)
|
|
|
|
{
|
2015-02-11 18:38:41 +11:00
|
|
|
int winx = rp->ar->winx / rp->resolution_divider;
|
|
|
|
int winy = rp->ar->winy / rp->resolution_divider;
|
2014-07-09 17:57:32 +06:00
|
|
|
if (use_border) {
|
|
|
|
rcti scaled_cliprct;
|
|
|
|
rcti_scale_coords(&scaled_cliprct, clip_rect,
|
|
|
|
1.0f / rp->resolution_divider);
|
|
|
|
RE_ChangeResolution(re, winx, winy, &scaled_cliprct);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
RE_ChangeResolution(re, winx, winy, NULL);
|
|
|
|
}
|
2014-08-19 19:36:49 +06:00
|
|
|
|
|
|
|
if (rp->has_freestyle) {
|
2017-08-15 00:11:52 +02:00
|
|
|
if (rp->resolution_divider == BKE_render_preview_pixel_size(&rp->scene->r)) {
|
2014-08-19 19:36:49 +06:00
|
|
|
RE_ChangeModeFlag(re, R_EDGE_FRS, false);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
RE_ChangeModeFlag(re, R_EDGE_FRS, true);
|
|
|
|
}
|
|
|
|
}
|
2014-07-09 17:57:32 +06: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_view3d_startjob(void *customdata, short *stop, short *do_update, float *UNUSED(progress))
|
|
|
|
{
|
|
|
|
RenderPreview *rp = customdata;
|
|
|
|
Render *re;
|
|
|
|
RenderStats *rstats;
|
|
|
|
rctf viewplane;
|
|
|
|
rcti cliprct;
|
2013-05-25 11:52:52 +00:00
|
|
|
float clipsta, clipend, pixsize;
|
2013-04-17 01:16:23 +00:00
|
|
|
bool orth, restore = 0;
|
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
|
|
|
char name[32];
|
2013-07-08 22:26:10 +00:00
|
|
|
int update_flag;
|
2014-08-19 19:36:49 +06:00
|
|
|
bool use_border;
|
Vector Transform node support for GLSL mode and the internal renderer
The Vector Transform node is a useful node which is present in the Cycles renderer.
{F144283}
This patch implements the Vector Transform node for GLSL mode and the internal renderer.
Example: {F273060}
Alexander (Blend4Web Team)
Reviewers: brecht, campbellbarton, sergey
Reviewed By: campbellbarton, sergey
Subscribers: psy-fi, duarteframos, RobM, lightbwk, sergey, AlexKowel, valentin_b4w, Evgeny_Rodygin, yurikovelenov
Projects: #bf_blender:_next
Differential Revision: https://developer.blender.org/D909
2016-01-23 15:27:36 +03:00
|
|
|
int ob_inst_update_flag = 0;
|
2013-07-08 22:26:10 +00:00
|
|
|
|
|
|
|
update_flag = rp->engine->job_update_flag;
|
|
|
|
rp->engine->job_update_flag = 0;
|
|
|
|
|
|
|
|
//printf("ma %d res %d view %d db %d\n", update_flag & PR_UPDATE_MATERIAL, update_flag & PR_UPDATE_RENDERSIZE, update_flag & PR_UPDATE_VIEW, update_flag & PR_UPDATE_DATABASE);
|
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
G.is_break = false;
|
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
|
|
|
|
2018-01-18 15:58:02 +01:00
|
|
|
if (false == render_view3d_get_rects(rp->depsgraph, rp->ar, rp->v3d, rp->rv3d, &viewplane, rp->engine, &clipsta, &clipend, &pixsize, &orth))
|
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
|
|
|
return;
|
|
|
|
|
|
|
|
rp->stop = stop;
|
|
|
|
rp->do_update = do_update;
|
|
|
|
|
2013-05-17 11:13:46 +00:00
|
|
|
// printf("Enter previewrender\n");
|
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
|
|
|
|
|
|
|
/* ok, are we rendering all over? */
|
|
|
|
sprintf(name, "View3dPreview %p", (void *)rp->ar);
|
2013-04-17 01:16:23 +00:00
|
|
|
re = rp->engine->re = RE_GetRender(name);
|
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
|
|
|
|
|
|
|
/* set this always, rp is different for each job */
|
|
|
|
RE_test_break_cb(re, rp, render_view3d_break);
|
2013-12-17 23:42:38 +06:00
|
|
|
RE_display_update_cb(re, rp, render_view3d_display_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
|
|
|
RE_stats_draw_cb(re, rp, render_view3d_renderinfo_cb);
|
|
|
|
|
2013-04-17 01:16:23 +00:00
|
|
|
rstats = RE_GetStats(re);
|
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
|
|
|
|
2014-06-19 16:21:17 +06:00
|
|
|
if (update_flag & PR_UPDATE_VIEW) {
|
2014-08-13 00:32:04 +06:00
|
|
|
Object *object;
|
2014-07-09 19:02:07 +06:00
|
|
|
rp->resolution_divider = rp->start_resolution_divider;
|
2014-08-13 00:32:04 +06:00
|
|
|
|
|
|
|
/* Same as database_init_objects(), loop over all objects.
|
|
|
|
* We might consider de-duplicating the code between this two cases.
|
|
|
|
*/
|
|
|
|
for (object = rp->bmain->object.first; object; object = object->id.next) {
|
|
|
|
float mat[4][4];
|
|
|
|
mul_m4_m4m4(mat, rp->viewmat, object->obmat);
|
|
|
|
invert_m4_m4(object->imat_ren, mat);
|
2014-08-17 12:18:40 +10:00
|
|
|
}
|
2014-06-19 16:21:17 +06:00
|
|
|
}
|
|
|
|
|
2018-01-18 15:58:02 +01:00
|
|
|
use_border = render_view3d_disprect(rp->scene, rp->depsgraph,
|
|
|
|
rp->ar, rp->v3d, rp->rv3d,
|
|
|
|
&cliprct);
|
2014-07-09 17:57:32 +06:00
|
|
|
|
2017-07-25 01:35:33 +02:00
|
|
|
if ((update_flag & (PR_UPDATE_RENDERSIZE | PR_UPDATE_DATABASE | PR_UPDATE_VIEW)) || rstats->convertdone == 0) {
|
2014-06-19 16:21:17 +06:00
|
|
|
RenderData rdata;
|
|
|
|
|
2015-04-10 13:16:05 +02:00
|
|
|
/* no osa, blur, seq, layers, savebuffer etc for preview 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
|
|
|
rdata = rp->scene->r;
|
|
|
|
rdata.mode &= ~(R_OSA | R_MBLUR | R_BORDER | R_PANORAMA);
|
2015-04-10 13:16:05 +02:00
|
|
|
rdata.scemode &= ~(R_DOSEQ | R_DOCOMP | R_FREE_IMAGE | R_EXR_TILE_FILE | R_FULL_SAMPLE);
|
2013-05-15 17:09:45 +00:00
|
|
|
rdata.scemode |= R_VIEWPORT_PREVIEW;
|
2014-06-19 16:21:17 +06: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
|
|
|
/* we do use layers, but only active */
|
|
|
|
rdata.scemode |= R_SINGLE_LAYER;
|
|
|
|
|
|
|
|
/* initalize always */
|
2014-07-09 17:57:32 +06:00
|
|
|
if (use_border) {
|
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
|
|
|
rdata.mode |= R_BORDER;
|
2017-11-22 10:52:39 -02:00
|
|
|
RE_InitState(re, NULL, &rdata, &rp->scene->view_layers, rp->scene->active_view_layer, &rp->scene->view_render, NULL, rp->ar->winx, rp->ar->winy, &cliprct);
|
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
|
|
|
}
|
|
|
|
else
|
2017-11-22 10:52:39 -02:00
|
|
|
RE_InitState(re, NULL, &rdata, &rp->scene->view_layers, rp->scene->active_view_layer, &rp->scene->view_render, NULL, rp->ar->winx, rp->ar->winy, NULL);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
if (orth)
|
|
|
|
RE_SetOrtho(re, &viewplane, clipsta, clipend);
|
|
|
|
else
|
|
|
|
RE_SetWindow(re, &viewplane, clipsta, clipend);
|
|
|
|
|
2013-05-25 11:52:52 +00:00
|
|
|
RE_SetPixelSize(re, pixsize);
|
|
|
|
|
2013-07-08 22:26:10 +00:00
|
|
|
if ((update_flag & PR_UPDATE_DATABASE) || rstats->convertdone == 0) {
|
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
|
|
|
unsigned int lay = rp->scene->lay;
|
|
|
|
|
|
|
|
/* allow localview render for objects with lights in normal layers */
|
|
|
|
if (rp->v3d->lay & 0xFF000000)
|
|
|
|
lay |= rp->v3d->lay;
|
|
|
|
else lay = rp->v3d->lay;
|
|
|
|
|
2013-05-17 11:13:46 +00:00
|
|
|
RE_SetView(re, rp->viewmat);
|
2013-07-08 17:56:51 +00:00
|
|
|
|
|
|
|
/* copying blender data while main thread is locked, to avoid crashes */
|
|
|
|
WM_job_main_thread_lock_acquire(rp->job);
|
2013-07-08 22:26:10 +00:00
|
|
|
RE_Database_Free(re);
|
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
|
|
|
RE_Database_FromScene(re, rp->bmain, rp->scene, lay, 0); // 0= dont use camera view
|
2013-07-08 17:56:51 +00:00
|
|
|
WM_job_main_thread_lock_release(rp->job);
|
|
|
|
|
|
|
|
/* do preprocessing like building raytree, shadows, volumes, SSS */
|
|
|
|
RE_Database_Preprocess(re);
|
|
|
|
|
2013-07-08 22:26:10 +00:00
|
|
|
/* conversion not completed, need to do it again */
|
2013-08-20 18:55:41 +00:00
|
|
|
if (!rstats->convertdone) {
|
|
|
|
if (render_view3d_is_valid(rp)) {
|
|
|
|
rp->engine->job_update_flag |= PR_UPDATE_DATABASE;
|
|
|
|
}
|
|
|
|
}
|
2013-07-08 22:26:10 +00:00
|
|
|
|
2013-05-17 11:13:46 +00:00
|
|
|
// printf("dbase update\n");
|
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
|
|
|
}
|
|
|
|
else {
|
2013-05-17 11:13:46 +00:00
|
|
|
// printf("dbase rotate\n");
|
|
|
|
RE_DataBase_IncrementalView(re, rp->viewmat, 0);
|
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
|
|
|
restore = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
RE_DataBase_ApplyWindow(re);
|
|
|
|
|
|
|
|
/* OK, can we enter render code? */
|
|
|
|
if (rstats->convertdone) {
|
2014-07-09 17:57:32 +06:00
|
|
|
bool first_time = true;
|
Vector Transform node support for GLSL mode and the internal renderer
The Vector Transform node is a useful node which is present in the Cycles renderer.
{F144283}
This patch implements the Vector Transform node for GLSL mode and the internal renderer.
Example: {F273060}
Alexander (Blend4Web Team)
Reviewers: brecht, campbellbarton, sergey
Reviewed By: campbellbarton, sergey
Subscribers: psy-fi, duarteframos, RobM, lightbwk, sergey, AlexKowel, valentin_b4w, Evgeny_Rodygin, yurikovelenov
Projects: #bf_blender:_next
Differential Revision: https://developer.blender.org/D909
2016-01-23 15:27:36 +03:00
|
|
|
|
|
|
|
if (update_flag & PR_UPDATE_VIEW) {
|
|
|
|
ob_inst_update_flag |= RE_OBJECT_INSTANCES_UPDATE_VIEW;
|
|
|
|
}
|
|
|
|
|
|
|
|
RE_updateRenderInstances(re, ob_inst_update_flag);
|
|
|
|
|
2014-06-19 16:21:17 +06:00
|
|
|
for (;;) {
|
2017-08-15 00:11:52 +02:00
|
|
|
int pixel_size = BKE_render_preview_pixel_size(&rp->scene->r);
|
2014-07-09 17:57:32 +06:00
|
|
|
if (first_time == false) {
|
|
|
|
if (restore)
|
|
|
|
RE_DataBase_IncrementalView(re, rp->viewmat, 1);
|
2014-06-19 16:21:17 +06:00
|
|
|
|
2017-10-06 16:56:41 +11:00
|
|
|
rp->resolution_divider = MAX2(rp->resolution_divider / 2, pixel_size);
|
2014-06-19 16:21:17 +06:00
|
|
|
*do_update = 1;
|
|
|
|
|
2014-07-09 17:57:32 +06:00
|
|
|
render_update_resolution(re, rp, use_border, &cliprct);
|
|
|
|
|
|
|
|
RE_DataBase_IncrementalView(re, rp->viewmat, 0);
|
|
|
|
RE_DataBase_ApplyWindow(re);
|
|
|
|
restore = 1;
|
2014-06-19 16:21:17 +06:00
|
|
|
}
|
|
|
|
else {
|
2014-07-09 17:57:32 +06:00
|
|
|
render_update_resolution(re, rp, use_border, &cliprct);
|
|
|
|
}
|
|
|
|
|
|
|
|
RE_TileProcessor(re);
|
|
|
|
|
|
|
|
first_time = false;
|
|
|
|
|
2017-08-15 00:11:52 +02:00
|
|
|
if (*stop || rp->resolution_divider == pixel_size) {
|
2014-06-19 16:21:17 +06:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-17 11:13:46 +00:00
|
|
|
/* always rotate back */
|
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
|
|
|
if (restore)
|
2013-05-17 11:13:46 +00:00
|
|
|
RE_DataBase_IncrementalView(re, rp->viewmat, 1);
|
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_view3d_free(void *customdata)
|
|
|
|
{
|
|
|
|
RenderPreview *rp = customdata;
|
|
|
|
|
|
|
|
MEM_freeN(rp);
|
|
|
|
}
|
|
|
|
|
2013-07-08 22:26:10 +00:00
|
|
|
static bool render_view3d_flag_changed(RenderEngine *engine, const bContext *C)
|
|
|
|
{
|
|
|
|
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
|
|
|
View3D *v3d = CTX_wm_view3d(C);
|
|
|
|
ARegion *ar = CTX_wm_region(C);
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
2018-01-18 15:58:02 +01:00
|
|
|
Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
2013-07-08 22:26:10 +00:00
|
|
|
Render *re;
|
|
|
|
rctf viewplane;
|
|
|
|
rcti disprect;
|
|
|
|
float clipsta, clipend;
|
|
|
|
bool orth;
|
|
|
|
int job_update_flag = 0;
|
|
|
|
char name[32];
|
|
|
|
|
|
|
|
/* ensure render engine exists */
|
|
|
|
re = engine->re;
|
|
|
|
|
|
|
|
if (!re) {
|
|
|
|
sprintf(name, "View3dPreview %p", (void *)ar);
|
|
|
|
re = engine->re = RE_GetRender(name);
|
|
|
|
if (!re)
|
|
|
|
re = engine->re = RE_NewRender(name);
|
|
|
|
|
|
|
|
engine->update_flag |= RE_ENGINE_UPDATE_DATABASE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check update_flag */
|
|
|
|
if (engine->update_flag & RE_ENGINE_UPDATE_MA)
|
|
|
|
job_update_flag |= PR_UPDATE_MATERIAL;
|
|
|
|
|
|
|
|
if (engine->update_flag & RE_ENGINE_UPDATE_OTHER)
|
|
|
|
job_update_flag |= PR_UPDATE_MATERIAL;
|
|
|
|
|
2013-07-08 22:41:14 +00:00
|
|
|
if (engine->update_flag & RE_ENGINE_UPDATE_DATABASE) {
|
2013-07-08 22:26:10 +00:00
|
|
|
job_update_flag |= PR_UPDATE_DATABASE;
|
2013-07-08 22:41:14 +00:00
|
|
|
|
|
|
|
/* load editmesh */
|
|
|
|
if (scene->obedit)
|
|
|
|
ED_object_editmode_load(scene->obedit);
|
|
|
|
}
|
2013-07-08 22:26:10 +00:00
|
|
|
|
|
|
|
engine->update_flag = 0;
|
|
|
|
|
|
|
|
/* check if viewport changed */
|
|
|
|
if (engine->last_winx != ar->winx || engine->last_winy != ar->winy) {
|
|
|
|
engine->last_winx = ar->winx;
|
|
|
|
engine->last_winy = ar->winy;
|
|
|
|
job_update_flag |= PR_UPDATE_RENDERSIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (compare_m4m4(engine->last_viewmat, rv3d->viewmat, 0.00001f) == 0) {
|
|
|
|
copy_m4_m4(engine->last_viewmat, rv3d->viewmat);
|
|
|
|
job_update_flag |= PR_UPDATE_VIEW;
|
|
|
|
}
|
|
|
|
|
2018-01-18 15:58:02 +01:00
|
|
|
render_view3d_get_rects(depsgraph, ar, v3d, rv3d, &viewplane, engine, &clipsta, &clipend, NULL, &orth);
|
2013-07-08 22:26:10 +00:00
|
|
|
|
|
|
|
if (BLI_rctf_compare(&viewplane, &engine->last_viewplane, 0.00001f) == 0) {
|
|
|
|
engine->last_viewplane = viewplane;
|
|
|
|
job_update_flag |= PR_UPDATE_VIEW;
|
|
|
|
}
|
|
|
|
|
2018-01-18 15:58:02 +01:00
|
|
|
render_view3d_disprect(scene, depsgraph, ar, v3d, rv3d, &disprect);
|
2013-07-08 22:26:10 +00:00
|
|
|
if (BLI_rcti_compare(&disprect, &engine->last_disprect) == 0) {
|
|
|
|
engine->last_disprect = disprect;
|
|
|
|
job_update_flag |= PR_UPDATE_RENDERSIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* any changes? go ahead and rerender */
|
|
|
|
if (job_update_flag) {
|
|
|
|
engine->job_update_flag |= job_update_flag;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void render_view3d_do(RenderEngine *engine, const bContext *C)
|
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
|
|
|
{
|
|
|
|
wmJob *wm_job;
|
|
|
|
RenderPreview *rp;
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
2018-01-18 15:58:02 +01:00
|
|
|
Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
2014-07-09 19:02:07 +06:00
|
|
|
ARegion *ar = CTX_wm_region(C);
|
|
|
|
int width = ar->winx, height = ar->winy;
|
2017-08-15 00:11:52 +02:00
|
|
|
int divider = BKE_render_preview_pixel_size(&scene->r);
|
2014-07-09 19:02:07 +06:00
|
|
|
int resolution_threshold = scene->r.preview_start_resolution *
|
|
|
|
scene->r.preview_start_resolution;
|
|
|
|
|
2013-07-08 22:26:10 +00:00
|
|
|
if (CTX_wm_window(C) == NULL)
|
|
|
|
return;
|
|
|
|
if (!render_view3d_flag_changed(engine, C))
|
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
|
|
|
return;
|
|
|
|
|
|
|
|
wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), CTX_wm_region(C), "Render Preview",
|
2013-04-17 01:16:23 +00:00
|
|
|
WM_JOB_EXCL_RENDER, WM_JOB_TYPE_RENDER_PREVIEW);
|
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
|
|
|
rp = MEM_callocN(sizeof(RenderPreview), "render preview");
|
2013-07-08 17:56:51 +00:00
|
|
|
rp->job = wm_job;
|
|
|
|
|
2014-07-09 19:02:07 +06:00
|
|
|
while (width * height > resolution_threshold) {
|
|
|
|
width = max_ii(1, width / 2);
|
|
|
|
height = max_ii(1, height / 2);
|
|
|
|
divider *= 2;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* customdata for preview thread */
|
|
|
|
rp->scene = scene;
|
2018-01-18 15:58:02 +01:00
|
|
|
rp->depsgraph = depsgraph;
|
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
|
|
|
rp->engine = engine;
|
|
|
|
rp->sa = CTX_wm_area(C);
|
|
|
|
rp->ar = CTX_wm_region(C);
|
|
|
|
rp->v3d = rp->sa->spacedata.first;
|
|
|
|
rp->rv3d = CTX_wm_region_view3d(C);
|
|
|
|
rp->bmain = CTX_data_main(C);
|
2014-07-09 19:02:07 +06:00
|
|
|
rp->resolution_divider = divider;
|
|
|
|
rp->start_resolution_divider = divider;
|
2015-01-08 14:42:15 +05:00
|
|
|
rp->has_freestyle = (scene->r.mode & R_EDGE_FRS) != 0;
|
2013-05-17 11:13:46 +00:00
|
|
|
copy_m4_m4(rp->viewmat, rp->rv3d->viewmat);
|
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-12 20:31:30 +00:00
|
|
|
/* clear info text */
|
|
|
|
engine->text[0] = '\0';
|
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
|
|
|
|
|
|
|
/* setup job */
|
|
|
|
WM_jobs_customdata_set(wm_job, rp, render_view3d_free);
|
2013-04-17 01:16:23 +00:00
|
|
|
WM_jobs_timer(wm_job, 0.1, NC_SPACE | ND_SPACE_VIEW3D, NC_SPACE | ND_SPACE_VIEW3D);
|
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
|
|
|
WM_jobs_callbacks(wm_job, render_view3d_startjob, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
WM_jobs_start(CTX_wm_manager(C), wm_job);
|
|
|
|
|
|
|
|
engine->flag &= ~RE_ENGINE_DO_UPDATE;
|
|
|
|
}
|
|
|
|
|
2015-02-11 18:38:41 +11:00
|
|
|
/* callback for render engine, on changes */
|
2013-07-08 22:26:10 +00:00
|
|
|
void render_view3d_update(RenderEngine *engine, const bContext *C)
|
2013-05-17 16:46:59 +00:00
|
|
|
{
|
2013-07-08 22:26:10 +00:00
|
|
|
/* this shouldn't be needed and causes too many database rebuilds, but we
|
2016-07-16 17:48:57 +10:00
|
|
|
* aren't actually tracking updates for all relevant datablocks so this is
|
2013-07-08 22:26:10 +00:00
|
|
|
* a catch-all for updates */
|
|
|
|
engine->update_flag |= RE_ENGINE_UPDATE_DATABASE;
|
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
|
|
|
render_view3d_do(engine, C);
|
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 render_view3d_draw(RenderEngine *engine, const bContext *C)
|
|
|
|
{
|
|
|
|
Render *re = engine->re;
|
|
|
|
RenderResult rres;
|
2013-07-08 22:26:10 +00:00
|
|
|
char name[32];
|
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
|
|
|
render_view3d_do(engine, C);
|
|
|
|
|
|
|
|
if (re == NULL) {
|
|
|
|
sprintf(name, "View3dPreview %p", (void *)CTX_wm_region(C));
|
|
|
|
re = RE_GetRender(name);
|
|
|
|
|
|
|
|
if (re == NULL) return;
|
|
|
|
}
|
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
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
/* Viewport render preview doesn't support multiview, view hardcoded to 0 */
|
|
|
|
RE_AcquireResultImage(re, &rres, 0);
|
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
|
|
|
|
|
|
|
if (rres.rectf) {
|
2014-07-09 17:57:32 +06:00
|
|
|
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
|
|
|
View3D *v3d = CTX_wm_view3d(C);
|
2013-05-12 19:01:23 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2018-01-18 15:58:02 +01:00
|
|
|
Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
2014-06-19 16:21:17 +06:00
|
|
|
ARegion *ar = CTX_wm_region(C);
|
2013-05-12 19:01:23 +00:00
|
|
|
bool force_fallback = false;
|
|
|
|
bool need_fallback = true;
|
|
|
|
float dither = scene->r.dither_intensity;
|
2014-07-09 17:57:32 +06:00
|
|
|
float scale_x, scale_y;
|
|
|
|
rcti clip_rect;
|
|
|
|
int xof, yof;
|
|
|
|
|
2018-01-18 15:58:02 +01:00
|
|
|
if (render_view3d_disprect(scene, depsgraph, ar, v3d, rv3d, &clip_rect)) {
|
2014-07-09 17:57:32 +06:00
|
|
|
scale_x = (float) BLI_rcti_size_x(&clip_rect) / rres.rectx;
|
|
|
|
scale_y = (float) BLI_rcti_size_y(&clip_rect) / rres.recty;
|
|
|
|
xof = clip_rect.xmin;
|
|
|
|
yof = clip_rect.ymin;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
scale_x = (float) ar->winx / rres.rectx;
|
|
|
|
scale_y = (float) ar->winy / rres.recty;
|
|
|
|
xof = rres.xof;
|
|
|
|
yof = rres.yof;
|
|
|
|
}
|
2013-05-12 19:01:23 +00:00
|
|
|
|
|
|
|
/* If user decided not to use GLSL, fallback to glaDrawPixelsAuto */
|
|
|
|
force_fallback |= (U.image_draw_method != IMAGE_DRAW_METHOD_GLSL);
|
|
|
|
|
|
|
|
/* Try using GLSL display transform. */
|
|
|
|
if (force_fallback == false) {
|
2014-06-20 18:10:32 +06:00
|
|
|
if (IMB_colormanagement_setup_glsl_draw(&scene->view_settings, &scene->display_settings, dither, true)) {
|
2013-05-12 19:01:23 +00:00
|
|
|
glEnable(GL_BLEND);
|
2017-04-11 16:30:00 +02:00
|
|
|
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
|
|
|
|
immDrawPixelsTex(&state, xof, yof, rres.rectx, rres.recty,
|
2017-02-24 01:16:33 +01:00
|
|
|
GL_RGBA, GL_FLOAT, GL_NEAREST, rres.rectf,
|
|
|
|
scale_x, scale_y, NULL);;
|
2013-05-12 19:01:23 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
|
|
IMB_colormanagement_finish_glsl_draw();
|
|
|
|
need_fallback = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If GLSL failed, use old-school CPU-based transform. */
|
|
|
|
if (need_fallback) {
|
|
|
|
unsigned char *display_buffer = MEM_mallocN(4 * rres.rectx * rres.recty * sizeof(char),
|
|
|
|
"render_view3d_draw");
|
|
|
|
|
|
|
|
IMB_colormanagement_buffer_make_display_space(rres.rectf, display_buffer, rres.rectx, rres.recty,
|
2013-10-01 15:34:43 +00:00
|
|
|
4, dither, &scene->view_settings, &scene->display_settings);
|
2013-05-12 19:01:23 +00:00
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
2017-04-11 16:30:00 +02:00
|
|
|
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
|
|
|
|
immDrawPixelsTex(&state, xof, yof, rres.rectx, rres.recty,
|
2017-02-24 01:16:33 +01:00
|
|
|
GL_RGBA, GL_UNSIGNED_BYTE,
|
|
|
|
GL_NEAREST, display_buffer,
|
|
|
|
scale_x, scale_y, NULL);
|
2013-05-12 19:01:23 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
|
|
MEM_freeN(display_buffer);
|
|
|
|
}
|
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-04-17 14:47:52 +00:00
|
|
|
|
|
|
|
RE_ReleaseResultImage(re);
|
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
|
|
|
|
2014-11-18 15:51:31 +01:00
|
|
|
void ED_viewport_render_kill_jobs(wmWindowManager *wm,
|
|
|
|
Main *bmain,
|
|
|
|
bool free_database)
|
2013-07-08 22:26:10 +00:00
|
|
|
{
|
|
|
|
bScreen *sc;
|
|
|
|
ScrArea *sa;
|
|
|
|
ARegion *ar;
|
|
|
|
|
|
|
|
if (!wm)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* kill all actively running jobs */
|
|
|
|
WM_jobs_kill(wm, NULL, render_view3d_startjob);
|
|
|
|
|
|
|
|
/* loop over 3D view render engines */
|
|
|
|
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) {
|
|
|
|
/* free render database now before we change data, because
|
|
|
|
* RE_Database_Free will also loop over blender data */
|
2013-07-10 01:05:56 +00:00
|
|
|
if (free_database) {
|
|
|
|
char name[32];
|
|
|
|
Render *re;
|
|
|
|
|
|
|
|
sprintf(name, "View3dPreview %p", (void *)ar);
|
|
|
|
re = RE_GetRender(name);
|
|
|
|
|
|
|
|
if (re)
|
|
|
|
RE_Database_Free(re);
|
|
|
|
|
|
|
|
/* tag render engine to update entire database */
|
|
|
|
rv3d->render_engine->update_flag |= RE_ENGINE_UPDATE_DATABASE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* quick shader update */
|
|
|
|
rv3d->render_engine->update_flag |= RE_ENGINE_UPDATE_MA;
|
|
|
|
}
|
2013-07-08 22:26:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-31 17:20:31 +00:00
|
|
|
Scene *ED_render_job_get_scene(const bContext *C)
|
|
|
|
{
|
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
RenderJob *rj = (RenderJob *)WM_jobs_customdata_from_type(wm, WM_JOB_TYPE_RENDER);
|
|
|
|
|
|
|
|
if (rj)
|
2015-03-11 00:01:53 +05:00
|
|
|
return rj->scene;
|
2013-10-31 17:20:31 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2015-03-11 00:01:53 +05:00
|
|
|
|
|
|
|
Scene *ED_render_job_get_current_scene(const bContext *C)
|
|
|
|
{
|
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
RenderJob *rj = (RenderJob *)WM_jobs_customdata_from_type(wm, WM_JOB_TYPE_RENDER);
|
|
|
|
if (rj) {
|
|
|
|
return rj->current_scene;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2015-10-27 19:00:51 +05:00
|
|
|
|
|
|
|
/* Motion blur curve preset */
|
|
|
|
|
|
|
|
static int render_shutter_curve_preset_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
CurveMapping *mblur_shutter_curve = &scene->r.mblur_shutter_curve;
|
|
|
|
CurveMap *cm = mblur_shutter_curve->cm;
|
|
|
|
int preset = RNA_enum_get(op->ptr, "shape");
|
|
|
|
|
|
|
|
cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
|
|
|
|
mblur_shutter_curve->preset = preset;
|
|
|
|
curvemap_reset(cm,
|
|
|
|
&mblur_shutter_curve->clipr,
|
|
|
|
mblur_shutter_curve->preset,
|
|
|
|
CURVEMAP_SLOPE_POS_NEG);
|
|
|
|
curvemapping_changed(mblur_shutter_curve, false);
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void RENDER_OT_shutter_curve_preset(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
PropertyRNA *prop;
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem prop_shape_items[] = {
|
2015-10-27 19:00:51 +05:00
|
|
|
{CURVE_PRESET_SHARP, "SHARP", 0, "Sharp", ""},
|
|
|
|
{CURVE_PRESET_SMOOTH, "SMOOTH", 0, "Smooth", ""},
|
|
|
|
{CURVE_PRESET_MAX, "MAX", 0, "Max", ""},
|
|
|
|
{CURVE_PRESET_LINE, "LINE", 0, "Line", ""},
|
|
|
|
{CURVE_PRESET_ROUND, "ROUND", 0, "Round", ""},
|
|
|
|
{CURVE_PRESET_ROOT, "ROOT", 0, "Root", ""},
|
|
|
|
{0, NULL, 0, NULL, NULL}};
|
|
|
|
|
|
|
|
ot->name = "Shutter Curve Preset";
|
|
|
|
ot->description = "Set shutter curve";
|
|
|
|
ot->idname = "RENDER_OT_shutter_curve_preset";
|
|
|
|
|
|
|
|
ot->exec = render_shutter_curve_preset_exec;
|
|
|
|
|
|
|
|
prop = RNA_def_enum(ot->srna, "shape", prop_shape_items, CURVE_PRESET_SMOOTH, "Mode", "");
|
|
|
|
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
|
|
|
|
}
|