diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/newview/llpanelobject.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/newview/llpanelobject.cpp')
-rw-r--r-- | linden/indra/newview/llpanelobject.cpp | 109 |
1 files changed, 89 insertions, 20 deletions
diff --git a/linden/indra/newview/llpanelobject.cpp b/linden/indra/newview/llpanelobject.cpp index 7024691..9022c14 100644 --- a/linden/indra/newview/llpanelobject.cpp +++ b/linden/indra/newview/llpanelobject.cpp | |||
@@ -99,7 +99,7 @@ enum { | |||
99 | }; | 99 | }; |
100 | 100 | ||
101 | //*TODO:translate (depricated, so very low priority) | 101 | //*TODO:translate (depricated, so very low priority) |
102 | static const LLString LEGACY_FULLBRIGHT_DESC("Fullbright (Legacy)"); | 102 | static const std::string LEGACY_FULLBRIGHT_DESC("Fullbright (Legacy)"); |
103 | 103 | ||
104 | BOOL LLPanelObject::postBuild() | 104 | BOOL LLPanelObject::postBuild() |
105 | { | 105 | { |
@@ -289,9 +289,12 @@ BOOL LLPanelObject::postBuild() | |||
289 | } | 289 | } |
290 | 290 | ||
291 | mLabelSculptType = getChild<LLTextBox>("label sculpt type"); | 291 | mLabelSculptType = getChild<LLTextBox>("label sculpt type"); |
292 | mCtrlSculptType = getChild<LLComboBox>( "sculpt type control"); | 292 | mCtrlSculptType = getChild<LLComboBox>("sculpt type control"); |
293 | childSetCommitCallback("sculpt type control", onCommitSculptType, this); | 293 | childSetCommitCallback("sculpt type control", onCommitSculptType, this); |
294 | 294 | mCtrlSculptMirror = getChild<LLCheckBoxCtrl>("sculpt mirror control"); | |
295 | childSetCommitCallback("sculpt mirror control", onCommitSculptType, this); | ||
296 | mCtrlSculptInvert = getChild<LLCheckBoxCtrl>("sculpt invert control"); | ||
297 | childSetCommitCallback("sculpt invert control", onCommitSculptType, this); | ||
295 | 298 | ||
296 | // Start with everyone disabled | 299 | // Start with everyone disabled |
297 | clearCtrls(); | 300 | clearCtrls(); |
@@ -429,7 +432,7 @@ void LLPanelObject::getState( ) | |||
429 | 432 | ||
430 | BOOL owners_identical; | 433 | BOOL owners_identical; |
431 | LLUUID owner_id; | 434 | LLUUID owner_id; |
432 | LLString owner_name; | 435 | std::string owner_name; |
433 | owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); | 436 | owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); |
434 | 437 | ||
435 | // BUG? Check for all objects being editable? | 438 | // BUG? Check for all objects being editable? |
@@ -538,7 +541,7 @@ void LLPanelObject::getState( ) | |||
538 | mComboMaterial->remove(LEGACY_FULLBRIGHT_DESC); | 541 | mComboMaterial->remove(LEGACY_FULLBRIGHT_DESC); |
539 | } | 542 | } |
540 | // *TODO:Translate | 543 | // *TODO:Translate |
541 | mComboMaterial->setSimple(LLString(LLMaterialTable::basic.getName(material_code))); | 544 | mComboMaterial->setSimple(std::string(LLMaterialTable::basic.getName(material_code))); |
542 | } | 545 | } |
543 | } | 546 | } |
544 | else | 547 | else |
@@ -1057,6 +1060,8 @@ void LLPanelObject::getState( ) | |||
1057 | mCtrlSculptTexture->setVisible(sculpt_texture_visible); | 1060 | mCtrlSculptTexture->setVisible(sculpt_texture_visible); |
1058 | mLabelSculptType->setVisible(sculpt_texture_visible); | 1061 | mLabelSculptType->setVisible(sculpt_texture_visible); |
1059 | mCtrlSculptType->setVisible(sculpt_texture_visible); | 1062 | mCtrlSculptType->setVisible(sculpt_texture_visible); |
1063 | mCtrlSculptMirror->setVisible(sculpt_texture_visible); | ||
1064 | mCtrlSculptInvert->setVisible(sculpt_texture_visible); | ||
1060 | 1065 | ||
1061 | 1066 | ||
1062 | // sculpt texture | 1067 | // sculpt texture |
@@ -1086,12 +1091,29 @@ void LLPanelObject::getState( ) | |||
1086 | mTextureCtrl->setImageAssetID(LLUUID::null); | 1091 | mTextureCtrl->setImageAssetID(LLUUID::null); |
1087 | } | 1092 | } |
1088 | 1093 | ||
1094 | U8 sculpt_type = sculpt_params->getSculptType(); | ||
1095 | U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK; | ||
1096 | BOOL sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; | ||
1097 | BOOL sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; | ||
1098 | |||
1089 | if (mCtrlSculptType) | 1099 | if (mCtrlSculptType) |
1090 | { | 1100 | { |
1091 | mCtrlSculptType->setCurrentByIndex(sculpt_params->getSculptType()); | 1101 | mCtrlSculptType->setCurrentByIndex(sculpt_stitching); |
1092 | mCtrlSculptType->setEnabled(editable); | 1102 | mCtrlSculptType->setEnabled(editable); |
1093 | } | 1103 | } |
1094 | 1104 | ||
1105 | if (mCtrlSculptMirror) | ||
1106 | { | ||
1107 | mCtrlSculptMirror->set(sculpt_mirror); | ||
1108 | mCtrlSculptMirror->setEnabled(editable); | ||
1109 | } | ||
1110 | |||
1111 | if (mCtrlSculptInvert) | ||
1112 | { | ||
1113 | mCtrlSculptInvert->set(sculpt_invert); | ||
1114 | mCtrlSculptInvert->setEnabled(editable); | ||
1115 | } | ||
1116 | |||
1095 | if (mLabelSculptType) | 1117 | if (mLabelSculptType) |
1096 | { | 1118 | { |
1097 | mLabelSculptType->setEnabled(TRUE); | 1119 | mLabelSculptType->setEnabled(TRUE); |
@@ -1191,10 +1213,10 @@ void LLPanelObject::onCommitMaterial( LLUICtrl* ctrl, void* userdata ) | |||
1191 | if (box) | 1213 | if (box) |
1192 | { | 1214 | { |
1193 | // apply the currently selected material to the object | 1215 | // apply the currently selected material to the object |
1194 | const LLString& material_name = box->getSimple(); | 1216 | const std::string& material_name = box->getSimple(); |
1195 | if (material_name != LEGACY_FULLBRIGHT_DESC) | 1217 | if (material_name != LEGACY_FULLBRIGHT_DESC) |
1196 | { | 1218 | { |
1197 | U8 material_code = LLMaterialTable::basic.getMCode(material_name.c_str()); | 1219 | U8 material_code = LLMaterialTable::basic.getMCode(material_name); |
1198 | LLSelectMgr::getInstance()->selectionSetMaterial(material_code); | 1220 | LLSelectMgr::getInstance()->selectionSetMaterial(material_code); |
1199 | } | 1221 | } |
1200 | } | 1222 | } |
@@ -1546,7 +1568,7 @@ void LLPanelObject::getVolumeParams(LLVolumeParams& volume_params) | |||
1546 | } | 1568 | } |
1547 | 1569 | ||
1548 | // BUG: Make work with multiple objects | 1570 | // BUG: Make work with multiple objects |
1549 | void LLPanelObject::sendRotation() | 1571 | void LLPanelObject::sendRotation(BOOL btn_down) |
1550 | { | 1572 | { |
1551 | if (mObject.isNull()) return; | 1573 | if (mObject.isNull()) return; |
1552 | 1574 | ||
@@ -1570,16 +1592,34 @@ void LLPanelObject::sendRotation() | |||
1570 | { | 1592 | { |
1571 | rotation = rotation * ~mRootObject->getRotationRegion(); | 1593 | rotation = rotation * ~mRootObject->getRotationRegion(); |
1572 | } | 1594 | } |
1595 | std::vector<LLVector3>& child_positions = mObject->mUnselectedChildrenPositions ; | ||
1596 | std::vector<LLQuaternion> child_rotations; | ||
1597 | if (mObject->isRootEdit()) | ||
1598 | { | ||
1599 | mObject->saveUnselectedChildrenRotation(child_rotations) ; | ||
1600 | mObject->saveUnselectedChildrenPosition(child_positions) ; | ||
1601 | } | ||
1573 | 1602 | ||
1574 | mObject->setRotation(rotation, TRUE ); | 1603 | mObject->setRotation(rotation); |
1604 | LLManip::rebuild(mObject) ; | ||
1575 | 1605 | ||
1576 | LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_ROTATION); | 1606 | // for individually selected roots, we need to counterrotate all the children |
1607 | if (mObject->isRootEdit()) | ||
1608 | { | ||
1609 | mObject->resetChildrenRotationAndPosition(child_rotations, child_positions) ; | ||
1610 | } | ||
1611 | |||
1612 | if(!btn_down) | ||
1613 | { | ||
1614 | child_positions.clear() ; | ||
1615 | LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_ROTATION | UPD_POSITION); | ||
1616 | } | ||
1577 | } | 1617 | } |
1578 | } | 1618 | } |
1579 | 1619 | ||
1580 | 1620 | ||
1581 | // BUG: Make work with multiple objects | 1621 | // BUG: Make work with multiple objects |
1582 | void LLPanelObject::sendScale() | 1622 | void LLPanelObject::sendScale(BOOL btn_down) |
1583 | { | 1623 | { |
1584 | if (mObject.isNull()) return; | 1624 | if (mObject.isNull()) return; |
1585 | 1625 | ||
@@ -1599,7 +1639,11 @@ void LLPanelObject::sendScale() | |||
1599 | } | 1639 | } |
1600 | 1640 | ||
1601 | mObject->setScale(newscale, TRUE); | 1641 | mObject->setScale(newscale, TRUE); |
1602 | LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_SCALE | UPD_POSITION); | 1642 | |
1643 | if(!btn_down) | ||
1644 | { | ||
1645 | LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_SCALE | UPD_POSITION); | ||
1646 | } | ||
1603 | 1647 | ||
1604 | LLSelectMgr::getInstance()->adjustTexturesByScale(TRUE, !dont_stretch_textures); | 1648 | LLSelectMgr::getInstance()->adjustTexturesByScale(TRUE, !dont_stretch_textures); |
1605 | // llinfos << "scale sent" << llendl; | 1649 | // llinfos << "scale sent" << llendl; |
@@ -1611,7 +1655,7 @@ void LLPanelObject::sendScale() | |||
1611 | } | 1655 | } |
1612 | 1656 | ||
1613 | 1657 | ||
1614 | void LLPanelObject::sendPosition() | 1658 | void LLPanelObject::sendPosition(BOOL btn_down) |
1615 | { | 1659 | { |
1616 | if (mObject.isNull()) return; | 1660 | if (mObject.isNull()) return; |
1617 | 1661 | ||
@@ -1654,7 +1698,7 @@ void LLPanelObject::sendPosition() | |||
1654 | LLVector3d delta = new_pos_global - old_pos_global; | 1698 | LLVector3d delta = new_pos_global - old_pos_global; |
1655 | // moved more than 1/2 millimeter | 1699 | // moved more than 1/2 millimeter |
1656 | if (delta.magVec() >= 0.0005f) | 1700 | if (delta.magVec() >= 0.0005f) |
1657 | { | 1701 | { |
1658 | if (mRootObject != mObject) | 1702 | if (mRootObject != mObject) |
1659 | { | 1703 | { |
1660 | newpos = newpos - mRootObject->getPositionRegion(); | 1704 | newpos = newpos - mRootObject->getPositionRegion(); |
@@ -1664,8 +1708,21 @@ void LLPanelObject::sendPosition() | |||
1664 | else | 1708 | else |
1665 | { | 1709 | { |
1666 | mObject->setPositionEdit(newpos); | 1710 | mObject->setPositionEdit(newpos); |
1711 | } | ||
1712 | |||
1713 | LLManip::rebuild(mObject) ; | ||
1714 | |||
1715 | // for individually selected roots, we need to counter-translate all unselected children | ||
1716 | if (mObject->isRootEdit()) | ||
1717 | { | ||
1718 | // only offset by parent's translation | ||
1719 | mObject->resetChildrenPosition(LLVector3(-delta), TRUE) ; | ||
1720 | } | ||
1721 | |||
1722 | if(!btn_down) | ||
1723 | { | ||
1724 | LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION); | ||
1667 | } | 1725 | } |
1668 | LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION); | ||
1669 | 1726 | ||
1670 | LLSelectMgr::getInstance()->updateSelectionCenter(); | 1727 | LLSelectMgr::getInstance()->updateSelectionCenter(); |
1671 | } | 1728 | } |
@@ -1690,9 +1747,18 @@ void LLPanelObject::sendSculpt() | |||
1690 | if (mCtrlSculptTexture) | 1747 | if (mCtrlSculptTexture) |
1691 | sculpt_params.setSculptTexture(mCtrlSculptTexture->getImageAssetID()); | 1748 | sculpt_params.setSculptTexture(mCtrlSculptTexture->getImageAssetID()); |
1692 | 1749 | ||
1750 | U8 sculpt_type = 0; | ||
1751 | |||
1693 | if (mCtrlSculptType) | 1752 | if (mCtrlSculptType) |
1694 | sculpt_params.setSculptType(mCtrlSculptType->getCurrentIndex()); | 1753 | sculpt_type |= mCtrlSculptType->getCurrentIndex(); |
1754 | |||
1755 | if ((mCtrlSculptMirror) && (mCtrlSculptMirror->get())) | ||
1756 | sculpt_type |= LL_SCULPT_FLAG_MIRROR; | ||
1757 | |||
1758 | if ((mCtrlSculptInvert) && (mCtrlSculptInvert->get())) | ||
1759 | sculpt_type |= LL_SCULPT_FLAG_INVERT; | ||
1695 | 1760 | ||
1761 | sculpt_params.setSculptType(sculpt_type); | ||
1696 | mObject->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE); | 1762 | mObject->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE); |
1697 | } | 1763 | } |
1698 | 1764 | ||
@@ -1846,21 +1912,24 @@ void LLPanelObject::onCommitLock(LLUICtrl *ctrl, void *data) | |||
1846 | void LLPanelObject::onCommitPosition( LLUICtrl* ctrl, void* userdata ) | 1912 | void LLPanelObject::onCommitPosition( LLUICtrl* ctrl, void* userdata ) |
1847 | { | 1913 | { |
1848 | LLPanelObject* self = (LLPanelObject*) userdata; | 1914 | LLPanelObject* self = (LLPanelObject*) userdata; |
1849 | self->sendPosition(); | 1915 | BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ; |
1916 | self->sendPosition(btn_down); | ||
1850 | } | 1917 | } |
1851 | 1918 | ||
1852 | // static | 1919 | // static |
1853 | void LLPanelObject::onCommitScale( LLUICtrl* ctrl, void* userdata ) | 1920 | void LLPanelObject::onCommitScale( LLUICtrl* ctrl, void* userdata ) |
1854 | { | 1921 | { |
1855 | LLPanelObject* self = (LLPanelObject*) userdata; | 1922 | LLPanelObject* self = (LLPanelObject*) userdata; |
1856 | self->sendScale(); | 1923 | BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ; |
1924 | self->sendScale(btn_down); | ||
1857 | } | 1925 | } |
1858 | 1926 | ||
1859 | // static | 1927 | // static |
1860 | void LLPanelObject::onCommitRotation( LLUICtrl* ctrl, void* userdata ) | 1928 | void LLPanelObject::onCommitRotation( LLUICtrl* ctrl, void* userdata ) |
1861 | { | 1929 | { |
1862 | LLPanelObject* self = (LLPanelObject*) userdata; | 1930 | LLPanelObject* self = (LLPanelObject*) userdata; |
1863 | self->sendRotation(); | 1931 | BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ; |
1932 | self->sendRotation(btn_down); | ||
1864 | } | 1933 | } |
1865 | 1934 | ||
1866 | // static | 1935 | // static |