poly-hammer / BlenderTools

Blender addons that improve the game development workflow between Blender and Unreal.
https://poly-hammer.github.io/BlenderTools/
MIT License
201 stars 14 forks source link

Load / Save Template crash Blender 4.2 RC #39

Open youthatninja opened 3 months ago

youthatninja commented 3 months ago

Blender 4.2 RC crash on Load and Save Template in Settings Dialog

JoshQuake commented 3 months ago

Interesting. Thanks for the report!

JoshQuake commented 3 months ago

I'm unable to replicate the issue. Can you please attach a zip of the blend and the template being loaded?

youthatninja commented 3 months ago

Yeah, I think the problem is in my user prefs after migrating from 3.6./ 4.1 I have the same crashers if I do reload scripts or load factory settings in Blender Any suggestions on how to debug this? :D

youthatninja commented 3 months ago

Found the issue, the crash will happen if you set the temporary editor file browser to maximized area image

also found this, https://projects.blender.org/blender/blender/issues/123698 ue2rigify uses legasy undo

JoshQuake commented 3 months ago

Confirmed crashing with access violation using the above setting on 4.1 and 4.2 blender.crash.txt

JoshQuake commented 2 months ago

Welp I put break points all over the place where the file browser gets opened and none get triggered. My current theory is Blender is trying to interact with the settings dialog through context or something which ends up not existing in memory anymore since the area gets replaced with the file browser. Might be something to report to Blender themselves.

youthatninja commented 2 months ago

I haven't spotted any new report about the maximized area, plus I have no issues in other addons that use file browser

JoshQuake commented 2 months ago

Hmmm can I please get the name of some of those addons so I can test? I wonder if it's something to do with ImportHelper / ExportHelper

youthatninja commented 2 months ago

Pie menu Editor - Command - External Script image UVpackMaster - load preset image

youthatninja commented 2 months ago

Heh, there is no crash on Pipline -Import -Import Asset

JoshQuake commented 2 months ago

Yeah that's why I'm thinking it's something in the backend having to do with trying to close out of a popup. The only difference between them from what I can see is that ImportAsset isn't accessed from a dialog. I'm going to try adding that operator to the dialog and see what happens.

JoshQuake commented 2 months ago

Yep it crashes from the dialog (bpy.types.Panel)

JoshQuake commented 2 months ago

I wrote a simple addon that replicates how send2ue invokes the setting dialog and load/save template ImportHelper operators and can confirm it crashes.

import bpy
from bpy_extras.io_utils import ImportHelper
from bpy.types import Operator, Menu

class ExamplePanelOperator(bpy.types.Operator):
    bl_idname = "object.example_panel_operator"
    bl_label = "Example Panel Operator"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):
        return context.window_manager.invoke_popup(self, width=200)

    def draw(self, context):
        layout = self.layout
        layout.operator("object.example_operator")

class ExampleOperator(Operator, ImportHelper):
    bl_idname = "object.example_operator"
    bl_label = "Open File"

    def execute(self, context):
        print("You clicked on the panel operator and a file browser was opened.")
        return {'FINISHED'}

class ExampleMenu(Menu):
    bl_idname = "TOPBAR_MT_CustomMenu"
    bl_label = "Custom Menu"

    def draw(self, context):
        layout = self.layout
        layout.operator("object.example_panel_operator")

def menu_draw_func(self, context):
    self.layout.menu(ExampleMenu.bl_idname)

def register():
    bpy.utils.register_class(ExampleOperator)
    bpy.utils.register_class(ExamplePanelOperator)
    bpy.utils.register_class(ExampleMenu)
    bpy.types.TOPBAR_MT_editor_menus.append(menu_draw_func)

def unregister():
    bpy.types.TOPBAR_MT_editor_menus.remove(menu_draw_func)
    bpy.utils.unregister_class(ExampleMenu)
    bpy.utils.unregister_class(ExamplePanelOperator)
    bpy.utils.unregister_class(ExampleOperator)

if __name__ == "__main__":
    register()
JoshQuake commented 2 months ago

I have created a bug report for Blender here

youthatninja commented 2 months ago

Thank you 🙏