Add an optional "frame" & "tile_index" argument to Image.scale() #117549
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#117549
Loading…
Reference in New Issue
No description provided.
Delete Branch "lichtwerk/blender:117539"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
BKE_image_scale
-- which is only used for the python API -- wasgetting the
ImBuf
without providing anImageUser
.This is fine, but always gets the first tile (and the current frame for sequences).
To resolve this, add an optional "frame" & "tile_index" argument so these can be specified explicitly (similar to layer_index and pass_index already used for some other API functions).
Fixes #117539 : Image.scale() always works on the first tile
API functions like this should not rely on what is active or selected, that's the main way in which they different from operators.
This whole image API suffers from not properly exposing the individual image buffers well. The easiest thing to do with the current API would be to add an optional
tile_index
argument, similar tolayer_index
andpass_index
already used for some other API functions.Fix #117539: Image.scale() always works on the first tileto WIP: Fix #117539: Image.scale() always works on the first tileWIP: Fix #117539: Image.scale() always works on the first tileto Add an optional "frame" & "tile_index" argument to Image.scale()@ -184,1 +186,3 @@
if (!BKE_image_scale(image, width, height)) {
ImageUser iuser{};
BKE_imageuser_default(&iuser);
bool use_imageuser = false;
Just always use the image user.
@ -185,0 +208,4 @@
/* Not exactly sure if we should check this beforehand? */
char filepath[FILE_MAX];
BKE_image_user_file_path(&iuser, image, filepath);
if (BLI_open(filepath, O_BINARY | O_RDONLY, 0) == -1) {
This leaks a file handle.
@ -185,0 +218,4 @@
}
use_imageuser = true;
}
I don't think it has to be checking if the tile and frame are valid. It requires the logic here and the one in acquiring the image buffer to match, and that's difficult to verify and maintain.
I would just check the return value of
BKE_image_scale
, and tweak the error message to be something like "Failed to load image buffer".@blender-bot build
test failed to an unrelated issue (from the time the PR was made)