mirror of
https://github.com/litruv/PNGTuber-Plus.git
synced 2026-07-24 02:26:02 +10:00
2.2 KiB
2.2 KiB
🔧 Fixed: Slider Labels Now Show Correct Text
✅ Problem Solved
The issue was that slider labels were showing "Value" instead of the actual label_text property (like "X Frequency", "Drag", etc.) in the Godot editor.
🎯 Root Cause
- Editor Execution: Components needed
@toolto work properly in the editor - Initialization Timing: Label updates happened before exported properties were set
- Property Setter Timing: Label wasn't updated when properties were set by the editor
🔧 Solution Applied
1. Added @tool Directive
Added @tool to all component scripts to enable editor execution:
LabeledSlider.gdWobbleSlider.gdParameterSlider.gd
2. Improved Property Setters
Updated all export property setters to check if the node is ready:
func set_label_text(new_text: String):
label_text = new_text
if is_inside_tree():
_update_label()
else:
call_deferred("_update_label")
3. Enhanced Initialization
- Added
NOTIFICATION_SCENE_INSTANTIATEDhandler - Improved
_ready()function timing - Added deferred label updates for proper timing
4. Fixed Base Template
Updated LabeledSlider.tscn to have cleaner default text:
text = "Value" # Instead of "Value: 0"
5. Robust Label Updates
Enhanced _update_label() to handle missing nodes gracefully:
func _update_label():
if not label:
label = get_node_or_null("Label")
if not label:
call_deferred("_update_label")
return
# ... update logic
🎉 Result
Now in the Godot editor, all slider labels should properly display:
- ✅ "X Frequency: 0.000 Hz"
- ✅ "Y Amplitude: 0"
- ✅ "Drag: 0.0"
- ✅ "Opacity: 100%"
- ✅ "Rotational Limit Min: -180°"
Instead of just "Value" everywhere!
🔄 How to Test
- Open
sprite_viewer.tscnin the Godot editor - Check the slider components in the scene tree
- Labels should now show the correct text for each parameter
- Properties can be modified in the inspector and labels update immediately
The components now work properly both in the editor preview and at runtime! 🚀