Fix #109561: Overwrite existing imagepath based on relativepath property #109815

Merged
Pratik Borhade merged 5 commits from PratikPB2123/blender:109561-overrite-image-path into main 2023-09-02 07:20:01 +02:00
Member

Update the filepath of an image when it already exists in the main
storage. This is useful when relative_path property is changed and we
attempt to open the same image file again.

Also remove is_relative_path parameter. Not required anymore because
range->filepath is correctly set to absolute/relative. This is also
passed in BKE_image_load_exists_ex to set path to non-exiting image.

Update the filepath of an image when it already exists in the main storage. This is useful when relative_path property is changed and we attempt to open the same image file again. Also remove `is_relative_path` parameter. Not required anymore because `range->filepath` is correctly set to absolute/relative. This is also passed in `BKE_image_load_exists_ex` to set path to non-exiting image.
Pratik Borhade added 1 commit 2023-07-07 12:18:23 +02:00
Update the filepath of an image when it already exists in the main
storage. This is useful when relative_path property is changed and we
attempt to open the same image file again.
Pratik Borhade requested review from Pablo Vazquez 2023-07-07 12:18:39 +02:00
Pratik Borhade requested review from Jeroen Bakker 2023-07-07 12:18:40 +02:00
Author
Member

Well this is actually a 2-3 lines of change
but Gitea is showing the diff in more complex way :)

Not sure if this change is really useful but submitted the PR anyway.

Well this is actually a 2-3 lines of change but Gitea is showing the diff in more complex way :) Not sure if this change is really useful but submitted the PR anyway.
Pablo Vazquez approved these changes 2023-07-22 18:51:04 +02:00
Pablo Vazquez left a comment
Member

Accepting it from the usability point of view. Will leave code review to @Jeroen-Bakker .

Accepting it from the usability point of view. Will leave code review to @Jeroen-Bakker .
Brecht Van Lommel requested changes 2023-08-15 19:44:08 +02:00
@ -1299,0 +1296,4 @@
if (exists) {
STRNCPY(ima->filepath, range->filepath);
return ima;
}

Doesn't this always make the path absolute?

I would think this following code needs to run for both the exists and not exists case?

  if (is_relative_path) {
    BLI_path_rel(ima->filepath, relbase);
  } 
Doesn't this always make the path absolute? I would think this following code needs to run for both the exists and not exists case? ``` if (is_relative_path) { BLI_path_rel(ima->filepath, relbase); } ```
Author
Member

Doesn't this always make the path absolute?

No. Before calling image_open_single, range->filepath is set to relative/absolute in ED_image_filesel_detect_sequences function execution.

So I don't think additional change is needed :)

@brecht , let me know if you think this change is not good and the explanation is not convincing. I'll update the PR then 😅

> Doesn't this always make the path absolute? No. Before calling `image_open_single`, range->filepath is set to relative/absolute in [ED_image_filesel_detect_sequences](https://projects.blender.org/blender/blender/src/branch/main/source/blender/editors/space_image/image_sequence.cc#L164) function execution. So I don't think additional change is needed :) @brecht , let me know if you think this change is not good and the explanation is not convincing. I'll update the PR then 😅

Then that would mean this code is also not needed for the !exists case, and can be removed? Otherwise it's confusing to me.

Then that would mean this code is also not needed for the `!exists` case, and can be removed? Otherwise it's confusing to me.
Author
Member

Yes, not needed. removed :)

Yes, not needed. removed :)
Brecht Van Lommel removed review request for Jeroen Bakker 2023-08-15 19:44:13 +02:00
Pratik Borhade added 1 commit 2023-08-22 11:26:47 +02:00
Brecht Van Lommel requested changes 2023-08-30 11:30:17 +02:00
Brecht Van Lommel left a comment
Owner

Requesting changes.

Requesting changes.
Pratik Borhade added 1 commit 2023-09-01 12:50:49 +02:00
This is not needed. range->filepath is correctly set to absoulte/relative.
range->filepath is also passed in `BKE_image_load_exists_ex` to assign path
to non-exiting image.
Brecht Van Lommel approved these changes 2023-09-01 13:19:39 +02:00
Brecht Van Lommel left a comment
Owner

Isn't there a warning about is_relative_path being unused now? I think it can just be removed, and let other parts of the code handle that RNA property.

Isn't there a warning about `is_relative_path` being unused now? I think it can just be removed, and let other parts of the code handle that RNA property.
Pratik Borhade added 2 commits 2023-09-01 13:40:21 +02:00
Author
Member

No warning but yes, it's not used anywhere else. Removed.

No warning but yes, it's not used anywhere else. Removed.
Brecht Van Lommel approved these changes 2023-09-01 13:47:38 +02:00
Pratik Borhade merged commit 1c0a1ae801 into main 2023-09-02 07:20:01 +02:00
Pratik Borhade deleted branch 109561-overrite-image-path 2023-09-02 07:20:03 +02:00
Author
Member

Merged, thanks for reviewing :)

Merged, thanks for reviewing :)
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
3 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#109815
No description provided.