Merge branch 'DRTVWR-544-maint' of https://bitbucket.org/lindenlab/viewer

master
Ansariel 2022-02-02 12:56:43 +01:00
commit dbd7ecc9a4
16 changed files with 121 additions and 79 deletions

View File

@ -879,6 +879,8 @@ ELoadStatus LLBVHLoader::loadBVHFile(const char *buffer, char* error_text, S32 &
}
// If the user only supplies one animation frame (after the ignored reference frame 0), hold for mFrameTime.
// If the user supples exactly one total frame, it isn't clear if that is a pose or reference frame, and the
// behavior is not defined. In this case, retain historical undefined behavior.
mDuration = llmax((F32)(mNumFrames - NUMBER_OF_UNPLAYED_FRAMES), 1.0f) * mFrameTime;
if (!mLoop)
{
@ -1392,11 +1394,7 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
continue;
}
if (frame == 0) {
LL_WARNS("BVH") << "ERROR: [line: " << getLineNumber() << "] Joint " << ki - joint->mKeys.begin() << " not marked to ignore rotation for initial frame. Not serializing." << LL_ENDL;
return FALSE;
}
time = (F32)(frame - NUMBER_OF_IGNORED_FRAMES_AT_START) * mFrameTime; // Time elapsed before this frame starts.
time = llmax((F32)(frame - NUMBER_OF_IGNORED_FRAMES_AT_START), 0.0f) * mFrameTime; // Time elapsed before this frame starts.
if (mergeParent)
{
@ -1472,11 +1470,7 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
continue;
}
if (frame == 0) {
LL_WARNS("BVH") << "ERROR: [line: " << getLineNumber() << "] Joint " << ki - joint->mKeys.begin() << " not marked to ignore position for initial frame. Not serializing." << LL_ENDL;
return FALSE;
}
time = (F32)(frame - NUMBER_OF_IGNORED_FRAMES_AT_START) * mFrameTime; // Time elapsed before this frame starts.
time = llmax((F32)(frame - NUMBER_OF_IGNORED_FRAMES_AT_START), 0.0f) * mFrameTime; // Time elapsed before this frame starts.
LLVector3 inPos = (LLVector3(ki->mPos) - relKey) * ~first_frame_rot;// * fixup_rot;
LLVector3 outPos = inPos * frameRot * offsetRot;

View File

@ -116,14 +116,20 @@ void LLAlignedArray<T, alignment>::resize(U32 size)
template <class T, U32 alignment>
T& LLAlignedArray<T, alignment>::operator[](int idx)
{
llassert(idx < mElementCount);
if(idx >= mElementCount)
{
LL_ERRS() << "Out of bounds LLAlignedArray, requested: " << (S32)idx << " size: " << mElementCount << LL_ENDL;
}
return mArray[idx];
}
template <class T, U32 alignment>
const T& LLAlignedArray<T, alignment>::operator[](int idx) const
{
llassert(idx < mElementCount);
if (idx >= mElementCount)
{
LL_ERRS() << "Out of bounds LLAlignedArray, requested: " << (S32)idx << " size: " << mElementCount << LL_ENDL;
}
return mArray[idx];
}

View File

@ -348,6 +348,7 @@ public:
// support right-click context menus for avatar/group lists
enum ContextMenuType { MENU_NONE, MENU_AVATAR, MENU_GROUP };
void setContextMenu(const ContextMenuType &menu) { mContextMenuType = menu; }
ContextMenuType getContextMenuType() { return mContextMenuType; }
// Overridden from LLView
/*virtual*/ void draw();

View File

@ -102,6 +102,7 @@ BOOL LLFloater360Capture::postBuild()
mWebBrowser = getChild<LLMediaCtrl>("360capture_contents");
mWebBrowser->addObserver(this);
mWebBrowser->setAllowFileDownload(true);
// There is a group of radio buttons that define the quality
// by each having a 'value' that is returns equal to the pixel

View File

@ -1490,7 +1490,11 @@ LLPreviewAnimation::LLPreviewAnimation(S32 width, S32 height) : LLViewerDynamicT
mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), LLViewerObject::CO_FLAG_UI_AVATAR);
mDummyAvatar->mSpecialRenderMode = 1;
mDummyAvatar->startMotion(ANIM_AGENT_STAND, BASE_ANIM_TIME_OFFSET);
mDummyAvatar->hideSkirt();
// on idle overall apperance update will set skirt to visible, so either
// call early or account for mSpecialRenderMode in updateMeshVisibility
mDummyAvatar->updateOverallAppearance();
mDummyAvatar->hideSkirt();
// stop extraneous animations
mDummyAvatar->stopMotion( ANIM_AGENT_HEAD_ROT, TRUE );

View File

@ -46,6 +46,7 @@
#include "lluictrlfactory.h" // LLDefaultChildRegistry
#include "llkeyboard.h"
#include "llviewermenu.h"
#include "llviewermenufile.h" // LLFilePickerThread
// linden library includes
#include "llfocusmgr.h"
@ -105,7 +106,8 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
mTrusted(p.trusted_content),
mWindowShade(NULL),
mHoverTextChanged(false),
mContextMenu(NULL)
mContextMenu(NULL),
mAllowFileDownload(false)
{
{
LLColor4 color = p.caret_color().get();
@ -1165,8 +1167,23 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
case MEDIA_EVENT_FILE_DOWNLOAD:
{
//llinfos << "Media event - file download requested - filename is " << self->getFileDownloadFilename() << llendl;
//LLNotificationsUtil::add("MediaFileDownloadUnsupported");
if (mAllowFileDownload)
{
// pick a file from SAVE FILE dialog
// for now the only thing that should be allowed to save is 360s
std::string suggested_filename = self->getFileDownloadFilename();
LLFilePicker::ESaveFilter filter = LLFilePicker::FFSAVE_ALL;
if (suggested_filename.find(".jpg") != std::string::npos || suggested_filename.find(".jpeg") != std::string::npos)
filter = LLFilePicker::FFSAVE_JPEG;
if (suggested_filename.find(".png") != std::string::npos)
filter = LLFilePicker::FFSAVE_PNG;
(new LLMediaFilePicker(self, filter, suggested_filename))->getFile();
}
else
{
LLNotificationsUtil::add("MediaFileDownloadUnsupported");
}
};
break;

View File

@ -151,6 +151,8 @@ public:
void setTrustedContent(bool trusted);
void setAllowFileDownload(bool allow) { mAllowFileDownload = allow; }
// over-rides
virtual BOOL handleKeyHere(KEY key, MASK mask);
virtual BOOL handleKeyUpHere(KEY key, MASK mask);
@ -206,7 +208,8 @@ public:
mClearCache,
mHoverTextChanged,
mDecoupleTextureSize,
mUpdateScrolls;
mUpdateScrolls,
mAllowFileDownload;
std::string mHomePageUrl,
mHomePageMimeType,

View File

@ -295,6 +295,25 @@ BOOL LLNameListCtrl::handleToolTip(S32 x, S32 y, MASK mask)
return handled;
}
// virtual
BOOL LLNameListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
LLNameListItem* hit_item = dynamic_cast<LLNameListItem*>(hitItem(x, y));
LLFloater* floater = gFloaterView->getParentFloater(this);
if (floater && floater->isFrontmost() && hit_item)
{
if(hit_item->isGroup())
{
ContextMenuType prev_menu = getContextMenuType();
setContextMenu(MENU_GROUP);
BOOL handled = LLScrollListCtrl::handleRightMouseDown(x, y, mask);
setContextMenu(prev_menu);
return handled;
}
}
return LLScrollListCtrl::handleRightMouseDown(x, y, mask);
}
// public
void LLNameListCtrl::addGroupNameItem(const LLUUID& group_id, EAddPosition pos,
BOOL enabled)

View File

@ -191,6 +191,7 @@ public:
/*virtual*/ void updateColumns(bool force_update);
/*virtual*/ void mouseOverHighlightNthItem( S32 index );
/*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
bool isSpecialType() { return (mNameListType == SPECIAL); }

View File

@ -167,10 +167,8 @@ BOOL LLPanelFace::postBuild()
childSetCommitCallback("glossiness",&LLPanelFace::onCommitMaterialGloss, this);
childSetCommitCallback("environment",&LLPanelFace::onCommitMaterialEnv, this);
childSetCommitCallback("maskcutoff",&LLPanelFace::onCommitMaterialMaskCutoff, this);
mCommitCallbackRegistrar.add("BuildTool.AddMedia", boost::bind(&LLPanelFace::onClickBtnAddMedia, this));
mCommitCallbackRegistrar.add("BuildTool.DeleteMedia", boost::bind(&LLPanelFace::onClickBtnDeleteMedia, this));
mCommitCallbackRegistrar.add("BuildTool.EditMedia", boost::bind(&LLPanelFace::onClickBtnEditMedia, this));
childSetCommitCallback("add_media", &LLPanelFace::onClickBtnAddMedia, this);
childSetCommitCallback("delete_media", &LLPanelFace::onClickBtnDeleteMedia, this);
// <FS:CR>
childSetCommitCallback("checkbox_sync_settings", &LLPanelFace::onClickMapsSync, this);
@ -2941,32 +2939,34 @@ void LLPanelFace::onSelectNormalTexture(const LLSD& data)
//////////////////////////////////////////////////////////////////////////////
// called when a user wants to edit existing media settings on a prim or prim face
// TODO: test if there is media on the item and only allow editing if present
void LLPanelFace::onClickBtnEditMedia()
void LLPanelFace::onClickBtnEditMedia(LLUICtrl* ctrl, void* userdata)
{
refreshMedia();
LLPanelFace* self = (LLPanelFace*)userdata;
self->refreshMedia();
LLFloaterReg::showInstance("media_settings");
}
//////////////////////////////////////////////////////////////////////////////
// called when a user wants to delete media from a prim or prim face
void LLPanelFace::onClickBtnDeleteMedia()
void LLPanelFace::onClickBtnDeleteMedia(LLUICtrl* ctrl, void* userdata)
{
LLNotificationsUtil::add("DeleteMedia", LLSD(), LLSD(), deleteMediaConfirm);
}
//////////////////////////////////////////////////////////////////////////////
// called when a user wants to add media to a prim or prim face
void LLPanelFace::onClickBtnAddMedia()
void LLPanelFace::onClickBtnAddMedia(LLUICtrl* ctrl, void* userdata)
{
// check if multiple faces are selected
if (LLSelectMgr::getInstance()->getSelection()->isMultipleTESelected())
{
refreshMedia();
LLPanelFace* self = (LLPanelFace*)userdata;
self->refreshMedia();
LLNotificationsUtil::add("MultipleFacesSelected", LLSD(), LLSD(), multipleFacesSelectedConfirm);
}
else
{
onClickBtnEditMedia();
onClickBtnEditMedia(ctrl, userdata);
}
}

View File

@ -151,9 +151,6 @@ protected:
void onCommitNormalTexture(const LLSD& data);
void onCancelNormalTexture(const LLSD& data);
void onSelectNormalTexture(const LLSD& data);
void onClickBtnEditMedia();
void onClickBtnDeleteMedia();
void onClickBtnAddMedia();
void onCommitColor(const LLSD& data);
void onCommitShinyColor(const LLSD& data);
void onCommitAlpha(const LLSD& data);
@ -211,6 +208,9 @@ protected:
static void onCommitMaterialsMedia( LLUICtrl* ctrl, void* userdata);
static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata);
static void onClickBtnEditMedia(LLUICtrl* ctrl, void* userdata);
static void onClickBtnDeleteMedia(LLUICtrl* ctrl, void* userdata);
static void onClickBtnAddMedia(LLUICtrl* ctrl, void* userdata);
static void onCommitBump( LLUICtrl* ctrl, void* userdata);
static void onCommitTexGen( LLUICtrl* ctrl, void* userdata);
static void onCommitShiny( LLUICtrl* ctrl, void* userdata);

View File

@ -926,7 +926,10 @@ bool LLPreviewNotecard::loadNotecardText(const std::string& filename)
buffer[nread] = '\0';
fclose(file);
mEditor->setText(LLStringExplicit(buffer));
std::string text = std::string(buffer);
LLStringUtil::replaceTabsWithSpaces(text, LLTextEditor::spacesPerTab());
mEditor->setText(text);
delete[] buffer;
return true;

View File

@ -78,41 +78,12 @@
#include <boost/bind.hpp> // for SkinFolder listener
#include <boost/signals2.hpp>
class LLMediaFilePicker : public LLFilePickerThread // deletes itself when done
{
public:
LLMediaFilePicker(LLPluginClassMedia* plugin, LLFilePicker::ELoadFilter filter, bool get_multiple)
: LLFilePickerThread(filter, get_multiple),
mPlugin(plugin->getSharedPrt())
{
}
LLMediaFilePicker(LLPluginClassMedia* plugin, LLFilePicker::ESaveFilter filter, const std::string &proposed_name)
: LLFilePickerThread(filter, proposed_name),
mPlugin(plugin->getSharedPrt())
{
}
virtual void notify(const std::vector<std::string>& filenames)
{
mPlugin->sendPickFileResponse(mResponses);
mPlugin = NULL;
}
private:
boost::shared_ptr<LLPluginClassMedia> mPlugin;
};
void init_threaded_picker_load_dialog(LLPluginClassMedia* plugin, LLFilePicker::ELoadFilter filter, bool get_multiple)
{
(new LLMediaFilePicker(plugin, filter, get_multiple))->getFile(); // will delete itself
}
void init_threaded_picker_save_dialog(LLPluginClassMedia* plugin, LLFilePicker::ESaveFilter filter, std::string &proposed_name)
{
(new LLMediaFilePicker(plugin, filter, proposed_name))->getFile(); // will delete itself
}
///////////////////////////////////////////////////////////////////////////////
// Move this to its own file.
@ -3301,18 +3272,11 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
case LLViewerMediaObserver::MEDIA_EVENT_FILE_DOWNLOAD:
{
LL_DEBUGS("Media") << "Media event - file download requested - filename is " << plugin->getFileDownloadFilename() << LL_ENDL;
// pick a file from SAVE FILE dialog
// need a better algorithm that this or else, pass in type of save type
// from event that initiated it - this is okay for now - only thing
// that saves is 360s
std::string suggested_filename = plugin->getFileDownloadFilename();
LLFilePicker::ESaveFilter filter = LLFilePicker::FFSAVE_ALL;
if (suggested_filename.find(".jpg") != std::string::npos || suggested_filename.find(".jpeg") != std::string::npos)
filter = LLFilePicker::FFSAVE_JPEG;
if (suggested_filename.find(".png") != std::string::npos)
filter = LLFilePicker::FFSAVE_PNG;
init_threaded_picker_save_dialog(plugin, filter, suggested_filename);
//unblock media plugin
const std::vector<std::string> empty_response;
plugin->sendPickFileResponse(empty_response);
LLNotificationsUtil::add("MediaFileDownloadUnsupported");
}
break;

View File

@ -46,6 +46,7 @@
#include "llimagejpeg.h"
#include "llimagetga.h"
#include "llinventorymodel.h" // gInventory
#include "llpluginclassmedia.h"
#include "llresourcedata.h"
#include "lltoast.h"
#include "llfloaterperms.h"
@ -259,6 +260,25 @@ void LLFilePickerReplyThread::notify(const std::vector<std::string>& filenames)
}
}
LLMediaFilePicker::LLMediaFilePicker(LLPluginClassMedia* plugin, LLFilePicker::ELoadFilter filter, bool get_multiple)
: LLFilePickerThread(filter, get_multiple),
mPlugin(plugin->getSharedPrt())
{
}
LLMediaFilePicker::LLMediaFilePicker(LLPluginClassMedia* plugin, LLFilePicker::ESaveFilter filter, const std::string &proposed_name)
: LLFilePickerThread(filter, proposed_name),
mPlugin(plugin->getSharedPrt())
{
}
void LLMediaFilePicker::notify(const std::vector<std::string>& filenames)
{
mPlugin->sendPickFileResponse(mResponses);
mPlugin = NULL;
}
//============================================================================
#if LL_WINDOWS

View File

@ -38,6 +38,7 @@
#include <boost/signals2.hpp> // <FS:CR Threaded Filepickers />
class LLTransactionID;
class LLPluginClassMedia;
void init_menu_file();
@ -72,6 +73,7 @@ void assign_defaults_and_show_upload_message(
const std::string& display_name,
std::string& description);
//consider moving all file pickers below to more suitable place
class LLFilePickerThread : public LLThread
{ //multi-threaded file picker (runs system specific file picker in background and calls "notify" from main thread)
public:
@ -128,4 +130,17 @@ private:
file_picked_signal_t* mFailureSignal;
};
class LLMediaFilePicker : public LLFilePickerThread
{
public:
LLMediaFilePicker(LLPluginClassMedia* plugin, LLFilePicker::ELoadFilter filter, bool get_multiple);
LLMediaFilePicker(LLPluginClassMedia* plugin, LLFilePicker::ESaveFilter filter, const std::string &proposed_name);
virtual void notify(const std::vector<std::string>& filenames);
private:
boost::shared_ptr<LLPluginClassMedia> mPlugin;
};
#endif

View File

@ -499,10 +499,7 @@
top_pad="4"
tool_tip="Add Media"
label="Choose..."
width="85">
<button.commit_callback
function="BuildTool.AddMedia"/>
</button>
width="85"/>
<button
follows="top|left"
height="18"
@ -512,10 +509,7 @@
tool_tip="Delete this media texture"
top_delta="0"
label="Remove"
width="85">
<button.commit_callback
function="BuildTool.DeleteMedia"/>
</button>
width="85"/>
<button
follows="left|top"
height="18"