mirror of
https://github.com/litruv/PNGTuber-Plus.git
synced 2026-07-25 19:16:02 +10:00
Compare commits
19 Commits
v2025.07.2
...
v2025.07.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 56e76c61e6 | |||
| 5dfe68cb81 | |||
| 6e02a67114 | |||
| 32a67a6617 | |||
| fb0c7a9e3b | |||
| f0ce00b23b | |||
| d4a9f5a0b0 | |||
| 085d6a21a0 | |||
| 99d2d3f508 | |||
| dad22ece22 | |||
| 52496df10e | |||
| 29b903fadd | |||
| e8191e2de8 | |||
| b7b7d7cdec | |||
| fc6e4a1028 | |||
| 1dfe21363b | |||
| fde3f23ed5 | |||
| 79e54c28da | |||
| a8f327ae5a |
46
.github/workflows/build-windows.yml
vendored
46
.github/workflows/build-windows.yml
vendored
@@ -16,6 +16,7 @@ jobs:
|
|||||||
export-windows:
|
export-windows:
|
||||||
name: Windows Export
|
name: Windows Export
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
|
if: contains(github.event.head_commit.message, '!build')
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -124,11 +125,49 @@ jobs:
|
|||||||
Write-Host "Generated tag: $tag"
|
Write-Host "Generated tag: $tag"
|
||||||
Write-Host "Generated release name: $releaseName"
|
Write-Host "Generated release name: $releaseName"
|
||||||
|
|
||||||
|
# Get the latest release tag to compare against
|
||||||
|
$latestTag = ""
|
||||||
|
try {
|
||||||
|
$latestTag = & git describe --tags --abbrev=0 2>$null
|
||||||
|
Write-Host "Latest tag found: $latestTag"
|
||||||
|
} catch {
|
||||||
|
Write-Host "No previous tags found, showing all commits"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Generate commit history since last tag (or all commits if no tag)
|
||||||
|
$commitRange = if ($latestTag) { "$latestTag..HEAD" } else { "HEAD" }
|
||||||
|
|
||||||
|
# Get commits with format: short hash, subject, author
|
||||||
|
$commits = & git log $commitRange --pretty=format:"%h|%s|%an" --no-merges
|
||||||
|
|
||||||
|
# Build commit history as a single string
|
||||||
|
$commitHistory = ""
|
||||||
|
|
||||||
|
if ($commits) {
|
||||||
|
$commitHistory += "`n`n## Changes Since Last Release`n`n"
|
||||||
|
|
||||||
|
$commits | ForEach-Object {
|
||||||
|
$parts = $_ -split '\|', 3
|
||||||
|
$hash = $parts[0]
|
||||||
|
$subject = $parts[1] -replace '"', '""'
|
||||||
|
$author = $parts[2]
|
||||||
|
$commitUrl = "https://github.com/${{ github.repository }}/commit/$hash"
|
||||||
|
$commitHistory += "- [$hash]($commitUrl) $subject`n"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$commitHistory += "`n`n## Changes Since Last Release`n`nNo new commits since last release.`n"
|
||||||
|
}
|
||||||
|
|
||||||
# Set outputs for use in next steps
|
# Set outputs for use in next steps
|
||||||
echo "tag=$tag" >> $env:GITHUB_OUTPUT
|
echo "tag=$tag" >> $env:GITHUB_OUTPUT
|
||||||
echo "release_name=$releaseName" >> $env:GITHUB_OUTPUT
|
echo "release_name=$releaseName" >> $env:GITHUB_OUTPUT
|
||||||
echo "short_sha=$shortSha" >> $env:GITHUB_OUTPUT
|
echo "short_sha=$shortSha" >> $env:GITHUB_OUTPUT
|
||||||
echo "build_number=$buildNumber" >> $env:GITHUB_OUTPUT
|
echo "build_number=$buildNumber" >> $env:GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# Use heredoc syntax for multiline commit history
|
||||||
|
Add-Content -Path $env:GITHUB_OUTPUT -Value "commit_history<<EOF"
|
||||||
|
Add-Content -Path $env:GITHUB_OUTPUT -Value $commitHistory
|
||||||
|
Add-Content -Path $env:GITHUB_OUTPUT -Value "EOF"
|
||||||
- name: Download Windows Build
|
- name: Download Windows Build
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -145,15 +184,14 @@ jobs:
|
|||||||
release_name: ${{ steps.release_info.outputs.release_name }}
|
release_name: ${{ steps.release_info.outputs.release_name }}
|
||||||
body: |
|
body: |
|
||||||
Automated build of PNGTuber Plus
|
Automated build of PNGTuber Plus
|
||||||
|
|
||||||
|
${{ steps.release_info.outputs.commit_history }}
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
1. Download PNGTuber-Plus.exe from the assets below
|
1. Download PNGTuber-Plus.exe from the assets below
|
||||||
2. Run the executable - no installation required!
|
2. Run the executable - no installation required!
|
||||||
3. For StreamDeck integration, download the plugin from [here](https://github.com/BoyneGames/streamdeck-godot-plugin/releases/tag/1.0.0)
|
3. For StreamDeck integration, download the plugin from [here](https://github.com/BoyneGames/streamdeck-godot-plugin/releases/tag/1.0.0)
|
||||||
|
|
||||||
## Credits
|
|
||||||
- Original project by [kaiakairos](https://github.com/kaiakairos/PNGTuber-Plus)
|
|
||||||
- Microphone improvements by [k0ffinz](https://github.com/k0ffinz/PNGTuber-Plus)
|
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
|
||||||
|
|||||||
2
.vscode/tasks.json
vendored
2
.vscode/tasks.json
vendored
@@ -4,7 +4,7 @@
|
|||||||
{
|
{
|
||||||
"label": "Build PNGTuber-Plus",
|
"label": "Build PNGTuber-Plus",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "cd c:\\DEV\\Sync\\PNGTuber-Plus && .\\build-windows.bat",
|
"command": "cd c:\\DEV\\Sync\\PNGTuber-Plus; .\\build-windows.bat",
|
||||||
"group": "build"
|
"group": "build"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
79
README.md
79
README.md
@@ -2,16 +2,73 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Recent Updates by Litruv
|
A fork of [kaiakairos/PNGTuber-Plus](https://github.com/kaiakairos/PNGTuber-Plus) with some quality-of-life upgrades, editor polish, and a few power-user toys.
|
||||||
- **GitHub Actions**: Automated Windows builds on every commit
|
|
||||||
- **StreamDeck Integration**: Add buttons to enable the streamdeck plugin that was built in
|
|
||||||
- **Rotation Wobble**: New sprite rotation effects with frequency and amplitude controls
|
|
||||||
- **Enhanced Modifier Keys**: Support for complex key combinations (Ctrl+Shift+Alt+Cmd)
|
|
||||||
- **Godot 4.4.1 Support**: Updated for latest Godot stable release
|
|
||||||
- **Microphone Improvements**: Audio delay fix & more *from [k0ffinz/PNGTuber-Plus](https://github.com/k0ffinz/PNGTuber-Plus)*
|
|
||||||
|
|
||||||
## 🙏 Credits
|
---
|
||||||
|
|
||||||
- **Original Project**: [PNGTuber Plus by kaiakairos](https://github.com/kaiakairos/PNGTuber-Plus)
|
## 🔧 Fork Changes (Litruv Edition)
|
||||||
- **StreamDeck Plugin**: Based on [BoyneGames StreamDeck Godot Plugin](https://github.com/BoyneGames/streamdeck-godot-plugin)
|
|
||||||
- **Microphone Improvements**: k0ffinz - Experimental mic loudness detection, improved audio initialization, and audio delay fixes from [k0ffinz/PNGTuber-Plus](https://github.com/k0ffinz/PNGTuber-Plus)
|
### 🎛️ Opacity Controls
|
||||||
|
|
||||||
|
Added a proper opacity slider for sprites, with an "affect children" toggle. Clip masks still behave like they should.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
### 🌀 Rotation Wobble
|
||||||
|
|
||||||
|
Sprites can now do a subtle (or chaotic) rotational wobble. Frequency + amplitude sliders included.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
### ⌨️ Enhanced Modifier Keys
|
||||||
|
|
||||||
|
Supports combos like Ctrl+Shift+Alt+Cmd. For people with more keybinds than fingers.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
### ↗️ Editor Middle Mouse Button Panning
|
||||||
|
|
||||||
|
Hold MMB in the editor to pan around the scene, it'll reset when you go back to live.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### ↗️ View Mode MMB Shake
|
||||||
|
|
||||||
|
Hold MMB in view mode to shake your character, Show off them physics!
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
🎞️ Delta Time Physics
|
||||||
|
|
||||||
|
Physics are now framerate-independent. Low FPS won’t make your character move in slow motion anymore.
|
||||||
|
Just smooth, consistent jank if that’s your thing. Great for stop-motion vibes.
|
||||||
|
|
||||||
|
|
||||||
|
### 🎤 Microphone Fixes
|
||||||
|
|
||||||
|
Merged in [k0ffinz’s](https://github.com/k0ffinz/PNGTuber-Plus) audio tweaks:
|
||||||
|
|
||||||
|
* Reduced mic startup delay
|
||||||
|
* Better loudness detection
|
||||||
|
* General stability improvements
|
||||||
|
|
||||||
|
|
||||||
|
### 🧱 Engine Update
|
||||||
|
|
||||||
|
Updated to **Godot 4.4.1** — no more editor nags or compatibility weirdness.
|
||||||
|
|
||||||
|
|
||||||
|
### 🎚️ StreamDeck Integration
|
||||||
|
|
||||||
|
StreamDeck plugin was already in, this just wires up the buttons.
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧾 Credits
|
||||||
|
|
||||||
|
* Original project by [kaiakairos](https://github.com/kaiakairos/PNGTuber-Plus)
|
||||||
|
* StreamDeck plugin from [BoyneGames](https://github.com/BoyneGames/streamdeck-godot-plugin)
|
||||||
|
* Mic improvements by [k0ffinz](https://github.com/k0ffinz/PNGTuber-Plus)
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ func _process(delta):
|
|||||||
heldSprite.z += 1
|
heldSprite.z += 1
|
||||||
heldSprite.setZIndex()
|
heldSprite.setZIndex()
|
||||||
pushUpdate("Moved sprite layer.")
|
pushUpdate("Moved sprite layer.")
|
||||||
if main.editMode:
|
if main and main.editMode:
|
||||||
if Input.is_action_just_pressed("reparent"):
|
if Input.is_action_just_pressed("reparent"):
|
||||||
reparentMode = !reparentMode
|
reparentMode = !reparentMode
|
||||||
Global.chain.enable(reparentMode)
|
Global.chain.enable(reparentMode)
|
||||||
@@ -115,7 +115,7 @@ func _process(delta):
|
|||||||
reparentMode = false
|
reparentMode = false
|
||||||
Global.chain.enable(reparentMode)
|
Global.chain.enable(reparentMode)
|
||||||
|
|
||||||
if main.editMode:
|
if main and main.editMode:
|
||||||
if reparentMode:
|
if reparentMode:
|
||||||
RenderingServer.set_default_clear_color(Color.POWDER_BLUE)
|
RenderingServer.set_default_clear_color(Color.POWDER_BLUE)
|
||||||
else:
|
else:
|
||||||
@@ -126,7 +126,7 @@ func _process(delta):
|
|||||||
scrollSprites()
|
scrollSprites()
|
||||||
|
|
||||||
|
|
||||||
if !main.fileSystemOpen:
|
if !main or main.fileSystemOpen:
|
||||||
|
|
||||||
if Input.is_action_just_pressed("refresh"):
|
if Input.is_action_just_pressed("refresh"):
|
||||||
refresh()
|
refresh()
|
||||||
@@ -222,7 +222,7 @@ func scrollSprites():
|
|||||||
if Input.is_action_pressed("control"):
|
if Input.is_action_pressed("control"):
|
||||||
return
|
return
|
||||||
|
|
||||||
if !main.editMode:
|
if !main or !main.editMode:
|
||||||
return
|
return
|
||||||
|
|
||||||
if main.fileSystemOpen:
|
if main.fileSystemOpen:
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ extends Node2D
|
|||||||
@onready var editButton = $Edit/Button
|
@onready var editButton = $Edit/Button
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
|
var uiAnimSpeed = Global.main.physicsTimeMultiplier * 20.0 if Global.main else 120.0
|
||||||
if Rect2(editButton.get_parent().position-Vector2(24,24),editButton.size).has_point(get_local_mouse_position()):
|
if Rect2(editButton.get_parent().position-Vector2(24,24),editButton.size).has_point(get_local_mouse_position()):
|
||||||
editSprite.scale = lerp(editSprite.scale,Vector2(1.2,1.2),0.2)
|
editSprite.scale = lerp(editSprite.scale, Vector2(1.2,1.2), delta * uiAnimSpeed)
|
||||||
else:
|
else:
|
||||||
editSprite.scale = lerp(editSprite.scale,Vector2(1.0,1.0),0.2)
|
editSprite.scale = lerp(editSprite.scale, Vector2(1.0,1.0), delta * uiAnimSpeed)
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ func _process(delta):
|
|||||||
if buttons[b] == null:
|
if buttons[b] == null:
|
||||||
continue
|
continue
|
||||||
if Rect2(buttons[b].get_parent().position-Vector2(24,24),buttons[b].size).has_point(get_local_mouse_position()):
|
if Rect2(buttons[b].get_parent().position-Vector2(24,24),buttons[b].size).has_point(get_local_mouse_position()):
|
||||||
sprites[s].scale = lerp(sprites[s].scale,Vector2(1.2,1.2),0.2)
|
var uiAnimSpeed = Global.main.physicsTimeMultiplier * 20.0 if Global.main else 120.0
|
||||||
|
sprites[s].scale = lerp(sprites[s].scale, Vector2(1.2,1.2), delta * uiAnimSpeed)
|
||||||
if Input.is_action_pressed("mouse_left"):
|
if Input.is_action_pressed("mouse_left"):
|
||||||
sprites[s].scale = Vector2(0.6,0.6)
|
sprites[s].scale = Vector2(0.6,0.6)
|
||||||
match b:
|
match b:
|
||||||
@@ -50,7 +51,8 @@ func _process(delta):
|
|||||||
Global.mouse.text = "Duplicate sprite"
|
Global.mouse.text = "Duplicate sprite"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
sprites[s].scale = lerp(sprites[s].scale,Vector2(1.0,1.0),0.2)
|
var uiAnimSpeed = Global.main.physicsTimeMultiplier * 20.0 if Global.main else 120.0
|
||||||
|
sprites[s].scale = lerp(sprites[s].scale, Vector2(1.0,1.0), delta * uiAnimSpeed)
|
||||||
s += 1
|
s += 1
|
||||||
|
|
||||||
var newColor = Color.DARK_SLATE_GRAY if Global.heldSprite == null else Color.WHITE
|
var newColor = Color.DARK_SLATE_GRAY if Global.heldSprite == null else Color.WHITE
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ var yVel = 0
|
|||||||
var bounceSlider = 250
|
var bounceSlider = 250
|
||||||
var bounceGravity = 1000
|
var bounceGravity = 1000
|
||||||
|
|
||||||
|
# Physics timing multiplier - adjust this to fine-tune physics speed
|
||||||
|
# 1.0 = very slow, 10.0 = reasonable, 60.0 = old frame-based speed
|
||||||
|
var physicsTimeMultiplier = 6.0
|
||||||
|
|
||||||
#Costumes
|
#Costumes
|
||||||
var costume = 1
|
var costume = 1
|
||||||
var bounceOnCostumeChange = false
|
var bounceOnCostumeChange = false
|
||||||
@@ -43,6 +47,18 @@ var bounceOnCostumeChange = false
|
|||||||
#Zooming
|
#Zooming
|
||||||
var scaleOverall = 100
|
var scaleOverall = 100
|
||||||
|
|
||||||
|
#Camera Panning
|
||||||
|
var isPanning = false
|
||||||
|
var initialPanPosition = Vector2.ZERO
|
||||||
|
var initialCameraOffset = Vector2.ZERO
|
||||||
|
var cameraOffset = Vector2.ZERO
|
||||||
|
|
||||||
|
#View Mode Panning
|
||||||
|
var viewModePanning = false
|
||||||
|
var initialViewPanPosition = Vector2.ZERO
|
||||||
|
var viewPanOffset = Vector2.ZERO
|
||||||
|
var viewPanLerpSpeed = 3.0
|
||||||
|
|
||||||
var bounceChange = 0.0
|
var bounceChange = 0.0
|
||||||
|
|
||||||
#IMPORTANT
|
#IMPORTANT
|
||||||
@@ -130,28 +146,93 @@ func _ready():
|
|||||||
|
|
||||||
var s = get_viewport().get_visible_rect().size
|
var s = get_viewport().get_visible_rect().size
|
||||||
origin.position = s*0.5
|
origin.position = s*0.5
|
||||||
camera.position = origin.position
|
updateCameraPosition()
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
var hold = origin.get_parent().position.y
|
var hold = origin.get_parent().position.y
|
||||||
|
|
||||||
origin.get_parent().position.y += yVel * 0.0166
|
origin.get_parent().position.y += yVel * delta * physicsTimeMultiplier
|
||||||
if origin.get_parent().position.y > 0:
|
if origin.get_parent().position.y > 0:
|
||||||
origin.get_parent().position.y = 0
|
origin.get_parent().position.y = 0
|
||||||
bounceChange = hold - origin.get_parent().position.y
|
bounceChange = hold - origin.get_parent().position.y
|
||||||
|
|
||||||
yVel += bounceGravity*0.0166
|
yVel += bounceGravity * delta * physicsTimeMultiplier
|
||||||
|
|
||||||
|
# Handle view mode panning lerp back to center
|
||||||
|
if !editMode:
|
||||||
|
if !viewModePanning:
|
||||||
|
# Lerp back to center when not actively panning
|
||||||
|
viewPanOffset = viewPanOffset.lerp(Vector2.ZERO, viewPanLerpSpeed * delta)
|
||||||
|
|
||||||
|
# Apply view pan offset to the root character (affects physics)
|
||||||
|
origin.position = (get_viewport().get_visible_rect().size * 0.5) + viewPanOffset
|
||||||
|
updateCameraPosition()
|
||||||
|
|
||||||
if Input.is_action_just_pressed("openFolder"):
|
if Input.is_action_just_pressed("openFolder"):
|
||||||
OS.shell_open(ProjectSettings.globalize_path("user://"))
|
OS.shell_open(ProjectSettings.globalize_path("user://"))
|
||||||
|
|
||||||
moveSpriteMenu(delta)
|
moveSpriteMenu(delta)
|
||||||
zoomScene()
|
zoomScene(delta)
|
||||||
|
|
||||||
fileSystemOpen = isFileSystemOpen()
|
fileSystemOpen = isFileSystemOpen()
|
||||||
|
|
||||||
followShadow()
|
followShadow()
|
||||||
|
|
||||||
|
## Handle input events, especially for camera panning
|
||||||
|
func _input(event):
|
||||||
|
# Handle middle mouse button for camera panning/reset
|
||||||
|
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_MIDDLE:
|
||||||
|
if editMode:
|
||||||
|
if event.pressed:
|
||||||
|
# Start panning in edit mode
|
||||||
|
isPanning = true
|
||||||
|
initialPanPosition = event.global_position
|
||||||
|
initialCameraOffset = cameraOffset
|
||||||
|
else:
|
||||||
|
# Stop panning
|
||||||
|
isPanning = false
|
||||||
|
else:
|
||||||
|
if event.pressed:
|
||||||
|
# Start view mode panning
|
||||||
|
viewModePanning = true
|
||||||
|
initialViewPanPosition = event.global_position
|
||||||
|
else:
|
||||||
|
# Stop view mode panning
|
||||||
|
viewModePanning = false
|
||||||
|
|
||||||
|
# Handle mouse movement during edit mode panning
|
||||||
|
elif editMode and event is InputEventMouseMotion and isPanning:
|
||||||
|
var totalDelta = event.global_position - initialPanPosition
|
||||||
|
|
||||||
|
# Scale pan distance based on zoom level for more intuitive panning
|
||||||
|
# Higher zoom (closer) = less movement, lower zoom (farther) = more movement
|
||||||
|
var zoomScale = 1.0 / camera.zoom.x
|
||||||
|
var scaledDelta = totalDelta * zoomScale
|
||||||
|
|
||||||
|
# Calculate new camera offset from initial position plus scaled movement
|
||||||
|
cameraOffset = initialCameraOffset - scaledDelta
|
||||||
|
|
||||||
|
# Update camera position immediately
|
||||||
|
var s = get_viewport().get_visible_rect().size
|
||||||
|
camera.position = origin.position + cameraOffset
|
||||||
|
|
||||||
|
# Update UI positions
|
||||||
|
controlPanel.position = camera.position + (s/(camera.zoom*2.0))
|
||||||
|
tutorial.position = controlPanel.position
|
||||||
|
editControls.position = camera.position - (s/(camera.zoom*2.0))
|
||||||
|
viewerArrows.position = editControls.position
|
||||||
|
pushUpdates.position.y = controlPanel.position.y
|
||||||
|
pushUpdates.position.x = editControls.position.x
|
||||||
|
|
||||||
|
# Handle mouse movement during view mode panning
|
||||||
|
elif !editMode and event is InputEventMouseMotion and viewModePanning:
|
||||||
|
var totalDelta = event.global_position - initialViewPanPosition
|
||||||
|
|
||||||
|
# Scale pan distance for view mode (less sensitive than edit mode)
|
||||||
|
# Invert the movement so dragging right moves character right (not left)
|
||||||
|
var panSensitivity = 0.5
|
||||||
|
viewPanOffset = -totalDelta * panSensitivity
|
||||||
|
|
||||||
func followShadow():
|
func followShadow():
|
||||||
# Shadow disabled for selected sprites
|
# Shadow disabled for selected sprites
|
||||||
shadow.visible = false
|
shadow.visible = false
|
||||||
@@ -189,16 +270,10 @@ func onWindowSizeChange():
|
|||||||
lines.position = s*0.5
|
lines.position = s*0.5
|
||||||
lines.drawLine()
|
lines.drawLine()
|
||||||
|
|
||||||
camera.position = origin.position
|
updateCameraPosition()
|
||||||
controlPanel.position = camera.position + (s/(camera.zoom*2.0))
|
|
||||||
tutorial.position = controlPanel.position
|
|
||||||
editControls.position = camera.position - (s/(camera.zoom*2.0))
|
|
||||||
viewerArrows.position = editControls.position
|
|
||||||
spriteList.position.x = s.x - 233
|
spriteList.position.x = s.x - 233
|
||||||
pushUpdates.position.y = controlPanel.position.y
|
|
||||||
pushUpdates.position.x = editControls.position.x
|
|
||||||
|
|
||||||
func zoomScene():
|
func zoomScene(delta):
|
||||||
#Handles Zooming
|
#Handles Zooming
|
||||||
if Input.is_action_pressed("control"):
|
if Input.is_action_pressed("control"):
|
||||||
if Input.is_action_just_pressed("scrollUp"):
|
if Input.is_action_just_pressed("scrollUp"):
|
||||||
@@ -212,7 +287,7 @@ func zoomScene():
|
|||||||
scaleOverall -= 10
|
scaleOverall -= 10
|
||||||
changeZoom()
|
changeZoom()
|
||||||
|
|
||||||
$ControlPanel/ZoomLabel.modulate.a = lerp($ControlPanel/ZoomLabel.modulate.a,0.0,0.02)
|
$ControlPanel/ZoomLabel.modulate.a = lerp($ControlPanel/ZoomLabel.modulate.a, 0.0, delta * (physicsTimeMultiplier * 1.2))
|
||||||
|
|
||||||
func changeZoom():
|
func changeZoom():
|
||||||
var newZoom = Vector2(1.0,1.0) / camera.zoom
|
var newZoom = Vector2(1.0,1.0) / camera.zoom
|
||||||
@@ -224,11 +299,45 @@ func changeZoom():
|
|||||||
pushUpdates.scale = newZoom
|
pushUpdates.scale = newZoom
|
||||||
Global.mouse.scale = newZoom
|
Global.mouse.scale = newZoom
|
||||||
|
|
||||||
|
# Update UI positions to account for new zoom level
|
||||||
|
# Force update even during panning since zoom affects UI positioning calculations
|
||||||
|
var s = get_viewport().get_visible_rect().size
|
||||||
|
controlPanel.position = camera.position + (s/(camera.zoom*2.0))
|
||||||
|
tutorial.position = controlPanel.position
|
||||||
|
editControls.position = camera.position - (s/(camera.zoom*2.0))
|
||||||
|
viewerArrows.position = editControls.position
|
||||||
|
pushUpdates.position.y = controlPanel.position.y
|
||||||
|
pushUpdates.position.x = editControls.position.x
|
||||||
|
|
||||||
$ControlPanel/ZoomLabel.modulate.a = 6.0
|
$ControlPanel/ZoomLabel.modulate.a = 6.0
|
||||||
$ControlPanel/ZoomLabel.text = "Zoom : " + str(scaleOverall) + "%"
|
$ControlPanel/ZoomLabel.text = "Zoom : " + str(scaleOverall) + "%"
|
||||||
|
|
||||||
Global.pushUpdate("Set zoom to " + str(scaleOverall) + "%")
|
Global.pushUpdate("Set zoom to " + str(scaleOverall) + "%")
|
||||||
onWindowSizeChange()
|
|
||||||
|
## Update camera position with current offset
|
||||||
|
func updateCameraPosition():
|
||||||
|
var s = get_viewport().get_visible_rect().size
|
||||||
|
|
||||||
|
# Only update if not currently panning to avoid conflicts
|
||||||
|
if !isPanning:
|
||||||
|
camera.position = origin.position + cameraOffset
|
||||||
|
|
||||||
|
# Update UI element positions relative to new camera position
|
||||||
|
controlPanel.position = camera.position + (s/(camera.zoom*2.0))
|
||||||
|
tutorial.position = controlPanel.position
|
||||||
|
editControls.position = camera.position - (s/(camera.zoom*2.0))
|
||||||
|
viewerArrows.position = editControls.position
|
||||||
|
pushUpdates.position.y = controlPanel.position.y
|
||||||
|
pushUpdates.position.x = editControls.position.x
|
||||||
|
|
||||||
|
## Reset camera position to center
|
||||||
|
func resetCameraPosition():
|
||||||
|
cameraOffset = Vector2.ZERO
|
||||||
|
isPanning = false
|
||||||
|
viewPanOffset = Vector2.ZERO
|
||||||
|
viewModePanning = false
|
||||||
|
updateCameraPosition()
|
||||||
|
Global.pushUpdate("Camera reset to center.")
|
||||||
|
|
||||||
#When the user speaks!
|
#When the user speaks!
|
||||||
func onSpeak():
|
func onSpeak():
|
||||||
@@ -243,6 +352,14 @@ func swapMode():
|
|||||||
editMode = !editMode
|
editMode = !editMode
|
||||||
Global.pushUpdate("Toggled editing mode.")
|
Global.pushUpdate("Toggled editing mode.")
|
||||||
|
|
||||||
|
# Reset camera when entering view mode
|
||||||
|
if !editMode:
|
||||||
|
resetCameraPosition()
|
||||||
|
else:
|
||||||
|
# Reset view mode panning when entering edit mode
|
||||||
|
viewPanOffset = Vector2.ZERO
|
||||||
|
viewModePanning = false
|
||||||
|
|
||||||
get_viewport().transparent_bg = !editMode
|
get_viewport().transparent_bg = !editMode
|
||||||
if Global.backgroundColor.a != 0.0:
|
if Global.backgroundColor.a != 0.0:
|
||||||
get_viewport().transparent_bg = false
|
get_viewport().transparent_bg = false
|
||||||
@@ -365,6 +482,13 @@ func _on_load_dialog_file_selected(path):
|
|||||||
Saving.settings["lastAvatar"] = path
|
Saving.settings["lastAvatar"] = path
|
||||||
Global.spriteList.updateData()
|
Global.spriteList.updateData()
|
||||||
|
|
||||||
|
# Update opacity shaders for all loaded sprites after they're all created
|
||||||
|
await get_tree().process_frame # Wait for all sprites to be fully initialized
|
||||||
|
var allSprites = get_tree().get_nodes_in_group("saved")
|
||||||
|
for sprite in allSprites:
|
||||||
|
if sprite.has_method("updateOpacity"):
|
||||||
|
sprite.updateOpacity()
|
||||||
|
|
||||||
Global.pushUpdate("Loaded avatar at: " + path)
|
Global.pushUpdate("Loaded avatar at: " + path)
|
||||||
|
|
||||||
onWindowSizeChange()
|
onWindowSizeChange()
|
||||||
@@ -504,6 +628,10 @@ func _on_duplicate_button_pressed():
|
|||||||
origin.add_child(sprite)
|
origin.add_child(sprite)
|
||||||
sprite.position = Global.heldSprite.position + Vector2(16,16)
|
sprite.position = Global.heldSprite.position + Vector2(16,16)
|
||||||
|
|
||||||
|
# Update opacity shader for the duplicated sprite
|
||||||
|
await get_tree().process_frame # Wait for sprite to be fully initialized
|
||||||
|
sprite.updateOpacity()
|
||||||
|
|
||||||
Global.heldSprite = sprite
|
Global.heldSprite = sprite
|
||||||
|
|
||||||
Global.spriteList.updateData()
|
Global.spriteList.updateData()
|
||||||
@@ -576,9 +704,9 @@ func moveSpriteMenu(delta):
|
|||||||
|
|
||||||
|
|
||||||
if $EditControls/MoveMenuUp.overlaps_area(Global.mouse.area):
|
if $EditControls/MoveMenuUp.overlaps_area(Global.mouse.area):
|
||||||
Global.spriteEdit.position.y += (delta*432.0)
|
Global.spriteEdit.position.y += (delta * 432.0 * physicsTimeMultiplier)
|
||||||
elif $EditControls/MoveMenuDown.overlaps_area(Global.mouse.area):
|
elif $EditControls/MoveMenuDown.overlaps_area(Global.mouse.area):
|
||||||
Global.spriteEdit.position.y -= (delta*432.0)
|
Global.spriteEdit.position.y -= (delta * 432.0 * physicsTimeMultiplier)
|
||||||
|
|
||||||
if Global.spriteEdit.position.y > 66:
|
if Global.spriteEdit.position.y > 66:
|
||||||
Global.spriteEdit.position.y = 66
|
Global.spriteEdit.position.y = 66
|
||||||
|
|||||||
@@ -14358,6 +14358,7 @@ text = "Zoom : 100%"
|
|||||||
horizontal_alignment = 2
|
horizontal_alignment = 2
|
||||||
|
|
||||||
[node name="VersionLabels" type="Node2D" parent="ControlPanel"]
|
[node name="VersionLabels" type="Node2D" parent="ControlPanel"]
|
||||||
|
position = Vector2(-284, 59)
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="ControlPanel/VersionLabels"]
|
[node name="Label" type="Label" parent="ControlPanel/VersionLabels"]
|
||||||
offset_left = -713.0
|
offset_left = -713.0
|
||||||
@@ -14377,13 +14378,21 @@ label_settings = SubResource("LabelSettings_qg0do")
|
|||||||
|
|
||||||
[node name="versionNo" type="Label" parent="ControlPanel/VersionLabels/Label2"]
|
[node name="versionNo" type="Label" parent="ControlPanel/VersionLabels/Label2"]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = 144.0
|
offset_left = 104.0
|
||||||
offset_top = 40.0
|
offset_top = 11.0
|
||||||
offset_right = 282.0
|
offset_right = 242.0
|
||||||
offset_bottom = 74.0
|
offset_bottom = 54.0
|
||||||
text = "v1.4.5"
|
text = "v1.4.5"
|
||||||
label_settings = SubResource("LabelSettings_xvf50")
|
label_settings = SubResource("LabelSettings_xvf50")
|
||||||
|
|
||||||
|
[node name="Label3" type="Label" parent="ControlPanel/VersionLabels"]
|
||||||
|
offset_left = -566.0
|
||||||
|
offset_top = -93.0
|
||||||
|
offset_right = -428.0
|
||||||
|
offset_bottom = -59.0
|
||||||
|
text = "Litruv Edition"
|
||||||
|
label_settings = SubResource("LabelSettings_qg0do")
|
||||||
|
|
||||||
[node name="EditControls" type="Node2D" parent="."]
|
[node name="EditControls" type="Node2D" parent="."]
|
||||||
z_index = 4090
|
z_index = 4090
|
||||||
script = ExtResource("17_bf1ic")
|
script = ExtResource("17_bf1ic")
|
||||||
|
|||||||
@@ -136,6 +136,11 @@ control={
|
|||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194326,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194326,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
mouse_middle={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":3,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
saveImages={
|
saveImages={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":76,"key_label":0,"unicode":108,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":76,"key_label":0,"unicode":108,"location":0,"echo":false,"script":null)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ func _ready():
|
|||||||
Global.mouse = self
|
Global.mouse = self
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
if Global.main.editMode:
|
if Global.main and Global.main.editMode:
|
||||||
if text != "":
|
if text != "":
|
||||||
label.text = text
|
label.text = text
|
||||||
visible = true
|
visible = true
|
||||||
|
|||||||
@@ -79,12 +79,13 @@ var ignoreBounce = false
|
|||||||
#Animation
|
#Animation
|
||||||
var frames = 1
|
var frames = 1
|
||||||
var animSpeed = 0
|
var animSpeed = 0
|
||||||
|
var animTime = 0.0 # Time accumulator for animations
|
||||||
|
|
||||||
var remadePolygon = false
|
var remadePolygon = false
|
||||||
|
|
||||||
var clipped = false
|
var clipped = false
|
||||||
|
|
||||||
var tick = 0
|
var time = 0.0 # Time accumulator for physics calculations
|
||||||
|
|
||||||
#Opacity
|
#Opacity
|
||||||
var spriteOpacity = 1.0
|
var spriteOpacity = 1.0
|
||||||
@@ -224,7 +225,7 @@ func replaceSprite(pathNew):
|
|||||||
remakePolygon()
|
remakePolygon()
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
tick += 1
|
time += delta
|
||||||
if Global.heldSprite == self:
|
if Global.heldSprite == self:
|
||||||
|
|
||||||
grabArea.visible = true
|
grabArea.visible = true
|
||||||
@@ -251,13 +252,17 @@ func _process(delta):
|
|||||||
|
|
||||||
talkBlink()
|
talkBlink()
|
||||||
|
|
||||||
animation()
|
animation(delta)
|
||||||
|
|
||||||
func animation():
|
func animation(delta):
|
||||||
|
|
||||||
var speed = max(float(animSpeed),Engine.max_fps*6.0)
|
|
||||||
if animSpeed > 0 and frames > 1:
|
if animSpeed > 0 and frames > 1:
|
||||||
if Global.animationTick % int((speed)/float(animSpeed)) == 0:
|
animTime += delta
|
||||||
|
# Convert animSpeed to frames per second - no additional scaling needed since this controls frame rate
|
||||||
|
var frameRate = animSpeed / 60.0 # Normalize from old frame-based system
|
||||||
|
var frameInterval = 1.0 / frameRate
|
||||||
|
|
||||||
|
if animTime >= frameInterval:
|
||||||
|
animTime -= frameInterval
|
||||||
if sprite.frame == frames - 1:
|
if sprite.frame == frames - 1:
|
||||||
sprite.frame = 0
|
sprite.frame = 0
|
||||||
else:
|
else:
|
||||||
@@ -269,7 +274,7 @@ func setZIndex():
|
|||||||
sprite.z_index = z
|
sprite.z_index = z
|
||||||
|
|
||||||
func talkBlink():
|
func talkBlink():
|
||||||
var faded = 0.2 * int(Global.main.editMode)
|
var faded = 0.2 * int(Global.main and Global.main.editMode)
|
||||||
var value = (showOnTalk + (showOnBlink*3)) + (int(Global.speaking)*10) + (int(Global.blink)*20)
|
var value = (showOnTalk + (showOnBlink*3)) + (int(Global.speaking)*10) + (int(Global.blink)*20)
|
||||||
var yes = [0,10,20,30,1,21,12,32,3,13,4,15,26,36,27,38].has(int(value))
|
var yes = [0,10,20,30,1,21,12,32,3,13,4,15,26,36,27,38].has(int(value))
|
||||||
var baseAlpha = max(int(yes), faded)
|
var baseAlpha = max(int(yes), faded)
|
||||||
@@ -348,31 +353,46 @@ func drag(delta):
|
|||||||
if dragSpeed == 0:
|
if dragSpeed == 0:
|
||||||
dragger.global_position = wob.global_position
|
dragger.global_position = wob.global_position
|
||||||
else:
|
else:
|
||||||
dragger.global_position = lerp(dragger.global_position,wob.global_position,1/dragSpeed)
|
# Convert dragSpeed to a proper delta-time lerp factor
|
||||||
|
# Higher dragSpeed = slower movement, so we invert it
|
||||||
|
# Use Global.main.physicsTimeMultiplier for consistent physics timing
|
||||||
|
var physicsMultiplier = Global.main.physicsTimeMultiplier if Global.main else 10.0
|
||||||
|
var lerpFactor = clamp(delta * (physicsMultiplier * 10.0 / max(dragSpeed, 0.1)), 0.0, 1.0)
|
||||||
|
dragger.global_position = lerp(dragger.global_position, wob.global_position, lerpFactor)
|
||||||
dragOrigin.global_position = dragger.global_position
|
dragOrigin.global_position = dragger.global_position
|
||||||
|
|
||||||
func wobble():
|
func wobble():
|
||||||
wob.position.x = sin(tick*xFrq)*xAmp
|
# Use Global.main.physicsTimeMultiplier for consistent physics timing
|
||||||
wob.position.y = sin(tick*yFrq)*yAmp
|
var physicsMultiplier = Global.main.physicsTimeMultiplier if Global.main else 10.0
|
||||||
|
var scaledTime = time * physicsMultiplier
|
||||||
|
wob.position.x = sin(scaledTime * xFrq) * xAmp
|
||||||
|
wob.position.y = sin(scaledTime * yFrq) * yAmp
|
||||||
|
|
||||||
func rotationalDrag(length,delta):
|
func rotationalDrag(length, delta):
|
||||||
var yvel = (length * rdragStr)
|
var yvel = (length * rdragStr)
|
||||||
|
|
||||||
#Calculate Max angle
|
#Calculate Max angle
|
||||||
yvel = clamp(yvel,rLimitMin,rLimitMax)
|
yvel = clamp(yvel, rLimitMin, rLimitMax)
|
||||||
|
|
||||||
# Add rotation wobble as percentage of rotational limits range
|
# Add rotation wobble as percentage of rotational limits range
|
||||||
var rotationRange = rLimitMax - rLimitMin
|
var rotationRange = rLimitMax - rLimitMin
|
||||||
var rotationWobble = sin(tick*rFrq) * (rotationRange * rAmp * 0.01)
|
var physicsMultiplier = Global.main.physicsTimeMultiplier if Global.main else 10.0
|
||||||
|
var scaledTime = time * physicsMultiplier
|
||||||
|
var rotationWobble = sin(scaledTime * rFrq) * (rotationRange * rAmp * 0.01)
|
||||||
var totalRotation = yvel + rotationWobble
|
var totalRotation = yvel + rotationWobble
|
||||||
|
|
||||||
sprite.rotation = lerp_angle(sprite.rotation,deg_to_rad(totalRotation),0.25)
|
# Use delta-based lerp for smooth rotation with slower speed
|
||||||
|
var lerpFactor = clamp(delta * (physicsMultiplier * 1.0), 0.0, 1.0) # Reduced from 15.0 to 4.0
|
||||||
|
sprite.rotation = lerp_angle(sprite.rotation, deg_to_rad(totalRotation), lerpFactor)
|
||||||
|
|
||||||
func stretch(length,delta):
|
func stretch(length, delta):
|
||||||
var yvel = (length * stretchAmount * 0.01)
|
var yvel = (length * stretchAmount * 0.01)
|
||||||
var target = Vector2(1.0-yvel,1.0+yvel)
|
var target = Vector2(1.0 - yvel, 1.0 + yvel)
|
||||||
|
|
||||||
sprite.scale = lerp(sprite.scale,target,0.5)
|
# Use delta-based lerp for smooth stretching
|
||||||
|
var physicsMultiplier = Global.main.physicsTimeMultiplier if Global.main else 10.0
|
||||||
|
var lerpFactor = clamp(delta * (physicsMultiplier * 30.0), 0.0, 1.0)
|
||||||
|
sprite.scale = lerp(sprite.scale, target, lerpFactor)
|
||||||
|
|
||||||
func changeCollision(enable):
|
func changeCollision(enable):
|
||||||
grabArea.monitorable = enable
|
grabArea.monitorable = enable
|
||||||
|
|||||||
Reference in New Issue
Block a user