@@ -907,14 +907,17 @@ GuiControl* GuiInspectorTypeParticleDataList::constructEditControl()
907907 mNewParticleBtn ->registerObject ();
908908 mNewParticleBtn ->_setBitmap (StringTable->insert (" ToolsModule:iconAdd_image" ));
909909 mNewParticleBtn ->setDataField (StringTable->insert (" profile" ), NULL , " ToolsGuiDefaultProfile" );
910+ mNewParticleBtn ->setDataField (StringTable->insert (" tooltipprofile" ), NULL , " GuiToolTipProfile" );
911+ mNewParticleBtn ->setDataField (StringTable->insert (" hovertime" ), NULL , " 1000" );
912+ mNewParticleBtn ->setDataField (StringTable->insert (" tooltip" ), NULL , " Add new particle slot" );
910913 mNewParticleBtn ->setHorizSizing (horizResizeRight);
911914 mNewParticleBtn ->mMakeIconSquare = true ;
912915 mNewParticleBtn ->mFitBitmapToButton = true ;
913916 mNewParticleBtn ->setExtent (20 , 20 );
914917
915918 char szBuffer[512 ];
916919 dSprintf (szBuffer, sizeof (szBuffer), " ParticleEditor.addParticleSlot(%s, %s);" ,
917- mNewParticleBtn ->getIdString (), mInspector ->getInspectObject ()->getIdString ());
920+ this ->getIdString (), mInspector ->getInspectObject ()->getIdString ());
918921 mNewParticleBtn ->setField (" Command" , szBuffer);
919922
920923 GuiContainer* newBtnCtnr = new GuiContainer ();
@@ -924,39 +927,16 @@ GuiControl* GuiInspectorTypeParticleDataList::constructEditControl()
924927
925928 mStack ->addObject (newBtnCtnr);
926929
927- // Particle 0
928- mParticleSlot0Ctrl = _buildParticleEntryField (0 );
929-
930- mStack ->addObject (mParticleSlot0Ctrl );
931-
932- // Now the non-default entries if we already have some
933- Parent::updateValue ();
934- const char * data = getData ();
935-
936- if (data != NULL && !String::isEmpty (data))
937- {
938- U32 particlesCount = StringUnit::getUnitCount (data, " " );
939- for (U32 i=1 ; i < particlesCount; i++)
940- {
941- GuiControl* particleSlotCtrl = _buildParticleEntryField (i);
942- mStack ->addObject (particleSlotCtrl);
943- }
944- }
930+ _rebuildParticleEntryList ();
945931
946932 _registerEditControl (mStack );
947933
948- // constructEditControlChildren(retCtrl, getWidth());
949-
950- // retCtrl->addObject(mScriptValue);
951-
952- /* char szBuffer[512];
953- dSprintf(szBuffer, 512, "setClipboard(%d.getText());", mScriptValue->getId());
954- mCopyButton->setField("Command", szBuffer);
955- addObject(mCopyButton);*/
956-
957934 mUseHeightOverride = true ;
958935 mHeightOverride = (mStack ->getCount () * 23 ) + 6 ;
959936
937+ // Now the non-default entries if we already have some
938+ // Parent::updateValue();
939+
960940 return mStack ;
961941}
962942
@@ -980,7 +960,7 @@ GuiControl* GuiInspectorTypeParticleDataList::_buildParticleEntryField(const S32
980960
981961 char szBuffer[512 ];
982962 dSprintf (szBuffer, sizeof (szBuffer), " ParticleEditor.changeParticleSlot(%s, %s, %d);" ,
983- listBtn ->getIdString (), mInspector ->getInspectObject ()->getIdString (), index);
963+ this ->getIdString (), mInspector ->getInspectObject ()->getIdString (), index);
984964 listBtn->setField (" Command" , szBuffer);
985965
986966 if (mField && index != -1 )
@@ -1001,6 +981,9 @@ GuiControl* GuiInspectorTypeParticleDataList::_buildParticleEntryField(const S32
1001981 editSlotBtn->registerObject ();
1002982 editSlotBtn->setText (StringTable->insert (" ..." ));
1003983 editSlotBtn->setDataField (StringTable->insert (" profile" ), NULL , " ToolsGuiButtonProfile" );
984+ editSlotBtn->setDataField (StringTable->insert (" tooltipprofile" ), NULL , " GuiToolTipProfile" );
985+ editSlotBtn->setDataField (StringTable->insert (" hovertime" ), NULL , " 1000" );
986+ editSlotBtn->setDataField (StringTable->insert (" tooltip" ), NULL , " Edit this particle" );
1004987 editSlotBtn->setHorizSizing (horizResizeRight);
1005988 editSlotBtn->setInternalName (" editBtn" );
1006989 editSlotBtn->setPosition (editExtent.x - 40 , 0 );
@@ -1019,6 +1002,9 @@ GuiControl* GuiInspectorTypeParticleDataList::_buildParticleEntryField(const S32
10191002 deleteSlotBtn->registerObject ();
10201003 deleteSlotBtn->_setBitmap (StringTable->insert (" ToolsModule:iconCancel_image" ));
10211004 deleteSlotBtn->setDataField (StringTable->insert (" profile" ), NULL , " ToolsGuiDefaultProfile" );
1005+ deleteSlotBtn->setDataField (StringTable->insert (" tooltipprofile" ), NULL , " GuiToolTipProfile" );
1006+ deleteSlotBtn->setDataField (StringTable->insert (" hovertime" ), NULL , " 1000" );
1007+ deleteSlotBtn->setDataField (StringTable->insert (" tooltip" ), NULL , " Delete this particle slot" );
10221008 deleteSlotBtn->setHorizSizing (horizResizeRight);
10231009 deleteSlotBtn->setInternalName (" deleteBtn" );
10241010 deleteSlotBtn->mMakeIconSquare = true ;
@@ -1062,6 +1048,38 @@ void GuiInspectorTypeParticleDataList::_populateMenu(GuiPopUpMenuCtrlEx* menu)
10621048 menu->sort ();
10631049}
10641050
1051+ void GuiInspectorTypeParticleDataList::_rebuildParticleEntryList ()
1052+ {
1053+ const char * data = getData ();
1054+
1055+ // whoops it's misaligned, force a rebuild
1056+ mParticleSlot0Ctrl = NULL ;
1057+
1058+ for (U32 i = 0 ; i < mParticleSlotList .size (); i++)
1059+ {
1060+ mStack ->removeObject (mParticleSlotList [i]);
1061+ mParticleSlotList [i]->deleteObject ();
1062+ }
1063+ mParticleSlotList .clear ();
1064+
1065+ // Particle 0
1066+ mParticleSlot0Ctrl = _buildParticleEntryField (0 );
1067+ mStack ->addObject (mParticleSlot0Ctrl );
1068+ mParticleSlotList .push_back (mParticleSlot0Ctrl );
1069+
1070+ if (data != NULL && !String::isEmpty (data))
1071+ {
1072+ U32 particlesCount = StringUnit::getUnitCount (data, " " );
1073+
1074+ for (U32 i = 1 ; i < particlesCount; i++)
1075+ {
1076+ GuiControl* particleSlotCtrl = _buildParticleEntryField (i);
1077+ mStack ->addObject (particleSlotCtrl);
1078+ mParticleSlotList .push_back (particleSlotCtrl);
1079+ }
1080+ }
1081+ }
1082+
10651083bool GuiInspectorTypeParticleDataList::updateRects ()
10661084{
10671085 S32 rowSize = 18 ;
@@ -1109,14 +1127,43 @@ bool GuiInspectorTypeParticleDataList::updateRects()
11091127
11101128 mEdit ->resize (mEditCtrlRect .point , mEditCtrlRect .extent );
11111129
1130+ mUseHeightOverride = true ;
11121131 mHeightOverride = (mStack ->getCount () * 23 ) + 6 ;
11131132
1114- // mCopyButton->resize(Point2I(mProfile->mTextOffset.x, rowSize + 3), Point2I(45, 15) );
1115- // mPasteButton->resize(Point2I(mProfile->mTextOffset. x, rowSize + rowSize + 6), Point2I(45, 15) );
1133+ RectI bnds = getBounds ( );
1134+ setBounds (bnds. point . x , bnds. point . y , bnds. extent . x , mHeightOverride );
11161135
11171136 return true ;
11181137}
11191138
1139+ void GuiInspectorTypeParticleDataList::updateValue ()
1140+ {
1141+ const char * data = getData ();
1142+
1143+ if (data != NULL && !String::isEmpty (data))
1144+ {
1145+ U32 particlesCount = StringUnit::getUnitCount (data, " " );
1146+
1147+ if (particlesCount != mParticleSlotList .size ())
1148+ {
1149+ _rebuildParticleEntryList ();
1150+ }
1151+ else
1152+ {
1153+ for (U32 i = 0 ; i < particlesCount; i++)
1154+ {
1155+ GuiButtonCtrl* listBtn = dynamic_cast <GuiButtonCtrl*>(mParticleSlotList [i]->getObject (0 ));
1156+ if (!listBtn) // This *really* shouldn't happen
1157+ continue ;
1158+
1159+ const char * particleName = StringUnit::getUnit (data, i, " " );
1160+ listBtn->setText (particleName);
1161+ }
1162+ }
1163+ }
1164+
1165+ updateRects ();
1166+ }
11201167
11211168void GuiInspectorTypeParticleDataList::consoleInit ()
11221169{
0 commit comments