Skip to content

Commit 2fdb356

Browse files
authored
Merge pull request #38 from Devostated/main
1.14.2 (2022-06-12T08:46Z) - fixed AGR Batch Export issue, which caused an error on export if an armature was deleted of the viewport
2 parents fa01304 + 7831fc1 commit 2fdb356

File tree

3 files changed

+42
-36
lines changed

3 files changed

+42
-36
lines changed

advancedfx/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
bl_info = {
44
"name": "advancedfx Blender Scripts",
55
"author": "advancedfx.org",
6-
"version": (1, 14, 0),
6+
"version": (1, 14, 2),
77
"blender": (2, 80, 0),
88
"location": "File > Import/Export",
99
"description": "For inter-operation with HLAE.",

advancedfx/export_agr2fbx.py

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -46,43 +46,46 @@ def execute(self, context):
4646
self.filepath = self.filepath.rsplit(sep="\\", maxsplit=1)[0] + "\\"
4747

4848
# export model
49+
bpy.ops.object.select_all(action='DESELECT')
4950
for CurrentModel in bpy.data.objects:
5051
if CurrentModel.name.find("afx.") != -1:
51-
# select root
52-
CurrentModel.select_set(1)
53-
# select childrens
54-
for CurrentChildren in CurrentModel.children:
55-
CurrentChildren.select_set(1)
56-
# rename top to root
57-
CurrentObjectName = CurrentModel.name
58-
CurrentModel.name = self.root_name
59-
# export single objects as fbx
60-
fullfiles = self.filepath + "/" + CurrentObjectName + ".fbx"
61-
if self.skip_meshes:
62-
bpy.ops.export_scene.fbx(
63-
filepath = fullfiles,
64-
object_types={'ARMATURE'},
65-
use_selection = True,
66-
global_scale = self.global_scale,
67-
bake_anim_use_nla_strips = False,
68-
bake_anim_use_all_actions = False,
69-
bake_anim_simplify_factor = 0,
70-
add_leaf_bones=False)
71-
else:
72-
bpy.ops.export_scene.fbx(
73-
filepath = fullfiles,
74-
object_types={'ARMATURE', 'MESH'},
75-
use_selection = True,
76-
global_scale = self.global_scale,
77-
bake_anim_use_nla_strips = False,
78-
bake_anim_use_all_actions = False,
79-
bake_anim_simplify_factor = 0,
80-
add_leaf_bones=False)
81-
# undo all changes
82-
CurrentModel.name = CurrentObjectName
83-
CurrentModel.select_set(0)
84-
for CurrentChildren in CurrentModel.children:
85-
CurrentChildren.select_set(0)
52+
for o in context.scene.objects:
53+
if o.name == CurrentModel.name:
54+
# select root
55+
CurrentModel.select_set(1)
56+
# select childrens
57+
for CurrentChildren in CurrentModel.children:
58+
CurrentChildren.select_set(1)
59+
# rename top to root
60+
CurrentObjectName = CurrentModel.name
61+
CurrentModel.name = self.root_name
62+
# export single objects as fbx
63+
fullfiles = self.filepath + "/" + CurrentObjectName + ".fbx"
64+
if self.skip_meshes:
65+
bpy.ops.export_scene.fbx(
66+
filepath = fullfiles,
67+
object_types={'ARMATURE'},
68+
use_selection = True,
69+
global_scale = self.global_scale,
70+
bake_anim_use_nla_strips = False,
71+
bake_anim_use_all_actions = False,
72+
bake_anim_simplify_factor = 0,
73+
add_leaf_bones=False)
74+
else:
75+
bpy.ops.export_scene.fbx(
76+
filepath = fullfiles,
77+
object_types={'ARMATURE', 'MESH'},
78+
use_selection = True,
79+
global_scale = self.global_scale,
80+
bake_anim_use_nla_strips = False,
81+
bake_anim_use_all_actions = False,
82+
bake_anim_simplify_factor = 0,
83+
add_leaf_bones=False)
84+
# undo all changes
85+
CurrentModel.name = CurrentObjectName
86+
CurrentModel.select_set(0)
87+
for CurrentChildren in CurrentModel.children:
88+
CurrentChildren.select_set(0)
8689

8790
# export camera
8891
for CameraData in bpy.data.objects:

advancedfx/readme.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ For more informations visit it's Advancedfx Wiki page ( https://github.com/advan
5050

5151
Changelog:
5252

53+
1.14.2 (2022-06-12T08:46Z):
54+
- fixed AGR Batch Export issue, which caused an error on export if an armature was deleted of the viewport
55+
5356
1.14.1 (2022-03-11T22:28Z):
5457
- Added support for AGR version 6, still supports version 5.
5558

0 commit comments

Comments
 (0)