-
-
Notifications
You must be signed in to change notification settings - Fork 408
EffectEngine: Refactoring, stabalizing and fixes #2011
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
Merged
Merged
Changes from 18 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
680c10c
Fix RC in error path
wr-web 3447046
EffectEngine: Fix follow-up Python reference-counting bugs
Lord-Grey ce44e20
EffectEngine: Fix missing null-guards and silent null returns
Lord-Grey 2102294
Apply Feedback
Lord-Grey 8f72a47
Refactor and cleanup
Lord-Grey a04aa52
Merge branch 'master' into fix/python-refcount-effectengine
Lord-Grey 7c93130
Fixes
Lord-Grey 8b25859
Fixes 2
Lord-Grey 6033c6e
Refactor
Lord-Grey c922a02
Refactor
Lord-Grey d393d63
Add effect tracing
Lord-Grey 9fc0eee
Have Image 0x0 as empty one and not 1x1
Lord-Grey ba418b2
Stabalise effects
Lord-Grey cfd7686
Apply feedback
Lord-Grey 057437f
Effect stability
Lord-Grey e1dea12
New Jugger effect
Lord-Grey 890e915
Update changelog
Lord-Grey cfd9a8e
Improvements
Lord-Grey 1a6332e
Potential fix for pull request finding
Lord-Grey 6dc79ca
Potential fix for pull request finding
Lord-Grey 3d65ba1
Potential fix for pull request finding
Lord-Grey 70849e5
Potential fix for pull request finding
Lord-Grey 45bc2e9
Consistently use adjusted local cropLeft computed earlier
Lord-Grey 1f757c9
Merge branch 'fix/python-refcount-effectengine' of github.com:hyperio…
Lord-Grey a2dc290
Merge branch 'master' into fix/python-refcount-effectengine
Lord-Grey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "name" : "Juggler", | ||
| "script" : "juggler.py", | ||
| "args" : | ||
| { | ||
| "brightness" : 100 | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import hyperion, time, math, colorsys | ||
|
|
||
| # Parameter | ||
| brightness = float(hyperion.args.get('brightness', 100)) / 100.0 | ||
|
|
||
| # Image setup | ||
| hyperion.imageMinSize(64, 64) | ||
| iW = hyperion.imageWidth() | ||
| iH = hyperion.imageHeight() | ||
|
|
||
| sleepTime = max(hyperion.lowestUpdateInterval(), 1.0 / 60.0) | ||
|
|
||
| # Buffer | ||
| buf = [[[0, 0, 0] for _ in range(iH)] for _ in range(iW)] | ||
|
|
||
| # Constants | ||
| numDots = 8 | ||
| dotR = max(2, min(iW, iH) // 20) | ||
| dotRSq = dotR * dotR | ||
|
|
||
| # Precompute the circular dot mask | ||
| dotMask = [] | ||
| for ox in range(-dotR, dotR + 1): | ||
| for oy in range(-dotR, dotR + 1): | ||
| distSq = ox * ox + oy * oy | ||
| if distSq <= dotRSq: | ||
| dist = math.sqrt(distSq) | ||
| intensity = max(0, 255 - int(dist / dotR * 200)) | ||
| dotMask.append((ox, oy, intensity)) | ||
|
|
||
| # Main loop | ||
| startTime = time.time() | ||
| while not hyperion.abort(): | ||
| tMs = (time.time() - startTime) * 1000.0 | ||
|
|
||
| # Fade buffer | ||
| scale = max(0.0, 1.0 - 25 / 256.0) | ||
| for x in range(iW): | ||
| for y in range(iH): | ||
| buf[x][y][0] = int(buf[x][y][0] * scale) | ||
| buf[x][y][1] = int(buf[x][y][1] * scale) | ||
| buf[x][y][2] = int(buf[x][y][2] * scale) | ||
|
|
||
| # Draw moving dots | ||
| for i in range(numDots): | ||
| angleX = (tMs / 60000.0) * (i + 5) * 2.0 * math.pi + i * 1.3 | ||
| angleY = (tMs / 60000.0) * (i + 3) * 2.0 * math.pi + i * 0.9 + math.pi | ||
| dx = int((math.sin(angleX) + 1.0) * 0.5 * (iW - 1)) | ||
| dy = int((math.sin(angleY) + 1.0) * 0.5 * (iH - 1)) | ||
|
|
||
| r, g, b = colorsys.hsv_to_rgb(((i * 32) & 255) / 255.0, 200 / 255.0, 255 / 255.0) | ||
| r = int(r * 255) | ||
| g = int(g * 255) | ||
| b = int(b * 255) | ||
|
|
||
| for ox, oy, intensity in dotMask: | ||
| x = dx + ox | ||
| y = dy + oy | ||
| if 0 <= x < iW and 0 <= y < iH: | ||
| pr = r * intensity // 255 | ||
| pg = g * intensity // 255 | ||
| pb = b * intensity // 255 | ||
| buf[x][y][0] = max(buf[x][y][0], pr) | ||
| buf[x][y][1] = max(buf[x][y][1], pg) | ||
| buf[x][y][2] = max(buf[x][y][2], pb) | ||
|
|
||
| # Push buffer to Hyperion image | ||
| for x in range(iW): | ||
| for y in range(iH): | ||
| r = int(buf[x][y][0] * brightness) | ||
| g = int(buf[x][y][1] * brightness) | ||
| b = int(buf[x][y][2] * brightness) | ||
| hyperion.imageSetPixel(x, y, r, g, b) | ||
|
|
||
| hyperion.imageShow() | ||
| hyperion.imageStackClear() | ||
|
|
||
| time.sleep(sleepTime) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "type": "object", | ||
| "script": "juggler.py", | ||
| "title": "edt_eff_juggler_header", | ||
| "required": true, | ||
| "properties": { | ||
| "brightness": { | ||
| "type": "number", | ||
| "title": "edt_eff_brightness", | ||
| "default": 100, | ||
| "minimum": 1, | ||
| "maximum": 100, | ||
| "append": "edt_append_percent", | ||
| "propertyOrder": 1 | ||
| } | ||
| }, | ||
| "additionalProperties": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.