diff options
Diffstat (limited to 'linden/indra/newview/llpanelobject.cpp')
-rw-r--r-- | linden/indra/newview/llpanelobject.cpp | 61 |
1 files changed, 58 insertions, 3 deletions
diff --git a/linden/indra/newview/llpanelobject.cpp b/linden/indra/newview/llpanelobject.cpp index cc9d969..5cd8690 100644 --- a/linden/indra/newview/llpanelobject.cpp +++ b/linden/indra/newview/llpanelobject.cpp | |||
@@ -46,6 +46,7 @@ | |||
46 | // project includes | 46 | // project includes |
47 | #include "llagent.h" | 47 | #include "llagent.h" |
48 | #include "llbutton.h" | 48 | #include "llbutton.h" |
49 | #include "llcalc.h" | ||
49 | #include "llcheckboxctrl.h" | 50 | #include "llcheckboxctrl.h" |
50 | #include "llcolorswatch.h" | 51 | #include "llcolorswatch.h" |
51 | #include "llcombobox.h" | 52 | #include "llcombobox.h" |
@@ -109,6 +110,9 @@ BOOL LLPanelObject::postBuild() | |||
109 | // Top | 110 | // Top |
110 | //-------------------------------------------------------- | 111 | //-------------------------------------------------------- |
111 | 112 | ||
113 | // Build constant tipsheet | ||
114 | childSetAction("build_math_constants",onClickBuildConstants,this); | ||
115 | |||
112 | // Lock checkbox | 116 | // Lock checkbox |
113 | mCheckLock = getChild<LLCheckBoxCtrl>("checkbox locked"); | 117 | mCheckLock = getChild<LLCheckBoxCtrl>("checkbox locked"); |
114 | childSetCommitCallback("checkbox locked",onCommitLock,this); | 118 | childSetCommitCallback("checkbox locked",onCommitLock,this); |
@@ -341,6 +345,8 @@ void LLPanelObject::getState( ) | |||
341 | } | 345 | } |
342 | } | 346 | } |
343 | 347 | ||
348 | LLCalc* calcp = LLCalc::getInstance(); | ||
349 | |||
344 | LLVOVolume *volobjp = NULL; | 350 | LLVOVolume *volobjp = NULL; |
345 | if ( objectp && (objectp->getPCode() == LL_PCODE_VOLUME)) | 351 | if ( objectp && (objectp->getPCode() == LL_PCODE_VOLUME)) |
346 | { | 352 | { |
@@ -357,6 +363,7 @@ void LLPanelObject::getState( ) | |||
357 | 363 | ||
358 | // Disable all text input fields | 364 | // Disable all text input fields |
359 | clearCtrls(); | 365 | clearCtrls(); |
366 | calcp->clearAllVariables(); | ||
360 | return; | 367 | return; |
361 | } | 368 | } |
362 | 369 | ||
@@ -365,6 +372,7 @@ void LLPanelObject::getState( ) | |||
365 | BOOL enable_scale = objectp->permMove() && objectp->permModify(); | 372 | BOOL enable_scale = objectp->permMove() && objectp->permModify(); |
366 | BOOL enable_rotate = objectp->permMove() && ( (objectp->permModify() && !objectp->isAttachment()) || !gSavedSettings.getBOOL("EditLinkedParts")); | 373 | BOOL enable_rotate = objectp->permMove() && ( (objectp->permModify() && !objectp->isAttachment()) || !gSavedSettings.getBOOL("EditLinkedParts")); |
367 | 374 | ||
375 | childSetEnabled("build_math_constants",true); | ||
368 | LLVector3 vec; | 376 | LLVector3 vec; |
369 | if (enable_move) | 377 | if (enable_move) |
370 | { | 378 | { |
@@ -372,12 +380,18 @@ void LLPanelObject::getState( ) | |||
372 | mCtrlPosX->set( vec.mV[VX] ); | 380 | mCtrlPosX->set( vec.mV[VX] ); |
373 | mCtrlPosY->set( vec.mV[VY] ); | 381 | mCtrlPosY->set( vec.mV[VY] ); |
374 | mCtrlPosZ->set( vec.mV[VZ] ); | 382 | mCtrlPosZ->set( vec.mV[VZ] ); |
383 | calcp->setVar(LLCalc::X_POS, vec.mV[VX]); | ||
384 | calcp->setVar(LLCalc::Y_POS, vec.mV[VY]); | ||
385 | calcp->setVar(LLCalc::Z_POS, vec.mV[VZ]); | ||
375 | } | 386 | } |
376 | else | 387 | else |
377 | { | 388 | { |
378 | mCtrlPosX->clear(); | 389 | mCtrlPosX->clear(); |
379 | mCtrlPosY->clear(); | 390 | mCtrlPosY->clear(); |
380 | mCtrlPosZ->clear(); | 391 | mCtrlPosZ->clear(); |
392 | calcp->clearVar(LLCalc::X_POS); | ||
393 | calcp->clearVar(LLCalc::Y_POS); | ||
394 | calcp->clearVar(LLCalc::Z_POS); | ||
381 | } | 395 | } |
382 | 396 | ||
383 | 397 | ||
@@ -392,12 +406,18 @@ void LLPanelObject::getState( ) | |||
392 | mCtrlScaleX->set( vec.mV[VX] ); | 406 | mCtrlScaleX->set( vec.mV[VX] ); |
393 | mCtrlScaleY->set( vec.mV[VY] ); | 407 | mCtrlScaleY->set( vec.mV[VY] ); |
394 | mCtrlScaleZ->set( vec.mV[VZ] ); | 408 | mCtrlScaleZ->set( vec.mV[VZ] ); |
409 | calcp->setVar(LLCalc::X_SCALE, vec.mV[VX]); | ||
410 | calcp->setVar(LLCalc::Y_SCALE, vec.mV[VY]); | ||
411 | calcp->setVar(LLCalc::Z_SCALE, vec.mV[VZ]); | ||
395 | } | 412 | } |
396 | else | 413 | else |
397 | { | 414 | { |
398 | mCtrlScaleX->clear(); | 415 | mCtrlScaleX->clear(); |
399 | mCtrlScaleY->clear(); | 416 | mCtrlScaleY->clear(); |
400 | mCtrlScaleZ->clear(); | 417 | mCtrlScaleZ->clear(); |
418 | calcp->setVar(LLCalc::X_SCALE, 0.f); | ||
419 | calcp->setVar(LLCalc::Y_SCALE, 0.f); | ||
420 | calcp->setVar(LLCalc::Z_SCALE, 0.f); | ||
401 | } | 421 | } |
402 | 422 | ||
403 | mLabelSize->setEnabled( enable_scale ); | 423 | mLabelSize->setEnabled( enable_scale ); |
@@ -417,12 +437,18 @@ void LLPanelObject::getState( ) | |||
417 | mCtrlRotX->set( mCurEulerDegrees.mV[VX] ); | 437 | mCtrlRotX->set( mCurEulerDegrees.mV[VX] ); |
418 | mCtrlRotY->set( mCurEulerDegrees.mV[VY] ); | 438 | mCtrlRotY->set( mCurEulerDegrees.mV[VY] ); |
419 | mCtrlRotZ->set( mCurEulerDegrees.mV[VZ] ); | 439 | mCtrlRotZ->set( mCurEulerDegrees.mV[VZ] ); |
440 | calcp->setVar(LLCalc::X_ROT, mCurEulerDegrees.mV[VX]); | ||
441 | calcp->setVar(LLCalc::Y_ROT, mCurEulerDegrees.mV[VY]); | ||
442 | calcp->setVar(LLCalc::Z_ROT, mCurEulerDegrees.mV[VZ]); | ||
420 | } | 443 | } |
421 | else | 444 | else |
422 | { | 445 | { |
423 | mCtrlRotX->clear(); | 446 | mCtrlRotX->clear(); |
424 | mCtrlRotY->clear(); | 447 | mCtrlRotY->clear(); |
425 | mCtrlRotZ->clear(); | 448 | mCtrlRotZ->clear(); |
449 | calcp->clearVar(LLCalc::X_ROT); | ||
450 | calcp->clearVar(LLCalc::Y_ROT); | ||
451 | calcp->clearVar(LLCalc::Z_ROT); | ||
426 | } | 452 | } |
427 | 453 | ||
428 | mLabelRotation->setEnabled( enable_rotate ); | 454 | mLabelRotation->setEnabled( enable_rotate ); |
@@ -678,8 +704,9 @@ void LLPanelObject::getState( ) | |||
678 | F32 end_t = volume_params.getEndT(); | 704 | F32 end_t = volume_params.getEndT(); |
679 | 705 | ||
680 | // Hollowness | 706 | // Hollowness |
681 | F32 hollow = volume_params.getHollow(); | 707 | F32 hollow = 100.f * volume_params.getHollow(); |
682 | mSpinHollow->set( 100.f * hollow ); | 708 | mSpinHollow->set( hollow ); |
709 | calcp->setVar(LLCalc::HOLLOW, hollow); | ||
683 | 710 | ||
684 | // All hollow objects allow a shape to be selected. | 711 | // All hollow objects allow a shape to be selected. |
685 | if (hollow > 0.f) | 712 | if (hollow > 0.f) |
@@ -732,6 +759,10 @@ void LLPanelObject::getState( ) | |||
732 | mSpinCutEnd ->set( cut_end ); | 759 | mSpinCutEnd ->set( cut_end ); |
733 | mCtrlPathBegin ->set( adv_cut_begin ); | 760 | mCtrlPathBegin ->set( adv_cut_begin ); |
734 | mCtrlPathEnd ->set( adv_cut_end ); | 761 | mCtrlPathEnd ->set( adv_cut_end ); |
762 | calcp->setVar(LLCalc::CUT_BEGIN, cut_begin); | ||
763 | calcp->setVar(LLCalc::CUT_END, cut_end); | ||
764 | calcp->setVar(LLCalc::PATH_BEGIN, adv_cut_begin); | ||
765 | calcp->setVar(LLCalc::PATH_END, adv_cut_end); | ||
735 | 766 | ||
736 | // Twist | 767 | // Twist |
737 | F32 twist = volume_params.getTwist(); | 768 | F32 twist = volume_params.getTwist(); |
@@ -750,18 +781,24 @@ void LLPanelObject::getState( ) | |||
750 | 781 | ||
751 | mSpinTwist ->set( twist ); | 782 | mSpinTwist ->set( twist ); |
752 | mSpinTwistBegin ->set( twist_begin ); | 783 | mSpinTwistBegin ->set( twist_begin ); |
784 | calcp->setVar(LLCalc::TWIST_END, twist); | ||
785 | calcp->setVar(LLCalc::TWIST_BEGIN, twist_begin); | ||
753 | 786 | ||
754 | // Shear | 787 | // Shear |
755 | F32 shear_x = volume_params.getShearX(); | 788 | F32 shear_x = volume_params.getShearX(); |
756 | F32 shear_y = volume_params.getShearY(); | 789 | F32 shear_y = volume_params.getShearY(); |
757 | mSpinShearX->set( shear_x ); | 790 | mSpinShearX->set( shear_x ); |
758 | mSpinShearY->set( shear_y ); | 791 | mSpinShearY->set( shear_y ); |
792 | calcp->setVar(LLCalc::X_SHEAR, shear_x); | ||
793 | calcp->setVar(LLCalc::Y_SHEAR, shear_y); | ||
759 | 794 | ||
760 | // Taper | 795 | // Taper |
761 | F32 taper_x = volume_params.getTaperX(); | 796 | F32 taper_x = volume_params.getTaperX(); |
762 | F32 taper_y = volume_params.getTaperY(); | 797 | F32 taper_y = volume_params.getTaperY(); |
763 | mSpinTaperX->set( taper_x ); | 798 | mSpinTaperX->set( taper_x ); |
764 | mSpinTaperY->set( taper_y ); | 799 | mSpinTaperY->set( taper_y ); |
800 | calcp->setVar(LLCalc::X_TAPER, taper_x); | ||
801 | calcp->setVar(LLCalc::Y_TAPER, taper_y); | ||
765 | 802 | ||
766 | // Radius offset. | 803 | // Radius offset. |
767 | F32 radius_offset = volume_params.getRadiusOffset(); | 804 | F32 radius_offset = volume_params.getRadiusOffset(); |
@@ -791,10 +828,12 @@ void LLPanelObject::getState( ) | |||
791 | } | 828 | } |
792 | } | 829 | } |
793 | mSpinRadiusOffset->set( radius_offset); | 830 | mSpinRadiusOffset->set( radius_offset); |
831 | calcp->setVar(LLCalc::RADIUS_OFFSET, radius_offset); | ||
794 | 832 | ||
795 | // Revolutions | 833 | // Revolutions |
796 | F32 revolutions = volume_params.getRevolutions(); | 834 | F32 revolutions = volume_params.getRevolutions(); |
797 | mSpinRevolutions->set( revolutions ); | 835 | mSpinRevolutions->set( revolutions ); |
836 | calcp->setVar(LLCalc::REVOLUTIONS, revolutions); | ||
798 | 837 | ||
799 | // Skew | 838 | // Skew |
800 | F32 skew = volume_params.getSkew(); | 839 | F32 skew = volume_params.getSkew(); |
@@ -819,6 +858,7 @@ void LLPanelObject::getState( ) | |||
819 | } | 858 | } |
820 | } | 859 | } |
821 | mSpinSkew->set( skew ); | 860 | mSpinSkew->set( skew ); |
861 | calcp->setVar(LLCalc::SKEW, skew); | ||
822 | } | 862 | } |
823 | 863 | ||
824 | // Compute control visibility, label names, and twist range. | 864 | // Compute control visibility, label names, and twist range. |
@@ -924,6 +964,8 @@ void LLPanelObject::getState( ) | |||
924 | case MI_RING: | 964 | case MI_RING: |
925 | mSpinScaleX->set( scale_x ); | 965 | mSpinScaleX->set( scale_x ); |
926 | mSpinScaleY->set( scale_y ); | 966 | mSpinScaleY->set( scale_y ); |
967 | calcp->setVar(LLCalc::X_HOLE, scale_x); | ||
968 | calcp->setVar(LLCalc::Y_HOLE, scale_y); | ||
927 | mSpinScaleX->setMinValue(OBJECT_MIN_HOLE_SIZE); | 969 | mSpinScaleX->setMinValue(OBJECT_MIN_HOLE_SIZE); |
928 | mSpinScaleX->setMaxValue(OBJECT_MAX_HOLE_SIZE_X); | 970 | mSpinScaleX->setMaxValue(OBJECT_MAX_HOLE_SIZE_X); |
929 | mSpinScaleY->setMinValue(OBJECT_MIN_HOLE_SIZE); | 971 | mSpinScaleY->setMinValue(OBJECT_MIN_HOLE_SIZE); |
@@ -934,6 +976,8 @@ void LLPanelObject::getState( ) | |||
934 | { | 976 | { |
935 | mSpinScaleX->set( 1.f - scale_x ); | 977 | mSpinScaleX->set( 1.f - scale_x ); |
936 | mSpinScaleY->set( 1.f - scale_y ); | 978 | mSpinScaleY->set( 1.f - scale_y ); |
979 | calcp->setVar(LLCalc::X_HOLE, 1.f - scale_x); | ||
980 | calcp->setVar(LLCalc::Y_HOLE, 1.f - scale_y); | ||
937 | mSpinScaleX->setMinValue(-1.f); | 981 | mSpinScaleX->setMinValue(-1.f); |
938 | mSpinScaleX->setMaxValue(1.f); | 982 | mSpinScaleX->setMaxValue(1.f); |
939 | mSpinScaleY->setMinValue(-1.f); | 983 | mSpinScaleY->setMinValue(-1.f); |
@@ -1148,7 +1192,7 @@ void LLPanelObject::getState( ) | |||
1148 | mSculptTextureRevert = LLUUID::null; | 1192 | mSculptTextureRevert = LLUUID::null; |
1149 | } | 1193 | } |
1150 | 1194 | ||
1151 | 1195 | ||
1152 | //---------------------------------------------------------------------------- | 1196 | //---------------------------------------------------------------------------- |
1153 | 1197 | ||
1154 | mObject = objectp; | 1198 | mObject = objectp; |
@@ -1913,6 +1957,8 @@ void LLPanelObject::clearCtrls() | |||
1913 | childSetEnabled( "advanced_cut", FALSE ); | 1957 | childSetEnabled( "advanced_cut", FALSE ); |
1914 | childSetEnabled( "advanced_dimple", FALSE ); | 1958 | childSetEnabled( "advanced_dimple", FALSE ); |
1915 | childSetVisible("advanced_slice", FALSE); | 1959 | childSetVisible("advanced_slice", FALSE); |
1960 | |||
1961 | childSetEnabled("build_math_constants",false); | ||
1916 | } | 1962 | } |
1917 | 1963 | ||
1918 | // | 1964 | // |
@@ -1954,6 +2000,9 @@ void LLPanelObject::onCommitRotation( LLUICtrl* ctrl, void* userdata ) | |||
1954 | LLPanelObject* self = (LLPanelObject*) userdata; | 2000 | LLPanelObject* self = (LLPanelObject*) userdata; |
1955 | BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ; | 2001 | BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ; |
1956 | self->sendRotation(btn_down); | 2002 | self->sendRotation(btn_down); |
2003 | |||
2004 | // Needed to ensure all rotations are shown consistently in range | ||
2005 | self->refresh(); | ||
1957 | } | 2006 | } |
1958 | 2007 | ||
1959 | // static | 2008 | // static |
@@ -2048,3 +2097,9 @@ void LLPanelObject::onCommitSculptType(LLUICtrl *ctrl, void* userdata) | |||
2048 | 2097 | ||
2049 | self->sendSculpt(); | 2098 | self->sendSculpt(); |
2050 | } | 2099 | } |
2100 | |||
2101 | // static | ||
2102 | void LLPanelObject::onClickBuildConstants(void *) | ||
2103 | { | ||
2104 | gViewerWindow->alertXml("ClickBuildConstants"); | ||
2105 | } | ||