LLViewerWindow::handlePerFrameHover renamed to LLViewerWindow::updateUI. Migrated some code to LLViewerWindow::updateMouseDelta, but made no functional change. Use LLSelectMgr to look up selected textures for texture view (opposed to soon-to-be-removed llhoverview)

This commit is contained in:
Shyotl
2012-02-24 20:18:46 -06:00
parent a066730acb
commit dcec1cb5f2
6 changed files with 87 additions and 76 deletions

View File

@@ -3912,7 +3912,7 @@ void LLAppViewer::idle()
return;
}
gViewerWindow->handlePerFrameHover();
gViewerWindow->updateUI();
///////////////////////////////////////
// Agent and camera movement

View File

@@ -399,7 +399,7 @@ bool idle_startup()
// until initialization is complete, but need to be done here for things
// to work.
gIdleCallbacks.callFunctions();
gViewerWindow->handlePerFrameHover();
gViewerWindow->updateUI();
LLMortician::updateClass();
if (gNoRender)

View File

@@ -747,52 +747,56 @@ void LLTextureView::draw()
if (!mOrderFetch)
{
#if 1
if (pri < HIGH_PRIORITY && LLSelectMgr::getInstance())
{
struct f : public LLSelectedTEFunctor
if (pri < HIGH_PRIORITY && LLSelectMgr::getInstance())
{
LLViewerFetchedTexture* mImage;
f(LLViewerFetchedTexture* image) : mImage(image) {}
virtual bool apply(LLViewerObject* object, S32 te)
struct f : public LLSelectedTEFunctor
{
return (mImage == object->getTEImage(te));
LLViewerFetchedTexture* mImage;
f(LLViewerFetchedTexture* image) : mImage(image) {}
virtual bool apply(LLViewerObject* object, S32 te)
{
return (mImage == object->getTEImage(te));
}
} func(imagep);
const bool firstonly = true;
bool match = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, firstonly);
if (match)
{
pri += 3*HIGH_PRIORITY;
}
} func(imagep);
const bool firstonly = true;
bool match = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, firstonly);
if (match)
{
pri += 3*HIGH_PRIORITY;
}
}
#endif
#if 1
if (pri < HIGH_PRIORITY && (cur_discard< 0 || desired_discard < cur_discard))
{
LLViewerObject *objectp = gHoverView->getLastHoverObject();
if (objectp)
if (pri < HIGH_PRIORITY && (cur_discard< 0 || desired_discard < cur_discard))
{
S32 tex_count = objectp->getNumTEs();
for (S32 i = 0; i < tex_count; i++)
LLSelectNode* hover_node = LLSelectMgr::instance().getHoverNode();
if (hover_node)
{
if (imagep == objectp->getTEImage(i))
LLViewerObject *objectp = hover_node->getObject();
if (objectp)
{
pri += 2*HIGH_PRIORITY;
break;
S32 tex_count = objectp->getNumTEs();
for (S32 i = 0; i < tex_count; i++)
{
if (imagep == objectp->getTEImage(i))
{
pri += 2*HIGH_PRIORITY;
break;
}
}
}
}
}
}
#endif
#if 1
if (pri > 0.f && pri < HIGH_PRIORITY)
{
if (imagep->mLastPacketTimer.getElapsedTimeF32() < 1.f ||
imagep->mFetchDeltaTime < 0.25f)
if (pri > 0.f && pri < HIGH_PRIORITY)
{
pri += 1*HIGH_PRIORITY;
if (imagep->mLastPacketTimer.getElapsedTimeF32() < 1.f ||
imagep->mFetchDeltaTime < 0.25f)
{
pri += 1*HIGH_PRIORITY;
}
}
}
#endif
}

View File

@@ -152,7 +152,7 @@ void display_startup()
LLGLState::checkStates();
LLGLState::checkTextureChannels();
gViewerWindow->handlePerFrameHover(); // Fix ui flicker.
gViewerWindow->updateUI(); // Fix ui flicker.
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
LLGLSUIDefault gls_ui;

View File

@@ -2793,7 +2793,7 @@ void LLViewerWindow::moveCursorToCenter()
// Update UI based on stored mouse position from mouse-move
// event processing.
BOOL LLViewerWindow::handlePerFrameHover()
void LLViewerWindow::updateUI()
{
static LLFastTimer::DeclareTimer ftm("Update UI");
LLFastTimer t(ftm);
@@ -2819,51 +2819,13 @@ BOOL LLViewerWindow::handlePerFrameHover()
&gDebugRaycastStart,
&gDebugRaycastEnd);
}
//RN: fix for asynchronous notification of mouse leaving window not working
LLCoordWindow mouse_pos;
mWindow->getCursorPosition(&mouse_pos);
if (mouse_pos.mX < 0 ||
mouse_pos.mY < 0 ||
mouse_pos.mX > mWindowRectRaw.getWidth() ||
mouse_pos.mY > mWindowRectRaw.getHeight())
{
mMouseInWindow = FALSE;
}
else
{
mMouseInWindow = TRUE;
}
updateMouseDelta();
S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::sGLScaleFactor.mV[VX]);
S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::sGLScaleFactor.mV[VY]);
LLVector2 mouse_vel;
static const LLCachedControl<bool> mouse_smooth("MouseSmooth",false);
if (mouse_smooth)
{
static F32 fdx = 0.f;
static F32 fdy = 0.f;
F32 amount = 16.f;
fdx = fdx + ((F32) dx - fdx) * llmin(gFrameIntervalSeconds*amount,1.f);
fdy = fdy + ((F32) dy - fdy) * llmin(gFrameIntervalSeconds*amount,1.f);
mCurrentMouseDelta.set(llround(fdx), llround(fdy));
mouse_vel.setVec(fdx,fdy);
}
else
{
mCurrentMouseDelta.set(dx, dy);
mouse_vel.setVec((F32) dx, (F32) dy);
}
mMouseVelocityStat.addValue(mouse_vel.magVec());
if (gNoRender)
{
return TRUE;
return;
}
// clean up current focus
@@ -3239,7 +3201,7 @@ BOOL LLViewerWindow::handlePerFrameHover()
previous_x = x;
previous_y = y;
return handled;
return;
}
@@ -3250,6 +3212,50 @@ void LLViewerWindow::hoverPickCallback(const LLPickInfo& pick_info)
}
void LLViewerWindow::updateMouseDelta()
{
S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::sGLScaleFactor.mV[VX]);
S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::sGLScaleFactor.mV[VY]);
//RN: fix for asynchronous notification of mouse leaving window not working
LLCoordWindow mouse_pos;
mWindow->getCursorPosition(&mouse_pos);
if (mouse_pos.mX < 0 ||
mouse_pos.mY < 0 ||
mouse_pos.mX > mWindowRectRaw.getWidth() ||
mouse_pos.mY > mWindowRectRaw.getHeight())
{
mMouseInWindow = FALSE;
}
else
{
mMouseInWindow = TRUE;
}
LLVector2 mouse_vel;
static const LLCachedControl<bool> mouse_smooth("MouseSmooth",false);
if (mouse_smooth)
{
static F32 fdx = 0.f;
static F32 fdy = 0.f;
F32 amount = 16.f;
fdx = fdx + ((F32) dx - fdx) * llmin(gFrameIntervalSeconds*amount,1.f);
fdy = fdy + ((F32) dy - fdy) * llmin(gFrameIntervalSeconds*amount,1.f);
mCurrentMouseDelta.set(llround(fdx), llround(fdy));
mouse_vel.setVec(fdx,fdy);
}
else
{
mCurrentMouseDelta.set(dx, dy);
mouse_vel.setVec((F32) dx, (F32) dy);
}
mMouseVelocityStat.addValue(mouse_vel.magVec());
}
void LLViewerWindow::saveLastMouse(const LLCoordGL &point)
{
// Store last mouse location.

View File

@@ -282,7 +282,8 @@ public:
void updateObjectUnderCursor();
BOOL handlePerFrameHover(); // Once per frame, update UI based on mouse position
void updateUI(); // Once per frame, update UI based on mouse position
void updateMouseDelta();
BOOL handleKey(KEY key, MASK mask);
void handleScrollWheel (S32 clicks);