WIP: GPv3 - Add support to material render previews #113944

Closed
Antonio Vazquez wants to merge 2 commits from antoniov/blender:gpv3_previews into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
5 changed files with 18 additions and 4 deletions

Binary file not shown.

View File

@ -905,6 +905,7 @@ if(WITH_BLENDER)
# Blend files.
data_to_c_simple(../../../../release/datafiles/preview.blend SRC)
data_to_c_simple(../../../../release/datafiles/preview_grease_pencil.blend SRC)
data_to_c_simple(../../../../release/datafiles/preview_grease_pencil_legacy.blend SRC)
# Images.
data_to_c_simple(../../../../release/datafiles/splash.png SRC)

View File

@ -23,6 +23,9 @@ extern const char datatoc_preview_blend[];
extern int datatoc_preview_grease_pencil_blend_size;
extern const char datatoc_preview_grease_pencil_blend[];
extern int datatoc_preview_grease_pencil_legacy_blend_size;
extern const char datatoc_preview_grease_pencil_legacy_blend[];
extern int datatoc_blender_icons16_png_size;
extern const char datatoc_blender_icons16_png[];

View File

@ -194,8 +194,16 @@ void ED_preview_ensure_dbase(const bool with_gpencil)
base_initialized = true;
}
if (!base_initialized_gpencil && with_gpencil) {
G_pr_main_grease_pencil = load_main_from_memory(datatoc_preview_grease_pencil_blend,
datatoc_preview_grease_pencil_blend_size);
if (U.experimental.use_grease_pencil_version3) {
G_pr_main_grease_pencil = load_main_from_memory(datatoc_preview_grease_pencil_blend,
datatoc_preview_grease_pencil_blend_size);
}
else {
G_pr_main_grease_pencil = load_main_from_memory(
datatoc_preview_grease_pencil_legacy_blend,
datatoc_preview_grease_pencil_legacy_blend_size);
}
base_initialized_gpencil = true;
}
#else
@ -419,7 +427,8 @@ static const char *preview_world_name(const Scene *sce,
* this approximation.
*/
if (id_type == ID_MA && pr_method == PR_ICON_RENDER &&
!render_engine_supports_ray_visibility(sce)) {
!render_engine_supports_ray_visibility(sce))
{
return "WorldFloor";
}
return "World";
@ -1437,7 +1446,8 @@ static void icon_preview_startjob(void *customdata, bool *stop, bool *do_update)
* only get existing `ibuf`. */
ibuf = BKE_image_acquire_ibuf(ima, &iuser, nullptr);
if (ibuf == nullptr ||
(ibuf->byte_buffer.data == nullptr && ibuf->float_buffer.data == nullptr)) {
(ibuf->byte_buffer.data == nullptr && ibuf->float_buffer.data == nullptr))
{
BKE_image_release_ibuf(ima, ibuf, nullptr);
return;
}