void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const std::string& name ) { LLCtrlSelectionInterface *iface = childGetSelectionInterface("friend combo"); if (!iface) return; buildAvatarIDList(); if(iface->setCurrentByID(avatar_id) || gAgent.isGodlike()) { // *HACK: Adjust Z values automatically for liaisons & gods so // they swoop down when they click on the map. Requested // convenience. if(gAgent.isGodlike()) { childSetValue("spin z", LLSD(200.f)); } // Don't re-request info if we already have it or we won't have it in time to teleport if (mTrackedStatus != LLTracker::TRACKING_AVATAR || name != mTrackedAvatarName) { mTrackedStatus = LLTracker::TRACKING_AVATAR; mTrackedAvatarName = name; LLTracker::trackAvatar(avatar_id, name); } } else { LLTracker::stopTracking(NULL); } setDefaultBtn("Teleport"); }
//----------------------------------------------------------------------------- // postBuild() //----------------------------------------------------------------------------- BOOL LLFloaterImagePreview::postBuild() { if (!LLFloaterNameDesc::postBuild()) { return FALSE; } LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); if (iface) { iface->selectFirstItem(); } childSetCommitCallback("clothing_type_combo", onPreviewTypeCommit, this); mPreviewRect.set(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD, getRect().getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f); getChildView("bad_image_text")->setVisible(FALSE); if (mRawImagep.notNull() && gAgent.getRegion() != NULL) { mAvatarPreview = new LLImagePreviewAvatar(256, 256); mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, FALSE); mSculptedPreview = new LLImagePreviewSculpted(256, 256); mSculptedPreview->setPreviewTarget(mRawImagep, 2.0f); if (mRawImagep->getWidth() * mRawImagep->getHeight () <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF) getChildView("lossless_check")->setEnabled(TRUE); // <FS:CR> Temporary texture uploads if (LLGlobalEconomy::Singleton::getInstance()->getPriceUpload() == 0 || gAgent.getRegion()->getCentralBakeVersion() > 0) { gSavedSettings.setBOOL("TemporaryUpload", FALSE); getChild<LLCheckBoxCtrl>("temp_check")->setVisible(FALSE); } // </FS:CR> } else { mAvatarPreview = NULL; mSculptedPreview = NULL; getChildView("bad_image_text")->setVisible(TRUE); getChildView("clothing_type_combo")->setEnabled(FALSE); getChildView("ok_btn")->setEnabled(FALSE); if(!mImageLoadError.empty()) { getChild<LLUICtrl>("bad_image_text")->setValue(mImageLoadError.c_str()); } } getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); return TRUE; }
//----------------------------------------------------------------------------- // postBuild() //----------------------------------------------------------------------------- BOOL LLFloaterImagePreview::postBuild() { if (!LLFloaterNameDesc::postBuild()) { return FALSE; } childSetLabelArg("ok_btn", "[UPLOADFEE]", gHippoGridManager->getConnectedGrid()->getUploadFee()); childSetAction("ok_btn", onBtnOK, this); LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); if (iface) { iface->selectFirstItem(); } childSetCommitCallback("clothing_type_combo", onPreviewTypeCommit, this); mPreviewRect.set(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT, getRect().getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f); childHide("bad_image_text"); if (mRawImagep.notNull() && gAgent.getRegion() != NULL) { mAvatarPreview = new LLImagePreviewAvatar(256, 256); mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, FALSE); mSculptedPreview = new LLImagePreviewSculpted(256, 256); mSculptedPreview->setPreviewTarget(mRawImagep, 2.0f); if (mRawImagep->getWidth() * mRawImagep->getHeight () <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF) childEnable("lossless_check"); // <edit> gSavedSettings.setBOOL("TemporaryUpload",FALSE); childSetValue("temp_check",FALSE); // </edit> } else { mAvatarPreview = NULL; mSculptedPreview = NULL; childShow("bad_image_text"); childDisable("clothing_type_combo"); childDisable("ok_btn"); } return TRUE; }
// public void LLFloaterLandHoldings::refresh() { LLCtrlSelectionInterface *list = childGetSelectionInterface("parcel list"); BOOL enable_btns = FALSE; if (list && list->getFirstSelectedIndex()> -1) { enable_btns = TRUE; } childSetEnabled("Teleport", enable_btns); childSetEnabled("Show on Map", enable_btns); refreshAggregates(); }
void LLFloaterWorldMap::friendsChanged() { LLAvatarTracker& t = LLAvatarTracker::instance(); const LLUUID& avatar_id = t.getAvatarID(); buildAvatarIDList(); if(avatar_id.notNull()) { LLCtrlSelectionInterface *iface = childGetSelectionInterface("friend combo"); if(!iface || !iface->setCurrentByID(avatar_id) || !t.getBuddyInfo(avatar_id)->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION) || gAgent.isGodlike()) { LLTracker::stopTracking(NULL); } } }
void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id ) { LLCtrlSelectionInterface *iface = childGetSelectionInterface("landmark combo"); if (!iface) return; buildLandmarkIDLists(); BOOL found = FALSE; S32 idx; for (idx = 0; idx < mLandmarkItemIDList.count(); idx++) { if ( mLandmarkItemIDList.get(idx) == landmark_item_id) { found = TRUE; break; } } if (found && iface->setCurrentByID( landmark_item_id ) ) { LLUUID asset_id = mLandmarkAssetIDList.get( idx ); std::string name; LLComboBox* combo = getChild<LLComboBox>( "landmark combo"); if (combo) name = combo->getSimple(); mTrackedStatus = LLTracker::TRACKING_LANDMARK; LLTracker::trackLandmark(mLandmarkAssetIDList.get( idx ), // assetID mLandmarkItemIDList.get( idx ), // itemID name); // name if( asset_id != sHomeID ) { // start the download process gLandmarkList.getAsset( asset_id); } // We have to download both region info and landmark data, so set busy. JC // getWindow()->incBusyCount(); } else { LLTracker::stopTracking(NULL); } setDefaultBtn("Teleport"); }
//----------------------------------------------------------------------------- // postBuild() //----------------------------------------------------------------------------- BOOL LLFloaterSculptPreview::postBuild() { childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%d",sUploadAmount)); LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); if (iface) { iface->selectFirstItem(); } childSetCommitCallback("clothing_type_combo", onPreviewTypeCommit, this); mPreviewRect.set(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT, getRect().getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f); childHide("bad_image_text"); if (mRawImagep.notNull() && gAgent.getRegion() != NULL) { mAvatarPreview = new LLPreviewAvatar(256, 256); mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, FALSE); mSculptedPreview = new LLPreviewSculpted(256, 256); mSculptedPreview->setPreviewTarget(mRawImagep, 2.0f); if (mRawImagep->getWidth() * mRawImagep->getHeight () <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF) childEnable("lossless_check"); childSetValue("temp_check",FALSE); } else { mAvatarPreview = NULL; mSculptedPreview = NULL; childShow("bad_image_text"); childDisable("clothing_type_combo"); childDisable("ok_btn"); } return TRUE; }
void LLPanelFace::getState() { LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); if( objectp && objectp->getPCode() == LL_PCODE_VOLUME && objectp->permModify()) { BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced(); // only turn on auto-adjust button if there is a media renderer and the media is loaded getChildView("textbox autofix")->setEnabled(editable); getChildView("button align")->setEnabled(editable); //if ( LLMediaEngine::getInstance()->getMediaRenderer () ) // if ( LLMediaEngine::getInstance()->getMediaRenderer ()->isLoaded () ) // { // // //mLabelTexAutoFix->setEnabled ( editable ); // // //mBtnAutoFix->setEnabled ( editable ); // } S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME )) && (selected_count == 1); getChildView("copytextures")->setEnabled(single_volume && editable); getChildView("pastetextures")->setEnabled(editable); getChildView("textbox params")->setEnabled(single_volume && editable); getChildView("button apply")->setEnabled(editable); bool identical; LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control"); // Texture { LLUUID id; struct f1 : public LLSelectedTEGetFunctor<LLUUID> { LLUUID get(LLViewerObject* object, S32 te_index) { LLUUID id; LLViewerTexture* image = object->getTEImage(te_index); if (image) id = image->getID(); if (!id.isNull() && LLViewerMedia::textureHasMedia(id)) { LLTextureEntry *te = object->getTE(te_index); if (te) { LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID()) : NULL ; if(!tex) { tex = LLViewerFetchedTexture::sDefaultImagep; } if (tex) { id = tex->getID(); } } } return id; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id ); if(LLViewerMedia::textureHasMedia(id)) { getChildView("textbox autofix")->setEnabled(editable); getChildView("button align")->setEnabled(editable); } if (identical) { // All selected have the same texture if(texture_ctrl) { texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); } } else { if(texture_ctrl) { if( id.isNull() ) { // None selected texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( FALSE ); texture_ctrl->setImageAssetID( LLUUID::null ); } else { // Tentative: multiple selected with different textures texture_ctrl->setTentative( TRUE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); } } } } // planar align bool align_planar = false; bool identical_planar_aligned = false; bool is_planar = false; { LLCheckBoxCtrl* cb_planar_align = getChild<LLCheckBoxCtrl>("checkbox planar align"); align_planar = (cb_planar_align && cb_planar_align->get()); struct f1 : public LLSelectedTEGetFunctor<bool> { bool get(LLViewerObject* object, S32 face) { return (object->getTE(face)->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR); } } func; bool texgens_identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, is_planar ); bool enabled = (editable && texgens_identical && is_planar); childSetValue("checkbox planar align", align_planar && enabled); childSetEnabled("checkbox planar align", enabled); if (align_planar && enabled) { struct f2 : public LLSelectedTEGetFunctor<LLFace *> { LLFace* get(LLViewerObject* object, S32 te) { return (object->mDrawable) ? object->mDrawable->getFace(te): NULL; } } get_te_face_func; LLFace* last_face; LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_te_face_func, last_face); LLPanelFaceGetIsAlignedTEFunctor get_is_aligend_func(last_face); // this will determine if the texture param controls are tentative: identical_planar_aligned = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&get_is_aligend_func); } } // Texture scale { F32 scale_s = 1.f; struct f2 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->mScaleS; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_s ); identical = align_planar ? identical_planar_aligned : identical; getChild<LLUICtrl>("TexScaleU")->setValue(editable ? llabs(scale_s) : 0); getChild<LLUICtrl>("TexScaleU")->setTentative(LLSD((BOOL)(!identical))); getChildView("TexScaleU")->setEnabled(editable); getChild<LLUICtrl>("checkbox flip s")->setValue(LLSD((BOOL)(scale_s < 0 ? TRUE : FALSE ))); getChild<LLUICtrl>("checkbox flip s")->setTentative(LLSD((BOOL)((!identical) ? TRUE : FALSE ))); getChildView("checkbox flip s")->setEnabled(editable); } { F32 scale_t = 1.f; struct f3 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->mScaleT; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_t ); identical = align_planar ? identical_planar_aligned : identical; getChild<LLUICtrl>("TexScaleV")->setValue(llabs(editable ? llabs(scale_t) : 0)); getChild<LLUICtrl>("TexScaleV")->setTentative(LLSD((BOOL)(!identical))); getChildView("TexScaleV")->setEnabled(editable); getChild<LLUICtrl>("checkbox flip t")->setValue(LLSD((BOOL)(scale_t< 0 ? TRUE : FALSE ))); getChild<LLUICtrl>("checkbox flip t")->setTentative(LLSD((BOOL)((!identical) ? TRUE : FALSE ))); getChildView("checkbox flip t")->setEnabled(editable); } // Texture offset { getChildView("tex offset")->setEnabled(editable); F32 offset_s = 0.f; struct f4 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->mOffsetS; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, offset_s ); identical = align_planar ? identical_planar_aligned : identical; getChild<LLUICtrl>("TexOffsetU")->setValue(editable ? offset_s : 0); getChild<LLUICtrl>("TexOffsetU")->setTentative(!identical); getChildView("TexOffsetU")->setEnabled(editable); } { F32 offset_t = 0.f; struct f5 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->mOffsetT; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, offset_t ); identical = align_planar ? identical_planar_aligned : identical; getChild<LLUICtrl>("TexOffsetV")->setValue(editable ? offset_t : 0); getChild<LLUICtrl>("TexOffsetV")->setTentative(!identical); getChildView("TexOffsetV")->setEnabled(editable); } // Texture rotation { F32 rotation = 0.f; struct f6 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->mRotation; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, rotation ); identical = align_planar ? identical_planar_aligned : identical; getChild<LLUICtrl>("TexRot")->setValue(editable ? rotation * RAD_TO_DEG : 0); getChild<LLUICtrl>("TexRot")->setTentative(!identical); getChildView("TexRot")->setEnabled(editable); } // Color swatch LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); LLColor4 color = LLColor4::white; if(mColorSwatch) { struct f7 : public LLSelectedTEGetFunctor<LLColor4> { LLColor4 get(LLViewerObject* object, S32 face) { return object->getTE(face)->getColor(); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, color ); mColorSwatch->setOriginal(color); mColorSwatch->set(color, TRUE); mColorSwatch->setValid(editable); mColorSwatch->setEnabled( editable ); mColorSwatch->setCanApplyImmediately( editable ); } // Color transparency { getChildView("color trans")->setEnabled(editable); } F32 transparency = (1.f - color.mV[VALPHA]) * 100.f; { getChild<LLUICtrl>("ColorTrans")->setValue(editable ? transparency : 0); getChildView("ColorTrans")->setEnabled(editable); } { F32 glow = 0.f; struct f8 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->getGlow(); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, glow ); getChild<LLUICtrl>("glow")->setValue(glow); getChildView("glow")->setEnabled(editable); getChild<LLUICtrl>("glow")->setTentative(!identical); getChildView("glow label")->setEnabled(editable); } // Bump { F32 shinyf = 0.f; struct f9 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return (F32)(object->getTE(face)->getShiny()); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shinyf ); LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); if (combobox_shininess) { combobox_shininess->selectNthItem((S32)shinyf); } else { llwarns << "failed childGetSelectionInterface for 'combobox shininess'" << llendl; } getChildView("combobox shininess")->setEnabled(editable); getChild<LLUICtrl>("combobox shininess")->setTentative(!identical); getChildView("label shininess")->setEnabled(editable); } { F32 bumpf = 0.f; struct f10 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return (F32)(object->getTE(face)->getBumpmap()); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpf ); LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); if (combobox_bumpiness) { combobox_bumpiness->selectNthItem((S32)bumpf); } else { llwarns << "failed childGetSelectionInterface for 'combobox bumpiness'" << llendl; } getChildView("combobox bumpiness")->setEnabled(editable); getChild<LLUICtrl>("combobox bumpiness")->setTentative(!identical); getChildView("label bumpiness")->setEnabled(editable); } { F32 genf = 0.f; struct f11 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return (F32)(object->getTE(face)->getTexGen()); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, genf ); S32 selected_texgen = ((S32) genf) >> TEM_TEX_GEN_SHIFT; LLCtrlSelectionInterface* combobox_texgen = childGetSelectionInterface("combobox texgen"); if (combobox_texgen) { combobox_texgen->selectNthItem(selected_texgen); } else { llwarns << "failed childGetSelectionInterface for 'combobox texgen'" << llendl; } getChildView("combobox texgen")->setEnabled(editable); getChild<LLUICtrl>("combobox texgen")->setTentative(!identical); getChildView("tex gen")->setEnabled(editable); if (selected_texgen == 1) { getChild<LLUICtrl>("TexScaleU")->setValue(2.0f * getChild<LLUICtrl>("TexScaleU")->getValue().asReal() ); getChild<LLUICtrl>("TexScaleV")->setValue(2.0f * getChild<LLUICtrl>("TexScaleV")->getValue().asReal() ); // EXP-1507 (change label based on the mapping mode) getChild<LLUICtrl>("rpt")->setValue(getString("string repeats per meter")); } else if (selected_texgen == 0) // FIXME: should not be magic numbers { getChild<LLUICtrl>("rpt")->setValue(getString("string repeats per face")); } } { F32 fullbrightf = 0.f; struct f12 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return (F32)(object->getTE(face)->getFullbright()); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, fullbrightf ); getChild<LLUICtrl>("checkbox fullbright")->setValue((S32)fullbrightf); getChildView("checkbox fullbright")->setEnabled(editable); getChild<LLUICtrl>("checkbox fullbright")->setTentative(!identical); } // Repeats per meter label { getChildView("rpt")->setEnabled(editable); } // Repeats per meter { F32 repeats = 1.f; struct f13 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { U32 s_axis = VX; U32 t_axis = VY; // BUG: Only repeats along S axis // BUG: Only works for boxes. LLPrimitive::getTESTAxes(face, &s_axis, &t_axis); return object->getTE(face)->mScaleS / object->getScale().mV[s_axis]; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, repeats ); getChild<LLUICtrl>("rptctrl")->setValue(editable ? repeats : 0); getChild<LLUICtrl>("rptctrl")->setTentative(!identical); LLComboBox* mComboTexGen = getChild<LLComboBox>("combobox texgen"); if (mComboTexGen) { BOOL enabled = editable && (!mComboTexGen || mComboTexGen->getCurrentIndex() != 1); getChildView("rptctrl")->setEnabled(enabled); getChildView("button apply")->setEnabled(enabled); } } // Set variable values for numeric expressions LLCalc* calcp = LLCalc::getInstance(); calcp->setVar(LLCalc::TEX_U_SCALE, childGetValue("TexScaleU").asReal()); calcp->setVar(LLCalc::TEX_V_SCALE, childGetValue("TexScaleV").asReal()); calcp->setVar(LLCalc::TEX_U_OFFSET, childGetValue("TexOffsetU").asReal()); calcp->setVar(LLCalc::TEX_V_OFFSET, childGetValue("TexOffsetV").asReal()); calcp->setVar(LLCalc::TEX_ROTATION, childGetValue("TexRot").asReal()); calcp->setVar(LLCalc::TEX_TRANSPARENCY, childGetValue("ColorTrans").asReal()); calcp->setVar(LLCalc::TEX_GLOW, childGetValue("glow").asReal()); }
void LLPanelFace::getState() { LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); LLCalc* calcp = LLCalc::getInstance(); if( objectp && objectp->getPCode() == LL_PCODE_VOLUME && objectp->permModify()) { BOOL editable = objectp->permModify(); // only turn on auto-adjust button if there is a media renderer and the media is loaded childSetEnabled("textbox autofix",FALSE); //mLabelTexAutoFix->setEnabled ( FALSE ); childSetEnabled("button align",FALSE); //mBtnAutoFix->setEnabled ( FALSE ); //if ( LLMediaEngine::getInstance()->getMediaRenderer () ) // if ( LLMediaEngine::getInstance()->getMediaRenderer ()->isLoaded () ) // { // // //mLabelTexAutoFix->setEnabled ( editable ); // // //mBtnAutoFix->setEnabled ( editable ); // } childSetEnabled("button apply",editable); bool identical; LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control"); // Texture { LLUUID id; struct f1 : public LLSelectedTEGetFunctor<LLUUID> { LLUUID get(LLViewerObject* object, S32 te) { LLViewerImage* image = object->getTEImage(te); return image ? image->getID() : LLUUID::null; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id ); if (identical) { // All selected have the same texture if(texture_ctrl) { texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); } } else { if(texture_ctrl) { if( id.isNull() ) { // None selected texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( FALSE ); texture_ctrl->setImageAssetID( LLUUID::null ); } else { // Tentative: multiple selected with different textures texture_ctrl->setTentative( TRUE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); } } } if(LLViewerMedia::textureHasMedia(id)) { childSetEnabled("textbox autofix",editable); childSetEnabled("button align",editable); } } LLAggregatePermissions texture_perms; if(texture_ctrl) { // texture_ctrl->setValid( editable ); if (LLSelectMgr::getInstance()->selectGetAggregateTexturePermissions(texture_perms)) { BOOL can_copy = texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_EMPTY || texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_ALL; BOOL can_transfer = texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_EMPTY || texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_ALL; texture_ctrl->setCanApplyImmediately(can_copy && can_transfer); } else { // force it to "work" anyway, HACK HACK HACK -- MC //texture_ctrl->setCanApplyImmediately(FALSE); // Pretty confident this is the cause: llwarns << "Couldn't set a selected node to valid when processing ObjectProperties or ObjectPropertiesFamily, most likely because selection became screwed up sim-side. Unexpected behavior is probably occurring throughout the viewer right now" << llendl; } } // planar align bool align_planar = false; bool identical_planar_aligned = false; { LLCheckBoxCtrl* cb_planar_align = getChild<LLCheckBoxCtrl>("checkbox planar align"); align_planar = (cb_planar_align && cb_planar_align->get()); struct f1 : public LLSelectedTEGetFunctor<bool> { bool get(LLViewerObject* object, S32 face) { return (object->getTE(face)->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR); } } func; bool is_planar; bool texgens_identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, is_planar ); bool enabled = (editable && texgens_identical && is_planar); childSetValue("checkbox planar align", align_planar && enabled); childSetEnabled("checkbox planar align", enabled); if (align_planar && enabled) { struct f2 : public LLSelectedTEGetFunctor<LLFace *> { LLFace* get(LLViewerObject* object, S32 te) { return (object->mDrawable) ? object->mDrawable->getFace(te): NULL; } } get_te_face_func; LLFace* last_face; LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_te_face_func, last_face); LLPanelFaceGetIsAlignedTEFunctor get_is_aligend_func(last_face); // this will determine if the texture param controls are tentative: identical_planar_aligned = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&get_is_aligend_func); } } // Texture scale { childSetEnabled("tex scale",editable); //mLabelTexScale->setEnabled( editable ); F32 scale_s = 1.f; struct f2 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->mScaleS; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_s ); identical = align_planar ? identical_planar_aligned : identical; childSetValue("TexScaleU",editable ? llabs(scale_s) : 0); childSetTentative("TexScaleU",LLSD((BOOL)(!identical))); childSetEnabled("TexScaleU",editable); childSetValue("checkbox flip s",LLSD((BOOL)(scale_s < 0 ? TRUE : FALSE ))); childSetTentative("checkbox flip s",LLSD((BOOL)((!identical) ? TRUE : FALSE ))); childSetEnabled("checkbox flip s",editable); } { F32 scale_t = 1.f; struct f3 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->mScaleT; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_t ); identical = align_planar ? identical_planar_aligned : identical; childSetValue("TexScaleV",llabs(editable ? llabs(scale_t) : 0)); childSetTentative("TexScaleV",LLSD((BOOL)(!identical))); childSetEnabled("TexScaleV",editable); childSetValue("checkbox flip t",LLSD((BOOL)(scale_t< 0 ? TRUE : FALSE ))); childSetTentative("checkbox flip t",LLSD((BOOL)((!identical) ? TRUE : FALSE ))); childSetEnabled("checkbox flip t",editable); } // Texture offset { childSetEnabled("tex offset",editable); F32 offset_s = 0.f; struct f4 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->mOffsetS; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, offset_s ); identical = align_planar ? identical_planar_aligned : identical; childSetValue("TexOffsetU", editable ? offset_s : 0); childSetTentative("TexOffsetU",!identical); childSetEnabled("TexOffsetU",editable); } { F32 offset_t = 0.f; struct f5 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->mOffsetT; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, offset_t ); identical = align_planar ? identical_planar_aligned : identical; childSetValue("TexOffsetV", editable ? offset_t : 0); childSetTentative("TexOffsetV",!identical); childSetEnabled("TexOffsetV",editable); } // Texture rotation { childSetEnabled("tex rotate",editable); F32 rotation = 0.f; struct f6 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->mRotation; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, rotation ); identical = align_planar ? identical_planar_aligned : identical; childSetValue("TexRot", editable ? rotation * RAD_TO_DEG : 0); childSetTentative("TexRot",!identical); childSetEnabled("TexRot",editable); } // Color swatch LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); LLColor4 color = LLColor4::white; if(mColorSwatch) { struct f7 : public LLSelectedTEGetFunctor<LLColor4> { LLColor4 get(LLViewerObject* object, S32 face) { return object->getTE(face)->getColor(); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, color ); mColorSwatch->setOriginal(color); mColorSwatch->set(color, TRUE); mColorSwatch->setValid(editable); mColorSwatch->setEnabled( editable ); mColorSwatch->setCanApplyImmediately( editable ); } // Color transparency { childSetEnabled("color trans",editable); } F32 transparency = (1.f - color.mV[VALPHA]) * 100.f; { childSetValue("ColorTrans", editable ? transparency : 0); childSetEnabled("ColorTrans",editable); } { F32 glow = 0.f; struct f8 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->getGlow(); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, glow ); childSetValue("glow",glow); childSetEnabled("glow",editable); childSetTentative("glow",!identical); childSetEnabled("glow label",editable); } // Bump { F32 shinyf = 0.f; struct f9 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return (F32)(object->getTE(face)->getShiny()); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shinyf ); LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); if (combobox_shininess) { combobox_shininess->selectNthItem((S32)shinyf); } else { llwarns << "failed childGetSelectionInterface for 'combobox shininess'" << llendl; } childSetEnabled("combobox shininess",editable); childSetTentative("combobox shininess",!identical); childSetEnabled("label shininess",editable); } { F32 bumpf = 0.f; struct f10 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return (F32)(object->getTE(face)->getBumpmap()); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpf ); LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); if (combobox_bumpiness) { combobox_bumpiness->selectNthItem((S32)bumpf); } else { llwarns << "failed childGetSelectionInterface for 'combobox bumpiness'" << llendl; } childSetEnabled("combobox bumpiness",editable); childSetTentative("combobox bumpiness",!identical); childSetEnabled("label bumpiness",editable); } { F32 genf = 0.f; struct f11 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return (F32)(object->getTE(face)->getTexGen()); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, genf ); S32 selected_texgen = ((S32) genf) >> TEM_TEX_GEN_SHIFT; LLCtrlSelectionInterface* combobox_texgen = childGetSelectionInterface("combobox texgen"); if (combobox_texgen) { combobox_texgen->selectNthItem(selected_texgen); } else { llwarns << "failed childGetSelectionInterface for 'combobox texgen'" << llendl; } childSetEnabled("combobox texgen",editable); childSetTentative("combobox texgen",!identical); childSetEnabled("tex gen",editable); if (selected_texgen == 1) { childSetText("tex scale",getString("string repeats per meter")); childSetValue("TexScaleU", 2.0f * childGetValue("TexScaleU").asReal() ); childSetValue("TexScaleV", 2.0f * childGetValue("TexScaleV").asReal() ); } else { childSetText("tex scale",getString("string repeats per face")); } } { F32 fullbrightf = 0.f; struct f12 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return (F32)(object->getTE(face)->getFullbright()); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, fullbrightf ); childSetValue("checkbox fullbright",(S32)fullbrightf); childSetEnabled("checkbox fullbright",editable); childSetTentative("checkbox fullbright",!identical); } // Repeats per meter label { childSetEnabled("rpt",editable); } // Repeats per meter { F32 repeats = 1.f; struct f13 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { U32 s_axis = VX; U32 t_axis = VY; // BUG: Only repeats along S axis // BUG: Only works for boxes. LLPrimitive::getTESTAxes(face, &s_axis, &t_axis); return object->getTE(face)->mScaleS / object->getScale().mV[s_axis]; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, repeats ); childSetValue("rptctrl", editable ? repeats : 0); childSetTentative("rptctrl",!identical); LLComboBox* mComboTexGen = getChild<LLComboBox>("combobox texgen"); if (mComboTexGen) { BOOL enabled = editable && (!mComboTexGen || mComboTexGen->getCurrentIndex() != 1); childSetEnabled("rptctrl",enabled); childSetEnabled("button apply",enabled); } } childSetEnabled("texture_math_constants",true); // Set variable values for numeric expressions calcp->setVar(LLCalc::TEX_U_SCALE, childGetValue("TexScaleU").asReal()); calcp->setVar(LLCalc::TEX_V_SCALE, childGetValue("TexScaleV").asReal()); calcp->setVar(LLCalc::TEX_U_OFFSET, childGetValue("TexOffsetU").asReal()); calcp->setVar(LLCalc::TEX_V_OFFSET, childGetValue("TexOffsetV").asReal()); calcp->setVar(LLCalc::TEX_ROTATION, childGetValue("TexRot").asReal()); calcp->setVar(LLCalc::TEX_TRANSPARENCY, childGetValue("ColorTrans").asReal()); calcp->setVar(LLCalc::TEX_GLOW, childGetValue("glow").asReal()); }
void LLPanelFace::getState() { LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); if( objectp && objectp->getPCode() == LL_PCODE_VOLUME && objectp->permModify()) { BOOL editable = objectp->permModify(); // only turn on auto-adjust button if there is a media renderer and the media is loaded childSetEnabled("textbox autofix",FALSE); //mLabelTexAutoFix->setEnabled ( FALSE ); childSetEnabled("button align",FALSE); //mBtnAutoFix->setEnabled ( FALSE ); if(LLViewerMedia::hasMedia()) { childSetEnabled("textbox autofix",editable); childSetEnabled("button align",editable); } //if ( LLMediaEngine::getInstance()->getMediaRenderer () ) // if ( LLMediaEngine::getInstance()->getMediaRenderer ()->isLoaded () ) // { // // //mLabelTexAutoFix->setEnabled ( editable ); // // //mBtnAutoFix->setEnabled ( editable ); // } childSetEnabled("button apply",editable); bool identical; LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control"); // Texture { LLUUID id; struct f1 : public LLSelectedTEGetFunctor<LLUUID> { LLUUID get(LLViewerObject* object, S32 te) { LLViewerImage* image = object->getTEImage(te); return image ? image->getID() : LLUUID::null; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id ); if (identical) { // All selected have the same texture if(texture_ctrl) { texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); } } else { if(texture_ctrl) { if( id.isNull() ) { // None selected texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( FALSE ); texture_ctrl->setImageAssetID( LLUUID::null ); } else { // Tentative: multiple selected with different textures texture_ctrl->setTentative( TRUE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); } } } } LLAggregatePermissions texture_perms; if(texture_ctrl) { // texture_ctrl->setValid( editable ); if (LLSelectMgr::getInstance()->selectGetAggregateTexturePermissions(texture_perms)) { BOOL can_copy = texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_EMPTY || texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_ALL; BOOL can_transfer = texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_EMPTY || texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_ALL; texture_ctrl->setCanApplyImmediately(can_copy && can_transfer); } else { texture_ctrl->setCanApplyImmediately(FALSE); } } // Texture scale { childSetEnabled("tex scale",editable); //mLabelTexScale->setEnabled( editable ); F32 scale_s = 1.f; struct f2 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->mScaleS; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_s ); childSetValue("TexScaleU",editable ? llabs(scale_s) : 0); childSetTentative("TexScaleU",LLSD((BOOL)(!identical))); childSetEnabled("TexScaleU",editable); childSetValue("checkbox flip s",LLSD((BOOL)(scale_s < 0 ? TRUE : FALSE ))); childSetTentative("checkbox flip s",LLSD((BOOL)((!identical) ? TRUE : FALSE ))); childSetEnabled("checkbox flip s",editable); } { F32 scale_t = 1.f; struct f3 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->mScaleT; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_t ); childSetValue("TexScaleV",llabs(editable ? llabs(scale_t) : 0)); childSetTentative("TexScaleV",LLSD((BOOL)(!identical))); childSetEnabled("TexScaleV",editable); childSetValue("checkbox flip t",LLSD((BOOL)(scale_t< 0 ? TRUE : FALSE ))); childSetTentative("checkbox flip t",LLSD((BOOL)((!identical) ? TRUE : FALSE ))); childSetEnabled("checkbox flip t",editable); } // Texture offset { childSetEnabled("tex offset",editable); F32 offset_s = 0.f; struct f4 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->mOffsetS; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, offset_s ); childSetValue("TexOffsetU", editable ? offset_s : 0); childSetTentative("TexOffsetU",!identical); childSetEnabled("TexOffsetU",editable); } { F32 offset_t = 0.f; struct f5 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->mOffsetT; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, offset_t ); childSetValue("TexOffsetV", editable ? offset_t : 0); childSetTentative("TexOffsetV",!identical); childSetEnabled("TexOffsetV",editable); } // Texture rotation { childSetEnabled("tex rotate",editable); F32 rotation = 0.f; struct f6 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->mRotation; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, rotation ); childSetValue("TexRot", editable ? rotation * RAD_TO_DEG : 0); childSetTentative("TexRot",!identical); childSetEnabled("TexRot",editable); } // Color swatch LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); LLColor4 color = LLColor4::white; if(mColorSwatch) { struct f7 : public LLSelectedTEGetFunctor<LLColor4> { LLColor4 get(LLViewerObject* object, S32 face) { return object->getTE(face)->getColor(); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, color ); mColorSwatch->setOriginal(color); mColorSwatch->set(color, TRUE); mColorSwatch->setValid(editable); mColorSwatch->setEnabled( editable ); mColorSwatch->setCanApplyImmediately( editable ); } // Color transparency { childSetEnabled("color trans",editable); } F32 transparency = (1.f - color.mV[VALPHA]) * 100.f; { childSetValue("ColorTrans", editable ? transparency : 0); childSetEnabled("ColorTrans",editable); } { F32 glow = 0.f; struct f8 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return object->getTE(face)->getGlow(); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, glow ); childSetValue("glow",glow); childSetEnabled("glow",editable); childSetTentative("glow",!identical); childSetEnabled("glow label",editable); } // Bump { F32 shinyf = 0.f; struct f9 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return (F32)(object->getTE(face)->getShiny()); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shinyf ); LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); if (combobox_shininess) { combobox_shininess->selectNthItem((S32)shinyf); } else { llwarns << "failed childGetSelectionInterface for 'combobox shininess'" << llendl; } childSetEnabled("combobox shininess",editable); childSetTentative("combobox shininess",!identical); childSetEnabled("label shininess",editable); } { F32 bumpf = 0.f; struct f10 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return (F32)(object->getTE(face)->getBumpmap()); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpf ); LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); if (combobox_bumpiness) { combobox_bumpiness->selectNthItem((S32)bumpf); } else { llwarns << "failed childGetSelectionInterface for 'combobox bumpiness'" << llendl; } childSetEnabled("combobox bumpiness",editable); childSetTentative("combobox bumpiness",!identical); childSetEnabled("label bumpiness",editable); } { F32 genf = 0.f; struct f11 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return (F32)(object->getTE(face)->getTexGen()); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, genf ); S32 selected_texgen = ((S32) genf) >> TEM_TEX_GEN_SHIFT; LLCtrlSelectionInterface* combobox_texgen = childGetSelectionInterface("combobox texgen"); if (combobox_texgen) { combobox_texgen->selectNthItem(selected_texgen); } else { llwarns << "failed childGetSelectionInterface for 'combobox texgen'" << llendl; } childSetEnabled("combobox texgen",editable); childSetTentative("combobox texgen",!identical); childSetEnabled("tex gen",editable); if (selected_texgen == 1) { childSetText("tex scale",getString("string repeats per meter")); childSetValue("TexScaleU", 2.0f * childGetValue("TexScaleU").asReal() ); childSetValue("TexScaleV", 2.0f * childGetValue("TexScaleV").asReal() ); } else { childSetText("tex scale",getString("string repeats per face")); } } { F32 fullbrightf = 0.f; struct f12 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { return (F32)(object->getTE(face)->getFullbright()); } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, fullbrightf ); childSetValue("checkbox fullbright",(S32)fullbrightf); childSetEnabled("checkbox fullbright",editable); childSetTentative("checkbox fullbright",!identical); } // Repeats per meter label { childSetEnabled("rpt",editable); } // Repeats per meter { F32 repeats = 1.f; struct f13 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) { U32 s_axis = VX; U32 t_axis = VY; // BUG: Only repeats along S axis // BUG: Only works for boxes. LLPrimitive::getTESTAxes(face, &s_axis, &t_axis); return object->getTE(face)->mScaleS / object->getScale().mV[s_axis]; } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, repeats ); childSetValue("rptctrl", editable ? repeats : 0); childSetTentative("rptctrl",!identical); LLComboBox* mComboTexGen = getChild<LLComboBox>("combobox texgen"); if (mComboTexGen) { BOOL enabled = editable && (!mComboTexGen || mComboTexGen->getCurrentIndex() != 1); childSetEnabled("rptctrl",enabled); childSetEnabled("button apply",enabled); } } }
//----------------------------------------------------------------------------- // handleHover() //----------------------------------------------------------------------------- BOOL LLFloaterImagePreview::handleHover(S32 x, S32 y, MASK mask) { MASK local_mask = mask & ~MASK_ALT; if (mAvatarPreview && hasMouseCapture()) { if (local_mask == MASK_PAN) { // pan here LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); if (iface && iface->getFirstSelectedIndex() <= 0) { mPreviewImageRect.translate((F32)(x - mLastMouseX) * -0.005f * mPreviewImageRect.getWidth(), (F32)(y - mLastMouseY) * -0.005f * mPreviewImageRect.getHeight()); } else { mAvatarPreview->pan((F32)(x - mLastMouseX) * -0.005f, (F32)(y - mLastMouseY) * -0.005f); mSculptedPreview->pan((F32)(x - mLastMouseX) * -0.005f, (F32)(y - mLastMouseY) * -0.005f); } } else if (local_mask == MASK_ORBIT) { F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f; F32 pitch_radians = (F32)(y - mLastMouseY) * 0.02f; mAvatarPreview->rotate(yaw_radians, pitch_radians); mSculptedPreview->rotate(yaw_radians, pitch_radians); } else { LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); if (iface && iface->getFirstSelectedIndex() <= 0) { F32 zoom_amt = (F32)(y - mLastMouseY) * -0.002f; mPreviewImageRect.stretch(zoom_amt); } else { F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f; F32 zoom_amt = (F32)(y - mLastMouseY) * 0.02f; mAvatarPreview->rotate(yaw_radians, 0.f); mAvatarPreview->zoom(zoom_amt); mSculptedPreview->rotate(yaw_radians, 0.f); mSculptedPreview->zoom(zoom_amt); } } LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); if (iface && iface->getFirstSelectedIndex() <= 0) { if (mPreviewImageRect.getWidth() > 1.f) { mPreviewImageRect.stretch((1.f - mPreviewImageRect.getWidth()) * 0.5f); } else if (mPreviewImageRect.getWidth() < 0.1f) { mPreviewImageRect.stretch((0.1f - mPreviewImageRect.getWidth()) * 0.5f); } if (mPreviewImageRect.getHeight() > 1.f) { mPreviewImageRect.stretch((1.f - mPreviewImageRect.getHeight()) * 0.5f); } else if (mPreviewImageRect.getHeight() < 0.1f) { mPreviewImageRect.stretch((0.1f - mPreviewImageRect.getHeight()) * 0.5f); } if (mPreviewImageRect.mLeft < 0.f) { mPreviewImageRect.translate(-mPreviewImageRect.mLeft, 0.f); } else if (mPreviewImageRect.mRight > 1.f) { mPreviewImageRect.translate(1.f - mPreviewImageRect.mRight, 0.f); } if (mPreviewImageRect.mBottom < 0.f) { mPreviewImageRect.translate(0.f, -mPreviewImageRect.mBottom); } else if (mPreviewImageRect.mTop > 1.f) { mPreviewImageRect.translate(0.f, 1.f - mPreviewImageRect.mTop); } } else { mAvatarPreview->refresh(); mSculptedPreview->refresh(); } LLUI::setCursorPositionLocal(this, mLastMouseX, mLastMouseY); } if (!mPreviewRect.pointInRect(x, y) || !mAvatarPreview || !mSculptedPreview) { return LLFloater::handleHover(x, y, mask); } else if (local_mask == MASK_ORBIT) { gViewerWindow->setCursor(UI_CURSOR_TOOLCAMERA); } else if (local_mask == MASK_PAN) { gViewerWindow->setCursor(UI_CURSOR_TOOLPAN); } else { gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN); } return TRUE; }
//----------------------------------------------------------------------------- // draw() //----------------------------------------------------------------------------- void LLFloaterImagePreview::draw() { LLFloater::draw(); LLRect r = getRect(); if (mRawImagep.notNull()) { LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); U32 selected = 0; if (iface) selected = iface->getFirstSelectedIndex(); if (selected <= 0) { gl_rect_2d_checkerboard(mPreviewRect); LLGLDisable gls_alpha(GL_ALPHA_TEST); if(mImagep.notNull()) { gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mImagep->getTexName()); } else { mImagep = new LLImageGL(mRawImagep, FALSE) ; gGL.getTexUnit(0)->unbind(mImagep->getTarget()) ; gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mImagep->getTexName()); stop_glerror(); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); if (mAvatarPreview) { mAvatarPreview->setTexture(mImagep->getTexName()); mSculptedPreview->setTexture(mImagep->getTexName()); } } gGL.color3f(1.f, 1.f, 1.f); gGL.begin( LLRender::QUADS ); { gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mTop); gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mBottom); gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); gGL.texCoord2f(mPreviewImageRect.mRight, mPreviewImageRect.mBottom); gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); gGL.texCoord2f(mPreviewImageRect.mRight, mPreviewImageRect.mTop); gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); } gGL.end(); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); stop_glerror(); } else { if ((mAvatarPreview) && (mSculptedPreview)) { gGL.color3f(1.f, 1.f, 1.f); if (selected == 9) { gGL.getTexUnit(0)->bind(mSculptedPreview->getTexture()); } else { gGL.getTexUnit(0)->bind(mAvatarPreview->getTexture()); } gGL.begin( LLRender::QUADS ); { gGL.texCoord2f(0.f, 1.f); gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); gGL.texCoord2f(0.f, 0.f); gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); gGL.texCoord2f(1.f, 0.f); gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); gGL.texCoord2f(1.f, 1.f); gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); } gGL.end(); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } } } }