aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanelobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llpanelobject.cpp')
-rw-r--r--linden/indra/newview/llpanelobject.cpp94
1 files changed, 90 insertions, 4 deletions
diff --git a/linden/indra/newview/llpanelobject.cpp b/linden/indra/newview/llpanelobject.cpp
index 01d41d2..5c70590 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,8 @@ 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);
376
368 S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); 377 S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
369 BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME )) 378 BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ))
370 && (selected_count == 1); 379 && (selected_count == 1);
@@ -383,12 +392,18 @@ void LLPanelObject::getState( )
383 mCtrlPosX->set( vec.mV[VX] ); 392 mCtrlPosX->set( vec.mV[VX] );
384 mCtrlPosY->set( vec.mV[VY] ); 393 mCtrlPosY->set( vec.mV[VY] );
385 mCtrlPosZ->set( vec.mV[VZ] ); 394 mCtrlPosZ->set( vec.mV[VZ] );
395 calcp->setVar(LLCalc::X_POS, vec.mV[VX]);
396 calcp->setVar(LLCalc::Y_POS, vec.mV[VY]);
397 calcp->setVar(LLCalc::Z_POS, vec.mV[VZ]);
386 } 398 }
387 else 399 else
388 { 400 {
389 mCtrlPosX->clear(); 401 mCtrlPosX->clear();
390 mCtrlPosY->clear(); 402 mCtrlPosY->clear();
391 mCtrlPosZ->clear(); 403 mCtrlPosZ->clear();
404 calcp->clearVar(LLCalc::X_POS);
405 calcp->clearVar(LLCalc::Y_POS);
406 calcp->clearVar(LLCalc::Z_POS);
392 } 407 }
393 408
394 409
@@ -403,12 +418,18 @@ void LLPanelObject::getState( )
403 mCtrlScaleX->set( vec.mV[VX] ); 418 mCtrlScaleX->set( vec.mV[VX] );
404 mCtrlScaleY->set( vec.mV[VY] ); 419 mCtrlScaleY->set( vec.mV[VY] );
405 mCtrlScaleZ->set( vec.mV[VZ] ); 420 mCtrlScaleZ->set( vec.mV[VZ] );
421 calcp->setVar(LLCalc::X_SCALE, vec.mV[VX]);
422 calcp->setVar(LLCalc::Y_SCALE, vec.mV[VY]);
423 calcp->setVar(LLCalc::Z_SCALE, vec.mV[VZ]);
406 } 424 }
407 else 425 else
408 { 426 {
409 mCtrlScaleX->clear(); 427 mCtrlScaleX->clear();
410 mCtrlScaleY->clear(); 428 mCtrlScaleY->clear();
411 mCtrlScaleZ->clear(); 429 mCtrlScaleZ->clear();
430 calcp->setVar(LLCalc::X_SCALE, 0.f);
431 calcp->setVar(LLCalc::Y_SCALE, 0.f);
432 calcp->setVar(LLCalc::Z_SCALE, 0.f);
412 } 433 }
413 434
414 mLabelSize->setEnabled( enable_scale ); 435 mLabelSize->setEnabled( enable_scale );
@@ -428,12 +449,18 @@ void LLPanelObject::getState( )
428 mCtrlRotX->set( mCurEulerDegrees.mV[VX] ); 449 mCtrlRotX->set( mCurEulerDegrees.mV[VX] );
429 mCtrlRotY->set( mCurEulerDegrees.mV[VY] ); 450 mCtrlRotY->set( mCurEulerDegrees.mV[VY] );
430 mCtrlRotZ->set( mCurEulerDegrees.mV[VZ] ); 451 mCtrlRotZ->set( mCurEulerDegrees.mV[VZ] );
452 calcp->setVar(LLCalc::X_ROT, mCurEulerDegrees.mV[VX]);
453 calcp->setVar(LLCalc::Y_ROT, mCurEulerDegrees.mV[VY]);
454 calcp->setVar(LLCalc::Z_ROT, mCurEulerDegrees.mV[VZ]);
431 } 455 }
432 else 456 else
433 { 457 {
434 mCtrlRotX->clear(); 458 mCtrlRotX->clear();
435 mCtrlRotY->clear(); 459 mCtrlRotY->clear();
436 mCtrlRotZ->clear(); 460 mCtrlRotZ->clear();
461 calcp->clearVar(LLCalc::X_ROT);
462 calcp->clearVar(LLCalc::Y_ROT);
463 calcp->clearVar(LLCalc::Z_ROT);
437 } 464 }
438 465
439 mLabelRotation->setEnabled( enable_rotate ); 466 mLabelRotation->setEnabled( enable_rotate );
@@ -686,8 +713,9 @@ void LLPanelObject::getState( )
686 F32 end_t = volume_params.getEndT(); 713 F32 end_t = volume_params.getEndT();
687 714
688 // Hollowness 715 // Hollowness
689 F32 hollow = volume_params.getHollow(); 716 F32 hollow = 100.f * volume_params.getHollow();
690 mSpinHollow->set( 100.f * hollow ); 717 mSpinHollow->set( hollow );
718 calcp->setVar(LLCalc::HOLLOW, hollow);
691 719
692 // All hollow objects allow a shape to be selected. 720 // All hollow objects allow a shape to be selected.
693 if (hollow > 0.f) 721 if (hollow > 0.f)
@@ -740,6 +768,10 @@ void LLPanelObject::getState( )
740 mSpinCutEnd ->set( cut_end ); 768 mSpinCutEnd ->set( cut_end );
741 mCtrlPathBegin ->set( adv_cut_begin ); 769 mCtrlPathBegin ->set( adv_cut_begin );
742 mCtrlPathEnd ->set( adv_cut_end ); 770 mCtrlPathEnd ->set( adv_cut_end );
771 calcp->setVar(LLCalc::CUT_BEGIN, cut_begin);
772 calcp->setVar(LLCalc::CUT_END, cut_end);
773 calcp->setVar(LLCalc::PATH_BEGIN, adv_cut_begin);
774 calcp->setVar(LLCalc::PATH_END, adv_cut_end);
743 775
744 // Twist 776 // Twist
745 F32 twist = volume_params.getTwist(); 777 F32 twist = volume_params.getTwist();
@@ -758,18 +790,24 @@ void LLPanelObject::getState( )
758 790
759 mSpinTwist ->set( twist ); 791 mSpinTwist ->set( twist );
760 mSpinTwistBegin ->set( twist_begin ); 792 mSpinTwistBegin ->set( twist_begin );
793 calcp->setVar(LLCalc::TWIST_END, twist);
794 calcp->setVar(LLCalc::TWIST_BEGIN, twist_begin);
761 795
762 // Shear 796 // Shear
763 F32 shear_x = volume_params.getShearX(); 797 F32 shear_x = volume_params.getShearX();
764 F32 shear_y = volume_params.getShearY(); 798 F32 shear_y = volume_params.getShearY();
765 mSpinShearX->set( shear_x ); 799 mSpinShearX->set( shear_x );
766 mSpinShearY->set( shear_y ); 800 mSpinShearY->set( shear_y );
801 calcp->setVar(LLCalc::X_SHEAR, shear_x);
802 calcp->setVar(LLCalc::Y_SHEAR, shear_y);
767 803
768 // Taper 804 // Taper
769 F32 taper_x = volume_params.getTaperX(); 805 F32 taper_x = volume_params.getTaperX();
770 F32 taper_y = volume_params.getTaperY(); 806 F32 taper_y = volume_params.getTaperY();
771 mSpinTaperX->set( taper_x ); 807 mSpinTaperX->set( taper_x );
772 mSpinTaperY->set( taper_y ); 808 mSpinTaperY->set( taper_y );
809 calcp->setVar(LLCalc::X_TAPER, taper_x);
810 calcp->setVar(LLCalc::Y_TAPER, taper_y);
773 811
774 // Radius offset. 812 // Radius offset.
775 F32 radius_offset = volume_params.getRadiusOffset(); 813 F32 radius_offset = volume_params.getRadiusOffset();
@@ -799,10 +837,12 @@ void LLPanelObject::getState( )
799 } 837 }
800 } 838 }
801 mSpinRadiusOffset->set( radius_offset); 839 mSpinRadiusOffset->set( radius_offset);
840 calcp->setVar(LLCalc::RADIUS_OFFSET, radius_offset);
802 841
803 // Revolutions 842 // Revolutions
804 F32 revolutions = volume_params.getRevolutions(); 843 F32 revolutions = volume_params.getRevolutions();
805 mSpinRevolutions->set( revolutions ); 844 mSpinRevolutions->set( revolutions );
845 calcp->setVar(LLCalc::REVOLUTIONS, revolutions);
806 846
807 // Skew 847 // Skew
808 F32 skew = volume_params.getSkew(); 848 F32 skew = volume_params.getSkew();
@@ -827,6 +867,7 @@ void LLPanelObject::getState( )
827 } 867 }
828 } 868 }
829 mSpinSkew->set( skew ); 869 mSpinSkew->set( skew );
870 calcp->setVar(LLCalc::SKEW, skew);
830 } 871 }
831 872
832 // Compute control visibility, label names, and twist range. 873 // Compute control visibility, label names, and twist range.
@@ -838,7 +879,7 @@ void LLPanelObject::getState( )
838 BOOL top_shear_x_visible = TRUE; 879 BOOL top_shear_x_visible = TRUE;
839 BOOL top_shear_y_visible = TRUE; 880 BOOL top_shear_y_visible = TRUE;
840 BOOL twist_visible = TRUE; 881 BOOL twist_visible = TRUE;
841 BOOL advanced_cut_visible = FALSE; 882 BOOL advanced_cut_visible = TRUE;
842 BOOL taper_visible = FALSE; 883 BOOL taper_visible = FALSE;
843 BOOL skew_visible = FALSE; 884 BOOL skew_visible = FALSE;
844 BOOL radius_offset_visible = FALSE; 885 BOOL radius_offset_visible = FALSE;
@@ -849,6 +890,7 @@ void LLPanelObject::getState( )
849 F32 twist_inc = OBJECT_TWIST_LINEAR_INC; 890 F32 twist_inc = OBJECT_TWIST_LINEAR_INC;
850 891
851 BOOL advanced_is_dimple = FALSE; 892 BOOL advanced_is_dimple = FALSE;
893 BOOL advanced_is_slice = FALSE;
852 BOOL size_is_hole = FALSE; 894 BOOL size_is_hole = FALSE;
853 895
854 // Tune based on overall volume type 896 // Tune based on overall volume type
@@ -862,6 +904,7 @@ void LLPanelObject::getState( )
862 //twist_visible = FALSE; 904 //twist_visible = FALSE;
863 advanced_cut_visible = TRUE; 905 advanced_cut_visible = TRUE;
864 advanced_is_dimple = TRUE; 906 advanced_is_dimple = TRUE;
907 advanced_is_slice = FALSE;
865 twist_min = OBJECT_TWIST_MIN; 908 twist_min = OBJECT_TWIST_MIN;
866 twist_max = OBJECT_TWIST_MAX; 909 twist_max = OBJECT_TWIST_MAX;
867 twist_inc = OBJECT_TWIST_INC; 910 twist_inc = OBJECT_TWIST_INC;
@@ -875,6 +918,7 @@ void LLPanelObject::getState( )
875 size_is_hole = TRUE; 918 size_is_hole = TRUE;
876 skew_visible = TRUE; 919 skew_visible = TRUE;
877 advanced_cut_visible = TRUE; 920 advanced_cut_visible = TRUE;
921 advanced_is_slice = FALSE;
878 taper_visible = TRUE; 922 taper_visible = TRUE;
879 radius_offset_visible = TRUE; 923 radius_offset_visible = TRUE;
880 revolutions_visible = TRUE; 924 revolutions_visible = TRUE;
@@ -902,8 +946,20 @@ void LLPanelObject::getState( )
902 break; 946 break;
903 947
904 case MI_BOX: 948 case MI_BOX:
949 advanced_cut_visible = TRUE;
950 advanced_is_slice = TRUE;
951 break;
952
905 case MI_CYLINDER: 953 case MI_CYLINDER:
954 advanced_cut_visible = TRUE;
955 advanced_is_slice = TRUE;
956 break;
957
906 case MI_PRISM: 958 case MI_PRISM:
959 advanced_cut_visible = TRUE;
960 advanced_is_slice = TRUE;
961 break;
962
907 default: 963 default:
908 break; 964 break;
909 } 965 }
@@ -917,6 +973,8 @@ void LLPanelObject::getState( )
917 case MI_RING: 973 case MI_RING:
918 mSpinScaleX->set( scale_x ); 974 mSpinScaleX->set( scale_x );
919 mSpinScaleY->set( scale_y ); 975 mSpinScaleY->set( scale_y );
976 calcp->setVar(LLCalc::X_HOLE, scale_x);
977 calcp->setVar(LLCalc::Y_HOLE, scale_y);
920 mSpinScaleX->setMinValue(OBJECT_MIN_HOLE_SIZE); 978 mSpinScaleX->setMinValue(OBJECT_MIN_HOLE_SIZE);
921 mSpinScaleX->setMaxValue(OBJECT_MAX_HOLE_SIZE_X); 979 mSpinScaleX->setMaxValue(OBJECT_MAX_HOLE_SIZE_X);
922 mSpinScaleY->setMinValue(OBJECT_MIN_HOLE_SIZE); 980 mSpinScaleY->setMinValue(OBJECT_MIN_HOLE_SIZE);
@@ -931,6 +989,14 @@ void LLPanelObject::getState( )
931 mSpinScaleX->setMaxValue(1.f); 989 mSpinScaleX->setMaxValue(1.f);
932 mSpinScaleY->setMinValue(-1.f); 990 mSpinScaleY->setMinValue(-1.f);
933 mSpinScaleY->setMaxValue(1.f); 991 mSpinScaleY->setMaxValue(1.f);
992
993 // Torus' Hole Size is Box/Cyl/Prism's Taper
994 calcp->setVar(LLCalc::X_TAPER, 1.f - scale_x);
995 calcp->setVar(LLCalc::Y_TAPER, 1.f - scale_y);
996
997 // Box/Cyl/Prism have no hole size
998 calcp->setVar(LLCalc::X_HOLE, 0.f);
999 calcp->setVar(LLCalc::Y_HOLE, 0.f);
934 } 1000 }
935 break; 1001 break;
936 } 1002 }
@@ -995,6 +1061,8 @@ void LLPanelObject::getState( )
995 1061
996 childSetVisible("advanced_cut", FALSE); 1062 childSetVisible("advanced_cut", FALSE);
997 childSetVisible("advanced_dimple", FALSE); 1063 childSetVisible("advanced_dimple", FALSE);
1064 childSetVisible("advanced_slice", FALSE);
1065
998 if (advanced_cut_visible) 1066 if (advanced_cut_visible)
999 { 1067 {
1000 if (advanced_is_dimple) 1068 if (advanced_is_dimple)
@@ -1002,6 +1070,12 @@ void LLPanelObject::getState( )
1002 childSetVisible("advanced_dimple", TRUE); 1070 childSetVisible("advanced_dimple", TRUE);
1003 childSetEnabled("advanced_dimple", enabled); 1071 childSetEnabled("advanced_dimple", enabled);
1004 } 1072 }
1073
1074 else if (advanced_is_slice)
1075 {
1076 childSetVisible("advanced_slice", TRUE);
1077 childSetEnabled("advanced_slice", enabled);
1078 }
1005 else 1079 else
1006 { 1080 {
1007 childSetVisible("advanced_cut", TRUE); 1081 childSetVisible("advanced_cut", TRUE);
@@ -1133,7 +1207,7 @@ void LLPanelObject::getState( )
1133 mSculptTextureRevert = LLUUID::null; 1207 mSculptTextureRevert = LLUUID::null;
1134 } 1208 }
1135 1209
1136 1210
1137 //---------------------------------------------------------------------------- 1211 //----------------------------------------------------------------------------
1138 1212
1139 mObject = objectp; 1213 mObject = objectp;
@@ -1897,6 +1971,9 @@ void LLPanelObject::clearCtrls()
1897 childSetEnabled("scale_taper", FALSE); 1971 childSetEnabled("scale_taper", FALSE);
1898 childSetEnabled( "advanced_cut", FALSE ); 1972 childSetEnabled( "advanced_cut", FALSE );
1899 childSetEnabled( "advanced_dimple", FALSE ); 1973 childSetEnabled( "advanced_dimple", FALSE );
1974 childSetVisible("advanced_slice", FALSE);
1975
1976 childSetEnabled("build_math_constants",false);
1900} 1977}
1901 1978
1902// 1979//
@@ -1938,6 +2015,9 @@ void LLPanelObject::onCommitRotation( LLUICtrl* ctrl, void* userdata )
1938 LLPanelObject* self = (LLPanelObject*) userdata; 2015 LLPanelObject* self = (LLPanelObject*) userdata;
1939 BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ; 2016 BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ;
1940 self->sendRotation(btn_down); 2017 self->sendRotation(btn_down);
2018
2019 // Needed to ensure all rotations are shown consistently in range
2020 self->refresh();
1941} 2021}
1942 2022
1943// static 2023// static
@@ -2032,3 +2112,9 @@ void LLPanelObject::onCommitSculptType(LLUICtrl *ctrl, void* userdata)
2032 2112
2033 self->sendSculpt(); 2113 self->sendSculpt();
2034} 2114}
2115
2116// static
2117void LLPanelObject::onClickBuildConstants(void *)
2118{
2119 gViewerWindow->alertXml("ClickBuildConstants");
2120}