Merge branch 'blender-v4.1-release'
This commit is contained in:
@@ -137,6 +137,11 @@ void DRW_draw_depth_object(
|
||||
Scene *scene, ARegion *region, View3D *v3d, GPUViewport *viewport, Object *object);
|
||||
void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d);
|
||||
|
||||
/**
|
||||
* Query that drawing is in progress (use to prevent nested draw calls).
|
||||
*/
|
||||
bool DRW_draw_in_progress();
|
||||
|
||||
/* Grease pencil render. */
|
||||
|
||||
/**
|
||||
|
||||
@@ -650,6 +650,9 @@ typedef struct DRWManager {
|
||||
|
||||
bool buffer_finish_called; /* Avoid bad usage of DRW_render_instance_buffer_finish */
|
||||
|
||||
/** True, when drawing is in progress, see #DRW_draw_in_progress. */
|
||||
bool in_progress;
|
||||
|
||||
DRWView *view_default;
|
||||
DRWView *view_active;
|
||||
DRWView *view_previous;
|
||||
|
||||
@@ -517,6 +517,8 @@ static void drw_manager_init(DRWManager *dst, GPUViewport *viewport, const int s
|
||||
RegionView3D *rv3d = dst->draw_ctx.rv3d;
|
||||
ARegion *region = dst->draw_ctx.region;
|
||||
|
||||
dst->in_progress = true;
|
||||
|
||||
int view = (viewport) ? GPU_viewport_active_view_get(viewport) : 0;
|
||||
|
||||
if (!dst->viewport && dst->vmempool) {
|
||||
@@ -647,6 +649,7 @@ static void drw_manager_exit(DRWManager *dst)
|
||||
/* Avoid accidental reuse. */
|
||||
drw_state_ensure_not_reused(dst);
|
||||
#endif
|
||||
dst->in_progress = false;
|
||||
}
|
||||
|
||||
DefaultFramebufferList *DRW_viewport_framebuffer_list_get()
|
||||
@@ -2930,6 +2933,11 @@ void DRW_draw_depth_object(
|
||||
GPU_framebuffer_free(depth_fb);
|
||||
}
|
||||
|
||||
bool DRW_draw_in_progress()
|
||||
{
|
||||
return DST.in_progress;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
@@ -111,3 +111,10 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Depsgraph *depsgraph,
|
||||
GPUOffScreen *ofs,
|
||||
GPUViewport *viewport,
|
||||
char err_out[256]);
|
||||
|
||||
/**
|
||||
* Drawing off-screen is not supported while drawing,
|
||||
* this is a simple check to use when the code path may occur within a draw call
|
||||
* (Python scripting for example).
|
||||
*/
|
||||
bool ED_view3d_draw_offscreen_check_nested();
|
||||
|
||||
@@ -2144,6 +2144,11 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Depsgraph *depsgraph,
|
||||
err_out);
|
||||
}
|
||||
|
||||
bool ED_view3d_draw_offscreen_check_nested()
|
||||
{
|
||||
return DRW_draw_in_progress();
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
@@ -449,6 +449,13 @@ static PyObject *pygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *ar
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (ED_view3d_draw_offscreen_check_nested()) {
|
||||
/* NOTE(@ideasman42): Nested draw calls could be supported.
|
||||
* Adding support for this looks to be possible but non-trivial. */
|
||||
PyErr_SetString(PyExc_RuntimeError, "Nested off-screen drawing not supported");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BLI_assert(BKE_id_is_in_global_main(&scene->id));
|
||||
|
||||
depsgraph = BKE_scene_ensure_depsgraph(G_MAIN, scene, view_layer);
|
||||
|
||||
Reference in New Issue
Block a user