summaryrefslogtreecommitdiffstats
path: root/editor/plugins/spatial_editor_plugin.h
diff options
context:
space:
mode:
authorErik <35656626+SeleckyErik@users.noreply.github.com>2019-04-06 22:55:01 +0200
committerSeleckyErik <35656626+SeleckyErik@users.noreply.github.com>2019-10-23 02:51:32 +0100
commit8b0546d93b7487476e8ec290399d95fd172d9f50 (patch)
treeadbe77833e84bc2a90c095c26686ce40a907e221 /editor/plugins/spatial_editor_plugin.h
parent72dfa67dd3508f20592959d306e8f2ef159eea5f (diff)
downloadredot-engine-8b0546d93b7487476e8ec290399d95fd172d9f50.tar.gz
Implement game camera override
Implemented uniform API in Viewport class to override 2D and/or 3D camera. Added buttons in 2D and 3D editor viewport toolbars that override the running game camera transform with the editor viewport camera transform. Implemented via remote debugger protocol and camera override API. Removed LiveEditFuncs function pointers from ScriptDebugger class. Since the debugger got access to the SceneTree instance (if one exists), there is no need to store the function pointers. The live edit functions in SceneTree are used directly instead. Also removed the static version of live edit functions in SceneTree for the same reason. This reduced the SceneTree -> Debugger coupling too since the function pointers don't need to be set from SceneTree anymore. Moved script_debugger_remote.h/cpp from 'core/' to 'scene/debugger/'. This is because the remote debugger is now using SceneTree directly and 'core/' classes should not depend on 'scene/' classes.
Diffstat (limited to 'editor/plugins/spatial_editor_plugin.h')
-rw-r--r--editor/plugins/spatial_editor_plugin.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index fe91c33642..65e3c32ca8 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -494,6 +494,7 @@ public:
TOOL_OPT_LOCAL_COORDS,
TOOL_OPT_USE_SNAP,
+ TOOL_OPT_OVERRIDE_CAMERA,
TOOL_OPT_MAX
};
@@ -559,6 +560,7 @@ private:
MENU_TOOL_LIST_SELECT,
MENU_TOOL_LOCAL_COORDS,
MENU_TOOL_USE_SNAP,
+ MENU_TOOL_OVERRIDE_CAMERA,
MENU_TRANSFORM_CONFIGURE_SNAP,
MENU_TRANSFORM_DIALOG,
MENU_VIEW_USE_1_VIEWPORT,
@@ -585,9 +587,6 @@ private:
PopupMenu *gizmos_menu;
MenuButton *view_menu;
- ToolButton *lock_button;
- ToolButton *unlock_button;
-
AcceptDialog *accept;
ConfirmationDialog *snap_dialog;
@@ -615,13 +614,16 @@ private:
void _menu_item_pressed(int p_option);
void _menu_item_toggled(bool pressed, int p_option);
void _menu_gizmo_toggled(int p_option);
+ void _update_camera_override_button(bool p_game_running);
+ void _update_camera_override_viewport(Object *p_viewport);
HBoxContainer *hbc_menu;
void _generate_selection_box();
UndoRedo *undo_redo;
- void _instance_scene();
+ int camera_override_viewport_id;
+
void _init_indicators();
void _update_gizmos_menu();
void _update_gizmos_menu_theme();
@@ -716,7 +718,7 @@ public:
void set_can_preview(Camera *p_preview);
SpatialEditorViewport *get_editor_viewport(int p_idx) {
- ERR_FAIL_INDEX_V(p_idx, 4, NULL);
+ ERR_FAIL_INDEX_V(p_idx, static_cast<int>(VIEWPORTS_COUNT), NULL);
return viewports[p_idx];
}