summaryrefslogtreecommitdiff
path: root/tools/editor/plugins
diff options
context:
space:
mode:
authorCarl Olsson <carl.olsson@gmail.com>2015-02-13 20:49:21 +1000
committerCarl Olsson <carl.olsson@gmail.com>2015-02-13 20:49:21 +1000
commit9d182e93a3d75396405733109f9f086969c4b19b (patch)
treecb38c19cf65a4dc7acc4e3c1e81f34ef879450ba /tools/editor/plugins
parentd0ea4754057663d2caefbabe32421fd597a8a15d (diff)
Added body mode property to TileMap to select between static and kinematic physics bodies. Kinematic allow use of TileMaps for moving platforms for example.
Updated 2D Platformer demo to use kinematic TileMaps for moving platforms, in doing so discovered that the tileset was messed up and not converting properly, so fixed that too. And in order to fix the tileset I need to activate snapping for collision polygon vertices.
Diffstat (limited to 'tools/editor/plugins')
-rw-r--r--tools/editor/plugins/collision_polygon_editor_plugin.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_editor_plugin.cpp
index b92acb60f9..a6f2085a19 100644
--- a/tools/editor/plugins/collision_polygon_editor_plugin.cpp
+++ b/tools/editor/plugins/collision_polygon_editor_plugin.cpp
@@ -31,6 +31,8 @@
#include "os/file_access.h"
#include "tools/editor/editor_settings.h"
#include "scene/3d/camera.h"
+#include "canvas_item_editor_plugin.h"
+
void CollisionPolygonEditor::_notification(int p_what) {
switch(p_what) {
@@ -71,14 +73,14 @@ void CollisionPolygonEditor::_node_removed(Node *p_node) {
Vector2 CollisionPolygonEditor::snap_point(const Vector2& p_point) const {
return p_point;
- /*
- if (canvas_item_editor->is_snap_active()) {
+
+ if (CanvasItemEditor::get_singleton()->is_snap_active()) {
- return p_point.snapped(Vector2(1,1)*canvas_item_editor->get_snap());
+ return p_point.snapped(Vector2(1,1)*CanvasItemEditor::get_singleton()->get_snap());
} else {
return p_point;
- } ??? */
+ }
}
void CollisionPolygonEditor::_menu_option(int p_option) {
@@ -148,7 +150,7 @@ bool CollisionPolygonEditor::forward_spatial_input_event(Camera* p_camera,const
Vector2 cpoint(spoint.x,spoint.y);
- //cpoint=snap_point(cpoint); snap?
+ cpoint=snap_point(cpoint);
Vector<Vector2> poly = node->get_polygon();
@@ -362,7 +364,7 @@ bool CollisionPolygonEditor::forward_spatial_input_event(Camera* p_camera,const
Vector2 cpoint(spoint.x,spoint.y);
- //cpoint=snap_point(cpoint);
+ cpoint=snap_point(cpoint);
edited_point_pos = cpoint;
_polygon_draw();