Skip to content

InteractArea: Set debug color on shapes - #2678

Merged
manuq merged 1 commit into
mainfrom
wjt/interactarea-set-debug-color-on-shapes
Aug 11, 2026
Merged

InteractArea: Set debug color on shapes#2678
manuq merged 1 commit into
mainfrom
wjt/interactarea-set-debug-color-on-shapes

Conversation

@wjt

@wjt wjt commented Aug 10, 2026

Copy link
Copy Markdown
Member

Use a consistent yellow color for all collision shapes that define an InteractArea (that is, their CollisionShape2D immediate children), so they are easy to identify in the editor.

@wjt
wjt force-pushed the wjt/interactarea-set-debug-color-on-shapes branch from 3095e64 to 1a8e0fa Compare August 10, 2026 14:12
@github-actions

Copy link
Copy Markdown

Play this branch at https://play.threadbare.game/branches/endlessm/wjt/interactarea-set-debug-color-on-shapes/.

(This launches the game from the start, not directly at the change(s) in this pull request.)

@manuq manuq left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I love it!


func _notification(what: int) -> void:
match what:
NOTIFICATION_CHILD_ORDER_CHANGED when Engine.is_editor_hint() and is_node_ready():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh first time I see when in GDScript! I didn't know match had it, I would have written this as nested if conditionals.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to look up the match syntax every time I use it, so I see this form in the documentation every time as well. (Also I first came across pattern matching in Haskell where pattern guards like this are very common.)

## Emitted when characters start or stop seeing this area for interaction.
signal observers_changed

const SHAPE_DEBUG_COLOR := Color(0.6, 0.545, 0.0, 0.42)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but if we add more color codes (like purple for hookable areas) we may want to have them all in a single file. Maybe in a const SHAPE_DEBUG_COLORS: Dictionary[StringName, Color].

@wjt

wjt commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

I haven't resaved all scenes with this change applied, hence draft.

I actually have a script lying around in my inventory branch to rewrite all scenes in the project that use a particular scene. I should be able to do something similar for scenes that use a particular script to do this programmatically. Maybe I can generalise it...

@wjt
wjt force-pushed the wjt/interactarea-set-debug-color-on-shapes branch from 1a8e0fa to 9468296 Compare August 11, 2026 08:18
@wjt
wjt marked this pull request as ready for review August 11, 2026 08:22
@wjt
wjt requested review from a team as code owners August 11, 2026 08:22
@manuq

manuq commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

I haven't resaved all scenes with this change applied, hence draft.

I actually have a script lying around in my inventory branch to rewrite all scenes in the project that use a particular scene. I should be able to do something similar for scenes that use a particular script to do this programmatically. Maybe I can generalise it...

Oh it would be great to have it under tools/!

@manuq manuq left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed that NOTIFICATION_CHILD_ORDER_CHANGED works like a charm to update the color in a @tool script.

@manuq
manuq merged commit 064df7f into main Aug 11, 2026
7 checks passed
@manuq
manuq deleted the wjt/interactarea-set-debug-color-on-shapes branch August 11, 2026 12:09
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.

2 participants