aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llmanip.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llmanip.cpp')
-rw-r--r--linden/indra/newview/llmanip.cpp86
1 files changed, 81 insertions, 5 deletions
diff --git a/linden/indra/newview/llmanip.cpp b/linden/indra/newview/llmanip.cpp
index 53c74aa..fd24f6d 100644
--- a/linden/indra/newview/llmanip.cpp
+++ b/linden/indra/newview/llmanip.cpp
@@ -69,7 +69,11 @@ S32 LLManip::sMaxTimesShowHelpText = 5;
69F32 LLManip::sGridMaxSubdivisionLevel = 32.f; 69F32 LLManip::sGridMaxSubdivisionLevel = 32.f;
70F32 LLManip::sGridMinSubdivisionLevel = 1.f; 70F32 LLManip::sGridMinSubdivisionLevel = 1.f;
71LLVector2 LLManip::sTickLabelSpacing(60.f, 25.f); 71LLVector2 LLManip::sTickLabelSpacing(60.f, 25.f);
72 72bool LLManip::sActualRoot = false;// going to set these up in the main entry
73bool LLManip::sPivotPerc = false;
74F32 LLManip::sPivotX = 0.f;
75F32 LLManip::sPivotY = 0.f;
76F32 LLManip::sPivotZ = 0.f;
73 77
74//static 78//static
75void LLManip::rebuild(LLViewerObject* vobj) 79void LLManip::rebuild(LLViewerObject* vobj)
@@ -100,8 +104,48 @@ LLManip::LLManip( const std::string& name, LLToolComposite* composite )
100 mHighlightedPart(LL_NO_PART), 104 mHighlightedPart(LL_NO_PART),
101 mManipPart(LL_NO_PART) 105 mManipPart(LL_NO_PART)
102{ 106{
103} 107 initPivot();
104 108
109 gSavedSettings.getControl("BuildPrefs_ActualRoot")->getSignal()->connect(&updateActualRoot);
110 gSavedSettings.getControl("BuildPrefs_PivotIsPercent")->getSignal()->connect(&updatePivotIsPercent);
111 gSavedSettings.getControl("BuildPrefs_PivotX")->getSignal()->connect(&updatePivotX);
112 gSavedSettings.getControl("BuildPrefs_PivotY")->getSignal()->connect(&updatePivotY);
113 gSavedSettings.getControl("BuildPrefs_PivotZ")->getSignal()->connect(&updatePivotZ);
114}
115//static
116void LLManip::initPivot()
117{
118 sActualRoot = (bool)gSavedSettings.getBOOL("BuildPrefs_ActualRoot");
119 sPivotPerc = (bool)gSavedSettings.getBOOL("BuildPrefs_PivotIsPercent");
120 sPivotX = gSavedSettings.getF32("BuildPrefs_PivotX");
121 sPivotY = gSavedSettings.getF32("BuildPrefs_PivotY");
122 sPivotZ = gSavedSettings.getF32("BuildPrefs_PivotZ");
123}
124//static
125void LLManip::updateActualRoot(const LLSD &data)
126{
127 sActualRoot = (bool)data.asBoolean();
128}
129//static
130void LLManip::updatePivotIsPercent(const LLSD &data)
131{
132 sPivotPerc = (bool)data.asBoolean();
133}
134//static
135void LLManip::updatePivotX(const LLSD &data)
136{
137 sPivotX = (F32)data.asReal();
138}
139//static
140void LLManip::updatePivotY(const LLSD &data)
141{
142 sPivotY = (F32)data.asReal();
143}
144//static
145void LLManip::updatePivotZ(const LLSD &data)
146{
147 sPivotZ = (F32)data.asReal();
148}
105void LLManip::getManipNormal(LLViewerObject* object, EManipPart manip, LLVector3 &normal) 149void LLManip::getManipNormal(LLViewerObject* object, EManipPart manip, LLVector3 &normal)
106{ 150{
107 LLVector3 grid_origin; 151 LLVector3 grid_origin;
@@ -351,11 +395,43 @@ LLVector3 LLManip::getSavedPivotPoint() const
351 395
352LLVector3 LLManip::getPivotPoint() 396LLVector3 LLManip::getPivotPoint()
353{ 397{
354 if (mObjectSelection->getFirstObject() && mObjectSelection->getObjectCount() == 1 && mObjectSelection->getSelectType() != SELECT_TYPE_HUD) 398 LLVector3 pos;
399 LLVector3 scale;
400 LLQuaternion rot;// = mObjectSelection->getFirstObject()->getRotation();
401 if (mObjectSelection->getFirstRootObject(TRUE) && (mObjectSelection->getObjectCount() == 1 || sActualRoot) && mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
402 {
403 pos = mObjectSelection->getFirstRootObject(TRUE)->getPivotPositionAgent();
404 scale = mObjectSelection->getFirstRootObject(TRUE)->getScale();
405 rot = mObjectSelection->getFirstRootObject(TRUE)->getRotation();
406 }else
407 {
408 pos = LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent();
409 scale = LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal();
410 rot = LLSelectMgr::getInstance()->getBBoxOfSelection().getRotation();
411 }
412 if(sPivotPerc)
413 {
414
415 LLVector3 add(
416 (-scale[VX]*0.5) + (scale[VX]*(sPivotX*0.01)),
417 (-scale[VY]*0.5) + (scale[VY]*(sPivotY*0.01)),
418 (-scale[VZ]*0.5) + (scale[VZ]*(sPivotZ*0.01)));
419 add = add * rot;
420 pos = pos + add;
421 }else
355 { 422 {
356 return mObjectSelection->getFirstObject()->getPivotPositionAgent(); 423 //pos[VX] = pos[VX] + gSavedSettings.getF32("BuildPrefs_PivotX");
424 //pos[VY] = pos[VY] + gSavedSettings.getF32("BuildPrefs_PivotY");
425 //pos[VZ] = pos[VZ] + gSavedSettings.getF32("BuildPrefs_PivotZ");
426 LLVector3 add(
427 sPivotX,
428 sPivotY,
429 sPivotZ);
430 add = add * rot;
431 pos = pos + add;
357 } 432 }
358 return LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent(); 433 //pos = pos * rot;
434 return pos;
359} 435}
360 436
361 437