diff options
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 9732dac..cc9d969 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 |
@@ -1080,6 +1083,8 @@ void LLPanelObject::getState( ) | |||
1080 | mCtrlSculptTexture->setVisible(sculpt_texture_visible); | 1083 | mCtrlSculptTexture->setVisible(sculpt_texture_visible); |
1081 | mLabelSculptType->setVisible(sculpt_texture_visible); | 1084 | mLabelSculptType->setVisible(sculpt_texture_visible); |
1082 | mCtrlSculptType->setVisible(sculpt_texture_visible); | 1085 | mCtrlSculptType->setVisible(sculpt_texture_visible); |
1086 | mCtrlSculptMirror->setVisible(sculpt_texture_visible); | ||
1087 | mCtrlSculptInvert->setVisible(sculpt_texture_visible); | ||
1083 | 1088 | ||
1084 | 1089 | ||
1085 | // sculpt texture | 1090 | // sculpt texture |
@@ -1109,12 +1114,29 @@ void LLPanelObject::getState( ) | |||
1109 | mTextureCtrl->setImageAssetID(LLUUID::null); | 1114 | mTextureCtrl->setImageAssetID(LLUUID::null); |
1110 | } | 1115 | } |
1111 | 1116 | ||
1117 | U8 sculpt_type = sculpt_params->getSculptType(); | ||
1118 | U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK; | ||
1119 | BOOL sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; | ||
1120 | BOOL sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; | ||
1121 | |||
1112 | if (mCtrlSculptType) | 1122 | if (mCtrlSculptType) |
1113 | { | 1123 | { |
1114 | mCtrlSculptType->setCurrentByIndex(sculpt_params->getSculptType()); | 1124 | mCtrlSculptType->setCurrentByIndex(sculpt_stitching); |
1115 | mCtrlSculptType->setEnabled(editable); | 1125 | mCtrlSculptType->setEnabled(editable); |
1116 | } | 1126 | } |
1117 | 1127 | ||
1128 | if (mCtrlSculptMirror) | ||
1129 | { | ||
1130 | mCtrlSculptMirror->set(sculpt_mirror); | ||
1131 | mCtrlSculptMirror->setEnabled(editable); | ||
1132 | } | ||
1133 | |||
1134 | if (mCtrlSculptInvert) | ||
1135 | { | ||
1136 | mCtrlSculptInvert->set(sculpt_invert); | ||
1137 | mCtrlSculptInvert->setEnabled(editable); | ||
1138 | } | ||
1139 | |||
1118 | if (mLabelSculptType) | 1140 | if (mLabelSculptType) |
1119 | { | 1141 | { |
1120 | mLabelSculptType->setEnabled(TRUE); | 1142 | mLabelSculptType->setEnabled(TRUE); |
@@ -1214,10 +1236,10 @@ void LLPanelObject::onCommitMaterial( LLUICtrl* ctrl, void* userdata ) | |||
1214 | if (box) | 1236 | if (box) |
1215 | { | 1237 | { |
1216 | // apply the currently selected material to the object | 1238 | // apply the currently selected material to the object |
1217 | const LLString& material_name = box->getSimple(); | 1239 | const std::string& material_name = box->getSimple(); |
1218 | if (material_name != LEGACY_FULLBRIGHT_DESC) | 1240 | if (material_name != LEGACY_FULLBRIGHT_DESC) |
1219 | { | 1241 | { |
1220 | U8 material_code = LLMaterialTable::basic.getMCode(material_name.c_str()); | 1242 | U8 material_code = LLMaterialTable::basic.getMCode(material_name); |
1221 | LLSelectMgr::getInstance()->selectionSetMaterial(material_code); | 1243 | LLSelectMgr::getInstance()->selectionSetMaterial(material_code); |
1222 | } | 1244 | } |
1223 | } | 1245 | } |
@@ -1569,7 +1591,7 @@ void LLPanelObject::getVolumeParams(LLVolumeParams& volume_params) | |||
1569 | } | 1591 | } |
1570 | 1592 | ||
1571 | // BUG: Make work with multiple objects | 1593 | // BUG: Make work with multiple objects |
1572 | void LLPanelObject::sendRotation() | 1594 | void LLPanelObject::sendRotation(BOOL btn_down) |
1573 | { | 1595 | { |
1574 | if (mObject.isNull()) return; | 1596 | if (mObject.isNull()) return; |
1575 | 1597 | ||
@@ -1593,16 +1615,34 @@ void LLPanelObject::sendRotation() | |||
1593 | { | 1615 | { |
1594 | rotation = rotation * ~mRootObject->getRotationRegion(); | 1616 | rotation = rotation * ~mRootObject->getRotationRegion(); |
1595 | } | 1617 | } |
1618 | std::vector<LLVector3>& child_positions = mObject->mUnselectedChildrenPositions ; | ||
1619 | std::vector<LLQuaternion> child_rotations; | ||
1620 | if (mObject->isRootEdit()) | ||
1621 | { | ||
1622 | mObject->saveUnselectedChildrenRotation(child_rotations) ; | ||
1623 | mObject->saveUnselectedChildrenPosition(child_positions) ; | ||
1624 | } | ||
1596 | 1625 | ||
1597 | mObject->setRotation(rotation, TRUE ); | 1626 | mObject->setRotation(rotation); |
1627 | LLManip::rebuild(mObject) ; | ||
1598 | 1628 | ||
1599 | LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_ROTATION); | 1629 | // for individually selected roots, we need to counterrotate all the children |
1630 | if (mObject->isRootEdit()) | ||
1631 | { | ||
1632 | mObject->resetChildrenRotationAndPosition(child_rotations, child_positions) ; | ||
1633 | } | ||
1634 | |||
1635 | if(!btn_down) | ||
1636 | { | ||
1637 | child_positions.clear() ; | ||
1638 | LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_ROTATION | UPD_POSITION); | ||
1639 | } | ||
1600 | } | 1640 | } |
1601 | } | 1641 | } |
1602 | 1642 | ||
1603 | 1643 | ||
1604 | // BUG: Make work with multiple objects | 1644 | // BUG: Make work with multiple objects |
1605 | void LLPanelObject::sendScale() | 1645 | void LLPanelObject::sendScale(BOOL btn_down) |
1606 | { | 1646 | { |
1607 | if (mObject.isNull()) return; | 1647 | if (mObject.isNull()) return; |
1608 | 1648 | ||
@@ -1622,7 +1662,11 @@ void LLPanelObject::sendScale() | |||
1622 | } | 1662 | } |
1623 | 1663 | ||
1624 | mObject->setScale(newscale, TRUE); | 1664 | mObject->setScale(newscale, TRUE); |
1625 | LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_SCALE | UPD_POSITION); | 1665 | |
1666 | if(!btn_down) | ||
1667 | { | ||
1668 | LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_SCALE | UPD_POSITION); | ||
1669 | } | ||
1626 | 1670 | ||
1627 | LLSelectMgr::getInstance()->adjustTexturesByScale(TRUE, !dont_stretch_textures); | 1671 | LLSelectMgr::getInstance()->adjustTexturesByScale(TRUE, !dont_stretch_textures); |
1628 | // llinfos << "scale sent" << llendl; | 1672 | // llinfos << "scale sent" << llendl; |
@@ -1634,7 +1678,7 @@ void LLPanelObject::sendScale() | |||
1634 | } | 1678 | } |
1635 | 1679 | ||
1636 | 1680 | ||
1637 | void LLPanelObject::sendPosition() | 1681 | void LLPanelObject::sendPosition(BOOL btn_down) |
1638 | { | 1682 | { |
1639 | if (mObject.isNull()) return; | 1683 | if (mObject.isNull()) return; |
1640 | 1684 | ||
@@ -1677,7 +1721,7 @@ void LLPanelObject::sendPosition() | |||
1677 | LLVector3d delta = new_pos_global - old_pos_global; | 1721 | LLVector3d delta = new_pos_global - old_pos_global; |
1678 | // moved more than 1/2 millimeter | 1722 | // moved more than 1/2 millimeter |
1679 | if (delta.magVec() >= 0.0005f) | 1723 | if (delta.magVec() >= 0.0005f) |
1680 | { | 1724 | { |
1681 | if (mRootObject != mObject) | 1725 | if (mRootObject != mObject) |
1682 | { | 1726 | { |
1683 | newpos = newpos - mRootObject->getPositionRegion(); | 1727 | newpos = newpos - mRootObject->getPositionRegion(); |
@@ -1687,8 +1731,21 @@ void LLPanelObject::sendPosition() | |||
1687 | else | 1731 | else |
1688 | { | 1732 | { |
1689 | mObject->setPositionEdit(newpos); | 1733 | mObject->setPositionEdit(newpos); |
1734 | } | ||
1735 | |||
1736 | LLManip::rebuild(mObject) ; | ||
1737 | |||
1738 | // for individually selected roots, we need to counter-translate all unselected children | ||
1739 | if (mObject->isRootEdit()) | ||
1740 | { | ||
1741 | // only offset by parent's translation | ||
1742 | mObject->resetChildrenPosition(LLVector3(-delta), TRUE) ; | ||
1743 | } | ||
1744 | |||
1745 | if(!btn_down) | ||
1746 | { | ||
1747 | LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION); | ||
1690 | } | 1748 | } |
1691 | LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION); | ||
1692 | 1749 | ||
1693 | LLSelectMgr::getInstance()->updateSelectionCenter(); | 1750 | LLSelectMgr::getInstance()->updateSelectionCenter(); |
1694 | } | 1751 | } |
@@ -1713,9 +1770,18 @@ void LLPanelObject::sendSculpt() | |||
1713 | if (mCtrlSculptTexture) | 1770 | if (mCtrlSculptTexture) |
1714 | sculpt_params.setSculptTexture(mCtrlSculptTexture->getImageAssetID()); | 1771 | sculpt_params.setSculptTexture(mCtrlSculptTexture->getImageAssetID()); |
1715 | 1772 | ||
1773 | U8 sculpt_type = 0; | ||
1774 | |||
1716 | if (mCtrlSculptType) | 1775 | if (mCtrlSculptType) |
1717 | sculpt_params.setSculptType(mCtrlSculptType->getCurrentIndex()); | 1776 | sculpt_type |= mCtrlSculptType->getCurrentIndex(); |
1777 | |||
1778 | if ((mCtrlSculptMirror) && (mCtrlSculptMirror->get())) | ||
1779 | sculpt_type |= LL_SCULPT_FLAG_MIRROR; | ||
1780 | |||
1781 | if ((mCtrlSculptInvert) && (mCtrlSculptInvert->get())) | ||
1782 | sculpt_type |= LL_SCULPT_FLAG_INVERT; | ||
1718 | 1783 | ||
1784 | sculpt_params.setSculptType(sculpt_type); | ||
1719 | mObject->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE); | 1785 | mObject->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE); |
1720 | } | 1786 | } |
1721 | 1787 | ||
@@ -1870,21 +1936,24 @@ void LLPanelObject::onCommitLock(LLUICtrl *ctrl, void *data) | |||
1870 | void LLPanelObject::onCommitPosition( LLUICtrl* ctrl, void* userdata ) | 1936 | void LLPanelObject::onCommitPosition( LLUICtrl* ctrl, void* userdata ) |
1871 | { | 1937 | { |
1872 | LLPanelObject* self = (LLPanelObject*) userdata; | 1938 | LLPanelObject* self = (LLPanelObject*) userdata; |
1873 | self->sendPosition(); | 1939 | BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ; |
1940 | self->sendPosition(btn_down); | ||
1874 | } | 1941 | } |
1875 | 1942 | ||
1876 | // static | 1943 | // static |
1877 | void LLPanelObject::onCommitScale( LLUICtrl* ctrl, void* userdata ) | 1944 | void LLPanelObject::onCommitScale( LLUICtrl* ctrl, void* userdata ) |
1878 | { | 1945 | { |
1879 | LLPanelObject* self = (LLPanelObject*) userdata; | 1946 | LLPanelObject* self = (LLPanelObject*) userdata; |
1880 | self->sendScale(); | 1947 | BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ; |
1948 | self->sendScale(btn_down); | ||
1881 | } | 1949 | } |
1882 | 1950 | ||
1883 | // static | 1951 | // static |
1884 | void LLPanelObject::onCommitRotation( LLUICtrl* ctrl, void* userdata ) | 1952 | void LLPanelObject::onCommitRotation( LLUICtrl* ctrl, void* userdata ) |
1885 | { | 1953 | { |
1886 | LLPanelObject* self = (LLPanelObject*) userdata; | 1954 | LLPanelObject* self = (LLPanelObject*) userdata; |
1887 | self->sendRotation(); | 1955 | BOOL btn_down = ((LLSpinCtrl*)ctrl)->isMouseHeldDown() ; |
1956 | self->sendRotation(btn_down); | ||
1888 | } | 1957 | } |
1889 | 1958 | ||
1890 | // static | 1959 | // static |