Misc Bits
-=-=-=-=- -Added more missing icons to nodes. -Added more 3D split view modes -Fixed annoying script editor bug with keyboard focus
@@ -1,180 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* follow_camera.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef FOLLOW_CAMERA_H
|
||||
#define FOLLOW_CAMERA_H
|
||||
|
||||
#include "scene/3d/camera.h"
|
||||
|
||||
class FollowCamera : public Camera {
|
||||
|
||||
OBJ_TYPE( FollowCamera, Camera );
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//used for follow
|
||||
Vector3 follow_pos;
|
||||
//used for fixed
|
||||
Vector2 initial_orbit;
|
||||
Vector2 orbit;
|
||||
float distance;
|
||||
|
||||
float height;
|
||||
float target_width;
|
||||
|
||||
float min_distance;
|
||||
float max_distance;
|
||||
|
||||
float max_orbit_x;
|
||||
float min_orbit_x;
|
||||
|
||||
float inclination;
|
||||
float extraclip;
|
||||
bool fullclip;
|
||||
|
||||
bool clip;
|
||||
bool autoturn;
|
||||
float autoturn_tolerance;
|
||||
float autoturn_speed;
|
||||
|
||||
bool smooth;
|
||||
float smooth_rot_ratio;
|
||||
float smooth_pos_ratio;
|
||||
|
||||
|
||||
|
||||
struct ClipRay {
|
||||
RID query;
|
||||
bool clipped;
|
||||
Vector3 cast_pos;
|
||||
Vector3 clip_pos;
|
||||
};
|
||||
|
||||
ClipRay clip_ray[3];
|
||||
Vector3 target_pos;
|
||||
float clip_len;
|
||||
|
||||
Vector3 up_vector;
|
||||
|
||||
|
||||
virtual RES _get_gizmo_geometry() const;
|
||||
|
||||
Transform ted;
|
||||
Vector3 proposed_pos;
|
||||
Transform accepted;
|
||||
Transform final;
|
||||
RID target_body;
|
||||
|
||||
bool use_lookat_target;
|
||||
Vector3 lookat_target;
|
||||
|
||||
void _compute_camera();
|
||||
|
||||
bool queries_active;
|
||||
void _clear_queries();
|
||||
|
||||
void _set_initial_orbit(const Vector2& p_orbit);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void _request_camera_update() {} //ignore
|
||||
|
||||
void _notification(int p_what);
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
void _ray_collision(Vector3 p_point, Vector3 p_normal, int p_subindex, ObjectID p_against,int p_idx);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
void set_orbit(const Vector2& p_orbit);
|
||||
void set_orbit_x(float p_x);
|
||||
void set_orbit_y(float p_y);
|
||||
Vector2 get_orbit() const;
|
||||
|
||||
void set_height(float p_height);
|
||||
float get_height() const;
|
||||
|
||||
void set_inclination(float p_degrees);
|
||||
float get_inclination() const;
|
||||
|
||||
void set_max_orbit_x(float p_max);
|
||||
float get_max_orbit_x() const;
|
||||
|
||||
void set_min_orbit_x(float p_min);
|
||||
float get_min_orbit_x() const;
|
||||
|
||||
void rotate_orbit(const Vector2& p_relative);
|
||||
|
||||
void set_distance(float p_distance);
|
||||
float get_distance() const;
|
||||
|
||||
float get_min_distance() const;
|
||||
float get_max_distance() const;
|
||||
void set_min_distance(float p_min);
|
||||
void set_max_distance(float p_max);
|
||||
|
||||
/** FINISH THIS AND CLEAN IT UP */
|
||||
|
||||
void set_clip(bool p_enabled);
|
||||
bool has_clip() const;
|
||||
|
||||
void set_autoturn(bool p_enabled);
|
||||
bool has_autoturn() const;
|
||||
|
||||
void set_autoturn_tolerance(float p_degrees);
|
||||
float get_autoturn_tolerance() const;
|
||||
|
||||
void set_autoturn_speed(float p_speed);
|
||||
float get_autoturn_speed() const;
|
||||
|
||||
void set_smoothing(bool p_enable);
|
||||
bool has_smoothing() const;
|
||||
|
||||
void set_translation_smoothing(float p_amount);
|
||||
float get_translation_smoothing() const;
|
||||
|
||||
void set_rotation_smoothing(float p_amount);
|
||||
float get_rotation_smoothing() const;
|
||||
|
||||
void set_use_lookat_target(bool p_use, const Vector3 &p_lookat = Vector3());
|
||||
|
||||
void set_up_vector(const Vector3& p_up);
|
||||
Vector3 get_up_vector() const;
|
||||
|
||||
virtual Transform get_camera_transform() const;
|
||||
|
||||
FollowCamera();
|
||||
~FollowCamera();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // FOLLOW_CAMERA_H
|
||||
@@ -176,7 +176,6 @@
|
||||
#include "scene/3d/camera.h"
|
||||
|
||||
#include "scene/3d/interpolated_camera.h"
|
||||
#include "scene/3d/follow_camera.h"
|
||||
#include "scene/3d/position_3d.h"
|
||||
#include "scene/3d/test_cube.h"
|
||||
#include "scene/3d/mesh_instance.h"
|
||||
@@ -353,7 +352,6 @@ void register_scene_types() {
|
||||
ObjectTypeDB::register_type<BoneAttachment>();
|
||||
ObjectTypeDB::register_virtual_type<VisualInstance>();
|
||||
ObjectTypeDB::register_type<Camera>();
|
||||
ObjectTypeDB::register_type<FollowCamera>();
|
||||
ObjectTypeDB::register_type<InterpolatedCamera>();
|
||||
ObjectTypeDB::register_type<TestCube>();
|
||||
ObjectTypeDB::register_type<MeshInstance>();
|
||||
|
||||
@@ -5882,6 +5882,7 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_
|
||||
if (p_viewport->queue_capture) {
|
||||
|
||||
rasterizer->capture_viewport(&p_viewport->capture);
|
||||
p_viewport->queue_capture = false;
|
||||
}
|
||||
|
||||
//restore
|
||||
|
||||
|
After Width: | Height: | Size: 419 B |
|
After Width: | Height: | Size: 380 B |
|
After Width: | Height: | Size: 156 B |
|
After Width: | Height: | Size: 167 B |
|
After Width: | Height: | Size: 574 B |
|
After Width: | Height: | Size: 405 B |
|
After Width: | Height: | Size: 434 B |
@@ -1105,6 +1105,8 @@ void ScriptEditor::ensure_select_current() {
|
||||
if (!ste)
|
||||
return;
|
||||
Ref<Script> script = ste->get_edited_script();
|
||||
|
||||
ste->get_text_edit()->grab_focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2348,6 +2348,10 @@ Dictionary SpatialEditor::get_state() const {
|
||||
vc=3;
|
||||
else if (view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS) ))
|
||||
vc=4;
|
||||
else if (view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT) ))
|
||||
vc=5;
|
||||
else if (view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT) ))
|
||||
vc=6;
|
||||
|
||||
d["viewport_mode"]=vc;
|
||||
Array vpdata;
|
||||
@@ -2389,6 +2393,10 @@ void SpatialEditor::set_state(const Dictionary& p_state) {
|
||||
_menu_item_pressed(MENU_VIEW_USE_3_VIEWPORTS);
|
||||
else if (vc==4)
|
||||
_menu_item_pressed(MENU_VIEW_USE_4_VIEWPORTS);
|
||||
else if (vc==5)
|
||||
_menu_item_pressed(MENU_VIEW_USE_2_VIEWPORTS_ALT);
|
||||
else if (vc==6)
|
||||
_menu_item_pressed(MENU_VIEW_USE_3_VIEWPORTS_ALT);
|
||||
|
||||
Array vp = d["viewports"];
|
||||
ERR_FAIL_COND(vp.size()>4);
|
||||
@@ -2619,6 +2627,8 @@ void SpatialEditor::_menu_item_pressed(int p_option) {
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), false );
|
||||
|
||||
} break;
|
||||
case MENU_VIEW_USE_2_VIEWPORTS: {
|
||||
@@ -2641,6 +2651,32 @@ void SpatialEditor::_menu_item_pressed(int p_option) {
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), true );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), false );
|
||||
|
||||
} break;
|
||||
case MENU_VIEW_USE_2_VIEWPORTS_ALT: {
|
||||
|
||||
for(int i=1;i<4;i++) {
|
||||
|
||||
if (i==1 || i==3)
|
||||
viewports[i]->hide();
|
||||
else
|
||||
viewports[i]->show();
|
||||
|
||||
|
||||
}
|
||||
viewports[0]->set_area_as_parent_rect();
|
||||
viewports[0]->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_RATIO,0.5);
|
||||
viewports[2]->set_area_as_parent_rect();
|
||||
viewports[2]->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_RATIO,0.5);
|
||||
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), true );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), false );
|
||||
|
||||
} break;
|
||||
case MENU_VIEW_USE_3_VIEWPORTS: {
|
||||
@@ -2665,6 +2701,34 @@ void SpatialEditor::_menu_item_pressed(int p_option) {
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), true );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), false );
|
||||
|
||||
} break;
|
||||
case MENU_VIEW_USE_3_VIEWPORTS_ALT: {
|
||||
|
||||
for(int i=1;i<4;i++) {
|
||||
|
||||
if (i==1)
|
||||
viewports[i]->hide();
|
||||
else
|
||||
viewports[i]->show();
|
||||
}
|
||||
viewports[0]->set_area_as_parent_rect();
|
||||
viewports[0]->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_RATIO,0.5);
|
||||
viewports[0]->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_RATIO,0.5);
|
||||
viewports[2]->set_area_as_parent_rect();
|
||||
viewports[2]->set_anchor_and_margin(MARGIN_TOP,ANCHOR_RATIO,0.5);
|
||||
viewports[2]->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_RATIO,0.5);
|
||||
viewports[3]->set_area_as_parent_rect();
|
||||
viewports[3]->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_RATIO,0.5);
|
||||
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), true );
|
||||
|
||||
} break;
|
||||
case MENU_VIEW_USE_4_VIEWPORTS: {
|
||||
@@ -2690,6 +2754,8 @@ void SpatialEditor::_menu_item_pressed(int p_option) {
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), true );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), false );
|
||||
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), false );
|
||||
|
||||
} break;
|
||||
case MENU_VIEW_DISPLAY_NORMAL: {
|
||||
@@ -3159,7 +3225,9 @@ void SpatialEditor::_notification(int p_what) {
|
||||
|
||||
view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT),get_icon("Panels1","EditorIcons"));
|
||||
view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS),get_icon("Panels2","EditorIcons"));
|
||||
view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT),get_icon("Panels2Alt","EditorIcons"));
|
||||
view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS),get_icon("Panels3","EditorIcons"));
|
||||
view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT),get_icon("Panels3Alt","EditorIcons"));
|
||||
view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS),get_icon("Panels4","EditorIcons"));
|
||||
|
||||
_menu_item_pressed(MENU_VIEW_USE_1_VIEWPORT);
|
||||
@@ -3276,8 +3344,12 @@ void SpatialEditor::_toggle_maximize_view(Object* p_viewport) {
|
||||
_menu_item_pressed(MENU_VIEW_USE_1_VIEWPORT);
|
||||
else if (view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS) ))
|
||||
_menu_item_pressed(MENU_VIEW_USE_2_VIEWPORTS);
|
||||
else if (view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT) ))
|
||||
_menu_item_pressed(MENU_VIEW_USE_2_VIEWPORTS_ALT);
|
||||
else if (view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS) ))
|
||||
_menu_item_pressed(MENU_VIEW_USE_3_VIEWPORTS);
|
||||
else if (view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT) ))
|
||||
_menu_item_pressed(MENU_VIEW_USE_3_VIEWPORTS_ALT);
|
||||
else if (view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS) ))
|
||||
_menu_item_pressed(MENU_VIEW_USE_4_VIEWPORTS);
|
||||
}
|
||||
@@ -3442,7 +3514,9 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
||||
|
||||
p->add_check_item("1 Viewport",MENU_VIEW_USE_1_VIEWPORT,KEY_MASK_ALT+KEY_1);
|
||||
p->add_check_item("2 Viewports",MENU_VIEW_USE_2_VIEWPORTS,KEY_MASK_ALT+KEY_2);
|
||||
p->add_check_item("2 Viewports (Alt)",MENU_VIEW_USE_2_VIEWPORTS_ALT,KEY_MASK_SHIFT+KEY_MASK_ALT+KEY_2);
|
||||
p->add_check_item("3 Viewports",MENU_VIEW_USE_3_VIEWPORTS,KEY_MASK_ALT+KEY_3);
|
||||
p->add_check_item("3 Viewports (Alt)",MENU_VIEW_USE_3_VIEWPORTS_ALT,KEY_MASK_SHIFT+KEY_MASK_ALT+KEY_3);
|
||||
p->add_check_item("4 Viewports",MENU_VIEW_USE_4_VIEWPORTS,KEY_MASK_ALT+KEY_4);
|
||||
p->add_separator();
|
||||
|
||||
|
||||
@@ -344,7 +344,9 @@ private:
|
||||
MENU_TRANSFORM_DIALOG,
|
||||
MENU_VIEW_USE_1_VIEWPORT,
|
||||
MENU_VIEW_USE_2_VIEWPORTS,
|
||||
MENU_VIEW_USE_2_VIEWPORTS_ALT,
|
||||
MENU_VIEW_USE_3_VIEWPORTS,
|
||||
MENU_VIEW_USE_3_VIEWPORTS_ALT,
|
||||
MENU_VIEW_USE_4_VIEWPORTS,
|
||||
MENU_VIEW_USE_DEFAULT_LIGHT,
|
||||
MENU_VIEW_DISPLAY_NORMAL,
|
||||
|
||||