summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-01-02 12:55:18 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-01-02 12:55:18 -0300
commitaeee764971048cfdd0b20c244c3509a1bcb21344 (patch)
treeb5d8d854e9b1fd5f6dc524ee985b601053bc9a03 /tools/editor
parent0378e1109b8ff96a3583d7da02966ef3344ee35a (diff)
parentbf0862907fbe336873d3a4eb92c5c7799047834c (diff)
Merge branch 'master' of https://github.com/okamstudio/godot
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/animation_editor.cpp2
-rw-r--r--tools/editor/editor_settings.cpp2
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp12
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.h6
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp25
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.h6
-rw-r--r--tools/editor/plugins/tile_map_editor_plugin.cpp51
-rw-r--r--tools/editor/plugins/tile_map_editor_plugin.h9
8 files changed, 64 insertions, 49 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp
index 95f9ee6509..2eef821438 100644
--- a/tools/editor/animation_editor.cpp
+++ b/tools/editor/animation_editor.cpp
@@ -3238,7 +3238,7 @@ AnimationKeyEditor::AnimationKeyEditor(UndoRedo *p_undo_redo, EditorHistory *p_h
move_down_button->connect("pressed",this,"_menu_track",make_binds(TRACK_MENU_MOVE_DOWN));
move_down_button->set_focus_mode(FOCUS_NONE);
move_down_button->set_disabled(true);
- move_down_button->set_tooltip("Move current track dosn.");
+ move_down_button->set_tooltip("Move current track down.");
remove_button = memnew( ToolButton );
hb->add_child(remove_button);
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 8b0fd204e3..3f44701b98 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -419,6 +419,8 @@ void EditorSettings::_load_defaults() {
set("3d_editor/navigation_scheme",0);
hints["3d_editor/navigation_scheme"]=PropertyInfo(Variant::INT,"3d_editor/navigation_scheme",PROPERTY_HINT_ENUM,"Godot,Maya,Modo");
+ set("3d_editor/zoom_style",0);
+ hints["3d_editor/zoom_style"]=PropertyInfo(Variant::INT,"3d_editor/zoom_style",PROPERTY_HINT_ENUM,"Vertical, Horizontal");
set("3d_editor/orbit_modifier",0);
hints["3d_editor/orbit_modifier"]=PropertyInfo(Variant::INT,"3d_editor/orbit_modifier",PROPERTY_HINT_ENUM,"None,Shift,Alt,Meta,Ctrl");
set("3d_editor/pan_modifier",1);
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index 599160eb46..a18c2a58a7 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -2683,6 +2683,11 @@ void CanvasItemEditor::add_control_to_menu_panel(Control *p_control) {
hb->add_child(p_control);
}
+HSplitContainer *CanvasItemEditor::get_palette_split() {
+
+ return palette_split;
+}
+
CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
tool = TOOL_SELECT;
@@ -2697,15 +2702,20 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
add_child( hb );
hb->set_area_as_parent_rect();
+ palette_split = memnew( HSplitContainer);
+ palette_split->set_v_size_flags(SIZE_EXPAND_FILL);
+ add_child(palette_split);
+
Control *vp_base = memnew (Control);
- add_child(vp_base);
vp_base->set_v_size_flags(SIZE_EXPAND_FILL);
+ palette_split->add_child(vp_base);
Control *vp = memnew (Control);
vp_base->add_child(vp);
vp->set_area_as_parent_rect();
vp->add_child(p_editor->get_scene_root());
+
viewport = memnew( Control );
vp_base->add_child(viewport);
viewport->set_area_as_parent_rect();
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.h b/tools/editor/plugins/canvas_item_editor_plugin.h
index 15ac7b1bb3..c56570d43f 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.h
+++ b/tools/editor/plugins/canvas_item_editor_plugin.h
@@ -289,6 +289,10 @@ class CanvasItemEditor : public VBoxContainer {
void _viewport_input_event(const InputEvent& p_event);
void _viewport_draw();
+
+private:
+ HSplitContainer *palette_split;
+
friend class CanvasItemEditorPlugin;
protected:
@@ -341,6 +345,8 @@ public:
void add_control_to_menu_panel(Control *p_control);
+ HSplitContainer *get_palette_split();
+
Control *get_viewport_control() { return viewport; }
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index a1f1ccf5e3..0960a961ec 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -535,6 +535,14 @@ SpatialEditorViewport::NavigationScheme SpatialEditorViewport::_get_navigation_s
return NAVIGATION_GODOT;
}
+SpatialEditorViewport::NavigationZoomStyle SpatialEditorViewport::_get_navigation_zoom_style(const String& p_property) {
+ switch(EditorSettings::get_singleton()->get(p_property).operator int()) {
+ case 0: return NAVIGATION_ZOOM_VERTICAL;
+ case 1: return NAVIGATION_ZOOM_HORIZONTAL;
+ }
+ return NAVIGATION_ZOOM_VERTICAL;
+}
+
bool SpatialEditorViewport::_gizmo_select(const Vector2& p_screenpos,bool p_hilite_only) {
if (!spatial_editor->is_gizmo_visible())
@@ -1429,10 +1437,19 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
if (nav_scheme==NAVIGATION_MAYA && m.mod.shift)
zoom_speed *= zoom_speed_modifier;
- if ( m.relative_y > 0)
- cursor.distance*=1+m.relative_y*zoom_speed;
- else if (m.relative_y < 0)
- cursor.distance/=1-m.relative_y*zoom_speed;
+ NavigationZoomStyle zoom_style = _get_navigation_zoom_style("3d_editor/zoom_style");
+ if (zoom_style == NAVIGATION_ZOOM_HORIZONTAL) {
+ if ( m.relative_x > 0)
+ cursor.distance*=1-m.relative_x*zoom_speed;
+ else if (m.relative_x < 0)
+ cursor.distance/=1+m.relative_x*zoom_speed;
+ }
+ else {
+ if ( m.relative_y > 0)
+ cursor.distance*=1+m.relative_y*zoom_speed;
+ else if (m.relative_y < 0)
+ cursor.distance/=1-m.relative_y*zoom_speed;
+ }
} break;
diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h
index 1fdc97c49d..646a4d2d86 100644
--- a/tools/editor/plugins/spatial_editor_plugin.h
+++ b/tools/editor/plugins/spatial_editor_plugin.h
@@ -144,6 +144,12 @@ private:
};
NavigationScheme _get_navigation_schema(const String& p_property);
+ enum NavigationZoomStyle {
+ NAVIGATION_ZOOM_VERTICAL,
+ NAVIGATION_ZOOM_HORIZONTAL
+ };
+ NavigationZoomStyle _get_navigation_zoom_style(const String& p_property);
+
enum NavigationMode {
NAVIGATION_NONE,
NAVIGATION_PAN,
diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp
index a25997108b..21474205d7 100644
--- a/tools/editor/plugins/tile_map_editor_plugin.cpp
+++ b/tools/editor/plugins/tile_map_editor_plugin.cpp
@@ -42,7 +42,6 @@ void TileMapEditor::_notification(int p_what) {
case NOTIFICATION_READY: {
- pane_drag->connect("dragged", this,"_pane_drag");
mirror_x->set_icon( get_icon("MirrorX","EditorIcons"));
mirror_y->set_icon( get_icon("MirrorY","EditorIcons"));
@@ -701,23 +700,10 @@ void TileMapEditor::_tileset_settings_changed() {
canvas_item_editor->update();
}
-void TileMapEditor::_pane_drag(const Point2& p_to) {
-
- int x = theme_panel->get_margin(MARGIN_RIGHT);
-
- x+=p_to.x;
- if (x<10)
- x=10;
- if (x>300)
- x=300;
- theme_panel->set_margin(MARGIN_RIGHT,x);
-}
-
void TileMapEditor::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_menu_option"),&TileMapEditor::_menu_option);
ObjectTypeDB::bind_method(_MD("_canvas_draw"),&TileMapEditor::_canvas_draw);
- ObjectTypeDB::bind_method(_MD("_pane_drag"),&TileMapEditor::_pane_drag);
ObjectTypeDB::bind_method(_MD("_canvas_mouse_enter"),&TileMapEditor::_canvas_mouse_enter);
ObjectTypeDB::bind_method(_MD("_canvas_mouse_exit"),&TileMapEditor::_canvas_mouse_exit);
ObjectTypeDB::bind_method(_MD("_tileset_settings_changed"),&TileMapEditor::_tileset_settings_changed);
@@ -731,36 +717,30 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
editor=p_editor;
undo_redo = editor->get_undo_redo();
- theme_panel = memnew( Panel );
- theme_panel->set_anchor(MARGIN_BOTTOM,ANCHOR_END);
- theme_panel->set_begin( Point2(0,26));
- theme_panel->set_end( Point2(100,0) );
- p_editor->get_viewport()->add_child(theme_panel);
- theme_panel->hide();
+ int mw = EDITOR_DEF("tile_map/palette_min_width",80);
+ EmptyControl *ec = memnew( EmptyControl);
+ ec->set_minsize(Size2(mw,0));
+ add_child(ec);
+ // Add tile palette
palette = memnew( Tree );
- palette->set_area_as_parent_rect(4);
- palette->set_margin(MARGIN_TOP,25);;
- theme_panel->add_child(palette);
-
- pane_drag = memnew( PaneDrag ) ;
- pane_drag->set_anchor(MARGIN_LEFT,ANCHOR_END);
- pane_drag->set_begin(Point2(16,4));
- theme_panel->add_child(pane_drag);
-
- add_child( memnew( VSeparator ));
+ palette->set_v_size_flags(SIZE_EXPAND_FILL);
+ add_child(palette);
+ // Add menu items
+ HBoxContainer *canvas_item_editor_hb = memnew( HBoxContainer );
+ CanvasItemEditor::get_singleton()->add_control_to_menu_panel(canvas_item_editor_hb);
+ canvas_item_editor_hb->add_child( memnew( VSeparator ));
mirror_x = memnew( ToolButton );
mirror_x->set_toggle_mode(true);
mirror_x->set_tooltip("Mirror X (A)");
mirror_x->set_focus_mode(FOCUS_NONE);
- add_child(mirror_x);
+ canvas_item_editor_hb->add_child(mirror_x);
mirror_y = memnew( ToolButton );
mirror_y->set_toggle_mode(true);
mirror_y->set_tooltip("Mirror Y (S)");
mirror_y->set_focus_mode(FOCUS_NONE);
- add_child(mirror_y);
-
+ canvas_item_editor_hb->add_child(mirror_y);
tool=TOOL_NONE;
selection_active=false;
@@ -782,12 +762,10 @@ void TileMapEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
tile_map_editor->show();
- tile_map_editor->theme_panel->show();
} else {
tile_map_editor->hide();
- tile_map_editor->theme_panel->hide();
tile_map_editor->edit(NULL);
}
@@ -797,7 +775,8 @@ TileMapEditorPlugin::TileMapEditorPlugin(EditorNode *p_node) {
editor=p_node;
tile_map_editor = memnew( TileMapEditor(p_node) );
- CanvasItemEditor::get_singleton()->add_control_to_menu_panel(tile_map_editor);
+ CanvasItemEditor::get_singleton()->get_palette_split()->add_child(tile_map_editor);
+ CanvasItemEditor::get_singleton()->get_palette_split()->move_child(tile_map_editor,0);
tile_map_editor->hide();
diff --git a/tools/editor/plugins/tile_map_editor_plugin.h b/tools/editor/plugins/tile_map_editor_plugin.h
index 2336507f1b..0a09a29f9d 100644
--- a/tools/editor/plugins/tile_map_editor_plugin.h
+++ b/tools/editor/plugins/tile_map_editor_plugin.h
@@ -34,15 +34,14 @@
#include "scene/2d/tile_map.h"
#include "scene/gui/tool_button.h"
#include "scene/gui/button_group.h"
-#include "tools/editor/pane_drag.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
class CanvasItemEditor;
-class TileMapEditor : public HBoxContainer {
+class TileMapEditor : public VBoxContainer {
- OBJ_TYPE(TileMapEditor, BoxContainer );
+ OBJ_TYPE(TileMapEditor, VBoxContainer );
UndoRedo *undo_redo;
@@ -63,7 +62,6 @@ class TileMapEditor : public HBoxContainer {
Panel *panel;
TileMap *node;
MenuButton *options;
- PaneDrag *pane_drag;
bool selection_active;
Point2i selection_begin;
@@ -88,7 +86,6 @@ class TileMapEditor : public HBoxContainer {
int get_selected_tile() const;
void _update_palette();
- void _pane_drag(const Point2& p_to);
void _canvas_draw();
void _menu_option(int p_option);
@@ -99,8 +96,6 @@ class TileMapEditor : public HBoxContainer {
void _tileset_settings_changed();
-friend class TileMapEditorPlugin;
- Panel *theme_panel;
protected:
void _notification(int p_what);
void _node_removed(Node *p_node);