Skip to content

Commit a8128fd

Browse files
committed
- Fixed: Some named parameters were still missing
- Fixed: Preferences - Fixed: An import/export bug that could cause problems with weights
1 parent 097db4d commit a8128fd

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

ArmaToolbox/ArmaProxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def CreateProxy(obj, v1,v2,v3, path, index, enclose=None):
3838
if enclose != None:
3939
fnd = obj.vertex_groups.find(enclose)
4040
if (fnd == -1):
41-
vgrp2 = obj.vertex_groups.new(enclose)
41+
vgrp2 = obj.vertex_groups.new(name = enclose)
4242
else:
4343
vgrp2 = obj.vertex_groups[fnd]
4444

ArmaToolbox/ArmaTools.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,8 @@ def createComponents(context):
496496
selected_verts = list(filter(lambda v: v.select, mesh.vertices))
497497
bpy.ops.object.mode_set(mode="EDIT")
498498
if (len(selected_verts) > 3):
499-
vgrp = bpy.context.active_object.vertex_groups.new("Component%02d" % componentNr)
499+
cmp = ("Component%02d" % componentNr)
500+
vgrp = bpy.context.active_object.vertex_groups.new(name=cmp)
500501
componentNr = componentNr + 1
501502
bpy.ops.object.vertex_group_assign()
502503

ArmaToolbox/MDLImporter.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,12 @@ def loadLOD(context, filePtr, objectName, materialData, layerFlag, lodnr):
388388
for i in range(0, numFaces):
389389
b = readByte(filePtr)
390390
w = decodeWeight(b)
391-
if w>0:
392-
pPoly = obj.data.polygons[i]
393-
for n in range(0,len(pPoly.vertices)):
394-
idx = pPoly.vertices[n]
395-
vgrp.add([idx], w, 'REPLACE')
391+
# print("b = ",b,"w = ", w)
392+
# if w== 1.0:
393+
# pPoly = obj.data.polygons[i]
394+
# for n in range(0,len(pPoly.vertices)):
395+
# idx = pPoly.vertices[n]
396+
# vgrp.add([idx], w, 'REPLACE')
396397
#filePtr.seek(numFaces, 1)
397398

398399
# Done with the taggs, only the resolution is left to read

ArmaToolbox/MDLexporter.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,16 @@ def writeNamedSelection(filePtr, obj, mesh, idx):
171171
else:
172172
writeByte(filePtr, 0)
173173

174-
for face in mesh.polygons:
174+
for face in mesh.tessfaces:
175175
grps = [grp for vert in face.vertices for grp in mesh.vertices[vert].groups if grp.group == idx]
176176
if len(grps) == len(face.vertices):
177177
weight = 0
178178
for grpF in grps:
179179
weight += grpF.weight
180-
writeByte(filePtr, convertWeight(weight / len(grps)))
180+
if (weight > 0):
181+
writeByte(filePtr, convertWeight(1) #weight / len(grps)))
182+
else:
183+
writeByte(filePtr, 0)
181184
else:
182185
writeByte(filePtr, 0)
183186

ArmaToolbox/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def execute(self, context):
234234

235235
# Run O2Script to output the P3D
236236
#command = os.path.join(context.window_manager.armatoolbox.o2path, "O2Script.exe")
237-
user_preferences = context.user_preferences
237+
user_preferences = context.preferences
238238
addon_prefs = user_preferences.addons[__name__].preferences
239239
command = addon_prefs.o2ScriptProp
240240
command = '"' + command +'" "' + tmpName + '"'

0 commit comments

Comments
 (0)