Add EditorInterface methods to get the 2D current grid snapping options #101114
+153
−0
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.
The following methods are available:
EditorInterface.is_2d_editor_grid_snap_enabled()
EditorInterface.is_2d_editor_smart_snap_enabled()
EditorInterface.is_2d_editor_snap_relative_enabled()
EditorInterface.is_2d_editor_snap_rotation_enabled()
EditorInterface.is_2d_editor_snap_scale_enabled()
EditorInterface.get_2d_editor_grid_offset()
EditorInterface.get_2d_editor_grid_offset()
EditorInterface.get_2d_editor_grid_primary_steps()
EditorInterface.get_2d_editor_grid_step()
EditorInterface.get_2d_editor_snap_rotation_offset()
EditorInterface.get_2d_editor_snap_rotation_step()
EditorInterface.get_2d_editor_snap_scale_step()
Note that in 3D, the grid size is defined by the
editors/3d/grid_size
editor setting, but it's separate from snapping which is defined on a per-scene basis like in 2D. I suggest unifying this to make it work more like the 2D editor before adding methods that expose it to editor plugins.Testing project: test-2d-editor-grid-plugin.zip