Skip to content
ct

Grid Placement v5.0.9

PlaceableView Padding Migration

Migrate PlaceableView padding behavior for v5.0.9.

Status
Current
Version
v5.0.9
Updated
Active v5.0.9 guide line from Grid Placement repo

Summary

As of this update, PlaceableView no longer has a custom content_padding property. Instead, it uses Godot's standard PanelContainer theme system for inner margins.

Migration Steps

Option 1: Theme Override in Scene (Recommended)

Add theme constant overrides directly to PlaceableView instances in your scene files:

[node name="PlaceableView" type="PanelContainer"]
theme_override_constants/margin_left= 4
theme_override_constants/margin_right= 4
theme_override_constants/margin_top= 4
theme_override_constants/margin_bottom= 4

Option 2: Global Theme Resource

Create or modify a Theme resource and set PanelContainer margins:

  1. Create a new Theme resource or open your existing one
  2. Navigate to: PanelContainer > Theme Constants
  3. Set the following properties:
    • margin_left: 4
    • margin_right: 4
    • margin_top: 4
    • margin_bottom: 4
  4. Apply the theme to your UI root or individual controls

Option 3: Runtime Override

Set margins programmatically in your scripts:

func _ready():
    var placeable_view= $PlaceableView
    placeable_view.add_theme_constant_override("margin_left",4)
    placeable_view.add_theme_constant_override("margin_right",4)
    placeable_view.add_theme_constant_override("margin_top",4)
    placeable_view.add_theme_constant_override("margin_bottom",4)

Why This Change?

  • Follows Godot Best Practices: Uses built-in PanelContainer functionality instead of custom properties
  • Better Integration: Works with Godot's theme system and style inheritance
  • Simpler Code: Reduces custom code maintenance and complexity
  • More Flexible: Can be configured per-instance, per-theme, or globally

Default Template

The plugin's PlaceableView template scene (placeable_view.tscn) has been updated with 4px margins on all sides as the default.

Affected Files

  • godot/addons/grid_placement/ui/placeable/single/placeable_view.gd - Removed custom padding property and method
  • godot/templates/grid_placement_templates/ui/placement_selection/placeable_view.tscn - Updated with theme margin overrides