Merge branch 'blender-v3.3-release'

This commit is contained in:
Germano Cavalcante 2022-08-08 11:00:10 -03:00
commit 47f433c776
8 changed files with 70 additions and 46 deletions

View File

@ -81,10 +81,15 @@ ccl_device_inline float4 svm_image_texture_read_2d(int id, int x, int y)
x = svm_image_texture_wrap_periodic(x, info.width);
y = svm_image_texture_wrap_periodic(y, info.height);
}
else {
else if (info.extension == EXTENSION_EXTEND) {
x = svm_image_texture_wrap_clamp(x, info.width);
y = svm_image_texture_wrap_clamp(y, info.height);
}
else {
if (x < 0 || x >= info.width || y < 0 || y >= info.height) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
}
return svm_image_texture_read(info, x, y, 0);
}
@ -99,11 +104,16 @@ ccl_device_inline float4 svm_image_texture_read_3d(int id, int x, int y, int z)
y = svm_image_texture_wrap_periodic(y, info.height);
z = svm_image_texture_wrap_periodic(z, info.depth);
}
else {
else if (info.extension == EXTENSION_EXTEND) {
x = svm_image_texture_wrap_clamp(x, info.width);
y = svm_image_texture_wrap_clamp(y, info.height);
z = svm_image_texture_wrap_clamp(z, info.depth);
}
else {
if (x < 0 || x >= info.width || y < 0 || y >= info.height || z < 0 || z >= info.depth) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
}
return svm_image_texture_read(info, x, y, z);
}
@ -128,12 +138,6 @@ ccl_device float4 kernel_tex_image_interp(KernelGlobals, int id, float x, float
{
const TextureInfo &info = kernel_data_fetch(texture_info, id);
if (info.extension == EXTENSION_CLIP) {
if (x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
}
if (info.interpolation == INTERPOLATION_CLOSEST) {
/* Closest interpolation. */
int ix, iy;
@ -315,12 +319,6 @@ ccl_device float4 kernel_tex_image_interp_3d(KernelGlobals, int id, float3 P, in
}
#endif
else {
if (info.extension == EXTENSION_CLIP) {
if (x < 0.0f || y < 0.0f || z < 0.0f || x > 1.0f || y > 1.0f || z > 1.0f) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
}
x *= info.width;
y *= info.height;
z *= info.depth;

View File

@ -237,11 +237,13 @@ void BKE_image_ensure_viewer_views(const struct RenderData *rd,
*/
void BKE_image_user_frame_calc(struct Image *ima, struct ImageUser *iuser, int cfra);
int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, bool *r_is_in_range);
void BKE_image_user_file_path(struct ImageUser *iuser, struct Image *ima, char *path);
void BKE_image_user_file_path_ex(struct ImageUser *iuser,
struct Image *ima,
void BKE_image_user_file_path(const struct ImageUser *iuser, const struct Image *ima, char *path);
void BKE_image_user_file_path_ex(const struct Main *bmain,
const struct ImageUser *iuser,
const struct Image *ima,
char *path,
bool resolve_udim);
const bool resolve_udim,
const bool resolve_multiview);
void BKE_image_editors_update_frame(const struct Main *bmain, int cfra);
/**
@ -259,15 +261,15 @@ struct RenderPass *BKE_image_multilayer_index(struct RenderResult *rr, struct Im
/**
* Sets index offset for multi-view files.
*/
void BKE_image_multiview_index(struct Image *ima, struct ImageUser *iuser);
void BKE_image_multiview_index(const struct Image *ima, struct ImageUser *iuser);
/**
* For multi-layer images as well as for render-viewer
* and because rendered results use fake layer/passes, don't correct for wrong indices here.
*/
bool BKE_image_is_multilayer(struct Image *ima);
bool BKE_image_is_multiview(struct Image *ima);
bool BKE_image_is_stereo(struct Image *ima);
bool BKE_image_is_multilayer(const struct Image *ima);
bool BKE_image_is_multiview(const struct Image *ima);
bool BKE_image_is_stereo(const struct Image *ima);
struct RenderResult *BKE_image_acquire_renderresult(struct Scene *scene, struct Image *ima);
void BKE_image_release_renderresult(struct Scene *scene, struct Image *ima);

View File

@ -794,7 +794,7 @@ bool BKE_image_has_opengl_texture(Image *ima)
return false;
}
static int image_get_tile_number_from_iuser(Image *ima, const ImageUser *iuser)
static int image_get_tile_number_from_iuser(const Image *ima, const ImageUser *iuser)
{
BLI_assert(ima != nullptr && ima->tiles.first);
ImageTile *tile = static_cast<ImageTile *>(ima->tiles.first);
@ -3651,7 +3651,7 @@ RenderPass *BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser)
return rpass;
}
void BKE_image_multiview_index(Image *ima, ImageUser *iuser)
void BKE_image_multiview_index(const Image *ima, ImageUser *iuser)
{
if (iuser) {
bool is_stereo = BKE_image_is_stereo(ima) && (iuser->flag & IMA_SHOW_STEREO);
@ -3672,7 +3672,7 @@ void BKE_image_multiview_index(Image *ima, ImageUser *iuser)
/* if layer or pass changes, we need an index for the imbufs list */
/* note it is called for rendered results, but it doesn't use the index! */
bool BKE_image_is_multilayer(Image *ima)
bool BKE_image_is_multilayer(const Image *ima)
{
if (ELEM(ima->source, IMA_SRC_FILE, IMA_SRC_SEQUENCE, IMA_SRC_TILED)) {
if (ima->type == IMA_TYPE_MULTILAYER) {
@ -3687,13 +3687,13 @@ bool BKE_image_is_multilayer(Image *ima)
return false;
}
bool BKE_image_is_multiview(Image *ima)
bool BKE_image_is_multiview(const Image *ima)
{
ImageView *view = static_cast<ImageView *>(ima->views.first);
return (view && (view->next || view->name[0]));
}
bool BKE_image_is_stereo(Image *ima)
bool BKE_image_is_stereo(const Image *ima)
{
return BKE_image_is_multiview(ima) &&
(BLI_findstring(&ima->views, STEREO_LEFT_NAME, offsetof(ImageView, name)) &&
@ -5093,14 +5093,19 @@ void BKE_image_user_id_eval_animation(Depsgraph *depsgraph, ID *id)
image_walk_id_all_users(id, skip_nested_nodes, depsgraph, image_user_id_eval_animation);
}
void BKE_image_user_file_path(ImageUser *iuser, Image *ima, char *filepath)
void BKE_image_user_file_path(const ImageUser *iuser, const Image *ima, char *filepath)
{
BKE_image_user_file_path_ex(iuser, ima, filepath, true);
BKE_image_user_file_path_ex(G_MAIN, iuser, ima, filepath, true, true);
}
void BKE_image_user_file_path_ex(ImageUser *iuser, Image *ima, char *filepath, bool resolve_udim)
void BKE_image_user_file_path_ex(const Main *bmain,
const ImageUser *iuser,
const Image *ima,
char *filepath,
const bool resolve_udim,
const bool resolve_multiview)
{
if (BKE_image_is_multiview(ima)) {
if (resolve_multiview && BKE_image_is_multiview(ima)) {
ImageView *iv = static_cast<ImageView *>(BLI_findlink(&ima->views, iuser->view));
if (iv->filepath[0]) {
BLI_strncpy(filepath, iv->filepath, FILE_MAX);
@ -5133,7 +5138,7 @@ void BKE_image_user_file_path_ex(ImageUser *iuser, Image *ima, char *filepath, b
}
}
BLI_path_abs(filepath, ID_BLEND_PATH_FROM_GLOBAL(&ima->id));
BLI_path_abs(filepath, ID_BLEND_PATH(bmain, &ima->id));
}
bool BKE_image_has_alpha(Image *image)

View File

@ -144,13 +144,9 @@ bool BKE_image_save_options_init(ImageSaveOptions *opts,
opts->im_format.color_management = R_IMF_COLOR_MANAGEMENT_FOLLOW_SCENE;
if (ibuf->name[0] == '\0' || ima->source == IMA_SRC_TILED) {
BLI_strncpy(opts->filepath, ima->filepath, sizeof(opts->filepath));
BLI_path_abs(opts->filepath, ID_BLEND_PATH_FROM_GLOBAL(&ima->id));
}
else {
BLI_strncpy(opts->filepath, ibuf->name, sizeof(opts->filepath));
}
/* Compute filepath, but don't resolve multiview and UDIM which are handled
* by the image saving code itself. */
BKE_image_user_file_path_ex(bmain, iuser, ima, opts->filepath, false, false);
/* sanitize all settings */

View File

@ -1008,13 +1008,6 @@ int transformEvent(TransInfo *t, const wmEvent *event)
t->redraw |= TREDRAW_HARD;
handled = true;
}
else if (t->options & (CTX_MOVIECLIP | CTX_MASK)) {
restoreTransObjects(t);
t->flag ^= T_ALT_TRANSFORM;
t->redraw |= TREDRAW_HARD;
handled = true;
}
}
else {
if (t->mode == TFM_TRANSLATION) {

View File

@ -282,6 +282,7 @@ void initResize(TransInfo *t, float mouse_dir_constraint[3])
{
t->mode = TFM_RESIZE;
t->transform = applyResize;
t->handleEvent = NULL;
t->tsnap.applySnap = ApplySnapResize;
t->tsnap.distance = ResizeBetween;

View File

@ -351,6 +351,7 @@ void initRotation(TransInfo *t)
t->mode = TFM_ROTATION;
t->transform = applyRotation;
t->handleEvent = NULL;
t->transform_matrix = applyRotationMatrix;
t->tsnap.applySnap = ApplySnapRotation;
t->tsnap.distance = RotationBetween;

View File

@ -56,6 +56,8 @@ struct TranslateCustomData {
struct {
enum eTranslateRotateMode rotate_mode;
} prev;
const wmKeyMapItem *move_kmi;
};
/** \} */
@ -169,6 +171,27 @@ static void transdata_elem_translate_fn(void *__restrict iter_data_v,
/** \} */
/* -------------------------------------------------------------------- */
/** \name Events to Move Clip and Mask
* \{ */
static eRedrawFlag translate_handleEvent(struct TransInfo *t, const wmEvent *event)
{
BLI_assert(t->options & (CTX_MOVIECLIP | CTX_MASK));
struct TranslateCustomData *custom_data = t->custom.mode.data;
const wmKeyMapItem *kmi = custom_data->move_kmi;
if (kmi && event->type == kmi->type && event->val == kmi->val) {
/* Toggles the handle offset effect. */
restoreTransObjects(t);
t->flag ^= T_ALT_TRANSFORM;
return TREDRAW_HARD;
}
return TREDRAW_NOTHING;
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform (Translation)
* \{ */
@ -614,6 +637,11 @@ void initTranslation(TransInfo *t)
custom_data->prev.rotate_mode = TRANSLATE_ROTATE_OFF;
t->custom.mode.data = custom_data;
t->custom.mode.use_free = true;
if (t->keymap && (t->options & (CTX_MOVIECLIP | CTX_MASK))) {
custom_data->move_kmi = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_TRANSLATE);
t->handleEvent = translate_handleEvent;
}
}
/** \} */