Im in need of some python help or someone with more knowlage with python, tryn to update an old 2.7 scrip to 2.8 and so far so good until clicking on export button. i get this error when using a relative path and the same using a custom path but on line 1638

NameError: name 'FBX_Export_Actions' is not defined , line 1636, in execute

This is the error lines within my class

#FBX Export button  
class FBXEXPORT_OT_button(bpy.types.Operator):
    """Button for Fbx Export"""
    bl_idname = "ue.export_fbx_button"
    bl_label = "ExportFbxButton" 
    def execute (self, context):   
        ActualPath = dirname(bpy.data.filepath) 
        if FBXRelativeFolderSelector == True:            
            if ActualPath == "":
                self.report({'ERROR'}, "You need Save the file for use save automatically into a relative folder")
                FBX_Export_actions(self,context) #this is line 1636
            FBX_Export_actions(self,context)     #this is line 1638  
        #print("test OK")
        return {'FINISHED'}

I can see the problem is within FBX_Export_Actions (maybe not being defined right?)

    #Init button  
class INITUETOOLS_OT_button(bpy.types.Operator): #InitUEToolsButton
    """Init Main Properties"""
    bl_idname = "ue.init_button"
    bl_label = "InitButton"    
    def execute (self, context):       
        global Init
        Init = True        
        return {'FINISHED'}   

    #FBX Export Actions

    def FBX_Export_actions(self,context):
        if FBX_PivotToCenter == True:                  
            global FBX_name_multi
            scn = context.scene 
            sufix = 0
            #Create group
            group = "exportgroup"
            if group in bpy.data.collections:
                print ("Group already created")
            ActionGroup = bpy.data.collections["exportgroup"]
            Get_Custom_ExportName("String:   ", 'FBX_Custom_Export_Path', scn)
            #Group Operation
            for ob in ActionGroup.objects:
                ob.select = True
                bpy.context.scene.objects.active = ob
                bpy.context.view_layer.objects.active = ob
                if FBXBaseNameSelector == "Object":
                    FBX_name_multi = ob.name
                if FBXBaseNameSelector == "Custom":
                    FBX_name_multi = FBX_CustomExportName + "_" + str(sufix)
                #Store initial position
                obStartPosX = ob.location[0]
                obStartPosY = ob.location[1]
                obStartPosZ = ob.location[2]
                if FBX_ExportCollision == False:
                    print("Collision Not Exported")
                if FBX_ExportCollision == True:
                    FBX_SelectCollsionObjects (self,context)  
                #move object to center
                ob.location = (0,0,0) 
                #Move to initial position
                ob.location = (obStartPosX,obStartPosY,obStartPosZ)
                ob.select = False
                if FBX_ExportCollision == False:
                    print("Collision Not Exported")
                if FBX_ExportCollision == True:
                    FBX_SelectCollsionObjects (self,context)
                    #FBX_Make_Only_selectedObjLayer_visible (self,context)               
                sufix = sufix +1           
        if FBX_PivotToCenter == False:
            print("Export normally")  

It would be a great help if anyone could take a look over this code and help to pinpoint this error.

  • 1
    $\begingroup$ Hi and welcome! TBH: There are several naming and reference issues in the script so I don't think it's worth it fixing the bugs. I recommend have a look into the templates that come with blender and start from scratch. What exactly the add-on is doing? Just exporting individual objects of the scene for unreal? Maybe related: blender.stackexchange.com/a/169820/31447 $\endgroup$ – brockmann Jul 12 at 21:51
  • $\begingroup$ Hey and ty for the welcome @brockmann, This is an old 2.7 addon (Created by Lluis Garca lluisgarcia.es/ue-tools-addon ) for exporting to EU4, im not so python savvy and have tryd to contact him but seems he has no plans to update, so have took it on myself to attemp to update it although im really only looking for the Exporting tools and after a week of fixing errors and bugs have been thinking it may be alot less hastle to create a new scrip from scratch^^ Thank you for the link (will be taking notes from it) $\endgroup$ – Kenny W Jul 12 at 22:33
  • $\begingroup$ also This is the idea i have/looking to accomplish - dropbox.com/s/oxeg3fibd3ang8o/Capture.PNG?dl=0 Iv been going over as many resources i can find online and examples ect but still getting to grips with python... If you have any ideas on how to create such a script that would be greatly appreciated $\endgroup$ – Kenny W Jul 12 at 22:34
  • $\begingroup$ Check out the answer I've posted, all in there. To get such interface you would have to declare the properties like use_selection_setting, axis_forward_setting in your export_helper class and they will appear in the properties area of the file browser, done. Or check out the templates that come with blender as mentioned (text editor > templates > python)... Had a look at the original script and I still think this is crappy IMHO. $\endgroup$ – brockmann Jul 12 at 22:43
  • $\begingroup$ Will do thanks for your help $\endgroup$ – Kenny W Jul 12 at 22:44

Your Answer

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

Browse other questions tagged or ask your own question.