@@ -172,10 +172,9 @@ public virtual void OnControllerChanged(ref ControllerChangedEvent e)
172
172
173
173
protected virtual bool HasPosition ( ) => true ;
174
174
175
- private bool SyncSettings ( )
175
+ private void SyncSettings ( )
176
176
{
177
177
Profiler . BeginSample ( "VFXNodeUI.SyncSettings" ) ;
178
- var hasChanged = false ;
179
178
var settings = controller . settings ;
180
179
var graphSettings = controller . model . GetSettings ( false , VFXSettingAttribute . VisibleFlags . InGraph ) . ToArray ( ) ;
181
180
@@ -186,7 +185,6 @@ private bool SyncSettings()
186
185
{
187
186
propertyRM . RemoveFromHierarchy ( ) ;
188
187
m_Settings . Remove ( propertyRM ) ;
189
- hasChanged = true ;
190
188
}
191
189
}
192
190
@@ -199,7 +197,6 @@ private bool SyncSettings()
199
197
var setting = settings . Single ( x => string . Compare ( x . name , vfxSetting . field . Name , StringComparison . OrdinalIgnoreCase ) == 0 ) ;
200
198
var propertyRM = AddSetting ( setting ) ;
201
199
settingsContainer . Insert ( i , propertyRM ) ;
202
- hasChanged = true ;
203
200
}
204
201
}
205
202
@@ -224,20 +221,17 @@ private bool SyncSettings()
224
221
}
225
222
226
223
Profiler . EndSample ( ) ;
227
- return hasChanged ;
228
224
}
229
225
230
- bool SyncAnchors ( )
226
+ void SyncAnchors ( )
231
227
{
232
228
Profiler . BeginSample ( "VFXNodeUI.SyncAnchors" ) ;
233
- var hasResync = SyncAnchors ( controller . outputPorts , outputContainer , false ) ;
234
- hasResync |= SyncAnchors ( controller . inputPorts , inputContainer , controller . HasActivationAnchor ) ;
229
+ SyncAnchors ( controller . outputPorts , outputContainer , false ) ;
230
+ SyncAnchors ( controller . inputPorts , inputContainer , controller . HasActivationAnchor ) ;
235
231
Profiler . EndSample ( ) ;
236
-
237
- return hasResync ;
238
232
}
239
233
240
- bool SyncAnchors ( ReadOnlyCollection < VFXDataAnchorController > ports , VisualElement container , bool hasActivationPort )
234
+ void SyncAnchors ( ReadOnlyCollection < VFXDataAnchorController > ports , VisualElement container , bool hasActivationPort )
241
235
{
242
236
// Check whether resync is needed
243
237
bool needsResync = false ;
@@ -295,7 +289,6 @@ bool SyncAnchors(ReadOnlyCollection<VFXDataAnchorController> ports, VisualElemen
295
289
296
290
if ( hasActivationPort )
297
291
UpdateActivationPortPositionIfAny ( ) ; // Needed to account for expanded state change in case of undo/redo
298
- return needsResync ;
299
292
}
300
293
301
294
private void UpdateActivationPortPosition ( VFXDataAnchor anchor )
@@ -416,18 +409,15 @@ protected virtual void SelfChange()
416
409
417
410
base . expanded = controller . expanded ;
418
411
419
- var needRefresh = SyncSettings ( ) ;
420
- needRefresh |= SyncAnchors ( ) ;
412
+ SyncSettings ( ) ;
413
+ SyncAnchors ( ) ;
421
414
Profiler . BeginSample ( "VFXNodeUI.SelfChange The Rest" ) ;
422
415
RefreshExpandedState ( ) ;
423
416
Profiler . EndSample ( ) ;
424
417
Profiler . EndSample ( ) ;
425
418
426
419
UpdateCollapse ( ) ;
427
- if ( needRefresh )
428
- {
429
- EditorApplication . delayCall += RefreshLayout ;
430
- }
420
+ RefreshLayout ( ) ;
431
421
}
432
422
433
423
protected virtual VFXDataAnchor InstantiateDataAnchor ( VFXDataAnchorController ctrl , VFXNodeUI node )
@@ -520,18 +510,23 @@ private PropertyRM AddSetting(VFXSettingController setting)
520
510
return rm ;
521
511
}
522
512
513
+ public void GetWidths ( out float labelWidth , out float controlWidth )
514
+ {
515
+ var settingsLabelWidth = 0f ;
516
+ var inputsLabelWidth = 0f ;
517
+ controlWidth = 50f ;
518
+ GetPreferredSettingsWidths ( ref settingsLabelWidth , ref controlWidth ) ;
519
+ GetPreferredWidths ( ref inputsLabelWidth , ref controlWidth ) ;
520
+ labelWidth = Mathf . Max ( settingsLabelWidth , inputsLabelWidth ) ;
521
+ if ( labelWidth > 0 )
522
+ labelWidth = Mathf . Max ( labelWidth , defaultLabelWidth ) ;
523
+ }
524
+
523
525
protected virtual void RefreshLayout ( )
524
526
{
525
527
if ( expanded )
526
528
{
527
- var settingsLabelWidth = 0f ;
528
- var inputsLabelWidth = 0f ;
529
- var controlWidth = 50f ;
530
- GetPreferredSettingsWidths ( ref settingsLabelWidth , ref controlWidth ) ;
531
- GetPreferredWidths ( ref inputsLabelWidth , ref controlWidth ) ;
532
- var labelWidth = Mathf . Max ( settingsLabelWidth , inputsLabelWidth ) ;
533
- if ( labelWidth > 0 )
534
- labelWidth = Mathf . Max ( labelWidth , defaultLabelWidth ) ;
529
+ GetWidths ( out var labelWidth , out var controlWidth ) ;
535
530
ApplySettingsWidths ( labelWidth ) ;
536
531
ApplyWidths ( labelWidth , controlWidth ) ;
537
532
}
0 commit comments