aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanelobject.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:57 -0500
committerJacek Antonelli2008-08-15 23:44:57 -0500
commitda68d3a57ecb27eba5d7efb8ff77d9640c0be65e (patch)
treef2fa2b9ed6e8cf49c8a3cb2a1893c4e5c61916a1 /linden/indra/newview/llpanelobject.cpp
parentSecond Life viewer sources 1.15.1.3 (diff)
downloadmeta-impy-da68d3a57ecb27eba5d7efb8ff77d9640c0be65e.zip
meta-impy-da68d3a57ecb27eba5d7efb8ff77d9640c0be65e.tar.gz
meta-impy-da68d3a57ecb27eba5d7efb8ff77d9640c0be65e.tar.bz2
meta-impy-da68d3a57ecb27eba5d7efb8ff77d9640c0be65e.tar.xz
Second Life viewer sources 1.16.0.5
Diffstat (limited to 'linden/indra/newview/llpanelobject.cpp')
-rw-r--r--linden/indra/newview/llpanelobject.cpp199
1 files changed, 199 insertions, 0 deletions
diff --git a/linden/indra/newview/llpanelobject.cpp b/linden/indra/newview/llpanelobject.cpp
index fb740a4..9fe94f9 100644
--- a/linden/indra/newview/llpanelobject.cpp
+++ b/linden/indra/newview/llpanelobject.cpp
@@ -53,6 +53,7 @@
53#include "llresmgr.h" 53#include "llresmgr.h"
54#include "llselectmgr.h" 54#include "llselectmgr.h"
55#include "llspinctrl.h" 55#include "llspinctrl.h"
56#include "lltexturectrl.h"
56#include "lltextbox.h" 57#include "lltextbox.h"
57#include "lltool.h" 58#include "lltool.h"
58#include "lltoolcomp.h" 59#include "lltoolcomp.h"
@@ -80,6 +81,7 @@ enum {
80 MI_TORUS, 81 MI_TORUS,
81 MI_TUBE, 82 MI_TUBE,
82 MI_RING, 83 MI_RING,
84 MI_SCULPT,
83 MI_NONE, 85 MI_NONE,
84 MI_VOLUME_COUNT 86 MI_VOLUME_COUNT
85}; 87};
@@ -252,6 +254,34 @@ BOOL LLPanelObject::postBuild()
252 childSetCommitCallback("Revolutions",onCommitParametric,this); 254 childSetCommitCallback("Revolutions",onCommitParametric,this);
253 mSpinRevolutions->setValidateBeforeCommit( &precommitValidate ); 255 mSpinRevolutions->setValidateBeforeCommit( &precommitValidate );
254 256
257 // Sculpt
258 mCtrlSculptTexture = LLUICtrlFactory::getTexturePickerByName(this,"sculpt texture control");
259 mCtrlSculptTexture->setDefaultImageAssetID(LLUUID(SCULPT_DEFAULT_TEXTURE));
260 mCtrlSculptTexture->setCommitCallback( LLPanelObject::onCommitSculpt );
261 mCtrlSculptTexture->setOnCancelCallback( LLPanelObject::onCancelSculpt );
262 mCtrlSculptTexture->setOnSelectCallback( LLPanelObject::onSelectSculpt );
263 mCtrlSculptTexture->setDropCallback(LLPanelObject::onDropSculpt);
264 mCtrlSculptTexture->setCallbackUserData( this );
265 // Don't allow (no copy) or (no transfer) textures to be selected during immediate mode
266 mCtrlSculptTexture->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
267 // Allow any texture to be used during non-immediate mode.
268 mCtrlSculptTexture->setNonImmediateFilterPermMask(PERM_NONE);
269 LLAggregatePermissions texture_perms;
270 if (gSelectMgr->selectGetAggregateTexturePermissions(texture_perms))
271 {
272 BOOL can_copy =
273 texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_EMPTY ||
274 texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_ALL;
275 BOOL can_transfer =
276 texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_EMPTY ||
277 texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_ALL;
278 mCtrlSculptTexture->setCanApplyImmediately(can_copy && can_transfer);
279 }
280 else
281 {
282 mCtrlSculptTexture->setCanApplyImmediately(FALSE);
283 }
284
255 // Start with everyone disabled 285 // Start with everyone disabled
256 clearCtrls(); 286 clearCtrls();
257 287
@@ -603,6 +633,14 @@ void LLPanelObject::getState( )
603 llinfos << "Unknown path " << (S32) path << " profile " << (S32) profile << " in getState" << llendl; 633 llinfos << "Unknown path " << (S32) path << " profile " << (S32) profile << " in getState" << llendl;
604 selected_item = MI_BOX; 634 selected_item = MI_BOX;
605 } 635 }
636
637
638 if (objectp->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT))
639 {
640 selected_item = MI_SCULPT;
641 }
642
643
606 mComboBaseType ->setCurrentByIndex( selected_item ); 644 mComboBaseType ->setCurrentByIndex( selected_item );
607 mSelectedType = selected_item; 645 mSelectedType = selected_item;
608 646
@@ -760,6 +798,8 @@ void LLPanelObject::getState( )
760 798
761 // Compute control visibility, label names, and twist range. 799 // Compute control visibility, label names, and twist range.
762 // Start with defaults. 800 // Start with defaults.
801 BOOL cut_visible = TRUE;
802 BOOL hollow_visible = TRUE;
763 BOOL top_size_x_visible = TRUE; 803 BOOL top_size_x_visible = TRUE;
764 BOOL top_size_y_visible = TRUE; 804 BOOL top_size_y_visible = TRUE;
765 BOOL top_shear_x_visible = TRUE; 805 BOOL top_shear_x_visible = TRUE;
@@ -770,6 +810,7 @@ void LLPanelObject::getState( )
770 BOOL skew_visible = FALSE; 810 BOOL skew_visible = FALSE;
771 BOOL radius_offset_visible = FALSE; 811 BOOL radius_offset_visible = FALSE;
772 BOOL revolutions_visible = FALSE; 812 BOOL revolutions_visible = FALSE;
813 BOOL sculpt_texture_visible = FALSE;
773 F32 twist_min = OBJECT_TWIST_LINEAR_MIN; 814 F32 twist_min = OBJECT_TWIST_LINEAR_MIN;
774 F32 twist_max = OBJECT_TWIST_LINEAR_MAX; 815 F32 twist_max = OBJECT_TWIST_LINEAR_MAX;
775 F32 twist_inc = OBJECT_TWIST_LINEAR_INC; 816 F32 twist_inc = OBJECT_TWIST_LINEAR_INC;
@@ -809,6 +850,23 @@ void LLPanelObject::getState( )
809 twist_inc = OBJECT_TWIST_INC; 850 twist_inc = OBJECT_TWIST_INC;
810 851
811 break; 852 break;
853
854 case MI_SCULPT:
855 cut_visible = FALSE;
856 hollow_visible = FALSE;
857 twist_visible = FALSE;
858 top_size_x_visible = FALSE;
859 top_size_y_visible = FALSE;
860 top_shear_x_visible = FALSE;
861 top_shear_y_visible = FALSE;
862 skew_visible = FALSE;
863 advanced_cut_visible = FALSE;
864 taper_visible = FALSE;
865 radius_offset_visible = FALSE;
866 revolutions_visible = FALSE;
867 sculpt_texture_visible = TRUE;
868
869 break;
812 870
813 case MI_BOX: 871 case MI_BOX:
814 case MI_CYLINDER: 872 case MI_CYLINDER:
@@ -929,6 +987,15 @@ void LLPanelObject::getState( )
929 mSpinRevolutions ->setEnabled( enabled ); 987 mSpinRevolutions ->setEnabled( enabled );
930 988
931 // Update field visibility 989 // Update field visibility
990 mLabelCut ->setVisible( cut_visible );
991 mSpinCutBegin ->setVisible( cut_visible );
992 mSpinCutEnd ->setVisible( cut_visible );
993
994 mLabelHollow ->setVisible( hollow_visible );
995 mSpinHollow ->setVisible( hollow_visible );
996 mLabelHoleType ->setVisible( hollow_visible );
997 mComboHoleType ->setVisible( hollow_visible );
998
932 mLabelTwist ->setVisible( twist_visible ); 999 mLabelTwist ->setVisible( twist_visible );
933 mSpinTwist ->setVisible( twist_visible ); 1000 mSpinTwist ->setVisible( twist_visible );
934 mSpinTwistBegin ->setVisible( twist_visible ); 1001 mSpinTwistBegin ->setVisible( twist_visible );
@@ -962,6 +1029,30 @@ void LLPanelObject::getState( )
962 mLabelRevolutions->setVisible( revolutions_visible ); 1029 mLabelRevolutions->setVisible( revolutions_visible );
963 mSpinRevolutions ->setVisible( revolutions_visible ); 1030 mSpinRevolutions ->setVisible( revolutions_visible );
964 1031
1032 mCtrlSculptTexture->setVisible( sculpt_texture_visible );
1033
1034
1035 // sculpt texture
1036
1037 if (selected_item == MI_SCULPT)
1038 {
1039 LLUUID id;
1040 LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
1041
1042 LLTextureCtrl* mTextureCtrl = LLViewerUICtrlFactory::getTexturePickerByName(this,"sculpt texture control");
1043 if((mTextureCtrl) && (sculpt_params))
1044 {
1045 mTextureCtrl->setTentative(FALSE);
1046 mTextureCtrl->setEnabled(editable);
1047 mTextureCtrl->setImageAssetID(sculpt_params->getSculptTexture());
1048
1049 if (mObject != objectp) // we've just selected a new object, so save for undo
1050 mSculptTextureRevert = sculpt_params->getSculptTexture();
1051 }
1052
1053 }
1054
1055
965 //---------------------------------------------------------------------------- 1056 //----------------------------------------------------------------------------
966 1057
967 mObject = objectp; 1058 mObject = objectp;
@@ -1083,9 +1174,26 @@ void LLPanelObject::onCommitParametric( LLUICtrl* ctrl, void* userdata )
1083 LLVolumeParams volume_params; 1174 LLVolumeParams volume_params;
1084 self->getVolumeParams(volume_params); 1175 self->getVolumeParams(volume_params);
1085 1176
1177
1178
1179 // set sculpting
1180 S32 selected_type = self->mComboBaseType->getCurrentIndex();
1181
1182 if (selected_type == MI_SCULPT)
1183 {
1184 self->mObject->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, TRUE, TRUE);
1185 }
1186 else
1187 {
1188 LLSculptParams *sculpt_params = (LLSculptParams *)self->mObject->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
1189 if (sculpt_params)
1190 self->mObject->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, FALSE, TRUE);
1191 }
1192
1086 // Update the volume, if necessary. 1193 // Update the volume, if necessary.
1087 self->mObject->updateVolume(volume_params); 1194 self->mObject->updateVolume(volume_params);
1088 1195
1196
1089 // This was added to make sure thate when changes are made, the UI 1197 // This was added to make sure thate when changes are made, the UI
1090 // adjusts to present valid options. 1198 // adjusts to present valid options.
1091 // *FIX: only some changes, ie, hollow or primitive type changes, 1199 // *FIX: only some changes, ie, hollow or primitive type changes,
@@ -1138,6 +1246,11 @@ void LLPanelObject::getVolumeParams(LLVolumeParams& volume_params)
1138 path = LL_PCODE_PATH_CIRCLE; 1246 path = LL_PCODE_PATH_CIRCLE;
1139 break; 1247 break;
1140 1248
1249 case MI_SCULPT:
1250 profile = LL_PCODE_PROFILE_CIRCLE;
1251 path = LL_PCODE_PATH_CIRCLE;
1252 break;
1253
1141 default: 1254 default:
1142 llwarns << "Unknown base type " << selected_type 1255 llwarns << "Unknown base type " << selected_type
1143 << " in getVolumeParams()" << llendl; 1256 << " in getVolumeParams()" << llendl;
@@ -1148,6 +1261,7 @@ void LLPanelObject::getVolumeParams(LLVolumeParams& volume_params)
1148 break; 1261 break;
1149 } 1262 }
1150 1263
1264
1151 if (path == LL_PCODE_PATH_LINE) 1265 if (path == LL_PCODE_PATH_LINE)
1152 { 1266 {
1153 LLVOVolume *volobjp = (LLVOVolume *)(LLViewerObject*)(mObject); 1267 LLVOVolume *volobjp = (LLVOVolume *)(LLViewerObject*)(mObject);
@@ -1358,6 +1472,23 @@ void LLPanelObject::getVolumeParams(LLVolumeParams& volume_params)
1358 F32 shear_x = mSpinShearX->get(); 1472 F32 shear_x = mSpinShearX->get();
1359 F32 shear_y = mSpinShearY->get(); 1473 F32 shear_y = mSpinShearY->get();
1360 volume_params.setShear( shear_x, shear_y ); 1474 volume_params.setShear( shear_x, shear_y );
1475
1476 if (selected_type == MI_SCULPT)
1477 {
1478 volume_params.setSculptID(LLUUID::null, 0);
1479 volume_params.setBeginAndEndT (0, 1);
1480 volume_params.setBeginAndEndS (0, 1);
1481 volume_params.setHollow (0);
1482 volume_params.setTwistBegin (0);
1483 volume_params.setTwistEnd (0);
1484 volume_params.setRatio (1, 0.5);
1485 volume_params.setShear (0, 0);
1486 volume_params.setTaper (0, 0);
1487 volume_params.setRevolutions (1);
1488 volume_params.setRadiusOffset (0);
1489 volume_params.setSkew (0);
1490 }
1491
1361} 1492}
1362 1493
1363// BUG: Make work with multiple objects 1494// BUG: Make work with multiple objects
@@ -1502,6 +1633,18 @@ void LLPanelObject::sendPosition()
1502 } 1633 }
1503} 1634}
1504 1635
1636void LLPanelObject::sendSculpt()
1637{
1638 LLTextureCtrl* mTextureCtrl = gUICtrlFactory->getTexturePickerByName(this,"sculpt texture control");
1639 if(!mTextureCtrl)
1640 return;
1641
1642 LLSculptParams sculpt_params;
1643 sculpt_params.setSculptTexture(mTextureCtrl->getImageAssetID());
1644 sculpt_params.setSculptType(LL_SCULPT_TYPE_SPHERE);
1645
1646 mObject->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE);
1647}
1505 1648
1506void LLPanelObject::refresh() 1649void LLPanelObject::refresh()
1507{ 1650{
@@ -1697,3 +1840,59 @@ void LLPanelObject::onCommitCastShadows( LLUICtrl* ctrl, void* userdata )
1697 LLPanelObject* self = (LLPanelObject*) userdata; 1840 LLPanelObject* self = (LLPanelObject*) userdata;
1698 self->sendCastShadows(); 1841 self->sendCastShadows();
1699} 1842}
1843
1844
1845// static
1846void LLPanelObject::onSelectSculpt(LLUICtrl* ctrl, void* userdata)
1847{
1848 LLPanelObject* self = (LLPanelObject*) userdata;
1849
1850 LLTextureCtrl* mTextureCtrl = gUICtrlFactory->getTexturePickerByName(self, "sculpt texture control");
1851
1852 if (mTextureCtrl)
1853 self->mSculptTextureRevert = mTextureCtrl->getImageAssetID();
1854
1855 self->sendSculpt();
1856}
1857
1858
1859void LLPanelObject::onCommitSculpt( LLUICtrl* ctrl, void* userdata )
1860{
1861 LLPanelObject* self = (LLPanelObject*) userdata;
1862
1863 self->sendSculpt();
1864}
1865
1866// static
1867BOOL LLPanelObject::onDropSculpt(LLUICtrl*, LLInventoryItem* item, void* userdata)
1868{
1869 LLPanelObject* self = (LLPanelObject*) userdata;
1870
1871 LLTextureCtrl* mTextureCtrl = gUICtrlFactory->getTexturePickerByName(self, "sculpt texture control");
1872
1873 if (mTextureCtrl)
1874 {
1875 LLUUID asset = item->getAssetUUID();
1876
1877 mTextureCtrl->setImageAssetID(asset);
1878 self->mSculptTextureRevert = asset;
1879 }
1880
1881
1882 return TRUE;
1883}
1884
1885
1886// static
1887void LLPanelObject::onCancelSculpt(LLUICtrl* ctrl, void* userdata)
1888{
1889 LLPanelObject* self = (LLPanelObject*) userdata;
1890
1891 LLTextureCtrl* mTextureCtrl = gUICtrlFactory->getTexturePickerByName(self,"sculpt texture control");
1892 if(!mTextureCtrl)
1893 return;
1894
1895 mTextureCtrl->setImageAssetID(self->mSculptTextureRevert);
1896
1897 self->sendSculpt();
1898}