Render: move editor/render module to c++
Doing this in preparation for some work on asset preview generation. Differential Revision: https://developer.blender.org/D13676
This commit is contained in:
parent
644e6c7a3e
commit
1c9d8fcb47
|
@ -282,8 +282,9 @@ bool CTX_data_dir(const char *member);
|
|||
ListBase ctx_data_list; \
|
||||
CollectionPointerLink *ctx_link; \
|
||||
CTX_data_##member(C, &ctx_data_list); \
|
||||
for (ctx_link = ctx_data_list.first; ctx_link; ctx_link = ctx_link->next) { \
|
||||
Type instance = ctx_link->ptr.data;
|
||||
for (ctx_link = (CollectionPointerLink *)ctx_data_list.first; ctx_link; \
|
||||
ctx_link = ctx_link->next) { \
|
||||
Type instance = (Type)ctx_link->ptr.data;
|
||||
|
||||
#define CTX_DATA_END \
|
||||
} \
|
||||
|
|
|
@ -33,6 +33,10 @@ struct Scene;
|
|||
struct SceneEEVEE;
|
||||
struct ViewLayer;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Light Bake.
|
||||
*/
|
||||
|
@ -77,3 +81,7 @@ void EEVEE_lightcache_info_update(struct SceneEEVEE *eevee);
|
|||
|
||||
void EEVEE_lightcache_blend_write(struct BlendWriter *writer, struct LightCache *cache);
|
||||
void EEVEE_lightcache_blend_read_data(struct BlendDataReader *reader, struct LightCache *cache);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "DNA_ID_enums.h"
|
||||
#include "DNA_vec_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -41,7 +42,6 @@ struct bContext;
|
|||
struct bScreen;
|
||||
struct wmWindow;
|
||||
struct wmWindowManager;
|
||||
enum eIconSizes;
|
||||
|
||||
/* render_ops.c */
|
||||
|
||||
|
@ -100,7 +100,7 @@ void ED_preview_shader_job(const struct bContext *C,
|
|||
struct MTex *slot,
|
||||
int sizex,
|
||||
int sizey,
|
||||
int method);
|
||||
ePreviewRenderMethod method);
|
||||
void ED_preview_icon_render(const struct bContext *C,
|
||||
struct Scene *scene,
|
||||
struct ID *id,
|
||||
|
|
|
@ -36,15 +36,15 @@ set(INC
|
|||
)
|
||||
|
||||
set(SRC
|
||||
render_internal.c
|
||||
render_opengl.c
|
||||
render_ops.c
|
||||
render_preview.c
|
||||
render_shading.c
|
||||
render_update.c
|
||||
render_view.c
|
||||
render_internal.cc
|
||||
render_opengl.cc
|
||||
render_ops.cc
|
||||
render_preview.cc
|
||||
render_shading.cc
|
||||
render_update.cc
|
||||
render_view.cc
|
||||
|
||||
render_intern.h
|
||||
render_intern.hh
|
||||
)
|
||||
|
||||
set(LIB
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
|
||||
#include "SEQ_relations.h"
|
||||
|
||||
#include "render_intern.h"
|
||||
#include "render_intern.hh"
|
||||
|
||||
/* Render Callbacks */
|
||||
static int render_break(void *rjv);
|
||||
|
@ -384,7 +384,7 @@ static int screen_render_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static void render_freejob(void *rjv)
|
||||
{
|
||||
RenderJob *rj = rjv;
|
||||
RenderJob *rj = static_cast<RenderJob *>(rjv);
|
||||
|
||||
BKE_color_managed_view_settings_free(&rj->view_settings);
|
||||
MEM_freeN(rj);
|
||||
|
@ -472,7 +472,7 @@ static void make_renderinfo_string(const RenderStats *rs,
|
|||
|
||||
static void image_renderinfo_cb(void *rjv, RenderStats *rs)
|
||||
{
|
||||
RenderJob *rj = rjv;
|
||||
RenderJob *rj = static_cast<RenderJob *>(rjv);
|
||||
RenderResult *rr;
|
||||
|
||||
rr = RE_AcquireResultRead(rj->re);
|
||||
|
@ -480,7 +480,7 @@ static void image_renderinfo_cb(void *rjv, RenderStats *rs)
|
|||
if (rr) {
|
||||
/* malloc OK here, stats_draw is not in tile threads */
|
||||
if (rr->text == NULL) {
|
||||
rr->text = MEM_callocN(IMA_MAX_RENDER_TEXT, "rendertext");
|
||||
rr->text = static_cast<char *>(MEM_callocN(IMA_MAX_RENDER_TEXT, "rendertext"));
|
||||
}
|
||||
|
||||
make_renderinfo_string(rs, rj->scene, rj->v3d_override, rr->error, rr->text);
|
||||
|
@ -494,7 +494,7 @@ static void image_renderinfo_cb(void *rjv, RenderStats *rs)
|
|||
|
||||
static void render_progress_update(void *rjv, float progress)
|
||||
{
|
||||
RenderJob *rj = rjv;
|
||||
RenderJob *rj = static_cast<RenderJob *>(rjv);
|
||||
|
||||
if (rj->progress && *rj->progress != progress) {
|
||||
*rj->progress = progress;
|
||||
|
@ -515,14 +515,16 @@ static void render_image_update_pass_and_layer(RenderJob *rj, RenderResult *rr,
|
|||
ScrArea *first_area = NULL, *matched_area = NULL;
|
||||
|
||||
/* image window, compo node users */
|
||||
for (wm = rj->main->wm.first; wm && matched_area == NULL; wm = wm->id.next) { /* only 1 wm */
|
||||
for (wm = static_cast<wmWindowManager *>(rj->main->wm.first); wm && matched_area == NULL;
|
||||
wm = static_cast<wmWindowManager *>(wm->id.next)) { /* only 1 wm */
|
||||
wmWindow *win;
|
||||
for (win = wm->windows.first; win && matched_area == NULL; win = win->next) {
|
||||
for (win = static_cast<wmWindow *>(wm->windows.first); win && matched_area == NULL;
|
||||
win = win->next) {
|
||||
const bScreen *screen = WM_window_get_active_screen(win);
|
||||
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
if (area->spacetype == SPACE_IMAGE) {
|
||||
SpaceImage *sima = area->spacedata.first;
|
||||
SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
|
||||
/* area->spacedata might be empty when toggling full-screen mode. */
|
||||
if (sima != NULL && sima->image == rj->image) {
|
||||
if (first_area == NULL) {
|
||||
|
@ -543,7 +545,7 @@ static void render_image_update_pass_and_layer(RenderJob *rj, RenderResult *rr,
|
|||
}
|
||||
|
||||
if (matched_area) {
|
||||
SpaceImage *sima = matched_area->spacedata.first;
|
||||
SpaceImage *sima = static_cast<SpaceImage *>(matched_area->spacedata.first);
|
||||
RenderResult *main_rr = RE_AcquireResultRead(rj->re);
|
||||
|
||||
/* TODO(sergey): is there faster way to get the layer index? */
|
||||
|
@ -563,7 +565,7 @@ static void render_image_update_pass_and_layer(RenderJob *rj, RenderResult *rr,
|
|||
|
||||
static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrect)
|
||||
{
|
||||
RenderJob *rj = rjv;
|
||||
RenderJob *rj = static_cast<RenderJob *>(rjv);
|
||||
Image *ima = rj->image;
|
||||
ImBuf *ibuf;
|
||||
void *lock;
|
||||
|
@ -623,14 +625,14 @@ static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrec
|
|||
|
||||
static void current_scene_update(void *rjv, Scene *scene)
|
||||
{
|
||||
RenderJob *rj = rjv;
|
||||
RenderJob *rj = static_cast<RenderJob *>(rjv);
|
||||
rj->current_scene = scene;
|
||||
rj->iuser.scene = scene;
|
||||
}
|
||||
|
||||
static void render_startjob(void *rjv, short *stop, short *do_update, float *progress)
|
||||
{
|
||||
RenderJob *rj = rjv;
|
||||
RenderJob *rj = static_cast<RenderJob *>(rjv);
|
||||
|
||||
rj->stop = stop;
|
||||
rj->do_update = do_update;
|
||||
|
@ -666,15 +668,16 @@ 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 */
|
||||
for (wm = static_cast<wmWindowManager *>(rj->main->wm.first); wm;
|
||||
wm = static_cast<wmWindowManager *>(wm->id.next)) { /* only 1 wm */
|
||||
wmWindow *win;
|
||||
for (win = wm->windows.first; win; win = win->next) {
|
||||
for (win = static_cast<wmWindow *>(wm->windows.first); win; win = win->next) {
|
||||
const bScreen *screen = WM_window_get_active_screen(win);
|
||||
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
if (area == rj->area) {
|
||||
if (area->spacetype == SPACE_IMAGE) {
|
||||
SpaceImage *sima = area->spacedata.first;
|
||||
SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
|
||||
|
||||
if (RE_HasSingleLayer(rj->re)) {
|
||||
/* For single layer renders keep the active layer
|
||||
|
@ -700,7 +703,7 @@ static void render_image_restore_layer(RenderJob *rj)
|
|||
|
||||
static void render_endjob(void *rjv)
|
||||
{
|
||||
RenderJob *rj = rjv;
|
||||
RenderJob *rj = static_cast<RenderJob *>(rjv);
|
||||
|
||||
/* this render may be used again by the sequencer without the active
|
||||
* 'Render' where the callbacks would be re-assigned. assign dummy callbacks
|
||||
|
@ -774,7 +777,7 @@ static void render_endjob(void *rjv)
|
|||
* 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);
|
||||
WM_set_locked_interface(static_cast<wmWindowManager *>(G_MAIN->wm.first), false);
|
||||
DEG_tag_on_visible_update(G_MAIN, false);
|
||||
}
|
||||
}
|
||||
|
@ -782,7 +785,7 @@ static void render_endjob(void *rjv)
|
|||
/* called by render, check job 'stop' value or the global */
|
||||
static int render_breakjob(void *rjv)
|
||||
{
|
||||
RenderJob *rj = rjv;
|
||||
RenderJob *rj = static_cast<RenderJob *>(rjv);
|
||||
|
||||
if (G.is_break) {
|
||||
return 1;
|
||||
|
@ -809,7 +812,7 @@ static int render_break(void *UNUSED(rjv))
|
|||
/* maybe need a way to get job send notifier? */
|
||||
static void render_drawlock(void *rjv, bool lock)
|
||||
{
|
||||
RenderJob *rj = rjv;
|
||||
RenderJob *rj = static_cast<RenderJob *>(rjv);
|
||||
|
||||
/* If interface is locked, renderer callback shall do nothing. */
|
||||
if (!rj->interface_locked) {
|
||||
|
@ -871,11 +874,12 @@ static void clean_viewport_memory(Main *bmain, Scene *scene)
|
|||
BKE_main_id_tag_listbase(&bmain->objects, LIB_TAG_DOIT, true);
|
||||
|
||||
/* Go over all the visible objects. */
|
||||
for (wmWindowManager *wm = bmain->wm.first; wm; wm = wm->id.next) {
|
||||
for (wmWindowManager *wm = static_cast<wmWindowManager *>(bmain->wm.first); wm;
|
||||
wm = static_cast<wmWindowManager *>(wm->id.next)) {
|
||||
LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
|
||||
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
|
||||
|
||||
for (base = view_layer->object_bases.first; base; base = base->next) {
|
||||
for (base = static_cast<Base *>(view_layer->object_bases.first); base; base = base->next) {
|
||||
clean_viewport_memory_base(base);
|
||||
}
|
||||
}
|
||||
|
@ -964,7 +968,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even
|
|||
area = render_view_open(C, event->xy[0], event->xy[1], op->reports);
|
||||
|
||||
/* job custom data */
|
||||
rj = MEM_callocN(sizeof(RenderJob), "render job");
|
||||
rj = MEM_cnew<RenderJob>("render job");
|
||||
rj->main = bmain;
|
||||
rj->scene = scene;
|
||||
rj->current_scene = rj->scene;
|
||||
|
@ -988,7 +992,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even
|
|||
BKE_color_managed_view_settings_copy(&rj->view_settings, &scene->view_settings);
|
||||
|
||||
if (area) {
|
||||
SpaceImage *sima = area->spacedata.first;
|
||||
SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
|
||||
rj->orig_layer = sima->iuser.layer;
|
||||
}
|
||||
|
|
@ -82,7 +82,7 @@
|
|||
#include "GPU_framebuffer.h"
|
||||
#include "GPU_matrix.h"
|
||||
|
||||
#include "render_intern.h"
|
||||
#include "render_intern.hh"
|
||||
|
||||
/* Define this to get timing information. */
|
||||
// #define DEBUG_TIME
|
||||
|
@ -192,10 +192,10 @@ static void screen_opengl_views_setup(OGLRender *oglrender)
|
|||
|
||||
if (!is_multiview) {
|
||||
/* we only have one view when multiview is off */
|
||||
rv = rr->views.first;
|
||||
rv = static_cast<RenderView *>(rr->views.first);
|
||||
|
||||
if (rv == NULL) {
|
||||
rv = MEM_callocN(sizeof(RenderView), "new opengl render view");
|
||||
rv = MEM_cnew<RenderView>("new opengl render view");
|
||||
BLI_addtail(&rr->views, rv);
|
||||
}
|
||||
|
||||
|
@ -224,9 +224,10 @@ static void screen_opengl_views_setup(OGLRender *oglrender)
|
|||
}
|
||||
|
||||
/* remove all the views that are not needed */
|
||||
rv = rr->views.last;
|
||||
rv = static_cast<RenderView *>(rr->views.last);
|
||||
while (rv) {
|
||||
srv = BLI_findstring(&rd->views, rv->name, offsetof(SceneRenderView, name));
|
||||
srv = static_cast<SceneRenderView *>(
|
||||
BLI_findstring(&rd->views, rv->name, offsetof(SceneRenderView, name)));
|
||||
if (BKE_scene_multiview_is_render_view_active(rd, srv)) {
|
||||
rv = rv->prev;
|
||||
}
|
||||
|
@ -253,15 +254,16 @@ static void screen_opengl_views_setup(OGLRender *oglrender)
|
|||
}
|
||||
|
||||
/* create all the views that are needed */
|
||||
for (srv = rd->views.first; srv; srv = srv->next) {
|
||||
for (srv = static_cast<SceneRenderView *>(rd->views.first); srv; srv = srv->next) {
|
||||
if (BKE_scene_multiview_is_render_view_active(rd, srv) == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
rv = BLI_findstring(&rr->views, srv->name, offsetof(SceneRenderView, name));
|
||||
rv = static_cast<RenderView *>(
|
||||
BLI_findstring(&rr->views, srv->name, offsetof(SceneRenderView, name)));
|
||||
|
||||
if (rv == NULL) {
|
||||
rv = MEM_callocN(sizeof(RenderView), "new opengl render view");
|
||||
rv = MEM_cnew<RenderView>("new opengl render view");
|
||||
BLI_strncpy(rv->name, srv->name, sizeof(rv->name));
|
||||
BLI_addtail(&rr->views, rv);
|
||||
}
|
||||
|
@ -352,7 +354,8 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
|
|||
ED_annotation_draw_ex(scene, gpd, sizex, sizey, scene->r.cfra, SPACE_SEQ);
|
||||
G.f &= ~G_FLAG_RENDER_VIEWPORT;
|
||||
|
||||
gp_rect = MEM_mallocN(sizeof(uchar[4]) * sizex * sizey, "offscreen rect");
|
||||
gp_rect = static_cast<uchar *>(
|
||||
MEM_mallocN(sizeof(uchar[4]) * sizex * sizey, "offscreen rect"));
|
||||
GPU_offscreen_read_pixels(oglrender->ofs, GPU_DATA_UBYTE, gp_rect);
|
||||
|
||||
for (i = 0; i < sizex * sizey * 4; i += 4) {
|
||||
|
@ -372,7 +375,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
|
|||
if (view_context) {
|
||||
ibuf_view = ED_view3d_draw_offscreen_imbuf(depsgraph,
|
||||
scene,
|
||||
v3d->shading.type,
|
||||
static_cast<eDrawType>(v3d->shading.type),
|
||||
v3d,
|
||||
region,
|
||||
sizex,
|
||||
|
@ -506,7 +509,8 @@ static void screen_opengl_render_apply(const bContext *C, OGLRender *oglrender)
|
|||
}
|
||||
|
||||
rr = RE_AcquireResultRead(oglrender->re);
|
||||
for (rv = rr->views.first, view_id = 0; rv; rv = rv->next, view_id++) {
|
||||
for (rv = static_cast<RenderView *>(rr->views.first), view_id = 0; rv;
|
||||
rv = rv->next, view_id++) {
|
||||
BLI_assert(view_id < oglrender->views_len);
|
||||
RE_SetActiveRenderView(oglrender->re, rv->name);
|
||||
oglrender->view_id = view_id;
|
||||
|
@ -602,7 +606,7 @@ static int gather_frames_to_render_for_id(LibraryIDLinkCallbackData *cb_data)
|
|||
return IDWALK_RET_STOP_RECURSION;
|
||||
}
|
||||
|
||||
OGLRender *oglrender = cb_data->user_data;
|
||||
OGLRender *oglrender = static_cast<OGLRender *>(cb_data->user_data);
|
||||
|
||||
/* Whitelist of datablocks to follow pointers into. */
|
||||
const ID_Type id_type = GS(id->name);
|
||||
|
@ -722,8 +726,8 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
|
|||
const bool is_render_keyed_only = RNA_boolean_get(op->ptr, "render_keyed_only");
|
||||
const bool is_sequencer = RNA_boolean_get(op->ptr, "sequencer");
|
||||
const bool is_write_still = RNA_boolean_get(op->ptr, "write_still");
|
||||
const eImageFormatDepth color_depth = (is_animation) ? scene->r.im_format.depth :
|
||||
R_IMF_CHAN_DEPTH_32;
|
||||
const eImageFormatDepth color_depth = static_cast<eImageFormatDepth>(
|
||||
(is_animation) ? scene->r.im_format.depth : R_IMF_CHAN_DEPTH_32);
|
||||
char err_out[256] = "unknown";
|
||||
|
||||
if (G.background) {
|
||||
|
@ -777,7 +781,7 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
/* allocate opengl render */
|
||||
oglrender = MEM_callocN(sizeof(OGLRender), "OGLRender");
|
||||
oglrender = MEM_cnew<OGLRender>("OGLRender");
|
||||
op->customdata = oglrender;
|
||||
|
||||
oglrender->ofs = ofs;
|
||||
|
@ -801,7 +805,8 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
|
|||
oglrender->is_sequencer = is_sequencer;
|
||||
if (is_sequencer) {
|
||||
oglrender->sseq = CTX_wm_space_seq(C);
|
||||
ImBuf **ibufs_arr = MEM_callocN(sizeof(*ibufs_arr) * oglrender->views_len, __func__);
|
||||
ImBuf **ibufs_arr = static_cast<ImBuf **>(
|
||||
MEM_callocN(sizeof(*ibufs_arr) * oglrender->views_len, __func__));
|
||||
oglrender->seq_data.ibufs_arr = ibufs_arr;
|
||||
}
|
||||
|
||||
|
@ -812,7 +817,7 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
|
|||
/* so quad view renders camera */
|
||||
ED_view3d_context_user_region(C, &oglrender->v3d, &oglrender->region);
|
||||
|
||||
oglrender->rv3d = oglrender->region->regiondata;
|
||||
oglrender->rv3d = static_cast<RegionView3D *>(oglrender->region->regiondata);
|
||||
|
||||
/* MUST be cleared on exit */
|
||||
memset(&oglrender->scene->customdata_mask_modal,
|
||||
|
@ -959,7 +964,7 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender)
|
|||
|
||||
static void screen_opengl_render_cancel(bContext *C, wmOperator *op)
|
||||
{
|
||||
screen_opengl_render_end(C, op->customdata);
|
||||
screen_opengl_render_end(C, static_cast<OGLRender *>(op->customdata));
|
||||
}
|
||||
|
||||
/* share between invoke and exec */
|
||||
|
@ -969,7 +974,7 @@ static bool screen_opengl_render_anim_init(bContext *C, wmOperator *op)
|
|||
OGLRender *oglrender;
|
||||
Scene *scene;
|
||||
|
||||
oglrender = op->customdata;
|
||||
oglrender = static_cast<OGLRender *>(op->customdata);
|
||||
scene = oglrender->scene;
|
||||
oglrender->totvideos = BKE_scene_multiview_num_videos_get(&scene->r);
|
||||
|
||||
|
@ -989,7 +994,8 @@ static bool screen_opengl_render_anim_init(bContext *C, wmOperator *op)
|
|||
return false;
|
||||
}
|
||||
|
||||
oglrender->movie_ctx_arr = MEM_mallocN(sizeof(void *) * oglrender->totvideos, "Movies");
|
||||
oglrender->movie_ctx_arr = static_cast<void **>(
|
||||
MEM_mallocN(sizeof(void *) * oglrender->totvideos, "Movies"));
|
||||
|
||||
for (i = 0; i < oglrender->totvideos; i++) {
|
||||
Scene *scene_eval = DEG_get_evaluated_scene(oglrender->depsgraph);
|
||||
|
@ -1083,8 +1089,9 @@ static void write_result_func(TaskPool *__restrict pool, void *task_data_v)
|
|||
}
|
||||
if (reports.list.first != NULL) {
|
||||
BLI_spin_lock(&oglrender->reports_lock);
|
||||
for (Report *report = reports.list.first; report != NULL; report = report->next) {
|
||||
BKE_report(oglrender->reports, report->type, report->message);
|
||||
for (Report *report = static_cast<Report *>(reports.list.first); report != NULL;
|
||||
report = report->next) {
|
||||
BKE_report(oglrender->reports, static_cast<eReportType>(report->type), report->message);
|
||||
}
|
||||
BLI_spin_unlock(&oglrender->reports_lock);
|
||||
}
|
||||
|
@ -1105,7 +1112,7 @@ static bool schedule_write_result(OGLRender *oglrender, RenderResult *rr)
|
|||
return false;
|
||||
}
|
||||
Scene *scene = oglrender->scene;
|
||||
WriteTaskData *task_data = MEM_mallocN(sizeof(WriteTaskData), "write task data");
|
||||
WriteTaskData *task_data = MEM_new<WriteTaskData>("write task data");
|
||||
task_data->rr = rr;
|
||||
task_data->tmp_scene = *scene;
|
||||
BLI_mutex_lock(&oglrender->task_mutex);
|
||||
|
@ -1120,7 +1127,7 @@ static bool schedule_write_result(OGLRender *oglrender, RenderResult *rr)
|
|||
|
||||
static bool screen_opengl_render_anim_step(bContext *C, wmOperator *op)
|
||||
{
|
||||
OGLRender *oglrender = op->customdata;
|
||||
OGLRender *oglrender = static_cast<OGLRender *>(op->customdata);
|
||||
Scene *scene = oglrender->scene;
|
||||
Depsgraph *depsgraph = oglrender->depsgraph;
|
||||
char name[FILE_MAX];
|
||||
|
@ -1185,10 +1192,12 @@ static bool screen_opengl_render_anim_step(bContext *C, wmOperator *op)
|
|||
|
||||
/* save to disk */
|
||||
rr = RE_AcquireResultRead(oglrender->re);
|
||||
RenderResult *new_rr = RE_DuplicateRenderResult(rr);
|
||||
RE_ReleaseResult(oglrender->re);
|
||||
{
|
||||
RenderResult *new_rr = RE_DuplicateRenderResult(rr);
|
||||
RE_ReleaseResult(oglrender->re);
|
||||
|
||||
ok = schedule_write_result(oglrender, new_rr);
|
||||
ok = schedule_write_result(oglrender, new_rr);
|
||||
}
|
||||
|
||||
finally: /* Step the frame and bail early if needed */
|
||||
|
||||
|
@ -1197,7 +1206,7 @@ finally: /* Step the frame and bail early if needed */
|
|||
|
||||
/* stop at the end or on error */
|
||||
if (CFRA >= PEFRA || !ok) {
|
||||
screen_opengl_render_end(C, op->customdata);
|
||||
screen_opengl_render_end(C, static_cast<OGLRender *>(op->customdata));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1206,7 +1215,7 @@ finally: /* Step the frame and bail early if needed */
|
|||
|
||||
static int screen_opengl_render_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
OGLRender *oglrender = op->customdata;
|
||||
OGLRender *oglrender = static_cast<OGLRender *>(op->customdata);
|
||||
const bool anim = RNA_boolean_get(op->ptr, "animation");
|
||||
bool ret;
|
||||
|
||||
|
@ -1214,7 +1223,7 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, const wmEvent
|
|||
case EVT_ESCKEY:
|
||||
/* cancel */
|
||||
oglrender->pool_ok = false; /* Flag pool for cancel. */
|
||||
screen_opengl_render_end(C, op->customdata);
|
||||
screen_opengl_render_end(C, static_cast<OGLRender *>(op->customdata));
|
||||
return OPERATOR_FINISHED;
|
||||
case TIMER:
|
||||
/* render frame? */
|
||||
|
@ -1231,8 +1240,8 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, const wmEvent
|
|||
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, oglrender->scene);
|
||||
|
||||
if (anim == 0) {
|
||||
screen_opengl_render_apply(C, op->customdata);
|
||||
screen_opengl_render_end(C, op->customdata);
|
||||
screen_opengl_render_apply(C, static_cast<OGLRender *>(op->customdata));
|
||||
screen_opengl_render_end(C, static_cast<OGLRender *>(op->customdata));
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
@ -1261,7 +1270,7 @@ static int screen_opengl_render_invoke(bContext *C, wmOperator *op, const wmEven
|
|||
}
|
||||
}
|
||||
|
||||
oglrender = op->customdata;
|
||||
oglrender = static_cast<OGLRender *>(op->customdata);
|
||||
render_view_open(C, event->xy[0], event->xy[1], op->reports);
|
||||
|
||||
/* View may be changed above #USER_RENDER_DISPLAY_WINDOW. */
|
||||
|
@ -1284,8 +1293,8 @@ static int screen_opengl_render_exec(bContext *C, wmOperator *op)
|
|||
|
||||
if (!is_animation) { /* same as invoke */
|
||||
/* render image */
|
||||
screen_opengl_render_apply(C, op->customdata);
|
||||
screen_opengl_render_end(C, op->customdata);
|
||||
screen_opengl_render_apply(C, static_cast<OGLRender *>(op->customdata));
|
||||
screen_opengl_render_end(C, static_cast<OGLRender *>(op->customdata));
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include "WM_api.h"
|
||||
|
||||
#include "render_intern.h" /* own include */
|
||||
#include "render_intern.hh" /* own include */
|
||||
|
||||
/***************************** render ***********************************/
|
||||
|
|
@ -137,7 +137,7 @@ typedef struct ShaderPreview {
|
|||
|
||||
int sizex, sizey;
|
||||
uint *pr_rect;
|
||||
int pr_method;
|
||||
ePreviewRenderMethod pr_method;
|
||||
bool own_id_copy;
|
||||
|
||||
Main *bmain;
|
||||
|
@ -212,7 +212,7 @@ static bool check_engine_supports_preview(Scene *scene)
|
|||
return (type->flag & RE_USE_PREVIEW) != 0;
|
||||
}
|
||||
|
||||
static bool preview_method_is_render(int pr_method)
|
||||
static bool preview_method_is_render(const ePreviewRenderMethod pr_method)
|
||||
{
|
||||
return ELEM(pr_method, PR_ICON_RENDER, PR_BUTS_RENDER);
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ static Scene *preview_get_scene(Main *pr_main)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return pr_main->scenes.first;
|
||||
return static_cast<Scene *>(pr_main->scenes.first);
|
||||
}
|
||||
|
||||
static const char *preview_collection_name(const ePreviewType pr_type)
|
||||
|
@ -276,10 +276,10 @@ static bool render_engine_supports_ray_visibility(const Scene *sce)
|
|||
static void switch_preview_collection_visibilty(ViewLayer *view_layer, const ePreviewType pr_type)
|
||||
{
|
||||
/* Set appropriate layer as visible. */
|
||||
LayerCollection *lc = view_layer->layer_collections.first;
|
||||
LayerCollection *lc = static_cast<LayerCollection *>(view_layer->layer_collections.first);
|
||||
const char *collection_name = preview_collection_name(pr_type);
|
||||
|
||||
for (lc = lc->layer_collections.first; lc; lc = lc->next) {
|
||||
for (lc = static_cast<LayerCollection *>(lc->layer_collections.first); lc; lc = lc->next) {
|
||||
if (STREQ(lc->collection->id.name + 2, collection_name)) {
|
||||
lc->collection->flag &= ~COLLECTION_HIDE_RENDER;
|
||||
}
|
||||
|
@ -308,7 +308,8 @@ static void switch_preview_floor_material(Main *pr_main,
|
|||
}
|
||||
|
||||
const char *material_name = preview_floor_material_name(scene, pr_method);
|
||||
Material *mat = BLI_findstring(&pr_main->materials, material_name, offsetof(ID, name) + 2);
|
||||
Material *mat = static_cast<Material *>(
|
||||
BLI_findstring(&pr_main->materials, material_name, offsetof(ID, name) + 2));
|
||||
if (mat) {
|
||||
me->mat[0] = mat;
|
||||
}
|
||||
|
@ -329,7 +330,8 @@ static void switch_preview_floor_visibility(Main *pr_main,
|
|||
}
|
||||
}
|
||||
if (base->object->type == OB_MESH) {
|
||||
switch_preview_floor_material(pr_main, base->object->data, scene, pr_method);
|
||||
switch_preview_floor_material(
|
||||
pr_main, static_cast<Mesh *>(base->object->data), scene, pr_method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -421,11 +423,12 @@ static World *preview_get_world(Main *pr_main,
|
|||
{
|
||||
World *result = NULL;
|
||||
const char *world_name = preview_world_name(sce, id_type, pr_method);
|
||||
result = BLI_findstring(&pr_main->worlds, world_name, offsetof(ID, name) + 2);
|
||||
result = static_cast<World *>(
|
||||
BLI_findstring(&pr_main->worlds, world_name, offsetof(ID, name) + 2));
|
||||
|
||||
/* No world found return first world. */
|
||||
if (result == NULL) {
|
||||
result = pr_main->worlds.first;
|
||||
result = static_cast<World *>(pr_main->worlds.first);
|
||||
}
|
||||
|
||||
BLI_assert_msg(result, "Preview file has no world.");
|
||||
|
@ -465,7 +468,7 @@ static Scene *preview_prepare_scene(
|
|||
|
||||
sce = preview_get_scene(pr_main);
|
||||
if (sce) {
|
||||
ViewLayer *view_layer = sce->view_layers.first;
|
||||
ViewLayer *view_layer = static_cast<ViewLayer *>(sce->view_layers.first);
|
||||
|
||||
/* Only enable the combined renderpass */
|
||||
view_layer->passflag = SCE_PASS_COMBINED;
|
||||
|
@ -491,7 +494,8 @@ static Scene *preview_prepare_scene(
|
|||
sce->r.cfra = scene->r.cfra;
|
||||
|
||||
/* Setup the world. */
|
||||
sce->world = preview_prepare_world(pr_main, sce, scene->world, id_type, sp->pr_method);
|
||||
sce->world = preview_prepare_world(
|
||||
pr_main, sce, scene->world, static_cast<ID_Type>(id_type), sp->pr_method);
|
||||
|
||||
if (id_type == ID_TE) {
|
||||
/* Texture is not actually rendered with engine, just set dummy value. */
|
||||
|
@ -523,10 +527,10 @@ static Scene *preview_prepare_scene(
|
|||
}
|
||||
|
||||
/* For grease pencil, always use sphere for icon renders. */
|
||||
const ePreviewType preview_type = (sp->pr_method == PR_ICON_RENDER &&
|
||||
sp->pr_main == G_pr_main_grease_pencil) ?
|
||||
MA_SPHERE_A :
|
||||
mat->pr_type;
|
||||
const ePreviewType preview_type = static_cast<ePreviewType>(
|
||||
(sp->pr_method == PR_ICON_RENDER && sp->pr_main == G_pr_main_grease_pencil) ?
|
||||
MA_SPHERE_A :
|
||||
mat->pr_type);
|
||||
set_preview_visibility(pr_main, sce, view_layer, preview_type, sp->pr_method);
|
||||
}
|
||||
else {
|
||||
|
@ -670,8 +674,8 @@ static bool ed_preview_draw_rect(ScrArea *area, int split, int first, rcti *rect
|
|||
newrect->ymax = max_ii(newrect->ymax, rect->ymin + rres.recty);
|
||||
|
||||
if (rres.rectx && rres.recty) {
|
||||
uchar *rect_byte = MEM_mallocN(rres.rectx * rres.recty * sizeof(int),
|
||||
"ed_preview_draw_rect");
|
||||
uchar *rect_byte = static_cast<uchar *>(
|
||||
MEM_mallocN(rres.rectx * rres.recty * sizeof(int), "ed_preview_draw_rect"));
|
||||
float fx = rect->xmin + offx;
|
||||
float fy = rect->ymin;
|
||||
|
||||
|
@ -703,7 +707,7 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
|
|||
ID *parent = (ID *)parentp;
|
||||
MTex *slot = (MTex *)slotp;
|
||||
SpaceProperties *sbuts = CTX_wm_space_properties(C);
|
||||
ShaderPreview *sp = WM_jobs_customdata(wm, area);
|
||||
ShaderPreview *sp = static_cast<ShaderPreview *>(WM_jobs_customdata(wm, area));
|
||||
rcti newrect;
|
||||
int ok;
|
||||
int newx = BLI_rcti_size_x(rect);
|
||||
|
@ -796,7 +800,7 @@ static Scene *object_preview_scene_create(const struct ObjectPreviewData *previe
|
|||
* viewport displays. */
|
||||
CFRA = preview_data->cfra;
|
||||
|
||||
ViewLayer *view_layer = scene->view_layers.first;
|
||||
ViewLayer *view_layer = static_cast<ViewLayer *>(scene->view_layers.first);
|
||||
Depsgraph *depsgraph = DEG_graph_new(
|
||||
preview_data->pr_main, scene, view_layer, DAG_EVAL_VIEWPORT);
|
||||
|
||||
|
@ -836,14 +840,14 @@ static void object_preview_render(IconPreview *preview, IconPreviewSize *preview
|
|||
|
||||
BLI_assert(preview->id_copy && (preview->id_copy != preview->id));
|
||||
|
||||
struct ObjectPreviewData preview_data = {
|
||||
.pr_main = preview_main,
|
||||
/* Act on a copy. */
|
||||
.object = (Object *)preview->id_copy,
|
||||
.cfra = preview->scene->r.cfra,
|
||||
.sizex = preview_sized->sizex,
|
||||
.sizey = preview_sized->sizey,
|
||||
};
|
||||
struct ObjectPreviewData preview_data = {};
|
||||
preview_data.pr_main = preview_main;
|
||||
/* Act on a copy. */
|
||||
preview_data.object = (Object *)preview->id_copy;
|
||||
preview_data.cfra = preview->scene->r.cfra;
|
||||
preview_data.sizex = preview_sized->sizex;
|
||||
preview_data.sizey = preview_sized->sizey;
|
||||
|
||||
Depsgraph *depsgraph;
|
||||
Scene *scene = object_preview_scene_create(&preview_data, &depsgraph);
|
||||
|
||||
|
@ -994,7 +998,7 @@ static void shader_preview_update(void *spv,
|
|||
RenderResult *UNUSED(rr),
|
||||
volatile struct rcti *UNUSED(rect))
|
||||
{
|
||||
ShaderPreview *sp = spv;
|
||||
ShaderPreview *sp = static_cast<ShaderPreview *>(spv);
|
||||
|
||||
*(sp->do_update) = true;
|
||||
}
|
||||
|
@ -1002,7 +1006,7 @@ static void shader_preview_update(void *spv,
|
|||
/* called by renderer, checks job value */
|
||||
static int shader_preview_break(void *spv)
|
||||
{
|
||||
ShaderPreview *sp = spv;
|
||||
ShaderPreview *sp = static_cast<ShaderPreview *>(spv);
|
||||
|
||||
return *(sp->stop);
|
||||
}
|
||||
|
@ -1026,7 +1030,8 @@ static void shader_preview_texture(ShaderPreview *sp, Tex *tex, Scene *sce, Rend
|
|||
/* Create buffer in empty RenderView created in the init step. */
|
||||
RenderResult *rr = RE_AcquireResultWrite(re);
|
||||
RenderView *rv = (RenderView *)rr->views.first;
|
||||
rv->rectf = MEM_callocN(sizeof(float[4]) * width * height, "texture render result");
|
||||
rv->rectf = static_cast<float *>(
|
||||
MEM_callocN(sizeof(float[4]) * width * height, "texture render result"));
|
||||
RE_ReleaseResult(re);
|
||||
|
||||
/* Get texture image pool (if any) */
|
||||
|
@ -1177,7 +1182,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
|
|||
/* runs inside thread for material and icons */
|
||||
static void shader_preview_startjob(void *customdata, short *stop, short *do_update)
|
||||
{
|
||||
ShaderPreview *sp = customdata;
|
||||
ShaderPreview *sp = static_cast<ShaderPreview *>(customdata);
|
||||
|
||||
sp->stop = stop;
|
||||
sp->do_update = do_update;
|
||||
|
@ -1208,7 +1213,7 @@ static void preview_id_copy_free(ID *id)
|
|||
|
||||
static void shader_preview_free(void *customdata)
|
||||
{
|
||||
ShaderPreview *sp = customdata;
|
||||
ShaderPreview *sp = static_cast<ShaderPreview *>(customdata);
|
||||
Main *pr_main = sp->pr_main;
|
||||
ID *main_id_copy = NULL;
|
||||
ID *sub_id_copy = NULL;
|
||||
|
@ -1370,13 +1375,13 @@ static void set_alpha(char *cp, int sizex, int sizey, char alpha)
|
|||
|
||||
static void icon_preview_startjob(void *customdata, short *stop, short *do_update)
|
||||
{
|
||||
ShaderPreview *sp = customdata;
|
||||
ShaderPreview *sp = static_cast<ShaderPreview *>(customdata);
|
||||
|
||||
if (sp->pr_method == PR_ICON_DEFERRED) {
|
||||
PreviewImage *prv = sp->owner;
|
||||
PreviewImage *prv = static_cast<PreviewImage *>(sp->owner);
|
||||
ImBuf *thumb;
|
||||
char *deferred_data = PRV_DEFERRED_DATA(prv);
|
||||
int source = deferred_data[0];
|
||||
char *deferred_data = static_cast<char *>(PRV_DEFERRED_DATA(prv));
|
||||
ThumbSource source = static_cast<ThumbSource>(deferred_data[0]);
|
||||
char *path = &deferred_data[1];
|
||||
|
||||
// printf("generating deferred %d×%d preview for %s\n", sp->sizex, sp->sizey, path);
|
||||
|
@ -1468,7 +1473,7 @@ static void common_preview_startjob(void *customdata,
|
|||
short *do_update,
|
||||
float *UNUSED(progress))
|
||||
{
|
||||
ShaderPreview *sp = customdata;
|
||||
ShaderPreview *sp = static_cast<ShaderPreview *>(customdata);
|
||||
|
||||
if (ELEM(sp->pr_method, PR_ICON_RENDER, PR_ICON_DEFERRED)) {
|
||||
icon_preview_startjob(customdata, stop, do_update);
|
||||
|
@ -1484,12 +1489,12 @@ static void common_preview_startjob(void *customdata,
|
|||
*/
|
||||
static void other_id_types_preview_render(IconPreview *ip,
|
||||
IconPreviewSize *cur_size,
|
||||
const int pr_method,
|
||||
const ePreviewRenderMethod pr_method,
|
||||
short *stop,
|
||||
short *do_update,
|
||||
float *progress)
|
||||
{
|
||||
ShaderPreview *sp = MEM_callocN(sizeof(ShaderPreview), "Icon ShaderPreview");
|
||||
ShaderPreview *sp = MEM_cnew<ShaderPreview>("Icon ShaderPreview");
|
||||
|
||||
/* These types don't use the ShaderPreview mess, they have their own types and functions. */
|
||||
BLI_assert(!ip->id || !ELEM(GS(ip->id->name), ID_OB));
|
||||
|
@ -1553,10 +1558,12 @@ static void icon_preview_startjob_all_sizes(void *customdata,
|
|||
IconPreview *ip = (IconPreview *)customdata;
|
||||
IconPreviewSize *cur_size;
|
||||
|
||||
for (cur_size = ip->sizes.first; cur_size; cur_size = cur_size->next) {
|
||||
PreviewImage *prv = ip->owner;
|
||||
for (cur_size = static_cast<IconPreviewSize *>(ip->sizes.first); cur_size;
|
||||
cur_size = cur_size->next) {
|
||||
PreviewImage *prv = static_cast<PreviewImage *>(ip->owner);
|
||||
/* Is this a render job or a deferred loading job? */
|
||||
const int pr_method = (prv->tag & PRV_TAG_DEFFERED) ? PR_ICON_DEFERRED : PR_ICON_RENDER;
|
||||
const ePreviewRenderMethod pr_method = (prv->tag & PRV_TAG_DEFFERED) ? PR_ICON_DEFERRED :
|
||||
PR_ICON_RENDER;
|
||||
|
||||
if (*stop) {
|
||||
break;
|
||||
|
@ -1609,7 +1616,7 @@ static void icon_preview_startjob_all_sizes(void *customdata,
|
|||
|
||||
static void icon_preview_add_size(IconPreview *ip, uint *rect, int sizex, int sizey)
|
||||
{
|
||||
IconPreviewSize *cur_size = ip->sizes.first, *new_size;
|
||||
IconPreviewSize *cur_size = static_cast<IconPreviewSize *>(ip->sizes.first);
|
||||
|
||||
while (cur_size) {
|
||||
if (cur_size->sizex == sizex && cur_size->sizey == sizey) {
|
||||
|
@ -1620,7 +1627,7 @@ static void icon_preview_add_size(IconPreview *ip, uint *rect, int sizex, int si
|
|||
cur_size = cur_size->next;
|
||||
}
|
||||
|
||||
new_size = MEM_callocN(sizeof(IconPreviewSize), "IconPreviewSize");
|
||||
IconPreviewSize *new_size = MEM_cnew<IconPreviewSize>("IconPreviewSize");
|
||||
new_size->sizex = sizex;
|
||||
new_size->sizey = sizey;
|
||||
new_size->rect = rect;
|
||||
|
@ -1630,7 +1637,7 @@ static void icon_preview_add_size(IconPreview *ip, uint *rect, int sizex, int si
|
|||
|
||||
static void icon_preview_endjob(void *customdata)
|
||||
{
|
||||
IconPreview *ip = customdata;
|
||||
IconPreview *ip = static_cast<IconPreview *>(customdata);
|
||||
|
||||
if (ip->id) {
|
||||
|
||||
|
@ -1656,7 +1663,7 @@ static void icon_preview_endjob(void *customdata)
|
|||
}
|
||||
|
||||
if (ip->owner) {
|
||||
PreviewImage *prv_img = ip->owner;
|
||||
PreviewImage *prv_img = static_cast<PreviewImage *>(ip->owner);
|
||||
prv_img->tag &= ~PRV_TAG_DEFFERED_RENDERING;
|
||||
|
||||
LISTBASE_FOREACH (IconPreviewSize *, icon_size, &ip->sizes) {
|
||||
|
@ -1742,10 +1749,10 @@ void ED_preview_icon_job(
|
|||
WM_JOB_EXCL_RENDER,
|
||||
WM_JOB_TYPE_RENDER_PREVIEW);
|
||||
|
||||
ip = MEM_callocN(sizeof(IconPreview), "icon preview");
|
||||
ip = MEM_cnew<IconPreview>("icon preview");
|
||||
|
||||
/* render all resolutions from suspended job too */
|
||||
old_ip = WM_jobs_customdata_get(wm_job);
|
||||
old_ip = static_cast<IconPreview *>(WM_jobs_customdata_get(wm_job));
|
||||
if (old_ip) {
|
||||
BLI_movelisttolist(&ip->sizes, &old_ip->sizes);
|
||||
}
|
||||
|
@ -1764,7 +1771,7 @@ void ED_preview_icon_job(
|
|||
/* Special threading hack:
|
||||
* warn main code that this preview is being rendered and cannot be freed... */
|
||||
{
|
||||
PreviewImage *prv_img = owner;
|
||||
PreviewImage *prv_img = static_cast<PreviewImage *>(owner);
|
||||
if (prv_img->tag & PRV_TAG_DEFFERED) {
|
||||
prv_img->tag |= PRV_TAG_DEFFERED_RENDERING;
|
||||
}
|
||||
|
@ -1789,7 +1796,7 @@ void ED_preview_shader_job(const bContext *C,
|
|||
MTex *slot,
|
||||
int sizex,
|
||||
int sizey,
|
||||
int method)
|
||||
ePreviewRenderMethod method)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
wmJob *wm_job;
|
||||
|
@ -1814,7 +1821,7 @@ void ED_preview_shader_job(const bContext *C,
|
|||
"Shader Preview",
|
||||
WM_JOB_EXCL_RENDER,
|
||||
WM_JOB_TYPE_RENDER_PREVIEW);
|
||||
sp = MEM_callocN(sizeof(ShaderPreview), "shader preview");
|
||||
sp = MEM_cnew<ShaderPreview>("shader preview");
|
||||
|
||||
/* customdata for preview thread */
|
||||
sp->scene = scene;
|
||||
|
@ -1886,7 +1893,7 @@ void ED_preview_restart_queue_free(void)
|
|||
|
||||
void ED_preview_restart_queue_add(ID *id, enum eIconSizes size)
|
||||
{
|
||||
PreviewRestartQueueEntry *queue_entry = MEM_mallocN(sizeof(*queue_entry), __func__);
|
||||
PreviewRestartQueueEntry *queue_entry = MEM_new<PreviewRestartQueueEntry>(__func__);
|
||||
queue_entry->size = size;
|
||||
queue_entry->id = id;
|
||||
BLI_addtail(&G_restart_previews_queue, queue_entry);
|
|
@ -96,7 +96,7 @@
|
|||
|
||||
#include "engines/eevee/eevee_lightcache.h"
|
||||
|
||||
#include "render_intern.h" /* own include */
|
||||
#include "render_intern.hh" /* own include */
|
||||
|
||||
static bool object_materials_supported_poll_ex(bContext *C, const Object *ob);
|
||||
|
||||
|
@ -106,7 +106,7 @@ static bool object_materials_supported_poll_ex(bContext *C, const Object *ob);
|
|||
|
||||
static bool object_array_for_shading_edit_mode_enabled_filter(const Object *ob, void *user_data)
|
||||
{
|
||||
bContext *C = user_data;
|
||||
bContext *C = static_cast<bContext *>(user_data);
|
||||
if (object_materials_supported_poll_ex(C, ob)) {
|
||||
if (BKE_object_is_in_editmode(ob) == true) {
|
||||
return true;
|
||||
|
@ -123,7 +123,7 @@ static Object **object_array_for_shading_edit_mode_enabled(bContext *C, uint *r_
|
|||
|
||||
static bool object_array_for_shading_edit_mode_disabled_filter(const Object *ob, void *user_data)
|
||||
{
|
||||
bContext *C = user_data;
|
||||
bContext *C = static_cast<bContext *>(user_data);
|
||||
if (object_materials_supported_poll_ex(C, ob)) {
|
||||
if (BKE_object_is_in_editmode(ob) == false) {
|
||||
return true;
|
||||
|
@ -159,7 +159,7 @@ static bool object_materials_supported_poll_ex(bContext *C, const Object *ob)
|
|||
}
|
||||
|
||||
/* Material linked to obdata. */
|
||||
const ID *data = ob->data;
|
||||
const ID *data = static_cast<ID *>(ob->data);
|
||||
return (data && !ID_IS_LINKED(data) && !ID_IS_OVERRIDE_LIBRARY(data));
|
||||
}
|
||||
|
||||
|
@ -328,7 +328,7 @@ static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
ListBase *nurbs = BKE_curve_editNurbs_get((Curve *)ob->data);
|
||||
|
||||
if (nurbs) {
|
||||
for (nu = nurbs->first; nu; nu = nu->next) {
|
||||
for (nu = static_cast<Nurb *>(nurbs->first); nu; nu = nu->next) {
|
||||
if (ED_curve_nurb_select_check(v3d, nu)) {
|
||||
changed = true;
|
||||
nu->mat_nr = mat_nr_active;
|
||||
|
@ -432,7 +432,7 @@ static int material_slot_de_select(bContext *C, bool select)
|
|||
int a;
|
||||
|
||||
if (nurbs) {
|
||||
for (nu = nurbs->first; nu; nu = nu->next) {
|
||||
for (nu = static_cast<Nurb *>(nurbs->first); nu; nu = nu->next) {
|
||||
if (nu->mat_nr == mat_nr_active) {
|
||||
if (nu->bezt) {
|
||||
a = nu->pntsu;
|
||||
|
@ -477,7 +477,7 @@ static int material_slot_de_select(bContext *C, bool select)
|
|||
|
||||
if (changed) {
|
||||
changed_multi = true;
|
||||
DEG_id_tag_update(ob->data, ID_RECALC_SELECT);
|
||||
DEG_id_tag_update(static_cast<ID *>(ob->data), ID_RECALC_SELECT);
|
||||
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
|
||||
}
|
||||
}
|
||||
|
@ -545,7 +545,8 @@ static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
Material ***matar_object = &ob->mat;
|
||||
|
||||
Material **matar = MEM_callocN(sizeof(*matar) * (size_t)ob->totcol, __func__);
|
||||
Material **matar = static_cast<Material **>(
|
||||
MEM_callocN(sizeof(*matar) * (size_t)ob->totcol, __func__));
|
||||
for (int i = ob->totcol; i--;) {
|
||||
matar[i] = ob->matbits[i] ? (*matar_object)[i] : (*matar_obdata)[i];
|
||||
}
|
||||
|
@ -620,7 +621,7 @@ static int material_slot_move_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
slot_remap = MEM_mallocN(sizeof(uint) * ob->totcol, __func__);
|
||||
slot_remap = static_cast<uint *>(MEM_mallocN(sizeof(uint) * ob->totcol, __func__));
|
||||
|
||||
range_vn_u(slot_remap, ob->totcol, 0);
|
||||
|
||||
|
@ -749,7 +750,8 @@ void OBJECT_OT_material_slot_remove_unused(wmOperatorType *ot)
|
|||
|
||||
static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
|
||||
Material *ma = static_cast<Material *>(
|
||||
CTX_data_pointer_get_type(C, "material", &RNA_Material).data);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
PointerRNA ptr, idptr;
|
||||
PropertyRNA *prop;
|
||||
|
@ -757,7 +759,8 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
/* hook into UI */
|
||||
UI_context_active_but_prop_get_templateID(C, &ptr, &prop);
|
||||
|
||||
Object *ob = (prop && RNA_struct_is_a(ptr.type, &RNA_Object)) ? ptr.data : NULL;
|
||||
Object *ob = static_cast<Object *>((prop && RNA_struct_is_a(ptr.type, &RNA_Object)) ? ptr.data :
|
||||
NULL);
|
||||
|
||||
/* add or copy material */
|
||||
if (ma) {
|
||||
|
@ -823,7 +826,7 @@ void MATERIAL_OT_new(wmOperatorType *ot)
|
|||
|
||||
static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
|
||||
Tex *tex = static_cast<Tex *>(CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
PointerRNA ptr, idptr;
|
||||
PropertyRNA *prop;
|
||||
|
@ -876,7 +879,7 @@ void TEXTURE_OT_new(wmOperatorType *ot)
|
|||
|
||||
static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
World *wo = CTX_data_pointer_get_type(C, "world", &RNA_World).data;
|
||||
World *wo = static_cast<World *>(CTX_data_pointer_get_type(C, "world", &RNA_World).data);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
PointerRNA ptr, idptr;
|
||||
PropertyRNA *prop;
|
||||
|
@ -1389,7 +1392,8 @@ void SCENE_OT_render_view_add(wmOperatorType *ot)
|
|||
static int render_view_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
SceneRenderView *rv = BLI_findlink(&scene->r.views, scene->r.actview);
|
||||
SceneRenderView *rv = static_cast<SceneRenderView *>(
|
||||
BLI_findlink(&scene->r.views, scene->r.actview));
|
||||
|
||||
if (!BKE_scene_remove_render_view(scene, rv)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -1444,7 +1448,7 @@ static bool freestyle_linestyle_check_report(FreestyleLineSet *lineset, ReportLi
|
|||
static bool freestyle_active_module_poll(bContext *C)
|
||||
{
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
|
||||
FreestyleModuleConfig *module = ptr.data;
|
||||
FreestyleModuleConfig *module = static_cast<FreestyleModuleConfig *>(ptr.data);
|
||||
|
||||
return module != NULL;
|
||||
}
|
||||
|
@ -1486,7 +1490,7 @@ static int freestyle_module_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
|
||||
FreestyleModuleConfig *module = ptr.data;
|
||||
FreestyleModuleConfig *module = static_cast<FreestyleModuleConfig *>(ptr.data);
|
||||
|
||||
BKE_freestyle_module_delete(&view_layer->freestyle_config, module);
|
||||
|
||||
|
@ -1516,7 +1520,7 @@ static int freestyle_module_move_exec(bContext *C, wmOperator *op)
|
|||
Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
|
||||
FreestyleModuleConfig *module = ptr.data;
|
||||
FreestyleModuleConfig *module = static_cast<FreestyleModuleConfig *>(ptr.data);
|
||||
int dir = RNA_enum_get(op->ptr, "direction");
|
||||
|
||||
if (BKE_freestyle_module_move(&view_layer->freestyle_config, module, dir)) {
|
||||
|
@ -2014,7 +2018,7 @@ static int freestyle_modifier_remove_exec(bContext *C, wmOperator *op)
|
|||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&view_layer->freestyle_config);
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier);
|
||||
LineStyleModifier *modifier = ptr.data;
|
||||
LineStyleModifier *modifier = static_cast<LineStyleModifier *>(ptr.data);
|
||||
|
||||
if (!freestyle_linestyle_check_report(lineset, op->reports)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -2070,7 +2074,7 @@ static int freestyle_modifier_copy_exec(bContext *C, wmOperator *op)
|
|||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&view_layer->freestyle_config);
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier);
|
||||
LineStyleModifier *modifier = ptr.data;
|
||||
LineStyleModifier *modifier = static_cast<LineStyleModifier *>(ptr.data);
|
||||
|
||||
if (!freestyle_linestyle_check_report(lineset, op->reports)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -2126,7 +2130,7 @@ static int freestyle_modifier_move_exec(bContext *C, wmOperator *op)
|
|||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&view_layer->freestyle_config);
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier);
|
||||
LineStyleModifier *modifier = ptr.data;
|
||||
LineStyleModifier *modifier = static_cast<LineStyleModifier *>(ptr.data);
|
||||
int dir = RNA_enum_get(op->ptr, "direction");
|
||||
bool changed = false;
|
||||
|
||||
|
@ -2311,7 +2315,8 @@ void TEXTURE_OT_slot_move(wmOperatorType *ot)
|
|||
/* material copy/paste */
|
||||
static int copy_material_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
|
||||
Material *ma = static_cast<Material *>(
|
||||
CTX_data_pointer_get_type(C, "material", &RNA_Material).data);
|
||||
|
||||
if (ma == NULL) {
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -2345,7 +2350,8 @@ void MATERIAL_OT_copy(wmOperatorType *ot)
|
|||
|
||||
static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
|
||||
Material *ma = static_cast<Material *>(
|
||||
CTX_data_pointer_get_type(C, "material", &RNA_Material).data);
|
||||
|
||||
if (ma == NULL) {
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -2433,7 +2439,7 @@ static void paste_mtex_copybuf(ID *id)
|
|||
|
||||
if (mtex) {
|
||||
if (*mtex == NULL) {
|
||||
*mtex = MEM_mallocN(sizeof(MTex), "mtex copy");
|
||||
*mtex = MEM_new<MTex>("mtex copy");
|
||||
}
|
||||
else if ((*mtex)->tex) {
|
||||
id_us_min(&(*mtex)->tex->id);
|
||||
|
@ -2500,13 +2506,14 @@ static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
ID *id = CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).owner_id;
|
||||
|
||||
if (id == NULL) {
|
||||
Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
|
||||
Light *la = CTX_data_pointer_get_type(C, "light", &RNA_Light).data;
|
||||
World *wo = CTX_data_pointer_get_type(C, "world", &RNA_World).data;
|
||||
ParticleSystem *psys =
|
||||
CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem).data;
|
||||
FreestyleLineStyle *linestyle =
|
||||
CTX_data_pointer_get_type(C, "line_style", &RNA_FreestyleLineStyle).data;
|
||||
Material *ma = static_cast<Material *>(
|
||||
CTX_data_pointer_get_type(C, "material", &RNA_Material).data);
|
||||
Light *la = static_cast<Light *>(CTX_data_pointer_get_type(C, "light", &RNA_Light).data);
|
||||
World *wo = static_cast<World *>(CTX_data_pointer_get_type(C, "world", &RNA_World).data);
|
||||
ParticleSystem *psys = static_cast<ParticleSystem *>(
|
||||
CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem).data);
|
||||
FreestyleLineStyle *linestyle = static_cast<FreestyleLineStyle *>(
|
||||
CTX_data_pointer_get_type(C, "line_style", &RNA_FreestyleLineStyle).data);
|
||||
|
||||
if (ma) {
|
||||
id = &ma->id;
|
|
@ -82,8 +82,8 @@ void ED_render_view3d_update(Depsgraph *depsgraph,
|
|||
continue;
|
||||
}
|
||||
|
||||
View3D *v3d = area->spacedata.first;
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
View3D *v3d = static_cast<View3D *>(area->spacedata.first);
|
||||
RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
|
||||
RenderEngine *engine = rv3d->render_engine;
|
||||
|
||||
/* call update if the scene changed, or if the render engine
|
||||
|
@ -94,7 +94,7 @@ void ED_render_view3d_update(Depsgraph *depsgraph,
|
|||
bContext *C = CTX_create();
|
||||
CTX_data_main_set(C, bmain);
|
||||
CTX_data_scene_set(C, scene);
|
||||
CTX_wm_manager_set(C, bmain->wm.first);
|
||||
CTX_wm_manager_set(C, static_cast<wmWindowManager *>(bmain->wm.first));
|
||||
CTX_wm_window_set(C, window);
|
||||
CTX_wm_screen_set(C, WM_window_get_active_screen(window));
|
||||
CTX_wm_area_set(C, area);
|
||||
|
@ -111,15 +111,15 @@ void ED_render_view3d_update(Depsgraph *depsgraph,
|
|||
else {
|
||||
RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type);
|
||||
if (updated) {
|
||||
DRW_notify_view_update((&(DRWUpdateContext){
|
||||
.bmain = bmain,
|
||||
.depsgraph = depsgraph,
|
||||
.scene = scene,
|
||||
.view_layer = view_layer,
|
||||
.region = region,
|
||||
.v3d = v3d,
|
||||
.engine_type = engine_type,
|
||||
}));
|
||||
DRWUpdateContext drw_context = {0};
|
||||
drw_context.bmain = bmain;
|
||||
drw_context.depsgraph = depsgraph;
|
||||
drw_context.scene = scene;
|
||||
drw_context.view_layer = view_layer;
|
||||
drw_context.region = region;
|
||||
drw_context.v3d = v3d;
|
||||
drw_context.engine_type = engine_type;
|
||||
DRW_notify_view_update(&drw_context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, const bool
|
|||
|
||||
recursive_check = true;
|
||||
|
||||
wmWindowManager *wm = bmain->wm.first;
|
||||
wmWindowManager *wm = static_cast<wmWindowManager *>(bmain->wm.first);
|
||||
LISTBASE_FOREACH (wmWindow *, window, &wm->windows) {
|
||||
bScreen *screen = WM_window_get_active_screen(window);
|
||||
|
||||
|
@ -166,13 +166,13 @@ void ED_render_engine_area_exit(Main *bmain, ScrArea *area)
|
|||
{
|
||||
/* clear all render engines in this area */
|
||||
ARegion *region;
|
||||
wmWindowManager *wm = bmain->wm.first;
|
||||
wmWindowManager *wm = static_cast<wmWindowManager *>(bmain->wm.first);
|
||||
|
||||
if (area->spacetype != SPACE_VIEW3D) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (region = area->regionbase.first; region; region = region->next) {
|
||||
for (region = static_cast<ARegion *>(area->regionbase.first); region; region = region->next) {
|
||||
if (region->regiontype != RGN_TYPE_WINDOW || !(region->regiondata)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -183,7 +183,8 @@ void ED_render_engine_area_exit(Main *bmain, ScrArea *area)
|
|||
void ED_render_engine_changed(Main *bmain, const bool update_scene_data)
|
||||
{
|
||||
/* on changing the render engine type, clear all running render engines */
|
||||
for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
|
||||
for (bScreen *screen = static_cast<bScreen *>(bmain->screens.first); screen;
|
||||
screen = static_cast<bScreen *>(screen->id.next)) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
ED_render_engine_area_exit(bmain, area);
|
||||
}
|
||||
|
@ -192,7 +193,8 @@ void ED_render_engine_changed(Main *bmain, const bool update_scene_data)
|
|||
/* Inform all render engines and draw managers. */
|
||||
DEGEditorUpdateContext update_ctx = {NULL};
|
||||
update_ctx.bmain = bmain;
|
||||
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = static_cast<Scene *>(bmain->scenes.first); scene;
|
||||
scene = static_cast<Scene *>(scene->id.next)) {
|
||||
update_ctx.scene = scene;
|
||||
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
|
||||
/* TDODO(sergey): Iterate over depsgraphs instead? */
|
||||
|
@ -258,14 +260,16 @@ static void texture_changed(Main *bmain, Tex *tex)
|
|||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_id_ensure(&tex->id));
|
||||
|
||||
for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
|
||||
for (scene = static_cast<Scene *>(bmain->scenes.first); scene;
|
||||
scene = static_cast<Scene *>(scene->id.next)) {
|
||||
/* paint overlays */
|
||||
for (view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
|
||||
for (view_layer = static_cast<ViewLayer *>(scene->view_layers.first); view_layer;
|
||||
view_layer = view_layer->next) {
|
||||
BKE_paint_invalidate_overlay_tex(scene, view_layer, tex);
|
||||
}
|
||||
/* find compositing nodes */
|
||||
if (scene->use_nodes && scene->nodetree) {
|
||||
for (node = scene->nodetree->nodes.first; node; node = node->next) {
|
||||
for (node = static_cast<bNode *>(scene->nodetree->nodes.first); node; node = node->next) {
|
||||
if (node->id == &tex->id) {
|
||||
ED_node_tag_update_id(&scene->id);
|
||||
}
|
||||
|
@ -288,7 +292,8 @@ static void image_changed(Main *bmain, Image *ima)
|
|||
BKE_icon_changed(BKE_icon_id_ensure(&ima->id));
|
||||
|
||||
/* textures */
|
||||
for (tex = bmain->textures.first; tex; tex = tex->id.next) {
|
||||
for (tex = static_cast<Tex *>(bmain->textures.first); tex;
|
||||
tex = static_cast<Tex *>(tex->id.next)) {
|
||||
if (tex->type == TEX_IMAGE && tex->ima == ima) {
|
||||
texture_changed(bmain, tex);
|
||||
}
|
||||
|
@ -300,7 +305,8 @@ static void scene_changed(Main *bmain, Scene *scene)
|
|||
Object *ob;
|
||||
|
||||
/* glsl */
|
||||
for (ob = bmain->objects.first; ob; ob = ob->id.next) {
|
||||
for (ob = static_cast<Object *>(bmain->objects.first); ob;
|
||||
ob = static_cast<Object *>(ob->id.next)) {
|
||||
if (ob->mode & OB_MODE_TEXTURE_PAINT) {
|
||||
BKE_texpaint_slots_refresh_object(scene, ob);
|
||||
ED_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
#include "wm_window.h"
|
||||
|
||||
#include "render_intern.h"
|
||||
#include "render_intern.hh"
|
||||
|
||||
/*********************** utilities for finding areas *************************/
|
||||
|
||||
|
@ -63,7 +63,7 @@ static ScrArea *biggest_non_image_area(bContext *C)
|
|||
int size, maxsize = 0, bwmaxsize = 0;
|
||||
short foundwin = 0;
|
||||
|
||||
for (area = screen->areabase.first; area; area = area->next) {
|
||||
for (area = static_cast<ScrArea *>(screen->areabase.first); area; area = area->next) {
|
||||
if (area->winx > 30 && area->winy > 30) {
|
||||
size = area->winx * area->winy;
|
||||
if (!area->full && area->spacetype == SPACE_PROPERTIES) {
|
||||
|
@ -90,13 +90,13 @@ static ScrArea *find_area_showing_r_result(bContext *C, Scene *scene, wmWindow *
|
|||
SpaceImage *sima;
|
||||
|
||||
/* find an imagewindow showing render result */
|
||||
for (*win = wm->windows.first; *win; *win = (*win)->next) {
|
||||
for (*win = static_cast<wmWindow *>(wm->windows.first); *win; *win = (*win)->next) {
|
||||
if (WM_window_get_active_scene(*win) == scene) {
|
||||
const bScreen *screen = WM_window_get_active_screen(*win);
|
||||
|
||||
for (area = screen->areabase.first; area; area = area->next) {
|
||||
for (area = static_cast<ScrArea *>(screen->areabase.first); area; area = area->next) {
|
||||
if (area->spacetype == SPACE_IMAGE) {
|
||||
sima = area->spacedata.first;
|
||||
sima = static_cast<SpaceImage *>(area->spacedata.first);
|
||||
if (sima->image && sima->image->type == IMA_TYPE_R_RESULT) {
|
||||
break;
|
||||
}
|
||||
|
@ -118,9 +118,9 @@ static ScrArea *find_area_image_empty(bContext *C)
|
|||
SpaceImage *sima;
|
||||
|
||||
/* find an imagewindow showing render result */
|
||||
for (area = screen->areabase.first; area; area = area->next) {
|
||||
for (area = static_cast<ScrArea *>(screen->areabase.first); area; area = area->next) {
|
||||
if (area->spacetype == SPACE_IMAGE) {
|
||||
sima = area->spacedata.first;
|
||||
sima = static_cast<SpaceImage *>(area->spacedata.first);
|
||||
if ((sima->mode == SI_MODE_VIEW) && !sima->image) {
|
||||
break;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports)
|
|||
|
||||
area = CTX_wm_area(C);
|
||||
if (BLI_listbase_is_single(&area->spacedata) == false) {
|
||||
sima = area->spacedata.first;
|
||||
sima = static_cast<SpaceImage *>(area->spacedata.first);
|
||||
sima->flag |= SI_PREVSPACE;
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports)
|
|||
area = biggest_non_image_area(C);
|
||||
if (area) {
|
||||
ED_area_newspace(C, area, SPACE_IMAGE, true);
|
||||
sima = area->spacedata.first;
|
||||
sima = static_cast<SpaceImage *>(area->spacedata.first);
|
||||
|
||||
/* Makes "Escape" go back to previous space. */
|
||||
sima->flag |= SI_PREVSPACE;
|
||||
|
@ -228,7 +228,7 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports)
|
|||
area = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TYPE_ANY, 0);
|
||||
if (area->spacetype != SPACE_IMAGE) {
|
||||
// XXX newspace(area, SPACE_IMAGE);
|
||||
sima = area->spacedata.first;
|
||||
sima = static_cast<SpaceImage *>(area->spacedata.first);
|
||||
|
||||
/* Makes "Escape" go back to previous space. */
|
||||
sima->flag |= SI_PREVSPACE;
|
||||
|
@ -236,7 +236,7 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports)
|
|||
}
|
||||
}
|
||||
}
|
||||
sima = area->spacedata.first;
|
||||
sima = static_cast<SpaceImage *>(area->spacedata.first);
|
||||
sima->link_flag |= SPACE_FLAG_TYPE_TEMPORARY;
|
||||
|
||||
/* get the correct image, and scale it */
|
||||
|
@ -272,7 +272,7 @@ static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
SpaceImage *sima = area->spacedata.first;
|
||||
SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
|
||||
|
||||
/* ensure image editor full-screen and area full-screen states are in sync */
|
||||
if ((sima->flag & SI_FULLWINDOW) && !area->full) {
|
||||
|
@ -333,7 +333,7 @@ static int render_view_show_invoke(bContext *C, wmOperator *op, const wmEvent *e
|
|||
ScrArea *area = find_area_showing_r_result(C, CTX_data_scene(C), &winshow);
|
||||
|
||||
/* is there another window on current scene showing result? */
|
||||
for (win = CTX_wm_manager(C)->windows.first; win; win = win->next) {
|
||||
for (win = static_cast<wmWindow *>(CTX_wm_manager(C)->windows.first); win; win = win->next) {
|
||||
const bScreen *screen = WM_window_get_active_screen(win);
|
||||
|
||||
if ((WM_window_is_temp_screen(win) &&
|
||||
|
@ -348,7 +348,7 @@ static int render_view_show_invoke(bContext *C, wmOperator *op, const wmEvent *e
|
|||
if (area) {
|
||||
/* but don't close it when rendering */
|
||||
if (G.is_rendering == false) {
|
||||
SpaceImage *sima = area->spacedata.first;
|
||||
SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
|
||||
|
||||
if (sima->flag & SI_PREVSPACE) {
|
||||
sima->flag &= ~SI_PREVSPACE;
|
Loading…
Reference in New Issue