Hydra: saving changed to unpacking for packed images #110933

Merged
Brecht Van Lommel merged 4 commits from DagerD/blender:unpack-instead-of-save into main 2023-08-17 18:09:58 +02:00

Purpose

For packed images use unpacking instead of saving as it's much faster.

Technical steps

Added BKE_packedfile_unpack_image instead of cache_image_file for packed images.

Ref: #110765

### Purpose For packed images use unpacking instead of saving as it's much faster. ### Technical steps Added `BKE_packedfile_unpack_image` instead of `cache_image_file` for packed images. Ref: #110765
Georgiy Markelov added 1 commit 2023-08-08 18:37:00 +02:00
Georgiy Markelov requested review from Brecht Van Lommel 2023-08-08 18:37:32 +02:00
Georgiy Markelov requested review from Brian Savery (AMD) 2023-08-08 18:37:32 +02:00
Georgiy Markelov requested review from Bogdan Nagirniak 2023-08-08 18:37:32 +02:00
Georgiy Markelov requested review from Vasyl Pidhirskyi 2023-08-08 18:37:32 +02:00
Brecht Van Lommel requested changes 2023-08-08 18:49:02 +02:00
Brecht Van Lommel left a comment
Owner

Thanks.

It should unpack to the same temporary folder where other images are saved for Hydra though. We should not silently overwrite files in the textures/ directory, that could overwrite files that the user does not want modified.

I guess it should use a slightly slower level functiion like BKE_packedfile_unpack_to_file.

Thanks. It should unpack to the same temporary folder where other images are saved for Hydra though. We should not silently overwrite files in the `textures/` directory, that could overwrite files that the user does not want modified. I guess it should use a slightly slower level functiion like `BKE_packedfile_unpack_to_file`.
Georgiy Markelov added 1 commit 2023-08-09 17:15:31 +02:00
4ac33b5640 HYDRA: changed method for unpacking images
Now images are saved to Hydra temporary folder
and doesn't actually unpacked.
Georgiy Markelov requested review from Brecht Van Lommel 2023-08-09 17:16:33 +02:00
Brecht Van Lommel requested changes 2023-08-10 18:47:13 +02:00
Brecht Van Lommel left a comment
Owner

This should not use the first image file path, but the image filepath

This should not use the first image file path, but the image filepath
@ -85,0 +90,4 @@
char filename[FILE_MAX];
LISTBASE_FOREACH (ImagePackedFile *, ipf, &image->packedfiles) {
BLI_path_split_dir_file(ipf->filepath, dirname, sizeof(dirname), filename, sizeof(filename));
strcpy(str,

The returned string may be null, and if it's not null it needs to be freed.

The returned string may be null, and if it's not null it needs to be freed.
DagerD marked this conversation as resolved
@ -85,0 +94,4 @@
BKE_packedfile_unpack_to_file(nullptr,
BKE_main_blendfile_path(bmain),
dirname,
get_cache_file(filename).c_str(),

This file name is not guaranteed to be unique. Maybe put all unpack files in a uniquely name subdirectory?

Something like unpack_%p with the image datablock pointer, similar to how it's done to make cached images unique.

This file name is not guaranteed to be unique. Maybe put all unpack files in a uniquely name subdirectory? Something like `unpack_%p` with the image datablock pointer, similar to how it's done to make cached images unique.
DagerD marked this conversation as resolved
Georgiy Markelov added 1 commit 2023-08-11 15:38:37 +02:00
Author
Member

This should not use the first image file path, but the image filepath

Didn't understand this comment: if we return image filepath, then it will be something like //..\Desktop\Untitled.001.<UDIM>.png.

> This should not use the first image file path, but the image filepath Didn't understand this comment: if we return image filepath, then it will be something like `//..\Desktop\Untitled.001.<UDIM>.png`.

Didn't understand this comment: if we return image filepath, then it will be something like //..\Desktop\Untitled.001.<UDIM>.png.

Sorry, I accidentally submitted this comment after I had changed my mind, ignore it.

> Didn't understand this comment: if we return image filepath, then it will be something like `//..\Desktop\Untitled.001.<UDIM>.png`. Sorry, I accidentally submitted this comment after I had changed my mind, ignore it.
Brecht Van Lommel approved these changes 2023-08-15 16:19:32 +02:00

@blender-bot build

@blender-bot build
Brecht Van Lommel added 1 commit 2023-08-17 17:04:29 +02:00
buildbot/vexp-code-patch-coordinator Build done. Details
b0f9cf1898
Merge branch 'main' into unpack-instead-of-save

@blender-bot build

@blender-bot build
Brecht Van Lommel merged commit 37269c78d2 into main 2023-08-17 18:09:58 +02:00
Brecht Van Lommel deleted branch unpack-instead-of-save 2023-08-17 18:10:00 +02:00
Sign in to join this conversation.
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
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#110933
No description provided.