Skip to content

Commit 0d1f97f

Browse files
committed
Added: Mesh Collector lists now verify their integrity and display a warning icon if something is missing.
1 parent af633e8 commit 0d1f97f

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

ArmaToolbox/ArmaTools.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1085,4 +1085,19 @@ def findNamedSelectionString(obj, selectionName):
10851085
if len(output.value) is 0:
10861086
return None
10871087

1088-
return output.value
1088+
return output.value
1089+
1090+
def collectorMeshValid(context, name):
1091+
if context.scene.objects.get(name) is not None:
1092+
return True
1093+
else:
1094+
return False
1095+
1096+
def collectionMeshListValid(context, object):
1097+
arma = object.armaObjProps
1098+
for obj in arma.collectedMeshes:
1099+
name = obj.object.name
1100+
if collectorMeshValid(context, name) is False:
1101+
return False
1102+
1103+
return True

ArmaToolbox/lists.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import bpy
2+
import ArmaTools
23

34
class ATBX_UL_named_prop_list(bpy.types.UIList):
45
# The draw_item function is called for each item of the collection that is visible in the list.
@@ -189,7 +190,10 @@ def draw_item(self, context, layout, data, item, icon, active_data, active_propn
189190

190191
if self.layout_type in {'DEFAULT', 'COMPACT'}:
191192
o = item.object
192-
layout.prop(o, property="name", text="", emboss=False, icon="OBJECT_DATA")
193+
labelIcon = "OBJECT_DATA"
194+
if ArmaTools.collectorMeshValid(context, o.name) is False:
195+
labelIcon = 'ERROR'
196+
layout.prop(o, property="name", text="", emboss=False, icon=labelIcon)
193197
elif self.layout_type == 'GRID':
194198
layout.alignment = 'CENTER'
195199
layout.label(text="", icon="GROUP_VERTEX")

ArmaToolbox/panels.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,13 @@ def draw(self, context):
124124
else:
125125
obj = context.active_object
126126
arma = obj.armaObjProps
127+
valid = ArmaTools.collectionMeshListValid(context, obj)
127128
layout = self.layout
128129
row = layout.row()
129-
row.label(text = "Collected Meshes")
130+
wicon = 'BLANK1'
131+
if valid is False:
132+
wicon = 'ERROR'
133+
row.label(text = "Collected Meshes", icon = wicon)
130134
row = layout.row()
131135
row.template_list(listtype_name="ATBX_UL_collected_meshes_list",
132136
dataptr = arma,

0 commit comments

Comments
 (0)