Merge remote-tracking branch 'Liru/master'

This commit is contained in:
Damian Zhaoying
2013-09-17 00:30:42 -03:00
11 changed files with 1006 additions and 186 deletions

View File

@@ -399,7 +399,7 @@ void LLAudioEngine::idle(F32 max_decode_time)
}
LLAudioChannel *channelp = sourcep->getChannel();
bool is_stopped = channelp && channelp->isPlaying();
bool is_stopped = !channelp || !channelp->isPlaying();
if (is_stopped || (sourcep->isLoop() && channelp->mLoopedThisFrame))
{
// This sound isn't playing, so we just process move the queue

View File

@@ -71,10 +71,10 @@ glh_linear.h
#define GLH_EPSILON GLH_REAL(10e-6)
#define GLH_PI GLH_REAL(3.1415926535897932384626433832795)
#define equivalent(a,b) (((a < b + GLH_EPSILON) && (a > b - GLH_EPSILON)) ? true : false)
namespace glh
{
inline bool equivalent(GLH_REAL a, GLH_REAL b) { return b - GLH_EPSILON < a && a < b + GLH_EPSILON; }
inline GLH_REAL to_degrees(GLH_REAL radians) { return radians*GLH_RAD_TO_DEG; }
inline GLH_REAL to_radians(GLH_REAL degrees) { return degrees*GLH_DEG_TO_RAD; }

View File

@@ -17513,6 +17513,77 @@ This should be as low as possible, but too low may break functionality</string>
<key>Value</key>
<real>1280.0</real>
</map>
<key>ColladaExportFloaterRect</key>
<map>
<key>Comment</key>
<string>Collada floater position</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Rect</string>
<key>Value</key>
<array>
<integer>0</integer>
<integer>0</integer>
<integer>0</integer>
<integer>0</integer>
</array>
</map>
<key>DAEExportConsolidateMaterials</key>
<map>
<key>Comment</key>
<string>Combine faces with same texture</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>DAEExportSkipTransparent</key>
<map>
<key>Comment</key>
<string>Skip exporting faces with default transparent texture or full transparent</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>DAEExportTextures</key>
<map>
<key>Comment</key>
<string>Export textures when exporting Collada</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>DAEExportTextureParams</key>
<map>
<key>Comment</key>
<string>Apply texture params suchs as repeats to the exported UV map</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>DAEExportTexturesType</key>
<map>
<key>Comment</key>
<string>Image file format to use when exporting Collada</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>0</integer>
</map>
</map>
</llsd>

File diff suppressed because it is too large Load Diff

View File

@@ -1,48 +1,110 @@
/**
* @file daeexport.h
* @brief A system which allows saving in-world objects to Collada .DAE files for offline texturizing/shading.
* @authors Latif Khalifa
*
* $LicenseInfo:firstyear=2013&license=LGPLV2.1$
* Copyright (C) 2013 Latif Khalifa
*
* 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; either
* version 2.1 of the License, or (at your option) any later version.
*
* 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
*/
* @file daeexport.h
* @brief A system which allows saving in-world objects to Collada .DAE files for offline texturizing/shading.
* @authors Latif Khalifa
*
* $LicenseInfo:firstyear=2013&license=LGPLV2.1$
* Copyright (C) 2013 Latif Khalifa
*
* 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; either
* version 2.1 of the License, or (at your option) any later version.
*
* 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
*/
#ifndef DAEEXPORT_H_
#define DAEEXPORT_H_
#include <dom/domElements.h>
#include "lltextureentry.h"
class LLViewerObject;
class DAESaver
{
typedef std::vector<std::pair<LLViewerObject*,std::string> > obj_info_t;
public:
class MaterialInfo
{
public:
LLUUID textureID;
LLColor4 color;
std::string name;
bool matches(LLTextureEntry* te)
{
return (textureID == te->getID()) && (color == te->getColor());
}
bool operator== (const MaterialInfo& rhs)
{
return (textureID == rhs.textureID) && (color == rhs.color) && (name == rhs.name);
}
bool operator!= (const MaterialInfo& rhs)
{
return !(*this == rhs);
}
MaterialInfo()
{
}
MaterialInfo(const MaterialInfo& rhs)
{
textureID = rhs.textureID;
color = rhs.color;
name = rhs.name;
}
MaterialInfo& operator= (const MaterialInfo& rhs)
{
textureID = rhs.textureID;
color = rhs.color;
name = rhs.name;
return *this;
}
};
typedef std::vector<std::pair<LLViewerObject*,std::string> > obj_info_t;
typedef std::vector<LLUUID> id_list_t;
typedef std::vector<std::string> string_list_t;
typedef std::vector<S32> int_list_t;
typedef std::vector<MaterialInfo> material_list_t;
material_list_t mAllMaterials;
id_list_t mTextures;
string_list_t mTextureNames;
obj_info_t mObjects;
LLVector3 mOffset;
std::string mImageFormat;
S32 mTotalNumMaterials;
DAESaver();
void Add(const LLViewerObject* prim, const std::string name);
void updateTextureInfo();
void add(const LLViewerObject* prim, const std::string name);
bool saveDAE(std::string filename);
private:
void transformTexCoord(S32 num_vert, LLVector2* coord, LLVector3* positions, LLVector3* normals, LLTextureEntry* te, LLVector3 scale);
void addSource(daeElement* mesh, const char* src_id, std::string params, const std::vector<F32> &vals);
void addPolygons(daeElement* mesh, const char* geomID, const char* materialID, LLViewerObject* obj, int face_to_include);
void addPolygons(daeElement* mesh, const char* geomID, const char* materialID, LLViewerObject* obj, int_list_t* faces_to_include);
bool skipFace(LLTextureEntry *te);
MaterialInfo getMaterial(LLTextureEntry* te);
void getMaterials(LLViewerObject* obj, material_list_t* ret);
void getFacesWithMaterial(LLViewerObject* obj, MaterialInfo& mat, int_list_t* ret);
void generateEffects(daeElement *effects);
void generateImagesSection(daeElement* images);
};
#endif // DAEEXPORT_H_

View File

@@ -3440,6 +3440,7 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags)
mItems.push_back(std::string("Replace Outfit"));
}
mItems.push_back(std::string("Replace Remove Separator"));
mItems.push_back(std::string("Remove From Outfit"));
if (!LLAppearanceMgr::getCanRemoveFromCOF(mUUID))
{

View File

@@ -92,7 +92,7 @@ std::string LLLogChat::timestamp(bool withdate)
std::string text;
if (withdate)
if (withseconds)
text = llformat("[%d-%02d-%02d %02d:%02d:%02d] ", (timep->tm_year-100)+2000, timep->tm_mon+1, timep->tm_mday, timep->tm_hour, timep->tm_min, timep->tm_sec);
text = llformat("[%d/%02d/%02d %02d:%02d:%02d] ", (timep->tm_year-100)+2000, timep->tm_mon+1, timep->tm_mday, timep->tm_hour, timep->tm_min, timep->tm_sec);
else
text = llformat("[%d/%02d/%02d %02d:%02d] ", (timep->tm_year-100)+2000, timep->tm_mon+1, timep->tm_mday, timep->tm_hour, timep->tm_min);
else
@@ -127,6 +127,19 @@ void LLLogChat::saveHistory(std::string const& filename, std::string line)
}
}
const std::streamoff BUFFER_SIZE(4096);
// Read a chunk of size from pos in ifstr and prepend it to data
// return that chunk's newline count
U32 read_chunk(llifstream& ifstr, const std::streamoff& pos, U32 size, std::string& data)
{
char buffer[BUFFER_SIZE];
ifstr.seekg(pos);
ifstr.read(buffer, size);
data.insert(0, buffer, size);
return std::count(buffer, buffer + size, '\n');
}
void LLLogChat::loadHistory(std::string const& filename , void (*callback)(ELogLineType,std::string,void*), void* userdata)
{
if(!filename.size())
@@ -143,10 +156,43 @@ void LLLogChat::loadHistory(std::string const& filename , void (*callback)(ELogL
else
{
static const LLCachedControl<U32> lines("LogShowHistoryLines", 32);
std::string line;
for (U32 i = 0; i < lines && getline(ifstr, line); ++i)
ifstr.seekg(-1, std::ios_base::end);
if (!lines || !ifstr)
{
callback(LOG_LINE, line, userdata);
callback(LOG_EMPTY,LLStringUtil::null,userdata);
return;
}
std::string data;
U32 nlines = 0;
if (ifstr.get() != '\n') // in case file doesn't end with a newline
{
data.push_back('\n');
++nlines;
}
// Read BUFFER_SIZE byte chunks until we have enough endlines accumulated
for(std::streamoff pos = ifstr.tellg() - BUFFER_SIZE; nlines < lines+1; pos -= BUFFER_SIZE)
{
if (pos > 0)
{
nlines += read_chunk(ifstr, pos, BUFFER_SIZE, data);
}
else // Ran out of file read the remaining from the start
{
nlines += read_chunk(ifstr, 0, pos + BUFFER_SIZE, data);
break;
}
}
// Break data into lines
std::istringstream sstr(data);
for (std::string line; nlines > 0 && getline(sstr, line); --nlines)
{
if (nlines <= lines)
{
callback(LOG_LINE, line, userdata);
}
}
callback(LOG_END,LLStringUtil::null,userdata);
}

View File

@@ -2891,24 +2891,18 @@ class LLObjectEnableExport : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLPermissions perms;
bool new_value = LLSelectMgr::getInstance()->selectGetPermissions(perms) && perms.isOwned(); // At least one object, accumulated permissions of all objects.
ExportPolicy export_policy = LFSimFeatureHandler::instance().exportPolicy();
if (new_value && !(export_policy == ep_export_bit && (perms.getMaskEveryone() & PERM_EXPORT))) // No need to call allowExportBy if PERM_EXPORT is set on (all) root objects.
bool can_export_any = false;
LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
for (LLObjectSelection::iterator node = selection->begin(); node != selection->end(); ++node)
{
bool can_export_any = false;
LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
for (LLObjectSelection::iterator node = selection->begin(); node != selection->end(); ++node)
if ((*node)->mPermissions->allowExportBy(gAgent.getID(), export_policy))
{
if ((*node)->mPermissions->allowExportBy(gAgent.getID(), export_policy))
{
can_export_any = true;
break;
}
can_export_any = true;
break;
}
new_value = can_export_any;
}
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
gMenuHolder->findControl(userdata["control"].asString())->setValue(can_export_any);
return true;
}
};

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater name="Collada Export" title="Collada Export" width="600" height="260" can_close="true" can_minimize="true">
<string name="texture_progress">Collada Export: Saving textures ([COUNT] remaining)</string>
<text name="file name" follows="bottom|left" left="10" bottom="-48" height="20">File Name:</text>
<line_editor name="file name editor" follows="bottom|left" left_delta="60" bottom_delta="4" width="360" height="20" enabled="false"/>
<button name="browse button" label="Browse" follows="bottom|left" left_delta="363" bottom_delta="0" width="80" height="20">
<button.commit_callback function="ColladaExport.FilePicker"/>
</button>
<button name="export button" label="Export" follows="bottom|left" left_delta="83" bottom_delta="0" width="80" height="20" enabled="false">
<button.commit_callback function="ColladaExport.Export"/>
</button>
<panel border="true" left="10" bottom_delta="-88" height="80" width="200" follows="bottom|left" name="object info panel">
<text name="Object info" bottom="-20" height="20" left="5">Object Info</text>
<text name="Object Name" bottom_delta="-20" height="20" left="10">Name: [NAME]</text>
<text name="Exportable Prims" bottom_delta="-20" height="20" left="10">Exportable Prims: [COUNT]/[TOTAL]</text>
<text name="Exportable Textures" bottom_delta="-20" height="20">Exportable Textures: [COUNT]/[TOTAL]</text>
</panel>
<panel border="true" bottom_delta="-120" height="115" width="200" follows="bottom|left" name="options panel">
<text name="Object info" bottom="-20" height="20" left="5">Options</text>
<check_box name="texture export check" label="Export Textures" height="20" bottom_delta="-20" left="10" control_name="DAEExportTextures">
<check_box.commit_callback function="ColladaExport.TextureExport"/>
</check_box>
<combo_box name="texture type combo" bottom_delta="0" left_delta="120" height="20" width="60" control_name="DAEExportTexturesType">
<combo_item name="tga" value="0">TGA</combo_item>
<combo_item name="png" value="1">PNG</combo_item>
<combo_item name="j2c" value="2">J2C</combo_item>
<combo_item name="bmp" value="3">BMP</combo_item>
<combo_item name="jpg" value="4">JPG</combo_item>
<combo_box.commit_callback function="ColladaExport.TextureTypeCombo" />
</combo_box>
<check_box name="consolidate check" label="Consolidate faces" tool_tip="Export faces that have the same texture as one" bottom_delta="-20" left="10" height="20" control_name="DAEExportConsolidateMaterials"/>
<check_box name="skip transparent check" label="Skip transparent textures" bottom_delta="-20" height="20" control_name="DAEExportSkipTransparent"/>
<check_box name="texture params check" label="Apply texture params" bottom_delta="-20" height="20" control_name="DAEExportTextureParams"/>
</panel>
<scroll_container name="textures container" follows="all" bottom="-252" left_delta="205" width="380" height="200"/>
</floater>

View File

@@ -243,6 +243,7 @@
mouse_opaque="true" name="Replace Outfit" width="128">
<on_click filter="" function="Inventory.DoToSelected" userdata="replaceoutfit" />
</menu_item_call>
<menu_item_separator name="Replace Remove Separator"/>
<menu_item_call bottom_delta="-18" height="18" label="Remove From Outfit" left="0"
mouse_opaque="true" name="Remove From Outfit" width="128">
<on_click filter="" function="Inventory.DoToSelected" userdata="removefromoutfit" />

View File

@@ -1435,7 +1435,7 @@ static std::string add_imageload_filter_to_gtkchooser(GtkWindow *picker)
return filtername;
}
static std::string add_imagesave_filter_to_gtkchooser(GTKWindow *picker)
static std::string add_imagesave_filter_to_gtkchooser(GtkWindow *picker)
{
GtkFileFilter *gfilter = gtk_file_filter_new();
gtk_file_filter_add_mime_type(gfilter, "image/bmp");