// color control callbacks void LLFloaterEditSky::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl) { LLWLParamManager::getInstance()->mAnimator.deactivate(); LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl); LLVector4 color_vec(swatch->get().mV); // Set intensity to maximum of the RGB values. color_vec.mV[3] = llmax(color_vec.mV[0], llmax(color_vec.mV[1], color_vec.mV[2])); // Multiply RGB values by the appropriate factor. F32 k = WL_CLOUD_SLIDER_SCALE; if (color_ctrl->isSunOrAmbientColor) { k = WL_SUN_AMBIENT_SLIDER_SCALE; } if (color_ctrl->isBlueHorizonOrDensity) { k = WL_BLUE_HORIZON_DENSITY_SCALE; } color_vec *= k; // intensity isn't affected by the multiplication // Apply the new RGBI value. *color_ctrl = color_vec; color_ctrl->update(LLWLParamManager::getInstance()->mCurParams); LLWLParamManager::getInstance()->propagateParameters(); }
// virtual void LLPanelVolume::clearCtrls() { LLPanel::clearCtrls(); childSetEnabled("select_single",false); childSetVisible("select_single",true); childSetEnabled("edit_object",false); childSetVisible("edit_object",false); childSetEnabled("Light Checkbox Ctrl",false); childSetEnabled("label color",false); childSetEnabled("label color",false); LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LightColorSwatch->setEnabled( FALSE ); LightColorSwatch->setValid( FALSE ); } childSetEnabled("Light Intensity",false); childSetEnabled("Light Radius",false); childSetEnabled("Light Falloff",false); childSetEnabled("Flexible1D Checkbox Ctrl",false); childSetEnabled("FlexNumSections",false); childSetEnabled("FlexGravity",false); childSetEnabled("FlexTension",false); childSetEnabled("FlexFriction",false); childSetEnabled("FlexWind",false); childSetEnabled("FlexForceX",false); childSetEnabled("FlexForceY",false); childSetEnabled("FlexForceZ",false); }
////////////////////////////////////////////////////////////////////////////// // called (infrequently) when the color changes so the subject of the swatch can be updated. void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op ) { LLColorSwatchCtrl* subject = ( LLColorSwatchCtrl* )data; if ( subject ) { LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)subject->mPickerHandle.get(); if (pickerp) { // move color across from selector to internal widget storage LLColor4 updatedColor ( pickerp->getCurR (), pickerp->getCurG (), pickerp->getCurB (), subject->mColor.mV[VALPHA] ); // keep current alpha subject->mColor = updatedColor; subject->setControlValue(updatedColor.getValue()); if (pick_op == COLOR_CANCEL && subject->mOnCancelCallback) { subject->mOnCancelCallback(subject, subject->mCallbackUserData); } else if (pick_op == COLOR_SELECT && subject->mOnSelectCallback) { subject->mOnSelectCallback(subject, subject->mCallbackUserData); } else { // just commit change subject->onCommit (); } } } }
void LLFloaterColorPicker::showUI () { setVisible ( TRUE ); setFocus ( TRUE ); openFloater(getKey()); // HACK: if system color picker is required - close the SL one we made and use default system dialog if ( gSavedSettings.getBOOL ( "UseDefaultColorPicker" ) ) { LLColorSwatchCtrl* swatch = getSwatch (); setVisible ( FALSE ); // code that will get switched in for default system color picker if ( swatch ) { LLColor4 curCol = swatch->get (); send_agent_pause(); getWindow()->dialogColorPicker( &curCol [ 0 ], &curCol [ 1 ], &curCol [ 2 ] ); send_agent_resume(); setOrigRgb ( curCol [ 0 ], curCol [ 1 ], curCol [ 2 ] ); setCurRgb( curCol [ 0 ], curCol [ 1 ], curCol [ 2 ] ); LLColorSwatchCtrl::onColorChanged ( swatch, LLColorSwatchCtrl::COLOR_CHANGE ); } closeFloater(); } }
void LLFloaterEnvSettings::onChangeWaterColor(LLUICtrl* ctrl, WaterColorControl* colorControl) { LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl); *colorControl = swatch->get(); colorControl->update(LLWaterParamManager::instance()->mCurParams); LLWaterParamManager::instance()->propagateParameters(); }
void LLFloaterWater::onWaterFogColorMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl) { LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl); *color_ctrl = swatch->get(); color_ctrl->update(LLWaterParamManager::getInstance()->mCurParams); LLWaterParamManager::getInstance()->propagateParameters(); }
void LLPanelVolume::onLightCancelColor(const LLSD& data) { LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LightColorSwatch->setColor(mLightSavedColor); } onLightSelectColor(data); }
void LLPanelFace::sendColor() { LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(!mColorSwatch)return; LLColor4 color = mColorSwatch->get(); LLSelectMgr::getInstance()->selectionSetColorOnly( color ); }
// static void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata ) { LLPanelVolume* self = (LLPanelVolume*) userdata; LLViewerObject* objectp = self->mObject; if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME)) { return; } LLVOVolume *volobjp = (LLVOVolume *)objectp; volobjp->setLightIntensity((F32)self->getChild<LLUICtrl>("Light Intensity")->getValue().asReal()); volobjp->setLightRadius((F32)self->getChild<LLUICtrl>("Light Radius")->getValue().asReal()); volobjp->setLightFalloff((F32)self->getChild<LLUICtrl>("Light Falloff")->getValue().asReal()); LLColorSwatchCtrl* LightColorSwatch = self->getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LLColor4 clr = LightColorSwatch->get(); volobjp->setLightColor(LLColor3(clr)); } LLTextureCtrl* LightTextureCtrl = self->getChild<LLTextureCtrl>("light texture control"); if(LightTextureCtrl) { LLUUID id = LightTextureCtrl->getImageAssetID(); if (id.notNull()) { if (!volobjp->isLightSpotlight()) { //this commit is making this a spot light, set UI to default params volobjp->setLightTextureID(id); LLVector3 spot_params = volobjp->getSpotLightParams(); self->getChild<LLUICtrl>("Light FOV")->setValue(spot_params.mV[0]); self->getChild<LLUICtrl>("Light Focus")->setValue(spot_params.mV[1]); self->getChild<LLUICtrl>("Light Ambiance")->setValue(spot_params.mV[2]); } else { //modifying existing params LLVector3 spot_params; spot_params.mV[0] = (F32) self->getChild<LLUICtrl>("Light FOV")->getValue().asReal(); spot_params.mV[1] = (F32) self->getChild<LLUICtrl>("Light Focus")->getValue().asReal(); spot_params.mV[2] = (F32) self->getChild<LLUICtrl>("Light Ambiance")->getValue().asReal(); volobjp->setSpotLightParams(spot_params); } } else if (volobjp->isLightSpotlight()) { //no longer a spot light volobjp->setLightTextureID(id); //self->getChildView("Light FOV")->setEnabled(FALSE); //self->getChildView("Light Focus")->setEnabled(FALSE); //self->getChildView("Light Ambiance")->setEnabled(FALSE); } } }
void LLPanelVolume::onLightCancelColor(LLUICtrl* ctrl, void* userdata) { LLPanelVolume* self = (LLPanelVolume*) userdata; LLColorSwatchCtrl* LightColorSwatch = self->getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LightColorSwatch->setColor(self->mLightSavedColor); } onLightSelectColor(NULL, userdata); }
void lggBeamMapFloater::onBackgroundChange(LLUICtrl* ctrl, void* userdata) { lggBeamMapFloater* self = (lggBeamMapFloater*)userdata; LLColorSwatchCtrl* cctrl = (LLColorSwatchCtrl*)ctrl; if(cctrl) { self->getChild<LLPanel>("beamshape_draw")->setBackgroundColor(cctrl->get()); } }
// virtual void LLPanelVolume::clearCtrls() { LLPanel::clearCtrls(); getChildView("select_single")->setEnabled(false); getChildView("select_single")->setVisible(true); getChildView("edit_object")->setEnabled(false); getChildView("edit_object")->setVisible(false); getChildView("Light Checkbox Ctrl")->setEnabled(false); getChildView("label color")->setEnabled(false); LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LightColorSwatch->setEnabled( FALSE ); LightColorSwatch->setValid( FALSE ); } childSetEnabled("label texture",false); LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control"); if(LightTextureCtrl) { LightTextureCtrl->setEnabled( FALSE ); LightTextureCtrl->setValid( FALSE ); } getChildView("Light Intensity")->setEnabled(false); getChildView("Light Radius")->setEnabled(false); getChildView("Light Falloff")->setEnabled(false); getChildView("Flexible1D Checkbox Ctrl")->setEnabled(false); getChildView("FlexNumSections")->setEnabled(false); getChildView("FlexGravity")->setEnabled(false); getChildView("FlexTension")->setEnabled(false); getChildView("FlexFriction")->setEnabled(false); getChildView("FlexWind")->setEnabled(false); getChildView("FlexForceX")->setEnabled(false); getChildView("FlexForceY")->setEnabled(false); getChildView("FlexForceZ")->setEnabled(false); #if MESH_ENABLED mSpinPhysicsGravity->setEnabled(FALSE); mSpinPhysicsFriction->setEnabled(FALSE); mSpinPhysicsDensity->setEnabled(FALSE); mSpinPhysicsRestitution->setEnabled(FALSE); #endif //MESH_ENABLED }
BOOL LLPanelVolume::postBuild() { // Flexible Objects Parameters { childSetCommitCallback("Flexible1D Checkbox Ctrl",onCommitIsFlexible,this); childSetCommitCallback("FlexNumSections",onCommitFlexible,this); childSetValidate("FlexNumSections",precommitValidate); childSetCommitCallback("FlexGravity",onCommitFlexible,this); childSetValidate("FlexGravity",precommitValidate); childSetCommitCallback("FlexFriction",onCommitFlexible,this); childSetValidate("FlexFriction",precommitValidate); childSetCommitCallback("FlexWind",onCommitFlexible,this); childSetValidate("FlexWind",precommitValidate); childSetCommitCallback("FlexTension",onCommitFlexible,this); childSetValidate("FlexTension",precommitValidate); childSetCommitCallback("FlexForceX",onCommitFlexible,this); childSetValidate("FlexForceX",precommitValidate); childSetCommitCallback("FlexForceY",onCommitFlexible,this); childSetValidate("FlexForceY",precommitValidate); childSetCommitCallback("FlexForceZ",onCommitFlexible,this); childSetValidate("FlexForceZ",precommitValidate); } // LIGHT Parameters { childSetCommitCallback("Light Checkbox Ctrl",onCommitIsLight,this); LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch){ LightColorSwatch->setOnCancelCallback(onLightCancelColor); LightColorSwatch->setOnSelectCallback(onLightSelectColor); childSetCommitCallback("colorswatch",onCommitLight,this); } childSetCommitCallback("Light Intensity",onCommitLight,this); childSetValidate("Light Intensity",precommitValidate); childSetCommitCallback("Light Radius",onCommitLight,this); childSetValidate("Light Radius",precommitValidate); childSetCommitCallback("Light Falloff",onCommitLight,this); childSetValidate("Light Falloff",precommitValidate); } // Start with everyone disabled clearCtrls(); return TRUE; }
void LLPanelVolume::onLightSelectColor(const LLSD& data) { LLViewerObject* objectp = mObject; if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME)) { return; } LLVOVolume *volobjp = (LLVOVolume *)objectp; LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LLColor4 clr = LightColorSwatch->get(); LLColor3 clr3( clr ); volobjp->setLightColor(clr3); mLightSavedColor = clr; } }
// static void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata ) { LLPanelVolume* self = (LLPanelVolume*) userdata; LLViewerObject* objectp = self->mObject; if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME)) { return; } LLVOVolume *volobjp = (LLVOVolume *)objectp; volobjp->setLightIntensity((F32)self->childGetValue("Light Intensity").asReal()); volobjp->setLightRadius((F32)self->childGetValue("Light Radius").asReal()); volobjp->setLightFalloff((F32)self->childGetValue("Light Falloff").asReal()); LLColorSwatchCtrl* LightColorSwatch = self->getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LLColor4 clr = LightColorSwatch->get(); volobjp->setLightColor(LLColor3(clr)); } }
BOOL mfdKeywordFloater::postBuild(void) { setCanMinimize(false); childSetAction("Meta7Keywords_save",onClickSave,this); childSetAction("Meta7Keywords_cancel",onClickCancel,this); childSetValue("Meta7Keywords_Alert",gSavedPerAccountSettings.getBOOL("Meta7KeywordOn")); childSetValue("Meta7Keywords_Entries",gSavedPerAccountSettings.getString("Meta7Keywords")); childSetValue("Meta7Keywords_IM",gSavedPerAccountSettings.getBOOL("Meta7KeywordInIM")); childSetValue("Meta7Keywords_GroupChat",gSavedPerAccountSettings.getBOOL("Meta7KeywordInGroup")); childSetValue("Meta7Keywords_LocalChat",gSavedPerAccountSettings.getBOOL("Meta7KeywordInChat")); childSetValue("Meta7Keywords_IRC",gSavedPerAccountSettings.getBOOL("Meta7KeywordInIRC")); childSetValue("Meta7Keywords_Highlight",gSavedPerAccountSettings.getBOOL("Meta7KeywordChangeColor")); //childSetValue("Meta7Keywords_Color",gSavedPerAccountSettings.getLLSD("Meta7KeywordColor")); childSetValue("Meta7Keywords_PlaySound",gSavedPerAccountSettings.getBOOL("Meta7KeywordPlaySound")); childSetValue("Meta7Keywords_SoundUUID",gSavedPerAccountSettings.getString("Meta7KeywordSound")); LLColorSwatchCtrl* colorctrl = getChild<LLColorSwatchCtrl>("Meta7Keywords_Color"); colorctrl->set(LLColor4(gSavedPerAccountSettings.getColor4("Meta7KeywordColor")),TRUE); return true; }
BOOL LLPanelFace::postBuild() { childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this); childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this); childSetCommitCallback("TexScaleU",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("checkbox flip s",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexScaleV",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("checkbox flip t",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexRot",&LLPanelFace::onCommitTextureInfo, this); childSetAction("button apply",&LLPanelFace::onClickApply,this); childSetCommitCallback("checkbox planar align",&LLPanelFace::onCommitPlanarAlign, this); childSetCommitCallback("TexOffsetU",LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexOffsetV",LLPanelFace::onCommitTextureInfo, this); childSetAction("button align",&LLPanelFace::onClickAutoFix,this); childSetAction("copytextures",&LLPanelFace::onClickCopy,this); childSetAction("pastetextures",&LLPanelFace::onClickPaste,this); LLRect rect = this->getRect(); LLTextureCtrl* mTextureCtrl; LLColorSwatchCtrl* mColorSwatch; LLComboBox* mComboTexGen; LLCheckBoxCtrl *mCheckFullbright; LLTextBox* mLabelColorTransp; LLSpinCtrl* mCtrlColorTransp; // transparency = 1 - alpha LLSpinCtrl* mCtrlGlow; setMouseOpaque(FALSE); mTextureCtrl = getChild<LLTextureCtrl>("texture control"); if(mTextureCtrl) { mTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); mTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitTexture, this, _2) ); mTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelTexture, this, _2) ); mTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectTexture, this, _2) ); mTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); mTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); mTextureCtrl->setFollowsTop(); mTextureCtrl->setFollowsLeft(); mTextureCtrl->setImmediateFilterPermMask(PERM_NONE); mTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); } mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(mColorSwatch) { mColorSwatch->setCommitCallback(boost::bind(&LLPanelFace::onCommitColor, this, _2)); mColorSwatch->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelColor, this, _2)); mColorSwatch->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectColor, this, _2)); mColorSwatch->setFollowsTop(); mColorSwatch->setFollowsLeft(); mColorSwatch->setCanApplyImmediately(TRUE); } mLabelColorTransp = getChild<LLTextBox>("color trans"); if(mLabelColorTransp) { mLabelColorTransp->setFollowsTop(); mLabelColorTransp->setFollowsLeft(); } mCtrlColorTransp = getChild<LLSpinCtrl>("ColorTrans"); if(mCtrlColorTransp) { mCtrlColorTransp->setCommitCallback(boost::bind(&LLPanelFace::onCommitAlpha, this, _2)); mCtrlColorTransp->setPrecision(0); mCtrlColorTransp->setFollowsTop(); mCtrlColorTransp->setFollowsLeft(); } mCheckFullbright = getChild<LLCheckBoxCtrl>("checkbox fullbright"); if (mCheckFullbright) { mCheckFullbright->setCommitCallback(LLPanelFace::onCommitFullbright, this); } mComboTexGen = getChild<LLComboBox>("combobox texgen"); if(mComboTexGen) { mComboTexGen->setCommitCallback(LLPanelFace::onCommitTexGen, this); mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } mCtrlGlow = getChild<LLSpinCtrl>("glow"); if(mCtrlGlow) { mCtrlGlow->setCommitCallback(LLPanelFace::onCommitGlow, this); } clearCtrls(); 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()); }
BOOL LLPanelVolume::postBuild() { // Flexible Objects Parameters { childSetCommitCallback("Flexible1D Checkbox Ctrl",onCommitIsFlexible,this); childSetCommitCallback("FlexNumSections",onCommitFlexible,this); getChild<LLUICtrl>("FlexNumSections")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexGravity",onCommitFlexible,this); getChild<LLUICtrl>("FlexGravity")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexFriction",onCommitFlexible,this); getChild<LLUICtrl>("FlexFriction")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexWind",onCommitFlexible,this); getChild<LLUICtrl>("FlexWind")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexTension",onCommitFlexible,this); getChild<LLUICtrl>("FlexTension")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexForceX",onCommitFlexible,this); getChild<LLUICtrl>("FlexForceX")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexForceY",onCommitFlexible,this); getChild<LLUICtrl>("FlexForceY")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexForceZ",onCommitFlexible,this); getChild<LLUICtrl>("FlexForceZ")->setValidateBeforeCommit(precommitValidate); } // LIGHT Parameters { childSetCommitCallback("Light Checkbox Ctrl",onCommitIsLight,this); LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LightColorSwatch->setOnCancelCallback(boost::bind(&LLPanelVolume::onLightCancelColor, this, _2)); LightColorSwatch->setOnSelectCallback(boost::bind(&LLPanelVolume::onLightSelectColor, this, _2)); childSetCommitCallback("colorswatch",onCommitLight,this); } LLTextureCtrl* LightTexPicker = getChild<LLTextureCtrl>("light texture control"); if (LightTexPicker) { LightTexPicker->setOnCancelCallback(boost::bind(&LLPanelVolume::onLightCancelTexture, this, _2)); LightTexPicker->setOnSelectCallback(boost::bind(&LLPanelVolume::onLightSelectTexture, this, _2)); childSetCommitCallback("light texture control", onCommitLight, this); } childSetCommitCallback("Light Intensity",onCommitLight,this); getChild<LLUICtrl>("Light Intensity")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("Light Radius",onCommitLight,this); getChild<LLUICtrl>("Light Radius")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("Light Falloff",onCommitLight,this); getChild<LLUICtrl>("Light Falloff")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("Light FOV", onCommitLight, this); getChild<LLUICtrl>("Light FOV")->setValidateBeforeCommit( precommitValidate); childSetCommitCallback("Light Focus", onCommitLight, this); getChild<LLUICtrl>("Light Focus")->setValidateBeforeCommit( precommitValidate); childSetCommitCallback("Light Ambiance", onCommitLight, this); getChild<LLUICtrl>("Light Ambiance")->setValidateBeforeCommit( precommitValidate); } // PHYSICS Parameters { // PhysicsShapeType combobox mComboPhysicsShapeType = getChild<LLComboBox>("Physics Shape Type Combo Ctrl"); mComboPhysicsShapeType->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsShapeType, this, _1, mComboPhysicsShapeType)); // PhysicsGravity mSpinPhysicsGravity = getChild<LLSpinCtrl>("Physics Gravity"); mSpinPhysicsGravity->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsGravity, this, _1, mSpinPhysicsGravity)); // PhysicsFriction mSpinPhysicsFriction = getChild<LLSpinCtrl>("Physics Friction"); mSpinPhysicsFriction->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsFriction, this, _1, mSpinPhysicsFriction)); // PhysicsDensity mSpinPhysicsDensity = getChild<LLSpinCtrl>("Physics Density"); mSpinPhysicsDensity->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsDensity, this, _1, mSpinPhysicsDensity)); // PhysicsRestitution mSpinPhysicsRestitution = getChild<LLSpinCtrl>("Physics Restitution"); mSpinPhysicsRestitution->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsRestitution, this, _1, mSpinPhysicsRestitution)); } std::map<std::string, std::string> material_name_map; material_name_map["Stone"]= LLTrans::getString("Stone"); material_name_map["Metal"]= LLTrans::getString("Metal"); material_name_map["Glass"]= LLTrans::getString("Glass"); material_name_map["Wood"]= LLTrans::getString("Wood"); material_name_map["Flesh"]= LLTrans::getString("Flesh"); material_name_map["Plastic"]= LLTrans::getString("Plastic"); material_name_map["Rubber"]= LLTrans::getString("Rubber"); material_name_map["Light"]= LLTrans::getString("Light"); LLMaterialTable::basic.initTableTransNames(material_name_map); // material type popup mComboMaterial = getChild<LLComboBox>("material"); childSetCommitCallback("material",onCommitMaterial,this); mComboMaterial->removeall(); for (LLMaterialTable::info_list_t::iterator iter = LLMaterialTable::basic.mMaterialInfoList.begin(); iter != LLMaterialTable::basic.mMaterialInfoList.end(); ++iter) { LLMaterialInfo* minfop = *iter; if (minfop->mMCode != LL_MCODE_LIGHT) { mComboMaterial->add(minfop->mName); } } mComboMaterialItemCount = mComboMaterial->getItemCount(); // Start with everyone disabled clearCtrls(); return TRUE; }
void LLFloaterWater::syncMenu() { bool err; LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); LLWaterParamSet & current_params = param_mgr->mCurParams; LLComboBox* comboBox = getChild<LLComboBox>("WaterPresetsCombo"); if (comboBox->getSelectedItemLabel() != current_params.mName) { comboBox->setSimple(current_params.mName); } // blue horizon param_mgr->mFogColor = current_params.getVector4(param_mgr->mFogColor.mName, err); LLColor4 col = param_mgr->getFogColor(); childSetValue("WaterGlow", col.mV[3]); col.mV[3] = 1.0f; LLColorSwatchCtrl* colCtrl = sWaterMenu->getChild<LLColorSwatchCtrl>("WaterFogColor"); colCtrl->set(col); // fog and wavelets param_mgr->mFogDensity.mExp = log(current_params.getFloat(param_mgr->mFogDensity.mName, err)) / log(param_mgr->mFogDensity.mBase); param_mgr->setDensitySliderValue(param_mgr->mFogDensity.mExp); childSetValue("WaterFogDensity", param_mgr->mFogDensity.mExp); param_mgr->mUnderWaterFogMod.mX = current_params.getFloat(param_mgr->mUnderWaterFogMod.mName, err); childSetValue("WaterUnderWaterFogMod", param_mgr->mUnderWaterFogMod.mX); param_mgr->mNormalScale = current_params.getVector3(param_mgr->mNormalScale.mName, err); childSetValue("WaterNormalScaleX", param_mgr->mNormalScale.mX); childSetValue("WaterNormalScaleY", param_mgr->mNormalScale.mY); childSetValue("WaterNormalScaleZ", param_mgr->mNormalScale.mZ); // Fresnel param_mgr->mFresnelScale.mX = current_params.getFloat(param_mgr->mFresnelScale.mName, err); childSetValue("WaterFresnelScale", param_mgr->mFresnelScale.mX); param_mgr->mFresnelOffset.mX = current_params.getFloat(param_mgr->mFresnelOffset.mName, err); childSetValue("WaterFresnelOffset", param_mgr->mFresnelOffset.mX); // Scale Above/Below param_mgr->mScaleAbove.mX = current_params.getFloat(param_mgr->mScaleAbove.mName, err); childSetValue("WaterScaleAbove", param_mgr->mScaleAbove.mX); param_mgr->mScaleBelow.mX = current_params.getFloat(param_mgr->mScaleBelow.mName, err); childSetValue("WaterScaleBelow", param_mgr->mScaleBelow.mX); // blur mult param_mgr->mBlurMultiplier.mX = current_params.getFloat(param_mgr->mBlurMultiplier.mName, err); childSetValue("WaterBlurMult", param_mgr->mBlurMultiplier.mX); // wave directions param_mgr->mWave1Dir = current_params.getVector2(param_mgr->mWave1Dir.mName, err); childSetValue("WaterWave1DirX", param_mgr->mWave1Dir.mX); childSetValue("WaterWave1DirY", param_mgr->mWave1Dir.mY); param_mgr->mWave2Dir = current_params.getVector2(param_mgr->mWave2Dir.mName, err); childSetValue("WaterWave2DirX", param_mgr->mWave2Dir.mX); childSetValue("WaterWave2DirY", param_mgr->mWave2Dir.mY); LLTextureCtrl* textCtrl = sWaterMenu->getChild<LLTextureCtrl>("WaterNormalMap"); textCtrl->setImageAssetID(param_mgr->getNormalMapID()); }
BOOL LLPanelFace::postBuild() { LLRect rect = this->getRect(); LLTextureCtrl* mTextureCtrl; LLColorSwatchCtrl* mColorSwatch; LLComboBox* mComboTexGen; LLCheckBoxCtrl *mCheckFullbright; LLTextBox* mLabelColorTransp; LLSpinCtrl* mCtrlColorTransp; // transparency = 1 - alpha LLSpinCtrl* mCtrlGlow; setMouseOpaque(FALSE); mTextureCtrl = getChild<LLTextureCtrl>("texture control"); if(mTextureCtrl) { mTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); mTextureCtrl->setCommitCallback( LLPanelFace::onCommitTexture ); mTextureCtrl->setOnCancelCallback( LLPanelFace::onCancelTexture ); mTextureCtrl->setOnSelectCallback( LLPanelFace::onSelectTexture ); mTextureCtrl->setDragCallback(LLPanelFace::onDragTexture); mTextureCtrl->setCallbackUserData( this ); mTextureCtrl->setFollowsTop(); mTextureCtrl->setFollowsLeft(); // Don't allow (no copy) or (no transfer) textures to be selected during immediate mode mTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); // Allow any texture to be used during non-immediate mode. mTextureCtrl->setNonImmediateFilterPermMask(PERM_NONE); LLAggregatePermissions texture_perms; 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; mTextureCtrl->setCanApplyImmediately(can_copy && can_transfer); } else { mTextureCtrl->setCanApplyImmediately(FALSE); } } mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(mColorSwatch) { mColorSwatch->setCommitCallback(LLPanelFace::onCommitColor); mColorSwatch->setOnCancelCallback(LLPanelFace::onCancelColor); mColorSwatch->setOnSelectCallback(LLPanelFace::onSelectColor); mColorSwatch->setCallbackUserData( this ); mColorSwatch->setFollowsTop(); mColorSwatch->setFollowsLeft(); mColorSwatch->setCanApplyImmediately(TRUE); } mLabelColorTransp = getChild<LLTextBox>("color trans"); if(mLabelColorTransp) { mLabelColorTransp->setFollowsTop(); mLabelColorTransp->setFollowsLeft(); } mCtrlColorTransp = getChild<LLSpinCtrl>("ColorTrans"); if(mCtrlColorTransp) { mCtrlColorTransp->setCommitCallback(LLPanelFace::onCommitAlpha); mCtrlColorTransp->setCallbackUserData(this); mCtrlColorTransp->setPrecision(0); mCtrlColorTransp->setFollowsTop(); mCtrlColorTransp->setFollowsLeft(); } mCheckFullbright = getChild<LLCheckBoxCtrl>("checkbox fullbright"); if (mCheckFullbright) { mCheckFullbright->setCommitCallback(LLPanelFace::onCommitFullbright); mCheckFullbright->setCallbackUserData( this ); } mComboTexGen = getChild<LLComboBox>("combobox texgen"); if(mComboTexGen) { mComboTexGen->setCommitCallback(LLPanelFace::onCommitTexGen); mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); mComboTexGen->setCallbackUserData( this ); } mCtrlGlow = getChild<LLSpinCtrl>("glow"); if(mCtrlGlow) { mCtrlGlow->setCommitCallback(LLPanelFace::onCommitGlow); mCtrlGlow->setCallbackUserData(this); } childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this); childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this); childSetCommitCallback("checkbox planar align",&LLPanelFace::onCommitPlanarAlign, this); childSetCommitCallback("TexScaleU",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("checkbox flip s",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexScaleV",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("checkbox flip t",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexRot",&LLPanelFace::onCommitTextureInfo, this); childSetAction("button apply",&onClickApply,this); childSetCommitCallback("TexOffsetU",LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexOffsetV",LLPanelFace::onCommitTextureInfo, this); childSetAction("button align",onClickAutoFix,this); childSetAction("texture_math_constants",onClickTextureConstants,this); clearCtrls(); return TRUE; }
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()); }
// Update controls based on current settings void LLPrefsAscentChat::refresh() { //Chat -------------------------------------------------------------------------------- // time format combobox LLComboBox* combo = getChild<LLComboBox>("time_format_combobox"); if (combo) { combo->setCurrentByIndex(mTimeFormat); } // date format combobox combo = getChild<LLComboBox>("date_format_combobox"); if (combo) { combo->setCurrentByIndex(mDateFormat); } childSetValue("AscentInstantMessageResponseAnyone", mIMResponseAnyone); childSetValue("AscentInstantMessageResponseFriends", mIMResponseFriends); childSetValue("AscentInstantMessageResponseMuted", mIMResponseMuted); childSetValue("AscentInstantMessageShowOnTyping", mIMShowOnTyping); childSetValue("AscentInstantMessageShowResponded", mIMShowResponded); childSetValue("AscentInstantMessageResponseRepeat", mIMResponseRepeat); childSetValue("AscentInstantMessageResponseItem", mIMResponseItem); LLWString auto_response = utf8str_to_wstring( gSavedPerAccountSettings.getString("AscentInstantMessageResponse") ); LLWStringUtil::replaceChar(auto_response, '^', '\n'); LLWStringUtil::replaceChar(auto_response, '%', ' '); childSetText("im_response", wstring_to_utf8str(auto_response)); //Text Options ------------------------------------------------------------------------ combo = getChild<LLComboBox>("SpellBase"); if (combo != NULL) { combo->removeall(); std::vector<std::string> names = glggHunSpell->getDicts(); for (int i = 0; i < (int)names.size(); i++) { combo->add(names[i]); } combo->setSimple(gSavedSettings.getString("SpellBase")); } combo = getChild<LLComboBox>("EmSpell_Avail"); if (combo != NULL) { combo->removeall(); combo->add(""); std::vector<std::string> names = glggHunSpell->getAvailDicts(); for (int i = 0; i < (int)names.size(); i++) { combo->add(names[i]); } combo->setSimple(std::string("")); } combo = getChild<LLComboBox>("EmSpell_Installed"); if (combo != NULL) { combo->removeall(); combo->add(""); std::vector<std::string> names = glggHunSpell->getInstalledDicts(); for (int i = 0; i < (int)names.size(); i++) { combo->add(names[i]); } combo->setSimple(std::string("")); } childSetEnabled("KeywordsList", mKeywordsOn); childSetEnabled("KeywordsInChat", mKeywordsOn); childSetEnabled("KeywordsInIM", mKeywordsOn); childSetEnabled("KeywordsChangeColor", mKeywordsOn); childSetEnabled("KeywordsColor", mKeywordsOn); childSetEnabled("KeywordsPlaySound", mKeywordsOn); childSetEnabled("KeywordsSound", mKeywordsOn); childSetValue("KeywordsOn", mKeywordsOn); childSetValue("KeywordsList", mKeywordsList); childSetValue("KeywordsInChat", mKeywordsInChat); childSetValue("KeywordsInIM", mKeywordsInIM); childSetValue("KeywordsChangeColor", mKeywordsChangeColor); LLColorSwatchCtrl* colorctrl = getChild<LLColorSwatchCtrl>("KeywordsColor"); colorctrl->set(LLColor4(mKeywordsColor),TRUE); childSetValue("KeywordsPlaySound", mKeywordsPlaySound); childSetValue("KeywordsSound", mKeywordsSound); }
BOOL LLPanelVolume::postBuild() { // Flexible Objects Parameters { getChild<LLCheckboxCtrl>("Flexible1D Checkbox Ctrl")->setCommitCallback(boost::bind(&LLPanelVolume::onCommitIsFlexible, this, _1, _2), NULL); childSetCommitCallback("FlexNumSections",onCommitFlexible,this); getChild<LLUICtrl>("FlexNumSections")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexGravity",onCommitFlexible,this); getChild<LLUICtrl>("FlexGravity")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexFriction",onCommitFlexible,this); getChild<LLUICtrl>("FlexFriction")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexWind",onCommitFlexible,this); getChild<LLUICtrl>("FlexWind")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexTension",onCommitFlexible,this); getChild<LLUICtrl>("FlexTension")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexForceX",onCommitFlexible,this); getChild<LLUICtrl>("FlexForceX")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexForceY",onCommitFlexible,this); getChild<LLUICtrl>("FlexForceY")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexForceZ",onCommitFlexible,this); getChild<LLUICtrl>("FlexForceZ")->setValidateBeforeCommit(precommitValidate); } // LIGHT Parameters { childSetCommitCallback("Light Checkbox Ctrl",onCommitIsLight,this); LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch){ LightColorSwatch->setOnCancelCallback(onLightCancelColor); LightColorSwatch->setOnSelectCallback(onLightSelectColor); childSetCommitCallback("colorswatch",onCommitLight,this); } LLTextureCtrl* LightTexPicker = getChild<LLTextureCtrl>("light texture control"); if (LightTexPicker) { LightTexPicker->setOnCancelCallback(onLightCancelTexture); LightTexPicker->setOnSelectCallback(onLightSelectTexture); childSetCommitCallback("light texture control", onCommitLight, this); } childSetCommitCallback("Light Intensity",onCommitLight,this); getChild<LLUICtrl>("Light Intensity")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("Light Radius",onCommitLight,this); getChild<LLUICtrl>("Light Radius")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("Light Falloff",onCommitLight,this); getChild<LLUICtrl>("Light Falloff")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("Light FOV", onCommitLight, this); getChild<LLUICtrl>("Light FOV")->setValidateBeforeCommit( precommitValidate); childSetCommitCallback("Light Focus", onCommitLight, this); getChild<LLUICtrl>("Light Focus")->setValidateBeforeCommit( precommitValidate); childSetCommitCallback("Light Ambiance", onCommitLight, this); getChild<LLUICtrl>("Light Ambiance")->setValidateBeforeCommit( precommitValidate); } // PHYSICS Parameters { // Label mComboPhysicsShapeLabel = getChild<LLTextBox>("label physicsshapetype"); // PhysicsShapeType combobox mComboPhysicsShapeType = getChild<LLComboBox>("Physics Shape Type Combo Ctrl"); mComboPhysicsShapeType->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsShapeType, this, _1, mComboPhysicsShapeType)); // PhysicsGravity mSpinPhysicsGravity = getChild<LLSpinCtrl>("Physics Gravity"); mSpinPhysicsGravity->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsGravity, this, _1, mSpinPhysicsGravity)); // PhysicsFriction mSpinPhysicsFriction = getChild<LLSpinCtrl>("Physics Friction"); mSpinPhysicsFriction->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsFriction, this, _1, mSpinPhysicsFriction)); // PhysicsDensity mSpinPhysicsDensity = getChild<LLSpinCtrl>("Physics Density"); mSpinPhysicsDensity->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsDensity, this, _1, mSpinPhysicsDensity)); // PhysicsRestitution mSpinPhysicsRestitution = getChild<LLSpinCtrl>("Physics Restitution"); mSpinPhysicsRestitution->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsRestitution, this, _1, mSpinPhysicsRestitution)); } std::map<std::string, std::string> material_name_map; material_name_map["Stone"]= LLTrans::getString("Stone"); material_name_map["Metal"]= LLTrans::getString("Metal"); material_name_map["Glass"]= LLTrans::getString("Glass"); material_name_map["Wood"]= LLTrans::getString("Wood"); material_name_map["Flesh"]= LLTrans::getString("Flesh"); material_name_map["Plastic"]= LLTrans::getString("Plastic"); material_name_map["Rubber"]= LLTrans::getString("Rubber"); material_name_map["Light"]= LLTrans::getString("Light"); LLMaterialTable::basic.initTableTransNames(material_name_map); // Start with everyone disabled clearCtrls(); return TRUE; }
void LLPanelVolume::getState( ) { LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(); LLViewerObject* root_objectp = objectp; if(!objectp) { objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); // *FIX: shouldn't we just keep the child? if (objectp) { LLViewerObject* parentp = objectp->getRootEdit(); if (parentp) { root_objectp = parentp; } else { root_objectp = objectp; } } } LLVOVolume *volobjp = NULL; if ( objectp && (objectp->getPCode() == LL_PCODE_VOLUME)) { volobjp = (LLVOVolume *)objectp; } if( !objectp ) { //forfeit focus if (gFocusMgr.childHasKeyboardFocus(this)) { gFocusMgr.setKeyboardFocus(NULL); } // Disable all text input fields clearCtrls(); return; } BOOL owners_identical; LLUUID owner_id; std::string owner_name; owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); // BUG? Check for all objects being editable? BOOL editable = root_objectp->permModify(); BOOL single_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ) && LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1; // Select Single Message if (single_volume) { getChildView("edit_object")->setVisible(true); getChildView("edit_object")->setEnabled(true); getChildView("select_single")->setVisible(false); } else { getChildView("edit_object")->setVisible(false); getChildView("select_single")->setVisible(true); getChildView("select_single")->setEnabled(true); } // Light properties BOOL is_light = volobjp && volobjp->getIsLight(); getChild<LLUICtrl>("Light Checkbox Ctrl")->setValue(is_light); getChildView("Light Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp); if (is_light && editable && single_volume) { getChildView("label color")->setEnabled(true); //mLabelColor ->setEnabled( TRUE ); LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LightColorSwatch->setEnabled( TRUE ); LightColorSwatch->setValid( TRUE ); LightColorSwatch->set(volobjp->getLightBaseColor()); } LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control"); if (LightTextureCtrl) { LightTextureCtrl->setEnabled(TRUE); LightTextureCtrl->setValid(TRUE); LightTextureCtrl->setImageAssetID(volobjp->getLightTextureID()); } getChildView("Light Intensity")->setEnabled(true); getChildView("Light Radius")->setEnabled(true); getChildView("Light Falloff")->setEnabled(true); getChildView("Light FOV")->setEnabled(true); getChildView("Light Focus")->setEnabled(true); getChildView("Light Ambiance")->setEnabled(true); getChild<LLUICtrl>("Light Intensity")->setValue(volobjp->getLightIntensity()); getChild<LLUICtrl>("Light Radius")->setValue(volobjp->getLightRadius()); getChild<LLUICtrl>("Light Falloff")->setValue(volobjp->getLightFalloff()); LLVector3 params = volobjp->getSpotLightParams(); getChild<LLUICtrl>("Light FOV")->setValue(params.mV[0]); getChild<LLUICtrl>("Light Focus")->setValue(params.mV[1]); getChild<LLUICtrl>("Light Ambiance")->setValue(params.mV[2]); mLightSavedColor = volobjp->getLightColor(); } else { getChild<LLSpinCtrl>("Light Intensity", true)->clear(); getChild<LLSpinCtrl>("Light Radius", true)->clear(); getChild<LLSpinCtrl>("Light Falloff", true)->clear(); getChildView("label color")->setEnabled(false); LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LightColorSwatch->setEnabled( FALSE ); LightColorSwatch->setValid( FALSE ); } LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control"); if (LightTextureCtrl) { LightTextureCtrl->setEnabled(FALSE); LightTextureCtrl->setValid(FALSE); } getChildView("Light Intensity")->setEnabled(false); getChildView("Light Radius")->setEnabled(false); getChildView("Light Falloff")->setEnabled(false); getChildView("Light FOV")->setEnabled(false); getChildView("Light Focus")->setEnabled(false); getChildView("Light Ambiance")->setEnabled(false); } // Flexible properties BOOL is_flexible = volobjp && volobjp->isFlexible(); getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->setValue(is_flexible); if (is_flexible || (volobjp && volobjp->canBeFlexible())) { getChildView("Flexible1D Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp); } else { getChildView("Flexible1D Checkbox Ctrl")->setEnabled(false); } if (is_flexible && editable && single_volume) { getChildView("FlexNumSections")->setVisible(true); getChildView("FlexGravity")->setVisible(true); getChildView("FlexTension")->setVisible(true); getChildView("FlexFriction")->setVisible(true); getChildView("FlexWind")->setVisible(true); getChildView("FlexForceX")->setVisible(true); getChildView("FlexForceY")->setVisible(true); getChildView("FlexForceZ")->setVisible(true); getChildView("FlexNumSections")->setEnabled(true); getChildView("FlexGravity")->setEnabled(true); getChildView("FlexTension")->setEnabled(true); getChildView("FlexFriction")->setEnabled(true); getChildView("FlexWind")->setEnabled(true); getChildView("FlexForceX")->setEnabled(true); getChildView("FlexForceY")->setEnabled(true); getChildView("FlexForceZ")->setEnabled(true); LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); getChild<LLUICtrl>("FlexNumSections")->setValue((F32)attributes->getSimulateLOD()); getChild<LLUICtrl>("FlexGravity")->setValue(attributes->getGravity()); getChild<LLUICtrl>("FlexTension")->setValue(attributes->getTension()); getChild<LLUICtrl>("FlexFriction")->setValue(attributes->getAirFriction()); getChild<LLUICtrl>("FlexWind")->setValue(attributes->getWindSensitivity()); getChild<LLUICtrl>("FlexForceX")->setValue(attributes->getUserForce().mV[VX]); getChild<LLUICtrl>("FlexForceY")->setValue(attributes->getUserForce().mV[VY]); getChild<LLUICtrl>("FlexForceZ")->setValue(attributes->getUserForce().mV[VZ]); } else { getChild<LLSpinCtrl>("FlexNumSections", true)->clear(); getChild<LLSpinCtrl>("FlexGravity", true)->clear(); getChild<LLSpinCtrl>("FlexTension", true)->clear(); getChild<LLSpinCtrl>("FlexFriction", true)->clear(); getChild<LLSpinCtrl>("FlexWind", true)->clear(); getChild<LLSpinCtrl>("FlexForceX", true)->clear(); getChild<LLSpinCtrl>("FlexForceY", true)->clear(); getChild<LLSpinCtrl>("FlexForceZ", true)->clear(); getChildView("FlexNumSections")->setEnabled(false); getChildView("FlexGravity")->setEnabled(false); getChildView("FlexTension")->setEnabled(false); getChildView("FlexFriction")->setEnabled(false); getChildView("FlexWind")->setEnabled(false); getChildView("FlexForceX")->setEnabled(false); getChildView("FlexForceY")->setEnabled(false); getChildView("FlexForceZ")->setEnabled(false); } mObject = objectp; mRootObject = root_objectp; }
BOOL LLPanelVolume::postBuild() { // Flexible Objects Parameters { childSetCommitCallback("Flexible1D Checkbox Ctrl",onCommitIsFlexible,this); childSetCommitCallback("FlexNumSections",onCommitFlexible,this); getChild<LLUICtrl>("FlexNumSections")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexGravity",onCommitFlexible,this); getChild<LLUICtrl>("FlexGravity")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexFriction",onCommitFlexible,this); getChild<LLUICtrl>("FlexFriction")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexWind",onCommitFlexible,this); getChild<LLUICtrl>("FlexWind")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexTension",onCommitFlexible,this); getChild<LLUICtrl>("FlexTension")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexForceX",onCommitFlexible,this); getChild<LLUICtrl>("FlexForceX")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexForceY",onCommitFlexible,this); getChild<LLUICtrl>("FlexForceY")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexForceZ",onCommitFlexible,this); getChild<LLUICtrl>("FlexForceZ")->setValidateBeforeCommit(precommitValidate); } // LIGHT Parameters { childSetCommitCallback("Light Checkbox Ctrl",onCommitIsLight,this); LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch){ LightColorSwatch->setOnCancelCallback(boost::bind(&LLPanelVolume::onLightCancelColor, this, _2)); LightColorSwatch->setOnSelectCallback(boost::bind(&LLPanelVolume::onLightSelectColor, this, _2)); childSetCommitCallback("colorswatch",onCommitLight,this); } LLTextureCtrl* LightTexPicker = getChild<LLTextureCtrl>("light texture control"); if (LightTexPicker) { LightTexPicker->setOnCancelCallback(boost::bind(&LLPanelVolume::onLightCancelTexture, this, _2)); LightTexPicker->setOnSelectCallback(boost::bind(&LLPanelVolume::onLightSelectTexture, this, _2)); childSetCommitCallback("light texture control", onCommitLight, this); } childSetCommitCallback("Light Intensity",onCommitLight,this); getChild<LLUICtrl>("Light Intensity")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("Light Radius",onCommitLight,this); getChild<LLUICtrl>("Light Radius")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("Light Falloff",onCommitLight,this); getChild<LLUICtrl>("Light Falloff")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("Light FOV", onCommitLight, this); getChild<LLUICtrl>("Light FOV")->setValidateBeforeCommit( precommitValidate); childSetCommitCallback("Light Focus", onCommitLight, this); getChild<LLUICtrl>("Light Focus")->setValidateBeforeCommit( precommitValidate); childSetCommitCallback("Light Ambiance", onCommitLight, this); getChild<LLUICtrl>("Light Ambiance")->setValidateBeforeCommit( precommitValidate); } // Start with everyone disabled clearCtrls(); return TRUE; }
void LLPanelVolume::getState( ) { LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(); LLViewerObject* root_objectp = objectp; if(!objectp) { objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); // *FIX: shouldn't we just keep the child? if (objectp) { LLViewerObject* parentp = objectp->getRootEdit(); if (parentp) { root_objectp = parentp; } else { root_objectp = objectp; } } } LLVOVolume *volobjp = NULL; if ( objectp && (objectp->getPCode() == LL_PCODE_VOLUME)) { volobjp = (LLVOVolume *)objectp; } if( !objectp ) { //forfeit focus if (gFocusMgr.childHasKeyboardFocus(this)) { gFocusMgr.setKeyboardFocus(NULL); } // Disable all text input fields clearCtrls(); return; } LLUUID owner_id; std::string owner_name; LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); // BUG? Check for all objects being editable? BOOL editable = root_objectp->permModify() && !root_objectp->isPermanentEnforced(); BOOL single_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ) && LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1; // Select Single Message if (single_volume) { getChildView("edit_object")->setVisible(true); getChildView("edit_object")->setEnabled(true); getChildView("select_single")->setVisible(false); } else { getChildView("edit_object")->setVisible(false); getChildView("select_single")->setVisible(true); getChildView("select_single")->setEnabled(true); } // Light properties BOOL is_light = volobjp && volobjp->getIsLight(); getChild<LLUICtrl>("Light Checkbox Ctrl")->setValue(is_light); getChildView("Light Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp); if (is_light && editable && single_volume) { getChildView("label color")->setEnabled(true); //mLabelColor ->setEnabled( TRUE ); LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LightColorSwatch->setEnabled( TRUE ); LightColorSwatch->setValid( TRUE ); LightColorSwatch->set(volobjp->getLightBaseColor()); } childSetEnabled("label texture",true); LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control"); if (LightTextureCtrl) { LightTextureCtrl->setEnabled(TRUE); LightTextureCtrl->setValid(TRUE); LightTextureCtrl->setImageAssetID(volobjp->getLightTextureID()); } getChildView("Light Intensity")->setEnabled(true); getChildView("Light Radius")->setEnabled(true); getChildView("Light Falloff")->setEnabled(true); getChildView("Light FOV")->setEnabled(true); getChildView("Light Focus")->setEnabled(true); getChildView("Light Ambiance")->setEnabled(true); getChild<LLUICtrl>("Light Intensity")->setValue(volobjp->getLightIntensity()); getChild<LLUICtrl>("Light Radius")->setValue(volobjp->getLightRadius()); getChild<LLUICtrl>("Light Falloff")->setValue(volobjp->getLightFalloff()); LLVector3 params = volobjp->getSpotLightParams(); getChild<LLUICtrl>("Light FOV")->setValue(params.mV[0]); getChild<LLUICtrl>("Light Focus")->setValue(params.mV[1]); getChild<LLUICtrl>("Light Ambiance")->setValue(params.mV[2]); mLightSavedColor = volobjp->getLightColor(); } else { getChild<LLSpinCtrl>("Light Intensity", true)->clear(); getChild<LLSpinCtrl>("Light Radius", true)->clear(); getChild<LLSpinCtrl>("Light Falloff", true)->clear(); getChildView("label color")->setEnabled(false); LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch) { LightColorSwatch->setEnabled( FALSE ); LightColorSwatch->setValid( FALSE ); } childSetEnabled("label texture",false); LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control"); if (LightTextureCtrl) { LightTextureCtrl->setEnabled(FALSE); LightTextureCtrl->setValid(FALSE); } getChildView("Light Intensity")->setEnabled(false); getChildView("Light Radius")->setEnabled(false); getChildView("Light Falloff")->setEnabled(false); getChildView("Light FOV")->setEnabled(false); getChildView("Light Focus")->setEnabled(false); getChildView("Light Ambiance")->setEnabled(false); } // Flexible properties BOOL is_flexible = volobjp && volobjp->isFlexible(); getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->setValue(is_flexible); if (is_flexible || (volobjp && volobjp->canBeFlexible())) { getChildView("Flexible1D Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp && !volobjp->isMesh() && !objectp->isPermanentEnforced()); } else { getChildView("Flexible1D Checkbox Ctrl")->setEnabled(false); } if (is_flexible && editable && single_volume) { getChildView("FlexNumSections")->setVisible(true); getChildView("FlexGravity")->setVisible(true); getChildView("FlexTension")->setVisible(true); getChildView("FlexFriction")->setVisible(true); getChildView("FlexWind")->setVisible(true); getChildView("FlexForceX")->setVisible(true); getChildView("FlexForceY")->setVisible(true); getChildView("FlexForceZ")->setVisible(true); getChildView("FlexNumSections")->setEnabled(true); getChildView("FlexGravity")->setEnabled(true); getChildView("FlexTension")->setEnabled(true); getChildView("FlexFriction")->setEnabled(true); getChildView("FlexWind")->setEnabled(true); getChildView("FlexForceX")->setEnabled(true); getChildView("FlexForceY")->setEnabled(true); getChildView("FlexForceZ")->setEnabled(true); LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); getChild<LLUICtrl>("FlexNumSections")->setValue((F32)attributes->getSimulateLOD()); getChild<LLUICtrl>("FlexGravity")->setValue(attributes->getGravity()); getChild<LLUICtrl>("FlexTension")->setValue(attributes->getTension()); getChild<LLUICtrl>("FlexFriction")->setValue(attributes->getAirFriction()); getChild<LLUICtrl>("FlexWind")->setValue(attributes->getWindSensitivity()); getChild<LLUICtrl>("FlexForceX")->setValue(attributes->getUserForce().mV[VX]); getChild<LLUICtrl>("FlexForceY")->setValue(attributes->getUserForce().mV[VY]); getChild<LLUICtrl>("FlexForceZ")->setValue(attributes->getUserForce().mV[VZ]); } else { getChild<LLSpinCtrl>("FlexNumSections", true)->clear(); getChild<LLSpinCtrl>("FlexGravity", true)->clear(); getChild<LLSpinCtrl>("FlexTension", true)->clear(); getChild<LLSpinCtrl>("FlexFriction", true)->clear(); getChild<LLSpinCtrl>("FlexWind", true)->clear(); getChild<LLSpinCtrl>("FlexForceX", true)->clear(); getChild<LLSpinCtrl>("FlexForceY", true)->clear(); getChild<LLSpinCtrl>("FlexForceZ", true)->clear(); getChildView("FlexNumSections")->setEnabled(false); getChildView("FlexGravity")->setEnabled(false); getChildView("FlexTension")->setEnabled(false); getChildView("FlexFriction")->setEnabled(false); getChildView("FlexWind")->setEnabled(false); getChildView("FlexForceX")->setEnabled(false); getChildView("FlexForceY")->setEnabled(false); getChildView("FlexForceZ")->setEnabled(false); } // Physics properties mComboPhysicsShapeLabel->setEnabled(editable); mSpinPhysicsGravity->set(objectp->getPhysicsGravity()); mSpinPhysicsGravity->setEnabled(editable); mSpinPhysicsFriction->set(objectp->getPhysicsFriction()); mSpinPhysicsFriction->setEnabled(editable); mSpinPhysicsDensity->set(objectp->getPhysicsDensity()); mSpinPhysicsDensity->setEnabled(editable); mSpinPhysicsRestitution->set(objectp->getPhysicsRestitution()); mSpinPhysicsRestitution->setEnabled(editable); // update the physics shape combo to include allowed physics shapes mComboPhysicsShapeType->removeall(); mComboPhysicsShapeType->add(getString("None"), LLSD(1)); BOOL isMesh = FALSE; LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); if (sculpt_params) { U8 sculpt_type = sculpt_params->getSculptType(); U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK; isMesh = (sculpt_stitching == LL_SCULPT_TYPE_MESH); } if(isMesh && objectp) { const LLVolumeParams &volume_params = objectp->getVolume()->getParams(); LLUUID mesh_id = volume_params.getSculptID(); if(gMeshRepo.hasPhysicsShape(mesh_id)) { // if a mesh contains an uploaded or decomposed physics mesh, // allow 'Prim' mComboPhysicsShapeType->add(getString("Prim"), LLSD(0)); } } else { // simple prims always allow physics shape prim mComboPhysicsShapeType->add(getString("Prim"), LLSD(0)); } mComboPhysicsShapeType->add(getString("Convex Hull"), LLSD(2)); mComboPhysicsShapeType->setValue(LLSD(objectp->getPhysicsShapeType())); mComboPhysicsShapeType->setEnabled(editable && !objectp->isPermanentEnforced() && ((root_objectp == NULL) || !root_objectp->isPermanentEnforced())); mObject = objectp; mRootObject = root_objectp; }
BOOL LLPanelVolume::postBuild() { // Flexible Objects Parameters { childSetCommitCallback("Flexible1D Checkbox Ctrl",onCommitIsFlexible,this); childSetCommitCallback("FlexNumSections",onCommitFlexible,this); getChild<LLUICtrl>("FlexNumSections")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexGravity",onCommitFlexible,this); getChild<LLUICtrl>("FlexGravity")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexFriction",onCommitFlexible,this); getChild<LLUICtrl>("FlexFriction")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexWind",onCommitFlexible,this); getChild<LLUICtrl>("FlexWind")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexTension",onCommitFlexible,this); getChild<LLUICtrl>("FlexTension")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexForceX",onCommitFlexible,this); getChild<LLUICtrl>("FlexForceX")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexForceY",onCommitFlexible,this); getChild<LLUICtrl>("FlexForceY")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("FlexForceZ",onCommitFlexible,this); getChild<LLUICtrl>("FlexForceZ")->setValidateBeforeCommit(precommitValidate); } // LIGHT Parameters { childSetCommitCallback("Light Checkbox Ctrl",onCommitIsLight,this); LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if(LightColorSwatch){ LightColorSwatch->setOnCancelCallback(onLightCancelColor); LightColorSwatch->setOnSelectCallback(onLightSelectColor); childSetCommitCallback("colorswatch",onCommitLight,this); } LLTextureCtrl* LightTexPicker = getChild<LLTextureCtrl>("light texture control"); if (LightTexPicker) { LightTexPicker->setOnCancelCallback(onLightCancelTexture); LightTexPicker->setOnSelectCallback(onLightSelectTexture); childSetCommitCallback("light texture control", onCommitLight, this); } childSetCommitCallback("Light Intensity",onCommitLight,this); getChild<LLUICtrl>("Light Intensity")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("Light Radius",onCommitLight,this); getChild<LLUICtrl>("Light Radius")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("Light Falloff",onCommitLight,this); getChild<LLUICtrl>("Light Falloff")->setValidateBeforeCommit(precommitValidate); childSetCommitCallback("Light FOV", onCommitLight, this); getChild<LLUICtrl>("Light FOV")->setValidateBeforeCommit( precommitValidate); childSetCommitCallback("Light Focus", onCommitLight, this); getChild<LLUICtrl>("Light Focus")->setValidateBeforeCommit( precommitValidate); childSetCommitCallback("Light Ambiance", onCommitLight, this); getChild<LLUICtrl>("Light Ambiance")->setValidateBeforeCommit( precommitValidate); } #if MESH_ENABLED // PHYSICS Parameters { // Label mComboPhysicsShapeLabel = getChild<LLTextBox>("label physicsshapetype"); // PhysicsShapeType combobox mComboPhysicsShapeType = getChild<LLComboBox>("Physics Shape Type Combo Ctrl"); mComboPhysicsShapeType->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsShapeType, this, _1, mComboPhysicsShapeType)); // PhysicsGravity mSpinPhysicsGravity = getChild<LLSpinCtrl>("Physics Gravity"); mSpinPhysicsGravity->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsGravity, this, _1, mSpinPhysicsGravity)); // PhysicsFriction mSpinPhysicsFriction = getChild<LLSpinCtrl>("Physics Friction"); mSpinPhysicsFriction->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsFriction, this, _1, mSpinPhysicsFriction)); // PhysicsDensity mSpinPhysicsDensity = getChild<LLSpinCtrl>("Physics Density"); mSpinPhysicsDensity->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsDensity, this, _1, mSpinPhysicsDensity)); // PhysicsRestitution mSpinPhysicsRestitution = getChild<LLSpinCtrl>("Physics Restitution"); mSpinPhysicsRestitution->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsRestitution, this, _1, mSpinPhysicsRestitution)); } #endif //MESH_ENABLED // Start with everyone disabled clearCtrls(); return TRUE; }
void LLFloaterEnvSettings::syncMenu() { LLSliderCtrl* sldr; sldr = getChild<LLSliderCtrl>("EnvTimeSlider"); // sync the clock F32 val = (F32)LLWLParamManager::instance()->mAnimator.getDayTime(); std::string timeStr = timeToString(val); LLTextBox* textBox; textBox = getChild<LLTextBox>("EnvTimeText"); textBox->setValue(timeStr); // sync time slider which starts at 6 AM val -= 0.25; if(val < 0) { val++; } sldr->setValue(val); // sync cloud coverage bool err; childSetValue("EnvCloudSlider", LLWLParamManager::instance()->mCurParams.getFloat("cloud_shadow", err)); LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); // sync water params LLColor4 col = param_mgr->getFogColor(); LLColorSwatchCtrl* colCtrl = getChild<LLColorSwatchCtrl>("EnvWaterColor"); col.mV[3] = 1.0f; colCtrl->set(col); childSetValue("EnvWaterFogSlider", param_mgr->mFogDensity.mExp); param_mgr->setDensitySliderValue(param_mgr->mFogDensity.mExp); // turn off Use Estate Time button if it's already being used if(LLWLParamManager::instance()->mAnimator.mUseLindenTime) { childDisable("EnvUseEstateTimeButton"); } else { childEnable("EnvUseEstateTimeButton"); } if(!gPipeline.canUseVertexShaders()) { childDisable("EnvWaterColor"); childDisable("EnvWaterColorText"); //childDisable("EnvAdvancedWaterButton"); } else { childEnable("EnvWaterColor"); childEnable("EnvWaterColorText"); //childEnable("EnvAdvancedWaterButton"); } // only allow access to these if they are using windlight if(!gPipeline.canUseWindLightShaders()) { childDisable("EnvCloudSlider"); childDisable("EnvCloudText"); //childDisable("EnvAdvancedSkyButton"); } else { childEnable("EnvCloudSlider"); childEnable("EnvCloudText"); //childEnable("EnvAdvancedSkyButton"); } }
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); } } }