aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloatersaveavatar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llfloatersaveavatar.cpp')
-rw-r--r--linden/indra/newview/llfloatersaveavatar.cpp117
1 files changed, 0 insertions, 117 deletions
diff --git a/linden/indra/newview/llfloatersaveavatar.cpp b/linden/indra/newview/llfloatersaveavatar.cpp
deleted file mode 100644
index 2675212..0000000
--- a/linden/indra/newview/llfloatersaveavatar.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
1/**
2 * @file llfloatersaveavatar.cpp
3 * @brief write out avatar as CAL3D file
4 *
5 * $LicenseInfo:firstyear=2005&license=viewergpl$
6 *
7 * Copyright (c) 2005-2008, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
30 */
31
32#include "llviewerprecompiledheaders.h"
33
34#include "llfloatersaveavatar.h"
35
36#include "lldir.h"
37
38#include "llagent.h"
39#include "llvoavatar.h"
40#include "llbutton.h"
41#include "lllineeditor.h"
42#include "llvieweruictrlfactory.h"
43#include "llviewercontrol.h"
44
45static LLFloaterSaveAvatar* mSingleton = NULL;
46
47LLFloaterSaveAvatar::LLFloaterSaveAvatar() : LLFloater("Save Avatar")
48{
49 llassert( !mSingleton );
50 mSingleton = this;
51}
52
53LLFloaterSaveAvatar::~LLFloaterSaveAvatar()
54{
55 llassert( mSingleton == this );
56 mSingleton = NULL;
57}
58
59// Creates singleton or (if it already exists) brings it to the front
60// static
61void LLFloaterSaveAvatar::show()
62{
63 if ( !mSingleton)
64 {
65 LLFloaterSaveAvatar *instance = new LLFloaterSaveAvatar();
66
67 gUICtrlFactory->buildFloater(instance, "floater_save_avatar.xml");
68 S32 left;
69 S32 top;
70 gFloaterView->getNewFloaterPosition(&left, &top);
71 instance->setOrigin(left, top - instance->getRect().getHeight());
72 }
73 else
74 {
75 mSingleton->open(); /*Flawfinder: ignore*/
76 }
77}
78
79BOOL LLFloaterSaveAvatar::postBuild()
80{
81 mBaseNameEdit = LLViewerUICtrlFactory::getLineEditorByName(this, "base_name_edit");
82 mBaseNameEdit->setText(gSavedSettings.getString("AvExportBaseName"));
83 mPathEdit = LLViewerUICtrlFactory::getLineEditorByName(this, "path_edit");
84 mPathEdit->setText(gSavedSettings.getString("AvExportPath"));
85
86 mSaveBtn = LLViewerUICtrlFactory::getButtonByName(this, "save_btn");
87 mSaveBtn->setClickedCallback(onSave);
88 mSaveBtn->setCallbackUserData(this);
89
90 return TRUE;
91}
92
93//static
94void LLFloaterSaveAvatar::onSave( void* user_data )
95{
96 LLFloaterSaveAvatar* self = (LLFloaterSaveAvatar*)user_data;
97
98 gSavedSettings.setString("AvExportPath", self->mPathEdit->getText());
99 gSavedSettings.setString("AvExportBaseName", self->mBaseNameEdit->getText());
100
101 std::string path_name = self->mPathEdit->getText();
102 if (path_name.size() && *(path_name.end() - 1) == '\\')
103 {
104 // remove trailing backslash
105 path_name.erase(path_name.end() - 1);
106 }
107
108 std::string base_name = self->mBaseNameEdit->getText();
109 if (base_name.size() && *(base_name.end() - 1) == '_')
110 {
111 // remove trailing underscore
112 base_name.erase(base_name.end() - 1);
113 }
114
115 gAgent.getAvatarObject()->writeCAL3D(path_name, base_name);
116 self->close();
117}