Fix findChild during draw in script editor

master
Rye Mutt 2024-08-18 18:34:42 -04:00
parent b214de1cc3
commit e5748df9a5
2 changed files with 9 additions and 5 deletions

View File

@ -435,7 +435,7 @@ void LLLiveLSLEditor::experienceChanged()
if(mScriptEd->getAssociatedExperience() != mExperiences->getSelectedValue().asUUID())
{
mScriptEd->enableSave(getIsModifiable());
//getChildView("Save_btn")->setEnabled(true);
//mSaveBtn->setEnabled(true);
mScriptEd->setAssociatedExperience(mExperiences->getSelectedValue().asUUID());
updateExperiencePanel();
}
@ -481,6 +481,7 @@ void LLLiveLSLEditor::onToggleExperience( LLUICtrl *ui, void* userdata )
bool LLScriptEdCore::postBuild()
{
mLineCol = getChild<LLTextBox>("line_col");
mErrorList = getChild<LLScrollListCtrl>("lsl errors");
mFunctions = getChild<LLComboBox>("Insert...");
@ -490,7 +491,8 @@ bool LLScriptEdCore::postBuild()
mEditor = getChild<LLScriptEditor>("Script Editor");
childSetCommitCallback("lsl errors", &LLScriptEdCore::onErrorList, this);
childSetAction("Save_btn", boost::bind(&LLScriptEdCore::doSave,this,false));
mSaveBtn = getChild<LLButton>("Save_btn");
mSaveBtn->setCommitCallback(boost::bind(&LLScriptEdCore::doSave, this, false));
childSetAction("Edit_btn", boost::bind(&LLScriptEdCore::openInExternalEditor, this));
initMenu();
@ -711,7 +713,7 @@ bool LLScriptEdCore::hasChanged()
void LLScriptEdCore::draw()
{
bool script_changed = hasChanged();
getChildView("Save_btn")->setEnabled(script_changed && !mScriptRemoved);
mSaveBtn->setEnabled(script_changed && !mScriptRemoved);
if( mEditor->hasFocus() )
{
@ -723,11 +725,11 @@ void LLScriptEdCore::draw()
args["[LINE]"] = llformat ("%d", line);
args["[COLUMN]"] = llformat ("%d", column);
cursor_pos = LLTrans::getString("CursorPos", args);
getChild<LLUICtrl>("line_col")->setValue(cursor_pos);
mLineCol->setValue(cursor_pos);
}
else
{
getChild<LLUICtrl>("line_col")->setValue(LLStringUtil::null);
mLineCol->setValue(LLStringUtil::null);
}
updateDynamicHelp();

View File

@ -195,6 +195,8 @@ private:
bool mScriptRemoved;
bool mSaveDialogShown;
LLUUID mAssetID;
LLTextBox* mLineCol = nullptr;
LLButton* mSaveBtn = nullptr;
LLScriptEdContainer* mContainer; // parent view