Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions indra/newview/app_settings/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16555,5 +16555,60 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>SnapshotAnimesh</key>
<map>
<key>Comment</key>
<string>If enabled, avatars-only snapshots also render animesh (animated objects).</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>SnapshotParticles</key>
<map>
<key>Comment</key>
<string>If enabled, avatars-only snapshots also render particles.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>SnapshotSelectedObjects</key>
<map>
<key>Comment</key>
<string>If enabled, avatars-only snapshots also render currently selected objects.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>SnapshotAvatarsOnly</key>
<map>
<key>Comment</key>
<string>If enabled, snapshots render only avatars and their attachments on a transparent background.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>SnapshotSitObjects</key>
<map>
<key>Comment</key>
<string>If enabled, avatars-only snapshots also render the objects avatars are sitting on.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
</map>
</llsd>
12 changes: 11 additions & 1 deletion indra/newview/lldrawpoolalpha.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,17 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)

// install glow-accumulating blend mode
// don't touch color, add to alpha (glow)
gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE, LLRender::BF_ONE, LLRender::BF_ONE);
if (LLPipeline::sSnapshotAvatarsOnly && !LLPipeline::sRenderingHUDs && !LLPipeline::sImpostorRender)
{
// avatars-only snapshot repurposes the alpha channel as
// transmittance for the transparent background; adding glow
// there would punch see-through haze around glowing faces
gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE, LLRender::BF_ZERO, LLRender::BF_ONE);
}
else
{
gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE, LLRender::BF_ONE, LLRender::BF_ONE);
}

bool rebind = false;
LLGLSLShader* lastShader = current_shader;
Expand Down
72 changes: 72 additions & 0 deletions indra/newview/llfloatersnapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,66 @@ void LLFloaterSnapshotBase::ImplBase::onClickNoPost(LLUICtrl *ctrl, void* data)
view->impl->updateControls(view);
}

// avatars-only snapshot
// static
void LLFloaterSnapshotBase::ImplBase::onClickAvatarsOnly(LLUICtrl *ctrl, void* data)
{
bool avatars_only = ((LLCheckBoxCtrl*)ctrl)->get();
gSavedSettings.setBOOL("SnapshotAvatarsOnly", avatars_only);

LLFloaterSnapshotBase* view = (LLFloaterSnapshotBase*)data;
view->getPreviewView()->updateSnapshot(true, true);
view->impl->updateControls(view);
}

// avatars-only seat objects
// static
void LLFloaterSnapshotBase::ImplBase::onClickSitObjects(LLUICtrl *ctrl, void* data)
{
bool sit_objects = ((LLCheckBoxCtrl*)ctrl)->get();
gSavedSettings.setBOOL("SnapshotSitObjects", sit_objects);

LLFloaterSnapshotBase* view = (LLFloaterSnapshotBase*)data;
view->getPreviewView()->updateSnapshot(true, true);
view->impl->updateControls(view);
}

// avatars-only animesh
// static
void LLFloaterSnapshotBase::ImplBase::onClickAnimesh(LLUICtrl *ctrl, void* data)
{
bool animesh = ((LLCheckBoxCtrl*)ctrl)->get();
gSavedSettings.setBOOL("SnapshotAnimesh", animesh);

LLFloaterSnapshotBase* view = (LLFloaterSnapshotBase*)data;
view->getPreviewView()->updateSnapshot(true, true);
view->impl->updateControls(view);
}

// avatars-only particles
// static
void LLFloaterSnapshotBase::ImplBase::onClickParticles(LLUICtrl *ctrl, void* data)
{
bool particles = ((LLCheckBoxCtrl*)ctrl)->get();
gSavedSettings.setBOOL("SnapshotParticles", particles);

LLFloaterSnapshotBase* view = (LLFloaterSnapshotBase*)data;
view->getPreviewView()->updateSnapshot(true, true);
view->impl->updateControls(view);
}

// avatars-only selected objects
// static
void LLFloaterSnapshotBase::ImplBase::onClickSelectedObjects(LLUICtrl *ctrl, void* data)
{
bool selected = ((LLCheckBoxCtrl*)ctrl)->get();
gSavedSettings.setBOOL("SnapshotSelectedObjects", selected);

LLFloaterSnapshotBase* view = (LLFloaterSnapshotBase*)data;
view->getPreviewView()->updateSnapshot(true, true);
view->impl->updateControls(view);
}

// static
void LLFloaterSnapshotBase::ImplBase::onClickFilter(LLUICtrl *ctrl, void* data)
{
Expand Down Expand Up @@ -1002,6 +1062,18 @@ bool LLFloaterSnapshot::postBuild()
getChild<LLUICtrl>("no_post_check")->setValue(gSavedSettings.getBOOL("RenderSnapshotNoPost"));
childSetCommitCallback("no_post_check", ImplBase::onClickNoPost, this);

// avatars-only snapshot
getChild<LLUICtrl>("avatars_only_check")->setValue(gSavedSettings.getBOOL("SnapshotAvatarsOnly"));
childSetCommitCallback("avatars_only_check", ImplBase::onClickAvatarsOnly, this);
getChild<LLUICtrl>("sit_objects_check")->setValue(gSavedSettings.getBOOL("SnapshotSitObjects"));
childSetCommitCallback("sit_objects_check", ImplBase::onClickSitObjects, this);
getChild<LLUICtrl>("animesh_check")->setValue(gSavedSettings.getBOOL("SnapshotAnimesh"));
childSetCommitCallback("animesh_check", ImplBase::onClickAnimesh, this);
getChild<LLUICtrl>("particles_check")->setValue(gSavedSettings.getBOOL("SnapshotParticles"));
childSetCommitCallback("particles_check", ImplBase::onClickParticles, this);
getChild<LLUICtrl>("selected_objects_check")->setValue(gSavedSettings.getBOOL("SnapshotSelectedObjects"));
childSetCommitCallback("selected_objects_check", ImplBase::onClickSelectedObjects, this);

getChild<LLButton>("retract_btn")->setCommitCallback(boost::bind(&LLFloaterSnapshot::onExtendFloater, this));
getChild<LLButton>("extend_btn")->setCommitCallback(boost::bind(&LLFloaterSnapshot::onExtendFloater, this));

Expand Down
5 changes: 5 additions & 0 deletions indra/newview/llfloatersnapshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ class LLFloaterSnapshotBase::ImplBase
static void onClickNewSnapshot(void* data);
static void onClickAutoSnap(LLUICtrl *ctrl, void* data);
static void onClickNoPost(LLUICtrl *ctrl, void* data);
static void onClickAvatarsOnly(LLUICtrl *ctrl, void* data); // avatars-only snapshot
static void onClickSitObjects(LLUICtrl *ctrl, void* data); // avatars-only seat objects
static void onClickAnimesh(LLUICtrl *ctrl, void* data); // avatars-only animesh
static void onClickParticles(LLUICtrl *ctrl, void* data); // avatars-only particles
static void onClickSelectedObjects(LLUICtrl *ctrl, void* data); // avatars-only selected objects
static void onClickFilter(LLUICtrl *ctrl, void* data);
static void onClickDisplaySetting(LLUICtrl *ctrl, void* data);
static void onCommitFreezeFrame(LLUICtrl* ctrl, void* data);
Expand Down
22 changes: 21 additions & 1 deletion indra/newview/llsnapshotlivepreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include "llviewertexturelist.h"
#include "llwindow.h"
#include "llworld.h"
#include "pipeline.h" // avatars-only snapshot
#include <boost/filesystem.hpp>

constexpr F32 AUTO_SNAPSHOT_TIME_DELAY = 1.f;
Expand Down Expand Up @@ -576,6 +577,10 @@ void LLSnapshotLivePreview::generateThumbnailImage(bool force_update)
}
else
{
// avatars-only snapshot — only render avatars and their attachments
static LLCachedControl<bool> avatars_only_thumb(gSavedSettings, "SnapshotAvatarsOnly", false);
LLPipeline::setSnapshotAvatarsOnly(avatars_only_thumb);

// The thumbnail is a screen view with screen grab positioning preview
if(!gViewerWindow->thumbnailSnapshot(raw,
mThumbnailWidth, mThumbnailHeight,
Expand All @@ -587,6 +592,8 @@ void LLSnapshotLivePreview::generateThumbnailImage(bool force_update)
{
raw = NULL ;
}

LLPipeline::setSnapshotAvatarsOnly(false); // avatars-only snapshot
}

if (raw)
Expand Down Expand Up @@ -740,6 +747,10 @@ bool LLSnapshotLivePreview::onIdle( void* snapshot_preview )
previewp->getWindow()->incBusyCount();
previewp->setImageScaled(false);

// avatars-only snapshot — only render avatars and their attachments
static LLCachedControl<bool> avatars_only(gSavedSettings, "SnapshotAvatarsOnly", false);
LLPipeline::setSnapshotAvatarsOnly(avatars_only);

// grab the raw image
if (gViewerWindow->rawSnapshot(
previewp->mPreviewImage,
Expand Down Expand Up @@ -775,6 +786,7 @@ bool LLSnapshotLivePreview::onIdle( void* snapshot_preview )
previewp->setThumbnailImageSize();
previewp->generateThumbnailImage(true) ;
}
LLPipeline::setSnapshotAvatarsOnly(false); // avatars-only snapshot
previewp->getWindow()->decBusyCount();
previewp->setVisible(use_freeze_frame && previewp->mAllowFullScreenPreview); // only show fullscreen preview when in freeze frame mode
previewp->mSnapshotActive = false;
Expand Down Expand Up @@ -985,7 +997,15 @@ LLPointer<LLImageFormatted> LLSnapshotLivePreview::getFormattedImage()
mFormattedImage = new LLImageBMP();
break;
}
if (mFormattedImage->encode(mPreviewImage, 0))
// JPEG encoder rejects RGBA input — flatten avatars-only captures to RGB
LLPointer<LLImageRaw> encode_src = mPreviewImage;
if (format == LLSnapshotModel::SNAPSHOT_FORMAT_JPEG && mPreviewImage->getComponents() == 4)
{
encode_src = new LLImageRaw(mPreviewImage->getWidth(), mPreviewImage->getHeight(), 3);
encode_src->copy(mPreviewImage);
}

if (mFormattedImage->encode(encode_src, 0))
{
// We can update the data size precisely at that point
mDataSize = mFormattedImage->getDataSize();
Expand Down
12 changes: 12 additions & 0 deletions indra/newview/llviewerdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,12 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot)
constexpr F32 g = 0.5f;
glClearColor(g, g, g, 1.f);
}
else if (LLPipeline::sSnapshotAvatarsOnly)
{
// avatars-only snapshot — sky is disabled, so the debug magenta clear would
// show through and bleed into alpha-blended edges; clear to black instead
glClearColor(0, 0, 0, 1);
}
else
{
glClearColor(1, 0, 1, 1);
Expand Down Expand Up @@ -1242,6 +1248,12 @@ void display_cube_face()
{
glClearColor(0.5f, 0.5f, 0.5f, 1.f);
}
else if (LLPipeline::sSnapshotAvatarsOnly)
{
// avatars-only snapshot — sky is disabled, so the debug magenta clear would
// show through and bleed into alpha-blended edges; clear to black instead
glClearColor(0.f, 0.f, 0.f, 1.f);
}
else
{
glClearColor(1.f, 0.f, 1.f, 1.f);
Expand Down
Loading
Loading