Skip to content

Commit 86694ba

Browse files
committed
Fixed: Blender 4.1 support
1 parent 1cc827f commit 86694ba

File tree

5 files changed

+20
-9
lines changed

5 files changed

+20
-9
lines changed

ArmaToolbox/MDLImporter.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ def makeLodName(fileName, lodLevel):
5656
return lodName
5757

5858
def maybeAddEdgeSplit(obj):
59-
obj.data.use_auto_smooth = True
60-
obj.data.auto_smooth_angle = 3.1415927
59+
if (4,1,0) > bpy.app.version:
60+
obj.data.use_auto_smooth = True
61+
obj.data.auto_smooth_angle = 3.1415927
62+
else:
63+
pass
64+
6165

6266
#modifier = obj.modifiers.get("FHQ_ARMA_Toolbox_EdgeSplit")
6367
#if modifier is None:
@@ -369,7 +373,7 @@ def loadLOD(context, filePtr, objectName, materialData, layerFlag, lodnr):
369373
n1 = readULong(filePtr)
370374
n2 = readULong(filePtr)
371375
sharpEdges.append([n1, n2])
372-
print ("sharp edges", sharpEdges)
376+
# print ("sharp edges", sharpEdges)
373377
elif tagName == "#Property#":
374378
# Read named property
375379
propName = struct.unpack("64s", filePtr.read(64))[0].decode("utf-8")
@@ -396,14 +400,19 @@ def loadLOD(context, filePtr, objectName, materialData, layerFlag, lodnr):
396400
index += 1
397401
elif tagName == "#Mass#":
398402
weightArray = []
399-
weight = 0;
403+
weight = 0
400404
for idx in range (0,numPoints):
401405
f = readFloat(filePtr)
402406
weightArray.append(f)
403407
weight += f
404-
elif tagName[0] == '#':
408+
elif tagName.__len__() > 0 and tagName[0] == '#':
409+
print("Unkown/Unsued tagg " + tagName)
410+
print("Skipping " , numBytes , " bytes in file")
405411
# System tag we don't read
406412
filePtr.seek(numBytes, 1)
413+
elif tagName.__len__() == 0:
414+
print ("Unnamed tagg????")
415+
filePtr.seek(numBytes, 1)
407416
else:
408417
# Named Selection
409418
# Add a vertex group

ArmaToolbox/MDLexporter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ def OLDwriteNormals(filePtr, mesh, numberOfNormals):
150150
# FaceNormals must be inverted (-X, -Y, -Z) for clockwise vertex order (default for DirectX), and not changed for counterclockwise order.
151151
def writeNormals(filePtr, mesh, numberOfNormals):
152152
print("faces = ", len(mesh.polygons))
153-
mesh.calc_normals_split()
153+
if (4,1,0) > bpy.app.version:
154+
mesh.calc_normals_split()
154155
for poly in mesh.polygons:
155156
#print("index = ", poly.index)
156157
loops = poly.loop_indices

ArmaToolbox/lists.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ def draw_item(self, context, layout, data, item, icon, active_data, active_propn
220220
)
221221

222222
def safeAddTime(frame, prop):
223+
frame = int(frame)
223224
for k in prop:
224225
if k.timeIndex == frame:
225226
return

ArmaToolbox/panels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ def poll(cls, context):
885885
## Visible when there is a selected object, it is a mesh
886886
obj = context.active_object
887887

888-
return (obj
888+
return (obj != None
889889
and obj.select_get() == True
890890
and obj.armaObjProps != None
891891
and obj.armaObjProps.isArmaObject == True

deploy.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
xcopy /y ArmaToolbox\*.* "%appdata%\Blender Foundation\Blender\4.0\scripts\addons\ArmaToolbox"
2-
del /s/q "%appdata%\Blender Foundation\Blender\4.0\scripts\addons\ArmaToolbox\__pycache__"
1+
xcopy /y ArmaToolbox\*.* "%appdata%\Blender Foundation\Blender\4.1\scripts\addons\ArmaToolbox"
2+
del /s/q "%appdata%\Blender Foundation\Blender\4.1\scripts\addons\ArmaToolbox\__pycache__"

0 commit comments

Comments
 (0)