summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Stiefvater (qarl) <qarl@lindenlab.com>2009-11-09 17:57:21 -0600
committerKarl Stiefvater (qarl) <qarl@lindenlab.com>2009-11-09 17:57:21 -0600
commit7fa698252060a72be6b5ebc52f0ff01bcea6134c (patch)
tree6935e7db79921ba5bdebe518547eb8c61c32c176
parent4e420a36c67e611cd7d85652b43d9cd65315e563 (diff)
super importer stuff (gui, texture upload, etc.)
-rw-r--r--indra/newview/llassetuploadresponders.cpp3
-rw-r--r--indra/newview/llfilepicker.cpp23
-rw-r--r--indra/newview/llfilepicker.h1
-rw-r--r--indra/newview/llviewerfloaterreg.cpp2
-rw-r--r--indra/newview/llviewermenufile.cpp41
-rw-r--r--indra/newview/llviewermenufile.h2
-rw-r--r--indra/newview/skins/default/xui/en/floater_inventory.xml10
7 files changed, 69 insertions, 13 deletions
diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp
index 680d1acd81..2da40ba4b5 100644
--- a/indra/newview/llassetuploadresponders.cpp
+++ b/indra/newview/llassetuploadresponders.cpp
@@ -42,6 +42,7 @@
#include "llnotify.h"
#include "llinventorymodel.h"
#include "llfloaterinventory.h"
+#include "llfloaterimportcollada.h"
#include "llpermissionsflags.h"
#include "llpreviewnotecard.h"
#include "llpreviewscript.h"
@@ -414,6 +415,8 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(),
userdata);
}
+
+ LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, content["new_asset"], TRUE);
}
LLSendTexLayerResponder::LLSendTexLayerResponder(const LLSD& post_data,
diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp
index e12db901bd..8dfb333530 100644
--- a/indra/newview/llfilepicker.cpp
+++ b/indra/newview/llfilepicker.cpp
@@ -55,6 +55,7 @@ LLFilePicker LLFilePicker::sInstance;
#define SOUND_FILTER L"Sounds (*.wav)\0*.wav\0"
#define IMAGE_FILTER L"Images (*.tga; *.bmp; *.jpg; *.jpeg; *.png)\0*.tga;*.bmp;*.jpg;*.jpeg;*.png\0"
#define ANIM_FILTER L"Animations (*.bvh)\0*.bvh\0"
+#define COLLADA_FILTER L"Scene (*.dae)\0*.dae\0"
#ifdef _CORY_TESTING
#define GEOMETRY_FILTER L"SL Geometry (*.slg)\0*.slg\0"
#endif
@@ -176,6 +177,10 @@ BOOL LLFilePicker::setupFilter(ELoadFilter filter)
mOFN.lpstrFilter = ANIM_FILTER \
L"\0";
break;
+ case FFLOAD_COLLADA:
+ mOFN.lpstrFilter = COLLADA_FILTER \
+ L"\0";
+ break;
#ifdef _CORY_TESTING
case FFLOAD_GEOMETRY:
mOFN.lpstrFilter = GEOMETRY_FILTER \
@@ -547,6 +552,15 @@ Boolean LLFilePicker::navOpenFilterProc(AEDesc *theItem, void *info, void *callB
result = false;
}
}
+ else if (filter == FFLOAD_COLLADA)
+ {
+ if (fileInfo.filetype != 'DAE ' &&
+ (fileInfo.extension && (CFStringCompare(fileInfo.extension, CFSTR("dae"), kCFCompareCaseInsensitive) != kCFCompareEqualTo))
+ )
+ {
+ result = false;
+ }
+ }
#ifdef _CORY_TESTING
else if (filter == FFLOAD_GEOMETRY)
{
@@ -1093,6 +1107,12 @@ static std::string add_bvh_filter_to_gtkchooser(GtkWindow *picker)
LLTrans::getString("animation_files") + " (*.bvh)");
}
+static std::string add_collada_filter_to_gtkchooser(GtkWindow *picker)
+{
+ return add_simple_pattern_filter_to_gtkchooser(picker, "*.dae",
+ LLTrans::getString("scene_files") + " (*.dae)");
+}
+
static std::string add_imageload_filter_to_gtkchooser(GtkWindow *picker)
{
GtkFileFilter *gfilter = gtk_file_filter_new();
@@ -1217,6 +1237,9 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter )
case FFLOAD_ANIM:
filtername = add_bvh_filter_to_gtkchooser(picker);
break;
+ case FFLOAD_COLLADA:
+ filtername = add_collada_filter_to_gtkchooser(picker);
+ break;
case FFLOAD_IMAGE:
filtername = add_imageload_filter_to_gtkchooser(picker);
break;
diff --git a/indra/newview/llfilepicker.h b/indra/newview/llfilepicker.h
index 7600922e9c..10736c7dd0 100644
--- a/indra/newview/llfilepicker.h
+++ b/indra/newview/llfilepicker.h
@@ -94,6 +94,7 @@ public:
FFLOAD_SLOBJECT = 7,
FFLOAD_RAW = 8,
FFLOAD_MODEL = 9,
+ FFLOAD_COLLADA = 10,
};
enum ESaveFilter
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index 4ff1e6c703..f3bf6b70a3 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -73,6 +73,7 @@
#include "llimpanel.h"
#include "llfloaterinspect.h"
#include "llfloaterinventory.h"
+#include "llfloaterimportcollada.h"
#include "llfloaterjoystick.h"
#include "llfloaterlagmeter.h"
#include "llfloaterland.h"
@@ -172,6 +173,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("hud", "floater_hud.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHUD>);
LLFloaterReg::add("impanel", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIMFloater>);
+ LLFloaterReg::add("import_collada", "floater_import_collada.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterImportCollada>);
LLFloaterReg::add("inventory", "floater_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterInventory>);
LLFloaterReg::add("inspect", "floater_inspect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterInspect>);
LLInspectAvatarUtil::registerFloater();
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index 7b9494c02a..53067c5c93 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -39,6 +39,7 @@
#include "llfilepicker.h"
#include "llfloaterreg.h"
#include "llfloaterbuycurrency.h"
+#include "llfloaterimportcollada.h"
#include "llfloatermodelpreview.h"
#include "llfloatersnapshot.h"
#include "llinventorymodel.h" // gInventory
@@ -56,7 +57,7 @@
#include "llappviewer.h"
#include "lluploaddialog.h"
#include "lltrans.h"
-
+#include "llfloaterimportcollada.h"
// linden libraries
#include "llassetuploadresponders.h"
@@ -263,6 +264,19 @@ class LLFileUploadImage : public view_listener_t
}
};
+class LLFileUploadScene : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string filename = upload_pick((void *)LLFilePicker::FFLOAD_COLLADA);
+ if (!filename.empty())
+ {
+ LLImportCollada::getInstance()->importFile(filename);
+ }
+ return TRUE;
+ }
+};
+
class LLFileUploadModel : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@@ -517,7 +531,7 @@ void handle_compress_image(void*)
}
}
-void upload_new_resource(
+LLUUID upload_new_resource(
const std::string& src_filename,
std::string name,
std::string desc,
@@ -555,7 +569,7 @@ void upload_new_resource(
short_name.c_str());
args["FILE"] = short_name;
upload_error(error_message, "NofileExtension", filename, args);
- return;
+ return LLUUID();
}
else if( exten == "bmp")
{
@@ -569,7 +583,7 @@ void upload_new_resource(
args["FILE"] = src_filename;
args["ERROR"] = LLImage::getLastError();
upload_error(error_message, "ProblemWithFile", filename, args);
- return;
+ return LLUUID();
}
}
else if( exten == "tga")
@@ -584,7 +598,7 @@ void upload_new_resource(
args["FILE"] = src_filename;
args["ERROR"] = LLImage::getLastError();
upload_error(error_message, "ProblemWithFile", filename, args);
- return;
+ return LLUUID();
}
}
else if( exten == "jpg" || exten == "jpeg")
@@ -599,7 +613,7 @@ void upload_new_resource(
args["FILE"] = src_filename;
args["ERROR"] = LLImage::getLastError();
upload_error(error_message, "ProblemWithFile", filename, args);
- return;
+ return LLUUID();
}
}
else if( exten == "png")
@@ -614,7 +628,7 @@ void upload_new_resource(
args["FILE"] = src_filename;
args["ERROR"] = LLImage::getLastError();
upload_error(error_message, "ProblemWithFile", filename, args);
- return;
+ return LLUUID();
}
}
else if(exten == "wav")
@@ -642,7 +656,7 @@ void upload_new_resource(
upload_error(error_message, "UnknownVorbisEncodeFailure", filename, args);
break;
}
- return;
+ return LLUUID();
}
}
else if(exten == "tmp")
@@ -682,7 +696,7 @@ void upload_new_resource(
error_message = llformat("corrupt resource file: %s", src_filename.c_str());
args["FILE"] = src_filename;
upload_error(error_message, "CorruptResourceFile", filename, args);
- return;
+ return LLUUID();
}
if (2 == tokens_read)
@@ -710,7 +724,7 @@ void upload_new_resource(
error_message = llformat("unknown linden resource file version in file: %s", src_filename.c_str());
args["FILE"] = src_filename;
upload_error(error_message, "UnknownResourceFileVersion", filename, args);
- return;
+ return LLUUID();
}
}
else
@@ -752,7 +766,7 @@ void upload_new_resource(
error_message = llformat( "Unable to create output file: %s", filename.c_str());
args["FILE"] = filename;
upload_error(error_message, "UnableToCreateOutputFile", filename, args);
- return;
+ return LLUUID();
}
fclose(in);
@@ -766,7 +780,7 @@ void upload_new_resource(
{
error_message = llformat("We do not currently support bulk upload of animation files\n");
upload_error(error_message, "DoNotSupportBulkAnimationUpload", filename, args);
- return;
+ return LLUUID();
}
else
{
@@ -840,6 +854,8 @@ void upload_new_resource(
}
LLFilePicker::instance().reset();
}
+
+ return uuid;
}
void upload_done_callback(
@@ -1260,6 +1276,7 @@ void init_menu_file()
view_listener_t::addCommit(new LLFileUploadSound(), "File.UploadSound");
view_listener_t::addCommit(new LLFileUploadAnim(), "File.UploadAnim");
view_listener_t::addCommit(new LLFileUploadModel(), "File.UploadModel");
+ view_listener_t::addCommit(new LLFileUploadScene(), "File.UploadScene");
view_listener_t::addCommit(new LLFileUploadBulk(), "File.UploadBulk");
view_listener_t::addCommit(new LLFileCloseWindow(), "File.CloseWindow");
view_listener_t::addCommit(new LLFileCloseAllWindows(), "File.CloseAllWindows");
diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h
index 858fcd51de..25469e0168 100644
--- a/indra/newview/llviewermenufile.h
+++ b/indra/newview/llviewermenufile.h
@@ -41,7 +41,7 @@ class LLTransactionID;
void init_menu_file();
-void upload_new_resource(
+LLUUID upload_new_resource(
const std::string& src_filename,
std::string name,
std::string desc,
diff --git a/indra/newview/skins/default/xui/en/floater_inventory.xml b/indra/newview/skins/default/xui/en/floater_inventory.xml
index c7fcacab8b..5e324f1c6e 100644
--- a/indra/newview/skins/default/xui/en/floater_inventory.xml
+++ b/indra/newview/skins/default/xui/en/floater_inventory.xml
@@ -136,6 +136,16 @@
<menu_item_call.on_enable
function="File.EnableUpload" />
</menu_item_call>
+ <menu_item_call
+ label="Scene..."
+ layout="topleft"
+ name="Upload Scene">
+ <menu_item_call.on_click
+ function="File.UploadScene"
+ parameter="" />
+ <menu_item_call.on_enable
+ function="File.EnableUpload" />
+ </menu_item_call>
<menu_item_call
label="Animation (L$[COST])..."
layout="topleft"