summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorangela <angela@lindenlab.com>2009-11-19 15:02:05 +0800
committerangela <angela@lindenlab.com>2009-11-19 15:02:05 +0800
commitb6ad65c04edc6e79637bf8ac9daf40b3654d80a6 (patch)
treee299265bc9fb33ca937ed3445703f83a28b1b877
parent6e5f529a7adb53fa021986aed6e6b1b229cc0efd (diff)
EXT-2094 Add click-to-zoom as a one-click settable option for objects
-rw-r--r--indra/llcommon/llclickaction.h11
-rw-r--r--indra/lscript/lscript_compile/indra.l2
-rw-r--r--indra/newview/app_settings/keywords.ini2
-rw-r--r--indra/newview/llpanelpermissions.cpp71
-rw-r--r--indra/newview/lltoolpie.cpp30
-rw-r--r--indra/newview/skins/default/xui/en/floater_tools.xml8
6 files changed, 101 insertions, 23 deletions
diff --git a/indra/llcommon/llclickaction.h b/indra/llcommon/llclickaction.h
index 29c4df8df2..d4ffbf8634 100644
--- a/indra/llcommon/llclickaction.h
+++ b/indra/llcommon/llclickaction.h
@@ -33,16 +33,15 @@
#ifndef LL_LLCLICKACTION_H
#define LL_LLCLICKACTION_H
-
+// DO NOT CHANGE THE SEQUENCE OF THIS LIST!!
const U8 CLICK_ACTION_NONE = 0;
const U8 CLICK_ACTION_TOUCH = 0;
const U8 CLICK_ACTION_SIT = 1;
const U8 CLICK_ACTION_BUY = 2;
const U8 CLICK_ACTION_PAY = 3;
const U8 CLICK_ACTION_OPEN = 4;
-const U8 CLICK_ACTION_ZOOM = 5;
-const U8 CLICK_ACTION_PLAY = 6;
-const U8 CLICK_ACTION_OPEN_MEDIA = 7;
-
-
+const U8 CLICK_ACTION_PLAY = 5;
+const U8 CLICK_ACTION_OPEN_MEDIA = 6;
+const U8 CLICK_ACTION_ZOOM = 7;
+// DO NOT CHANGE THE SEQUENCE OF THIS LIST!!
#endif
diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l
index e650c71bea..8fe9f5ed29 100644
--- a/indra/lscript/lscript_compile/indra.l
+++ b/indra/lscript/lscript_compile/indra.l
@@ -611,9 +611,9 @@ extern "C" { int yyerror(const char *fmt, ...); }
"CLICK_ACTION_BUY" { count(); yylval.ival = CLICK_ACTION_BUY; return(INTEGER_CONSTANT); }
"CLICK_ACTION_PAY" { count(); yylval.ival = CLICK_ACTION_PAY; return(INTEGER_CONSTANT); }
"CLICK_ACTION_OPEN" { count(); yylval.ival = CLICK_ACTION_OPEN; return(INTEGER_CONSTANT); }
-"CLICK_ACTION_ZOOM" { count(); yylval.ival = CLICK_ACTION_ZOOM; return(INTEGER_CONSTANT); }
"CLICK_ACTION_PLAY" { count(); yylval.ival = CLICK_ACTION_PLAY; return(INTEGER_CONSTANT); }
"CLICK_ACTION_OPEN_MEDIA" { count(); yylval.ival = CLICK_ACTION_OPEN_MEDIA; return(INTEGER_CONSTANT); }
+"CLICK_ACTION_ZOOM" { count(); yylval.ival = CLICK_ACTION_ZOOM; return(INTEGER_CONSTANT); }
"TEXTURE_BLANK" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "5748decc-f629-461c-9a36-a35a221fe21f"); return(STRING_CONSTANT); }
"TEXTURE_DEFAULT" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "89556747-24cb-43ed-920b-47caed15465f"); return(STRING_CONSTANT); }
diff --git a/indra/newview/app_settings/keywords.ini b/indra/newview/app_settings/keywords.ini
index 71ea12bacd..14025c8061 100644
--- a/indra/newview/app_settings/keywords.ini
+++ b/indra/newview/app_settings/keywords.ini
@@ -508,9 +508,9 @@ CLICK_ACTION_SIT Used with llSetClickAction to set sit as the default act
CLICK_ACTION_BUY Used with llSetClickAction to set buy as the default action when object is clicked
CLICK_ACTION_PAY Used with llSetClickAction to set pay as the default action when object is clicked
CLICK_ACTION_OPEN Used with llSetClickAction to set open as the default action when object is clicked
-CLICK_ACTION_ZOOM Used with llSetClickAction to set zoom in as the default action when object is clicked
CLICK_ACTION_PLAY Used with llSetClickAction to set play as the default action when object is clicked
CLICK_ACTION_OPEN_MEDIA Used with llSetClickAction to set open-media as the default action when object is clicked
+CLICK_ACTION_ZOOM Used with llSetClickAction to set zoom in as the default action when object is clicked
TOUCH_INVALID_TEXCOORD Value returned by llDetectedTouchUV() and llDetectedTouchST() when the touch position is not valid.
TOUCH_INVALID_VECTOR Value returned by llDetectedTouchPos(), llDetectedTouchNormal(), and llDetectedTouchBinormal() when the touch position is not valid.
diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp
index 0dc010e2e7..d8e0d91d88 100644
--- a/indra/newview/llpanelpermissions.cpp
+++ b/indra/newview/llpanelpermissions.cpp
@@ -66,6 +66,65 @@
#include "roles_constants.h"
#include "llgroupactions.h"
+
+U8 string_value_to_click_action(std::string p_value);
+std::string click_action_to_string_value( U8 action);
+
+U8 string_value_to_click_action(std::string p_value)
+{
+ if(p_value == "Touch")
+ {
+ return CLICK_ACTION_TOUCH;
+ }
+ if(p_value == "Sit")
+ {
+ return CLICK_ACTION_SIT;
+ }
+ if(p_value == "Buy")
+ {
+ return CLICK_ACTION_BUY;
+ }
+ if(p_value == "Pay")
+ {
+ return CLICK_ACTION_PAY;
+ }
+ if(p_value == "Open")
+ {
+ return CLICK_ACTION_OPEN;
+ }
+ if(p_value == "Zoom")
+ {
+ return CLICK_ACTION_ZOOM;
+ }
+ return CLICK_ACTION_TOUCH;
+}
+
+std::string click_action_to_string_value( U8 action)
+{
+ switch (action)
+ {
+ case CLICK_ACTION_TOUCH:
+ default:
+ return "Touch";
+ break;
+ case CLICK_ACTION_SIT:
+ return "Sit";
+ break;
+ case CLICK_ACTION_BUY:
+ return "Buy";
+ break;
+ case CLICK_ACTION_PAY:
+ return "Pay";
+ break;
+ case CLICK_ACTION_OPEN:
+ return "Open";
+ break;
+ case CLICK_ACTION_ZOOM:
+ return "Zoom";
+ break;
+ }
+}
+
///----------------------------------------------------------------------------
/// Class llpanelpermissions
///----------------------------------------------------------------------------
@@ -774,7 +833,8 @@ void LLPanelPermissions::refresh()
LLComboBox* ComboClickAction = getChild<LLComboBox>("clickaction");
if(ComboClickAction)
{
- ComboClickAction->setCurrentByIndex((S32)click_action);
+ std::string combo_value = click_action_to_string_value(click_action);
+ ComboClickAction->setValue(LLSD(combo_value));
}
}
childSetEnabled("label click action",is_perm_modify && all_volume);
@@ -1015,8 +1075,9 @@ void LLPanelPermissions::onCommitClickAction(LLUICtrl* ctrl, void*)
{
LLComboBox* box = (LLComboBox*)ctrl;
if (!box) return;
-
- U8 click_action = (U8)box->getCurrentIndex();
+ std::string value = box->getValue().asString();
+ U8 click_action = string_value_to_click_action(value);
+
if (click_action == CLICK_ACTION_BUY)
{
LLSaleInfo sale_info;
@@ -1028,8 +1089,8 @@ void LLPanelPermissions::onCommitClickAction(LLUICtrl* ctrl, void*)
// Set click action back to its old value
U8 click_action = 0;
LLSelectMgr::getInstance()->selectionGetClickAction(&click_action);
- box->setCurrentByIndex((S32)click_action);
-
+ std::string item_value = click_action_to_string_value(click_action);
+ box->setValue(LLSD(item_value));
return;
}
}
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index d0350507ed..5ed8dc5fb9 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -253,12 +253,7 @@ BOOL LLToolPie::pickLeftMouseDownCallback()
selectionPropertiesReceived();
}
}
- return TRUE;
- case CLICK_ACTION_ZOOM:
- gAgent.setFocusOnAvatar(FALSE, FALSE);
- gAgent.setFocusGlobal(mPick);
- gAgent.setCameraZoomFraction(0.9);
- return TRUE;
+ return TRUE;
case CLICK_ACTION_PLAY:
handle_click_action_play();
return TRUE;
@@ -266,6 +261,29 @@ BOOL LLToolPie::pickLeftMouseDownCallback()
// mClickActionObject = object;
handle_click_action_open_media(object);
return TRUE;
+ case CLICK_ACTION_ZOOM:
+ {
+ const F32 PADDING_FACTOR = 2.f;
+ LLViewerObject* object = gObjectList.findObject(mPick.mObjectID);
+
+ if (object)
+ {
+ gAgent.setFocusOnAvatar(FALSE, ANIMATE);
+
+ LLBBox bbox = object->getBoundingBoxAgent() ;
+ F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView());
+ F32 distance = bbox.getExtentLocal().magVec() * PADDING_FACTOR / atan(angle_of_view);
+
+ LLVector3 obj_to_cam = LLViewerCamera::getInstance()->getOrigin() - bbox.getCenterAgent();
+ obj_to_cam.normVec();
+
+ LLVector3d object_center_global = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent());
+ gAgent.setCameraPosAndFocusGlobal(object_center_global + LLVector3d(obj_to_cam * distance),
+ object_center_global,
+ mPick.mObjectID );
+ }
+ }
+ return TRUE;
default:
// nothing
break;
diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml
index 87d31b8f9b..8b6f0f03fe 100644
--- a/indra/newview/skins/default/xui/en/floater_tools.xml
+++ b/indra/newview/skins/default/xui/en/floater_tools.xml
@@ -968,19 +968,19 @@
<combo_box.item
label="Touch (default)"
name="Touch/grab(default)"
- value="Touch/grab (default)" />
+ value="Touch" />
<combo_box.item
label="Sit on object"
name="Sitonobject"
- value="Sit on object" />
+ value="Sit" />
<combo_box.item
label="Buy object"
name="Buyobject"
- value="Buy object" />
+ value="Buy" />
<combo_box.item
label="Pay object"
name="Payobject"
- value="Pay object" />
+ value="Pay" />
<combo_box.item
label="Open"
name="Open"