|
@@ -691,11 +691,11 @@ Vector3 Node3DEditorViewport::_get_camera_position() const {
|
|
|
return _get_camera_transform().origin;
|
|
|
}
|
|
|
|
|
|
-Point2 Node3DEditorViewport::_point_to_screen(const Vector3 &p_point) {
|
|
|
+Point2 Node3DEditorViewport::point_to_screen(const Vector3 &p_point) {
|
|
|
return camera->unproject_position(p_point) * subviewport_container->get_stretch_shrink();
|
|
|
}
|
|
|
|
|
|
-Vector3 Node3DEditorViewport::_get_ray_pos(const Vector2 &p_pos) const {
|
|
|
+Vector3 Node3DEditorViewport::get_ray_pos(const Vector2 &p_pos) const {
|
|
|
return camera->project_ray_origin(p_pos / subviewport_container->get_stretch_shrink());
|
|
|
}
|
|
|
|
|
@@ -703,7 +703,7 @@ Vector3 Node3DEditorViewport::_get_camera_normal() const {
|
|
|
return -_get_camera_transform().basis.get_column(2);
|
|
|
}
|
|
|
|
|
|
-Vector3 Node3DEditorViewport::_get_ray(const Vector2 &p_pos) const {
|
|
|
+Vector3 Node3DEditorViewport::get_ray(const Vector2 &p_pos) const {
|
|
|
return camera->project_ray_normal(p_pos / subviewport_container->get_stretch_shrink());
|
|
|
}
|
|
|
|
|
@@ -769,8 +769,8 @@ void Node3DEditorViewport::_select_clicked(bool p_allow_locked) {
|
|
|
}
|
|
|
|
|
|
ObjectID Node3DEditorViewport::_select_ray(const Point2 &p_pos) const {
|
|
|
- Vector3 ray = _get_ray(p_pos);
|
|
|
- Vector3 pos = _get_ray_pos(p_pos);
|
|
|
+ Vector3 ray = get_ray(p_pos);
|
|
|
+ Vector3 pos = get_ray_pos(p_pos);
|
|
|
Vector2 shrinked_pos = p_pos / subviewport_container->get_stretch_shrink();
|
|
|
|
|
|
if (viewport->get_debug_draw() == Viewport::DEBUG_DRAW_SDFGI_PROBES) {
|
|
@@ -837,8 +837,8 @@ ObjectID Node3DEditorViewport::_select_ray(const Point2 &p_pos) const {
|
|
|
}
|
|
|
|
|
|
void Node3DEditorViewport::_find_items_at_pos(const Point2 &p_pos, Vector<_RayResult> &r_results, bool p_include_locked_nodes) {
|
|
|
- Vector3 ray = _get_ray(p_pos);
|
|
|
- Vector3 pos = _get_ray_pos(p_pos);
|
|
|
+ Vector3 ray = get_ray(p_pos);
|
|
|
+ Vector3 pos = get_ray_pos(p_pos);
|
|
|
|
|
|
Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_ray(pos, pos + ray * camera->get_far(), get_tree()->get_root()->get_world_3d()->get_scenario());
|
|
|
HashSet<Node3D *> found_nodes;
|
|
@@ -1153,8 +1153,8 @@ void Node3DEditorViewport::_update_name() {
|
|
|
|
|
|
void Node3DEditorViewport::_compute_edit(const Point2 &p_point) {
|
|
|
_edit.original_local = spatial_editor->are_local_coords_enabled();
|
|
|
- _edit.click_ray = _get_ray(p_point);
|
|
|
- _edit.click_ray_pos = _get_ray_pos(p_point);
|
|
|
+ _edit.click_ray = get_ray(p_point);
|
|
|
+ _edit.click_ray_pos = get_ray_pos(p_point);
|
|
|
_edit.plane = TRANSFORM_VIEW;
|
|
|
spatial_editor->update_transform_gizmo();
|
|
|
_edit.center = spatial_editor->get_gizmo_transform().origin;
|
|
@@ -1233,8 +1233,8 @@ bool Node3DEditorViewport::_transform_gizmo_select(const Vector2 &p_screenpos, b
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- Vector3 ray_pos = _get_ray_pos(p_screenpos);
|
|
|
- Vector3 ray = _get_ray(p_screenpos);
|
|
|
+ Vector3 ray_pos = get_ray_pos(p_screenpos);
|
|
|
+ Vector3 ray = get_ray(p_screenpos);
|
|
|
|
|
|
Transform3D gt = spatial_editor->get_gizmo_transform();
|
|
|
|
|
@@ -3115,7 +3115,7 @@ void Node3DEditorViewport::_draw() {
|
|
|
}
|
|
|
|
|
|
if (_edit.mode == TRANSFORM_ROTATE && _edit.show_rotation_line) {
|
|
|
- Point2 center = _point_to_screen(_edit.center);
|
|
|
+ Point2 center = point_to_screen(_edit.center);
|
|
|
|
|
|
Color handle_color;
|
|
|
switch (_edit.plane) {
|
|
@@ -4087,8 +4087,8 @@ Vector3 Node3DEditorViewport::_get_instance_position(const Point2 &p_pos) const
|
|
|
const float MAX_DISTANCE = 50.0;
|
|
|
const float FALLBACK_DISTANCE = 5.0;
|
|
|
|
|
|
- Vector3 world_ray = _get_ray(p_pos);
|
|
|
- Vector3 world_pos = _get_ray_pos(p_pos);
|
|
|
+ Vector3 world_ray = get_ray(p_pos);
|
|
|
+ Vector3 world_pos = get_ray_pos(p_pos);
|
|
|
|
|
|
PhysicsDirectSpaceState3D *ss = get_tree()->get_root()->get_world_3d()->get_direct_space_state();
|
|
|
|
|
@@ -4250,8 +4250,8 @@ bool Node3DEditorViewport::_apply_preview_material(ObjectID p_target, const Poin
|
|
|
Ref<Mesh> mesh = mesh_instance->get_mesh();
|
|
|
int surface_count = mesh->get_surface_count();
|
|
|
|
|
|
- Vector3 world_ray = _get_ray(p_point);
|
|
|
- Vector3 world_pos = _get_ray_pos(p_point);
|
|
|
+ Vector3 world_ray = get_ray(p_point);
|
|
|
+ Vector3 world_pos = get_ray_pos(p_point);
|
|
|
|
|
|
int closest_surface = -1;
|
|
|
float closest_dist = 1e20;
|
|
@@ -4698,8 +4698,8 @@ void Node3DEditorViewport::apply_transform(Vector3 p_motion, double p_snap) {
|
|
|
|
|
|
// Update the current transform operation in response to an input.
|
|
|
void Node3DEditorViewport::update_transform(bool p_shift) {
|
|
|
- Vector3 ray_pos = _get_ray_pos(_edit.mouse_pos);
|
|
|
- Vector3 ray = _get_ray(_edit.mouse_pos);
|
|
|
+ Vector3 ray_pos = get_ray_pos(_edit.mouse_pos);
|
|
|
+ Vector3 ray = get_ray(_edit.mouse_pos);
|
|
|
double snap = EDITOR_GET("interface/inspector/default_float_step");
|
|
|
int snap_step_decimals = Math::range_step_decimals(snap);
|
|
|
|