Skip to content

Commit 016c9b8

Browse files
committed
Added: Inherit configs for Mesh Collectors
1 parent 74e0ba7 commit 016c9b8

File tree

5 files changed

+32
-4
lines changed

5 files changed

+32
-4
lines changed

ArmaToolbox/ArmaTools.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,23 @@ def GetObjectsByConfig(configName):
837837
arma = obj.armaObjProps
838838
if configName in arma.exportConfigs.keys() or arma.alwaysExport == True:
839839
objects.append(obj)
840-
840+
if arma.isMeshCollector and arma.inheritConfig:
841+
print("obj is a mesh collector", obj.name)
842+
include = False
843+
for collected in arma.collectedMeshes:
844+
ocol = collected.object
845+
print("Collected mesh: ", ocol.name)
846+
print(" isArmaObject:", ocol.armaObjProps.isArmaObject)
847+
print(" configs: ")
848+
for i in ocol.armaObjProps.exportConfigs.keys():
849+
print (" ", i)
850+
print(" always export:", ocol.armaObjProps.alwaysExport)
851+
print(" not already in export list:",ocol not in objects )
852+
if ocol.armaObjProps.isArmaObject and configName in ocol.armaObjProps.exportConfigs.keys() or ocol.armaObjProps.alwaysExport == True:
853+
include = True
854+
if include:
855+
objects.append(obj)
856+
print("Objects ", objects)
841857
return objects
842858

843859
def RunO2Script(context, fileName):
@@ -850,11 +866,14 @@ def RunO2Script(context, fileName):
850866
filePtr.write('save p3d;\n')
851867
filePtr.close()
852868

869+
print(__package__)
870+
print(__name__)
853871
#user_preferences = context.preferences
854872
#addon_prefs = user_preferences.addons["ArmaToolbox"].preferences
855873
addon_prefs = bpy.context.preferences.addons[__package__].preferences
856874
command = addon_prefs.o2ScriptProp
857875
command = '"' + command + '" "' + tmpName + '"'
876+
print("Running command ", command)
858877
call(command, shell=True)
859878
os.remove(tmpName)
860879

@@ -1302,7 +1321,7 @@ def meshCollectify(context, obj, mcify_lod, mcify_lodDistance, mcify_colectionNa
13021321
item.object = obj
13031322

13041323
# Copy the export configs
1305-
for c in context.scene.armaExportConfigs.exportConfigs:
1324+
for c in obj.armaObjProps.exportConfigs:
13061325
nobj.armaObjProps.exportConfigs.add().name = c.name
13071326

13081327
if mcify_deleteGroup != "":

ArmaToolbox/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Arma: Toolbox",
33
"description": "Collection of tools for editing RV Engine content",
44
"author": "Hans-Joerg \"Alwarren\" Frieden.",
5-
"version": (4, 2, 1),
5+
"version": (4, 2, 3),
66
"blender": (4, 2, 0),
77
"location": "View3D > Panels",
88
"warning": '',
@@ -56,7 +56,7 @@
5656

5757

5858
class ArmaToolboxPreferences(AddonPreferences):
59-
bl_idname = __name__
59+
bl_idname = __package__
6060

6161
o2ScriptProp : bpy.props.StringProperty(
6262
name="o2Script Path",

ArmaToolbox/panels.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,10 @@ def draw(self, context):
865865
row = layout.row()
866866
row.prop(arma, "alwaysExport", text="Include in every config")
867867

868+
if (arma.isMeshCollector):
869+
row = layout.row()
870+
row.prop(arma, "inheritConfig", text="Inherit config from collected meshes in addition to this list")
871+
868872
if arma.alwaysExport == False:
869873
if context.scene.armaExportConfigs.exportConfigs.keys().__len__() != 0:
870874
col = layout.box().column(align=True)

ArmaToolbox/properties.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ class ArmaToolboxProperties(bpy.types.PropertyGroup):
220220
exportConfigs : bpy.props.CollectionProperty(type = ArmaToolboxExportConfigObjectProperty, description = "Export Configs")
221221
configIndex: bpy.props.IntProperty("configIndex", default=-1)
222222
alwaysExport : bpy.props.BoolProperty(name = "alwaysExport", default=False, description="If True, include this in all exports on a batch export")
223+
inheritConfig: bpy.props.BoolProperty(name = "inheritConfig", default=True, description="If true, mesh collectors inherit the configs from their collected meshes.as well as those set in here.")
223224

224225
# Named Selections
225226
namedSelection : bpy.props.CollectionProperty(type = ArmaToolboxNamedSelection,

mkArc.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
del ArmaToolbox-4.2.3.zip
2+
cd ArmaToolbox
3+
7z a ..\ArmaToolbox-4.2.3.zip *.py blender_manifest.toml
4+
cd ..

0 commit comments

Comments
 (0)