示例#1
0
static LLSD getTabInfo(LLPanel* tab)
{
    LLSD panels;
    for (LLPanel::tree_iterator_t ti(tab->beginTreeDFS()), tend(tab->endTreeDFS());
         ti != tend; ++ti)
    {
        // *ti is actually an LLView*, which had better not be NULL
        LLView* view(*ti);
        if (! view)
        {
            LL_ERRS("LLSideTrayListener") << "LLSideTrayTab '" << tab->getName()
                                          << "' has a NULL child LLView*" << LL_ENDL;
        }

        // The logic we use to decide what "panel" names to return is heavily
        // based on LLSideTray::showPanel(): the function that actually
        // implements the "SideTray.ShowPanel" operation. showPanel(), in
        // turn, depends on LLSideTray::openChildPanel(): when
        // openChildPanel() returns non-NULL, showPanel() stops searching
        // attached and detached LLSideTrayTab tabs.

        // For each LLSideTrayTab, openChildPanel() first calls
        // findChildView(panel_name, true). In other words, panel_name need
        // not be a direct LLSideTrayTab child, it's sought recursively.
        // That's why we use (begin|end)TreeDFS() in this loop.

        // But this tree_iterator_t loop will actually traverse every widget
        // in every panel. Returning all those names will not help our caller:
        // passing most such names to openChildPanel() would not do what we
        // want. Even though the code suggests that passing ANY valid
        // side-panel widget name to openChildPanel() will open the tab
        // containing that widget, results could get confusing since followup
        // (onOpen()) logic wouldn't be invoked, and showPanel() wouldn't stop
        // searching because openChildPanel() would return NULL.

        // We must filter these LLView items, using logic that (sigh!) mirrors
        // openChildPanel()'s own.

        // openChildPanel() returns a non-NULL LLPanel* when either:
        // - the LLView is a direct child of an LLSideTrayPanelContainer
        // - the LLView is itself an LLPanel.
        // But as LLSideTrayPanelContainer can directly contain LLView items
        // that are NOT themselves LLPanels (e.g. "sidebar_me" contains an
        // LLButton called "Jump Right Arrow"), we'd better focus only on
        // LLSideTrayPanelContainer children that are themselves LLPanel
        // items. Which means that the second test completely subsumes the
        // first.
        LLPanel* panel(dynamic_cast<LLPanel*>(view));
        if (panel)
        {
            // Maybe it's overkill to construct an LLSD::Map for each panel, but
            // the possibility remains that we might want to deliver more info
            // about each panel than just its name.
            panels.append(LLSDMap("name", panel->getName()));
        }
    }

    return LLSDMap("panels", panels);
}
LLPipelineListener::LLPipelineListener():
	LLEventAPI("LLPipeline",
			   "API to te rendering pipeline.")
{
	// Render Types
	add("toggleRenderTypes",
		"Toggle rendering [\"types\"]:\n"
		"See: llviewermenu.cpp:render_type_from_string for list of available types.",
		&toggle_render_types_wrapper);
	add("hasRenderType",
		"Check if rendering [\"type\"] is enabled:\n"
		"See: llviewermenu.cpp:render_type_from_string for list of available types.",
		&has_render_type_wrapper,
		LLSDMap("reply", LLSD()));
	add("disableAllRenderTypes",
		"Turn off all rendering types.",
		&disable_all_render_types_wrapper);
	add("enableAllRenderTypes",
		"Turn on all rendering types.",
		&enable_all_render_types_wrapper);

	// Render Features
	add("toggleRenderFeatures",
		"Toggle rendering [\"features\"]:\n"
		"See: llviewermenu.cpp:feature_from_string for list of available features.",
		&toggle_render_features_wrapper);
	add("hasRenderFeature",
		"Check if rendering [\"feature\"] is enabled:\n"
		"See: llviewermenu.cpp:render_feature_from_string for list of available features.",
		&has_render_feature_wrapper,
		LLSDMap("reply", LLSD()));
	add("disableAllRenderFeatures",
		"Turn off all rendering features.",
		&disable_all_render_features_wrapper);
	add("enableAllRenderFeatures",
		"Turn on all rendering features.",
		&enable_all_render_features_wrapper);

	// Render Info Displays
	add("toggleRenderInfoDisplays",
		"Toggle info [\"displays\"]:\n"
		"See: llviewermenu.cpp:info_display_from_string for list of available displays.",
		&toggle_info_displays_wrapper);
	add("hasRenderInfoDisplay",
		"Check if info [\"display\"] is enabled:\n"
		"See: llviewermenu.cpp:info_display_from_string for list of available displays.",
		&has_info_display_wrapper,
		LLSDMap("reply", LLSD()));
	add("disableAllRenderInfoDisplays",
		"Turn off all info displays.",
		&disable_all_info_displays_wrapper);
	add("enableAllRenderInfoDisplays",
		"Turn on all info displays.",
		&enable_all_info_displays_wrapper);
}
void LLAgentListener::getAxes(const LLSD& event) const
{
    LLQuaternion quat(mAgent.getQuat());
    F32 roll, pitch, yaw;
    quat.getEulerAngles(&roll, &pitch, &yaw);
    // The official query API for LLQuaternion's [x, y, z, w] values is its
    // public member mQ...
    sendReply(LLSDMap
              ("quat", llsd_copy_array(boost::begin(quat.mQ), boost::end(quat.mQ)))
              ("euler", LLSDMap("roll", roll)("pitch", pitch)("yaw", yaw)),
              event);
}
示例#4
0
LLSideTrayListener::LLSideTrayListener(const Getter& getter):
    LLEventAPI("LLSideTray",
               "Operations on side tray (e.g. query state, query tabs)"),
    mGetter(getter)
{
    add("getCollapsed", "Send on [\"reply\"] an [\"open\"] Boolean",
        &LLSideTrayListener::getCollapsed, LLSDMap("reply", LLSD()));
    add("getTabs",
        "Send on [\"reply\"] a map of tab names and info about them",
        &LLSideTrayListener::getTabs, LLSDMap("reply", LLSD()));
    add("getPanels",
        "Send on [\"reply\"] data about panels available with SideTray.ShowPanel",
        &LLSideTrayListener::getPanels, LLSDMap("reply", LLSD()));
}
LLAgentListener::LLAgentListener(LLAgent &agent)
  : LLEventAPI("LLAgent",
               "LLAgent listener to (e.g.) teleport, sit, stand, etc."),
    mAgent(agent)
{
	add("requestTeleport",
        "Teleport: [\"regionname\"], [\"x\"], [\"y\"], [\"z\"]\n"
        "If [\"skip_confirmation\"] is true, use LLURLDispatcher rather than LLCommandDispatcher.",
        &LLAgentListener::requestTeleport);
	add("requestSit",
        "Ask to sit on the object specified in [\"obj_uuid\"]",
        &LLAgentListener::requestSit);
	add("requestStand",
        "Ask to stand up",
        &LLAgentListener::requestStand);
    add("resetAxes",
        "Set the agent to a fixed orientation (optionally specify [\"lookat\"] = array of [x, y, z])",
        &LLAgentListener::resetAxes);
    add("getAxes",
        "Send information about the agent's orientation on [\"reply\"]:\n"
        "[\"euler\"]: map of {roll, pitch, yaw}\n"
        "[\"quat\"]:  array of [x, y, z, w] quaternion values",
        &LLAgentListener::getAxes,
        LLSDMap("reply", LLSD()));
}
示例#6
0
void LLConversationItem::postEvent(const std::string& event_type, LLConversationItemSession* session, LLConversationItemParticipant* participant)
{
	LLUUID session_id = (session ? session->getUUID() : LLUUID());
	LLUUID participant_id = (participant ? participant->getUUID() : LLUUID());
	LLSD event(LLSDMap("type", event_type)("session_uuid", session_id)("participant_uuid", participant_id));
	LLEventPumps::instance().obtain("ConversationsEvents").post(event);
}
	virtual void apply(const std::string& name, LLControlVariable* control)
	{
		vars.append(LLSDMap
					("name", name)
					("type", mGroup->typeEnumToString(control->type()))
					("value", control->get())
					("comment", control->getComment()));
	}
示例#8
0
void LLAgentListener::getGroups(const LLSD& event) const
{
    LLSD reply(LLSD::emptyArray());
    for (LLDynamicArray<LLGroupData>::const_iterator
             gi(mAgent.mGroups.begin()), gend(mAgent.mGroups.end());
         gi != gend; ++gi)
    {
        reply.append(LLSDMap
                     ("id", gi->mID)
                     ("name", gi->mName)
                     ("insignia", gi->mInsigniaID)
                     ("notices", bool(gi->mAcceptNotices))
                     ("display", bool(gi->mListInProfile))
                     ("contrib", gi->mContribution));
    }
    sendReply(LLSDMap("groups", reply), event);
}
LLViewerControlListener::LLViewerControlListener()
	: LLEventAPI("LLViewerControl",
				 "LLViewerControl listener: set, toggle or set default for various controls")
{
	std::ostringstream groupnames;
	groupnames << "[\"group\"] is one of ";
	const char* delim = "";
	for (LLControlGroup::key_iter cgki(LLControlGroup::beginKeys()),
								  cgkend(LLControlGroup::endKeys());
		 cgki != cgkend; ++cgki)
	{
		groupnames << delim << '"' << *cgki << '"';
		delim = ", ";
	}
	groupnames << '\n';
	std::string grouphelp(groupnames.str());
	std::string replyhelp("If [\"reply\"] requested, send new [\"value\"] on specified LLEventPump\n");

	add("set",
		std::string("Set [\"group\"] control [\"key\"] to optional value [\"value\"]\n"
					"If [\"value\"] omitted, set to control's defined default value\n") +
		grouphelp + replyhelp,
		&LLViewerControlListener::set,
		LLSDMap("group", LLSD())("key", LLSD()));
	add("toggle",
		std::string("Toggle [\"group\"] control [\"key\"], if boolean\n") + grouphelp + replyhelp,
		&LLViewerControlListener::toggle,
		LLSDMap("group", LLSD())("key", LLSD()));
	add("get",
		std::string("Query [\"group\"] control [\"key\"], replying on LLEventPump [\"reply\"]\n") +
		grouphelp,
		&LLViewerControlListener::get,
		LLSDMap("group", LLSD())("key", LLSD())("reply", LLSD()));
	add("groups",
		"Send on LLEventPump [\"reply\"] an array [\"groups\"] of valid group names",
		&LLViewerControlListener::groups,
		LLSDMap("reply", LLSD()));
	add("vars",
		std::string("For [\"group\"], send on LLEventPump [\"reply\"] an array [\"vars\"],\n"
					"each of whose entries looks like:\n"
					"  [\"name\"], [\"type\"], [\"value\"], [\"comment\"]\n") + grouphelp,
		&LLViewerControlListener::vars,
		LLSDMap("group", LLSD())("reply", LLSD()));
}
示例#10
0
void LLFloaterRegListener::instanceVisible(const LLSD& event) const
{
    sendReply(LLSDMap("visible", LLFloaterReg::instanceVisible(event["name"], event["key"])),
              event);
}
示例#11
0
LLAgentListener::LLAgentListener(LLAgent &agent)
  : LLEventAPI("LLAgent",
               "LLAgent listener to (e.g.) teleport, sit, stand, etc."),
    mAgent(agent)
{
    add("requestTeleport",
        "Teleport: [\"regionname\"], [\"x\"], [\"y\"], [\"z\"]\n"
        "If [\"skip_confirmation\"] is true, use LLURLDispatcher rather than LLCommandDispatcher.",
        &LLAgentListener::requestTeleport);
    add("requestSit",
		"[\"obj_uuid\"]: id of object to sit on, use this or [\"position\"] to indicate the sit target"
		"[\"position\"]: region position {x, y, z} where to find closest object to sit on",
        &LLAgentListener::requestSit);
    add("requestStand",
        "Ask to stand up",
        &LLAgentListener::requestStand);
    add("requestTouch",
		"[\"obj_uuid\"]: id of object to touch, use this or [\"position\"] to indicate the object to touch"
		"[\"position\"]: region position {x, y, z} where to find closest object to touch"
		"[\"face\"]: optional object face number to touch[Default: 0]",
        &LLAgentListener::requestTouch);
    add("resetAxes",
        "Set the agent to a fixed orientation (optionally specify [\"lookat\"] = array of [x, y, z])",
        &LLAgentListener::resetAxes);
    add("getAxes",
        "Obsolete - use getPosition instead\n"
        "Send information about the agent's orientation on [\"reply\"]:\n"
        "[\"euler\"]: map of {roll, pitch, yaw}\n"
        "[\"quat\"]:  array of [x, y, z, w] quaternion values",
        &LLAgentListener::getAxes,
        LLSDMap("reply", LLSD()));
    add("getPosition",
        "Send information about the agent's position and orientation on [\"reply\"]:\n"
        "[\"region\"]: array of region {x, y, z} position\n"
        "[\"global\"]: array of global {x, y, z} position\n"
        "[\"euler\"]: map of {roll, pitch, yaw}\n"
        "[\"quat\"]:  array of [x, y, z, w] quaternion values",
        &LLAgentListener::getPosition,
        LLSDMap("reply", LLSD()));
    add("startAutoPilot",
        "Start the autopilot system using the following parameters:\n"
        "[\"target_global\"]: array of target global {x, y, z} position\n"
        "[\"stop_distance\"]: target maxiumum distance from target [default: autopilot guess]\n"
        "[\"target_rotation\"]: array of [x, y, z, w] quaternion values [default: no target]\n"
        "[\"rotation_threshold\"]: target maximum angle from target facing rotation [default: 0.03 radians]\n"
        "[\"behavior_name\"]: name of the autopilot behavior [default: \"\"]"
        "[\"allow_flying\"]: allow flying during autopilot [default: True]",
        //"[\"callback_pump\"]: pump to send success/failure and callback data to [default: none]\n"
        //"[\"callback_data\"]: data to send back during a callback [default: none]",
        &LLAgentListener::startAutoPilot);
    add("getAutoPilot",
        "Send information about current state of the autopilot system to [\"reply\"]:\n"
        "[\"enabled\"]: boolean indicating whether or not autopilot is enabled\n"
        "[\"target_global\"]: array of target global {x, y, z} position\n"
        "[\"leader_id\"]: uuid of target autopilot is following\n"
        "[\"stop_distance\"]: target maximum distance from target\n"
        "[\"target_distance\"]: last known distance from target\n"
        "[\"use_rotation\"]: boolean indicating if autopilot has a target facing rotation\n"
        "[\"target_facing\"]: array of {x, y} target direction to face\n"
        "[\"rotation_threshold\"]: target maximum angle from target facing rotation\n"
        "[\"behavior_name\"]: name of the autopilot behavior",
        &LLAgentListener::getAutoPilot,
        LLSDMap("reply", LLSD()));
    add("startFollowPilot",
		"[\"leader_id\"]: uuid of target to follow using the autopilot system (optional with avatar_name)\n"
		"[\"avatar_name\"]: avatar name to follow using the autopilot system (optional with leader_id)\n"
        "[\"allow_flying\"]: allow flying during autopilot [default: True]\n"
        "[\"stop_distance\"]: target maxiumum distance from target [default: autopilot guess]",
        &LLAgentListener::startFollowPilot);
    add("setAutoPilotTarget",
        "Update target for currently running autopilot:\n"
        "[\"target_global\"]: array of target global {x, y, z} position",
        &LLAgentListener::setAutoPilotTarget);
    add("stopAutoPilot",
        "Stop the autopilot system:\n"
        "[\"user_cancel\"] indicates whether or not to act as though user canceled autopilot [default: false]",
        &LLAgentListener::stopAutoPilot);
    add("lookAt",
		"[\"type\"]: number to indicate the lookAt type, 0 to clear\n"
		"[\"obj_uuid\"]: id of object to look at, use this or [\"position\"] to indicate the target\n"
		"[\"position\"]: region position {x, y, z} where to find closest object or avatar to look at",
        &LLAgentListener::lookAt);
}
示例#12
0
void LLSideTrayListener::getCollapsed(const LLSD& event) const
{
    sendReply(LLSDMap("open", ! mGetter()->getCollapsed()), event);
}