@@ -486,32 +486,38 @@ void LensDistort::updatePluginAttributesFromKnobs()
486
486
487
487
int LensDistort::knob_changed (Knob* k)
488
488
{
489
- bool updateUI = false ;
490
-
491
489
// If the lensFileSequence knob just changed then we need to check if it is valid and load it.
492
- // Once loaded then we set the updateUI flag to trigger a UI update.
493
490
if ( k->is ( " lensFileSequence" ) )
494
491
{
492
+ bool updateRequired = false ;
493
+
495
494
std::string path;
496
495
bool oldValue = m_useFileSequence;
497
496
m_useFileSequence = getFileSequencePath ( path );
498
- updateUI |= oldValue != m_useFileSequence;
497
+ updateRequired |= oldValue != m_useFileSequence;
499
498
500
499
if ( m_useFileSequence )
501
500
{
502
501
bool oldValue = m_hasValidFileSequence;
503
502
std::string path;
504
503
m_hasValidFileSequence = setLensFromFile ( path );
505
- updateUI |= m_hasValidFileSequence != oldValue;
504
+ updateRequired |= m_hasValidFileSequence != oldValue;
505
+ }
506
+
507
+ if ( updateRequired )
508
+ {
509
+ updateUI ();
506
510
}
507
511
512
+ return true ;
508
513
}
509
514
510
515
// If the lens model was just changed then we need to set it internally and then update the UI.
511
516
if ( k->is ( " model" ) )
512
517
{
513
518
setLensModel ( modelNames ()[getLensModel ()] );
514
- updateUI = true ;
519
+ updateUI ();
520
+ return true ;
515
521
}
516
522
517
523
// Update our internal reference of the knob value that just changed...
@@ -531,27 +537,28 @@ int LensDistort::knob_changed(Knob* k)
531
537
}
532
538
}
533
539
534
- if ( k->is ( " lensFileSequence" ) ) return true ;
535
-
536
540
// Do we need to update the UI?
537
- if ( k == &Knob::showPanel || updateUI )
541
+ if ( k == &Knob::showPanel )
538
542
{
539
- m_numNewKnobs = replace_knobs ( m_lastStaticKnob, m_numNewKnobs, addDynamicKnobs, this ->firstOp () );
540
-
541
- // Handle the knobs state.
542
- if ( knob (" model" ) != NULL ) knob (" model" )->enable ( !m_useFileSequence );
543
- for ( PluginAttributeList::iterator it = m_pluginAttributes.begin (); it != m_pluginAttributes.end (); it++ )
544
- {
545
- if ( it->m_knob != NULL ) it->m_knob ->enable ( !m_useFileSequence );
546
- }
547
-
543
+ updateUI ();
548
544
return true ;
549
545
}
550
546
551
-
552
547
return Iop::knob_changed (k);
553
548
}
554
549
550
+ void LensDistort::updateUI ()
551
+ {
552
+ m_numNewKnobs = replace_knobs ( m_lastStaticKnob, m_numNewKnobs, addDynamicKnobs, this ->firstOp () );
553
+
554
+ // Handle the knobs state.
555
+ if ( knob (" model" ) != NULL ) knob (" model" )->enable ( !m_useFileSequence );
556
+ for ( PluginAttributeList::iterator it = m_pluginAttributes.begin (); it != m_pluginAttributes.end (); it++ )
557
+ {
558
+ if ( it->m_knob != NULL ) it->m_knob ->enable ( !m_useFileSequence );
559
+ }
560
+ }
561
+
555
562
void LensDistort::buildDynamicKnobs (void * p, DD::Image::Knob_Callback f)
556
563
{
557
564
PluginAttributeList& attributeList ( ((LensDistort*)p)->attributeList () );
0 commit comments