Loading an image with bpy.data.images.load(path) Freezes the add-on panel in the 3D tool shelf #44930

Closed
opened 2015-06-02 20:04:05 +02:00 by Nils Söderman · 12 comments

System Information
Windows 64 bit
NVIDIA GeForce GTX 660 Ti

Blender Version
Broken: 2.74 000dfc0 as well as 2.74.5 148ed4e

Short description of error

Running the code:
bpy.data.images.load(path)
Will load the image into blender, bit it will also lock/freeze the add-on panel found in the Tool Shelf. http://i.imgur.com/WzXxIiT.png

Exact steps for others to reproduce the error
Based on a (as simple as possible) attached .blend file with minimum amount of steps

Blend file with code already set up: https://dl.dropboxusercontent.com/u/108488518/Add-on_Panel_Freezes.blend

Run the script and an item will be added to the Add menu(shift + A) under Mesh, http://i.imgur.com/TgWyxYN.png
Pressing "Object" will bring up the add-on panel, use the file browser to locate any image, select it and hit enter, the panel will then lock/freeze.

However, if you where to hit "Object" in the add menu 2 times before using the file browser it will work, and you can still change the "Option 2".

Code:

import bpy
from bpy.props import *

class primitive_object_add(bpy.types.Operator):
    '''Add an object'''
    bl_idname = "mesh.primitive_object_add"
    bl_label = "Add an object"
    bl_options = {'REGISTER', 'UNDO'}
    path = StringProperty(name="Path:", default="", subtype='FILE_PATH')
    opt = IntProperty(name="Option 2:")

    def execute(self, context):
        if self.path != "":            
            path = r"" + bpy.path.abspath(self.path)
            image = bpy.data.images.load(path)
        return {'FINISHED'}

def menu_func(self, context):
    self.layout.operator("mesh.primitive_object_add", text="Object", icon='OBJECT_DATA')
def register():
   bpy.utils.register_module(__name__)
   bpy.types.INFO_MT_mesh_add.append(menu_func)
def unregister():
    bpy.utils.unregister_module(__name__)
    bpy.types.INFO_MT_mesh_add.remove(menu_func)
if __name__ == "__main__":
    register()
**System Information** Windows 64 bit NVIDIA GeForce GTX 660 Ti **Blender Version** Broken: 2.74 000dfc0 as well as 2.74.5 148ed4e **Short description of error** Running the code: bpy.data.images.load(path) Will load the image into blender, bit it will also lock/freeze the add-on panel found in the Tool Shelf. http://i.imgur.com/WzXxIiT.png **Exact steps for others to reproduce the error** Based on a (as simple as possible) attached .blend file with minimum amount of steps Blend file with code already set up: https://dl.dropboxusercontent.com/u/108488518/Add-on_Panel_Freezes.blend Run the script and an item will be added to the Add menu(shift + A) under Mesh, http://i.imgur.com/TgWyxYN.png Pressing "Object" will bring up the add-on panel, use the file browser to locate any image, select it and hit enter, the panel will then lock/freeze. However, if you where to hit "Object" in the add menu 2 times before using the file browser it will work, and you can still change the "Option 2". Code: ``` import bpy from bpy.props import * class primitive_object_add(bpy.types.Operator): '''Add an object''' bl_idname = "mesh.primitive_object_add" bl_label = "Add an object" bl_options = {'REGISTER', 'UNDO'} path = StringProperty(name="Path:", default="", subtype='FILE_PATH') opt = IntProperty(name="Option 2:") def execute(self, context): if self.path != "": path = r"" + bpy.path.abspath(self.path) image = bpy.data.images.load(path) return {'FINISHED'} def menu_func(self, context): self.layout.operator("mesh.primitive_object_add", text="Object", icon='OBJECT_DATA') def register(): bpy.utils.register_module(__name__) bpy.types.INFO_MT_mesh_add.append(menu_func) def unregister(): bpy.utils.unregister_module(__name__) bpy.types.INFO_MT_mesh_add.remove(menu_func) if __name__ == "__main__": register() ```
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @NilsSoderman

Added subscriber: @NilsSoderman

Added subscriber: @fakhribou

Added subscriber: @fakhribou

Added subscriber: @RonHatfield

Added subscriber: @RonHatfield

Using:

NVIDIA GTX 660
Driver version 347.88 on a
Windows 7 Pro 64-bit (Service Pack 1) 24 GB RAM i5-3570 CPU @ 3.40GHz
NVIDIA CUDA 7.0.29 driver
NVCUDA.DLL version 8.17.13.488

Following the steps as outlined above, I was able to reproduce as reported above.
However, although the add-on panel "greys out", Blender is not locked up and I can continue on.
If you run the included script multiple times you will get multiple versions of the "Object" on the add mesh menu.

One additional, totally unwanted, result appears to be the overwriting of my startup.blend file (I did not save them) and after closing Blender, a complete inability to successfully restart Blender 2.74.

Running Blender 2.74 from command line I get:
read blend: C:\Users\HATFIE~1\AppData\Local\Temp\quit.blend
Error: EXCEPTION_ACCESS_VIOLATION
Writing: C:\Users\HATFIE~1\AppData\Local\Temp\blender.crash.txt

Blender.crash.txt contains the following:

Blender 2.74 (sub 1), Commit date: 2015-03-17 19:10, Hash 6389730

backtrace

17: PyInit_mathutils_noise_types - 0x40BF9740
16: fftw_plan_many_dft - 0x3FF847B0
15: fftw_plan_many_dft - 0x3FF847B0
14: fftw_plan_many_dft - 0x3FF847B0
13: UnhandledExceptionFilter - 0x7731B850
12: EtwEventSetInformation - 0x77527C58
11: _C_specific_handler - 0x774B7F0C
10: RtlDecodePointer - 0x774C9100
9: RtlUnwindEx - 0x774B7FF0
8: KiUserExceptionDispatcher - 0x774EDB0A
7: fftw_plan_many_dft - 0x3FF847B0
6: fftw_plan_many_dft - 0x3FF847B0
5: fftw_plan_many_dft - 0x3FF847B0
4: fftw_plan_many_dft - 0x3FF847B0
3: fftw_plan_many_dft - 0x3FF847B0
2: osl_trunc_vv - 0x42413F60
1: BaseThreadInitThunk - 0x772959C0
0: RtlUserThreadStart - 0x774CB960

Blender 2.72 starts but with the user aboves startup file UI.
Deleting the quit.blend file in C:\Users\HATFIE~1\AppData\Local\Temp puts me back in business with 2.74

This got me thinking it might be the .blend file. So I ran the script by itself in my own UI.
I got the exact same results including the inability to re-start Blender 2.74 due to error: EXCEPTION_ACCESS_VIOLATION
Again deleting the quit.blend file puts me back to work.

This gets me thinking that that the add-on on the tool shelf is likely grayed out due a lack of ACCESS to that file/path and running it twice as the OP states clears whatever file/path "lock" that the script above places on it.

I'm not sure how to prove/disprove this hypothesis but am willing to try if someone has the steps.

  • R
Using: NVIDIA GTX 660 Driver version 347.88 on a Windows 7 Pro 64-bit (Service Pack 1) 24 GB RAM i5-3570 CPU @ 3.40GHz NVIDIA CUDA 7.0.29 driver NVCUDA.DLL version 8.17.13.488 Following the steps as outlined above, I was able to reproduce as reported above. However, although the add-on panel "greys out", Blender is not locked up and I can continue on. If you run the included script multiple times you will get multiple versions of the "Object" on the add mesh menu. One additional, totally unwanted, result appears to be the overwriting of my startup.blend file (I did not save them) and after closing Blender, a complete inability to successfully restart Blender 2.74. Running Blender 2.74 from command line I get: read blend: C:\Users\HATFIE~1\AppData\Local\Temp\quit.blend Error: EXCEPTION_ACCESS_VIOLATION Writing: C:\Users\HATFIE~1\AppData\Local\Temp\blender.crash.txt Blender.crash.txt contains the following: # Blender 2.74 (sub 1), Commit date: 2015-03-17 19:10, Hash 6389730 # backtrace 17: PyInit_mathutils_noise_types - 0x40BF9740 16: fftw_plan_many_dft - 0x3FF847B0 15: fftw_plan_many_dft - 0x3FF847B0 14: fftw_plan_many_dft - 0x3FF847B0 13: UnhandledExceptionFilter - 0x7731B850 12: EtwEventSetInformation - 0x77527C58 11: _C_specific_handler - 0x774B7F0C 10: RtlDecodePointer - 0x774C9100 9: RtlUnwindEx - 0x774B7FF0 8: KiUserExceptionDispatcher - 0x774EDB0A 7: fftw_plan_many_dft - 0x3FF847B0 6: fftw_plan_many_dft - 0x3FF847B0 5: fftw_plan_many_dft - 0x3FF847B0 4: fftw_plan_many_dft - 0x3FF847B0 3: fftw_plan_many_dft - 0x3FF847B0 2: osl_trunc_vv - 0x42413F60 1: BaseThreadInitThunk - 0x772959C0 0: RtlUserThreadStart - 0x774CB960 Blender 2.72 starts but with the user aboves startup file UI. Deleting the quit.blend file in C:\Users\HATFIE~1\AppData\Local\Temp puts me back in business with 2.74 This got me thinking it might be the .blend file. So I ran the script by itself in my own UI. I got the exact same results including the inability to re-start Blender 2.74 due to error: EXCEPTION_ACCESS_VIOLATION Again deleting the quit.blend file puts me back to work. This gets me thinking that that the add-on on the tool shelf is likely grayed out due a lack of ACCESS to that file/path and running it twice as the OP states clears whatever file/path "lock" that the script above places on it. I'm not sure how to prove/disprove this hypothesis but am willing to try if someone has the steps. - R

After further review, I think I was off the mark having possibly mixed 2 separate issues into 1.
Further testing today proved that state of the path doesn't have any bearing on this issue.

This beyond my meager Python skills.
Closest I could come washttp://www.blender.org/api/blender_python_api_2_57_release/bpy.types.Operator.html

Sorry for muddying the waters.

  • R
After further review, I think I was off the mark having possibly mixed 2 separate issues into 1. Further testing today proved that state of the path doesn't have any bearing on this issue. This beyond my meager Python skills. Closest I could come was[http://www.blender.org/api/blender_python_api_2_57_release/bpy.types.Operator.html ](URL) Sorry for muddying the waters. - R

Added subscriber: @ideasman42

Added subscriber: @ideasman42

@RonHatfield, its not clear what the issue is here.

Could you provide a script which we can run to redo the error?

Also can you explain what you mean by freeze (does it un-freeze after some time... how long... ?)

This could be related to #44952

@RonHatfield, its not clear what the issue is here. Could you provide a script which we can run to redo the error? Also can you explain what you mean by *freeze* (does it un-freeze after some time... how long... ?) This could be related to #44952

The script to run is listed in the original steps to reproduce.

I don't think it's related to #44952 as the image seems to load in a timely fashion when selecting "object" a 2nd time (I think naming something "object" is a bad idea, but that's just my opinion. Changing it's label has no effect ).

The original poster claims after the posted script is run, selecting "object" from the Add Mesh menu AND after interacting with the object panel on the Tool Tab (keyboard shortcut: t) by selecting the path from the newly created "Add an object" panel in the tool tab, that said object panel "locks up".

I stated that the panel does "grey out" meaning you can't select another image from it.
However, Blender's other functions are not affected, and if you go back to the add mesh menu (Shift A ->Mesh) and select "object" again the panel is active again and you can load another image. F6 on that panel works as expected. Re-running the action from the History panel results in the panel being active again.

This is consistent with the way many panels act when adding any object(s) into Blender from the add mesh menu, let's say a cube for instance.
After you've taken action on that cube (let's say move it) you're not allowed to make changes to that object (Radius, Location, Rotation in the case of our cube) from that same panel.

I think because the image is now loaded into memory in the image editor and other locations (such as the image texture open dialog) in Blender that an "action" has taken place on this object and it can't be changed.

The only potential "problem" I can see here is that the panel isn't closed after the action (image loaded) takes place thus giving visual feedback to the user that there's nothing else to do here on this object. If the Developer of this script wanted something else done other than the object loaded into Blender then shouldn't they have coded it?

  • R
The script to run is listed in the original steps to reproduce. I don't think it's related to **[#44952 ](https://developer.blender.org/T44952)** as the image seems to load in a timely fashion when selecting "object" a 2nd time (I think naming something "object" is a bad idea, but that's just my opinion. Changing it's label has no effect ). The original poster claims after the posted script is run, selecting "object" from the Add Mesh menu AND after interacting with the object panel on the Tool Tab (keyboard shortcut: t) by selecting the path from the newly created "Add an object" panel in the tool tab, that said object panel "locks up". I stated that the panel does "grey out" meaning you can't select another image from it. However, Blender's other functions are not affected, and if you go back to the add mesh menu (Shift A ->Mesh) and select "object" again the panel is active again and you can load another image. F6 on that panel works as expected. Re-running the action from the History panel results in the panel being active again. This is consistent with the way many panels act when adding any object(s) into Blender from the add mesh menu, let's say a cube for instance. After you've taken action on that cube (let's say move it) you're not allowed to make changes to that object (Radius, Location, Rotation in the case of our cube) from that same panel. I think because the image is now loaded into memory in the image editor and other locations (such as the image texture open dialog) in Blender that an "action" has taken place on this object and it can't be changed. The only potential "problem" I can see here is that the panel isn't closed after the action (image loaded) takes place thus giving visual feedback to the user that there's nothing else to do here on this object. If the Developer of this script wanted something else done other than the object loaded into Blender then shouldn't they have coded it? - R

This issue was referenced by cb9bd23d0c

This issue was referenced by cb9bd23d0cac33c456c97c207cac4539269db518

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Issue was executing the file selector did an undo push, which caused the redo panel to consider the operator as no longer the last active operator. Fixed.

(I read report as if it were a software glitch - freeze/crash) - Now undo is read from the button, Only buttons that are flagged to undo will cause an undo push.

Issue was executing the file selector did an undo push, which caused the redo panel to consider the operator as no longer the last active operator. Fixed. *(I read report as if it were a software glitch - freeze/crash)* - Now undo is read from the button, Only buttons that are flagged to undo will cause an undo push.
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
5 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#44930
No description provided.