Thanks for the help guys! I'm still struggling quite a bit, but I've made some progress on making the scene/fragment work. Because I was having so much trouble getting the fragment to appear *at all*, I decided to scrap the fading thing for now until I can get the scene and fragment to work as intended.
The code I'm using right now to create the scene and fragment is:
Code:
ZO_CharacterFramingBlur = ZO_NormalizedPointFragment:Subclass()
function OnNormalizedPointChanged(normalizedX, normalizedY)
SetFullscreenEffect(FULLSCREEN_EFFECT_CHARACTER_FRAMING_BLUR, normalizedX, normalizedY)
end
function ZO_CharacterFramingBlur:New(normalizedPointCallback)
fragment = ZO_NormalizedPointFragment.New(self, normalizedPointCallback, OnNormalizedPointChanged)
return fragment
end
function CalculateCenteredFramingTarget()
screenWidth, screenHeight = GuiRoot:GetDimensions()
return screenWidth / 2, .55 * screenHeight
end
IO_BLUR_FRAGMENT = ZO_CharacterFramingBlur:New(CalculateCenteredFramingTarget)
local IO_BLUR_SCENE = ZO_Scene:New("IO_BLUR_SCENE", SCENE_MANAGER)
IO_BLUR_SCENE:AddFragment(IO_BLUR_FRAGMENT)
And then I call on that code in the following "if" block, which I put under an EVENT_POWER_UPDATE block to track when stamina changes:
Code:
if staminaPercent <= 0.9 then
SCENE_MANAGER:Show("IO_BLUR_SCENE")
else
SCENE_MANAGER:Hide("IO_BLUR_SCENE")
end
With this code my blur effect is appearing in-game, but not very consistently. Instead of simply appearing when under 90% stamina, it seemingly appears when around 10-25% stamina, and then never goes away at all unless I open a menu to change the scene.
But the scene itself is probably the bigger problem for me, because I can't find information on how to change the settings of a scene. When my custom scene appears I can't use abilities anymore, open menus, or turn the camera. I can only use the movement keys. I *think* this is because I need to set the scene's settings to be more like the HUD_SCENE, which obviously allows all of that stuff because that's the base scene that appears when you don't have a window open.
Does anyone happen to know how to change a custom scene's settings? Ideally I'd like for my custom scene to be identical in functionality as the HUD_SCENE, except for it not to disappear when opening other windows (or at least for those to layer on top if that's possible).
I'm only using a custom scene in the first place because I want to limit incompatibility and/or error messages, and also to avoid being locked into using HUD_SCENE's settings, which have it set to disappear while opening menus, etc.