Setting filepath of an image reloads it, which breaks all kind of generated content (including baking). #43985

Closed
opened 2015-03-13 15:39:50 +01:00 by Vilem Duha · 14 comments
Member

System Information
Operating system and graphics card

Blender Version
Broken: (example: 2.69.7 4b206af, see splash screen)
Worked: (optional): not sure if ever.

Short description of error
I tried to make some advanced baking script.
I hit this error, where setting the file path AFTER baking erases the image pixels to black. interesting is, that when I set the filepath before, it works.

Exact steps for others to reproduce the error
open file, run first script on upper left - that simply bakes into the image.
run the second script, which tries to set name and save. see the blackness!

bakebug.blend

**System Information** Operating system and graphics card **Blender Version** Broken: (example: 2.69.7 4b206af, see splash screen) Worked: (optional): not sure if ever. **Short description of error** I tried to make some advanced baking script. I hit this error, where setting the file path AFTER baking erases the image pixels to black. interesting is, that when I set the filepath before, it works. **Exact steps for others to reproduce the error** open file, run first script on upper left - that simply bakes into the image. run the second script, which tries to set name and save. see the blackness! [bakebug.blend](https://archive.blender.org/developer/F150571/bakebug.blend)
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Dalai Felinto was assigned by Vilem Duha 2015-03-13 15:39:50 +01:00
Author
Member

Added subscriber: @VilemDuha

Added subscriber: @VilemDuha

Added subscribers: @ideasman42, @Sergey, @mont29

Added subscribers: @ideasman42, @Sergey, @mont29

Setting the name of an image through RNA (i.e. python) forces reloading of that image (and since it does not yet exists on disc, it becomes black).

Campbell or Sergey, what do you think about adding an option to 'save' image func to specify a path?

Setting the name of an image through RNA (i.e. python) forces reloading of that image (and since it does not yet exists on disc, it becomes black). Campbell or Sergey, what do you think about adding an option to 'save' image func to specify a path?
Bastien Montagne changed title from Script-baked image gets erased when attempting to set filepath to Setting filepath of an image reloads it, which breaks all kind of generated content (including baking). 2015-03-13 16:13:00 +01:00
Dalai Felinto was unassigned by Bastien Montagne 2015-03-13 16:13:00 +01:00

Added subscriber: @dfelinto

Added subscriber: @dfelinto
Author
Member

Just to reply to your comment, not sure if it's a typo, but we talk about setting filepath, not name... although I didn't test if renaming does the same.

Just to reply to your comment, not sure if it's a typo, but we talk about setting filepath, not name... although I didn't test if renaming does the same.

Yeah, sure (issue being, 'filepath' var in C struct is actually called 'name' - talking about confusing naming :/ ).

Yeah, sure (issue being, 'filepath' var in C struct is actually called 'name' - talking about confusing naming :/ ).

Modifying filepath will re-load the image because you might have point it to an existing file. In order to modify file path to save the image after the bake you need to use filepath_raw.

Modifying filepath will re-load the image because you might have point it to an existing file. In order to modify file path to save the image after the bake you need to use `filepath_raw`.

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Campbell Barton self-assigned this 2015-03-16 03:45:00 +01:00

closing since this is known/intended behavior. Scripts can use filepath_raw.

closing since this is known/intended behavior. Scripts can use `filepath_raw`.
Author
Member

This could be called at least misleading, or very confusing behavior. The reloading is really not clear at all because it's not in documentation of the filepath prop, only mentioned in filepath_raw.... Also, what sense does it have to load an image which does not exist as a black image? shouldn't it try to load the image and when the file does not exist, then not do anything? Or, when the image path was same before, and I set the path 'to be sure' in the script, then this also has no logic at all..
But at least It's now clear to me...

This could be called at least misleading, or very confusing behavior. The reloading is really not clear at all because it's not in documentation of the filepath prop, only mentioned in filepath_raw.... Also, what sense does it have to load an image which does not exist as a black image? shouldn't it try to load the image and when the file does not exist, then not do anything? Or, when the image path was same before, and I set the path 'to be sure' in the script, then this also has no logic at all.. But at least It's now clear to me...
Author
Member

Ok, so I did more tests. And, filepath_raw actually doesn't work either. It doesn't erase the image changes, but the image doesn't get saved WITH the changes... at least in the testfile I sent. I totally understand it's good to lower the number of bugs before the release, but doing it this way isn't nice to users who spend time reporting the bugs....
should I report a new one?

Ok, so I did more tests. And, filepath_raw actually doesn't work either. It doesn't erase the image changes, but the image doesn't get saved WITH the changes... at least in the testfile I sent. I totally understand it's good to lower the number of bugs before the release, but doing it this way isn't nice to users who spend time reporting the bugs.... should I report a new one?

@VilemDuha - report a new bug is best,
However we've used both filepath(_raw) quite a lot, I would imagine if they were buggy we would have found before?.

This is how filepath_raw is intended to work:

  • Create new image
  • Edit pixels
  • Set filepath_raw (which wont reload)
  • Save the image Image.save

Nevertheless if you think you found a bug it would be really good to investigate before 2.74 release.

@VilemDuha - report a new bug is best, However we've used both filepath(_raw) quite a lot, I would imagine if they were buggy we would have found before?. This is how filepath_raw is intended to work: - Create new image - Edit pixels - Set `filepath_raw` (which wont reload) - Save the image `Image.save` Nevertheless if you think you found a bug it would be really good to investigate before 2.74 release.
Author
Member

well, I just replaced filepath with filepath_raw command in the example file. i will probably test a bit more and report then.

well, I just replaced filepath with filepath_raw command in the example file. i will probably test a bit more and report then.
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
4 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#43985
No description provided.