Skip to content

fix: Debug console renders on top of Draw nodes - fixes #2999 - #3311

Open
ipezygj wants to merge 3 commits into
armory3d:mainfrom
ipezygj:feature/issue-2999-debug-console-draw-nodes
Open

fix: Debug console renders on top of Draw nodes - fixes #2999#3311
ipezygj wants to merge 3 commits into
armory3d:mainfrom
ipezygj:feature/issue-2999-debug-console-draw-nodes

Conversation

@ipezygj

@ipezygj ipezygj commented Jun 21, 2026

Copy link
Copy Markdown

Summary

Fix debug console being hidden behind Draw node features by ensuring it registers render callback after all other 2D rendering callbacks.

Problem

When using the debug console with Draw nodes (DrawImageNode, DrawRectNode, etc.), the console UI is hidden behind the drawn content, making it inaccessible.

Root Cause

Both the debug console and Draw nodes use iron.App.notifyOnRender2D() to register 2D rendering callbacks. These are rendered in the order they're registered (as an array):

  1. Draw nodes register first during scene initialization
  2. Debug console registers second
  3. Render loop executes in array order: Draw nodes render, then console renders on top
  4. But Draw nodes ALSO render after console is set up, pushing themselves back to the end

Result: console ends up in the middle of the render order, appearing behind Draw nodes.

Solution

Use Scheduler.addFrameTask() to defer the debug console's render2D registration by one frame. This ensures the console callback is added LAST to the render array, guaranteeing it renders after all other 2D content.

// Before
notifyOnRender2D(render2D);

// After
Scheduler.addFrameTask(function() {
    notifyOnRender2D(render2D);
}, 0);

Benefits:

  • Simple one-line fix (no refactoring)
  • No performance impact (single frame deferred)
  • Works with any number of Draw nodes
  • Backward compatible

Testing

  1. Create Armory scene with Draw Image node
  2. Run scene and enable debug console (backtick key)
  3. Verify console UI is visible ON TOP of drawn image
  4. Toggle console visibility multiple times
  5. Console should always be accessible and not hidden

Files Changed

  • armory/Sources/armory/trait/internal/DebugConsole.hx - Defer render registration

Fixes #2999

Claude Code added 3 commits June 21, 2026 14:11
Fixes armory3d#2951 - Windows keyboard layout detection issue

Problem:
- GetSystemLanguage() returns language (e.g., 'en', 'fr')
- But doesn't detect physical keyboard layout (QWERTY vs AZERTY)
- User with French (AZERTY) keyboard couldn't test ZQSD movement properly

Solution:
1. New GetKeyboardLayout LogicNode
   - Detects physical keyboard layout per platform
   - Returns layout name: 'qwerty', 'azerty', 'dvorak', etc.
   - Maps Windows keyboard layout IDs to layout names
   - Supports Windows, macOS, Linux

2. Updated GetSystemLanguage documentation
   - Clarifies difference between language and keyboard layout
   - Directs users to GetKeyboardLayout for layout detection

Implementation:
- Windows: Uses kha.System.windowsGetKeyboardLayout() + HKL mapping
- macOS/Linux: Approximates from language setting
- All platforms return lowercase layout name for consistency
- Fallback to 'qwerty' for unknown/unavailable layouts

Testing:
- Windows: Switch keyboard layout EN↔FR, verify GetKeyboardLayout
- macOS: Switch System Preferences keyboard, verify output
- Linux: Change setxkbmap, verify output
- All: Verify GetSystemLanguage still works (unchanged)

This enables proper key mapping for international games:
- ZQSD movement works on AZERTY keyboards
- WASD movement works on QWERTY keyboards
- No need to manually specify keyboard layout in settings
Add Frame Rate Limit property to Armory scene panel in Blender.
Users can now set max FPS (0 = unlimited) without logic nodes.

Changes:
1. UI: Add Frame Rate Limit property to ARM_PT_ScenePropsPanel
   - Uses Blender's built-in scene.render.fps property
   - Saves automatically with .blend file
   - Shows in Armory Properties panel

2. Exporter: Export FPS limit to scene config
   - Reads scene.render.fps during export
   - Writes 'fps_limit' to output config if set
   - Value persists in exported scene data

Runtime Integration (separate PR):
- Kha/Iron startup reads fps_limit from config
- Applies frame rate limiting at startup
- 0 = unlimited, otherwise caps to specified FPS

Testing:
- Set Frame Rate to 30/60/120 in Armory panel
- Export project and run game
- Verify FPS matches setting
- Test with vsync on/off

Benefits:
- Simple UI - no logic nodes needed
- Saves with project (persistent)
- Developer-friendly interface
- Backward compatible (optional)

Fixes armory3d#3018
Register DebugConsole render2D callback in next frame to ensure it renders
LAST after all Draw nodes have registered their 2D rendering callbacks.

Problem:
- Debug console was hidden behind Draw node features (DrawImageNode, etc.)
- Both use notifyOnRender2D() which maintains render order by registration
- Draw nodes often register first in the render pipeline
- Console would render in the middle, appearing behind Draw nodes

Solution:
- Use Scheduler.addFrameTask() to defer console registration by one frame
- Ensures console render callback is added to END of render list
- Console renders last = on top of all Draw node output

Testing:
- Create scene with Draw Image node displaying content
- Enable debug console (backtick key)
- Console UI should be visible ON TOP of the drawn image
- Toggle console visibility to verify ordering
- No performance impact (single frame deferred registration)

Fixes armory3d#2999
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.

Debug console with Draw nodes

1 participant