@@ -73,7 +73,7 @@ ShowFieldDialog::ShowFieldDialog(const std::string& name, ModuleStateHandle stat
7373 connectButtonToExecuteSignal (edgesAsCylindersButton_);
7474 connectButtonToExecuteSignal (nodesAsPointsButton_);
7575 connectButtonToExecuteSignal (nodesAsSpheresButton_);
76-
76+
7777 // default values
7878 cylinder_rad_spin->setValue (1.0 );
7979 cylinder_res_spin->setValue (5 );
@@ -122,10 +122,12 @@ void ShowFieldDialog::pull()
122122 pull_newVersionToReplaceOld ();
123123 Pulling p (this );
124124 ColorRGB color (state_->getValue (ShowFieldModule::DefaultMeshColor).toString ());
125+ // std::cout << "pull color: " << color.r() << " " << color.g() << " " << color.b() << std::endl;
126+ // check for old saved color format: integers 0-255.
125127 defaultMeshColor_ = QColor (
126- static_cast <int >(color.r () * 255.0 ),
127- static_cast <int >(color.g () * 255.0 ),
128- static_cast <int >(color.b () * 255.0 ));
128+ static_cast <int >(color.r () > 1 ? color. r () : color. r () * 255.0 ),
129+ static_cast <int >(color.g () > 1 ? color. g () : color. g () * 255.0 ),
130+ static_cast <int >(color.b () > 1 ? color. b () : color. b () * 255.0 ));
129131}
130132
131133void ShowFieldDialog::assignDefaultMeshColor ()
@@ -142,5 +144,7 @@ void ShowFieldDialog::assignDefaultMeshColor()
142144
143145void ShowFieldDialog::pushColor ()
144146{
145- state_->setValue (ShowFieldModule::DefaultMeshColor, ColorRGB (defaultMeshColor_.red () / 255.0 , defaultMeshColor_.green () / 255.0 , defaultMeshColor_.blue () / 255.0 ).toString ());
147+ // std::cout << "push color: " << defaultMeshColor_.redF() << " " << defaultMeshColor_.greenF() << " " << defaultMeshColor_.blueF() << std::endl;
148+ state_->setValue (ShowFieldModule::DefaultMeshColor, ColorRGB (defaultMeshColor_.redF (), defaultMeshColor_.greenF (), defaultMeshColor_.blueF ()).toString ());
149+ Q_EMIT executeActionTriggered ();
146150}
0 commit comments