Skip to content

Commit d0006c7

Browse files
committed
1.14.4 (2025-03-19T11:42Z)
- add support for Blender 4.4 - removed unnecessary indents
1 parent 96f832a commit d0006c7

File tree

9 files changed

+460
-430
lines changed

9 files changed

+460
-430
lines changed

advancedfx/__init__.py

Lines changed: 3 additions & 3 deletions
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, 3),
6+
"version": (1, 14, 4),
77
"blender": (3, 5, 0),
88
"location": "File > Import/Export",
99
"description": "For inter-operation with HLAE.",
@@ -46,7 +46,7 @@ def register():
4646
from bpy.utils import register_class
4747
for cls in classes:
4848
register_class(cls)
49-
49+
5050
bpy.types.TOPBAR_MT_file_import.append(menu_func_import_agr)
5151
bpy.types.TOPBAR_MT_file_export.append(menu_func_export_agr2fbx)
5252
bpy.types.TOPBAR_MT_file_import.append(menu_func_import_cam)
@@ -58,7 +58,7 @@ def unregister():
5858
from bpy.utils import unregister_class
5959
for cls in reversed(classes):
6060
unregister_class(cls)
61-
61+
6262
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export_bvh)
6363
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import_bvh)
6464
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import_agr)

advancedfx/export_agr2fbx.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ class AgrExport(bpy.types.Operator):
88
bl_idname = "advancedfx.agr_to_fbx"
99
bl_label = "HLAE afxGameRecord"
1010
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
11-
11+
1212
filepath: bpy.props.StringProperty(subtype="DIR_PATH")
13-
13+
1414
global_scale: bpy.props.FloatProperty(
1515
name="Scale",
1616
description="Scale everything by this value",
@@ -30,15 +30,15 @@ class AgrExport(bpy.types.Operator):
3030
description="Skips mesh export for faster export",
3131
default=True,
3232
)
33-
33+
3434
def menu_draw_export(self, context):
3535
layout = self.layout
3636
layout.operator("advancedfx.agr_to_fbx", text="HLAE afxGameRecord")
37-
37+
3838
def invoke(self, context, event):
3939
context.window_manager.fileselect_add(self)
4040
return {'RUNNING_MODAL'}
41-
41+
4242
def execute(self, context):
4343
time_start = time.time()
4444
# Change Filepath, if something got insert in the File Name box

advancedfx/export_bvh.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ def WriteHeader(file, frames, frameTime):
2828
file.write("MOTION\n")
2929
file.write("Frames: "+str(frames)+"\n")
3030
file.write("Frame Time: "+FloatToBvhString(frameTime)+"\n")
31-
31+
3232
class BvhExporter(bpy.types.Operator, vs_utils.Logger):
3333
bl_idname = "advancedfx.bvhexporter"
3434
bl_label = "HLAE old Cam IO (.bvh)"
3535
bl_options = {'UNDO'}
36-
36+
3737
# Properties used by the file browser
3838
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
3939
filter_glob: bpy.props.StringProperty(default="*.bvh", options={'HIDDEN'})
@@ -46,7 +46,7 @@ class BvhExporter(bpy.types.Operator, vs_utils.Logger):
4646
soft_min=1.0, soft_max=1000.0,
4747
default=100.0,
4848
)
49-
49+
5050
frame_start: bpy.props.IntProperty(
5151
name="Start Frame",
5252
description="Starting frame to export",
@@ -61,76 +61,76 @@ class BvhExporter(bpy.types.Operator, vs_utils.Logger):
6161

6262
def execute(self, context):
6363
ok = self.writeBvh(context)
64-
64+
6565
self.errorReport("Error report")
66-
66+
6767
return {'FINISHED'}
68-
68+
6969
def invoke(self, context, event):
7070
self.frame_start = context.scene.frame_start
7171
self.frame_end = context.scene.frame_end
72-
72+
7373
bpy.context.window_manager.fileselect_add(self)
74-
74+
7575
return {'RUNNING_MODAL'}
76-
76+
7777
def writeBvh(self, context):
7878
scene = context.scene
7979
frame_current = scene.frame_current
8080
fps = context.scene.render.fps
81-
81+
8282
obj = context.active_object
83-
83+
8484
if obj is None:
8585
self.error("No object selected.")
8686
return False
87-
87+
8888
lastRot = None
89-
89+
9090
mRot = mathutils.Matrix.Rotation(math.radians(-90.0 if "CAMERA" == obj.type else 0.0), 4, 'X')
9191
mTrans = mathutils.Matrix.Scale(-1,4,(-1.0, 0.0, 0.0))
92-
92+
9393
file = None
94-
94+
9595
try:
9696
file = open(self.filepath, "w", encoding="utf8", newline="\n")
97-
97+
9898
frameCount = self.frame_end -self.frame_start +1
9999
if frameCount < 0: frameCount = 0
100-
100+
101101
frameTime = 1.0
102102
if 0.0 != fps: frameTime = frameTime / fps
103-
103+
104104
WriteHeader(file, frameCount, frameTime)
105-
105+
106106
for frame in range(self.frame_start, self.frame_end + 1):
107107
scene.frame_set(frame)
108-
108+
109109
mat = obj.matrix_world
110110
mat = mat @ mRot
111-
111+
112112
loc = mat.to_translation()
113-
113+
114114
rot = mat.to_euler('YXZ') if lastRot is None else mat.to_euler('YXZ', lastRot)
115115
lastRot = rot
116-
117-
118-
116+
117+
118+
119119
X = -(-loc[0]) * self.global_scale
120120
Y = loc[2] * self.global_scale
121121
Z = -loc[1] * self.global_scale
122-
122+
123123
XR = -math.degrees(-rot[0])
124124
YR = math.degrees( rot[2])
125125
ZR = -math.degrees( rot[1])
126-
126+
127127
S = "" +FloatToBvhString(X) +" " +FloatToBvhString(Y) +" " +FloatToBvhString(Z) +" " +FloatToBvhString(ZR) +" " +FloatToBvhString(XR) +" " +FloatToBvhString(YR) + "\n"
128128
file.write(S)
129-
129+
130130
finally:
131131
if file is not None:
132132
file.close()
133-
133+
134134
scene.frame_set(frame_current)
135-
135+
136136
return True

advancedfx/export_cam.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class CamExporter(bpy.types.Operator, vs_utils.Logger):
2323
bl_idname = "advancedfx.camexporter"
2424
bl_label = "HLAE Camera IO (.cam)"
2525
bl_options = {'UNDO'}
26-
26+
2727
# Properties used by the file browser
2828
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
2929
filter_glob: bpy.props.StringProperty(default="*.cam", options={'HIDDEN'})
@@ -36,7 +36,7 @@ class CamExporter(bpy.types.Operator, vs_utils.Logger):
3636
soft_min=1.0, soft_max=1000.0,
3737
default=100.0,
3838
)
39-
39+
4040
frame_start: bpy.props.IntProperty(
4141
name="Start Frame",
4242
description="Starting frame to export",
@@ -51,73 +51,73 @@ class CamExporter(bpy.types.Operator, vs_utils.Logger):
5151

5252
def execute(self, context):
5353
ok = self.writeBvh(context)
54-
54+
5555
self.errorReport("Error report")
56-
56+
5757
return {'FINISHED'}
58-
58+
5959
def invoke(self, context, event):
6060
self.frame_start = context.scene.frame_start
6161
self.frame_end = context.scene.frame_end
62-
62+
6363
bpy.context.window_manager.fileselect_add(self)
64-
64+
6565
return {'RUNNING_MODAL'}
66-
66+
6767
def writeBvh(self, context):
6868
scene = context.scene
6969
frame_current = scene.frame_current
7070
fps = context.scene.render.fps
71-
71+
7272
obj = context.active_object
73-
73+
7474
if (obj is None) or (obj.type != 'CAMERA'):
7575
self.error("No camera selected.")
7676
return False
77-
77+
7878
cam = obj.data
79-
79+
8080
lastRot = None
81-
81+
8282
unRot = mathutils.Matrix.Rotation(math.radians(-90.0), 4, 'X')
83-
83+
8484
file = None
85-
85+
8686
try:
8787
file = open(self.filepath, "w", encoding="utf8", newline="\n")
88-
88+
8989
frameCount = self.frame_end -self.frame_start +1
9090
if frameCount < 0: frameCount = 0
91-
91+
9292
frameTime = 1.0
9393
if 0.0 != fps: frameTime = frameTime / fps
94-
94+
9595
WriteHeader(file, frameCount, frameTime)
96-
96+
9797
for frame in range(self.frame_start, self.frame_end + 1):
9898
scene.frame_set(frame)
99-
99+
100100
mat = obj.matrix_world
101101
mat = mat @ unRot
102-
102+
103103
loc = mat.to_translation()
104104
rot = mat.to_euler('YXZ') if lastRot is None else mat.to_euler('YXZ', lastRot)
105105
lastRot = rot
106-
106+
107107
loc = self.global_scale * mathutils.Vector((loc[1],-loc[0],loc[2]))
108-
108+
109109
qAngleVec = mathutils.Vector((math.degrees(rot[1]),-math.degrees(rot[0]),math.degrees(rot[2])))
110-
110+
111111
# lens = camData.c.sensor_width / (2.0 * math.tan(math.radians(fov) / 2.0))
112112
fov = math.degrees(2.0 * math.atan((cam.sensor_width / cam.lens) / 2.0))
113-
113+
114114
S = ""+FloatToBvhString((frame-1) * frameTime) +" " +FloatToBvhString(loc[0]) +" " +FloatToBvhString(loc[1]) +" " +FloatToBvhString(loc[2]) +" " +FloatToBvhString(qAngleVec[0]) +" " +FloatToBvhString(qAngleVec[1]) +" " +FloatToBvhString(qAngleVec[2]) +" " +FloatToBvhString(fov) + "\n"
115115
file.write(S)
116-
116+
117117
finally:
118118
if file is not None:
119119
file.close()
120-
120+
121121
scene.frame_set(frame_current)
122-
122+
123123
return True

0 commit comments

Comments
 (0)