149 switch (event->
type) {
195 float *rect,
int channels,
int width,
int height,
int stride)
199 for (
int y = 0;
y < height;
y++) {
200 float *pixels = rect + size_t(stride) *
y * channels;
201 for (
int x = 0;
x < width;
x++, pixels += channels) {
202 if (
fabsf(pixels[0] - 0.5f) < 1.0f / 255.0f) {
203 pixels[0] = 0.5f + 1e-5f;
205 if (
fabsf(pixels[1] - 0.5f) < 1.0f / 255.0f) {
206 pixels[1] = 0.5f + 1e-5f;
213 const int image_tile_number,
219 const char margin_type,
221 const bool is_noncolor,
222 const bool is_tangent_normal,
223 Mesh const *mesh_eval,
225 const float uv_offset[2])
230 char *mask_buffer =
nullptr;
231 const size_t pixels_num = size_t(width) * size_t(height);
235 iuser.
tile = image_tile_number;
242 if (margin > 0 || !is_clear) {
251 const char *from_colorspace;
252 const char *to_colorspace;
263 if (from_colorspace != to_colorspace) {
265 buffer, ibuf->
x, ibuf->
y, ibuf->
channels, from_colorspace, to_colorspace,
false);
268 else if (!is_float && is_tangent_normal) {
328 RE_bake_margin(ibuf, mask_buffer, margin, margin_type, mesh_eval, uv_layer, uv_offset);
367 const int margin_type,
369 const bool is_noncolor,
370 const bool is_tangent_normal,
371 Mesh const *mesh_eval,
373 const float uv_offset[2])
375 ImBuf *ibuf =
nullptr;
379 is_float = im_format->
depth > 8;
408 buffer, ibuf->
x, ibuf->
y, ibuf->
channels, from_colorspace, to_colorspace,
false);
410 else if (is_tangent_normal) {
430 char *mask_buffer =
nullptr;
431 const size_t pixels_num = size_t(width) * size_t(height);
435 RE_bake_margin(ibuf, mask_buffer, margin, margin_type, mesh_eval, uv_layer, uv_offset);
444 chmod(filepath, S_IRUSR | S_IWUSR);
457 return ELEM(pass_type,
477 if (base ==
nullptr) {
494 if (
mesh->faces_num == 0) {
503 "Mesh does not have an active color attribute \"%s\"",
511 reports,
RPT_ERROR,
"No active UV layer found in the object \"%s\"", ob->
id.
name + 2);
517 const bNode *node =
nullptr;
518 const int mat_nr =
i + 1;
536 "Circular dependency for image \"%s\" from object \"%s\"",
556 "Uninitialized image \"%s\" from object \"%s\"",
567 if (mat !=
nullptr) {
570 "No active and selected image texture node found in material \"%s\" (%d) "
579 "No active image found in material slot (%d) for object \"%s\"",
594 const int pass_filter,
616 "Combined bake pass requires Emission, or a light pass with "
617 "Direct or Indirect contributions enabled");
623 "Combined bake pass requires Emission, or a light pass with "
624 "Direct or Indirect contributions enabled");
639 "Bake pass requires Direct, Indirect, or Color contributions to be enabled");
656 const bool is_selected_to_active,
662 if (is_selected_to_active) {
678 "Object \"%s\" is not a mesh or cannot be converted to a mesh (Curve, Text, "
679 "Surface or Metaball)",
686 if (tot_objects == 0) {
720 const bool preserve_origindex)
738 int materials_num = ob->
totcol;
740 if (materials_num == 0) {
743 reports,
RPT_ERROR,
"No active image found, add a material or bake to an external file");
750 "No active image found, add a material or bake without the Split Materials option");
762 targets->
images =
nullptr;
764 for (
int i = 0;
i < materials_num;
i++) {
766 const bNode *node =
nullptr;
816 bk_image->
width = ibuf->
x;
821 targets->
pixels_num += size_t(ibuf->
x) * size_t(ibuf->
y);
849 pixel_array + bk_image->
offset,
869 "Problem saving the bake map internally for object \"%s\"",
875 reports,
RPT_INFO,
"Baking map saved to internal image, save it externally or pack it");
940 bake->im_format.imtype,
945 "Path parsing errors should only occur when a variable map is provided.");
954 if (ob_eval->
mat[
i]) {
957 else if (mesh_eval->
mat[
i]) {
976 pixel_array + bk_image->
offset,
1014 BKE_report(reports,
RPT_ERROR,
"Color attribute baking is only supported for mesh objects");
1034 bk_image->
width = std::ceil(std::sqrt(
mesh->corners_num));
1037 bk_image->
image =
nullptr;
1046 const int *vert_origindex,
1047 const int *poly_origindex,
1048 const int poly_eval,
1049 const int vert_eval)
1053 const int vert_orig = vert_origindex[vert_eval];
1054 const int poly_orig_index = poly_origindex[poly_eval];
1061 const IndexRange orig_face = orig_faces[poly_orig_index];
1062 const int *poly_verts_orig = &orig_corner_verts[orig_face.
start()];
1063 for (
int j = 0; j < orig_face.
size(); ++j) {
1064 if (poly_verts_orig[j] == vert_orig) {
1065 return orig_face.
start() + j;
1081 for (
int i = 0;
i < pixels_num;
i++) {
1087 pixel->
du_dx = 0.0f;
1088 pixel->
du_dy = 0.0f;
1089 pixel->
dv_dx = 0.0f;
1090 pixel->
dv_dy = 0.0f;
1091 pixel->
uv[0] = 0.0f;
1092 pixel->
uv[1] = 0.0f;
1099 const Span<int> corner_verts = mesh_eval->corner_verts();
1103 {corner_tris, corner_tris_num});
1104 const Span<int> tri_faces = mesh_eval->corner_tri_faces();
1107 const int *vert_origindex =
static_cast<const int *
>(
1109 const int *poly_origindex =
static_cast<const int *
>(
1114 for (
int i = 0;
i < corner_tris_num;
i++) {
1115 const int3 &tri = corner_tris[
i];
1116 const int face_i = tri_faces[
i];
1118 for (
int j = 0; j < 3; j++) {
1120 const int v = corner_verts[
l];
1123 if (vert_origindex !=
nullptr && poly_origindex !=
nullptr) {
1125 orig_faces, orig_corner_verts, vert_origindex, poly_origindex, face_i,
v);
1146 pixel->
uv[0] = 1.0f;
1147 pixel->
uv[1] = 0.0f;
1150 pixel->
uv[0] = 0.0f;
1151 pixel->
uv[1] = 1.0f;
1154 pixel->
uv[0] = 0.0f;
1155 pixel->
uv[1] = 0.0f;
1165 if (channels_num == 4) {
1168 else if (channels_num == 3) {
1182 const bool is_noncolor,
1186 for (
int i = 0;
i <
num;
i++) {
1191 for (
int i = 0;
i <
num;
i++) {
1201 &
mesh->id,
mesh->active_color_attribute);
1211 const int totvert =
mesh->verts_num;
1212 const int totloop =
mesh->corners_num;
1220 for (
int i = 0;
i < totloop;
i++) {
1221 const int v = corner_verts[
i];
1223 num_loops_for_vertex[
v]++;
1227 for (
int i = 0;
i < totvert;
i++) {
1228 if (num_loops_for_vertex[
i] > 0) {
1255 memcpy(active_color_layer->
data, mcol,
sizeof(
MPropCol) *
mesh->verts_num);
1259 mcol, totvert, is_noncolor,
static_cast<MLoopCol *
>(active_color_layer->
data));
1299 for (
int i = 0;
i <
mesh->corners_num;
i++) {
1306 for (
int i = 0;
i <
mesh->corners_num;
i++) {
1354 "bake return pixels");
1387 bkr, targets, ob, ob_eval, mesh_eval, pixel_array, reports);
1428 Object *ob_cage =
nullptr;
1429 Object *ob_cage_eval =
nullptr;
1430 Object *ob_low_eval =
nullptr;
1433 int highpoly_num = 0;
1435 Mesh *me_low_eval =
nullptr;
1436 Mesh *me_cage_eval =
nullptr;
1439 int mmd_flags_low = 0;
1459 const std::optional<bke::AttributeMetaData> meta_data = attributes.
lookup_meta_data(
1464 "No UV layer named \"%s\" found in the object \"%s\"",
1477 if (ob_iter == ob_low) {
1485 ob_cage =
static_cast<Object *
>(
1488 if (ob_cage ==
nullptr || ob_cage->
type !=
OB_MESH) {
1497 "Cage object \"%s\" not found in evaluated scene, it may be hidden",
1514 mmd_flags_low = mmd_low->
flags;
1538 "No UV map found in the evaluated object \"%s\"",
1556 "Invalid cage object, the cage mesh must have the same number "
1557 "of faces as the active object");
1562 bool is_changed =
false;
1594 nullptr, ob_low_eval,
false, preserve_origindex,
true);
1599 "No UV map found in the evaluated object \"%s\"",
1612 if (ob_iter == ob_low) {
1620 "Object \"%s\" not found in evaluated scene, it may be hidden",
1631 highpoly[
i].
ob = ob_iter;
1633 highpoly[
i].
mesh = mesh_eval;
1636 copy_m4_m4(highpoly[
i].obmat, highpoly[
i].ob->object_to_world().ptr());
1651 if (
UNLIKELY(mesh_eval ==
nullptr)) {
1655 "Failed to access mesh from object \"%s\", ensure it's visible while rendering",
1663 if (ob_cage !=
nullptr) {
1684 ob_low_eval->object_to_world().ptr(),
1685 (ob_cage ? ob_cage->object_to_world().ptr() : ob_low_eval->object_to_world().ptr()),
1693 for (
i = 0;
i < highpoly_num;
i++) {
1696 highpoly[
i].ob_eval,
1705 reports,
RPT_ERROR,
"Error baking from object \"%s\"", highpoly[
i].ob->id.name + 2);
1766 ob_low_eval->object_to_world().ptr());
1770 Mesh *me_nores =
nullptr;
1783 if (check_valid_uv_map &&
1788 "No UV map found in the evaluated object \"%s\"",
1800 (me_nores) ? me_nores : me_low_eval,
1802 ob_low_eval->object_to_world().ptr());
1823 bkr, &targets, ob_low, ob_low_eval, me_low_eval, pixel_array_low, reports))
1837 for (
int i = 0;
i < highpoly_num;
i++) {
1838 if (highpoly[
i].
mesh !=
nullptr) {
1846 mmd_low->
flags = mmd_flags_low;
1849 if (pixel_array_low) {
1853 if (pixel_array_high) {
1859 if (me_low_eval !=
nullptr) {
1863 if (me_cage_eval !=
nullptr) {
1949 G.is_rendering =
true;
1960 G.is_rendering =
false;
1973 G.is_rendering =
false;
1998 G.is_rendering =
false;
2071 G.is_rendering =
false;
2122 op->
ptr, prop, (
bake->cage_object) ?
bake->cage_object->id.name + 2 :
"");
2209 "Baking texture...",
2220 G.is_rendering =
true;
2239 ot->description =
"Bake image textures of selected objects";
2240 ot->idname =
"OBJECT_OT_bake";
2254 "Type of pass to bake, some of them may not be supported by the current render engine");
2260 "Filter to combined, diffuse, glossy, transmission and subsurface passes");
2266 "Image filepath to use when saving externally");
2273 "Horizontal dimension of the baking map (external only)",
2282 "Vertical dimension of the baking map (external only)",
2291 "Extends the baked result as a post process filter",
2299 "Which algorithm to use to generate the margin");
2301 "use_selected_to_active",
2303 "Selected to Active",
2304 "Bake shading on the surface of selected objects to the active object");
2311 "The maximum ray distance for matching points between the active and selected "
2312 "objects. If zero, there is no limit",
2321 "Inflate the active object by the specified distance for baking. This helps "
2322 "matching to points nearer to the outside of the selected object meshes",
2330 "Object to use as cage, instead of calculating the cage from the active object "
2331 "with cage extrusion");
2337 "Choose normal space for baking");
2343 "Axis to bake in red channel");
2350 "Axis to bake in green channel");
2357 "Axis to bake in blue channel");
2364 "Where to output the baked map");
2370 "Where to save baked image textures");
2375 "Clear images before baking (only for internal saving)");
2376 RNA_def_boolean(
ot->srna,
"use_cage",
false,
"Cage",
"Cast rays to active object from a cage");
2379 "use_split_materials",
2382 "Split baked maps per material, using material name in output file (external only)");
2384 "use_automatic_name",
2387 "Automatically name the output file with the pass type");
2393 "UV layer to override active");
blender::bke::AttrDomain BKE_attribute_domain(const AttributeOwner &owner, const struct CustomDataLayer *layer)
const struct CustomDataLayer * BKE_id_attributes_color_find(const struct ID *id, blender::StringRef name)
void BKE_callback_exec_id(Main *bmain, ID *id, eCbEvent evt)
@ BKE_CB_EVT_OBJECT_BAKE_CANCEL
@ BKE_CB_EVT_OBJECT_BAKE_COMPLETE
@ BKE_CB_EVT_OBJECT_BAKE_PRE
bScreen * CTX_wm_screen(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
bool CTX_data_selected_objects(const bContext *C, blender::Vector< PointerRNA > *list)
Main * CTX_data_main(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
int CustomData_get_offset_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
bool CustomData_has_layer(const CustomData *data, eCustomDataType type)
int CustomData_get_active_layer_index(const CustomData *data, eCustomDataType type)
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
void BKE_image_mark_dirty(Image *image, ImBuf *ibuf)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
void BKE_image_get_tile_uv(const Image *ima, const int tile_number, float r_uv[2])
void BKE_imageuser_default(ImageUser *iuser)
void BKE_image_free_gputextures(Image *ima)
bool BKE_imbuf_write(ImBuf *ibuf, const char *filepath, const ImageFormatData *imf)
void BKE_image_partial_update_mark_full_update(Image *image)
Mark the whole image to be updated.
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
void BKE_main_id_tag_idcode(Main *mainvar, short type, int tag, bool value)
void BKE_id_free(Main *bmain, void *idv)
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
General operations, lookup, etc. for materials.
Material * BKE_object_material_get(Object *ob, short act)
Mesh * BKE_mesh_new_from_object(Depsgraph *depsgraph, Object *object, bool preserve_all_data_layers, bool preserve_origindex, bool ensure_subdivision)
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
void BKE_modifier_free(ModifierData *md)
General operations, lookup, etc. for blender objects.
void BKE_object_eval_reset(Object *ob_eval)
void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *ob)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
void BKE_scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain)
ScrArea * BKE_screen_find_big_area(const bScreen *screen, int spacetype, short min)
#define BLI_assert_msg(a, msg)
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE void linearrgb_to_srgb_uchar4(unsigned char srgb[4], const float linear[4])
MINLINE int poly_to_tri_count(int poly_count, int corner_count)
void copy_m4_m4(float m1[4][4], const float m2[4][4])
bool is_negative_m4(const float mat[4][4])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
MINLINE void mul_v4_fl(float r[4], float f)
MINLINE void add_v4_v4(float r[4], const float a[4])
MINLINE void zero_v4(float r[4])
MINLINE void add_v3_v3(float r[3], const float a[3])
ATTR_WARN_UNUSED_RESULT const size_t num
bool bool BLI_path_suffix(char *path, size_t path_maxncpy, const char *suffix, const char *sep) ATTR_NONNULL(1
#define SNPRINTF_UTF8(dst, format,...)
#define UNUSED_VARS_NDEBUG(...)
#define BLT_I18NCONTEXT_COLOR
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_disable_visibility_optimization(Depsgraph *depsgraph)
Depsgraph * DEG_graph_new(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluationMode mode)
void DEG_graph_free(Depsgraph *graph)
void DEG_graph_build_from_view_layer(Depsgraph *graph)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
#define MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX
@ BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT
@ eModifierType_EdgeSplit
Object is a sort of wrapper for general info.
@ R_BAKE_TARGET_VERTEX_COLORS
@ R_BAKE_TARGET_IMAGE_TEXTURES
@ R_BAKE_PASS_FILTER_DIFFUSE
@ R_BAKE_PASS_FILTER_NONE
@ R_BAKE_PASS_FILTER_COLOR
@ R_BAKE_PASS_FILTER_SUBSURFACE
@ R_BAKE_PASS_FILTER_INDIRECT
@ R_BAKE_PASS_FILTER_DIRECT
@ R_BAKE_PASS_FILTER_GLOSSY
@ R_BAKE_PASS_FILTER_EMIT
@ R_BAKE_PASS_FILTER_TRANSM
@ SCE_PASS_SUBSURFACE_COLOR
struct wmOperator wmOperator
void ED_mesh_split_faces(Mesh *mesh)
bool ED_operator_object_active_editable_mesh(bContext *C)
bool ED_object_get_active_image(Object *ob, int mat_nr, Image **r_ima, ImageUser **r_iuser, const bNode **r_node, const bNodeTree **r_ntree)
const char * IMB_colormanagement_get_rect_colorspace(const ImBuf *ibuf)
void IMB_colormanagement_transform_float(float *buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace, bool predivide)
@ COLOR_ROLE_SCENE_LINEAR
const char * IMB_colormanagement_role_colorspace_name_get(int role)
const char * IMB_colormanagement_get_float_colorspace(const ImBuf *ibuf)
void IMB_buffer_float_from_float_mask(float *rect_to, const float *rect_from, int channels_from, int width, int height, int stride_to, int stride_from, char *mask)
void IMB_buffer_byte_from_float(unsigned char *rect_to, const float *rect_from, int channels_from, float dither, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from, int start_y=0)
void IMB_buffer_float_from_float(float *rect_to, const float *rect_from, int channels_from, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from)
void IMB_buffer_byte_from_float_mask(unsigned char *rect_to, const float *rect_from, int channels_from, float dither, bool predivide, int width, int height, int stride_to, int stride_from, char *mask)
void IMB_freeImBuf(ImBuf *ibuf)
ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
@ IB_DISPLAY_BUFFER_INVALID
#define IB_PROFILE_LINEAR_RGB
Read Guarded memory(de)allocation.
#define MEM_recallocN(vmemh, len)
@ WM_JOB_TYPE_OBJECT_BAKE
void RE_bake_pixels_populate(Mesh *mesh, BakePixel pixel_array[], const size_t pixels_num, const BakeTargets *targets, const blender::StringRef uv_layer)
void RE_bake_normal_world_to_tangent(const BakePixel pixel_array[], const size_t pixels_num, const int depth, float result[], Mesh *mesh, const eBakeNormalSwizzle normal_swizzle[3], const float mat[4][4])
void RE_bake_margin(ImBuf *ibuf, char *mask, const int margin, const char margin_type, const Mesh *mesh, const blender::StringRef uv_layer, const float uv_offset[2])
int RE_pass_depth(const eScenePassType pass_type)
void RE_bake_ibuf_clear(Image *image, const bool is_tangent)
void RE_bake_normal_world_to_world(const BakePixel pixel_array[], const size_t pixels_num, const int depth, float result[], const eBakeNormalSwizzle normal_swizzle[3])
void RE_bake_normal_world_to_object(const BakePixel pixel_array[], const size_t pixels_num, const int depth, float result[], Object *ob, const eBakeNormalSwizzle normal_swizzle[3])
void RE_bake_mask_fill(const BakePixel pixel_array[], const size_t pixels_num, char *mask)
bool RE_bake_pixels_populate_from_objects(Mesh *me_low, BakePixel pixel_array_from[], BakePixel pixel_array_to[], BakeHighPolyData highpoly[], const int highpoly_num, const size_t pixels_num, const bool is_custom_cage, const float cage_extrusion, const float max_ray_distance, const float mat_low[4][4], const float mat_cage[4][4], Mesh *me_cage)
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert * v
BPy_StructRNA * depsgraph
static AttributeOwner from_id(ID *id)
constexpr int64_t size() const
constexpr int64_t start() const
constexpr bool is_empty() const
std::optional< AttributeMetaData > lookup_meta_data(StringRef attribute_id) const
bool RE_bake_engine(Render *re, Depsgraph *depsgraph, Object *object, const int object_id, const BakePixel pixel_array[], const BakeTargets *targets, const eScenePassType pass_type, const int pass_filter, float result[])
bool RE_bake_has_engine(const Render *re)
void RE_bake_engine_set_engine_parameters(Render *re, Main *bmain, Scene *scene)
const ccl_global KernelWorkTile * tile
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_callocN(size_t len, const char *str)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
#define unit_float_to_uchar_clamp_v4(v1, v2)
void corner_tris_calc(Span< float3 > vert_positions, OffsetIndices< int > faces, Span< int > corner_verts, MutableSpan< int3 > corner_tris)
bool node_is_connected_to_output(const bNodeTree &ntree, const bNode &node)
static void convert_float_color_to_byte_color(const MPropCol *float_colors, const int num, const bool is_noncolor, MLoopCol *byte_colors)
static bool bake_objects_check(Main *bmain, const Scene *scene, ViewLayer *view_layer, Object *ob, Span< PointerRNA > selected_objects, ReportList *reports, const bool is_selected_to_active, const eBakeTarget target)
static Mesh * bake_mesh_new_from_object(Depsgraph *depsgraph, Object *object, const bool preserve_origindex)
static bool bake_targets_init(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, Object *ob_eval, ReportList *reports)
static void bake_startjob(void *bkv, wmJobWorkerStatus *worker_status)
static void bake_targets_populate_pixels_color_attributes(BakeTargets *targets, Object *ob, Mesh *mesh_eval, BakePixel *pixel_array)
static void bake_targets_refresh(BakeTargets *targets)
static bool write_external_bake_pixels(const char *filepath, BakePixel pixel_array[], float *buffer, const int width, const int height, const int margin, const int margin_type, ImageFormatData const *im_format, const bool is_noncolor, const bool is_tangent_normal, Mesh const *mesh_eval, const StringRef uv_layer, const float uv_offset[2])
static void bake_job_complete(void *bkv)
static int find_original_loop(const OffsetIndices< int > orig_faces, const Span< int > orig_corner_verts, const int *vert_origindex, const int *poly_origindex, const int poly_eval, const int vert_eval)
void OBJECT_OT_bake(wmOperatorType *ot)
static bool bake_object_check(const Scene *scene, ViewLayer *view_layer, Object *ob, const eBakeTarget target, ReportList *reports)
static bool bake_break(void *)
static void bake_job_canceled(void *bkv)
static wmOperatorStatus bake_modal(bContext *C, wmOperator *, const wmEvent *event)
static bool bake_targets_output_internal(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, BakePixel *pixel_array, ReportList *reports, Mesh *mesh_eval)
static void bake_update_image(ScrArea *area, Image *image)
static wmOperatorStatus bake_invoke(bContext *C, wmOperator *op, const wmEvent *)
static void bake_targets_populate_pixels(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, Mesh *mesh_eval, BakePixel *pixel_array)
static bool write_internal_bake_pixels(Image *image, const int image_tile_number, BakePixel pixel_array[], float *buffer, const int width, const int height, const int margin, const char margin_type, const bool is_clear, const bool is_noncolor, const bool is_tangent_normal, Mesh const *mesh_eval, const StringRef uv_layer, const float uv_offset[2])
static wmOperatorStatus bake(const BakeAPIRender *bkr, Object *ob_low, const Span< PointerRNA > selected_objects, ReportList *reports)
static void bake_freejob(void *bkv)
static void bake_init_api_data(wmOperator *op, bContext *C, BakeAPIRender *bkr)
static bool bake_targets_output_vertex_colors(BakeTargets *targets, Object *ob)
static void bias_tangent_normal_pixels(float *rect, int channels, int width, int height, int stride)
static bool bake_pass_filter_check(eScenePassType pass_type, const int pass_filter, ReportList *reports)
static bool bake_targets_init_image_textures(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, ReportList *reports)
static bool bake_targets_output(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, Object *ob_eval, Mesh *mesh_eval, BakePixel *pixel_array, ReportList *reports)
static void bake_targets_free(BakeTargets *targets)
static bool bake_targets_init_vertex_colors(Main *bmain, BakeTargets *targets, Object *ob, ReportList *reports)
static bool bake_targets_init_internal(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, ReportList *reports)
static bool bake_targets_init_external(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, ReportList *reports)
static void bake_progress_update(void *bjv, float progress)
static void bake_set_props(wmOperator *op, Scene *scene)
static void bake_targets_clear(Main *bmain, const bool is_tangent)
static bool bake_targets_output_external(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, Object *ob_eval, Mesh *mesh_eval, BakePixel *pixel_array, ReportList *reports)
bool editmode_load(Main *bmain, Object *obedit)
static bool is_noncolor_pass(eScenePassType pass_type)
static void bake_result_add_to_rgba(float rgba[4], const float *result, const int channels_num)
static wmOperatorStatus bake_exec(bContext *C, wmOperator *op)
VecBase< int32_t, 3 > int3
bool RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **r_identifier)
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
int RNA_int_get(PointerRNA *ptr, const char *name)
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
float RNA_float_get(PointerRNA *ptr, const char *name)
std::string RNA_string_get(PointerRNA *ptr, const char *name)
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_string_file_path(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
const EnumPropertyItem rna_enum_bake_pass_type_items[]
const EnumPropertyItem rna_enum_normal_swizzle_items[]
const EnumPropertyItem rna_enum_bake_pass_filter_type_items[]
const EnumPropertyItem rna_enum_bake_save_mode_items[]
const EnumPropertyItem rna_enum_bake_margin_type_items[]
const EnumPropertyItem rna_enum_bake_target_items[]
const EnumPropertyItem rna_enum_normal_space_items[]
void RE_progress_cb(Render *re, void *handle, void(*f)(void *handle, float))
void RE_test_break_cb(Render *re, void *handle, bool(*f)(void *handle))
Render * RE_NewSceneRender(const Scene *scene)
void RE_SetReports(Render *re, ReportList *reports)
struct Image ** material_to_image
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
struct ModifierData * next
Vector< PointerRNA > selected_objects
eBakeNormalSwizzle normal_swizzle[3]
char custom_cage[MAX_NAME]
bool is_selected_to_active
eBakeMarginType margin_type
struct ReportList * reports
void WM_cursor_wait(bool val)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_jobs_timer(wmJob *wm_job, double time_step, uint note, uint endnote)
void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
wmJob * WM_jobs_get(wmWindowManager *wm, wmWindow *win, const void *owner, const char *name, const eWM_JobFlag flag, const eWM_JobType job_type)
void WM_jobs_callbacks_ex(wmJob *wm_job, wm_jobs_start_callback startjob, void(*initjob)(void *), void(*update)(void *), void(*endjob)(void *), void(*completed)(void *), void(*canceled)(void *))
bool WM_jobs_test(const wmWindowManager *wm, const void *owner, int job_type)
void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void(*free)(void *customdata))