aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanelvolume.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llpanelvolume.cpp117
1 files changed, 117 insertions, 0 deletions
diff --git a/linden/indra/newview/llpanelvolume.cpp b/linden/indra/newview/llpanelvolume.cpp
index 6d014a2..4270f0b 100644
--- a/linden/indra/newview/llpanelvolume.cpp
+++ b/linden/indra/newview/llpanelvolume.cpp
@@ -53,6 +53,7 @@
53#include "llbutton.h" 53#include "llbutton.h"
54#include "llcheckboxctrl.h" 54#include "llcheckboxctrl.h"
55#include "llcolorswatch.h" 55#include "llcolorswatch.h"
56#include "lltexturectrl.h"
56#include "llcombobox.h" 57#include "llcombobox.h"
57#include "llfirstuse.h" 58#include "llfirstuse.h"
58#include "llfocusmgr.h" 59#include "llfocusmgr.h"
@@ -111,12 +112,28 @@ BOOL LLPanelVolume::postBuild()
111 LightColorSwatch->setOnSelectCallback(onLightSelectColor); 112 LightColorSwatch->setOnSelectCallback(onLightSelectColor);
112 childSetCommitCallback("colorswatch",onCommitLight,this); 113 childSetCommitCallback("colorswatch",onCommitLight,this);
113 } 114 }
115
116 LLTextureCtrl* LightTexPicker = getChild<LLTextureCtrl>("light texture control");
117 if (LightTexPicker)
118 {
119 LightTexPicker->setOnCancelCallback(onLightCancelTexture);
120 LightTexPicker->setOnSelectCallback(onLightSelectTexture);
121 childSetCommitCallback("light texture control", onCommitLight, this);
122 }
123
114 childSetCommitCallback("Light Intensity",onCommitLight,this); 124 childSetCommitCallback("Light Intensity",onCommitLight,this);
115 childSetValidate("Light Intensity",precommitValidate); 125 childSetValidate("Light Intensity",precommitValidate);
116 childSetCommitCallback("Light Radius",onCommitLight,this); 126 childSetCommitCallback("Light Radius",onCommitLight,this);
117 childSetValidate("Light Radius",precommitValidate); 127 childSetValidate("Light Radius",precommitValidate);
118 childSetCommitCallback("Light Falloff",onCommitLight,this); 128 childSetCommitCallback("Light Falloff",onCommitLight,this);
119 childSetValidate("Light Falloff",precommitValidate); 129 childSetValidate("Light Falloff",precommitValidate);
130
131 childSetCommitCallback("Light FOV", onCommitLight, this);
132 childSetValidate("Light FOV", precommitValidate);
133 childSetCommitCallback("Light Focus", onCommitLight, this);
134 childSetValidate("Light Focus", precommitValidate);
135 childSetCommitCallback("Light Ambiance", onCommitLight, this);
136 childSetValidate("Light Ambiance", precommitValidate);
120 } 137 }
121 138
122 // Start with everyone disabled 139 // Start with everyone disabled
@@ -221,14 +238,32 @@ void LLPanelVolume::getState( )
221 LightColorSwatch->setValid( TRUE ); 238 LightColorSwatch->setValid( TRUE );
222 LightColorSwatch->set(volobjp->getLightBaseColor()); 239 LightColorSwatch->set(volobjp->getLightBaseColor());
223 } 240 }
241
242 LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
243 if (LightTextureCtrl)
244 {
245 LightTextureCtrl->setEnabled(TRUE);
246 LightTextureCtrl->setValid(TRUE);
247 LightTextureCtrl->setImageAssetID(volobjp->getLightTextureID());
248 }
249
224 childSetEnabled("Light Intensity",true); 250 childSetEnabled("Light Intensity",true);
225 childSetEnabled("Light Radius",true); 251 childSetEnabled("Light Radius",true);
226 childSetEnabled("Light Falloff",true); 252 childSetEnabled("Light Falloff",true);
227 253
254 childSetEnabled("Light FOV", true);
255 childSetEnabled("Light Focus", true);
256 childSetEnabled("Light Ambiance", true);
257
228 childSetValue("Light Intensity",volobjp->getLightIntensity()); 258 childSetValue("Light Intensity",volobjp->getLightIntensity());
229 childSetValue("Light Radius",volobjp->getLightRadius()); 259 childSetValue("Light Radius",volobjp->getLightRadius());
230 childSetValue("Light Falloff",volobjp->getLightFalloff()); 260 childSetValue("Light Falloff",volobjp->getLightFalloff());
231 261
262 LLVector3 params = volobjp->getSpotLightParams();
263 childSetValue("Light FOV", params.mV[0]);
264 childSetValue("Light Focus", params.mV[1]);
265 childSetValue("Light Ambiance", params.mV[2]);
266
232 mLightSavedColor = volobjp->getLightColor(); 267 mLightSavedColor = volobjp->getLightColor();
233 } 268 }
234 else 269 else
@@ -244,9 +279,20 @@ void LLPanelVolume::getState( )
244 LightColorSwatch->setEnabled( FALSE ); 279 LightColorSwatch->setEnabled( FALSE );
245 LightColorSwatch->setValid( FALSE ); 280 LightColorSwatch->setValid( FALSE );
246 } 281 }
282 LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
283 if (LightTextureCtrl)
284 {
285 LightTextureCtrl->setEnabled(FALSE);
286 LightTextureCtrl->setValid(FALSE);
287 }
288
247 childSetEnabled("Light Intensity",false); 289 childSetEnabled("Light Intensity",false);
248 childSetEnabled("Light Radius",false); 290 childSetEnabled("Light Radius",false);
249 childSetEnabled("Light Falloff",false); 291 childSetEnabled("Light Falloff",false);
292
293 childSetEnabled("Light FOV",false);
294 childSetEnabled("Light Focus",false);
295 childSetEnabled("Light Ambiance",false);
250 } 296 }
251 297
252 // Flexible properties 298 // Flexible properties
@@ -362,6 +408,13 @@ void LLPanelVolume::clearCtrls()
362 LightColorSwatch->setEnabled( FALSE ); 408 LightColorSwatch->setEnabled( FALSE );
363 LightColorSwatch->setValid( FALSE ); 409 LightColorSwatch->setValid( FALSE );
364 } 410 }
411 LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
412 if(LightTextureCtrl)
413 {
414 LightTextureCtrl->setEnabled( FALSE );
415 LightTextureCtrl->setValid( FALSE );
416 }
417
365 childSetEnabled("Light Intensity",false); 418 childSetEnabled("Light Intensity",false);
366 childSetEnabled("Light Radius",false); 419 childSetEnabled("Light Radius",false);
367 childSetEnabled("Light Falloff",false); 420 childSetEnabled("Light Falloff",false);
@@ -438,6 +491,16 @@ void LLPanelVolume::onLightCancelColor(LLUICtrl* ctrl, void* userdata)
438 onLightSelectColor(NULL, userdata); 491 onLightSelectColor(NULL, userdata);
439} 492}
440 493
494void LLPanelVolume::onLightCancelTexture(LLUICtrl* ctrl, void* userdata)
495{
496 LLPanelVolume* self = (LLPanelVolume*) userdata;
497 LLTextureCtrl* LightTextureCtrl = self->getChild<LLTextureCtrl>("light texture control");
498 if (LightTextureCtrl)
499 {
500 LightTextureCtrl->setImageAssetID(self->mLightSavedTexture);
501 }
502}
503
441void LLPanelVolume::onLightSelectColor(LLUICtrl* ctrl, void* userdata) 504void LLPanelVolume::onLightSelectColor(LLUICtrl* ctrl, void* userdata)
442{ 505{
443 LLPanelVolume* self = (LLPanelVolume*) userdata; 506 LLPanelVolume* self = (LLPanelVolume*) userdata;
@@ -459,6 +522,25 @@ void LLPanelVolume::onLightSelectColor(LLUICtrl* ctrl, void* userdata)
459 } 522 }
460} 523}
461 524
525void LLPanelVolume::onLightSelectTexture(LLUICtrl* ctrl, void* userdata)
526{
527 LLPanelVolume* self = (LLPanelVolume*) userdata;
528 LLViewerObject* objectp = self->mObject;
529 if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
530 {
531 return;
532 }
533 LLVOVolume *volobjp = (LLVOVolume *)objectp;
534
535
536 LLTextureCtrl* LightTextureCtrl = self->getChild<LLTextureCtrl>("light texture control");
537 if(LightTextureCtrl)
538 {
539 LLUUID id = LightTextureCtrl->getImageAssetID();
540 volobjp->setLightTextureID(id);
541 self->mLightSavedTexture = id;
542 }
543}
462// static 544// static
463void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata ) 545void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata )
464{ 546{
@@ -474,12 +556,47 @@ void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata )
474 volobjp->setLightIntensity((F32)self->childGetValue("Light Intensity").asReal()); 556 volobjp->setLightIntensity((F32)self->childGetValue("Light Intensity").asReal());
475 volobjp->setLightRadius((F32)self->childGetValue("Light Radius").asReal()); 557 volobjp->setLightRadius((F32)self->childGetValue("Light Radius").asReal());
476 volobjp->setLightFalloff((F32)self->childGetValue("Light Falloff").asReal()); 558 volobjp->setLightFalloff((F32)self->childGetValue("Light Falloff").asReal());
559
477 LLColorSwatchCtrl* LightColorSwatch = self->getChild<LLColorSwatchCtrl>("colorswatch"); 560 LLColorSwatchCtrl* LightColorSwatch = self->getChild<LLColorSwatchCtrl>("colorswatch");
478 if(LightColorSwatch) 561 if(LightColorSwatch)
479 { 562 {
480 LLColor4 clr = LightColorSwatch->get(); 563 LLColor4 clr = LightColorSwatch->get();
481 volobjp->setLightColor(LLColor3(clr)); 564 volobjp->setLightColor(LLColor3(clr));
482 } 565 }
566
567 LLTextureCtrl* LightTextureCtrl = self->getChild<LLTextureCtrl>("light texture control");
568 if(LightTextureCtrl)
569 {
570 LLUUID id = LightTextureCtrl->getImageAssetID();
571 if (id.notNull())
572 {
573 if (volobjp->getLightTextureID().isNull())
574 { //this commit is making this a spot light, set UI to default params
575 volobjp->setLightTextureID(id);
576 LLVector3 spot_params = volobjp->getSpotLightParams();
577 self->childSetValue("Light FOV", spot_params.mV[0]);
578 self->childSetValue("Light Focus", spot_params.mV[1]);
579 self->childSetValue("Light Ambiance", spot_params.mV[2]);
580 }
581 else
582 { //modifying existing params
583 LLVector3 spot_params;
584 spot_params.mV[0] = (F32) self->childGetValue("Light FOV").asReal();
585 spot_params.mV[1] = (F32) self->childGetValue("Light Focus").asReal();
586 spot_params.mV[2] = (F32) self->childGetValue("Light Ambiance").asReal();
587 volobjp->setSpotLightParams(spot_params);
588 }
589 }
590 else if (volobjp->getLightTextureID().notNull())
591 { //no longer a spot light
592 volobjp->setLightTextureID(id);
593 //self->childDisable("Light FOV");
594 //self->childDisable("Light Focus");
595 //self->childDisable("Light Ambiance");
596 }
597 }
598
599
483} 600}
484 601
485// static 602// static