Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
XDG Integration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
JennaHuntsman
XDG Integration
Commits
70237de3
Commit
70237de3
authored
3 years ago
by
Kitty Barnett
Browse files
Options
Downloads
Patches
Plain Diff
Add actual support for effect priority and enabled/disabled state
parent
a0ff6c35
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/newview/llvisualeffect.cpp
+41
-18
41 additions, 18 deletions
indra/newview/llvisualeffect.cpp
indra/newview/llvisualeffect.h
+10
-2
10 additions, 2 deletions
indra/newview/llvisualeffect.h
with
51 additions
and
20 deletions
indra/newview/llvisualeffect.cpp
+
41
−
18
View file @
70237de3
...
@@ -69,8 +69,8 @@ LLVector4 LLTweenableValueLerp<LLVector4>::get()
...
@@ -69,8 +69,8 @@ LLVector4 LLTweenableValueLerp<LLVector4>::get()
//
//
LLVfxManager
::
LLVfxManager
()
LLVfxManager
::
LLVfxManager
()
:
m_Effects
(
&
cmpEffect
)
{
{
}
}
bool
LLVfxManager
::
addEffect
(
LLVisualEffect
*
pEffectInst
)
bool
LLVfxManager
::
addEffect
(
LLVisualEffect
*
pEffectInst
)
...
@@ -91,6 +91,20 @@ LLVisualEffect* LLVfxManager::getEffect(EVisualEffect eCode, const LLUUID& idEff
...
@@ -91,6 +91,20 @@ LLVisualEffect* LLVfxManager::getEffect(EVisualEffect eCode, const LLUUID& idEff
return
(
m_Effects
.
end
()
!=
itEffect
)
?
*
itEffect
:
nullptr
;
return
(
m_Effects
.
end
()
!=
itEffect
)
?
*
itEffect
:
nullptr
;
}
}
bool
LLVfxManager
::
getEffects
(
std
::
list
<
LLVisualEffect
*>&
effectList
,
std
::
function
<
bool
(
const
LLVisualEffect
*
)
>
fnFilter
)
{
effectList
.
clear
();
auto
itEffect
=
boost
::
make_filter_iterator
(
fnFilter
,
m_Effects
.
begin
(),
m_Effects
.
end
()),
endEffect
=
boost
::
make_filter_iterator
(
fnFilter
,
m_Effects
.
end
(),
m_Effects
.
end
());
while
(
itEffect
!=
endEffect
)
{
effectList
.
push_back
(
*
itEffect
++
);
}
return
effectList
.
size
();
}
bool
LLVfxManager
::
removeEffect
(
EVisualEffect
eCode
,
const
LLUUID
&
idEffect
)
bool
LLVfxManager
::
removeEffect
(
EVisualEffect
eCode
,
const
LLUUID
&
idEffect
)
{
{
auto
itEffect
=
std
::
find_if
(
m_Effects
.
begin
(),
m_Effects
.
end
(),
[
eCode
,
&
idEffect
](
const
LLVisualEffect
*
pEffect
)
{
return
pEffect
->
getCode
()
==
eCode
&&
pEffect
->
getId
()
==
idEffect
;
});
auto
itEffect
=
std
::
find_if
(
m_Effects
.
begin
(),
m_Effects
.
end
(),
[
eCode
,
&
idEffect
](
const
LLVisualEffect
*
pEffect
)
{
return
pEffect
->
getCode
()
==
eCode
&&
pEffect
->
getId
()
==
idEffect
;
});
...
@@ -104,33 +118,42 @@ bool LLVfxManager::removeEffect(EVisualEffect eCode, const LLUUID& idEffect)
...
@@ -104,33 +118,42 @@ bool LLVfxManager::removeEffect(EVisualEffect eCode, const LLUUID& idEffect)
void
LLVfxManager
::
runEffect
(
EVisualEffect
eCode
,
LLVisualEffectParams
*
pParams
)
void
LLVfxManager
::
runEffect
(
EVisualEffect
eCode
,
LLVisualEffectParams
*
pParams
)
{
{
// *TODO-Catz: once we're done, check whether iterating over the entire list still has negliable impact
runEffect
([
eCode
](
const
LLVisualEffect
*
pEffect
)
{
return
pEffect
->
getCode
()
==
eCode
;
},
pParams
);
auto
pred
=
[
eCode
](
const
LLVisualEffect
*
pEffect
)
{
return
pEffect
->
getCode
()
==
eCode
;
};
}
void
LLVfxManager
::
runEffect
(
EVisualEffectType
eType
,
LLVisualEffectParams
*
pParams
)
{
runEffect
([
eType
](
const
LLVisualEffect
*
pEffect
)
{
return
pEffect
->
getType
()
==
eType
;
},
pParams
);
}
auto
itEffect
=
boost
::
make_filter_iterator
(
pred
,
m_Effects
.
begin
(),
m_Effects
.
end
()),
void
LLVfxManager
::
runEffect
(
std
::
function
<
bool
(
const
LLVisualEffect
*
)
>
predicate
,
LLVisualEffectParams
*
pParams
)
endEffect
=
boost
::
make_filter_iterator
(
pred
,
m_Effects
.
end
(),
m_Effects
.
end
());
{
// *TODO-Catz: once we're done, check whether iterating over the entire list still has negliable impact
auto
itEffect
=
boost
::
make_filter_iterator
(
predicate
,
m_Effects
.
begin
(),
m_Effects
.
end
()),
endEffect
=
boost
::
make_filter_iterator
(
predicate
,
m_Effects
.
end
(),
m_Effects
.
end
());
while
(
itEffect
!=
endEffect
)
while
(
itEffect
!=
endEffect
)
{
{
LLVisualEffect
*
pEffect
=
*
itEffect
++
;
LLVisualEffect
*
pEffect
=
*
itEffect
++
;
if
(
pParams
)
if
(
pEffect
->
getEnabled
())
pParams
->
step
(
itEffect
==
endEffect
);
{
pEffect
->
run
(
pParams
);
if
(
pParams
)
pParams
->
step
(
itEffect
==
endEffect
);
pEffect
->
run
(
pParams
);
}
}
}
}
}
void
LLVfxManager
::
runEffect
(
EVisualEffectType
eType
,
LLVisualEffectParams
*
pParams
)
// static
bool
LLVfxManager
::
cmpEffect
(
const
LLVisualEffect
*
pLHS
,
const
LLVisualEffect
*
pRHS
)
{
{
// *TODO-Catz: once we're done, check whether iterating over the entire list still has negliable impact
if
(
pLHS
&&
pRHS
)
auto
pred
=
[
eType
](
const
LLVisualEffect
*
pEffect
)
{
return
pEffect
->
getType
()
==
eType
;
};
auto
itEffect
=
boost
::
make_filter_iterator
(
pred
,
m_Effects
.
begin
(),
m_Effects
.
end
()),
endEffect
=
boost
::
make_filter_iterator
(
pred
,
m_Effects
.
end
(),
m_Effects
.
end
());
for
(;
itEffect
!=
endEffect
;
++
itEffect
)
{
{
if
(
pParams
)
// Sort by code, then priority, then memory address
pParams
->
step
(
itEffect
==
endEffect
);
return
(
pLHS
->
getCode
()
==
pRHS
->
getCode
())
?
(
pLHS
->
getPriority
()
==
pRHS
->
getPriority
()
?
pLHS
<
pRHS
(
*
itEffect
)
->
run
(
pParams
);
:
pLHS
->
getPriority
()
<
pRHS
->
getPriority
())
:
pLHS
->
getCode
()
<
pRHS
->
getCode
();
}
}
return
(
pLHS
);
}
}
// ============================================================================
// ============================================================================
This diff is collapsed.
Click to expand it.
indra/newview/llvisualeffect.h
+
10
−
2
View file @
70237de3
...
@@ -78,9 +78,12 @@ class LLVisualEffect
...
@@ -78,9 +78,12 @@ class LLVisualEffect
virtual
~
LLVisualEffect
()
{}
virtual
~
LLVisualEffect
()
{}
EVisualEffect
getCode
()
const
{
return
m_eCode
;}
EVisualEffect
getCode
()
const
{
return
m_eCode
;}
bool
getEnabled
()
const
{
return
m_fEnabled
;
}
const
LLUUID
&
getId
()
const
{
return
m_id
;}
const
LLUUID
&
getId
()
const
{
return
m_id
;}
U32
getPriority
()
const
{
return
m_nPriority
;
}
U32
getPriority
()
const
{
return
m_nPriority
;
}
EVisualEffectType
getType
()
const
{
return
m_eType
;}
EVisualEffectType
getType
()
const
{
return
m_eType
;}
void
setEnabled
(
bool
enable
)
{
m_fEnabled
=
enable
;
}
void
setPriority
(
U32
priority
)
{
m_nPriority
=
priority
;
}
virtual
void
run
(
const
LLVisualEffectParams
*
pParams
)
=
0
;
virtual
void
run
(
const
LLVisualEffectParams
*
pParams
)
=
0
;
...
@@ -91,7 +94,8 @@ class LLVisualEffect
...
@@ -91,7 +94,8 @@ class LLVisualEffect
LLUUID
m_id
;
LLUUID
m_id
;
EVisualEffect
m_eCode
;
EVisualEffect
m_eCode
;
EVisualEffectType
m_eType
;
EVisualEffectType
m_eType
;
U32
m_nPriority
;
bool
m_fEnabled
=
true
;
U32
m_nPriority
=
0
;
};
};
// ============================================================================
// ============================================================================
...
@@ -161,18 +165,22 @@ class LLVfxManager : public LLSingleton<LLVfxManager>
...
@@ -161,18 +165,22 @@ class LLVfxManager : public LLSingleton<LLVfxManager>
bool
addEffect
(
LLVisualEffect
*
pEffectInst
);
bool
addEffect
(
LLVisualEffect
*
pEffectInst
);
LLVisualEffect
*
getEffect
(
EVisualEffect
eCode
,
const
LLUUID
&
idEffect
)
const
;
LLVisualEffect
*
getEffect
(
EVisualEffect
eCode
,
const
LLUUID
&
idEffect
)
const
;
template
<
typename
T
>
T
*
getEffect
(
const
LLUUID
&
idEffect
)
const
{
return
dynamic_cast
<
T
*>
(
getEffect
(
T
::
EffectCode
,
idEffect
));
}
template
<
typename
T
>
T
*
getEffect
(
const
LLUUID
&
idEffect
)
const
{
return
dynamic_cast
<
T
*>
(
getEffect
(
T
::
EffectCode
,
idEffect
));
}
bool
getEffects
(
std
::
list
<
LLVisualEffect
*>&
effectList
,
std
::
function
<
bool
(
const
LLVisualEffect
*
)
>
fnFilter
);
template
<
typename
T
>
bool
getEffects
(
std
::
list
<
LLVisualEffect
*>&
effectList
)
{
return
getEffects
(
effectList
,
[](
const
LLVisualEffect
*
pEffect
)
{
return
pEffect
->
getCode
()
==
T
::
EffectCode
;
});
}
bool
hasEffect
(
EVisualEffect
eCode
)
const
;
bool
hasEffect
(
EVisualEffect
eCode
)
const
;
bool
removeEffect
(
EVisualEffect
eCode
,
const
LLUUID
&
idEffect
);
bool
removeEffect
(
EVisualEffect
eCode
,
const
LLUUID
&
idEffect
);
template
<
typename
T
>
bool
removeEffect
(
const
LLUUID
&
idEffect
)
{
return
removeEffect
(
T
::
EffectCode
,
idEffect
);
}
template
<
typename
T
>
bool
removeEffect
(
const
LLUUID
&
idEffect
)
{
return
removeEffect
(
T
::
EffectCode
,
idEffect
);
}
void
runEffect
(
EVisualEffect
eCode
,
LLVisualEffectParams
*
pParams
=
nullptr
);
void
runEffect
(
EVisualEffect
eCode
,
LLVisualEffectParams
*
pParams
=
nullptr
);
void
runEffect
(
EVisualEffectType
eType
,
LLVisualEffectParams
*
pParams
=
nullptr
);
void
runEffect
(
EVisualEffectType
eType
,
LLVisualEffectParams
*
pParams
=
nullptr
);
protected
:
protected
:
void
runEffect
(
std
::
function
<
bool
(
const
LLVisualEffect
*
)
>
fnFilter
,
LLVisualEffectParams
*
pParams
);
static
bool
cmpEffect
(
const
LLVisualEffect
*
pLHS
,
const
LLVisualEffect
*
pRHS
);
/*
/*
* Member variables
* Member variables
*/
*/
protected
:
protected
:
std
::
set
<
LLVisualEffect
*>
m_Effects
;
std
::
set
<
LLVisualEffect
*
,
decltype
(
&
cmpEffect
)
>
m_Effects
;
};
};
// ============================================================================
// ============================================================================
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment