You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Added option to 2D and 3D curve editor to mirror curve tangent handles both in angle and/or length
This commit is contained in:
@@ -109,6 +109,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
|||||||
action_point = i;
|
action_point = i;
|
||||||
moving_from = curve->get_point_out(i);
|
moving_from = curve->get_point_out(i);
|
||||||
moving_screen_from = gpoint;
|
moving_screen_from = gpoint;
|
||||||
|
orig_in_length = curve->get_point_in(action_point).length();
|
||||||
return true;
|
return true;
|
||||||
} else if (dist_to_p_in < grab_threshold && i > 0) {
|
} else if (dist_to_p_in < grab_threshold && i > 0) {
|
||||||
|
|
||||||
@@ -116,6 +117,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
|||||||
action_point = i;
|
action_point = i;
|
||||||
moving_from = curve->get_point_in(i);
|
moving_from = curve->get_point_in(i);
|
||||||
moving_screen_from = gpoint;
|
moving_screen_from = gpoint;
|
||||||
|
orig_out_length = curve->get_point_out(action_point).length();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,6 +207,11 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
|||||||
undo_redo->create_action(TTR("Move In-Control in Curve"));
|
undo_redo->create_action(TTR("Move In-Control in Curve"));
|
||||||
undo_redo->add_do_method(curve.ptr(), "set_point_in", action_point, new_pos);
|
undo_redo->add_do_method(curve.ptr(), "set_point_in", action_point, new_pos);
|
||||||
undo_redo->add_undo_method(curve.ptr(), "set_point_in", action_point, moving_from);
|
undo_redo->add_undo_method(curve.ptr(), "set_point_in", action_point, moving_from);
|
||||||
|
|
||||||
|
if (mirror_handle_angle) {
|
||||||
|
undo_redo->add_do_method(curve.ptr(), "set_point_out", action_point, mirror_handle_length ? -new_pos : (-new_pos.normalized() * orig_out_length));
|
||||||
|
undo_redo->add_undo_method(curve.ptr(), "set_point_out", action_point, mirror_handle_length ? -moving_from : (-moving_from.normalized() * orig_out_length));
|
||||||
|
}
|
||||||
undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
|
undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
|
||||||
undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
|
undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
|
||||||
undo_redo->commit_action();
|
undo_redo->commit_action();
|
||||||
@@ -216,6 +223,11 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
|||||||
undo_redo->create_action(TTR("Move Out-Control in Curve"));
|
undo_redo->create_action(TTR("Move Out-Control in Curve"));
|
||||||
undo_redo->add_do_method(curve.ptr(), "set_point_out", action_point, new_pos);
|
undo_redo->add_do_method(curve.ptr(), "set_point_out", action_point, new_pos);
|
||||||
undo_redo->add_undo_method(curve.ptr(), "set_point_out", action_point, moving_from);
|
undo_redo->add_undo_method(curve.ptr(), "set_point_out", action_point, moving_from);
|
||||||
|
|
||||||
|
if (mirror_handle_angle) {
|
||||||
|
undo_redo->add_do_method(curve.ptr(), "set_point_in", action_point, mirror_handle_length ? -new_pos : (-new_pos.normalized() * orig_in_length));
|
||||||
|
undo_redo->add_undo_method(curve.ptr(), "set_point_in", action_point, mirror_handle_length ? -moving_from : (-moving_from.normalized() * orig_in_length));
|
||||||
|
}
|
||||||
undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
|
undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
|
||||||
undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
|
undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
|
||||||
undo_redo->commit_action();
|
undo_redo->commit_action();
|
||||||
@@ -255,10 +267,16 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
|||||||
|
|
||||||
case ACTION_MOVING_IN: {
|
case ACTION_MOVING_IN: {
|
||||||
curve->set_point_in(action_point, new_pos);
|
curve->set_point_in(action_point, new_pos);
|
||||||
|
|
||||||
|
if (mirror_handle_angle)
|
||||||
|
curve->set_point_out(action_point, mirror_handle_length ? -new_pos : (-new_pos.normalized() * orig_out_length));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case ACTION_MOVING_OUT: {
|
case ACTION_MOVING_OUT: {
|
||||||
curve->set_point_out(action_point, new_pos);
|
curve->set_point_out(action_point, new_pos);
|
||||||
|
|
||||||
|
if (mirror_handle_angle)
|
||||||
|
curve->set_point_in(action_point, mirror_handle_length ? -new_pos : (-new_pos.normalized() * orig_in_length));
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,6 +360,7 @@ void Path2DEditor::_bind_methods() {
|
|||||||
//ClassDB::bind_method(D_METHOD("_menu_option"),&Path2DEditor::_menu_option);
|
//ClassDB::bind_method(D_METHOD("_menu_option"),&Path2DEditor::_menu_option);
|
||||||
ClassDB::bind_method(D_METHOD("_node_visibility_changed"), &Path2DEditor::_node_visibility_changed);
|
ClassDB::bind_method(D_METHOD("_node_visibility_changed"), &Path2DEditor::_node_visibility_changed);
|
||||||
ClassDB::bind_method(D_METHOD("_mode_selected"), &Path2DEditor::_mode_selected);
|
ClassDB::bind_method(D_METHOD("_mode_selected"), &Path2DEditor::_mode_selected);
|
||||||
|
ClassDB::bind_method(D_METHOD("_handle_option_pressed"), &Path2DEditor::_handle_option_pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Path2DEditor::_mode_selected(int p_mode) {
|
void Path2DEditor::_mode_selected(int p_mode) {
|
||||||
@@ -396,11 +415,33 @@ void Path2DEditor::_mode_selected(int p_mode) {
|
|||||||
mode = Mode(p_mode);
|
mode = Mode(p_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Path2DEditor::_handle_option_pressed(int p_option) {
|
||||||
|
|
||||||
|
PopupMenu *pm;
|
||||||
|
pm = handle_menu->get_popup();
|
||||||
|
|
||||||
|
switch (p_option) {
|
||||||
|
case HANDLE_OPTION_ANGLE: {
|
||||||
|
bool is_checked = pm->is_item_checked(HANDLE_OPTION_ANGLE);
|
||||||
|
mirror_handle_angle = !is_checked;
|
||||||
|
pm->set_item_checked(HANDLE_OPTION_ANGLE, mirror_handle_angle);
|
||||||
|
pm->set_item_disabled(HANDLE_OPTION_LENGTH, !mirror_handle_angle);
|
||||||
|
} break;
|
||||||
|
case HANDLE_OPTION_LENGTH: {
|
||||||
|
bool is_checked = pm->is_item_checked(HANDLE_OPTION_LENGTH);
|
||||||
|
mirror_handle_length = !is_checked;
|
||||||
|
pm->set_item_checked(HANDLE_OPTION_LENGTH, mirror_handle_length);
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Path2DEditor::Path2DEditor(EditorNode *p_editor) {
|
Path2DEditor::Path2DEditor(EditorNode *p_editor) {
|
||||||
|
|
||||||
canvas_item_editor = NULL;
|
canvas_item_editor = NULL;
|
||||||
editor = p_editor;
|
editor = p_editor;
|
||||||
undo_redo = editor->get_undo_redo();
|
undo_redo = editor->get_undo_redo();
|
||||||
|
mirror_handle_angle = true;
|
||||||
|
mirror_handle_length = true;
|
||||||
|
|
||||||
mode = MODE_EDIT;
|
mode = MODE_EDIT;
|
||||||
action = ACTION_NONE;
|
action = ACTION_NONE;
|
||||||
@@ -444,6 +485,20 @@ Path2DEditor::Path2DEditor(EditorNode *p_editor) {
|
|||||||
curve_close->set_tooltip(TTR("Close Curve"));
|
curve_close->set_tooltip(TTR("Close Curve"));
|
||||||
curve_close->connect("pressed", this, "_mode_selected", varray(ACTION_CLOSE));
|
curve_close->connect("pressed", this, "_mode_selected", varray(ACTION_CLOSE));
|
||||||
base_hb->add_child(curve_close);
|
base_hb->add_child(curve_close);
|
||||||
|
|
||||||
|
PopupMenu *menu;
|
||||||
|
|
||||||
|
handle_menu = memnew(MenuButton);
|
||||||
|
handle_menu->set_text(TTR("Options"));
|
||||||
|
base_hb->add_child(handle_menu);
|
||||||
|
|
||||||
|
menu = handle_menu->get_popup();
|
||||||
|
menu->add_check_item(TTR("Mirror Handle Angles"));
|
||||||
|
menu->set_item_checked(HANDLE_OPTION_ANGLE, mirror_handle_angle);
|
||||||
|
menu->add_check_item(TTR("Mirror Handle Lengths"));
|
||||||
|
menu->set_item_checked(HANDLE_OPTION_LENGTH, mirror_handle_length);
|
||||||
|
menu->connect("id_pressed", this, "_handle_option_pressed");
|
||||||
|
|
||||||
base_hb->hide();
|
base_hb->hide();
|
||||||
|
|
||||||
curve_edit->set_pressed(true);
|
curve_edit->set_pressed(true);
|
||||||
|
|||||||
@@ -69,6 +69,15 @@ class Path2DEditor : public HBoxContainer {
|
|||||||
ToolButton *curve_edit_curve;
|
ToolButton *curve_edit_curve;
|
||||||
ToolButton *curve_del;
|
ToolButton *curve_del;
|
||||||
ToolButton *curve_close;
|
ToolButton *curve_close;
|
||||||
|
MenuButton *handle_menu;
|
||||||
|
|
||||||
|
bool mirror_handle_angle;
|
||||||
|
bool mirror_handle_length;
|
||||||
|
|
||||||
|
enum HandleOption {
|
||||||
|
HANDLE_OPTION_ANGLE,
|
||||||
|
HANDLE_OPTION_LENGTH
|
||||||
|
};
|
||||||
|
|
||||||
enum Action {
|
enum Action {
|
||||||
|
|
||||||
@@ -82,8 +91,11 @@ class Path2DEditor : public HBoxContainer {
|
|||||||
int action_point;
|
int action_point;
|
||||||
Point2 moving_from;
|
Point2 moving_from;
|
||||||
Point2 moving_screen_from;
|
Point2 moving_screen_from;
|
||||||
|
float orig_in_length;
|
||||||
|
float orig_out_length;
|
||||||
|
|
||||||
void _mode_selected(int p_mode);
|
void _mode_selected(int p_mode);
|
||||||
|
void _handle_option_pressed(int p_option);
|
||||||
|
|
||||||
void _node_visibility_changed();
|
void _node_visibility_changed();
|
||||||
friend class Path2DEditorPlugin;
|
friend class Path2DEditorPlugin;
|
||||||
|
|||||||
@@ -128,11 +128,22 @@ void PathSpatialGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_p
|
|||||||
|
|
||||||
if (p.intersects_ray(ray_from, ray_dir, &inters)) {
|
if (p.intersects_ray(ray_from, ray_dir, &inters)) {
|
||||||
|
|
||||||
|
if (!PathEditorPlugin::singleton->is_handle_clicked()) {
|
||||||
|
orig_in_length = c->get_point_in(idx).length();
|
||||||
|
orig_out_length = c->get_point_out(idx).length();
|
||||||
|
PathEditorPlugin::singleton->set_handle_clicked(true);
|
||||||
|
}
|
||||||
|
|
||||||
Vector3 local = gi.xform(inters) - base;
|
Vector3 local = gi.xform(inters) - base;
|
||||||
if (t == 0) {
|
if (t == 0) {
|
||||||
c->set_point_in(idx, local);
|
c->set_point_in(idx, local);
|
||||||
|
|
||||||
|
if (PathEditorPlugin::singleton->mirror_angle_enabled())
|
||||||
|
c->set_point_out(idx, PathEditorPlugin::singleton->mirror_length_enabled() ? -local : (-local.normalized() * orig_out_length));
|
||||||
} else {
|
} else {
|
||||||
c->set_point_out(idx, local);
|
c->set_point_out(idx, local);
|
||||||
|
if (PathEditorPlugin::singleton->mirror_angle_enabled())
|
||||||
|
c->set_point_in(idx, PathEditorPlugin::singleton->mirror_length_enabled() ? -local : (-local.normalized() * orig_in_length));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,8 +176,6 @@ void PathSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p
|
|||||||
int idx = p_idx / 2;
|
int idx = p_idx / 2;
|
||||||
int t = p_idx % 2;
|
int t = p_idx % 2;
|
||||||
|
|
||||||
Vector3 ofs;
|
|
||||||
|
|
||||||
if (t == 0) {
|
if (t == 0) {
|
||||||
if (p_cancel) {
|
if (p_cancel) {
|
||||||
c->set_point_in(p_idx, p_restore);
|
c->set_point_in(p_idx, p_restore);
|
||||||
@@ -176,6 +185,11 @@ void PathSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p
|
|||||||
ur->create_action(TTR("Set Curve In Position"));
|
ur->create_action(TTR("Set Curve In Position"));
|
||||||
ur->add_do_method(c.ptr(), "set_point_in", idx, c->get_point_in(idx));
|
ur->add_do_method(c.ptr(), "set_point_in", idx, c->get_point_in(idx));
|
||||||
ur->add_undo_method(c.ptr(), "set_point_in", idx, p_restore);
|
ur->add_undo_method(c.ptr(), "set_point_in", idx, p_restore);
|
||||||
|
|
||||||
|
if (PathEditorPlugin::singleton->mirror_angle_enabled()) {
|
||||||
|
ur->add_do_method(c.ptr(), "set_point_out", idx, PathEditorPlugin::singleton->mirror_length_enabled() ? -c->get_point_in(idx) : (-c->get_point_in(idx).normalized() * orig_out_length));
|
||||||
|
ur->add_undo_method(c.ptr(), "set_point_out", idx, PathEditorPlugin::singleton->mirror_length_enabled() ? -static_cast<Vector3>(p_restore) : (-static_cast<Vector3>(p_restore).normalized() * orig_out_length));
|
||||||
|
}
|
||||||
ur->commit_action();
|
ur->commit_action();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -188,6 +202,11 @@ void PathSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p
|
|||||||
ur->create_action(TTR("Set Curve Out Position"));
|
ur->create_action(TTR("Set Curve Out Position"));
|
||||||
ur->add_do_method(c.ptr(), "set_point_out", idx, c->get_point_out(idx));
|
ur->add_do_method(c.ptr(), "set_point_out", idx, c->get_point_out(idx));
|
||||||
ur->add_undo_method(c.ptr(), "set_point_out", idx, p_restore);
|
ur->add_undo_method(c.ptr(), "set_point_out", idx, p_restore);
|
||||||
|
|
||||||
|
if (PathEditorPlugin::singleton->mirror_angle_enabled()) {
|
||||||
|
ur->add_do_method(c.ptr(), "set_point_in", idx, PathEditorPlugin::singleton->mirror_length_enabled() ? -c->get_point_out(idx) : (-c->get_point_out(idx).normalized() * orig_in_length));
|
||||||
|
ur->add_undo_method(c.ptr(), "set_point_in", idx, PathEditorPlugin::singleton->mirror_length_enabled() ? -static_cast<Vector3>(p_restore) : (-static_cast<Vector3>(p_restore).normalized() * orig_in_length));
|
||||||
|
}
|
||||||
ur->commit_action();
|
ur->commit_action();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -291,6 +310,9 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<Inp
|
|||||||
|
|
||||||
Point2 mbpos(mb->get_position().x, mb->get_position().y);
|
Point2 mbpos(mb->get_position().x, mb->get_position().y);
|
||||||
|
|
||||||
|
if (!mb->is_pressed())
|
||||||
|
set_handle_clicked(false);
|
||||||
|
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->get_control()))) {
|
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->get_control()))) {
|
||||||
//click into curve, break it down
|
//click into curve, break it down
|
||||||
PoolVector<Vector3> v3a = c->tessellate();
|
PoolVector<Vector3> v3a = c->tessellate();
|
||||||
@@ -459,6 +481,7 @@ void PathEditorPlugin::make_visible(bool p_visible) {
|
|||||||
curve_edit->show();
|
curve_edit->show();
|
||||||
curve_del->show();
|
curve_del->show();
|
||||||
curve_close->show();
|
curve_close->show();
|
||||||
|
handle_menu->show();
|
||||||
sep->show();
|
sep->show();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -466,6 +489,7 @@ void PathEditorPlugin::make_visible(bool p_visible) {
|
|||||||
curve_edit->hide();
|
curve_edit->hide();
|
||||||
curve_del->hide();
|
curve_del->hide();
|
||||||
curve_close->hide();
|
curve_close->hide();
|
||||||
|
handle_menu->hide();
|
||||||
sep->hide();
|
sep->hide();
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -495,6 +519,26 @@ void PathEditorPlugin::_close_curve() {
|
|||||||
c->add_point(c->get_point_position(0), c->get_point_in(0), c->get_point_out(0));
|
c->add_point(c->get_point_position(0), c->get_point_in(0), c->get_point_out(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PathEditorPlugin::_handle_option_pressed(int p_option) {
|
||||||
|
|
||||||
|
PopupMenu *pm;
|
||||||
|
pm = handle_menu->get_popup();
|
||||||
|
|
||||||
|
switch (p_option) {
|
||||||
|
case HANDLE_OPTION_ANGLE: {
|
||||||
|
bool is_checked = pm->is_item_checked(HANDLE_OPTION_ANGLE);
|
||||||
|
mirror_handle_angle = !is_checked;
|
||||||
|
pm->set_item_checked(HANDLE_OPTION_ANGLE, mirror_handle_angle);
|
||||||
|
pm->set_item_disabled(HANDLE_OPTION_LENGTH, !mirror_handle_angle);
|
||||||
|
} break;
|
||||||
|
case HANDLE_OPTION_LENGTH: {
|
||||||
|
bool is_checked = pm->is_item_checked(HANDLE_OPTION_LENGTH);
|
||||||
|
mirror_handle_length = !is_checked;
|
||||||
|
pm->set_item_checked(HANDLE_OPTION_LENGTH, mirror_handle_length);
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PathEditorPlugin::_notification(int p_what) {
|
void PathEditorPlugin::_notification(int p_what) {
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||||
@@ -510,6 +554,7 @@ void PathEditorPlugin::_bind_methods() {
|
|||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("_mode_changed"), &PathEditorPlugin::_mode_changed);
|
ClassDB::bind_method(D_METHOD("_mode_changed"), &PathEditorPlugin::_mode_changed);
|
||||||
ClassDB::bind_method(D_METHOD("_close_curve"), &PathEditorPlugin::_close_curve);
|
ClassDB::bind_method(D_METHOD("_close_curve"), &PathEditorPlugin::_close_curve);
|
||||||
|
ClassDB::bind_method(D_METHOD("_handle_option_pressed"), &PathEditorPlugin::_handle_option_pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
PathEditorPlugin *PathEditorPlugin::singleton = NULL;
|
PathEditorPlugin *PathEditorPlugin::singleton = NULL;
|
||||||
@@ -519,6 +564,8 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) {
|
|||||||
path = NULL;
|
path = NULL;
|
||||||
editor = p_node;
|
editor = p_node;
|
||||||
singleton = this;
|
singleton = this;
|
||||||
|
mirror_handle_angle = true;
|
||||||
|
mirror_handle_length = true;
|
||||||
|
|
||||||
path_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
|
path_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
|
||||||
path_material->set_albedo(Color(0.5, 0.5, 1.0, 0.8));
|
path_material->set_albedo(Color(0.5, 0.5, 1.0, 0.8));
|
||||||
@@ -567,6 +614,20 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) {
|
|||||||
curve_close->set_tooltip(TTR("Close Curve"));
|
curve_close->set_tooltip(TTR("Close Curve"));
|
||||||
SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_close);
|
SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_close);
|
||||||
|
|
||||||
|
PopupMenu *menu;
|
||||||
|
|
||||||
|
handle_menu = memnew(MenuButton);
|
||||||
|
handle_menu->set_text(TTR("Options"));
|
||||||
|
handle_menu->hide();
|
||||||
|
SpatialEditor::get_singleton()->add_control_to_menu_panel(handle_menu);
|
||||||
|
|
||||||
|
menu = handle_menu->get_popup();
|
||||||
|
menu->add_check_item(TTR("Mirror Handle Angles"));
|
||||||
|
menu->set_item_checked(HANDLE_OPTION_ANGLE, mirror_handle_angle);
|
||||||
|
menu->add_check_item(TTR("Mirror Handle Lengths"));
|
||||||
|
menu->set_item_checked(HANDLE_OPTION_LENGTH, mirror_handle_length);
|
||||||
|
menu->connect("id_pressed", this, "_handle_option_pressed");
|
||||||
|
|
||||||
curve_edit->set_pressed(true);
|
curve_edit->set_pressed(true);
|
||||||
/*
|
/*
|
||||||
collision_polygon_editor = memnew( PathEditor(p_node) );
|
collision_polygon_editor = memnew( PathEditor(p_node) );
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* path_editor_plugin.h */
|
/* path_editor_plugin.h */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* This file is part of: */
|
/* This file is part of: */
|
||||||
@@ -40,6 +40,8 @@ class PathSpatialGizmo : public EditorSpatialGizmo {
|
|||||||
|
|
||||||
Path *path;
|
Path *path;
|
||||||
mutable Vector3 original;
|
mutable Vector3 original;
|
||||||
|
mutable float orig_in_length;
|
||||||
|
mutable float orig_out_length;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual String get_handle_name(int p_idx) const;
|
virtual String get_handle_name(int p_idx) const;
|
||||||
@@ -60,6 +62,7 @@ class PathEditorPlugin : public EditorPlugin {
|
|||||||
ToolButton *curve_edit;
|
ToolButton *curve_edit;
|
||||||
ToolButton *curve_del;
|
ToolButton *curve_del;
|
||||||
ToolButton *curve_close;
|
ToolButton *curve_close;
|
||||||
|
MenuButton *handle_menu;
|
||||||
|
|
||||||
EditorNode *editor;
|
EditorNode *editor;
|
||||||
|
|
||||||
@@ -67,6 +70,15 @@ class PathEditorPlugin : public EditorPlugin {
|
|||||||
|
|
||||||
void _mode_changed(int p_idx);
|
void _mode_changed(int p_idx);
|
||||||
void _close_curve();
|
void _close_curve();
|
||||||
|
void _handle_option_pressed(int p_option);
|
||||||
|
bool handle_clicked;
|
||||||
|
bool mirror_handle_angle;
|
||||||
|
bool mirror_handle_length;
|
||||||
|
|
||||||
|
enum HandleOption {
|
||||||
|
HANDLE_OPTION_ANGLE,
|
||||||
|
HANDLE_OPTION_LENGTH
|
||||||
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
@@ -88,6 +100,11 @@ public:
|
|||||||
virtual bool handles(Object *p_object) const;
|
virtual bool handles(Object *p_object) const;
|
||||||
virtual void make_visible(bool p_visible);
|
virtual void make_visible(bool p_visible);
|
||||||
|
|
||||||
|
bool mirror_angle_enabled() { return mirror_handle_angle; }
|
||||||
|
bool mirror_length_enabled() { return mirror_handle_length; }
|
||||||
|
bool is_handle_clicked() { return handle_clicked; }
|
||||||
|
void set_handle_clicked(bool clicked) { handle_clicked = clicked; }
|
||||||
|
|
||||||
PathEditorPlugin(EditorNode *p_node);
|
PathEditorPlugin(EditorNode *p_node);
|
||||||
~PathEditorPlugin();
|
~PathEditorPlugin();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user