2
$\begingroup$

In this small menu example below, I'd like to know why "Save as" and "Export" are not working on my menu?

How am I supposed to save as inside of a menu?

What am I doing wrong ?

bl_info = {
    "name" : "Back Me Up [BD3D]", 
    "author" : "BD3D",   
    "description" : "Save like you never did before.",
    "blender" : (2, 80, 0),
    "location" : "Ctrl S, Operator",
    "warning" : "",
    "category" : "Generic"
}

import bpy
from bpy.types import Menu
import bpy
context = bpy.context

class VIEW3D_PIE_backmeuptradnormal(Menu): #problem first save and save as ? what ???????????????????????
    bl_label = ""
    bl_idname = "view3d.menu_normal_backmeup" #other id if two pies 

    def draw(self, context):
        layout = self.layout
        pie = layout
        pie.operator("wm.collada_export",text="export not working",  icon='BLENDER')
        pie.operator("wm.save_as_mainfile",text="save as not working",  icon='BLENDER')

def register():
    bpy.utils.register_class(VIEW3D_PIE_backmeuptradnormal)
def unregister():
    bpy.utils.unregister_class(VIEW3D_PIE_backmeuptradnormal)

if __name__ == "__main__":
    register()
    bpy.ops.wm.call_menu(name="view3d.menu_normal_backmeup")

-

$\endgroup$
0
$\begingroup$
pie.operator_context = 'INVOKE_DEFAULT'

this line before the operator

pie.operator_context = 'EXEC_REGION_WIN'

and this line after will do it

|improve this answer|||||
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.