Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: #107 - fixed renderer for foundry v11 #110

Conversation

macskay
Copy link

@macskay macskay commented Jun 12, 2023

This makes sure that simplefog can be used with Foundry v11. Foundry now uses Pixi.js v7 and due to that change the MaskLayer.ts needs an update on how to call the Renderer's render function.

Release Note 11.293 for Pixi.js v7: https://foundryvtt.com/releases/11.293 Can be found under Web Workers Upgrading Our PIXIes

API Documentation of latest PIXI.CanvasRenderer of latest release can be found under:
https://pixijs.download/release/docs/PIXI.CanvasRenderer.html#render

For this purpose I moved the options to their own object and passed in the newly created options object to the render function. Now simplefog works again.

Proof:
2023-06-12 15_02_02-Foundry Virtual Tabletop

This affects issue #107

Tested with Version 11.301

@UranusBytes
Copy link
Collaborator

Nice! Thank you for investigating!

Instead of changing the composite function so that it only works with v11, could you do something like an if statement to determine if v11, do the new way, vs if v10 use the old method?

Something like

if (isNewerVersion(game.version, "10.299") ) {
 doNew
} else {
 doOld
}

@macskay
Copy link
Author

macskay commented Jun 12, 2023

Yes of course! Done. Added the clause and bumped the version number

@macskay
Copy link
Author

macskay commented Jun 16, 2023

What exactly is not working? Beware, that the fix has not yet been merged back into the main repository, thus it is not available if you don't install it manually with the specific branch.

Just tested it with 11.302 and the fix still works.
Proof:
image

@macskay
Copy link
Author

macskay commented Jun 17, 2023

Due to increasing demand of this fix I uploaded a temporary release to my repository that can be downloaded and manually installed.
https://github.com/macskay/simplefog/releases/tag/v11-fix

Beware that I will delete this release as soon as the PR I opened for this fix is merged back to the main repository.

@MisterCheesy
Copy link

MisterCheesy commented Jun 20, 2023

This patched version seems to have a problem, I cant select single tokens by clicking when its active in the latest foundry v11.

@mr-bo-jangles
Copy link

This patched version seems to have a problem, I cant select single tokens by clicking when its active in the latest foundry v11.

Have you tested this in combination with other modules or alone? If not alone, I would suggest using Find the Culprit to help narrow down if this is a combination of modules or SimpleFog itself, but.. well.. this issue stops that. You could still attempt to do the process manually though

@MisterCheesy
Copy link

This is the only module active when testing. While the module works just fine manipulating the fog, when its active, tokens cant be manipulated moved or selected. Its like there's some kind of layer over the tokens that I can't see. Some errors from the console when I activate it :

Foundry VTT | Drawing the SimplefogHUDControlLayer canvas layer
foundry.js:5760 Foundry VTT | Rendering HeadsUpDisplay
index.mjs:1 PixiJS Deprecation Warning: Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead.Deprecated since v7.2.0
commons.js:2004 Error: You are accessing BasePackage#data which is now deprecated in favor of referencing schema fields directly on the BasePackage instance.
Deprecated since Version 10
Backwards-compatible support will be removed in Version 12
at logCompatibilityWarning (commons.js:1993:19)
at get data [as data] (commons.js:13978:7)
at SimplefogNotification.checkVersion (SimplefogNotification.js:11:91)
at readyHooks (simplefog.js:61:24)
at Object.fn (main.js:44:2)
at #call (foundry.js:730:20)
at Hooks.callAll (foundry.js:687:17)
at Game.setupGame (foundry.js:8684:11)
at async Game._initializeGameView (foundry.js:9925:5)
at async Game.initialize (foundry.js:8588:5)
logCompatibilityWarning @ commons.js:2004
get data @ commons.js:13978
checkVersion @ SimplefogNotification.js:11
readyHooks @ simplefog.js:61
(anonymous) @ main.js:44
#call @ foundry.js:730
callAll @ foundry.js:687
setupGame @ foundry.js:8684
await in setupGame (async)
_initializeGameView @ foundry.js:9925
_initializeView @ foundry.js:9901
initialize @ foundry.js:8588
await in initialize (async)
window.addEventListener.once @ foundry.js:90585
foundry.js:7620 Foundry VTT | Retrieved and compiled template templates/hud/hud.html
worker.js:73 Worker Compressor | Initialized Worker

@macskay
Copy link
Author

macskay commented Jun 25, 2023

The fix does not erase existing underlying problems. It only makes it work with Foundry 11 again, so you can actually use it at all.

@UranusBytes
Copy link
Collaborator

@macskay In your testing, are you experiencing the problems in #107 (comment) ?

The testing I did yet was exhibiting this, and I haven't been able to come up with an obvious problem. Since moving the SimpleFogLayer zIndex to below the Token layer allows selection of the token, it makes me think it's something with transparent areas of the SimpleFogLayer not propagating click events down to the token layer. Mouseover seems to be propagating since the cursor changes to a finger-pointer and the token gets a surround. I don't see anything different between the v10 and v11 InteractiveCanvasLayer, so I don't think it's that.

@UranusBytes UranusBytes changed the base branch from master to dev-0.3.4 July 29, 2023 15:50
@UranusBytes UranusBytes merged commit d811a76 into League-of-Foundry-Developers:dev-0.3.4 Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants