157 switch (event->
type) {
173 return G.is_break || (bkr !=
nullptr && (bkr->
stop && *(bkr->
stop)));
208 float *rect,
int channels,
int width,
int height,
int stride)
212 for (
int y = 0;
y < height;
y++) {
213 float *pixels = rect + size_t(stride) *
y * channels;
214 for (
int x = 0;
x < width;
x++, pixels += channels) {
215 if (
fabsf(pixels[0] - 0.5f) < 1.0f / 255.0f) {
216 pixels[0] = 0.5f + 1e-5f;
218 if (
fabsf(pixels[1] - 0.5f) < 1.0f / 255.0f) {
219 pixels[1] = 0.5f + 1e-5f;
226 const int image_tile_number,
232 const char margin_type,
234 const bool is_noncolor,
235 const bool is_tangent_normal,
236 Mesh const *mesh_eval,
238 const float uv_offset[2])
243 char *mask_buffer =
nullptr;
244 const size_t pixels_num = size_t(width) * size_t(height);
248 iuser.
tile = image_tile_number;
255 if (margin > 0 || !is_clear) {
264 const char *from_colorspace;
265 const char *to_colorspace;
276 if (from_colorspace != to_colorspace) {
278 buffer, ibuf->
x, ibuf->
y, ibuf->
channels, from_colorspace, to_colorspace,
false);
281 else if (!is_float && is_tangent_normal) {
321 RE_bake_margin(ibuf, mask_buffer, margin, margin_type, mesh_eval, uv_layer, uv_offset);
330 MEM_delete(mask_buffer);
339 for (
int i = 0; i < targets->
images_num; i++) {
354 const int margin_type,
356 const bool is_noncolor,
357 const bool is_tangent_normal,
358 Mesh const *mesh_eval,
360 const float uv_offset[2])
362 ImBuf *ibuf =
nullptr;
364 bool is_float = im_format->
depth > 8;
385 buffer, ibuf->
x, ibuf->
y, ibuf->
channels, from_colorspace, to_colorspace,
false);
387 else if (is_tangent_normal) {
404 char *mask_buffer =
nullptr;
405 const size_t pixels_num = size_t(width) * size_t(height);
409 RE_bake_margin(ibuf, mask_buffer, margin, margin_type, mesh_eval, uv_layer, uv_offset);
412 MEM_delete(mask_buffer);
418 chmod(filepath, S_IRUSR | S_IWUSR);
431 return ELEM(pass_type,
452 if (base ==
nullptr) {
469 if (
mesh->faces_num == 0) {
478 "Mesh does not have an active color attribute \"%s\"",
484 if (!
mesh->uv_map_names().contains(
mesh->active_uv_map_name())) {
486 reports,
RPT_ERROR,
"No active UV layer found in the object \"%s\"", ob->
id.
name + 2);
490 for (
int i = 0; i < ob->
totcol; i++) {
493 const int mat_nr = i + 1;
511 "Circular dependency for image \"%s\" from object \"%s\"",
531 "Uninitialized image \"%s\" from object \"%s\"",
542 if (mat !=
nullptr) {
545 "No active and selected image texture node found in material \"%s\" (%d) "
554 "No active image found in material slot (%d) for object \"%s\"",
569 const int pass_filter,
591 "Combined bake pass requires Emission, or a light pass with "
592 "Direct or Indirect contributions enabled");
598 "Combined bake pass requires Emission, or a light pass with "
599 "Direct or Indirect contributions enabled");
614 "Bake pass requires Direct, Indirect, or Color contributions to be enabled");
631 const bool is_selected_to_active,
637 if (is_selected_to_active) {
644 for (
const PointerRNA &ptr : selected_objects) {
653 "Object \"%s\" is not a mesh or cannot be converted to a mesh (Curve, Text, "
654 "Surface or Metaball)",
661 if (tot_objects == 0) {
672 for (
const PointerRNA &ptr : selected_objects) {
674 *bmain, scene, view_layer,
static_cast<Object *
>(ptr.data), target, reports))
696 const bool preserve_origindex)
714 int materials_num = ob->
totcol;
716 if (materials_num == 0) {
719 reports,
RPT_ERROR,
"No active image found, add a material or bake to an external file");
726 "No active image found, add a material or bake without the Split Materials option");
738 targets->
images =
nullptr;
740 for (
int i = 0; i < materials_num; i++) {
781 for (
int i = 0; i < targets->
images_num; i++) {
792 bk_image->
width = ibuf->
x;
797 targets->
pixels_num += size_t(ibuf->
x) * size_t(ibuf->
y);
821 for (
int i = 0; i < targets->
images_num; i++) {
825 pixel_array + bk_image->
offset,
845 "Problem saving the bake map internally for object \"%s\"",
851 reports,
RPT_INFO,
"Baking map saved to internal image, save it externally or pack it");
868 for (
int i = 0; i < targets->
images_num; i++) {
904 for (
int i = 0; i < targets->
images_num; i++) {
916 bake->im_format.imtype,
921 "Path parsing errors should only occur when a variable map is provided.");
930 if (ob_eval->
mat[i]) {
933 else if (mesh_eval->
mat[i]) {
952 pixel_array + bk_image->
offset,
990 BKE_report(reports,
RPT_ERROR,
"Color attribute baking is only supported for mesh objects");
1010 bk_image->
width = std::ceil(std::sqrt(
mesh->corners_num));
1013 bk_image->
image =
nullptr;
1022 const int *vert_origindex,
1023 const int *poly_origindex,
1024 const int poly_eval,
1025 const int vert_eval)
1029 const int vert_orig = vert_origindex[vert_eval];
1030 const int poly_orig_index = poly_origindex[poly_eval];
1037 const IndexRange orig_face = orig_faces[poly_orig_index];
1038 const int *poly_verts_orig = &orig_corner_verts[orig_face.
start()];
1039 for (
int j = 0; j < orig_face.
size(); ++j) {
1040 if (poly_verts_orig[j] == vert_orig) {
1041 return orig_face.
start() + j;
1057 for (
int i = 0; i < pixels_num; i++) {
1063 pixel->
du_dx = 0.0f;
1064 pixel->
du_dy = 0.0f;
1065 pixel->
dv_dx = 0.0f;
1066 pixel->
dv_dy = 0.0f;
1067 pixel->
uv[0] = 0.0f;
1068 pixel->
uv[1] = 0.0f;
1076 const Span<int> corner_verts = mesh_eval->corner_verts();
1080 {corner_tris, corner_tris_num});
1081 const Span<int> tri_faces = mesh_eval->corner_tri_faces();
1084 const int *vert_origindex =
static_cast<const int *
>(
1086 const int *poly_origindex =
static_cast<const int *
>(
1091 for (
int i = 0; i < corner_tris_num; i++) {
1092 const int3 &tri = corner_tris[i];
1093 const int face_i = tri_faces[i];
1095 for (
int j = 0; j < 3; j++) {
1097 const int v = corner_verts[
l];
1100 if (vert_origindex !=
nullptr && poly_origindex !=
nullptr) {
1102 orig_faces, orig_corner_verts, vert_origindex, poly_origindex, face_i,
v);
1123 pixel->
uv[0] = 1.0f;
1124 pixel->
uv[1] = 0.0f;
1127 pixel->
uv[0] = 0.0f;
1128 pixel->
uv[1] = 1.0f;
1131 pixel->
uv[0] = 0.0f;
1132 pixel->
uv[1] = 0.0f;
1137 MEM_delete(corner_tris);
1142 if (channels_num == 4) {
1145 else if (channels_num == 3) {
1159 const bool is_noncolor,
1163 for (
int i = 0; i <
num; i++) {
1168 for (
int i = 0; i <
num; i++) {
1191 const int totvert =
mesh->verts_num;
1192 const int totloop =
mesh->corners_num;
1200 for (
int i = 0; i < totloop; i++) {
1201 const int v = corner_verts[i];
1203 num_loops_for_vertex[
v]++;
1207 for (
int i = 0; i < totvert; i++) {
1208 if (num_loops_for_vertex[i] > 0) {
1209 mul_v4_fl(mcol[i], 1.0f / num_loops_for_vertex[i]);
1245 MEM_SAFE_DELETE(num_loops_for_vertex);
1278 for (
int i = 0; i <
mesh->corners_num; i++) {
1285 for (
int i = 0; i <
mesh->corners_num; i++) {
1334 "bake return pixels");
1368 bkr, targets, ob, ob_eval, mesh_eval, pixel_array, reports);
1380 MEM_SAFE_DELETE(targets->
images);
1382 MEM_SAFE_DELETE(targets->
result);
1408 Object *ob_cage =
nullptr;
1409 Object *ob_cage_eval =
nullptr;
1410 Object *ob_low_eval =
nullptr;
1413 int highpoly_num = 0;
1415 Mesh *me_low_eval =
nullptr;
1416 Mesh *me_cage_eval =
nullptr;
1442 "No UV layer named \"%s\" found in the object \"%s\"",
1452 for (
const PointerRNA &ptr : selected_objects) {
1455 if (ob_iter == ob_low) {
1463 ob_cage =
static_cast<Object *
>(
1466 if (ob_cage ==
nullptr || ob_cage->
type !=
OB_MESH) {
1488 mmd_flags_low = mmd_low->
flags;
1501 if (ob_cage && (ob_cage_eval ==
nullptr || (ob_cage_eval->
id.
orig_id != &ob_cage->
id))) {
1504 "Cage object \"%s\" not found in evaluated scene, it may be hidden",
1517 "bake pixels low poly");
1519 if (check_valid_uv_map && me_low_eval->uv_map_names().is_empty()) {
1522 "No UV map found in the evaluated object \"%s\"",
1540 "Invalid cage object, the cage mesh must have the same number "
1541 "of faces as the active object");
1546 bool is_changed =
false;
1578 nullptr, ob_low_eval,
false, preserve_origindex,
true);
1579 if (check_valid_uv_map && me_cage_eval->uv_map_names().is_empty()) {
1582 "No UV map found in the evaluated object \"%s\"",
1592 for (
const PointerRNA &ptr : selected_objects) {
1595 if (ob_iter == ob_low) {
1603 "Object \"%s\" not found in evaluated scene, it may be hidden",
1614 highpoly[i].
ob = ob_iter;
1615 highpoly[i].
ob_eval = ob_eval;
1616 highpoly[i].
mesh = mesh_eval;
1619 copy_m4_m4(highpoly[i].obmat, highpoly[i].ob->object_to_world().ptr());
1634 if (mesh_eval ==
nullptr) [[unlikely]] {
1638 "Failed to access mesh from object \"%s\", ensure it's visible while rendering",
1646 if (ob_cage !=
nullptr) {
1656 "bake pixels high poly");
1668 ob_low_eval->object_to_world().ptr(),
1669 (ob_cage ? ob_cage->object_to_world().ptr() : ob_low_eval->object_to_world().ptr()),
1677 for (i = 0; i < highpoly_num; i++) {
1680 highpoly[i].ob_eval,
1689 reports,
RPT_ERROR,
"Error baking from object \"%s\"", highpoly[i].ob->id.name + 2);
1750 ob_low_eval->object_to_world().ptr());
1754 Mesh *me_nores =
nullptr;
1767 if (check_valid_uv_map && me_nores->uv_map_names().is_empty()) {
1770 "No UV map found in the evaluated object \"%s\"",
1783 (me_nores) ? me_nores : me_low_eval,
1785 ob_low_eval->object_to_world().ptr());
1808 bkr, &targets, ob_low, ob_low_eval, me_low_eval, pixel_array_low, reports);
1816 for (
int i = 0; i < highpoly_num; i++) {
1817 if (highpoly[i].
mesh !=
nullptr) {
1821 MEM_delete(highpoly);
1825 mmd_low->
flags = mmd_flags_low;
1828 if (pixel_array_low) {
1829 MEM_delete(pixel_array_low);
1832 if (pixel_array_high) {
1833 MEM_delete(pixel_array_high);
1838 if (me_low_eval !=
nullptr) {
1842 if (me_cage_eval !=
nullptr) {
1862 bkr->
stop =
nullptr;
1927 G.is_rendering =
true;
1938 G.is_rendering =
false;
1951 G.is_rendering =
false;
1985 G.is_rendering =
false;
2058 G.is_rendering =
false;
2111 op->
ptr, prop, (
bake->cage_object) ?
bake->cage_object->id.name + 2 :
"");
2198 "Baking texture...",
2209 G.is_rendering =
true;
2230 ot->
description =
"Bake image textures of selected objects";
2231 ot->
idname =
"OBJECT_OT_bake";
2245 "Type of pass to bake, some of them may not be supported by the current render engine");
2251 "Filter to combined, diffuse, glossy, transmission and subsurface passes");
2257 "Image filepath to use when saving externally");
2264 "Horizontal dimension of the baking map (external only)",
2273 "Vertical dimension of the baking map (external only)",
2282 "Extends the baked result as a post process filter",
2290 "Which algorithm to use to generate the margin");
2292 "use_selected_to_active",
2294 "Selected to Active",
2295 "Bake shading on the surface of selected objects to the active object");
2302 "The maximum ray distance for matching points between the active and selected "
2303 "objects. If zero, there is no limit",
2312 "Inflate the active object by the specified distance for baking. This helps "
2313 "matching to points nearer to the outside of the selected object meshes",
2321 "Object to use as cage, instead of calculating the cage from the active object "
2322 "with cage extrusion");
2328 "Choose normal space for baking");
2334 "Axis to bake in red channel");
2341 "Axis to bake in green channel");
2348 "Axis to bake in blue channel");
2355 "Where to output the baked map");
2361 "Where to save baked image textures");
2366 "Clear images before baking (only for internal saving)");
2367 RNA_def_boolean(ot->
srna,
"use_cage",
false,
"Cage",
"Cast rays to active object from a cage");
2370 "use_split_materials",
2373 "Split baked maps per material, using material name in output file (external only)");
2375 "use_automatic_name",
2378 "Automatically name the output file with the pass type");
2384 "UV layer to override active");
Generic geometry attributes built on CustomData.
General operations, lookup, etc. for materials.
General operations, lookup, etc. for blender objects.
#define SNPRINTF_UTF8(dst, format,...)
#define BLT_I18NCONTEXT_COLOR
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define UNUSED_VARS_NDEBUG(...)
#define BLI_assert_msg(a, msg)
#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)
#define MEM_realloc_zeroed(vmemh, len)
#define MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX
const CPPType & type() const
MutableSpan< T > typed() const
constexpr int64_t size() const
constexpr int64_t start() const
constexpr bool is_empty() const
std::optional< AttributeMetaData > lookup_meta_data(StringRef name) const
GSpanAttributeWriter lookup_for_write_span(StringRef name)
const ccl_global KernelWorkTile * tile
#define unit_float_to_uchar_clamp_v4(v1, v2)
bool is_uv_map(const AttributeMetaData &meta_data)
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 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 void convert_float_color_to_byte_color(const ColorGeometry4f *float_colors, const int num, const bool is_noncolor, ColorGeometry4b *byte_colors)
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 bool bake_has_been_canceled(const BakeAPIRender *bkr)
static void bake_targets_populate_pixels(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, Mesh *mesh_eval, BakePixel *pixel_array)
static bool bake_object_check(const Main &bmain, const Scene *scene, ViewLayer *view_layer, Object *ob, const eBakeTarget target, ReportList *reports)
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 void bake_freejob(void *bkv)
static void bake_init_api_data(wmOperator *op, bContext *C, BakeAPIRender *bkr)
Object * context_active_object(const bContext *C)
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 bool bake_break(void *rjv)
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)
const EnumPropertyItem rna_enum_normal_space_items[]
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void RE_bake_ibuf_clear(Image *image, const bool is_tangent)
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)
void BKE_object_eval_reset(Object *ob_eval)
int RNA_enum_get(PointerRNA *ptr, const char *name)
void RE_SetReports(Render *re, ReportList *reports)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void DEG_graph_build_from_view_layer(Depsgraph *graph)
const EnumPropertyItem rna_enum_bake_pass_filter_type_items[]
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
BMesh * BKE_editmesh_bmesh_get_for_write(Mesh *mesh)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
@ BKE_CB_EVT_OBJECT_BAKE_COMPLETE
@ BKE_CB_EVT_OBJECT_BAKE_CANCEL
@ BKE_CB_EVT_OBJECT_BAKE_PRE
void RE_test_break_cb(Render *re, void *handle, bool(*f)(void *handle))
@ R_BAKE_PASS_FILTER_TRANSM
@ R_BAKE_PASS_FILTER_SUBSURFACE
@ R_BAKE_PASS_FILTER_INDIRECT
@ R_BAKE_PASS_FILTER_DIFFUSE
@ R_BAKE_PASS_FILTER_EMIT
@ R_BAKE_PASS_FILTER_NONE
@ R_BAKE_PASS_FILTER_COLOR
@ R_BAKE_PASS_FILTER_GLOSSY
@ R_BAKE_PASS_FILTER_DIRECT
void DEG_graph_free(Depsgraph *graph)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
bool RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **r_identifier)
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
@ BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT
int RE_pass_depth(const eScenePassType pass_type)
Material * BKE_object_material_get(Object *ob, short act)
@ WM_JOB_TYPE_OBJECT_BAKE
bool RE_bake_has_engine(const Render *re)
void IMB_mark_dirty(ImBuf *ibuf)
bool bool BLI_path_suffix(char *path, size_t path_maxncpy, const char *suffix, const char *sep) ATTR_NONNULL(1
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
@ eModifierType_EdgeSplit
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
Depsgraph * DEG_graph_new(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluationMode mode)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int RNA_int_get(PointerRNA *ptr, const char *name)
bool is_negative_m4(const float mat[4][4])
wmWindow * CTX_wm_window(const bContext *C)
const char * IMB_colormanagement_get_byte_colorspace(const ImBuf *ibuf)
void BKE_callback_exec_id(Main *bmain, ID *id, eCbEvent evt)
@ COLOR_ROLE_SCENE_LINEAR
ATTR_WARN_UNUSED_RESULT const BMVert * v
void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void(*free)(void *customdata))
void IMB_buffer_byte_from_float(unsigned char *dest, const float *src, int src_channels, float dither, bool predivide, int width, int height, int stride, int start_y=0)
const EnumPropertyItem rna_enum_bake_target_items[]
void BKE_main_id_tag_idcode(Main *mainvar, short type, int tag, bool value)
ViewLayer * CTX_data_view_layer(const bContext *C)
void IMB_buffer_byte_from_float_mask(unsigned char *dest, const float *src, int src_channels, float dither, int width, int height, const 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)
void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
MINLINE void zero_v4(float r[4])
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
@ SCE_PASS_SUBSURFACE_COLOR
void RE_bake_pixels_populate(Mesh *mesh, BakePixel pixel_array[], const size_t pixels_num, const BakeTargets *targets, const StringRef uv_layer, int margin)
void RE_progress_cb(Render *re, void *handle, void(*f)(void *handle, float))
void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *ob)
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 *))
void IMB_freeImBuf(ImBuf *ibuf)
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])
VecBase< int32_t, 3 > int3
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE void add_v4_v4(float r[4], const float a[4])
void DEG_id_tag_update(ID *id, unsigned int flags)
const char * IMB_colormanagement_role_colorspace_name_get(int role)
void BKE_report(ReportList *reports, eReportType type, const char *message)
BMesh const char void * data
const EnumPropertyItem rna_enum_bake_margin_type_items[]
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)
wmWindowManager * CTX_wm_manager(const bContext *C)
void ED_mesh_split_faces(Mesh *mesh)
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])
const EnumPropertyItem rna_enum_bake_pass_type_items[]
void BKE_modifier_free(ModifierData *md)
void BKE_scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain)
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
void IMB_partial_update_mark_full(ImBuf *ibuf)
void IMB_buffer_float_rgba_from_float(float *dest, const float *src, int src_channels, int width, int height)
BMDataLayerLookup BM_data_layer_lookup(const BMesh &bm, const StringRef name)
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
ATTR_WARN_UNUSED_RESULT const size_t num
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RE_bake_mask_fill(const BakePixel pixel_array[], const size_t pixels_num, char *mask)
MINLINE int poly_to_tri_count(int poly_count, int corner_count)
const EnumPropertyItem rna_enum_normal_swizzle_items[]
void BKE_id_free(Main *bmain, void *idv)
void IMB_buffer_float_rgba_from_float_mask(float *dest, const float *src, int src_channels, int width, int height, const char *mask)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
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[])
ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, ImBufFlags flags)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
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])
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
MINLINE void add_v3_v3(float r[3], const float a[3])
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
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)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
Main * CTX_data_main(const bContext *C)
wmJob * WM_jobs_get(wmWindowManager *wm, wmWindow *win, const void *owner, const char *name, const eWM_JobFlag flag, const eWM_JobType job_type)
const EnumPropertyItem rna_enum_bake_save_mode_items[]
void RE_bake_engine_set_engine_parameters(Render *re, Main *bmain, Scene *scene)
Render * RE_NewSceneRender(const Scene *scene)
Vector< bke::path_templates::Error > BKE_image_path_from_imtype(char *filepath, const char *base, const char *relbase, const bke::path_templates::VariableMap *template_variables, int frame, char imtype, bool use_ext, bool use_frames, const char *suffix)
ScrArea * BKE_screen_find_big_area(const bScreen *screen, int spacetype, short min)
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
void ED_render_view3d_auto_pause(Main *bmain, bool pause)
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
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)
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
Mesh * BKE_mesh_new_from_object(Depsgraph *depsgraph, Object *object, bool preserve_all_data_layers, bool preserve_origindex, bool ensure_subdivision)
Scene * CTX_data_scene(const bContext *C)
bScreen * CTX_wm_screen(const bContext *C)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
std::string RNA_string_get(PointerRNA *ptr, const char *name)
void copy_m4_m4(float m1[4][4], const float m2[4][4])
MINLINE void mul_v4_fl(float r[4], float f)
bool CTX_data_selected_objects(const bContext *C, Vector< PointerRNA > *list)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RE_bake_margin(ImBuf *ibuf, char *mask, const int margin, const char margin_type, const Mesh *mesh, const StringRef uv_layer, const float uv_offset[2])
MINLINE void linearrgb_to_srgb_uchar4(unsigned char srgb[4], const float linear[4])
@ R_BAKE_TARGET_VERTEX_COLORS
@ R_BAKE_TARGET_IMAGE_TEXTURES
bool ED_operator_object_active_editable_mesh(bContext *C)
void IMB_colormanagement_transform_float(float *buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace, bool predivide)
void BKE_imageuser_default(ImageUser *iuser)
void WM_cursor_wait(bool val)
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)
void WM_jobs_timer(wmJob *wm_job, double time_step, uint note, uint endnote, void(*timer_step)(void *))
bool BKE_imbuf_write(ImBuf *ibuf, const char *filepath, const ImageFormatData *imf)
const char * IMB_colormanagement_get_float_colorspace(const ImBuf *ibuf)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
ColorSceneLinearByteEncoded4b< eAlpha::Premultiplied > ColorGeometry4b
void DEG_disable_visibility_optimization(Depsgraph *depsgraph)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
bool BKE_id_attributes_color_find(const struct ID *id, StringRef name)
void BKE_image_get_tile_uv(const Image *ima, const int tile_number, float r_uv[2])
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
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)
struct Image ** material_to_image
uint8_t * byte_data_for_write()
const float * float_data() const
float * float_data_for_write()
ListBaseT< Object > objects
ListBaseT< Image > images
struct ModifierData * next
MultiresModifierFlag flags
ListBaseT< ModifierData > modifiers
eObject_VisibilityFlag visibility_flag
ListBaseT< SpaceLink > spacedata
Vector< PointerRNA > selected_objects
eBakeNormalSwizzle normal_swizzle[3]
char custom_cage[MAX_NAME]
bool is_selected_to_active
eBakeMarginType margin_type
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports