@@ -1298,6 +1298,132 @@ def execute(self, context):
12981298
12991299 return {'FINISHED' }
13001300
1301+ class ATBX_OT_add_selected_meshes (bpy .types .Operator ):
1302+ bl_idname = "armatoolbox.add_selected_meshes"
1303+ bl_label = "Add selected meshes to active mesh capture list"
1304+ bl_description = "Add selected meshes to active mesh capture list"
1305+
1306+ @classmethod
1307+ def poll (cls , context ):
1308+ l = len (context .selected_objects )
1309+ return l >= 2 and context .active_object .armaObjProps .isMeshCollector
1310+
1311+ def execute (self , context ):
1312+ objs = context .selected_objects
1313+ arma = context .active_object .armaObjProps
1314+ for o in objs :
1315+ if o != context .active_object and o .type == 'MESH' :
1316+ if o not in [x .object for x in arma .collectedMeshes ]:
1317+ item = context .active_object .armaObjProps .collectedMeshes .add ()
1318+ print (item )
1319+ item .object = o
1320+
1321+ return {'FINISHED' }
1322+
1323+ class ATBX_OT_rem_selected_meshes (bpy .types .Operator ):
1324+ bl_idname = "armatoolbox.rem_selected_meshes"
1325+ bl_label = "Remove Active meshes from active mesh capture list"
1326+ bl_description = "Remove Active meshes from active mesh capture list"
1327+
1328+ @classmethod
1329+ def poll (cls , context ):
1330+ return context .active_object .armaObjProps .collectedMeshesIndex != - 1
1331+
1332+ def execute (self , context ):
1333+ obj = context .active_object
1334+ arma = obj .armaObjProps
1335+ if arma .collectedMeshesIndex != - 1 :
1336+ arma .collectedMeshes .remove (arma .collectedMeshesIndex )
1337+
1338+ return {'FINISHED' }
1339+
1340+ class ATBX_MT_clear_mesh_collector (bpy .types .Operator ):
1341+ bl_idname = "armatoolbox.clear_mesh_collector"
1342+ bl_label = "Remove all meshes from the list"
1343+ bl_description = "Remove all meshes from the list"
1344+
1345+ def execute (self ,context ):
1346+ obj = context .active_object
1347+ arma = obj .armaObjProps
1348+ arma .collectedMeshes .clear ()
1349+
1350+ return {'FINISHED' }
1351+
1352+ class ATBX_MT_add_same_config_mesh_collector (bpy .types .Operator ):
1353+ bl_idname = "armatoolbox.add_same_config_mesh_collector"
1354+ bl_label = "Add all objects with the same config combo"
1355+ bl_description = "Add all objects to this collector that have the exact same combination of configs"
1356+
1357+ def execute (self , context ):
1358+ arma = context .active_object .armaObjProps
1359+ if len (context .selected_objects )> 1 :
1360+ cobjs = context .selected_objects
1361+ else :
1362+ cobjs = context .view_layer .objects
1363+
1364+ objs = [obj for obj in cobjs
1365+ if obj .type == 'MESH'
1366+ and obj .armaObjProps .isArmaObject
1367+ and obj != context .active_object
1368+ and ArmaTools .matchAllConfigs (context , context .active_object , obj )]
1369+
1370+ for o in objs :
1371+ if o != context .active_object and o .type == 'MESH' :
1372+ if o not in [x .object for x in arma .collectedMeshes ]:
1373+ item = context .active_object .armaObjProps .collectedMeshes .add ()
1374+ item .object = o
1375+
1376+ return {'FINISHED' }
1377+
1378+ class ATBX_MT_add_any_config_mesh_collector (bpy .types .Operator ):
1379+ bl_idname = "armatoolbox.add_any_config_mesh_collector"
1380+ bl_label = "Add all objects with the at least one common config"
1381+ bl_description = "Add all objects to this collector that have the one or more of the objects configs"
1382+
1383+ def execute (self , context ):
1384+ arma = context .active_object .armaObjProps
1385+ if len (context .selected_objects )> 1 :
1386+ cobjs = context .selected_objects
1387+ else :
1388+ cobjs = context .view_layer .objects
1389+
1390+ objs = [obj for obj in cobjs
1391+ if obj .type == 'MESH'
1392+ and obj .armaObjProps .isArmaObject
1393+ and obj != context .active_object
1394+ and ArmaTools .matchAnyConfigs (context , context .active_object , obj )]
1395+ for o in objs :
1396+ if o != context .active_object and o .type == 'MESH' :
1397+ if o not in [x .object for x in arma .collectedMeshes ]:
1398+ item = context .active_object .armaObjProps .collectedMeshes .add ()
1399+ item .object = o
1400+
1401+ return {'FINISHED' }
1402+
1403+ class ATBX_MT_add_atleast_config_mesh_collector (bpy .types .Operator ):
1404+ bl_idname = "armatoolbox.add_atleast_config_mesh_collector"
1405+ bl_label = "Add all objects with the at least one common config"
1406+ bl_description = "Add all objects to this collector that have the one or more of the objects configs"
1407+
1408+ def execute (self , context ):
1409+ arma = context .active_object .armaObjProps
1410+ if len (context .selected_objects )> 1 :
1411+ cobjs = context .selected_objects
1412+ else :
1413+ cobjs = context .view_layer .objects
1414+
1415+ objs = [obj for obj in cobjs
1416+ if obj .type == 'MESH'
1417+ and obj .armaObjProps .isArmaObject
1418+ and obj != context .active_object
1419+ and ArmaTools .matchAtLeastConfigs (context , context .active_object , obj )]
1420+ for o in objs :
1421+ if o != context .active_object and o .type == 'MESH' :
1422+ if o not in [x .object for x in arma .collectedMeshes ]:
1423+ item = context .active_object .armaObjProps .collectedMeshes .add ()
1424+ item .object = o
1425+
1426+ return {'FINISHED' }
13011427
13021428op_classes = (
13031429 ATBX_OT_add_frame_range ,
@@ -1360,7 +1486,13 @@ def execute(self, context):
13601486 ATBX_OT_set_zbias ,
13611487 ATBX_OT_select_zbiased ,
13621488 ATBX_OT_batch_rename_vgrp ,
1363- ATBX_OT_match_vgrp
1489+ ATBX_OT_match_vgrp ,
1490+ ATBX_OT_add_selected_meshes ,
1491+ ATBX_OT_rem_selected_meshes ,
1492+ ATBX_MT_clear_mesh_collector ,
1493+ ATBX_MT_add_same_config_mesh_collector ,
1494+ ATBX_MT_add_any_config_mesh_collector ,
1495+ ATBX_MT_add_atleast_config_mesh_collector
13641496)
13651497
13661498
0 commit comments