178 const int fileflags =
G.fileflags;
179 Main *bmain =
nullptr;
188 G.fileflags = fileflags;
197 static bool base_initialized =
false;
198 static bool base_initialized_gpencil =
false;
200 if (!base_initialized) {
202 base_initialized =
true;
204 if (!base_initialized_gpencil && with_gpencil) {
207 base_initialized_gpencil =
true;
238 if (pr_main ==
nullptr) {
242 return pr_main->
scenes.first();
255 return "Shader Ball";
261 return "World Sphere";
301 return "FloorHidden";
311 if (
mesh->totcol == 0) {
331 if (
STREQ(base.object->id.name + 2,
"Floor")) {
338 if (base.object->type ==
OB_MESH) {
340 pr_main, id_cast<Mesh *>(base.object->data), scene, pr_method);
359 if (world ==
nullptr) {
371 sp->
worldcopy = id_cast<World *>(id_copy);
392 world->nodetree = ntree;
426 switch (
GS(
id->name)) {
446 return &instance_empty->
id;
453 if (!allow_failure) {
503 dst->range = src->range;
560 if (id_type ==
ID_TE) {
565 if (id_type ==
ID_MA) {
566 Material *mat =
nullptr, *origmat = id_cast<Material *>(
id);
587 const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
591 const float dark[4] = {0.05f, 0.05f, 0.05f, 0.05f};
604 if (base.object->id.name[2] ==
'p') {
612 int actcol =
max_ii(base.object->actcol - 1, 0);
614 if (matar && actcol < base.object->totcol) {
615 (*matar)[actcol] = mat;
618 else if (base.object->type ==
OB_LAMP) {
624 else if (id_type ==
ID_TE) {
625 Tex *tex =
nullptr, *origtex = id_cast<Tex *>(
id);
634 else if (id_type ==
ID_LA) {
635 Light *la =
nullptr, *origla = id_cast<Light *>(
id);
650 const float black[4] = {0.0f, 0.0f, 0.0f, 0.0f};
656 if (base.object->id.name[2] ==
'p') {
657 if (base.object->type ==
OB_LAMP) {
658 base.object->data = id_cast<ID *>(la);
663 else if (id_type ==
ID_WO) {
664 World *wrld =
nullptr, *origwrld = id_cast<World *>(
id);
686 Scene *scene,
const void *owner,
int split,
int first,
const rcti *rect,
rcti *newrect)
694 const void *split_owner = (!
split || first) ? owner :
695 static_cast<char *
>(
const_cast<void *
>(owner)) + 1;
705 newx = newx - newx / 2;
718 if (!rres.
views.is_empty()) {
727 if (rv && rv->
ibuf) {
733 float fx = rect->
xmin + offx;
734 float fy = rect->
ymin;
755 ID *
id =
static_cast<ID *
>(idp);
756 ID *parent =
static_cast<ID *
>(parentp);
757 MTex *slot =
static_cast<MTex *
>(slotp);
791 if (sbuts !=
nullptr) {
846 float dummy_scale[3];
851 const float eul[3] = {
M_PI * 0.4f, 0.0f,
M_PI * 0.1f};
859 (id_cast<Camera *>(
camera->data))->lens = 85;
865 Depsgraph **r_depsgraph)
882 preview_data->
pr_main, scene, view_layer, preview_data->
object);
884 scene->
camera = camera_object;
898 preview_data->
pr_main, depsgraph, scene, camera_object);
902 *r_depsgraph = depsgraph;
911 char err_out[256] =
"unknown";
916 preview_data.
pr_main = preview_main;
920 preview_data.
sizex = prv_img->
w[icon_size];
921 preview_data.
sizey = prv_img->
h[icon_size];
923 Depsgraph *depsgraph;
939 prv_img->
w[icon_size],
940 prv_img->
h[icon_size],
978 if (
object ==
nullptr) {
982 if (
object->pose ==
nullptr) {
984 "Object %s has no pose, unable to apply the Action before rendering",
1014 if (pose_backup ==
nullptr) {
1034 char err_out[256] =
"";
1036 Depsgraph *depsgraph = preview->
depsgraph;
1048 if (camera_eval ==
nullptr) {
1049 printf(
"Scene has no camera, unable to render preview of %s without it.\n",
1061 prv_img->
w[icon_size],
1062 prv_img->
h[icon_size],
1073 if (err_out[0] !=
'\0') {
1074 printf(
"Error rendering Action %s preview: %s\n", preview->
id->
name + 2, err_out);
1093 return scene->
camera !=
nullptr;
1101 Depsgraph *depsgraph = preview->
depsgraph;
1110 if (camera_eval ==
nullptr) {
1113 "Scene has no camera, unable to render preview of %s without it.",
1118 char err_out[256] =
"";
1125 prv_img->
w[icon_size],
1126 prv_img->
h[icon_size],
1135 if (err_out[0] !=
'\0') {
1138 "Error rendering Scene %s preview: %s.",
1177 int width = sp->
sizex;
1178 int height = sp->
sizey;
1198 float tex_coord[3] = {0.0f, 0.0f, 0.0f};
1200 for (
int y = 0;
y < height;
y++) {
1202 tex_coord[1] = (
float(
y) /
float(height)) * 2.0f - 1.0f;
1204 for (
int x = 0;
x < width;
x++) {
1205 tex_coord[0] = (
float(
x) /
float(height)) * 2.0f - 1.0f;
1233 short idtype =
GS(
id->name);
1240 sizex = sp->
sizex / 2;
1253 sce->
r.
xsch = sizex;
1260 if (sce ==
nullptr) {
1264 const void *split_owner = (!
split || first) ?
1266 static_cast<char *
>(
const_cast<void *
>(sp->
owner)) + 1;
1270 if (re ==
nullptr) {
1294 oldlens = (id_cast<Camera *>(sce->
camera->
data))->lens;
1295 if (sizex > sp->
sizey) {
1300 if (idtype ==
ID_TE) {
1308 (id_cast<Camera *>(sce->
camera->
data))->lens = oldlens;
1322 if (idtype ==
ID_TE) {
1361 ID *main_id_copy =
nullptr;
1362 ID *sub_id_copy =
nullptr;
1365 main_id_copy = id_cast<ID *>(sp->
matcopy);
1370 main_id_copy = id_cast<ID *>(sp->
texcopy);
1376 sub_id_copy = id_cast<ID *>(sp->
worldcopy);
1379 main_id_copy = id_cast<ID *>(sp->
worldcopy);
1385 main_id_copy = id_cast<ID *>(sp->
lampcopy);
1421 float scaledx, scaledy;
1422 if (ibuf->
x > ibuf->
y) {
1427 scaledx = (
float(ibuf->
x) /
float(ibuf->
y)) *
float(h);
1432 int ex = std::max<int>(1, scaledx);
1433 int ey = std::max<int>(1, scaledy);
1435 int dx = (
w - ex) / 2;
1436 int dy = (h - ey) / 2;
1439 if (ima ==
nullptr) {
1451 drect += dy *
w + dx;
1452 for (; ey > 0; ey--) {
1453 memcpy(drect, srect, ex *
sizeof(
int));
1461static void set_alpha(
char *cp,
int sizex,
int sizey,
char alpha)
1463 int a, size = sizex * sizey;
1465 for (a = 0; a < size; a++, cp += 4) {
1480 short idtype =
GS(
id->name);
1484 if (idtype ==
ID_IM) {
1485 Image *ima = id_cast<Image *>(
id);
1486 ImBuf *ibuf =
nullptr;
1490 if (ima ==
nullptr) {
1519 if (idtype ==
ID_WO) {
1558 sp->
sizex = prv_img->
w[icon_size];
1559 sp->
sizey = prv_img->
h[icon_size];
1573 ma = id_cast<Material *>(ip->
id);
1576 if ((ma ==
nullptr) || (ma->gp_style ==
nullptr)) {
1606 if (worker_status->
stop) {
1625 const bool use_solid_render_mode = (ip->
id !=
nullptr) &&
1643 bool rendered =
false;
1644 if (ip->
id !=
nullptr) {
1667 ip->
owner =
nullptr;
1685 if (worker_status->
stop) {
1716 ip->
owner =
nullptr;
1736 enum class PreviewState :
uint8_t {
1747 struct RequestedPreview {
1751 std::atomic<PreviewState>
state = PreviewState::NotStarted;
1761 bool is_queued =
false;
1764 : preview(preview), icon_size(icon_size)
1767 RequestedPreview(RequestedPreview &&other)
1768 : preview(other.preview), icon_size(other.icon_size),
state(other.state.load())
1779 std::mutex todo_queue_mutex_;
1782 void todo_queue_push(RequestedPreview *request);
1784 RequestedPreview *todo_queue_pop(
int wait_time_msec);
1796 std::mutex requested_previews_mutex_;
1820 static void update_fn(
void *customdata);
1821 static void end_fn(
void *customdata);
1822 static void free_fn(
void *customdata);
1825 static void finish_request(RequestedPreview &request);
1839 return known_downloaded_previews;
1848 PreviewLoadJob *job_data = MEM_new<PreviewLoadJob>(
"PreviewLoadJobData");
1867 run_fn(&job_data, &worker_status);
1868 update_fn(&job_data);
1880 "Preview was already requested and is being loaded");
1890 !PreviewLoadJob::known_downloaded_previews().contains_as(*path);
1892 const std::pair key = std::make_pair(*path, icon_size);
1894 RequestedPreview *request =
nullptr;
1896 std::lock_guard
lock(requested_previews_mutex_);
1905 if (std::unique_ptr<RequestedPreview> *existing_request_uptr = requested_previews_.lookup_ptr(
1908 RequestedPreview *existing_request = existing_request_uptr->get();
1909 if (existing_request->preview != preview) {
1914 existing_request->preview = preview;
1919 std::unique_ptr<RequestedPreview> new_request = std::make_unique<RequestedPreview>(preview,
1921 request = new_request.get();
1923 if (is_downloading) {
1924 request->state = PreviewState::Downloading;
1927 request->state = PreviewState::LoadingFromDisk;
1929 requested_previews_.add(key, std::move(new_request));
1936 this->todo_queue_push(request);
1939void PreviewLoadJob::todo_queue_push(PreviewLoadJob::RequestedPreview *request)
1941 std::lock_guard
lock(this->todo_queue_mutex_);
1942 if (request->is_queued) {
1947 request->is_queued =
true;
1950PreviewLoadJob::RequestedPreview *PreviewLoadJob::todo_queue_pop(
const int wait_time_msec)
1952 RequestedPreview *request =
static_cast<RequestedPreview *
>(
1975 std::lock_guard
lock(this->todo_queue_mutex_);
1980 request->is_queued =
false;
1991 "This function is meant to be called from external code, not from the job");
1996 PreviewLoadJob::known_downloaded_previews().add_as(preview_full_filepath);
2000 bool has_request =
false;
2004 std::lock_guard
lock(load_job->requested_previews_mutex_);
2007 const std::pair key = std::make_pair(preview_full_filepath,
eIconSizes(size));
2008 std::unique_ptr<RequestedPreview> *request_uptr = load_job->requested_previews_.
lookup_ptr(
2010 if (!request_uptr) {
2014 RequestedPreview *request = request_uptr->get();
2016 if (request->state != PreviewState::Downloading) {
2021 request->state = PreviewState::LoadingFromDisk;
2022 load_job->todo_queue_push(request);
2029 PreviewLoadJob::known_downloaded_previews().add_as(preview_full_filepath);
2038 PreviewLoadJob::known_downloaded_previews().remove_as(preview_full_filepath);
2047 bool has_work =
true;
2051 while (has_work && !worker_status->
stop) {
2052 RequestedPreview *request = job_data->todo_queue_pop(100);
2054 if (worker_status->
stop) {
2058 has_work = request !=
nullptr;
2061 std::lock_guard
lock(job_data->requested_previews_mutex_);
2062 for (std::unique_ptr<RequestedPreview> &check_request :
2063 job_data->requested_previews_.
values())
2065 const PreviewState
state = check_request->state.load();
2066 if (
ELEM(
state, PreviewState::Downloading, PreviewState::LoadingFromDisk)) {
2077 BLI_assert(request->state != PreviewState::NotStarted);
2081 BLI_assert(!
ELEM(request->state, PreviewState::Ready, PreviewState::Failed));
2083 if (request->state == PreviewState::Downloading) {
2091 PreviewImage *preview = request->preview;
2096 if (!source || !filepath) {
2111 preview->
w[request->icon_size] = thumb->
x;
2112 preview->
h[request->icon_size] = thumb->
y;
2114 preview->
rect[request->icon_size] =
reinterpret_cast<uint *
>(
2119 preview->
w[request->icon_size],
2120 preview->
h[request->icon_size],
2121 preview->
rect[request->icon_size]);
2126 request->state = thumb ? PreviewState::Ready : PreviewState::Failed;
2134void PreviewLoadJob::finish_request(RequestedPreview &request)
2138 PreviewImage *preview = request.preview;
2146void PreviewLoadJob::update_fn(
void *customdata)
2150 Vector<std::pair<StringRef, eIconSizes>> finished_requests;
2152 std::lock_guard
lock(job_data->requested_previews_mutex_);
2153 for (
const auto item : job_data->requested_previews_.
items()) {
2154 std::unique_ptr<RequestedPreview> &requested = item.value;
2157 if (
ELEM(requested->state, PreviewState::Ready, PreviewState::Failed)) {
2158 finish_request(*requested);
2159 finished_requests.
append(item.key);
2163 for (
auto &key : finished_requests) {
2164 job_data->requested_previews_.
remove(key);
2168void PreviewLoadJob::end_fn(
void *customdata)
2172 std::lock_guard
lock(job_data->requested_previews_mutex_);
2174 for (std::unique_ptr<RequestedPreview> &request : job_data->requested_previews_.
values()) {
2175 finish_request(*request);
2177 job_data->requested_previews_.
clear();
2180void PreviewLoadJob::free_fn(
void *customdata)
2208 if (
id ==
nullptr) {
2214 const auto [
result, disabled_hint] = [
id]() -> std::pair<bool, const char *> {
2215 switch (
GS(
id->name)) {
2217 return {
false,
RPT_(
"Node groups do not support automatic previews")};
2220 RPT_(
"Object type does not support automatic previews")};
2224 RPT_(
"Collection does not contain object types that can be rendered for the automatic "
2228 RPT_(
"Scenes without a camera do not support previews")};
2230 return {
false,
RPT_(
"Brushes do not support automatic previews")};
2244 return {
false,
RPT_(
"Screens do not support automatic previews")};
2247 return {
false,
RPT_(
"Data-block type does not support automatic previews")};
2251 if (
result ==
false && disabled_hint && r_disabled_hint) {
2252 *r_disabled_hint = disabled_hint;
2284 ip.
scene = icon_scene;
2341 "Generating icon preview...",
2360 ip->
scene = icon_scene;
2371 ip->
owner = prv_img;
2419 "Generating shader preview...",
2442 if (id_type ==
ID_MA) {
2443 ma = id_cast<Material *>(
id);
2446 if ((ma ==
nullptr) || (ma->gp_style ==
nullptr)) {
2487 if (
wm && preview) {
Functions and classes to work with Actions.
Functions to work with animation poses.
General operations, lookup, etc. for blender lights.
#define FOREACH_MAIN_ID_END
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)
General operations, lookup, etc. for materials.
General operations, lookup, etc. for blender objects.
#define STRNCPY_UTF8(dst, src)
external readfile function prototypes.
#define ID_IS_EDITABLE(_id)
Object groups, one object can be in many groups at once.
Object is a sort of wrapper for general info.
#define OB_TYPE_IS_GEOMETRY(_type)
#define OB_TYPE_SUPPORT_MATERIAL(_type)
const char datatoc_preview_grease_pencil_blend[]
int datatoc_preview_grease_pencil_blend_size
const char datatoc_preview_blend[]
int datatoc_preview_blend_size
Read Blender memory allocation and freeing.
#define BLI_assert_unreachable()
#define ARRAY_SET_ITEMS(...)
#define BLI_assert_msg(a, msg)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
const Value * lookup_ptr(const Key &key) const
ValueIterator values() const &
bool remove(const Key &key)
ItemIterator items() const &
static void load_jobless(PreviewImage *preview, eIconSizes icon_size)
static PreviewLoadJob & ensure_job(wmWindowManager *wm, wmWindow *win)
static void on_download_requested(StringRef preview_full_filepath)
void push_load_request(PreviewImage *preview, eIconSizes icon_size)
static void on_download_completed(wmWindowManager *wm, StringRef preview_full_filepath)
void append(const T &value)
void camera(KernelGlobals &kg, const ShadingData &sd, float3 &outview, float &outdepth, float &outdist)
void pose_apply_action_all_bones(Object *ob, bAction *action, slot_handle_t slot_handle, const AnimationEvalContext *anim_eval_context)
Slot & get_best_pose_slot_for_id(const ID &id, Action &pose_data)
bNode * node_find_node_by_name(bNodeTree &ntree, StringRefNull name)
bNode * node_add_node(const bContext *C, bNodeTree &ntree, UString idname, std::optional< int > unique_identifier=std::nullopt)
bNodeLink & node_add_link(bNodeTree &ntree, bNode &fromnode, bNodeSocket &fromsock, bNode &tonode, bNodeSocket &tosock)
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, UString identifier)
void node_set_active(bNodeTree &ntree, bNode &node)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
BLI_INLINE Texture * wrap(MTLTexture *texture)
void split(const std::string &s, const char delim, std::vector< std::string > &tokens)
void icon_render_id(const bContext *C, Scene *scene, ID *id, enum eIconSizes size, bool use_job)
static void switch_preview_floor_visibility(Main *pr_main, const Scene *scene, ViewLayer *view_layer, const ePreviewRenderMethod pr_method)
bool ED_preview_id_render_is_supported(const ID *id, const char **r_disabled_hint=nullptr)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
Render * RE_GetRender(const void *owner)
Object * BKE_object_add(Main *bmain, Scene *scene, ViewLayer *view_layer, ObjectType type, const char *name) ATTR_NONNULL(1
void WM_global_reportf(eReportType type, const char *format,...)
static bool ed_preview_draw_rect(Scene *scene, const void *owner, int split, int first, const rcti *rect, rcti *newrect)
static void object_preview_render(const PreviewImage *prv_img, IconPreview *preview, const eIconSizes icon_size)
ScrArea * CTX_wm_area(const bContext *C)
void eul_to_mat3(float mat[3][3], const float eul[3])
void mat4_to_loc_rot_size(float loc[3], float rot[3][3], float size[3], const float wmat[4][4])
void BKE_previewimg_id_free(ID *id)
RenderView * RE_RenderViewGetById(RenderResult *rr, const int view_id)
void IMB_thumb_locks_release()
void ED_preview_kill_jobs_for_id(wmWindowManager *wm, const ID *id)
static bool preview_kill_jobs_for_undo
bool BKE_previewimg_render_restart(PreviewImage *prv, int size)
void ED_preview_restart_work(const bContext *C)
void DEG_graph_build_from_view_layer(Depsgraph *graph)
@ BLI_THREAD_QUEUE_WORK_PRIORITY_NORMAL
void RE_ResultGet32(Render *re, uint8_t *dst)
static bool shader_preview_break(void *spv)
void WM_jobs_callbacks(wmJob *wm_job, wm_jobs_start_callback startjob, void(*initjob)(void *), void(*update)(void *), void(*endjob)(void *))
static ID * duplicate_ids(ID *id, const bool allow_failure)
void WM_jobs_delay_start(wmJob *wm_job, double delay_time)
static void shader_preview_update(void *spv, RenderResult *)
void BKE_previewimg_clear_single(PreviewImage *prv, enum eIconSizes size)
void RE_test_break_cb(Render *re, void *handle, bool(*f)(void *handle))
bool BKE_previewimg_is_online(const PreviewImage *prv)
void IMB_thumb_path_unlock(const char *path)
static bool preview_method_is_render(const ePreviewRenderMethod pr_method)
void * BLI_thread_queue_pop_timeout(ThreadQueue *queue, int ms)
Material *** BKE_object_material_array_p(Object *ob)
void DEG_graph_free(Depsgraph *graph)
void ED_preview_kill_jobs_for_undo(wmWindowManager *wm, Main *bmain)
@ PRV_TAG_DEFERRED_DELETE
void BKE_screen_view3d_shading_init(View3DShading *shading)
@ BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT
void BKE_previewimg_render_end(PreviewImage *prv, int size, PreviewImageRenderEndStatus status)
void mul_m3_m3_post(float R[3][3], const float B[3][3])
static World * preview_get_world_simple(ShaderPreview *sp)
std::optional< int > BKE_previewimg_deferred_thumb_source_get(const PreviewImage *prv)
bool ED_preview_use_image_size(const PreviewImage *preview, eIconSizes size)
void BKE_pose_backup_restore(const struct PoseBackup *pbd)
static void shader_preview_updatejob(void *)
@ WM_JOB_TYPE_LOAD_PREVIEW
@ WM_JOB_TYPE_RENDER_PREVIEW
static void common_preview_startjob(void *customdata, wmJobWorkerStatus *worker_status)
static Object * object_preview_camera_create(Main *preview_main, Scene *scene, ViewLayer *view_layer, Object *preview_object)
void ED_draw_imbuf(const ImBuf *ibuf, float x, float y, bool use_filter, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, float zoom_x, float zoom_y)
void IMB_thumb_locks_acquire()
static void icon_copy_rect(const ImBuf *ibuf, uint w, uint h, uint *rect)
void BKE_id_free_ex(Main *bmain, void *idv, int flag_orig, bool use_flag_from_idtag)
Depsgraph * DEG_graph_new(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluationMode mode)
void BKE_texture_get_value_ex(struct Tex *texture, const float *tex_co, struct TexResult *texres, struct ImagePool *pool, bool use_color_management)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
@ V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS
void RE_SetScene(Render *re, Scene *sce)
World * ED_preview_prepare_world_simple(Main *bmain)
wmWindow * CTX_wm_window(const bContext *C)
static bool object_preview_is_type_supported(const Object *ob)
MINLINE int max_ii(int a, int b)
MINLINE void copy_v4_fl4(float v[4], float x, float y, float z, float w)
static void switch_preview_floor_material(Main *pr_main, Mesh *mesh, const Scene *scene, const ePreviewRenderMethod pr_method)
void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void(*free)(void *customdata))
void BKE_texture_fetch_images_for_pool(struct Tex *texture, struct ImagePool *pool)
const char * BKE_id_name(const ID &id)
static void other_id_types_preview_render(const PreviewImage *prv_img, IconPreview *ip, const eIconSizes icon_size, const ePreviewRenderMethod pr_method, wmJobWorkerStatus *worker_status)
void DEG_evaluate_on_refresh(Depsgraph *graph, DepsgraphEvaluateSyncWriteback sync_writeback=DEG_EVALUATE_SYNC_WRITEBACK_NO)
static const char * preview_world_name(const Scene *sce, const ID_Type id_type, const ePreviewRenderMethod pr_method)
Render * RE_NewRender(const void *owner)
void BKE_color_managed_view_settings_copy(ColorManagedViewSettings *new_settings, const ColorManagedViewSettings *settings)
World * ED_preview_prepare_world(Main *pr_main, const Scene *scene, const World *world, ID_Type id_type, ePreviewRenderMethod pr_method)
static Scene * preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_type, ShaderPreview *sp)
static bool action_preview_render(const PreviewImage *prv_img, IconPreview *preview, const eIconSizes icon_size)
static void shader_preview_free(void *customdata)
@ LIB_ID_COPY_NO_ANIMDATA
bool BKE_previewimg_id_supports_jobs(const ID *id)
void BKE_previewimg_render_start(PreviewImage *prv, int size, bool using_job)
void IMB_thumb_path_lock(const char *path)
PreviewImage ** BKE_previewimg_id_get_p(const ID *id)
static void icon_preview_endjob(void *customdata)
const char * RE_engine_id_BLENDER_EEVEE
void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
void BKE_libblock_free_data(ID *id, bool do_id_user) ATTR_NONNULL()
static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int first)
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
void * WM_jobs_customdata_get(wmJob *wm_job)
static void set_alpha(char *cp, int sizex, int sizey, char alpha)
void ED_preview_kill_jobs(wmWindowManager *wm, Main *bmain)
static World * preview_get_localized_world(ShaderPreview *sp, World *world)
static void icon_preview_free(void *customdata)
void ED_preview_world_simple_set_rgb(World *world, const float color[4])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
void IMB_freeImBuf(ImBuf *ibuf)
static void preview_sync_exposure(World *dst, const World *src)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
void BKE_color_managed_display_settings_copy(ColorManagedDisplaySettings *new_settings, const ColorManagedDisplaySettings *settings)
RenderResult * RE_AcquireResultWrite(Render *re)
@ PRV_RENDER_STATUS_CANCELLED
@ PRV_RENDER_STATUS_FAILED
@ PRV_RENDER_STATUS_FINISHED
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void DEG_id_tag_update(ID *id, unsigned int flags)
static bool scene_preview_is_supported(const Scene *scene)
static Main * G_pr_main_grease_pencil
bool WM_jobs_has_running(const wmWindowManager *window_manager, const void *owner, const eWM_JobType type, const eWM_JobFlag exclude_flags)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
bool BKE_collection_contains_geometry_recursive(const Collection *collection)
const char * ED_preview_collection_name(ePreviewType pr_type)
wmWindowManager * CTX_wm_manager(const bContext *C)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C, bool rna_write_check=false)
static void action_preview_render_cleanup(IconPreview *preview, PoseBackup *pose_backup)
void BKE_ntree_update_after_single_tree_change(Main &bmain, bNodeTree &modified_tree, const NodeTreeUpdateExtraParams ¶ms={})
PreviewImage * BKE_previewimg_id_ensure(ID *id)
void BKE_scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain)
Scene * BKE_scene_add(Main *bmain, const char *name)
static void shader_preview_startjob(void *customdata, bool *stop, bool *do_update)
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
static void switch_preview_collection_visibility(ViewLayer *view_layer, const ePreviewType pr_type)
static void icon_preview_startjob(void *customdata, bool *stop, bool *do_update)
bool BKE_collection_object_add(Main *bmain, Collection *collection, Object *ob)
bool ED_check_engine_supports_preview(const Scene *scene)
void BLI_thread_queue_free(ThreadQueue *queue)
static void icon_preview_startjob_all_sizes(void *customdata, wmJobWorkerStatus *worker_status)
void WM_global_report(eReportType type, const char *message)
ThreadQueue * BLI_thread_queue_init()
void ED_preview_set_visibility(Main *pr_main, Scene *scene, ViewLayer *view_layer, ePreviewType pr_type, ePreviewRenderMethod pr_method)
void ED_preview_online_download_finished(wmWindowManager *wm, StringRef preview_full_filepath)
void BKE_image_pool_free(ImagePool *pool)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
PreviewImage * BKE_previewimg_id_get(const ID *id)
void ED_preview_free_dbase()
RenderEngineType * RE_engines_find(const char *idname)
void BKE_main_free(Main *bmain)
struct World * BKE_world_add(struct Main *bmain, const char *name)
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
void ED_previews_tag_dirty_by_id(const Main &bmain, const ID &id)
void RE_InitState(Render *re, Render *source, const RenderData *rd, ListBaseT< ViewLayer > *, ViewLayer *single_layer, int winx, int winy, const rcti *disprect)
void WM_jobs_kill_type(wmWindowManager *wm, const void *owner, int job_type)
bool BKE_previewimg_is_rendering(const PreviewImage *prv, int size)
struct PoseBackup * BKE_pose_backup_create_all_bones(Span< Object * > objects, const struct bAction *action) ATTR_WARN_UNUSED_RESULT
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
ImBuf * IMB_thumb_manage(const char *file_or_lib_path, ThumbSize size, ThumbSource source, const ThumbCancellationToken *cancel_token=nullptr)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Main * CTX_data_main(const bContext *C)
void IMB_byte_from_float(ImBuf *ibuf)
void RE_display_update_cb(Render *re, void *handle, void(*f)(void *handle, RenderResult *rr))
void BKE_pose_backup_free(struct PoseBackup *pbd)
wmJob * WM_jobs_get(wmWindowManager *wm, wmWindow *win, const void *owner, const char *name, const eWM_JobFlag flag, const eWM_JobType job_type)
bool ED_view3d_camera_to_view_selected_with_set_clipping(Main *bmain, Depsgraph *depsgraph, const Scene *scene, Object *camera_ob)
std::optional< StringRefNull > BKE_previewimg_deferred_filepath_get(const PreviewImage *prv)
static bool render_engine_supports_ray_visibility(const Scene *sce)
ID_Type GS(const char *name)
Scene * DEG_get_input_scene(const Depsgraph *graph)
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
static void scene_preview_render(const PreviewImage *prv_img, IconPreview *preview, const eIconSizes icon_size, ReportList *reports)
static World * preview_get_world(Main *pr_main, const Scene *sce, const ID_Type id_type, const ePreviewRenderMethod pr_method)
BlendFileData * BLO_read_from_memory(const void *mem, int memsize, eBLOReadSkip skip_flags, ReportList *reports)
void BKE_color_managed_view_settings_free(ColorManagedViewSettings *settings)
Scene * CTX_data_scene(const bContext *C)
Depsgraph * BKE_scene_ensure_depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer)
MINLINE void copy_v4_v4(float r[4], const float a[4])
ImagePool * BKE_image_pool_new()
void RE_PreviewRender(Render *re, Main *bmain, Scene *sce)
ImBuf * RE_RenderViewEnsureImBuf(const RenderResult *render_result, RenderView *render_view)
void BKE_libblock_free_datablock(ID *id, int flag) ATTR_NONNULL()
void RE_AcquireResultImageViews(Render *re, RenderResult *rr)
static PoseBackup * action_preview_render_prepare(IconPreview *preview)
@ SCE_DISPLAY_AA_SAMPLES_8
void RE_ReleaseResult(Render *re)
ID * BKE_id_copy_ex(Main *bmain, const ID *id, ID **new_id_p, int flag)
static Scene * object_preview_scene_create(const ObjectPreviewData *preview_data, Depsgraph **r_depsgraph)
ImBuf * ED_view3d_draw_offscreen_imbuf_simple(Depsgraph *depsgraph, Scene *scene, View3DShading *shading_override, eDrawType drawtype, Object *camera, int width, int height, ImBufFlags imbuf_flags, eV3DOffscreenDrawFlag draw_flags, int alpha_mode, const char *viewname, GPUOffScreen *ofs, GPUViewport *viewport, char err_out[256])
Object * BKE_object_add_only_object(Main *bmain, ObjectType type, const char *name) ATTR_RETURNS_NONNULL
void ED_preview_online_download_requested(StringRef preview_full_filepath)
ImBuf * IMB_scale_into_new(const ImBuf *ibuf, int2 new_size, IMBScaleFilter filter, bool threaded=true)
uint64_t BLI_thread_queue_push(ThreadQueue *queue, void *work, ThreadQueueWorkPriority priority)
void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, uiPreview *ui_preview, rcti *rect)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
ViewLayer * BKE_view_layer_default_render(const Scene *scene)
SpaceProperties * CTX_wm_space_properties(const bContext *C)
void RE_ReleaseResultImageViews(Render *re, RenderResult *rr)
static void shader_preview_texture(ShaderPreview *sp, Tex *tex, Scene *sce, Render *re)
void BKE_imageuser_default(ImageUser *iuser)
static Main * load_main_from_memory(const void *blend, int blend_size)
Object * CTX_data_active_object(const bContext *C)
void WM_jobs_timer(wmJob *wm_job, double time_step, uint note, uint endnote, void(*timer_step)(void *))
static Scene * preview_get_scene(Main *pr_main)
ListBaseT< Base > * BKE_view_layer_object_bases_get(ViewLayer *view_layer)
void mat3_to_quat(float q[4], const float mat[3][3])
void ED_preview_shader_job(const bContext *C, const void *owner, ID *id, ID *parent, MTex *slot, int sizex, int sizey, ePreviewRenderMethod method)
void ED_preview_icon_render(const bContext *C, Scene *scene, PreviewImage *prv_img, ID *id, enum eIconSizes icon_size)
void ED_preview_ensure_dbase(bool with_gpencil)
void ED_preview_icon_job(const bContext *C, PreviewImage *prv_img, ID *id, enum eIconSizes icon_size, bool delay)
bool WM_jobs_is_running(const wmJob *wm_job)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void IMB_premultiply_alpha(ImBuf *ibuf)
static const char * preview_floor_material_name(const Scene *scene, const ePreviewRenderMethod pr_method)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
static void preview_id_copy_free(ID *id)
void * WM_jobs_customdata_from_type(wmWindowManager *wm, const void *owner, int job_type)
bool BKE_layer_collection_sync(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
ListBaseT< uiPreview > ui_previews
bool render_size[NUM_ICON_SIZES]
bool cancelled[NUM_ICON_SIZES]
const uint8_t * byte_data() const
const float * float_data() const
float * float_data_for_write()
void assign_float_data(float *data)
struct Collection * collection
ListBaseT< LayerCollection > layer_collections
struct LayerCollection * next
bool need_preview_render_restart
ListBaseT< Light > lights
ListBaseT< World > worlds
ListBaseT< Material > materials
ListBaseT< Object > objects
ListBaseT< Scene > scenes
ListBaseT< Tex > textures
ListBaseT< bScreen > screens
eObject_TransFlag transflag
struct Collection * instance_collection
bke::PreviewImageRuntime * runtime
ListBaseT< RenderView > views
eSceneDisplay_AA render_aa
ListBaseT< ViewLayer > view_layers
struct SceneDisplay display
struct Collection * master_collection
ColorManagedViewSettings view_settings
ColorManagedDisplaySettings display_settings
ListBaseT< ARegion > regionbase
ePreviewRenderMethod pr_method
struct bNodeTree * nodetree
eViewLayerEEVEEPassType render_passes
ListBaseT< LayerCollection > layer_collections
struct ViewLayerEEVEE eevee
ListBaseT< struct ScrArea > areabase
int16_t tag[NUM_ICON_SIZES]
std::unique_ptr< PreviewDeferredLoadingData > deferred_loading_data
unsigned int id_session_uid