aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanelface.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llpanelface.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llpanelface.cpp129
1 files changed, 92 insertions, 37 deletions
diff --git a/linden/indra/newview/llpanelface.cpp b/linden/indra/newview/llpanelface.cpp
index 5ae7b55..a52c57f 100644
--- a/linden/indra/newview/llpanelface.cpp
+++ b/linden/indra/newview/llpanelface.cpp
@@ -57,10 +57,9 @@
57#include "lltooldraganddrop.h" 57#include "lltooldraganddrop.h"
58#include "llui.h" 58#include "llui.h"
59#include "llviewercontrol.h" 59#include "llviewercontrol.h"
60#include "llviewermedia.h"
60#include "llviewerobject.h" 61#include "llviewerobject.h"
61#include "llviewerstats.h" 62#include "llviewerstats.h"
62#include "llmediaengine.h"
63
64#include "llvieweruictrlfactory.h" 63#include "llvieweruictrlfactory.h"
65 64
66// 65//
@@ -81,8 +80,11 @@ BOOL LLPanelFace::postBuild()
81 LLTextBox* mLabelColorTransp; 80 LLTextBox* mLabelColorTransp;
82 LLSpinCtrl* mCtrlColorTransp; // transparency = 1 - alpha 81 LLSpinCtrl* mCtrlColorTransp; // transparency = 1 - alpha
83 82
83 LLTextBox* mLabelGlow;
84 LLSpinCtrl* mCtrlGlow;
85
84 setMouseOpaque(FALSE); 86 setMouseOpaque(FALSE);
85 mTextureCtrl = LLUICtrlFactory::getTexturePickerByName(this,"texture control"); 87 mTextureCtrl = getChild<LLTextureCtrl>("texture control");
86 if(mTextureCtrl) 88 if(mTextureCtrl)
87 { 89 {
88 mTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); 90 mTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" )));
@@ -114,7 +116,7 @@ BOOL LLPanelFace::postBuild()
114 } 116 }
115 } 117 }
116 118
117 mColorSwatch = LLUICtrlFactory::getColorSwatchByName(this,"colorswatch"); 119 mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
118 if(mColorSwatch) 120 if(mColorSwatch)
119 { 121 {
120 mColorSwatch->setCommitCallback(LLPanelFace::onCommitColor); 122 mColorSwatch->setCommitCallback(LLPanelFace::onCommitColor);
@@ -157,6 +159,15 @@ BOOL LLPanelFace::postBuild()
157 mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); 159 mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP);
158 mComboTexGen->setCallbackUserData( this ); 160 mComboTexGen->setCallbackUserData( this );
159 } 161 }
162
163 mLabelGlow = LLUICtrlFactory::getTextBoxByName(this,"glow label");
164 mCtrlGlow = LLUICtrlFactory::getSpinnerByName(this,"glow");
165 if(mCtrlGlow)
166 {
167 mCtrlGlow->setCommitCallback(LLPanelFace::onCommitGlow);
168 mCtrlGlow->setCallbackUserData(this);
169 }
170
160 childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this); 171 childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this);
161 childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this); 172 childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this);
162 childSetCommitCallback("TexScaleU",&LLPanelFace::onCommitTextureInfo, this); 173 childSetCommitCallback("TexScaleU",&LLPanelFace::onCommitTextureInfo, this);
@@ -188,7 +199,7 @@ LLPanelFace::~LLPanelFace()
188 199
189void LLPanelFace::sendTexture() 200void LLPanelFace::sendTexture()
190{ 201{
191 LLTextureCtrl* mTextureCtrl = gUICtrlFactory->getTexturePickerByName(this,"texture control"); 202 LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("texture control");
192 if(!mTextureCtrl) return; 203 if(!mTextureCtrl) return;
193 if( !mTextureCtrl->getTentative() ) 204 if( !mTextureCtrl->getTentative() )
194 { 205 {
@@ -255,6 +266,15 @@ void LLPanelFace::sendAlpha()
255} 266}
256 267
257 268
269void LLPanelFace::sendGlow()
270{
271 LLSpinCtrl* mCtrlGlow = LLViewerUICtrlFactory::getSpinnerByName(this,"glow");
272 if(!mCtrlGlow)return;
273 F32 glow = mCtrlGlow->get();
274
275 gSelectMgr->selectionSetGlow( glow );
276}
277
258struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor 278struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
259{ 279{
260 LLPanelFaceSetTEFunctor(LLPanelFace* panel) : mPanel(panel) {} 280 LLPanelFaceSetTEFunctor(LLPanelFace* panel) : mPanel(panel) {}
@@ -364,7 +384,8 @@ void LLPanelFace::getState()
364 LLViewerObject* objectp = gSelectMgr->getSelection()->getFirstObject(); 384 LLViewerObject* objectp = gSelectMgr->getSelection()->getFirstObject();
365 385
366 if( objectp 386 if( objectp
367 && objectp->getPCode() == LL_PCODE_VOLUME) 387 && objectp->getPCode() == LL_PCODE_VOLUME
388 && objectp->permModify())
368 { 389 {
369 BOOL editable = objectp->permModify(); 390 BOOL editable = objectp->permModify();
370 391
@@ -374,14 +395,19 @@ void LLPanelFace::getState()
374 childSetEnabled("button align",FALSE); 395 childSetEnabled("button align",FALSE);
375 //mBtnAutoFix->setEnabled ( FALSE ); 396 //mBtnAutoFix->setEnabled ( FALSE );
376 397
377 if ( LLMediaEngine::getInstance()->getMediaRenderer () ) 398 if(LLViewerMedia::hasMedia())
378 if ( LLMediaEngine::getInstance()->getMediaRenderer ()->isLoaded () ) 399 {
379 { 400 childSetEnabled("textbox autofix",editable);
380 childSetEnabled("textbox autofix",editable); 401 childSetEnabled("button align",editable);
381 //mLabelTexAutoFix->setEnabled ( editable ); 402 }
382 childSetEnabled("button align",editable); 403 //if ( LLMediaEngine::getInstance()->getMediaRenderer () )
383 //mBtnAutoFix->setEnabled ( editable ); 404 // if ( LLMediaEngine::getInstance()->getMediaRenderer ()->isLoaded () )
384 } 405 // {
406 //
407 // //mLabelTexAutoFix->setEnabled ( editable );
408 //
409 // //mBtnAutoFix->setEnabled ( editable );
410 // }
385 childSetEnabled("button apply",editable); 411 childSetEnabled("button apply",editable);
386 412
387 bool identical; 413 bool identical;
@@ -574,10 +600,28 @@ void LLPanelFace::getState()
574 childSetEnabled("ColorTrans",editable); 600 childSetEnabled("ColorTrans",editable);
575 } 601 }
576 602
603 {
604 F32 glow = 0.f;
605 struct f8 : public LLSelectedTEGetFunctor<F32>
606 {
607 F32 get(LLViewerObject* object, S32 face)
608 {
609 return object->getTE(face)->getGlow();
610 }
611 } func;
612 identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, glow );
613
614 childSetValue("glow",glow);
615 childSetEnabled("glow",editable);
616 childSetTentative("glow",!identical);
617 childSetEnabled("glow label",editable);
618
619 }
620
577 // Bump 621 // Bump
578 { 622 {
579 F32 shinyf = 0.f; 623 F32 shinyf = 0.f;
580 struct f8 : public LLSelectedTEGetFunctor<F32> 624 struct f9 : public LLSelectedTEGetFunctor<F32>
581 { 625 {
582 F32 get(LLViewerObject* object, S32 face) 626 F32 get(LLViewerObject* object, S32 face)
583 { 627 {
@@ -602,7 +646,7 @@ void LLPanelFace::getState()
602 646
603 { 647 {
604 F32 bumpf = 0.f; 648 F32 bumpf = 0.f;
605 struct f9 : public LLSelectedTEGetFunctor<F32> 649 struct f10 : public LLSelectedTEGetFunctor<F32>
606 { 650 {
607 F32 get(LLViewerObject* object, S32 face) 651 F32 get(LLViewerObject* object, S32 face)
608 { 652 {
@@ -627,7 +671,7 @@ void LLPanelFace::getState()
627 671
628 { 672 {
629 F32 genf = 0.f; 673 F32 genf = 0.f;
630 struct f10 : public LLSelectedTEGetFunctor<F32> 674 struct f11 : public LLSelectedTEGetFunctor<F32>
631 { 675 {
632 F32 get(LLViewerObject* object, S32 face) 676 F32 get(LLViewerObject* object, S32 face)
633 { 677 {
@@ -652,20 +696,20 @@ void LLPanelFace::getState()
652 696
653 if (selected_texgen == 1) 697 if (selected_texgen == 1)
654 { 698 {
655 childSetText("tex scale",childGetText("string repeats per meter")); 699 childSetText("tex scale",getString("string repeats per meter"));
656 childSetValue("TexScaleU", 2.0f * childGetValue("TexScaleU").asReal() ); 700 childSetValue("TexScaleU", 2.0f * childGetValue("TexScaleU").asReal() );
657 childSetValue("TexScaleV", 2.0f * childGetValue("TexScaleV").asReal() ); 701 childSetValue("TexScaleV", 2.0f * childGetValue("TexScaleV").asReal() );
658 } 702 }
659 else 703 else
660 { 704 {
661 childSetText("tex scale",childGetText("string repeats per face")); 705 childSetText("tex scale",getString("string repeats per face"));
662 } 706 }
663 707
664 } 708 }
665 709
666 { 710 {
667 F32 fullbrightf = 0.f; 711 F32 fullbrightf = 0.f;
668 struct f11 : public LLSelectedTEGetFunctor<F32> 712 struct f12 : public LLSelectedTEGetFunctor<F32>
669 { 713 {
670 F32 get(LLViewerObject* object, S32 face) 714 F32 get(LLViewerObject* object, S32 face)
671 { 715 {
@@ -687,7 +731,7 @@ void LLPanelFace::getState()
687 // Repeats per meter 731 // Repeats per meter
688 { 732 {
689 F32 repeats = 1.f; 733 F32 repeats = 1.f;
690 struct f12 : public LLSelectedTEGetFunctor<F32> 734 struct f13 : public LLSelectedTEGetFunctor<F32>
691 { 735 {
692 F32 get(LLViewerObject* object, S32 face) 736 F32 get(LLViewerObject* object, S32 face)
693 { 737 {
@@ -718,14 +762,14 @@ void LLPanelFace::getState()
718 clearCtrls(); 762 clearCtrls();
719 763
720 // Disable non-UICtrls 764 // Disable non-UICtrls
721 LLTextureCtrl* texture_ctrl = LLUICtrlFactory::getTexturePickerByName(this,"texture control"); 765 LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control");
722 if(texture_ctrl) 766 if(texture_ctrl)
723 { 767 {
724 texture_ctrl->setImageAssetID( LLUUID::null ); 768 texture_ctrl->setImageAssetID( LLUUID::null );
725 texture_ctrl->setEnabled( FALSE ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl. 769 texture_ctrl->setEnabled( FALSE ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl.
726// texture_ctrl->setValid(FALSE); 770// texture_ctrl->setValid(FALSE);
727 } 771 }
728 LLColorSwatchCtrl* mColorSwatch = LLUICtrlFactory::getColorSwatchByName(this,"colorswatch"); 772 LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
729 if(mColorSwatch) 773 if(mColorSwatch)
730 { 774 {
731 mColorSwatch->setEnabled( FALSE ); 775 mColorSwatch->setEnabled( FALSE );
@@ -757,6 +801,12 @@ void LLPanelFace::refresh()
757// Static functions 801// Static functions
758// 802//
759 803
804// static
805F32 LLPanelFace::valueGlow(LLViewerObject* object, S32 face)
806{
807 return (F32)(object->getTE(face)->getGlow());
808}
809
760 810
761// static 811// static
762void LLPanelFace::onCommitColor(LLUICtrl* ctrl, void* userdata) 812void LLPanelFace::onCommitColor(LLUICtrl* ctrl, void* userdata)
@@ -815,6 +865,13 @@ void LLPanelFace::onCommitFullbright(LLUICtrl* ctrl, void* userdata)
815} 865}
816 866
817// static 867// static
868void LLPanelFace::onCommitGlow(LLUICtrl* ctrl, void* userdata)
869{
870 LLPanelFace* self = (LLPanelFace*) userdata;
871 self->sendGlow();
872}
873
874// static
818BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item, void*) 875BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item, void*)
819{ 876{
820 BOOL accept = TRUE; 877 BOOL accept = TRUE;
@@ -884,27 +941,25 @@ struct LLPanelFaceSetMediaFunctor : public LLSelectedTEFunctor
884 virtual bool apply(LLViewerObject* object, S32 te) 941 virtual bool apply(LLViewerObject* object, S32 te)
885 { 942 {
886 // only do this if it's a media texture 943 // only do this if it's a media texture
887 if ( object->getTE ( te )->getID() == LLMediaEngine::getInstance()->getImageUUID () ) 944 if ( object->getTE ( te )->getID() == LLViewerMedia::getMediaTextureID() )
888 { 945 {
889 // make sure we're valid 946 S32 media_width, media_height;
890 if ( LLMediaEngine::getInstance()->getMediaRenderer() ) 947 S32 texture_width, texture_height;
948 if ( LLViewerMedia::getMediaSize( &media_width, &media_height )
949 && LLViewerMedia::getTextureSize( &texture_width, &texture_height ) )
891 { 950 {
892 // calculate correct scaling based on media dimensions and next-power-of-2 texture dimensions 951 F32 scale_s = (F32)media_width / (F32)texture_width;
893 F32 scaleS = (F32)LLMediaEngine::getInstance()->getMediaRenderer()->getMediaWidth() / 952 F32 scale_t = (F32)media_height / (F32)texture_height;
894 (F32)LLMediaEngine::getInstance()->getMediaRenderer()->getTextureWidth();
895
896 F32 scaleT = (F32)LLMediaEngine::getInstance()->getMediaRenderer()->getMediaHeight() /
897 (F32)LLMediaEngine::getInstance()->getMediaRenderer()->getTextureHeight();
898 953
899 // set scale and adjust offset 954 // set scale and adjust offset
900 object->setTEScaleS( te, scaleS ); 955 object->setTEScaleS( te, scale_s );
901 object->setTEScaleT( te, scaleT ); // don't need to flip Y anymore since QT does this for us now. 956 object->setTEScaleT( te, scale_t ); // don't need to flip Y anymore since QT does this for us now.
902 object->setTEOffsetS( te, -( 1.0f - scaleS ) / 2.0f ); 957 object->setTEOffsetS( te, -( 1.0f - scale_s ) / 2.0f );
903 object->setTEOffsetT( te, -( 1.0f - scaleT ) / 2.0f ); 958 object->setTEOffsetT( te, -( 1.0f - scale_t ) / 2.0f );
904 } 959 }
905 } 960 }
906 return true; 961 return true;
907 } 962 };
908}; 963};
909 964
910void LLPanelFace::onClickAutoFix(void* userdata) 965void LLPanelFace::onClickAutoFix(void* userdata)