#include <Iguana/GLBrowsers/interface/Ig3DAnimsCategory.h>
Definition at line 32 of file Ig3DAnimsCategory.h.
Ig3DAnimsCategory::Ig3DAnimsCategory | ( | IgState * | state, | |
Ig3DBaseBrowser * | source | |||
) |
Definition at line 35 of file Ig3DAnimsCategory.cc.
References reco::fitHelper::add(), IgControlCategory::bottomLayout(), Ig3DRangeControl< C1, C2, C3 >::control(), m_axis, m_complete, m_newAxis, m_on, m_state, m_timeFreq, m_timeMax, m_timeStep, IgControlCategory::panel(), IgState::put(), IgControlItem::setEditable(), IgQtRangeValue< T >::setMinValue(), IgQtRangeControlImp< T >::setRange(), IgQtRangeControlCommon::widget(), Ig3DBoolControl::widget(), Ig3DVectorControl::xControl(), Ig3DVectorControl::yControl(), and Ig3DVectorControl::zControl().
00037 : Ig3DObjectCategory<IgSoAnimator> (state, "Animators"), 00038 m_source (source), 00039 m_axis (new Ig3DUnitVec3fControl (this, "Axis")), 00040 m_timeMax (new Ig3DShortControl (this, "Max Time", 00041 IgQtRangeControl::StepperPart 00042 | IgQtRangeControl::ValuePart 00043 | IgQtRangeControl::SliderPart)), 00044 m_timeStep(new Ig3DShortControl (this, "Time Step", 00045 IgQtRangeControl::StepperPart 00046 | IgQtRangeControl::ValuePart 00047 | IgQtRangeControl::SliderPart)), 00048 m_timeFreq(new Ig3DFloatControl (this, "Frequency", 00049 IgQtRangeControl::StepperPart 00050 | IgQtRangeControl::ValuePart 00051 | IgQtRangeControl::SliderPart)), 00052 m_state (new Ig3DInt32Control (this, "State", 00053 IgQtRangeControl::StepperPart 00054 | IgQtRangeControl::ValuePart 00055 | IgQtRangeControl::SliderPart)), 00056 m_newAxis (new Ig3DInt32Control (this, "New Axis", 00057 IgQtRangeControl::StepperPart 00058 | IgQtRangeControl::ValuePart 00059 | IgQtRangeControl::SliderPart)), 00060 m_complete(new Ig3DBoolControl (this, "Complate")), 00061 m_on (new Ig3DBoolControl (this, "Start/Stop")), 00062 m_reset (new Ig3DBoolControl (this, "Reset animation")) 00063 { 00064 m_complete->setEditable (false); 00065 m_newAxis->setEditable (false); 00066 m_timeMax->control ()->setMinValue (1); 00067 m_timeStep->control ()->setMinValue (1); 00068 m_newAxis->control ()->setRange(0, 2); 00069 m_state->control ()->setRange(0, 2); 00070 m_timeFreq->control ()->setMinValue (0.); 00071 00072 QWhatsThis::add (panel (), "3D Animatation Control Category"); 00073 QWhatsThis::add (m_axis->xControl ()->widget (), "X-axis of animation"); 00074 QWhatsThis::add (m_axis->yControl ()->widget (), "Y-axis of animation"); 00075 QWhatsThis::add (m_axis->zControl ()->widget (), "Z-axis of animation"); 00076 QWhatsThis::add (m_timeMax->control ()->widget (),"Maximum counter value"); 00077 QWhatsThis::add (m_timeStep->control ()->widget (),"Counter step size"); 00078 QWhatsThis::add (m_timeFreq->control ()->widget (), 00079 "Number of complete cycles from the\n" 00080 "min value to the max value per second"); 00081 QWhatsThis::add (m_on->widget (), "Start/Stop animation"); 00082 QWhatsThis::add (m_complete->widget (), "Animation Completed"); 00083 QWhatsThis::add (m_newAxis->control ()->widget (), 00084 "Current Axis of animation\n" 00085 " 0 - Along X-axis\n" 00086 " 1 - Along Y-axis\n" 00087 " 2 - Along Z-axis"); 00088 QWhatsThis::add (m_state->control ()->widget (), 00089 "State of animation\n" 00090 " 0 - Along X-axis\n" 00091 " 1 - Along Y-axis\n" 00092 " 2 - Along Z-axis"); 00093 00094 // Space it up 00095 bottomLayout ()->addItem (new QSpacerItem (20, 20, 00096 QSizePolicy::Minimum, QSizePolicy::Expanding)); 00097 state->put (s_key, this); 00098 }
Ig3DAnimsCategory::~Ig3DAnimsCategory | ( | void | ) |
Definition at line 100 of file Ig3DAnimsCategory.cc.
References IgState::detach(), and IgControlCategory::state().
Ig3DAnimsCategory::Ig3DAnimsCategory | ( | const Ig3DAnimsCategory & | ) | [private] |
Reimplemented from IgControlCategory.
Definition at line 149 of file Ig3DAnimsCategory.cc.
References IgControlBase::apply(), m_axis, m_complete, m_newAxis, m_on, m_reset, m_state, m_timeFreq, m_timeMax, and m_timeStep.
00150 { 00151 m_axis->apply (); 00152 m_timeMax->apply (); 00153 m_timeStep->apply (); 00154 m_timeFreq->apply (); 00155 m_newAxis->apply (); 00156 m_state->apply (); 00157 m_on->apply (); 00158 m_reset->apply (); 00159 m_complete->apply (); 00160 }
Reimplemented from IgControlCategory.
Definition at line 106 of file Ig3DAnimsCategory.cc.
References IgSoAnimator::axis, IgSoAnimator::complete, IgControlCategory::currentItem(), m_axis, m_complete, m_newAxis, m_on, m_reset, m_state, m_timeFreq, m_timeMax, m_timeStep, IgSoAnimator::newAxis, VarParsing::obj, Ig3DObjectCategory< IgSoAnimator >::object(), IgSoAnimator::on, IgSoAnimator::reset, Ig3DBoolControl::setField(), Ig3DVec3fControl::setField(), Ig3DRangeControl< C1, C2, C3 >::setField(), IgSoAnimator::state, IgSoAnimator::timeFreq, IgSoAnimator::timeMax, and IgSoAnimator::timeStep.
Referenced by reconstruct().
00107 { 00108 IgSoAnimator *obj = object (currentItem ()); 00109 m_axis->setField (&obj->axis); 00110 m_timeMax->setField (&obj->timeMax); 00111 m_timeStep->setField (&obj->timeStep); 00112 m_timeFreq->setField (&obj->timeFreq); 00113 m_newAxis->setField (&obj->newAxis); 00114 m_state->setField (&obj->state); 00115 m_on->setField (&obj->on); 00116 m_reset->setField (&obj->reset); 00117 m_complete->setField (&obj->complete); 00118 }
void Ig3DAnimsCategory::browserChanged | ( | Ig3DBaseBrowser * | browser | ) |
Definition at line 300 of file Ig3DAnimsCategory.cc.
References m_source, and reconstruct().
Referenced by registerBrowser().
00301 { 00302 m_source = browser; 00303 reconstruct (); 00304 }
Definition at line 278 of file Ig3DAnimsCategory.cc.
References Ig3DBaseModel::attachPoint(), Ig3DBaseModel::encode(), group, m_source, Ig3DBaseRep::magic(), makeOne(), and Ig3DBaseBrowser::model().
Referenced by reconstruct().
00279 { 00280 SoGroup *group = new SoGroup; 00281 group->setName (Ig3DBaseModel::encode ("Default Anims Group")); 00282 m_source->model ()->attachPoint ()->magic ()->addChild (group); 00283 makeOne ("Default Animator"); 00284 }
Reimplemented from IgControlCategory.
Definition at line 204 of file Ig3DAnimsCategory.cc.
References IgControlCategory::itemChanged(), IgControlCategory::items(), makeOne(), and IgControlCategory::setCurrentItem().
00205 { 00206 bool isMade = makeOne (); 00207 if (isMade) 00208 { 00209 setCurrentItem (items ()-1); 00210 itemChanged (-1); 00211 } 00212 }
Reimplemented from IgControlCategory.
Definition at line 215 of file Ig3DAnimsCategory.cc.
References deleteOne().
00216 { deleteOne (); }
Definition at line 262 of file Ig3DAnimsCategory.cc.
References ASSERT, Ig3DBaseModel::attachPoint(), IgControlCategory::currentItem(), detach(), Ig3DBaseModel::encode(), Ig3DBaseRep::findMagic(), group, m_source, Ig3DBaseBrowser::model(), VarParsing::obj, and Ig3DObjectCategory< IgSoAnimator >::object().
Referenced by deleteItem().
00263 { 00264 int current = currentItem (); 00265 IgSoAnimator *obj = object (current); 00266 00267 detach (); 00268 SoGroup *group = dynamic_cast<SoGroup *>( 00269 m_source->model ()->attachPoint ()->findMagic ( 00270 Ig3DBaseModel::encode ("Default Anims Group"))); 00271 ASSERT (group); 00272 group->removeChild (obj); 00273 remove (current); 00274 }
Reimplemented from IgControlCategory.
Definition at line 121 of file Ig3DAnimsCategory.cc.
References m_axis, m_complete, m_newAxis, m_on, m_reset, m_state, m_timeFreq, m_timeMax, m_timeStep, Ig3DBoolControl::setField(), Ig3DVec3fControl::setField(), and Ig3DRangeControl< C1, C2, C3 >::setField().
Referenced by deleteOne(), and reconstruct().
00122 { 00123 m_axis->setField (0); 00124 m_timeMax->setField (0); 00125 m_timeStep->setField (0); 00126 m_timeFreq->setField (0); 00127 m_newAxis->setField (0); 00128 m_state->setField (0); 00129 m_on->setField (0); 00130 m_reset->setField (0); 00131 m_complete->setField (0); 00132 }
Ig3DAnimsCategory::IG_DECLARE_STATE_ELEMENT | ( | Ig3DAnimsCategory | ) | [private] |
bool Ig3DAnimsCategory::makeOne | ( | QString | name = "" |
) | [private, virtual, slot] |
Definition at line 232 of file Ig3DAnimsCategory.cc.
References ASSERT, Ig3DBaseModel::attachPoint(), pyDBSguiBaseClass::base, Ig3DBaseModel::encode(), Ig3DBaseRep::findMagic(), group, IgControlCategory::items(), m_source, Ig3DBaseBrowser::model(), edm::Normal, and IgControlCategory::panel().
Referenced by buildDefaults(), and createNewItem().
00233 { 00234 bool isMade = false; 00235 if (name.isEmpty ()) 00236 { 00237 bool ok = false; 00238 QString base ("Animator #%1"); 00239 00240 name = QInputDialog::getText (tr("Name"), QString::null, 00241 QLineEdit::Normal, 00242 base.arg (items () + 1), 00243 &ok, panel ()); 00244 00245 if (! ok || name.isEmpty ()) 00246 return isMade; 00247 } 00248 00249 IgSoAnimator *anim = new IgSoAnimator; 00250 anim->setName (Ig3DBaseModel::encode (name.utf8 ().data ())); 00251 00252 SoGroup *group = dynamic_cast<SoGroup *>( 00253 m_source->model ()->attachPoint ()->findMagic ( 00254 Ig3DBaseModel::encode ("Default Anims Group"))); 00255 ASSERT (group); 00256 group->addChild (anim); 00257 add (anim, true); 00258 return isMade = true; 00259 }
Ig3DAnimsCategory& Ig3DAnimsCategory::operator= | ( | const Ig3DAnimsCategory & | ) | [private] |
void Ig3DAnimsCategory::reconstruct | ( | SoGroup * | from | ) | [private] |
Definition at line 186 of file Ig3DAnimsCategory.cc.
References ASSERT, attach(), IgControlCategory::currentItem(), detach(), i, n, prof2calltree::node, and update().
00187 { 00188 for (int i = 0, n = from->getNumChildren (); i < n; ++i) 00189 { 00190 ASSERT (from->getChild (i)->isOfType (IgSoAnimator::getClassTypeId ())); 00191 IgSoAnimator *node = static_cast<IgSoAnimator *> (from->getChild (i)); 00192 add (node, true); 00193 } 00194 detach (); 00195 if (object (currentItem ())) 00196 { 00197 attach (); 00198 update (); 00199 } 00200 }
Definition at line 172 of file Ig3DAnimsCategory.cc.
References ASSERT, Ig3DBaseModel::attachPoint(), buildDefaults(), Ig3DObjectCategory< IgSoAnimator >::clear(), Ig3DBaseModel::encode(), Ig3DBaseRep::findMagic(), group, m_source, and Ig3DBaseBrowser::model().
Referenced by browserChanged().
00173 { 00174 ASSERT (m_source); 00175 SoGroup *group = dynamic_cast<SoGroup *>( 00176 m_source->model ()->attachPoint ()->findMagic ( 00177 Ig3DBaseModel::encode ("Default Anims Group"))); 00178 clear (); 00179 if (group) 00180 reconstruct (group); 00181 else 00182 buildDefaults (); 00183 }
void Ig3DAnimsCategory::registerBrowser | ( | IgState * | state, | |
Ig3DBaseBrowser * | browser | |||
) | [virtual] |
Reimplemented from Ig3DObjectCategory< IgSoAnimator >.
Definition at line 288 of file Ig3DAnimsCategory.cc.
References IgQtAppContextService::addOnFocusIn(), ASSERT, browserChanged(), lat::CreateCallback(), DBSPlugin::get(), and IgControlCategory::registerMe().
Referenced by Ig3DWindow::initCategories().
00289 { 00290 IgQtAppContextService *cs = IgQtAppContextService::get (state); 00291 ASSERT (cs); 00292 cs->addOnFocusIn (lat::CreateCallback (this, 00293 &Ig3DAnimsCategory::browserChanged, 00294 browser)); 00295 IgControlCategory::registerMe (state); 00296 }
void Ig3DAnimsCategory::renameItem | ( | const QString & | newName | ) | [protected, virtual] |
Reimplemented from IgControlCategory.
Definition at line 219 of file Ig3DAnimsCategory.cc.
References IgControlCategory::currentItem(), IgControlCategory::currentText(), Ig3DBaseModel::decode(), edm::getName(), Ig3DObjectCategory< IgSoAnimator >::rename(), and IgControlCategory::renameItem().
00220 { 00221 int current = currentItem (); 00222 QString oldName (Ig3DBaseModel::decode(object (current)->getName ()).c_str ()); 00223 if (!newName.isEmpty() && newName != oldName) 00224 { 00225 IgControlCategory:: renameItem(newName); 00226 rename (current, currentText ()); 00227 } 00228 }
Reimplemented from IgControlItem.
Definition at line 163 of file Ig3DAnimsCategory.cc.
References m_complete, m_newAxis, and IgControlItem::setEditable().
00164 { 00165 IgControlItem::setEditable (value); 00166 m_complete->setEditable (false); 00167 m_newAxis->setEditable (false); 00168 }
Reimplemented from IgControlCategory.
Definition at line 135 of file Ig3DAnimsCategory.cc.
References m_axis, m_complete, m_newAxis, m_on, m_reset, m_state, m_timeFreq, m_timeMax, m_timeStep, and IgControlBase::update().
Referenced by reconstruct().
00136 { 00137 m_axis->update (); 00138 m_timeMax->update (); 00139 m_timeStep->update (); 00140 m_timeFreq->update (); 00141 m_newAxis->update (); 00142 m_state->update (); 00143 m_on->update (); 00144 m_reset->update (); 00145 m_complete->update (); 00146 }
Ig3DUnitVec3fControl* Ig3DAnimsCategory::m_axis [private] |
Definition at line 71 of file Ig3DAnimsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DAnimsCategory(), and update().
Ig3DBoolControl* Ig3DAnimsCategory::m_complete [private] |
Definition at line 77 of file Ig3DAnimsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DAnimsCategory(), setEditable(), and update().
Ig3DInt32Control* Ig3DAnimsCategory::m_newAxis [private] |
Definition at line 76 of file Ig3DAnimsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DAnimsCategory(), setEditable(), and update().
Ig3DBoolControl* Ig3DAnimsCategory::m_on [private] |
Definition at line 78 of file Ig3DAnimsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DAnimsCategory(), and update().
Ig3DBoolControl* Ig3DAnimsCategory::m_reset [private] |
Ig3DBaseBrowser* Ig3DAnimsCategory::m_source [private] |
Definition at line 69 of file Ig3DAnimsCategory.h.
Referenced by browserChanged(), buildDefaults(), deleteOne(), makeOne(), and reconstruct().
Ig3DInt32Control* Ig3DAnimsCategory::m_state [private] |
Reimplemented from IgControlCategory.
Definition at line 75 of file Ig3DAnimsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DAnimsCategory(), and update().
Ig3DFloatControl* Ig3DAnimsCategory::m_timeFreq [private] |
Definition at line 74 of file Ig3DAnimsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DAnimsCategory(), and update().
Ig3DShortControl* Ig3DAnimsCategory::m_timeMax [private] |
Definition at line 72 of file Ig3DAnimsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DAnimsCategory(), and update().
Ig3DShortControl* Ig3DAnimsCategory::m_timeStep [private] |
Definition at line 73 of file Ig3DAnimsCategory.h.
Referenced by apply(), attach(), detach(), Ig3DAnimsCategory(), and update().