Regression: Image Editor / UV window, image display no longer updates in view when image data is changed from script #98321

Closed
opened 2022-05-22 20:38:17 +02:00 by Valera Barashkov · 8 comments

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3060/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 512.77

Blender Version
Broken: version: 3.2.0 Alpha, branch: master, commit date: 2022-04-05 23:33, hash: 931ae424b9
Worked: 3.0.1

Short description of error

bug image (1).mp4

Here it is working in 3.0:
bug image .mp4

Exact steps for others to reproduce the error
Set UI like in the video. Make sure to have an image and set the index in the script. Run script. Notice you have to drag / zoom in the image editor for the image to update.

import bpy

img_index = 0 # set image index

pixels = bpy.data.images[img_index].pixels

# just a safety so Blender dont freeze
if len(pixels) > 300*300*4:
    raise Exception("Image will take a long time! Use smaller size")

# change alpha / color
for i in range(len(pixels)):
    pixels[i] = 0

# this no longer works in 3.1, 3.2
bpy.data.images[img_index].update()

# not usually necessary, but just in case..
for area in bpy.context.window.screen.areas:
    if area.type == 'UV' or area.type == 'IMAGE_EDITOR':
        bpy.context.window.screen.areas[5].tag_redraw()
**System Information** Operating system: Windows-10-10.0.19044-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3060/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 512.77 **Blender Version** Broken: version: 3.2.0 Alpha, branch: master, commit date: 2022-04-05 23:33, hash: `931ae424b9` Worked: 3.0.1 **Short description of error** [bug image (1).mp4](https://archive.blender.org/developer/F13097999/bug_image___1_.mp4) Here it is working in 3.0: [bug image .mp4](https://archive.blender.org/developer/F13097973/bug_image_.mp4) **Exact steps for others to reproduce the error** Set UI like in the video. Make sure to have an image and set the index in the script. Run script. Notice you have to drag / zoom in the image editor for the image to update. ``` import bpy img_index = 0 # set image index pixels = bpy.data.images[img_index].pixels # just a safety so Blender dont freeze if len(pixels) > 300*300*4: raise Exception("Image will take a long time! Use smaller size") # change alpha / color for i in range(len(pixels)): pixels[i] = 0 # this no longer works in 3.1, 3.2 bpy.data.images[img_index].update() # not usually necessary, but just in case.. for area in bpy.context.window.screen.areas: if area.type == 'UV' or area.type == 'IMAGE_EDITOR': bpy.context.window.screen.areas[5].tag_redraw() ```

Added subscriber: @valera-8

Added subscriber: @valera-8

Added subscriber: @deadpin

Added subscriber: @deadpin

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Confirmed: rna_Image_update is missing a call to BKE_image_partial_update_mark_full_update(image); which will solve this bug.

Anecdotally, rna_Image_scale / BKE_image_scale are also missing some form of image / editor update but their solution is somewhat different and not a recent regression. Would be good to fix that api though too.

Confirmed: `rna_Image_update` is missing a call to `BKE_image_partial_update_mark_full_update(image);` which will solve this bug. Anecdotally, `rna_Image_scale / BKE_image_scale` are also missing some form of image / editor update but their solution is somewhat different and not a recent regression. Would be good to fix that api though too.
Member

Added subscriber: @Jeroen-Bakker

Added subscriber: @Jeroen-Bakker
Jeroen Bakker self-assigned this 2022-05-23 07:54:32 +02:00
Member

@deadpin, thanks for checking. Will update the rna_Image_update.

@deadpin, thanks for checking. Will update the rna_Image_update.

This issue was referenced by 4418536f69

This issue was referenced by 4418536f69dae23985cb55195066521af488298b
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
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#98321
No description provided.