@@ -124,18 +124,18 @@ private static Dictionary<string, VariableDefinition> GetVariableDefinitions(Nam
124124 {
125125 var shouldAdd = true ;
126126
127- if ( definition . IsVariableVisibleInEditor != null )
127+ if ( definition . IsVariableVisibleInEditor != null )
128128 {
129129 shouldAdd = definition . IsVariableVisibleInEditor ( container , instance ) ;
130130 }
131131
132- if ( shouldAdd )
132+ if ( shouldAdd )
133133 {
134134 variableDefinitions [ definition . Name ] = definition ;
135135 }
136136 }
137137 }
138- else if ( instance . SourceType == SourceType . Entity )
138+ else if ( instance . SourceType == SourceType . Entity )
139139 {
140140 var instanceElement = ObjectFinder . Self . GetElement ( instance ) ;
141141 if ( instanceElement != null )
@@ -174,9 +174,9 @@ private static Dictionary<string, VariableDefinition> GetVariableDefinitions(Nam
174174 }
175175
176176 var subtext = variableInElement ? . Summary ?? baseVariable ? . Summary ;
177- if ( ! string . IsNullOrWhiteSpace ( subtext ) )
177+ if ( ! string . IsNullOrWhiteSpace ( subtext ) )
178178 {
179- baseVariableDefinition . SubtextFunc = ( _ , _ ) => subtext ;
179+ baseVariableDefinition . SubtextFunc = ( _ , _ ) => subtext ;
180180 }
181181
182182 if ( variableInElement . CustomGetForcedOptionsFunc != null )
@@ -318,17 +318,17 @@ public static void UpdateShownVariables(DataUiGrid grid, NamedObjectSave instanc
318318 public static void UpdateConditionalVisibility ( DataUiGrid grid , NamedObjectSave instance , GlueElement container , AssetTypeInfo ati )
319319 {
320320 var needsFullRefresh = false ;
321- foreach ( var category in grid . Categories )
321+ foreach ( var category in grid . Categories )
322322 {
323- foreach ( var member in category . Members )
323+ foreach ( var member in category . Members )
324324 {
325- if ( member is NamedObjectSaveVariableDataGridItem namedObjectSaveVariableDataGridItem )
325+ if ( member is NamedObjectSaveVariableDataGridItem namedObjectSaveVariableDataGridItem )
326326 {
327- if ( namedObjectSaveVariableDataGridItem . VariableDefinition . IsVariableVisibleInEditor != null )
327+ if ( namedObjectSaveVariableDataGridItem . VariableDefinition . IsVariableVisibleInEditor != null )
328328 {
329329 // Is it true?
330330 var shouldBeVisible = namedObjectSaveVariableDataGridItem . VariableDefinition . IsVariableVisibleInEditor ( container , instance ) ;
331- if ( ! shouldBeVisible )
331+ if ( ! shouldBeVisible )
332332 {
333333 // this shouldn't be here, we need a refresh
334334 needsFullRefresh = true ;
@@ -338,24 +338,24 @@ public static void UpdateConditionalVisibility(DataUiGrid grid, NamedObjectSave
338338 }
339339 }
340340
341- if ( ! needsFullRefresh && ati != null )
341+ if ( ! needsFullRefresh && ati != null )
342342 {
343- foreach ( var variableDefinition in ati . VariableDefinitions )
343+ foreach ( var variableDefinition in ati . VariableDefinitions )
344344 {
345- if ( variableDefinition . IsVariableVisibleInEditor != null )
345+ if ( variableDefinition . IsVariableVisibleInEditor != null )
346346 {
347347 var shouldBeShown = variableDefinition . IsVariableVisibleInEditor ( container , instance ) ;
348- if ( shouldBeShown )
348+ if ( shouldBeShown )
349349 {
350350 var wasFound = false ;
351351 // This better be in one of the categories
352- foreach ( var category in grid . Categories )
352+ foreach ( var category in grid . Categories )
353353 {
354- foreach ( var member in category . Members )
354+ foreach ( var member in category . Members )
355355 {
356- if ( member is NamedObjectSaveVariableDataGridItem namedObjectSaveVariableDataGridItem )
356+ if ( member is NamedObjectSaveVariableDataGridItem namedObjectSaveVariableDataGridItem )
357357 {
358- if ( namedObjectSaveVariableDataGridItem . VariableDefinition . Name == variableDefinition . Name )
358+ if ( namedObjectSaveVariableDataGridItem . VariableDefinition . Name == variableDefinition . Name )
359359 {
360360 // This is good, we found it
361361 wasFound = true ;
@@ -364,7 +364,7 @@ public static void UpdateConditionalVisibility(DataUiGrid grid, NamedObjectSave
364364 }
365365 }
366366 }
367- if ( ! wasFound )
367+ if ( ! wasFound )
368368 {
369369 needsFullRefresh = true ;
370370 break ;
@@ -375,7 +375,7 @@ public static void UpdateConditionalVisibility(DataUiGrid grid, NamedObjectSave
375375 }
376376 }
377377
378- if ( needsFullRefresh )
378+ if ( needsFullRefresh )
379379 {
380380 UpdateShownVariables ( grid , instance , container , ati ) ;
381381 }
@@ -427,7 +427,7 @@ private static MemberCategory CreateTopmostCategory(List<MemberCategory> categor
427427 return topmostCategory ;
428428 }
429429
430- public static void AssignVariableSubtext ( NamedObjectSave instance , List < MemberCategory > categories , AssetTypeInfo assetTypeInfo )
430+ public static bool AssignVariableSubtext ( NamedObjectSave instance , List < MemberCategory > categories , AssetTypeInfo assetTypeInfo )
431431 {
432432 var xVariable = categories . SelectMany ( item => item . Members ) . FirstOrDefault ( item => item . DisplayName == "X" ) ;
433433 var yVariable = categories . SelectMany ( item => item . Members ) . FirstOrDefault ( item => item . DisplayName == "Y" ) ;
@@ -461,18 +461,36 @@ public static void AssignVariableSubtext(NamedObjectSave instance, List<MemberCa
461461 setZ = true ;
462462 }
463463
464-
464+ var changed = false ;
465465 if ( xVariable != null )
466- { xVariable . DetailText = subtext ; }
466+ {
467+ if ( xVariable . DetailText != subtext )
468+ {
469+ changed = true ;
470+ xVariable . DetailText = subtext ;
471+ }
472+ }
467473
468474
469475 if ( yVariable != null )
470- { yVariable . DetailText = subtext ; }
476+ {
477+ if ( yVariable . DetailText != subtext )
478+ {
479+ changed = true ;
480+ yVariable . DetailText = subtext ;
481+ }
482+ }
471483
472484 if ( zVariable != null && setZ )
473485 {
474- zVariable . DetailText = subtext ;
486+ if ( zVariable . DetailText != subtext )
487+ {
488+ changed = true ;
489+ zVariable . DetailText = subtext ;
490+ }
475491 }
492+
493+ return changed ;
476494 }
477495
478496 private static void AddForTypedMember ( NamedObjectSave instance , GlueElement container , List < MemberCategory > categories ,
0 commit comments