diff options
-rw-r--r-- | linden/indra/newview/app_settings/ao_template.ini | 103 | ||||
-rw-r--r-- | linden/indra/newview/floaterao.cpp | 65 | ||||
-rw-r--r-- | linden/indra/newview/floaterao.h | 2 | ||||
-rw-r--r-- | linden/indra/newview/llpreviewnotecard.h | 3 | ||||
-rw-r--r-- | linden/indra/newview/skins/default/xui/en-us/floater_ao.xml | 11 |
5 files changed, 182 insertions, 2 deletions
diff --git a/linden/indra/newview/app_settings/ao_template.ini b/linden/indra/newview/app_settings/ao_template.ini new file mode 100644 index 0000000..03f02e3 --- /dev/null +++ b/linden/indra/newview/app_settings/ao_template.ini | |||
@@ -0,0 +1,103 @@ | |||
1 | ############################################################ | ||
2 | ############################################################ | ||
3 | ## | ||
4 | ## IMPRUDENCE AO TEMPLATE | ||
5 | ## | ||
6 | ############################################################ | ||
7 | ## | ||
8 | ## INSTRUCTIONS: | ||
9 | ## | ||
10 | ## 1. Detach any AO you are currently wearing or it will interfere. | ||
11 | ## | ||
12 | ## 2. Place all of the animations you want ot use into a folder in your inventory. | ||
13 | ## | ||
14 | ## 3. Place the notecard for the AO in the *SAME* folder. | ||
15 | ## | ||
16 | ## 4. Find the line that matches the animation you're changing. | ||
17 | ## For example, if you're adding a walk animation, | ||
18 | ## find the line that starts with [ Walking ] | ||
19 | ## | ||
20 | ## If the notecard already has walking animations, the line will look something like this: | ||
21 | ## [ Walking ]SexyWalk1|SexyWalk2 | ||
22 | ## | ||
23 | ## 5. Type the name of the new animation at the end of this line. | ||
24 | ## If the line already contains some animations, type '|' before | ||
25 | ## typing the animation name. Once you're done, the line should look like this: | ||
26 | ## [ Walking ]NewWalkAnim | ||
27 | ## or | ||
28 | ## [ Walking ]SexyWalk1|SexyWalk2|NewWalkAnim | ||
29 | ## | ||
30 | ## 6. Once you're done, save the notecard. | ||
31 | ## | ||
32 | ## 7. Open the client AO window (CTRL-SHIFT-O) then drag the notecard onto the indicated spot. | ||
33 | ## | ||
34 | ## 8. Press the "Reload" button in the AO. | ||
35 | ## | ||
36 | ############################################################ | ||
37 | |||
38 | ############################################################ | ||
39 | ############################################################ | ||
40 | ## | ||
41 | ## LIST YOUR ANIMATIONS HERE | ||
42 | ## | ||
43 | ############################################################ | ||
44 | ############################################################ | ||
45 | |||
46 | |||
47 | [ Standing ] | ||
48 | [ Walking ] | ||
49 | [ Sitting ] | ||
50 | [ Sitting On Ground ] | ||
51 | [ Crouching ] | ||
52 | [ Crouch Walking ] | ||
53 | [ Landing ] | ||
54 | [ Standing Up ] | ||
55 | [ Falling ] | ||
56 | [ Flying Down ] | ||
57 | [ Flying Up ] | ||
58 | [ Flying ] | ||
59 | [ Flying Slow ] | ||
60 | [ Hovering ] | ||
61 | [ Jumping ] | ||
62 | [ Pre Jumping ] | ||
63 | [ Running ] | ||
64 | [ Turning Right ] | ||
65 | [ Turning Left ] | ||
66 | [ Floating ] | ||
67 | [ Swimming Forward ] | ||
68 | [ Swimming Up ] | ||
69 | [ Swimming Down ] | ||
70 | |||
71 | |||
72 | ############################################################# | ||
73 | ############################################################# | ||
74 | ## | ||
75 | ## FOR ADVANCED USERS ONLY | ||
76 | ## | ||
77 | ############################################################# | ||
78 | ## | ||
79 | ## Lines starting with a # are treated as comments and ignored. Blank lines are ignored. Valid lines look like this: | ||
80 | ## | ||
81 | ## [ Walking ]SexyWalk1|SexyWalk2|SexyWalk3 | ||
82 | ## | ||
83 | ## The token (in this case, [ Walking ] - note the spaces inside the [ ]) identifies the animation to be overridden. The rest is a list of | ||
84 | ## animations, separated by the '|' (pipe) character. You can specify multiple animations for Stands, Walks, Sits, and GroundSits. | ||
85 | ## Multiple animations on any other line are invalid. You can list as many animations as you want. | ||
86 | ## | ||
87 | ## You can repeat tokens, so you can split the Stands up across multiple lines. Use the [ Standing ] token in each line, and | ||
88 | ## the viewer will add the animation lists together. | ||
89 | ## | ||
90 | ## Each 'animation name' can be a comma-separated list of animations, which will be played together. For example: | ||
91 | ## [ Walking ]SexyWalk1UpperBody,SexyWalk1LowerBody|SexyWalk2|SexyWalk3 | ||
92 | ## | ||
93 | ## Note the ',' between SexyWalk1UpperBody and SexyWalk1LowerBody - this tells AO to treat these as a single | ||
94 | ## 'animation' and play them together. The '|' between this 'animation' and SexyWalk2 tells AO to treat SexyWalk2 and | ||
95 | ## SexyWalk3 as separate walk animations. You can use this to layer animations on top of each other. | ||
96 | ## | ||
97 | ## Do not add any spaces around animation names!!! | ||
98 | ## | ||
99 | ## If you have read and understood these instructions, feel free to delete these lines. | ||
100 | ## | ||
101 | ## Imprudence's AO notecard system is based on the ZHAO-II HUD by Second Life resident Ziggy Puff. | ||
102 | ## | ||
103 | ############################################################ \ No newline at end of file | ||
diff --git a/linden/indra/newview/floaterao.cpp b/linden/indra/newview/floaterao.cpp index d8844d8..5ecd769 100644 --- a/linden/indra/newview/floaterao.cpp +++ b/linden/indra/newview/floaterao.cpp | |||
@@ -45,6 +45,51 @@ void cmdline_printchat(std::string message) | |||
45 | } | 45 | } |
46 | 46 | ||
47 | 47 | ||
48 | class AONotecardCallback : public LLInventoryCallback | ||
49 | { | ||
50 | public: | ||
51 | AONotecardCallback(std::string &filename) | ||
52 | { | ||
53 | mFileName = filename; | ||
54 | } | ||
55 | |||
56 | void fire(const LLUUID &inv_item) | ||
57 | { | ||
58 | if (!mFileName.empty()) | ||
59 | { | ||
60 | LLPreviewNotecard* nc; | ||
61 | nc = (LLPreviewNotecard*)LLPreview::find(inv_item); | ||
62 | if(nc) | ||
63 | { | ||
64 | nc->open(); | ||
65 | LLTextEditor *text = nc->getEditor(); | ||
66 | if (text) | ||
67 | { | ||
68 | text->setText(LLStringUtil::null); | ||
69 | text->makePristine(); | ||
70 | |||
71 | std::ifstream file(mFileName.c_str()); | ||
72 | |||
73 | std::string line; | ||
74 | while (!file.eof()) | ||
75 | { | ||
76 | getline(file, line); | ||
77 | line = line + "\n"; | ||
78 | text->insertText(line); | ||
79 | } | ||
80 | file.close(); | ||
81 | |||
82 | nc->saveIfNeeded(); | ||
83 | } | ||
84 | } | ||
85 | } | ||
86 | } | ||
87 | |||
88 | private: | ||
89 | std::string mFileName; | ||
90 | }; | ||
91 | |||
92 | |||
48 | // ------------------------------------------------------- | 93 | // ------------------------------------------------------- |
49 | 94 | ||
50 | AOStandTimer* mAOStandTimer; | 95 | AOStandTimer* mAOStandTimer; |
@@ -308,6 +353,7 @@ BOOL LLFloaterAO::postBuild() | |||
308 | 353 | ||
309 | childSetAction("reloadcard",onClickReloadCard,this); | 354 | childSetAction("reloadcard",onClickReloadCard,this); |
310 | childSetAction("opencard",onClickOpenCard,this); | 355 | childSetAction("opencard",onClickOpenCard,this); |
356 | childSetAction("newcard",onClickNewCard,this); | ||
311 | childSetAction("prevstand",onClickPrevStand,this); | 357 | childSetAction("prevstand",onClickPrevStand,this); |
312 | childSetAction("nextstand",onClickNextStand,this); | 358 | childSetAction("nextstand",onClickNextStand,this); |
313 | childSetCommitCallback("AOEnabled",onClickToggleAO); | 359 | childSetCommitCallback("AOEnabled",onClickToggleAO); |
@@ -948,6 +994,25 @@ void LLFloaterAO::onClickOpenCard(void* user_data) | |||
948 | } | 994 | } |
949 | } | 995 | } |
950 | 996 | ||
997 | void LLFloaterAO::onClickNewCard(void* user_data) | ||
998 | { | ||
999 | // load the template file from app_settings/ao_template.ini then | ||
1000 | // create a new properly-formatted notecard in the user's inventory | ||
1001 | std::string ao_template = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "ao_template.ini"); | ||
1002 | if (!ao_template.empty()) | ||
1003 | { | ||
1004 | LLPointer<LLInventoryCallback> cb = new AONotecardCallback(ao_template); | ||
1005 | create_inventory_item(gAgent.getID(), gAgent.getSessionID(), | ||
1006 | LLUUID::null, LLTransactionID::tnull, "New AO Notecard", | ||
1007 | "Drop this notecard in your AO window to use", LLAssetType::AT_NOTECARD, | ||
1008 | LLInventoryType::IT_NOTECARD, NOT_WEARABLE, PERM_ALL, cb); | ||
1009 | } | ||
1010 | else | ||
1011 | { | ||
1012 | llwarns << "Can't find ao_template.ini in app_settings!" << llendl; | ||
1013 | } | ||
1014 | } | ||
1015 | |||
951 | struct AOAssetInfo | 1016 | struct AOAssetInfo |
952 | { | 1017 | { |
953 | std::string path; | 1018 | std::string path; |
diff --git a/linden/indra/newview/floaterao.h b/linden/indra/newview/floaterao.h index 6b356cd..204717f 100644 --- a/linden/indra/newview/floaterao.h +++ b/linden/indra/newview/floaterao.h | |||
@@ -99,7 +99,7 @@ public: | |||
99 | static void onClickNextStand(void* userdata); | 99 | static void onClickNextStand(void* userdata); |
100 | static void onClickReloadCard(void* userdata); | 100 | static void onClickReloadCard(void* userdata); |
101 | static void onClickOpenCard(void* userdata); | 101 | static void onClickOpenCard(void* userdata); |
102 | 102 | static void onClickNewCard(void* userdata); | |
103 | 103 | ||
104 | static LLUUID invfolderid; | 104 | static LLUUID invfolderid; |
105 | static const LLUUID& getAssetIDByName(const std::string& name); | 105 | static const LLUUID& getAssetIDByName(const std::string& name); |
diff --git a/linden/indra/newview/llpreviewnotecard.h b/linden/indra/newview/llpreviewnotecard.h index 75d1a50..a879fec 100644 --- a/linden/indra/newview/llpreviewnotecard.h +++ b/linden/indra/newview/llpreviewnotecard.h | |||
@@ -87,10 +87,11 @@ public: | |||
87 | void refreshFromInventory(); | 87 | void refreshFromInventory(); |
88 | 88 | ||
89 | LLTextEditor* getEditor(); | 89 | LLTextEditor* getEditor(); |
90 | |||
91 | bool saveIfNeeded(LLInventoryItem* copyitem = NULL); | ||
90 | protected: | 92 | protected: |
91 | 93 | ||
92 | virtual void loadAsset(); | 94 | virtual void loadAsset(); |
93 | bool saveIfNeeded(LLInventoryItem* copyitem = NULL); | ||
94 | 95 | ||
95 | static LLPreviewNotecard* getInstance(const LLUUID& uuid); | 96 | static LLPreviewNotecard* getInstance(const LLUUID& uuid); |
96 | 97 | ||
diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_ao.xml b/linden/indra/newview/skins/default/xui/en-us/floater_ao.xml index 02aed11..2bcc9d1 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_ao.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_ao.xml | |||
@@ -101,6 +101,17 @@ | |||
101 | mouse_opaque="true" name="standtime" label="Stand Time" label_width="80" | 101 | mouse_opaque="true" name="standtime" label="Stand Time" label_width="80" |
102 | tool_tip="AO Stand Time in seconds" width="180" /> | 102 | tool_tip="AO Stand Time in seconds" width="180" /> |
103 | 103 | ||
104 | <button | ||
105 | name="newcard" | ||
106 | label="New Notecard Template" | ||
107 | font="SansSerifSmall" | ||
108 | left="10" | ||
109 | bottom_delta="-32" | ||
110 | width="180" | ||
111 | height="20" | ||
112 | follows="bottom|left" | ||
113 | /> | ||
114 | |||
104 | <button bottom="4" follows="left|bottom" font="SansSerifSmall" halign="center" | 115 | <button bottom="4" follows="left|bottom" font="SansSerifSmall" halign="center" |
105 | height="20" label="More >>" left="118" | 116 | height="20" label="More >>" left="118" |
106 | mouse_opaque="true" name="more_btn" scale_image="TRUE" | 117 | mouse_opaque="true" name="more_btn" scale_image="TRUE" |