Add iostream include to collada plugin and change to light occluder to use canvas item snap function.
This commit is contained in:
parent
fb2cdfe7ed
commit
817f9debe7
2 changed files with 3 additions and 13 deletions
|
@ -39,6 +39,7 @@
|
||||||
#include "scene/resources/packed_scene.h"
|
#include "scene/resources/packed_scene.h"
|
||||||
#include "os/os.h"
|
#include "os/os.h"
|
||||||
#include "tools/editor/editor_node.h"
|
#include "tools/editor/editor_node.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
struct ColladaImport {
|
struct ColladaImport {
|
||||||
|
|
|
@ -35,17 +35,6 @@ void LightOccluder2DEditor::_node_removed(Node *p_node) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Vector2 LightOccluder2DEditor::snap_point(const Vector2& p_point) const {
|
|
||||||
|
|
||||||
if (canvas_item_editor->is_snap_active()) {
|
|
||||||
|
|
||||||
return p_point.snapped(Vector2(1,1)*canvas_item_editor->get_snap());
|
|
||||||
|
|
||||||
} else {
|
|
||||||
return p_point;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LightOccluder2DEditor::_menu_option(int p_option) {
|
void LightOccluder2DEditor::_menu_option(int p_option) {
|
||||||
|
|
||||||
switch(p_option) {
|
switch(p_option) {
|
||||||
|
@ -109,7 +98,7 @@ bool LightOccluder2DEditor::forward_input_event(const InputEvent& p_event) {
|
||||||
|
|
||||||
Vector2 gpoint = Point2(mb.x,mb.y);
|
Vector2 gpoint = Point2(mb.x,mb.y);
|
||||||
Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
|
Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
|
||||||
cpoint=snap_point(cpoint);
|
cpoint=canvas_item_editor->snap_point(cpoint);
|
||||||
cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
|
cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
|
||||||
|
|
||||||
Vector<Vector2> poly = Variant(node->get_occluder_polygon()->get_polygon());
|
Vector<Vector2> poly = Variant(node->get_occluder_polygon()->get_polygon());
|
||||||
|
@ -317,7 +306,7 @@ bool LightOccluder2DEditor::forward_input_event(const InputEvent& p_event) {
|
||||||
|
|
||||||
Vector2 gpoint = Point2(mm.x,mm.y);
|
Vector2 gpoint = Point2(mm.x,mm.y);
|
||||||
Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
|
Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
|
||||||
cpoint=snap_point(cpoint);
|
cpoint=canvas_item_editor->snap_point(cpoint);
|
||||||
edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);
|
edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);
|
||||||
|
|
||||||
canvas_item_editor->get_viewport_control()->update();
|
canvas_item_editor->get_viewport_control()->update();
|
||||||
|
|
Loading…
Reference in a new issue