140 switch (event->
type) {
172 const int image_tile_number,
178 const char margin_type,
180 const bool is_noncolor,
181 Mesh const *mesh_eval,
182 char const *uv_layer,
183 const float uv_offset[2])
188 char *mask_buffer =
NULL;
189 const size_t pixels_num = (size_t)
width * (
size_t)
height;
193 iuser.
tile = image_tile_number;
200 if (margin > 0 || !is_clear) {
201 mask_buffer =
MEM_callocN(
sizeof(
char) * pixels_num,
"Bake Mask");
209 const char *from_colorspace;
210 const char *to_colorspace;
221 if (from_colorspace != to_colorspace) {
223 buffer, ibuf->
x, ibuf->
y, ibuf->
channels, from_colorspace, to_colorspace,
false);
282 RE_bake_margin(ibuf, mask_buffer, margin, margin_type, mesh_eval, uv_layer, uv_offset);
310 for (
int i = 0; i < targets->
images_num; i++) {
327 const int margin_type,
329 const bool is_noncolor,
330 Mesh const *mesh_eval,
331 char const *uv_layer,
332 const float uv_offset[2])
338 is_float = im_format->
depth > 8;
366 buffer, ibuf->
x, ibuf->
y, ibuf->
channels, from_colorspace, to_colorspace,
false);
384 char *mask_buffer =
NULL;
385 const size_t pixels_num = (size_t)
width * (
size_t)
height;
387 mask_buffer =
MEM_callocN(
sizeof(
char) * pixels_num,
"Bake Mask");
389 RE_bake_margin(ibuf, mask_buffer, margin, margin_type, mesh_eval, uv_layer, uv_offset);
398 chmod(filepath, S_IRUSR | S_IWUSR);
411 return ELEM(pass_type,
455 "Mesh does not have an active color attribute \"%s\"",
463 reports,
RPT_ERROR,
"No active UV layer found in the object \"%s\"", ob->
id.
name + 2);
467 for (
int i = 0; i < ob->
totcol; i++) {
470 const int mat_nr = i + 1;
483 "Circular dependency for image \"%s\" from object \"%s\"",
503 "Uninitialized image \"%s\" from object \"%s\"",
517 "No active image found in material \"%s\" (%d) for object \"%s\"",
525 "No active image found in material slot (%d) for object \"%s\"",
540 const int pass_filter,
560 "Combined bake pass requires Emit, or a light pass with "
561 "Direct or Indirect contributions enabled");
567 "Combined bake pass requires Emit, or a light pass with "
568 "Direct or Indirect contributions enabled");
582 "Bake pass requires Direct, Indirect, or Color contributions to be enabled");
598 const bool is_selected_to_active,
606 if (is_selected_to_active) {
613 for (link = selected_objects->
first; link; link = link->
next) {
623 "Object \"%s\" is not a mesh or can't be converted to a mesh (Curve, Text, "
624 "Surface or Metaball)",
631 if (tot_objects == 0) {
642 for (link = selected_objects->
first; link; link = link->
next) {
665 const bool preserve_origindex)
683 int materials_num = ob->
totcol;
685 if (materials_num == 0) {
688 reports,
RPT_ERROR,
"No active image found, add a material or bake to an external file");
695 "No active image found, add a material or bake without the Split Materials option");
703 "BakeTargets.material_to_image");
710 for (
int i = 0; i < materials_num; i++) {
745 for (
int i = 0; i < targets->
images_num; i++) {
756 bk_image->
width = ibuf->
x;
761 targets->
pixels_num += (size_t)ibuf->
x * (
size_t)ibuf->
y;
783 for (
int i = 0; i < targets->
images_num; i++) {
787 pixel_array + bk_image->
offset,
806 "Problem saving the bake map internally for object \"%s\"",
812 reports,
RPT_INFO,
"Baking map saved to internal image, save it externally or pack it");
829 for (
int i = 0; i < targets->
images_num; i++) {
863 for (
int i = 0; i < targets->
images_num; i++) {
873 bake->im_format.imtype,
884 if (ob_eval->
mat[i]) {
887 else if (mesh_eval->
mat[i]) {
893 sprintf(tmp,
"%d", i % 1000);
906 pixel_array + bk_image->
offset,
943 BKE_report(reports,
RPT_ERROR,
"Color attribute baking is only supported for mesh objects");
960 "BakeTargets.material_to_image");
975 const int *vert_origindex,
976 const int *poly_origindex,
982 const int vert_orig = vert_origindex[vert_eval];
983 const int poly_orig = poly_origindex[poly_eval];
990 MPoly *mpoly_orig = me_orig->
mpoly + poly_orig;
992 for (
int j = 0; j < mpoly_orig->
totloop; ++j, ++mloop_orig) {
993 if (mloop_orig->
v == vert_orig) {
1010 for (
int i = 0; i < pixels_num; i++) {
1016 pixel->
du_dx = 0.0f;
1017 pixel->
du_dy = 0.0f;
1018 pixel->
dv_dx = 0.0f;
1019 pixel->
dv_dy = 0.0f;
1020 pixel->
uv[0] = 0.0f;
1021 pixel->
uv[1] = 0.0f;
1035 for (
int i = 0; i < tottri; i++) {
1038 for (
int j = 0; j < 3; j++) {
1039 unsigned int l = lt->
tri[j];
1040 unsigned int v = me_eval->
mloop[
l].
v;
1043 if (vert_origindex !=
NULL && poly_origindex !=
NULL) {
1065 pixel->
uv[0] = 1.0f;
1066 pixel->
uv[1] = 0.0f;
1069 pixel->
uv[0] = 0.0f;
1070 pixel->
uv[1] = 1.0f;
1073 pixel->
uv[0] = 0.0f;
1074 pixel->
uv[1] = 0.0f;
1084 if (channels_num == 4) {
1087 else if (channels_num == 3) {
1101 const bool is_noncolor,
1105 for (
int i = 0; i < num; i++) {
1110 for (
int i = 0; i < num; i++) {
1129 const int totvert = me->
totvert;
1130 const int totloop = me->
totloop;
1135 int *num_loops_for_vertex =
MEM_callocN(
sizeof(
int) * me->
totvert,
"num_loops_for_vertex");
1139 for (
int i = 0; i < totloop; i++, mloop++) {
1140 const int v = mloop->
v;
1142 num_loops_for_vertex[
v]++;
1146 for (
int i = 0; i < totvert; i++) {
1147 if (num_loops_for_vertex[i] > 0) {
1215 for (
int i = 0; i < me->
totloop; i++) {
1222 for (
int i = 0; i < me->
totloop; i++) {
1270 "bake return pixels");
1303 bkr, targets, ob, ob_eval, me_eval, pixel_array, reports);
1345 int tot_highpoly = 0;
1351 int mmd_flags_low = 0;
1372 "No UV layer named \"%s\" found in the object \"%s\"",
1383 for (link = selected_objects->
first; link; link = link->
next) {
1386 if (ob_iter == ob_low) {
1413 mmd_flags_low = mmd_low->
flags;
1448 "Invalid cage object, the cage mesh must have the same number "
1449 "of faces as the active object");
1454 bool is_changed =
false;
1492 for (link = selected_objects->
first; link; link = link->
next) {
1495 if (ob_iter == ob_low) {
1500 highpoly[i].
ob = ob_iter;
1517 if (ob_cage !=
NULL) {
1526 "bake pixels high poly");
1538 (ob_cage ? ob_cage->
obmat : ob_low_eval->
obmat),
1545 for (i = 0; i < tot_highpoly; i++) {
1557 reports,
RPT_ERROR,
"Error baking from object \"%s\"", highpoly[i].ob->id.name + 2);
1617 ob_low_eval->
obmat);
1641 (me_nores) ? me_nores : me_low_eval,
1643 ob_low_eval->
obmat);
1664 bkr, &targets, ob_low, ob_low_eval, me_low_eval, pixel_array_low, reports)) {
1677 for (
int i = 0; i < tot_highpoly; i++) {
1678 if (highpoly[i].me !=
NULL) {
1686 mmd_low->
flags = mmd_flags_low;
1689 if (pixel_array_low) {
1693 if (pixel_array_high) {
1699 if (me_low_eval !=
NULL) {
1703 if (me_cage_eval !=
NULL) {
1788 G.is_rendering =
true;
1835 G.is_rendering =
false;
1909 G.is_rendering =
false;
1960 op->
ptr, prop, (
bake->cage_object) ?
bake->cage_object->id.name + 2 :
"");
2059 G.is_rendering =
true;
2078 ot->
description =
"Bake image textures of selected objects";
2093 "Type of pass to bake, some of them may not be supported by the current render engine");
2099 "Filter to combined, diffuse, glossy, transmission and subsurface passes");
2106 "Image filepath to use when saving externally");
2113 "Horizontal dimension of the baking map (external only)",
2122 "Vertical dimension of the baking map (external only)",
2131 "Extends the baked result as a post process filter",
2139 "Which algorithm to use to generate the margin");
2141 "use_selected_to_active",
2143 "Selected to Active",
2144 "Bake shading on the surface of selected objects to the active object");
2151 "The maximum ray distance for matching points between the active and selected "
2152 "objects. If zero, there is no limit",
2161 "Inflate the active object by the specified distance for baking. This helps "
2162 "matching to points nearer to the outside of the selected object meshes",
2170 "Object to use as cage, instead of calculating the cage from the active object "
2171 "with cage extrusion");
2177 "Choose normal space for baking");
2183 "Axis to bake in red channel");
2189 "Axis to bake in green channel");
2195 "Axis to bake in blue channel");
2201 "Where to output the baked map");
2207 "Where to save baked image textures");
2212 "Clear images before baking (only for internal saving)");
2216 "use_split_materials",
2219 "Split baked maps per material, using material name in output file (external only)");
2221 "use_automatic_name",
2224 "Automatically name the output file with the pass type");
2230 "UV layer to override active");
Generic geometry attributes built on CustomData.
struct CustomDataLayer * BKE_id_attributes_active_color_get(const struct ID *id)
eAttrDomain BKE_id_attribute_domain(const struct ID *id, const struct CustomDataLayer *layer)
@ BKE_CB_EVT_OBJECT_BAKE_CANCEL
@ BKE_CB_EVT_OBJECT_BAKE_COMPLETE
@ BKE_CB_EVT_OBJECT_BAKE_PRE
void BKE_callback_exec_id(struct Main *bmain, struct ID *id, eCbEvent evt)
struct Scene * CTX_data_scene(const bContext *C)
int CTX_data_selected_objects(const bContext *C, ListBase *list)
struct wmWindowManager * CTX_wm_manager(const bContext *C)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct Object * CTX_data_active_object(const bContext *C)
struct bScreen * CTX_wm_screen(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
int CustomData_get_active_layer_index(const struct CustomData *data, int type)
int CustomData_get_offset_named(const CustomData *data, int type, const char *name)
void * CustomData_get_layer(const struct CustomData *data, int type)
int CustomData_get_named_layer(const struct CustomData *data, int type, const char *name)
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
void BKE_image_get_tile_uv(const struct Image *ima, const int tile_number, float r_uv[2])
int BKE_imbuf_write(struct ImBuf *ibuf, const char *name, const struct ImageFormatData *imf)
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
void BKE_image_partial_update_mark_full_update(struct Image *image)
Mark the whole image to be updated.
void BKE_image_free_gputextures(struct Image *ima)
void BKE_image_mark_dirty(struct Image *image, struct ImBuf *ibuf)
void BKE_imageuser_default(struct ImageUser *iuser)
struct Base * BKE_view_layer_base_find(struct ViewLayer *view_layer, struct Object *ob)
void BKE_main_id_tag_idcode(struct Main *mainvar, short type, int tag, bool value)
void BKE_id_free(struct Main *bmain, void *idv)
const char * BKE_main_blendfile_path(const struct Main *bmain) ATTR_NONNULL()
General operations, lookup, etc. for materials.
struct Material * BKE_object_material_get(struct Object *ob, short act)
void BKE_mesh_recalc_looptri(const struct MLoop *mloop, const struct MPoly *mpoly, const struct MVert *mvert, int totloop, int totpoly, struct MLoopTri *mlooptri)
struct Mesh * BKE_mesh_new_from_object(struct Depsgraph *depsgraph, struct Object *object, bool preserve_all_data_layers, bool preserve_origindex)
void BKE_mesh_split_faces(struct Mesh *mesh, bool free_loop_normals)
void BKE_modifier_free(struct ModifierData *md)
struct ModifierData * BKE_modifiers_findby_type(const struct Object *ob, ModifierType type)
bool BKE_node_is_connected_to_output(struct bNodeTree *ntree, struct bNode *node)
General operations, lookup, etc. for blender objects.
void BKE_object_handle_data_update(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob)
void BKE_object_eval_reset(struct Object *ob_eval)
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(struct Depsgraph *depsgraph, struct Main *bmain)
struct ARegion struct ARegion struct ScrArea struct ScrArea * BKE_screen_find_big_area(struct bScreen *screen, int spacetype, short min)
File and directory operations.
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define LISTBASE_FOREACH(type, var, list)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void void BLI_INLINE bool BLI_listbase_is_single(const struct ListBase *lb)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT 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)
bool invert_m4_m4(float R[4][4], const float A[4][4])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
bool is_negative_m4(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])
bool BLI_path_suffix(char *string, size_t maxlen, const char *suffix, const char *sep) ATTR_NONNULL()
#define SNPRINTF(dst, format,...)
Depsgraph * DEG_graph_new(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, eEvaluationMode mode)
struct Depsgraph Depsgraph
void DEG_graph_free(Depsgraph *graph)
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_graph_build_from_view_layer(struct Depsgraph *graph)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
#define MAX_CUSTOMDATA_LAYER_NAME
@ eModifierType_EdgeSplit
Object is a sort of wrapper for general info.
#define R_BAKE_SPACE_OBJECT
#define R_BAKE_SPACE_WORLD
@ R_BAKE_TARGET_VERTEX_COLORS
@ R_BAKE_TARGET_IMAGE_TEXTURES
#define R_BAKE_SPACE_TANGENT
@ 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
bool ED_object_editmode_load(struct Main *bmain, struct Object *obedit)
bool ED_operator_object_active_editable_mesh(struct bContext *C)
bool ED_object_get_active_image(struct Object *ob, int mat_nr, struct Image **r_ima, struct ImageUser **r_iuser, struct bNode **r_node, struct bNodeTree **r_ntree)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
const char * IMB_colormanagement_get_rect_colorspace(struct ImBuf *ibuf)
@ COLOR_ROLE_SCENE_LINEAR
const char * IMB_colormanagement_role_colorspace_name_get(int role)
void IMB_colormanagement_transform(float *buffer, int width, int height, int channels, const char *from_colorspace, const char *to_colorspace, bool predivide)
const char * IMB_colormanagement_get_float_colorspace(struct 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)
struct ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
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_freemipmapImBuf(struct ImBuf *ibuf)
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_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)
Contains defines and structs used throughout the imbuf module.
@ IB_DISPLAY_BUFFER_INVALID
#define IB_PROFILE_LINEAR_RGB
Read Guarded memory(de)allocation.
#define MEM_recallocN(vmemh, len)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
@ WM_JOB_TYPE_OBJECT_BAKE
bool RE_bake_pixels_populate_from_objects(struct Mesh *me_low, BakePixel pixel_array_from[], BakePixel pixel_array_to[], BakeHighPolyData highpoly[], const int tot_highpoly, const size_t pixels_num, const bool is_custom_cage, const float cage_extrusion, const float max_ray_distance, float mat_low[4][4], float mat_cage[4][4], struct Mesh *me_cage)
int RE_pass_depth(const eScenePassType pass_type)
void RE_bake_pixels_populate(Mesh *me, BakePixel pixel_array[], const size_t pixels_num, const BakeTargets *targets, const char *uv_layer)
void RE_bake_margin(ImBuf *ibuf, char *mask, const int margin, const char margin_type, Mesh const *me, char const *uv_layer, const float uv_offset[2])
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[], struct Object *ob, const eBakeNormalSwizzle normal_swizzle[3])
void RE_bake_mask_fill(const BakePixel pixel_array[], const size_t pixels_num, char *mask)
void RE_bake_normal_world_to_tangent(const BakePixel pixel_array[], const size_t pixels_num, const int depth, float result[], Mesh *me, const eBakeNormalSwizzle normal_swizzle[3], float mat[4][4])
#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)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert * v
const Depsgraph * depsgraph
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
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)
void IMB_freeImBuf(ImBuf *UNUSED(ibuf))
ccl_global float * buffer
ccl_global const KernelWorkTile * tile
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
#define unit_float_to_uchar_clamp_v4(v1, v2)
static void area(int d1, int d2, int e1, int e2, float weights[2])
static const pxr::TfToken rgba("rgba", pxr::TfToken::Immortal)
static int bake_exec(bContext *C, wmOperator *op)
static Mesh * bake_mesh_new_from_object(Depsgraph *depsgraph, Object *object, const bool preserve_origindex)
static void bake_init_api_data(wmOperator *op, bContext *C, BakeAPIRender *bkr)
static bool bake_targets_output_vertex_colors(BakeTargets *targets, Object *ob)
void OBJECT_OT_bake(wmOperatorType *ot)
static bool bake_targets_output(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, Object *ob_eval, Mesh *me_eval, BakePixel *pixel_array, ReportList *reports)
struct BakeAPIRender BakeAPIRender
static int find_original_loop(const Mesh *me_orig, const int *vert_origindex, const int *poly_origindex, const int poly_eval, const int vert_eval)
static void convert_float_color_to_byte_color(const MPropCol *float_colors, const int num, const bool is_noncolor, MLoopCol *byte_colors)
static void bake_targets_populate_pixels(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, Mesh *me_eval, BakePixel *pixel_array)
static bool bake_object_check(ViewLayer *view_layer, Object *ob, const eBakeTarget target, ReportList *reports)
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, Mesh const *mesh_eval, char const *uv_layer, const float uv_offset[2])
static bool bake_targets_init_image_textures(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, ReportList *reports)
static int bake(const BakeAPIRender *bkr, Object *ob_low, const ListBase *selected_objects, ReportList *reports)
static void bake_update_image(ScrArea *area, Image *image)
static void bake_job_canceled(void *bkv)
static bool bake_targets_init(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, Object *ob_eval, ReportList *reports)
static bool bake_targets_init_internal(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, ReportList *reports)
static void bake_job_complete(void *bkv)
static bool bake_objects_check(Main *bmain, ViewLayer *view_layer, Object *ob, ListBase *selected_objects, ReportList *reports, const bool is_selected_to_active, const eBakeTarget target)
static void bake_progress_update(void *bjv, float progress)
static void bake_startjob(void *bkv, short *UNUSED(stop), short *do_update, float *progress)
static void bake_targets_populate_pixels_color_attributes(BakeTargets *targets, Object *ob, Mesh *me_eval, BakePixel *pixel_array)
static bool bake_targets_output_internal(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, BakePixel *pixel_array, ReportList *reports, Mesh *mesh_eval)
static int bake_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
static int bake_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static int bake_break(void *UNUSED(rjv))
static void bake_targets_refresh(BakeTargets *targets)
static bool is_noncolor_pass(eScenePassType pass_type)
static bool bake_targets_output_external(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, Object *ob_eval, Mesh *mesh_eval, BakePixel *pixel_array, ReportList *reports)
static void bake_set_props(wmOperator *op, Scene *scene)
static bool bake_pass_filter_check(eScenePassType pass_type, const int pass_filter, ReportList *reports)
static void bake_freejob(void *bkv)
static void bake_targets_clear(Main *bmain, const bool is_tangent)
static void bake_targets_free(BakeTargets *targets)
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, Mesh const *mesh_eval, char const *uv_layer, const float uv_offset[2])
static void bake_result_add_to_rgba(float rgba[4], const float *result, const int channels_num)
static bool bake_targets_init_vertex_colors(Main *bmain, BakeTargets *targets, Object *ob, ReportList *reports)
static bool bake_targets_init_external(const BakeAPIRender *bkr, BakeTargets *targets, Object *ob, ReportList *reports)
void RE_progress_cb(Render *re, void *handle, void(*f)(void *handle, float))
Render * RE_NewSceneRender(const Scene *scene)
void RE_test_break_cb(Render *re, void *handle, int(*f)(void *handle))
void RE_SetReports(Render *re, ReportList *reports)
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_string_get(PointerRNA *ptr, const char *name, char *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)
bool RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
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_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool 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, int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
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[]
eBakeNormalSwizzle normal_swizzle[3]
char uv_layer[MAX_CUSTOMDATA_LAYER_NAME]
char custom_cage[MAX_NAME]
eBakeMarginType margin_type
ListBase selected_objects
bool is_selected_to_active
struct Image ** material_to_image
struct CollectionPointerLink * next
struct ImBuf * mipmap[IMB_MIPMAP_LEVELS]
struct BMEditMesh * edit_mesh
struct ModifierData * next
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
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_start(wmWindowManager *wm, wmJob *wm_job)
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 *))
void WM_jobs_timer(wmJob *wm_job, double timestep, unsigned int note, unsigned int endnote)
wmJob * WM_jobs_get(wmWindowManager *wm, wmWindow *win, const void *owner, const char *name, int flag, int job_type)