You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Implemented SkeletonEditorGizmo
Co-authored-by: Lyuma <xn.lyuma@gmail.com>
This commit is contained in:
@@ -103,9 +103,9 @@ void CollisionPolygon3DEditor::_wip_close() {
|
||||
undo_redo->commit_action();
|
||||
}
|
||||
|
||||
bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) {
|
||||
EditorPlugin::AfterGUIInput CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) {
|
||||
if (!node) {
|
||||
return false;
|
||||
return EditorPlugin::AFTER_GUI_INPUT_PASS;
|
||||
}
|
||||
|
||||
Transform3D gt = node->get_global_transform();
|
||||
@@ -124,7 +124,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con
|
||||
Vector3 spoint;
|
||||
|
||||
if (!p.intersects_ray(ray_from, ray_dir, &spoint)) {
|
||||
return false;
|
||||
return EditorPlugin::AFTER_GUI_INPUT_PASS;
|
||||
}
|
||||
|
||||
spoint = gi.xform(spoint);
|
||||
@@ -151,19 +151,19 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con
|
||||
snap_ignore = false;
|
||||
_polygon_draw();
|
||||
edited_point = 1;
|
||||
return true;
|
||||
return EditorPlugin::AFTER_GUI_INPUT_STOP;
|
||||
} else {
|
||||
if (wip.size() > 1 && p_camera->unproject_position(gt.xform(Vector3(wip[0].x, wip[0].y, depth))).distance_to(gpoint) < grab_threshold) {
|
||||
//wip closed
|
||||
_wip_close();
|
||||
|
||||
return true;
|
||||
return EditorPlugin::AFTER_GUI_INPUT_STOP;
|
||||
} else {
|
||||
wip.push_back(cpoint);
|
||||
edited_point = wip.size();
|
||||
snap_ignore = false;
|
||||
_polygon_draw();
|
||||
return true;
|
||||
return EditorPlugin::AFTER_GUI_INPUT_STOP;
|
||||
}
|
||||
}
|
||||
} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed() && wip_active) {
|
||||
@@ -184,7 +184,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con
|
||||
undo_redo->add_do_method(this, "_polygon_draw");
|
||||
undo_redo->add_undo_method(this, "_polygon_draw");
|
||||
undo_redo->commit_action();
|
||||
return true;
|
||||
return EditorPlugin::AFTER_GUI_INPUT_STOP;
|
||||
}
|
||||
|
||||
//search edges
|
||||
@@ -219,7 +219,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con
|
||||
_polygon_draw();
|
||||
snap_ignore = true;
|
||||
|
||||
return true;
|
||||
return EditorPlugin::AFTER_GUI_INPUT_STOP;
|
||||
}
|
||||
} else {
|
||||
//look for points to move
|
||||
@@ -244,7 +244,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con
|
||||
edited_point_pos = poly[closest_idx];
|
||||
_polygon_draw();
|
||||
snap_ignore = false;
|
||||
return true;
|
||||
return EditorPlugin::AFTER_GUI_INPUT_STOP;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -253,7 +253,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con
|
||||
if (edited_point != -1) {
|
||||
//apply
|
||||
|
||||
ERR_FAIL_INDEX_V(edited_point, poly.size(), false);
|
||||
ERR_FAIL_INDEX_V(edited_point, poly.size(), EditorPlugin::AFTER_GUI_INPUT_PASS);
|
||||
poly.write[edited_point] = edited_point_pos;
|
||||
undo_redo->create_action(TTR("Edit Poly"));
|
||||
undo_redo->add_do_method(node, "set_polygon", poly);
|
||||
@@ -263,7 +263,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con
|
||||
undo_redo->commit_action();
|
||||
|
||||
edited_point = -1;
|
||||
return true;
|
||||
return EditorPlugin::AFTER_GUI_INPUT_STOP;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -290,7 +290,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con
|
||||
undo_redo->add_do_method(this, "_polygon_draw");
|
||||
undo_redo->add_undo_method(this, "_polygon_draw");
|
||||
undo_redo->commit_action();
|
||||
return true;
|
||||
return EditorPlugin::AFTER_GUI_INPUT_STOP;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con
|
||||
Vector3 spoint;
|
||||
|
||||
if (!p.intersects_ray(ray_from, ray_dir, &spoint)) {
|
||||
return false;
|
||||
return EditorPlugin::AFTER_GUI_INPUT_PASS;
|
||||
}
|
||||
|
||||
spoint = gi.xform(spoint);
|
||||
@@ -332,7 +332,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return EditorPlugin::AFTER_GUI_INPUT_PASS;
|
||||
}
|
||||
|
||||
float CollisionPolygon3DEditor::_get_depth() {
|
||||
|
||||
Reference in New Issue
Block a user