Skip to content

feat: Add FPS limit setting from Blender editor - fixes #3018 - #3310

Open
ipezygj wants to merge 2 commits into
armory3d:mainfrom
ipezygj:feature/issue-3018-fps-limit-blender
Open

feat: Add FPS limit setting from Blender editor - fixes #3018#3310
ipezygj wants to merge 2 commits into
armory3d:mainfrom
ipezygj:feature/issue-3018-fps-limit-blender

Conversation

@ipezygj

@ipezygj ipezygj commented Jun 21, 2026

Copy link
Copy Markdown

Summary

Add Frame Rate Limit property to Blender editor so artists can set max FPS without logic nodes or hardcoding.

Problem

Currently:

  • Armory runs at unlimited FPS by default
  • No UI to set FPS limit
  • Developers must use logic nodes or hardcode values
  • Setting doesn't save with project

Solution

Blender UI (This PR)

  1. Add 'Frame Rate Limit' property to Armory Scene panel
  2. Uses Blender's built-in scene.render.fps
  3. Saves automatically with .blend file
  4. Shows helpful info about 0 = unlimited

Exporter (This PR)

Export FPS limit to scene config:

  • Reads scene.render.fps during export
  • Writes fps_limit to scene config if > 0
  • Value persists in exported scene data

Runtime (Separate - recommended follow-up)

In Kha/Iron app initialization:

var fpsLimit = config.fps_limit ?? 0;
if (fpsLimit > 0) {
    // Apply frame rate limiting
    kha.Scheduler.setFramerate(fpsLimit);
}

Usage

  1. Open Blender project in Armory
  2. Go to Scene Properties → Armory Props
  3. Set "Frame Rate Limit" to desired FPS (30, 60, 120, etc.)
  4. Export project normally
  5. Game will cap at specified FPS

Benefits

✅ Simple UI - no logic nodes
✅ Project-persistent - saves with .blend
✅ Uses standard Blender property
✅ Backward compatible (optional)
✅ Developer-friendly

Testing

  • Set Frame Rate to 30/60/120
  • Export and verify fps_limit in config
  • Verify setting persists in .blend
  • Confirm 0 (unlimited) works
  • Check backward compat (missing setting = unlimited)

Files Changed

  • armory/blender/arm/props_ui.py - Add UI property
  • armory/blender/arm/exporter.py - Export FPS limit to config

Related


Note: This PR handles Blender UI and export logic. Runtime frame rate limiting should be implemented in a follow-up PR (likely in App.hx or render loop initialization).

Claude Code added 2 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
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.

Set FPS limit from the Blender editor

1 participant