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")
else:
FBX_Export_actions(self,context) #this is line 1636
else:
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):
Main_UI_Properties(bpy.context.scene)
SetObjScale(bpy.context.scene)
Rename_Properties(bpy.context.scene)
FBX_Export_Properties(bpy.context.scene)
Animation_UI_Properties(bpy.context.scene)
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")
else:
bpy.ops.collections.create(name="exportgroup")
ActionGroup = bpy.data.collections["exportgroup"]
bpy.ops.object.select_all(action='DESELECT')
Get_Custom_ExportName("String: ", 'FBX_Custom_Export_Path', scn)
#Group Operation
for ob in ActionGroup.objects:
print(ob.name)
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
bpy.ops.view3d.snap_cursor_to_center(false)
bpy.ops.view3d.snap_selected_to_cursor(use_offset=False)
ob.location = (0,0,0)
#Export
FBX_Export(self,context)
#Move to initial position
ob.location = (obStartPosX,obStartPosY,obStartPosZ)
bpy.ops.view3d.snap_cursor_to_active()
bpy.ops.view3d.snap_selected_to_cursor(use_offset=False)
ob.select = False
if FBX_ExportCollision == False:
print("Collision Not Exported")
if FBX_ExportCollision == True:
FBX_SelectCollsionObjects (self,context)
bpy.ops.object.select_all(action='DESELECT')
#FBX_Make_Only_selectedObjLayer_visible (self,context)
sufix = sufix +1
bpy.data.collections["exportgroup"].user_clear()
bpy.data.collections.remove(bpy.data.collections["exportgroup"])
#print("pivotOK")
if FBX_PivotToCenter == False:
FBX_Export(self,context)
print("Export normally")
It would be a great help if anyone could take a look over this code and help to pinpoint this error.
use_selection_setting,axis_forward_settingin yourexport_helperclass 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. – brockmann Jul 12 '20 at 22:43