-
Notifications
You must be signed in to change notification settings - Fork 948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Physics behavior editor #825
Merged
Merged
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
73feeb3
Physics main editor setup and custom polygon support
Lizard-13 016abbf
Add shape preview
Lizard-13 61101c9
Add polygon editor
Lizard-13 dfb93bd
Run prettier
Lizard-13 ddd230f
Improve design
Lizard-13 d86cefc
Add BehaviorsEditorService
Lizard-13 9f9f1ff
Avoid divs and Physics2Editor constructor
Lizard-13 76cbe1c
Fix warnings for mixing comparison operators
Lizard-13 101157b
Remove debug component and safe check
Lizard-13 fbdccee
Fix minor misspelling error
Lizard-13 2248e67
Run Prettier on BehaviorPropertiesEditor
4ian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// @flow | ||
import BehaviorPropertiesEditor from './Editors/BehaviorPropertiesEditor'; | ||
import Physics2Editor from './Editors/Physics2Editor'; | ||
|
||
/** | ||
* A service returning editor components for each behavior type. | ||
*/ | ||
export default { | ||
getEditor(behaviorType: string) { | ||
if (!this.components[behaviorType]) { | ||
return BehaviorPropertiesEditor; // Default properties editor | ||
} | ||
return this.components[behaviorType].component; // Custom behavior editor | ||
}, | ||
components: { | ||
'Physics2::Physics2Behavior': { | ||
component: Physics2Editor, | ||
}, | ||
}, | ||
}; |
16 changes: 16 additions & 0 deletions
16
newIDE/app/src/BehaviorsEditor/Editors/BehaviorEditorProps.flow.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { | ||
type ResourceSource, | ||
type ChooseResourceFunction, | ||
} from '../../ResourcesList/ResourceSource.flow'; | ||
import { type ResourceExternalEditor } from '../../ResourcesList/ResourceExternalEditor.flow'; | ||
|
||
/** | ||
* The props given to any behavior editor | ||
*/ | ||
export type BehaviorEditorProps = {| | ||
behavior: Object, | ||
project: gdProject, | ||
resourceSources: Array<ResourceSource>, | ||
onChooseResource: ChooseResourceFunction, | ||
resourceExternalEditors: Array<ResourceExternalEditor>, | ||
|}; |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the >> 2? I also found it on kripken/box2d.js#87 but not sure exactly why it's useful when addressing the memory here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To divide by the size of float (4) and get the correct position, shift automatically deals with the decimal fraction.
It is a headache and would be a lot simpler if the support for
setValue
would not have been removed :(