Skip to content
Snippets Groups Projects
Commit 8808325c authored by Don Kjer's avatar Don Kjer
Browse files

Removed appearance utility from viewer source. Added appearance utility autobuild package.

parent 9307810e
No related branches found
No related tags found
No related merge requests found
Showing
with 97 additions and 1265 deletions
......@@ -8,9 +8,13 @@ Darwin.symbolfiles = "newview/Release/secondlife-symbols-darwin.tar.bz2"
CYGWIN.symbolfiles = "newview/Release/secondlife-symbols-windows.tar.bz2"
Linux.symbolfiles = "newview/secondlife-symbols-linux.tar.bz2"
variants=Release
# Use Public Upload Locations
public_build = true
clean_on_success = false
# skip windows debug build until we can get a fix in.
build_CYGWIN_Debug = false
......
......@@ -1239,6 +1239,32 @@
</map>
</map>
</map>
<key>llappearanceutility-source</key>
<map>
<key>license</key>
<string>TEMPORARY</string>
<key>license_file</key>
<string>LICENSES/llappearanceutility.txt</string>
<key>name</key>
<string>llappearanceutility-source</string>
<key>platforms</key>
<map>
<key>linux</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>a1197a789ccedb6cdd9d8aeb30e52b1b</string>
<key>url</key>
<string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/264759/arch/Linux/installer/llappearanceutility_source-0.1-linux-20120914.tar.bz2</string>
</map>
<key>name</key>
<string>linux</string>
</map>
</map>
<key>version</key>
<string>0.1</string>
</map>
<key>llphysicsextensions_source</key>
<map>
<key>license</key>
......
......@@ -113,11 +113,23 @@ build()
check_for "Before 'autobuild build'" ${build_dir}/packages/dictionaries
"$AUTOBUILD" build --no-configure -c $variant
viewer_build_ok=$?
build_ok=$?
end_section "Viewer$variant"
# Run build extensions
if [ $build_ok -eq 0 -a -d ${build_dir}/packages/build-extensions ]; then
for extension in ${build_dir}/packages/build-extensions/*.sh; do
. $extension
if [ $build_ok -ne 0 ]; then
break
fi
done
fi
# *TODO: Make this a build extension.
package_llphysicsextensions_tpv
tpvlib_build_ok=$?
if [ $viewer_build_ok -eq 0 -a $tpvlib_build_ok -eq 0 ]
if [ $build_ok -eq 0 -a $tpvlib_build_ok -eq 0 ]
then
echo true >"$build_dir"/build_ok
else
......@@ -299,7 +311,7 @@ then
then
if $build_viewer_deb && [ "$last_built_variant" == "Release" ]
then
begin_section "Build Debian Package"
begin_section "Build Viewer Debian Package"
# mangle the changelog
dch --force-bad-version \
--distribution unstable \
......@@ -313,7 +325,16 @@ then
# Unmangle the changelog file
hg revert debian/changelog
end_section "Build Debian Package"
end_section "Build Viewer Debian Package"
# Run debian extensions
if [ -d ${build_dir}/packages/debian-extensions ]; then
for extension in ${build_dir}/packages/debian-extensions/*.sh; do
. $extension
done
fi
# Move any .deb results.
mv ${build_dir}/packages/*.deb ../ 2>/dev/null || true
# upload debian package and create repository
begin_section "Upload Debian Repository"
......@@ -394,8 +415,9 @@ then
do
upload_item symbolfile "$build_dir/$symbolfile" binary/octet-stream
done
# Upload the llphysicsextensions_tpv package, if one was produced
# *TODO: Make this an upload-extension
if [ -r "$build_dir/llphysicsextensions_package" ]
then
llphysicsextensions_package=$(cat $build_dir/llphysicsextensions_package)
......@@ -409,6 +431,13 @@ then
;;
esac
# Run upload extensions
if [ -d ${build_dir}/packages/upload-extensions ]; then
for extension in ${build_dir}/packages/upload-extensions/*.sh; do
. $extension
done
fi
# Upload stub installers
upload_stub_installers "$build_dir_stubs"
fi
......
secondlife-viewer (0.4) unstable; urgency=low
* Adding appearance utility package
-- Don Kjer <don@lindenlab.com> Thu, 06 Sep 2012 19:32:55 +0000
secondlife-viewer (0.3) unstable; urgency=low
* Initial debian configuration
......
......@@ -14,11 +14,3 @@ Depends: ${shlibs:Depends}, ${misc:Depends},
Description: Second Life Viewer
Second Life is an online virtual world developed by Linden Lab.
Package: secondlife-appearance-utility
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends},
ia32-libs,
ia32-libs-gtk
Description: Second Life Appearance Utility
Utility for manipulating Second Life avatar appearance.
Copyright: 2012 Linden Research, Inc.
Second Life Viewer Copyright: 2000-2012 Linden Research, Inc.
License:
No license to distribute, copy, modify, or make derivitave works of this
software is granted unless specifically granted in writing by Linden Research,
Inc.
3Dconnexion SDK Copyright (C) 1992-2009 3Dconnexion
APR Copyright (C) 2011 The Apache Software Foundation
Collada DOM Copyright 2006 Sony Computer Entertainment Inc.
cURL Copyright (C) 1996-2010, Daniel Stenberg, (daniel@haxx.se)
DBus/dbus-glib Copyright (C) 2002, 2003 CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc.
expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
FreeType Copyright (C) 1996-2002, 2006 David Turner, Robert Wilhelm, and Werner Lemberg.
GL Copyright (C) 1999-2004 Brian Paul.
GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University and David Luebke, Brenden Schubert, University of Virginia.
google-perftools Copyright (c) 2005, Google Inc.
Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW)
jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
ogg/vorbis Copyright (C) 2002, Xiphophorus
OpenSSL Copyright (C) 1998-2008 The OpenSSL Project.
PCRE Copyright (c) 1997-2012 University of Cambridge
SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
xmlrpc-epi Copyright (C) 2000 Epinions, Inc.
zlib Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler.
Second Life Viewer uses Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (and its Licensors). All Rights Reserved. See www.havok.com for details.
This software contains source code provided by NVIDIA Corporation.
All rights reserved. See licenses.txt for details.
Voice chat Audio coding: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
......@@ -17,12 +17,6 @@ VIEWER_DESTDIR=$(CURDIR)/debian/$(VIEWER_PKG)
VIEWER_VERSION:=$(shell dpkg-parsechangelog | grep ^Version | sed 's/^Version: //')
VIEWER_INSTALLDIR:=$(BASEDIR)/viewer/SecondLife-i686-$(VIEWER_VERSION)
UTILITY_PKG=secondlife-appearance-utility
UTILITY_SRCDIR=indra/appearance_utility
UTILITY_PACKAGEDIR=build-linux-i686/appearance_utility
UTILITY_DESTDIR=$(CURDIR)/debian/$(UTILITY_PKG)
UTILITY_INSTALLDIR:=$(BASEDIR)/utilities
configure: configure-stamp
configure-stamp:
dh_testdir
......@@ -77,43 +71,6 @@ install: build
dh_link -p $(VIEWER_PKG) /$(VIEWER_INSTALLDIR)/secondlife /usr/bin/secondlife
dh_link -p $(VIEWER_PKG) $(BASEDIR)/viewer/SecondLife-i686-$(VIEWER_VERSION) $(BASEDIR)/viewer/SecondLife
# Add here commands to install the package into debian/secondlife-appearance-utility
# create containing directory
install -v -m 755 -o root -g root -d "$(UTILITY_DESTDIR)/$(UTILITY_INSTALLDIR)"
# install utility wrapper
install -v -m 755 -o root -g root "$(UTILITY_SRCDIR)/wrapper.sh" "$(UTILITY_DESTDIR)/$(UTILITY_INSTALLDIR)/wrapper.sh"
# install appearance-utility
install -v -m 755 -o root -g root "$(UTILITY_PACKAGEDIR)/appearance-utility-bin" "$(UTILITY_DESTDIR)/$(UTILITY_INSTALLDIR)/appearance-utility-bin"
dh_link -p $(UTILITY_PKG) $(UTILITY_INSTALLDIR)/wrapper.sh $(UTILITY_INSTALLDIR)/appearance-utility
# install xml/image resources from viewer package
for file in $$(find $(VIEWER_PACKAGEDIR)/character -name "avatar_*.xml" -o -name "*.tga" | sed 's~$(VIEWER_PACKAGEDIR)/~~'); do \
# create containing directory \
install -v -m 755 -o root -g root -d "$$(dirname "$(UTILITY_DESTDIR)/$(UTILITY_INSTALLDIR)/$$file")"; \
PERM=644; \
if [ -x "$(VIEWER_PACKAGEDIR)/$$file" ]; then \
PERM=755; \
fi; \
install -v -m $$PERM -o root -g root "$(VIEWER_PACKAGEDIR)/$$file" "$(UTILITY_DESTDIR)/$(UTILITY_INSTALLDIR)/$$file"; \
done
# install viewer libraries
for file in $$(find $(VIEWER_PACKAGEDIR)/lib -type f -o -type l | sed 's~$(VIEWER_PACKAGEDIR)/~~'); do \
# create containing directory \
install -v -m 755 -o root -g root -d "$$(dirname "$(UTILITY_DESTDIR)/$(UTILITY_INSTALLDIR)/$$file")"; \
PERM=644; \
if [ -x "$(VIEWER_PACKAGEDIR)/$$file" ]; then \
PERM=755; \
fi; \
if [ -L "$(VIEWER_PACKAGEDIR)/$$file" ]; then \
REAL="$$( readlink -f $(VIEWER_PACKAGEDIR)/$$file )"; \
RELATIVE="$$( echo $$REAL | sed 's~$(CURDIR)/$(VIEWER_PACKAGEDIR)/~~' )"; \
echo dh_link -p $(UTILITY_PKG) "$(UTILITY_INSTALLDIR)/$$RELATIVE" "$(UTILITY_INSTALLDIR)/$$file" ; \
dh_link -p $(UTILITY_PKG) "$(UTILITY_INSTALLDIR)/$$RELATIVE" "$(UTILITY_INSTALLDIR)/$$file" ; \
else \
install -v -m $$PERM -o root -g root "$(VIEWER_PACKAGEDIR)/$$file" "$(UTILITY_DESTDIR)/$(UTILITY_INSTALLDIR)/$$file"; \
fi; \
done
dh_link -p $(UTILITY_PKG) /$(UTILITY_INSTALLDIR)/appearance-utility /usr/bin/appearance-utility
# Build architecture-independent files here.
binary-indep: build install
......
misc:Depends=
......@@ -83,7 +83,10 @@ if (VIEWER)
if (LINUX)
add_subdirectory(${VIEWER_PREFIX}linux_crash_logger)
add_subdirectory(${VIEWER_PREFIX}linux_updater)
add_subdirectory(${VIEWER_PREFIX}appearance_utility)
if (INSTALL_PROPRIETARY)
include(LLAppearanceUtility)
add_subdirectory(${LLAPPEARANCEUTILITY_SRC_DIR} ${LLAPPEARANCEUTILITY_BIN_DIR})
endif (INSTALL_PROPRIETARY)
add_dependencies(viewer linux-crash-logger-strip-target linux-updater)
elseif (DARWIN)
add_subdirectory(${VIEWER_PREFIX}mac_crash_logger)
......
# -*- cmake -*-
project(appearance_utility)
include(00-Common)
include(LLAppearance)
include(LLCharacter)
include(LLCommon)
include(LLImage)
include(LLInventory)
include(LLMath)
include(LLRender)
include(LLVFS)
include(LLXML)
include(Linking)
include(GooglePerfTools)
include_directories(
${LLCOMMON_INCLUDE_DIRS}
${LLVFS_INCLUDE_DIRS}
${LLXML_INCLUDE_DIRS}
${LLCHARACTER_INCLUDE_DIRS}
${LLIMAGE_INCLUDE_DIRS}
${LLMATH_INCLUDE_DIRS}
${LLINVENTORY_INCLUDE_DIRS}
${LLRENDER_INCLUDE_DIRS}
${LLAPPEARANCE_INCLUDE_DIRS}
)
set(appearance_utility_SOURCE_FILES
appearance_utility.cpp
llappappearanceutility.cpp
llbakingavatar.cpp
llbakingjoint.cpp
llbakingjointmesh.cpp
llbakingshadermgr.cpp
llbakingtexlayer.cpp
llprocessparams.cpp
)
set(appearance_utility_HEADER_FILES
CMakeLists.txt
llappappearanceutility.h
llbakingavatar.h
llbakingjoint.h
llbakingjointmesh.h
llbakingprocess.h
llbakingshadermgr.h
llbakingtexlayer.h
llprocessparams.h
)
set_source_files_properties(${appearance_utility_HEADER_FILES}
PROPERTIES HEADER_FILES_ONLY TRUE)
list(APPEND appearance_utility_SOURCE_FILES ${appearance_utility_HEADER_FILES})
add_executable(appearance-utility-bin ${appearance_utility_SOURCE_FILES})
target_link_libraries(appearance-utility-bin
${LLAPPEARANCE_LIBRARIES}
${TCMALLOC_LIBRARIES}
)
add_custom_target(appearance-utility-bin-target ALL
DEPENDS appearance-utility-bin)
/**
* @file appearance_utility.cpp
* @author Don Kjer <don@lindenlab.com>, Nyx Linden
* @brief Utility for processing avatar appearance without a full viewer implementation.
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
// linden includes
#include "linden_common.h"
#include "llapr.h"
// project includes
#include "llappappearanceutility.h"
int main(int argc, char** argv)
{
// Create an application instance.
ll_init_apr();
LLAppAppearanceUtility* app = new LLAppAppearanceUtility(argc, argv);
// Assume success, unless exception is thrown.
EResult rv = RV_SUCCESS;
try
{
// Process command line and initialize system.
if (app->init())
{
// Run process.
app->mainLoop();
}
}
catch (LLAppException& e)
{
// Deal with errors.
rv = e.getStatusCode();
}
// Clean up application instance.
app->cleanup();
delete app;
ll_cleanup_apr();
return (int) rv;
}
/**
* @file llappappearanceutility.cpp
* @brief Implementation of LLAppAppearanceUtility class.
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include <iostream>
#include <sstream>
#include <string>
// linden includes
#include "linden_common.h"
#include "llapr.h"
#include "llerrorcontrol.h"
#include "llsd.h"
#include "llsdserialize.h"
#include "llsdutil.h"
// appearance includes
#include "llavatarappearance.h"
#include "llwearabletype.h"
// project includes
#include "llappappearanceutility.h"
#include "llbakingprocess.h"
#include "llprocessparams.h"
const std::string NOTHING_EXTRA("");
////////////////////////////////////////////
// LLAppException
////////////////////////////////////////////
static const std::string MESSAGE_RV_UNKNOWN("Unknown error.");
static const std::string MESSAGE_RV_ARGUMENTS
("Invalid arguments: ");
static const std::string MESSAGE_RV_UNABLE_OPEN("Unable to open file: ");
static const std::string MESSAGE_RV_UNABLE_TO_PARSE("Unable to parse input LLSD.");
static const std::string MESSAGE_DUPLICATE_MODES = "Cannot specify more than one process mode.";
LLAppException::LLAppException(EResult status_code, const std::string& extra) :
mStatusCode(status_code)
{
switch(status_code)
{
case RV_UNKNOWN_ERROR:
printErrorLLSD("unknown", MESSAGE_RV_UNKNOWN);
case RV_BAD_ARGUMENTS:
printErrorLLSD("arguments", MESSAGE_RV_ARGUMENTS + extra);
break;
case RV_UNABLE_OPEN:
printErrorLLSD("file", MESSAGE_RV_UNABLE_OPEN + extra);
break;
case RV_UNABLE_TO_PARSE:
printErrorLLSD("input", MESSAGE_RV_UNABLE_TO_PARSE);
break;
default:
printErrorLLSD("arguments", "Unknown exception.");
break;
}
}
void LLAppException::printErrorLLSD(const std::string& key, const std::string& message)
{
LLSD error_llsd;
error_llsd["success"] = false;
error_llsd["error"]["key"] = key;
error_llsd["error"]["message"] = message;
std::cerr << LLSDOStreamer<LLSDXMLFormatter>(error_llsd);
}
////////////////////////////////////////////
// LLAppAppearanceUtility
////////////////////////////////////////////
///////// Option Parsing /////////
// Simple usage command.
class LLProcessUsage : public LLBakingProcess
{
public:
LLProcessUsage(LLAppAppearanceUtility* app) :
LLBakingProcess(app) {}
/*virtual*/ void process(LLSD& input, std::ostream& output)
{
mApp->usage(output);
}
};
static const apr_getopt_option_t APPEARANCE_UTILITY_OPTIONS[] =
{
{"params", 'p', 0, "Generate appearance parameters for an agent."},
{"output", 'o', 1, "The output file to write to. Default is stdout"},
{"agent-id", 'a', 1, "The agent-id of the user."},
//{"grid", 'g', 1, "The grid."},
{"help", 'h', 0, "Print the help message."},
{0, 0, 0, 0}
};
void LLAppAppearanceUtility::usage(std::ostream& ostr)
{
ostr << "Utilities for processing agent appearance data."
<< std::endl << std::endl
<< "Usage:" << std::endl
<< "\t" << mAppName << " [options] filename" << std::endl << std::endl
<< "Will read from stdin if filename is set to '-'." << std::endl << std::endl
<< "Options:" << std::endl;
const apr_getopt_option_t* option = &APPEARANCE_UTILITY_OPTIONS[0];
while(option->name)
{
ostr << "\t--" << option->name << "\t\t"
<< option->description << std::endl;
++option;
}
ostr << std::endl << "Return Values:" << std::endl
<< "\t0\t\tSuccess." << std::endl
<< "\t1\t\tUnknown error." << std::endl
<< "\t2\t\tBad arguments." << std::endl
<< "\t3\t\tUnable to open file. Possibly wrong filename"
<< " or bad permissions." << std::endl
<< "\t4\t\tUnable to parse input LLSD." << std::endl
<< std::endl
<< "Output:" << std::endl
<< "If a non-zero status code is returned, additional error information"
<< " will be returned on stderr." << std::endl
<< "* This will be in the form of an LLSD document." << std::endl
<< "* Check ['error']['message'] to get a human readable message." << std::endl
<< "If a zero status code is returned, processed output will be written"
<< " to the file specified by --out (or stdout, if not specified)." << std::endl
<< std::endl
<< std::endl;
}
/////// LLApp Interface ////////
LLAppAppearanceUtility::LLAppAppearanceUtility(int argc, char** argv) :
LLApp(),
mArgc(argc),
mArgv(argv),
mProcess(NULL),
mInput(NULL),
mOutput(NULL),
mAppName(argv[0])
{
}
// virtual
LLAppAppearanceUtility::~LLAppAppearanceUtility()
{
}
void LLAppAppearanceUtility::verifyNoProcess()
{
if (mProcess)
{
std::cerr << "Invalid arguments. " << MESSAGE_DUPLICATE_MODES << std::endl;
usage(std::cerr);
throw LLAppException(RV_BAD_ARGUMENTS, MESSAGE_DUPLICATE_MODES);
}
}
void LLAppAppearanceUtility::parseArguments()
{
////// BEGIN OPTION PARSING //////
// Check for '-' as last option, since apr doesn't seem to like that.
if (std::string(mArgv[mArgc-1]) == "-")
{
mInputFilename.assign("-");
mArgc--;
}
apr_status_t apr_err;
const char* opt_arg = NULL;
int opt_id = 0;
apr_getopt_t* os = NULL;
if(APR_SUCCESS != apr_getopt_init(&os, gAPRPoolp, mArgc, mArgv))
{
std::cerr << "Unable to initialize apr" << std::endl;
throw LLAppException(RV_UNKNOWN_ERROR);
}
//std::string grid;
while(true)
{
apr_err = apr_getopt_long(os, APPEARANCE_UTILITY_OPTIONS, &opt_id, &opt_arg);
if(APR_STATUS_IS_EOF(apr_err)) break;
if(apr_err)
{
char buf[MAX_STRING]; /* Flawfinder: ignore */
std::cerr << "Error parsing options: "
<< apr_strerror(apr_err, buf, MAX_STRING) << std::endl;
usage(std::cerr);
throw LLAppException(RV_BAD_ARGUMENTS, buf);
}
switch (opt_id)
{
case 'h':
verifyNoProcess();
mProcess = new LLProcessUsage(this);
break;
case 'p':
verifyNoProcess();
mProcess = new LLProcessParams(this);
break;
case 'o':
mOutputFilename.assign(opt_arg);
break;
case 'a':
mAgentID.set(opt_arg);
if (mAgentID.isNull())
{
const char* INVALID_AGENT_ID="agent-id must be a valid uuid.";
std::cerr << "Invalid arguments. " << INVALID_AGENT_ID << std::endl;
usage(std::cerr);
throw LLAppException(RV_BAD_ARGUMENTS, INVALID_AGENT_ID);
}
break;
//case 'g':
// grid = opt_arg;
// break;
default:
usage(std::cerr);
throw LLAppException(RV_BAD_ARGUMENTS, "Unknown option.");
}
}
if ("-" != mInputFilename)
{
bool valid_input_filename = false;
// Try to grab the input filename.
if (os->argv && os->argv[os->ind])
{
mInputFilename.assign(os->argv[os->ind]);
if (! mInputFilename.empty() )
{
valid_input_filename = true;
}
}
if (!valid_input_filename)
{
const char* INVALID_FILENAME="Must specify input file.";
std::cerr << "Invalid arguments. " << INVALID_FILENAME << std::endl;
usage(std::cerr);
throw LLAppException(RV_BAD_ARGUMENTS, INVALID_FILENAME);
}
}
////// END OPTION PARSING //////
}
void LLAppAppearanceUtility::validateArguments()
{
///// BEGIN ARGUMENT VALIDATION /////
// Make sure we have a command specified.
if (!mProcess)
{
const char* INVALID_MODE="No process mode specified.";
std::cerr << "Invalid arguments. " << INVALID_MODE
<< std::endl;
usage(std::cerr);
throw LLAppException(RV_BAD_ARGUMENTS, INVALID_MODE);
}
///// END ARGUMENT VALIDATION /////
}
void LLAppAppearanceUtility::initializeIO()
{
///// BEGIN OPEN INPUT FILE ////
if ( "-" == mInputFilename )
{
// Read unformated data from stdin in to memory.
std::stringstream* data = new std::stringstream();
const S32 BUFFER_SIZE = BUFSIZ;
char buffer[BUFFER_SIZE];
while (true)
{
std::cin.read(buffer, BUFFER_SIZE);
// Check if anything out of the ordinary happened.
if (!std::cin)
{
// See if something 'really bad' happened, or if we just
// used up all of our buffer.
if (std::cin.bad())
{
std::cerr << "Problem reading standard input." << std::endl;
delete data;
throw (RV_UNKNOWN_ERROR);
}
else
{
// Output normally.
data->write(buffer, std::cin.gcount());
if (std::cin.eof()) break;
// Clear this problem. We have handled it.
std::cin.clear();
}
}
else
{
data->write(buffer, std::cin.gcount());
if (std::cin.eof()) break;
}
}
mInput = data;
}
else
{
// Make sure we can open the input file.
std::ifstream* input_file = new std::ifstream();
input_file->open( mInputFilename.c_str(), std::fstream::in );
if ( input_file->fail())
{
std::cerr << "Couldn't open input file '" << mInputFilename << "'." << std::endl;
delete input_file;
throw LLAppException(RV_UNABLE_OPEN, mInputFilename);
}
mInput = input_file;
}
///// END OPEN INPUT FILE ////
///// BEGIN OPEN OUTPUT FILE ////
if ("" == mOutputFilename)
{
mOutput = &std::cout;
}
else
{
// Make sure we can open the output file.
std::fstream* output_file = new std::fstream();
output_file->open( mOutputFilename.c_str(), std::fstream::out );
if ( output_file->fail() )
{
std::cerr << "Couldn't open output file '" << mOutputFilename << "'." << std::endl;
delete output_file;
throw LLAppException(RV_UNABLE_OPEN, mOutputFilename);
}
mOutput = output_file;
}
///// END OPEN OUTPUT FILE ////
///// BEGIN INPUT PARSING ////
LLSDSerialize::fromXML( mInputData, *mInput );
if (mInputData.isUndefined())
{
throw LLAppException(RV_UNABLE_TO_PARSE);
}
///// END INPUT PARSING ////
}
class LLPassthroughTranslationBridge : public LLTranslationBridge
{
public:
virtual std::string getString(const std::string &xml_desc)
{
// Just pass back the input string.
return xml_desc;
}
};
bool LLAppAppearanceUtility::init()
{
parseArguments();
bool log_to_stderr = true;
LLError::initForApplication("", log_to_stderr);
// *TODO: Add debug mode(s). Skip this in debug mode.
LLError::setDefaultLevel(LLError::LEVEL_WARN);
validateArguments();
initializeIO();
// Initialize classes.
LLWearableType::initClass(new LLPassthroughTranslationBridge());
// *TODO: Create a texture bridge?
LLAvatarAppearance::initClass();
return true;
}
bool LLAppAppearanceUtility::cleanup()
{
LLAvatarAppearance::cleanupClass();
LLWearableType::cleanupClass();
if (mProcess)
{
delete mProcess;
mProcess = NULL;
}
if ("-" != mInputFilename && mInput)
{
static_cast<std::ifstream*>(mInput)->close();
}
if ("" != mOutputFilename && mOutput)
{
static_cast<std::ofstream*>(mOutput)->close();
delete mOutput;
mOutput = NULL;
}
delete mInput;
mInput = NULL;
return true;
}
bool LLAppAppearanceUtility::mainLoop()
{
// This isn't really a loop, for this application. We just execute the requested command.
mProcess->process(mInputData, *mOutput);
return true;
}
/**
* @file llappappearanceutility.h
* @brief Declaration of LLAppAppearanceUtility class.
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLAPPAPPEARANCEUTILITY_H
#define LL_LLAPPAPPEARANCEUTILITY_H
#include <exception>
#include "llapp.h"
enum EResult
{
RV_SUCCESS = 0,
RV_UNKNOWN_ERROR,
RV_BAD_ARGUMENTS,
RV_UNABLE_OPEN,
RV_UNABLE_TO_PARSE,
};
extern const std::string NOTHING_EXTRA;
class LLAppAppearanceUtility;
class LLBakingProcess;
// Translate error status into error messages.
class LLAppException : public std::exception
{
public:
LLAppException(EResult status_code, const std::string& extra = NOTHING_EXTRA);
EResult getStatusCode() { return mStatusCode; }
private:
void printErrorLLSD(const std::string& key, const std::string& message);
EResult mStatusCode;
};
class LLAppAppearanceUtility : public LLApp
{
public:
LLAppAppearanceUtility(int argc, char** argv);
virtual ~LLAppAppearanceUtility();
// LLApp interface.
/*virtual*/ bool init();
/*virtual*/ bool cleanup();
/*virtual*/ bool mainLoop();
private:
// Option parsing.
void verifyNoProcess();
void parseArguments();
void validateArguments();
void initializeIO();
public:
void usage(std::ostream& ostr);
private:
int mArgc;
char** mArgv;
LLBakingProcess* mProcess;
std::istream* mInput;
std::ostream* mOutput;
std::string mAppName;
std::string mInputFilename;
std::string mOutputFilename;
LLUUID mAgentID;
LLSD mInputData;
};
#endif /* LL_LLAPPAPPEARANCEUTILITY_H */
/**
* @File llbakingavatar.cpp
* @brief Implementation of LLBakingAvatar class which is a derivation of LLAvatarAppearance
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
// linden includes
#include "linden_common.h"
#include "v3dmath.h"
// project includes
#include "llbakingavatar.h"
#include "llbakingjoint.h"
#include "llbakingjointmesh.h"
#include "llbakingtexlayer.h"
LLBakingAvatar::LLBakingAvatar(LLWearableData* wearable_data) :
LLAvatarAppearance(wearable_data)
{
}
// virtual
LLBakingAvatar::~LLBakingAvatar()
{
}
//-----------------------------------------------------------------------------
// Implemented methods
//-----------------------------------------------------------------------------
LLAvatarJoint* LLBakingAvatar::createAvatarJoint()
{
return new LLBakingJoint();
}
LLAvatarJoint* LLBakingAvatar::createAvatarJoint(S32 joint_num)
{
return new LLBakingJoint(joint_num);
}
LLAvatarJointMesh* LLBakingAvatar::createAvatarJointMesh()
{
return new LLBakingJointMesh();
}
LLTexLayerSet* LLBakingAvatar::createTexLayerSet()
{
return new LLBakingTexLayerSet(this);
}
//-----------------------------------------------------------------------------
// (Ignored) Non-implemented methods.
//-----------------------------------------------------------------------------
void LLBakingAvatar::bodySizeChanged() {}
void LLBakingAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components,
LLAvatarAppearanceDefines::EBakedTextureIndex index) {}
void LLBakingAvatar::invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result) {}
void LLBakingAvatar::updateMeshTextures() {}
void LLBakingAvatar::dirtyMesh() {}
void LLBakingAvatar::dirtyMesh(S32 priority) {}
void LLBakingAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake) {}
BOOL LLBakingAvatar::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const
{
return TRUE;
}
//-----------------------------------------------------------------------------
// (LLERR) Non-implemented methods.
//-----------------------------------------------------------------------------
LLVector3 LLBakingAvatar::getCharacterPosition()
{
LL_ERRS("AppearanceUtility") << "Not implemented." << LL_ENDL;
return LLVector3::zero;
}
LLQuaternion LLBakingAvatar::getCharacterRotation()
{
LL_ERRS("AppearanceUtility") << "Not implemented." << LL_ENDL;
return LLQuaternion::DEFAULT;
}
LLVector3 LLBakingAvatar::getCharacterVelocity()
{
LL_ERRS("AppearanceUtility") << "Not implemented." << LL_ENDL;
return LLVector3::zero;
}
LLVector3 LLBakingAvatar::getCharacterAngularVelocity()
{
LL_ERRS("AppearanceUtility") << "Not implemented." << LL_ENDL;
return LLVector3::zero;
}
const LLUUID& LLBakingAvatar::getID() const
{
LL_ERRS("AppearanceUtility") << "Not implemented." << LL_ENDL;
return LLUUID::null;
}
void LLBakingAvatar::addDebugText(const std::string& text)
{
LL_ERRS("AppearanceUtility") << "Not implemented." << LL_ENDL;
}
F32 LLBakingAvatar::getTimeDilation()
{
LL_ERRS("AppearanceUtility") << "Not implemented." << LL_ENDL;
return 0.0f;
}
void LLBakingAvatar::getGround(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm)
{
LL_ERRS("AppearanceUtility") << "Not implemented." << LL_ENDL;
}
F32 LLBakingAvatar::getPixelArea() const
{
LL_ERRS("AppearanceUtility") << "Not implemented." << LL_ENDL;
return 0.0f;
}
LLVector3d LLBakingAvatar::getPosGlobalFromAgent(const LLVector3 &position)
{
LL_ERRS("AppearanceUtility") << "Not implemented." << LL_ENDL;
return LLVector3d::zero;
}
LLVector3 LLBakingAvatar::getPosAgentFromGlobal(const LLVector3d &position)
{
LL_ERRS("AppearanceUtility") << "Not implemented." << LL_ENDL;
return LLVector3::zero;
}
/**
* @file llbakingavatar.h
* @brief Declaration of LLBakingAvatar class which is a derivation of LLAvatarAppearance
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLBAKINGAVATAR_H
#define LL_LLBAKINGAVATAR_H
#include "llavatarappearance.h"
class LLBakingAvatar : public LLAvatarAppearance
{
LOG_CLASS(LLBakingAvatar);
/********************************************************************************
** **
** INITIALIZATION
**/
public:
void* operator new(size_t size)
{
return ll_aligned_malloc_16(size);
}
void operator delete(void* ptr)
{
ll_aligned_free_16(ptr);
}
LLBakingAvatar(LLWearableData* wearable_data);
virtual ~LLBakingAvatar();
static void initClass(); // initializes static members
/** Initialization
** **
*******************************************************************************/
/********************************************************************************
** **
** INHERITED
**/
//--------------------------------------------------------------------
// LLCharacter interface
//--------------------------------------------------------------------
public:
/*virtual*/ LLVector3 getCharacterPosition();
/*virtual*/ LLQuaternion getCharacterRotation();
/*virtual*/ LLVector3 getCharacterVelocity();
/*virtual*/ LLVector3 getCharacterAngularVelocity();
/*virtual*/ const LLUUID& getID() const;
/*virtual*/ void addDebugText(const std::string& text);
/*virtual*/ F32 getTimeDilation();
/*virtual*/ void getGround(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm);
/*virtual*/ F32 getPixelArea() const;
/*virtual*/ LLVector3d getPosGlobalFromAgent(const LLVector3 &position);
/*virtual*/ LLVector3 getPosAgentFromGlobal(const LLVector3d &position);
//--------------------------------------------------------------------
// LLAvatarAppearance interface
//--------------------------------------------------------------------
public:
/*virtual*/ void bodySizeChanged();
/*virtual*/ void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components,
LLAvatarAppearanceDefines::EBakedTextureIndex index);
/*virtual*/ void invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result);
/*virtual*/ void updateMeshTextures();
/*virtual*/ void dirtyMesh(); // Dirty the avatar mesh
/*virtual*/ void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake);
/*virtual*/ BOOL isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const;
private:
/*virtual*/ void dirtyMesh(S32 priority); // Dirty the avatar mesh, with priority
// LLAvatarAppearance instance factories:
protected:
/*virtual*/ LLAvatarJoint* createAvatarJoint();
/*virtual*/ LLAvatarJoint* createAvatarJoint(S32 joint_num);
/*virtual*/ LLAvatarJointMesh* createAvatarJointMesh();
/*virtual*/ LLTexLayerSet* createTexLayerSet();
/** Inherited
** **
*******************************************************************************/
/********************************************************************************
** **
** STATE
**/
public:
/*virtual*/ bool isSelf() const { return true; }
/*virtual*/ BOOL isValid() const { return TRUE; }
/*virtual*/ BOOL isUsingBakedTextures() const { return TRUE; }
/** State
** **
*******************************************************************************/
};
#endif /* LL_LLBAKINGAVATAR_H */
/**
* @file llbakingjoint.cpp
* @brief Implementation of LLBakingJoint class
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llbakingjoint.h"
LLBakingJoint::LLBakingJoint() :
LLAvatarJoint()
{
}
LLBakingJoint::LLBakingJoint(S32 joint_num) :
LLAvatarJoint(joint_num)
{
}
// virtual
LLBakingJoint::~LLBakingJoint()
{
}
// virtual
U32 LLBakingJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
{
llerrs << "LLBakingJoint::render() should never be called!" << llendl;
return 0;
}
/**
* @file llbakingjoint.h
* @brief Implementation of LLBakingJoint class
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLBAKINGJOINT_H
#define LL_LLBAKINGJOINT_H
#include "llavatarjoint.h"
class LLBakingJoint : public virtual LLAvatarJoint
{
public:
LLBakingJoint();
LLBakingJoint(S32 joint_num);
virtual ~LLBakingJoint();
// LLViewerJoint interface
virtual U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE );
};
#endif /* LL_LLBAKINGJOINT_H */
/**
* @file llbakingjointmesh.cpp
* @brief Implementation of LLBakingJointMesh class
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llbakingjointmesh.h"
LLBakingJointMesh::LLBakingJointMesh() :
LLAvatarJointMesh()
{
}
// virtual
LLBakingJointMesh::~LLBakingJointMesh()
{
}
/**
* @file llbakingjoint.h
* @brief Implementation of LLBakingJointMesh class
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLBAKINGJOINTMESH_H
#define LL_LLBAKINGJOINTMESH_H
#include "llavatarjointmesh.h"
#include "llbakingjoint.h"
class LLBakingJointMesh : public LLAvatarJointMesh, public LLBakingJoint
{
public:
LLBakingJointMesh();
LLBakingJointMesh(S32 joint_num);
virtual ~LLBakingJointMesh();
};
#endif /* LL_LLBAKINGJOINTMESH_H */
/**
* @file llbakingprocess.h
* @brief Declaration of LLBakingProcess interface.
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2012, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLBAKINGPROCESS_H
#define LL_LLBAKINGPROCESS_H
#include <ostream>
class LLAppAppearanceUtility;
class LLSD;
// Simple wrapper for various process modes.
class LLBakingProcess
{
private:
// Hide default constructor.
LLBakingProcess() {}
public:
LLBakingProcess(LLAppAppearanceUtility* app) :
mApp(app) {}
virtual ~LLBakingProcess() {}
//virtual std::string getProcessName() const = 0;
virtual void process(LLSD& input, std::ostream& output) = 0;
protected:
LLAppAppearanceUtility* mApp;
};
#endif /* LL_LLBAKINGPROCESS_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment