Hot reload edited behavior(s) in editor#8597
Open
Bouh wants to merge 2 commits into
Open
Conversation
`onBehaviorUpdated` in CompactObjectPropertiesEditor was a no-op, so editing behavior properties from the compact panel never propagated to the in-app editor preview. Wire it to `onObjectsModified([object])` like the other property edits in the same file. Debounced at 250ms via `useDebounce` to avoid one hot reload per keystroke on fields.
Extract the field initialization from the constructor into a private `_applyBehaviorData` helper, and reuse it for both the constructor (full data) and the hot-reload hook `applyBehaviorOverriding` (diff containing only changed fields). When any shape-related property is present in the diff, the body is rebuilt via `recreateBody()`. Previously the default `applyBehaviorOverriding` returned false, so hot reload of Physics3D properties was silently dropped, forcing a full restart of the app or closing and reopening the tab to see any tweak made in the editor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR aim to refresh the editor when the behaviors properties are changed, but not too often thanks to the debounce.
This PR is a first step with the Physics3D behavior that I need to be done before the next PR about seeing 3D collision shapes from the physics 3D behavior inside the editor and in-game, drafted here: (URL to come in a few minutes :) )
I wasn't sure if the good thing was to use updateFromBehaviorData that is empty and never used.
So I found an updated test on https://github.com/4ian/GDevelop/pull/8553/changes so I searched and found how few capabilities behavior do with applyBehaviorOverriding(diff). I hope this is the way?