SoundLibrary::SoundLibrary(Options* options, AudioDevice& audio, const DirectoryPath& path) : audioDevice(audio) { #ifdef DISABLE_SFX on = false; #else on = options->getBoolValue(OptionId::SOUND); #endif options->addTrigger(OptionId::SOUND, [this](bool turnOn) { on = turnOn; }); for (SoundId id : ENUM_ALL(SoundId)) addSounds(id, path.subdirectory(toLower(EnumInfo<SoundId>::getString(id)))); }
/* ======================================================================================================================= ======================================================================================================================= */ void CDialogTextures::BuildTree() { CWaitCursor cursor; m_treeTextures.DeleteAllItems(); bool rootItems = m_chkHideRoot.GetCheck() == 0; idTimer timer; timer.Start(); addMaterials( rootItems ); // _D3XP removed //addModels( rootItems ); addScripts( rootItems ); addSounds( rootItems ); addGuis( rootItems ); addParticles( rootItems ); timer.Stop(); common->Printf( "CDialogTextures::BuildTree() took %.0f milliseconds\n", timer.Milliseconds() ); }
/* ======================================================================================================================= ======================================================================================================================= */ void CDialogTextures::OnRefresh() { quickTree.Clear(); addModels( true ); if (mode == TEXTURES) { idStrList textures(1024); int count = declManager->GetNumDecls( DECL_MATERIAL ); int i; const idMaterial *mat; for (i = 0; i < count; i++) { mat = declManager->MaterialByIndex(i, false); if ( mat->IsValid() && mat->TestMaterialFlag(MF_EDITOR_VISIBLE) && !idStr::Icmpn( mat->GetName(), "textures/", 9 ) ) { textures.Append(mat->GetName()); } } declManager->Reload( false ); BuildTree(); count = textures.Num(); for (i = 0; i < count; i++) { mat = declManager->FindMaterial(textures[i].c_str()); if ( mat ) { mat->SetMaterialFlag(MF_EDITOR_VISIBLE); } } SelectCurrentItem(false, g_qeglobals.d_texturewin.texdef.name, CDialogTextures::TEXTURES); } else if (mode == MATERIALS) { idStrList textures(1024); int count = declManager->GetNumDecls( DECL_MATERIAL ); int i; const idMaterial *mat; for (i = 0; i < count; i++) { mat = declManager->MaterialByIndex(i, false); if ( mat->IsValid() && mat->TestMaterialFlag(MF_EDITOR_VISIBLE) && idStr::Icmpn( mat->GetName(), "textures/", 9 ) ) { textures.Append(mat->GetName()); } } declManager->Reload( false ); BuildTree(); count = textures.Num(); for (i = 0; i < count; i++) { mat = declManager->FindMaterial(textures[i].c_str()); if ( mat ) { mat->SetMaterialFlag(MF_EDITOR_VISIBLE); } } SelectCurrentItem(false, g_qeglobals.d_texturewin.texdef.name, CDialogTextures::MATERIALS); } else if (mode == SOUNDS || mode == SOUNDPARENT) { HTREEITEM root = m_treeTextures.GetRootItem(); HTREEITEM sib = m_treeTextures.GetNextItem(root, TVGN_ROOT); while (sib) { idStr str = m_treeTextures.GetItemText(sib); if (str.Icmp(TypeNames[SOUNDS]) == 0) { CWaitCursor cursor; m_treeTextures.DeleteItem(sib); declManager->Reload( false ); bool rootItems = m_chkHideRoot.GetCheck() == 0; addSounds(rootItems); return; } sib = m_treeTextures.GetNextSiblingItem(sib); } } }
void LLPreviewGesture::refresh() { // If previewing or item is incomplete, all controls are disabled LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem(); bool is_complete = (item && item->isComplete()) ? true : false; if (mPreviewGesture || !is_complete) { childSetEnabled("desc", FALSE); //mDescEditor->setEnabled(FALSE); mTriggerEditor->setEnabled(FALSE); mReplaceText->setEnabled(FALSE); mReplaceEditor->setEnabled(FALSE); mModifierCombo->setEnabled(FALSE); mKeyCombo->setEnabled(FALSE); mLibraryList->setEnabled(FALSE); mAddBtn->setEnabled(FALSE); mUpBtn->setEnabled(FALSE); mDownBtn->setEnabled(FALSE); mDeleteBtn->setEnabled(FALSE); mStepList->setEnabled(FALSE); mOptionsText->setEnabled(FALSE); mAnimationCombo->setEnabled(FALSE); mAnimationRadio->setEnabled(FALSE); mSoundCombo->setEnabled(FALSE); mChatEditor->setEnabled(FALSE); mWaitAnimCheck->setEnabled(FALSE); mWaitTimeCheck->setEnabled(FALSE); mWaitTimeEditor->setEnabled(FALSE); mActiveCheck->setEnabled(FALSE); mSaveBtn->setEnabled(FALSE); // Make sure preview button is enabled, so we can stop it mPreviewBtn->setEnabled(TRUE); return; } BOOL modifiable = item->getPermissions().allowModifyBy(gAgent.getID()); childSetEnabled("desc", modifiable); mTriggerEditor->setEnabled(TRUE); mLibraryList->setEnabled(modifiable); mStepList->setEnabled(modifiable); mOptionsText->setEnabled(modifiable); mAnimationCombo->setEnabled(modifiable); mAnimationRadio->setEnabled(modifiable); mSoundCombo->setEnabled(modifiable); mChatEditor->setEnabled(modifiable); mWaitAnimCheck->setEnabled(modifiable); mWaitTimeCheck->setEnabled(modifiable); mWaitTimeEditor->setEnabled(modifiable); mActiveCheck->setEnabled(TRUE); const std::string& trigger = mTriggerEditor->getText(); BOOL have_trigger = !trigger.empty(); const std::string& replace = mReplaceEditor->getText(); BOOL have_replace = !replace.empty(); LLScrollListItem* library_item = mLibraryList->getFirstSelected(); BOOL have_library = (library_item != NULL); LLScrollListItem* step_item = mStepList->getFirstSelected(); S32 step_index = mStepList->getFirstSelectedIndex(); S32 step_count = mStepList->getItemCount(); BOOL have_step = (step_item != NULL); mReplaceText->setEnabled(have_trigger || have_replace); mReplaceEditor->setEnabled(have_trigger || have_replace); mModifierCombo->setEnabled(TRUE); mKeyCombo->setEnabled(TRUE); mAddBtn->setEnabled(modifiable && have_library); mUpBtn->setEnabled(modifiable && have_step && step_index > 0); mDownBtn->setEnabled(modifiable && have_step && step_index < step_count-1); mDeleteBtn->setEnabled(modifiable && have_step); // Assume all not visible mAnimationCombo->setVisible(FALSE); mAnimationRadio->setVisible(FALSE); mSoundCombo->setVisible(FALSE); mChatEditor->setVisible(FALSE); mWaitAnimCheck->setVisible(FALSE); mWaitTimeCheck->setVisible(FALSE); mWaitTimeEditor->setVisible(FALSE); if (have_step) { // figure out the type, show proper options, update text LLGestureStep* step = (LLGestureStep*)step_item->getUserdata(); EStepType type = step->getType(); switch(type) { case STEP_ANIMATION: { LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step; mOptionsText->setText("Animation to play:"); mAnimationCombo->setVisible(TRUE); mAnimationRadio->setVisible(TRUE); mAnimationRadio->setSelectedIndex((anim_step->mFlags & ANIM_FLAG_STOP) ? 1 : 0); mAnimationCombo->setCurrentByID(anim_step->mAnimAssetID); break; } case STEP_SOUND: { LLGestureStepSound* sound_step = (LLGestureStepSound*)step; mOptionsText->setText("Sound to play:"); mSoundCombo->setVisible(TRUE); mSoundCombo->setCurrentByID(sound_step->mSoundAssetID); break; } case STEP_CHAT: { LLGestureStepChat* chat_step = (LLGestureStepChat*)step; mOptionsText->setText("Chat to say:"); mChatEditor->setVisible(TRUE); mChatEditor->setText(chat_step->mChatText); break; } case STEP_WAIT: { LLGestureStepWait* wait_step = (LLGestureStepWait*)step; mOptionsText->setText("Wait:"); mWaitAnimCheck->setVisible(TRUE); mWaitAnimCheck->set(wait_step->mFlags & WAIT_FLAG_ALL_ANIM); mWaitTimeCheck->setVisible(TRUE); mWaitTimeCheck->set(wait_step->mFlags & WAIT_FLAG_TIME); mWaitTimeEditor->setVisible(TRUE); char buffer[16]; /*Flawfinder: ignore*/ snprintf(buffer, sizeof(buffer), "%.1f", (double)wait_step->mWaitSeconds); /* Flawfinder: ignore */ mWaitTimeEditor->setText(buffer); break; } default: break; } } else { // no gesture mOptionsText->setText(""); } BOOL active = gGestureManager.isGestureActive(mItemUUID); mActiveCheck->set(active); // Can only preview if there are steps mPreviewBtn->setEnabled(step_count > 0); // And can only save if changes have been made mSaveBtn->setEnabled(mDirty); addAnimations(); addSounds(); }
BOOL LLPreviewGesture::postBuild() { LLLineEditor* edit; LLComboBox* combo; LLButton* btn; LLScrollListCtrl* list; LLTextBox* text; LLCheckBoxCtrl* check; edit = LLViewerUICtrlFactory::getLineEditorByName(this, "trigger_editor"); edit->setKeystrokeCallback(onKeystrokeCommit); edit->setCommitCallback(onCommitSetDirty); edit->setCommitOnFocusLost(TRUE); edit->setCallbackUserData(this); edit->setIgnoreTab(TRUE); mTriggerEditor = edit; text = LLViewerUICtrlFactory::getTextBoxByName(this, "replace_text"); text->setEnabled(FALSE); mReplaceText = text; edit = LLViewerUICtrlFactory::getLineEditorByName(this, "replace_editor"); edit->setEnabled(FALSE); edit->setKeystrokeCallback(onKeystrokeCommit); edit->setCommitCallback(onCommitSetDirty); edit->setCommitOnFocusLost(TRUE); edit->setCallbackUserData(this); edit->setIgnoreTab(TRUE); mReplaceEditor = edit; combo = LLViewerUICtrlFactory::getComboBoxByName(this, "modifier_combo"); combo->setCommitCallback(onCommitSetDirty); combo->setCallbackUserData(this); mModifierCombo = combo; combo = LLViewerUICtrlFactory::getComboBoxByName(this, "key_combo"); combo->setCommitCallback(onCommitSetDirty); combo->setCallbackUserData(this); mKeyCombo = combo; list = LLViewerUICtrlFactory::getScrollListByName(this, "library_list"); list->setCommitCallback(onCommitLibrary); list->setDoubleClickCallback(onClickAdd); list->setCallbackUserData(this); mLibraryList = list; btn = LLViewerUICtrlFactory::getButtonByName(this, "add_btn"); btn->setClickedCallback(onClickAdd); btn->setCallbackUserData(this); btn->setEnabled(FALSE); mAddBtn = btn; btn = LLViewerUICtrlFactory::getButtonByName(this, "up_btn"); btn->setClickedCallback(onClickUp); btn->setCallbackUserData(this); btn->setEnabled(FALSE); mUpBtn = btn; btn = LLViewerUICtrlFactory::getButtonByName(this, "down_btn"); btn->setClickedCallback(onClickDown); btn->setCallbackUserData(this); btn->setEnabled(FALSE); mDownBtn = btn; btn = LLViewerUICtrlFactory::getButtonByName(this, "delete_btn"); btn->setClickedCallback(onClickDelete); btn->setCallbackUserData(this); btn->setEnabled(FALSE); mDeleteBtn = btn; list = LLViewerUICtrlFactory::getScrollListByName(this, "step_list"); list->setCommitCallback(onCommitStep); list->setCallbackUserData(this); mStepList = list; // Options text = LLViewerUICtrlFactory::getTextBoxByName(this, "options_text"); text->setBorderVisible(TRUE); mOptionsText = text; combo = LLViewerUICtrlFactory::getComboBoxByName(this, "animation_list"); combo->setVisible(FALSE); combo->setCommitCallback(onCommitAnimation); combo->setCallbackUserData(this); mAnimationCombo = combo; LLRadioGroup* group; group = LLViewerUICtrlFactory::getRadioGroupByName(this, "animation_trigger_type"); group->setVisible(FALSE); group->setCommitCallback(onCommitAnimationTrigger); group->setCallbackUserData(this); mAnimationRadio = group; combo = LLViewerUICtrlFactory::getComboBoxByName(this, "sound_list"); combo->setVisible(FALSE); combo->setCommitCallback(onCommitSound); combo->setCallbackUserData(this); mSoundCombo = combo; edit = LLViewerUICtrlFactory::getLineEditorByName(this, "chat_editor"); edit->setVisible(FALSE); edit->setCommitCallback(onCommitChat); //edit->setKeystrokeCallback(onKeystrokeCommit); edit->setCommitOnFocusLost(TRUE); edit->setCallbackUserData(this); edit->setIgnoreTab(TRUE); mChatEditor = edit; check = LLViewerUICtrlFactory::getCheckBoxByName(this, "wait_anim_check"); check->setVisible(FALSE); check->setCommitCallback(onCommitWait); check->setCallbackUserData(this); mWaitAnimCheck = check; check = LLViewerUICtrlFactory::getCheckBoxByName(this, "wait_time_check"); check->setVisible(FALSE); check->setCommitCallback(onCommitWait); check->setCallbackUserData(this); mWaitTimeCheck = check; edit = LLViewerUICtrlFactory::getLineEditorByName(this, "wait_time_editor"); edit->setEnabled(FALSE); edit->setVisible(FALSE); edit->setPrevalidate(LLLineEditor::prevalidateFloat); // edit->setKeystrokeCallback(onKeystrokeCommit); edit->setCommitOnFocusLost(TRUE); edit->setCommitCallback(onCommitWaitTime); edit->setCallbackUserData(this); edit->setIgnoreTab(TRUE); mWaitTimeEditor = edit; // Buttons at the bottom check = LLViewerUICtrlFactory::getCheckBoxByName(this, "active_check"); check->setCommitCallback(onCommitActive); check->setCallbackUserData(this); mActiveCheck = check; btn = LLViewerUICtrlFactory::getButtonByName(this, "save_btn"); btn->setClickedCallback(onClickSave); btn->setCallbackUserData(this); mSaveBtn = btn; btn = LLViewerUICtrlFactory::getButtonByName(this, "preview_btn"); btn->setClickedCallback(onClickPreview); btn->setCallbackUserData(this); mPreviewBtn = btn; // Populate the comboboxes addModifiers(); addKeys(); addAnimations(); addSounds(); const LLInventoryItem* item = getItem(); if (item) { childSetCommitCallback("desc", LLPreview::onText, this); childSetText("desc", item->getDescription()); childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); } return TRUE; }