Manual coordinates for curspr and point work
This commit is contained in:
@@ -84,9 +84,21 @@ public:
|
||||
ItemList *lines_list =
|
||||
editor->get_as_node<ItemList>("%lines_list");
|
||||
lines_list->connect("item_selected", this, "handler");
|
||||
Button *cursor_set = editor->get_as_node<Button>(
|
||||
"%road_lines_set_cursor_position");
|
||||
cursor_set->connect("pressed", this, "set_cursor_handler");
|
||||
Button *point_set = editor->get_as_node<Button>(
|
||||
"%road_lines_set_point_position");
|
||||
point_set->connect("pressed", this, "set_point_handler");
|
||||
}
|
||||
virtual ~HandleSelection()
|
||||
{
|
||||
Button *cursor_set = editor->get_as_node<Button>(
|
||||
"%road_lines_set_cursor_position");
|
||||
cursor_set->disconnect("pressed", this, "set_cursor_handler");
|
||||
Button *point_set = editor->get_as_node<Button>(
|
||||
"%road_lines_set_point_position");
|
||||
point_set->disconnect("pressed", this, "set_point_handler");
|
||||
ItemList *lines_list =
|
||||
editor->get_as_node<ItemList>("%lines_list");
|
||||
lines_list->disconnect("item_selected", this, "handler");
|
||||
@@ -109,12 +121,40 @@ protected:
|
||||
{
|
||||
editor->line_list_filter_changed(text);
|
||||
}
|
||||
void set_cursor_handler()
|
||||
{
|
||||
LineEdit *cursor_x = editor->get_as_node<LineEdit>("%cursor_x");
|
||||
LineEdit *cursor_y = editor->get_as_node<LineEdit>("%cursor_y");
|
||||
LineEdit *cursor_z = editor->get_as_node<LineEdit>("%cursor_z");
|
||||
LineEdit *cursor[] = { cursor_x, cursor_y, cursor_z };
|
||||
Vector3 position;
|
||||
position.x = cursor_x->get_text().to_float();
|
||||
position.y = cursor_y->get_text().to_float();
|
||||
position.z = cursor_z->get_text().to_float();
|
||||
editor->set_cursor_position(position);
|
||||
}
|
||||
void set_point_handler()
|
||||
{
|
||||
LineEdit *point_x = editor->get_as_node<LineEdit>("%point_x");
|
||||
LineEdit *point_y = editor->get_as_node<LineEdit>("%point_y");
|
||||
LineEdit *point_z = editor->get_as_node<LineEdit>("%point_z");
|
||||
LineEdit *point[] = { point_x, point_y, point_z };
|
||||
Vector3 position;
|
||||
position.x = point_x->get_text().to_float();
|
||||
position.y = point_y->get_text().to_float();
|
||||
position.z = point_z->get_text().to_float();
|
||||
editor->set_point_position(position);
|
||||
}
|
||||
static void _bind_methods()
|
||||
{
|
||||
ClassDB::bind_method(D_METHOD("handler", "index"),
|
||||
&HandleSelection::handler);
|
||||
ClassDB::bind_method(D_METHOD("filter_handler", "text"),
|
||||
&HandleSelection::filter_handler);
|
||||
ClassDB::bind_method(D_METHOD("set_cursor_handler"),
|
||||
&HandleSelection::set_cursor_handler);
|
||||
ClassDB::bind_method(D_METHOD("set_point_handler"),
|
||||
&HandleSelection::set_point_handler);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -594,6 +634,12 @@ void RoadLinesEditor::set_cursor_position(const Vector3 &cursor_position)
|
||||
pargs.push_back(cursor_position);
|
||||
editor->emit_signal("editor_event", "line_cursor_motion", pargs);
|
||||
}
|
||||
void RoadLinesEditor::set_point_position(const Vector3 &position)
|
||||
{
|
||||
int index = get_line_index();
|
||||
lines[current_line].points[index].origin = position;
|
||||
update_line_geometry();
|
||||
}
|
||||
void RoadLinesEditor::set_ui_cursor_position(const Vector3 &cursor_position)
|
||||
{
|
||||
LineEdit *cursor_x = get_as_node<LineEdit>("%cursor_x");
|
||||
|
||||
@@ -32,6 +32,7 @@ public:
|
||||
void create_new_line_at_cursor(const String &line_name);
|
||||
Vector3 get_cursor_position();
|
||||
void set_cursor_position(const Vector3 &cursor_position);
|
||||
void set_point_position(const Vector3 &position);
|
||||
void set_ui_cursor_position(const Vector3 &cursor_position);
|
||||
void set_ui_point_position(const Vector3 &point_position);
|
||||
void set_line_index(int index);
|
||||
|
||||
Reference in New Issue
Block a user