| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | /*************************************************************************/ | 
					
						
							|  |  |  | /*  canvas_item_editor_plugin.h                                          */ | 
					
						
							|  |  |  | /*************************************************************************/ | 
					
						
							|  |  |  | /*                       This file is part of:                           */ | 
					
						
							|  |  |  | /*                           GODOT ENGINE                                */ | 
					
						
							| 
									
										
										
										
											2017-08-27 14:16:55 +02:00
										 |  |  | /*                      https://godotengine.org                          */ | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | /*************************************************************************/ | 
					
						
							| 
									
										
										
										
											2022-01-03 21:27:34 +01:00
										 |  |  | /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */ | 
					
						
							|  |  |  | /* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */ | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | /*                                                                       */ | 
					
						
							|  |  |  | /* 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.                */ | 
					
						
							|  |  |  | /*************************************************************************/ | 
					
						
							| 
									
										
										
										
											2018-01-05 00:50:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-08 23:53:41 +03:00
										 |  |  | #ifndef CANVAS_ITEM_EDITOR_PLUGIN_H
 | 
					
						
							|  |  |  | #define CANVAS_ITEM_EDITOR_PLUGIN_H
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | #include "editor/editor_plugin.h"
 | 
					
						
							| 
									
										
										
										
											2021-05-07 15:41:39 +02:00
										 |  |  | #include "editor/editor_zoom_widget.h"
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | #include "scene/gui/box_container.h"
 | 
					
						
							| 
									
										
										
										
											2016-10-26 04:27:24 +09:00
										 |  |  | #include "scene/gui/check_box.h"
 | 
					
						
							|  |  |  | #include "scene/gui/label.h"
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | #include "scene/gui/panel_container.h"
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | #include "scene/gui/spin_box.h"
 | 
					
						
							| 
									
										
										
										
											2022-02-12 02:46:22 +01:00
										 |  |  | #include "scene/gui/split_container.h"
 | 
					
						
							| 
									
										
										
										
											2021-11-08 23:53:41 +03:00
										 |  |  | #include "scene/gui/texture_rect.h"
 | 
					
						
							| 
									
										
										
										
											2020-03-27 08:44:44 +01:00
										 |  |  | #include "scene/main/canvas_item.h"
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-12 02:46:22 +01:00
										 |  |  | class EditorData; | 
					
						
							| 
									
										
										
										
											2016-10-26 04:27:24 +09:00
										 |  |  | class CanvasItemEditorViewport; | 
					
						
							| 
									
										
										
										
											2022-01-19 19:59:12 +01:00
										 |  |  | class ViewPanner; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | class CanvasItemEditorSelectedItem : public Object { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	GDCLASS(CanvasItemEditorSelectedItem, Object); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2017-01-11 00:52:51 -03:00
										 |  |  | 	Transform2D prev_xform; | 
					
						
							| 
									
										
										
										
											2021-06-20 23:30:19 -04:00
										 |  |  | 	real_t prev_rot = 0; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	Rect2 prev_rect; | 
					
						
							| 
									
										
										
										
											2017-07-06 17:42:44 -03:00
										 |  |  | 	Vector2 prev_pivot; | 
					
						
							| 
									
										
										
										
											2021-06-20 23:30:19 -04:00
										 |  |  | 	real_t prev_anchors[4] = { (real_t)0.0 }; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-12 19:11:53 +02:00
										 |  |  | 	Transform2D pre_drag_xform; | 
					
						
							| 
									
										
										
										
											2017-10-03 22:44:34 +02:00
										 |  |  | 	Rect2 pre_drag_rect; | 
					
						
							| 
									
										
										
										
											2017-09-12 19:11:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-09 17:15:17 -05:00
										 |  |  | 	List<real_t> pre_drag_bones_length; | 
					
						
							| 
									
										
										
										
											2017-11-07 08:58:35 +01:00
										 |  |  | 	List<Dictionary> pre_drag_bones_undo_state; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	Dictionary undo_state; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-12 17:01:17 +02:00
										 |  |  | 	CanvasItemEditorSelectedItem() {} | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class CanvasItemEditor : public VBoxContainer { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	GDCLASS(CanvasItemEditor, VBoxContainer); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 14:26:04 +02:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	enum Tool { | 
					
						
							|  |  |  | 		TOOL_SELECT, | 
					
						
							| 
									
										
										
										
											2015-12-13 17:16:13 -03:00
										 |  |  | 		TOOL_LIST_SELECT, | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		TOOL_MOVE, | 
					
						
							| 
									
										
										
										
											2018-09-10 14:39:46 +02:00
										 |  |  | 		TOOL_SCALE, | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		TOOL_ROTATE, | 
					
						
							| 
									
										
										
										
											2015-12-28 09:38:15 -03:00
										 |  |  | 		TOOL_EDIT_PIVOT, | 
					
						
							| 
									
										
										
										
											2014-05-02 19:39:12 +08:00
										 |  |  | 		TOOL_PAN, | 
					
						
							| 
									
										
										
										
											2019-08-30 22:49:47 +02:00
										 |  |  | 		TOOL_RULER, | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		TOOL_MAX | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-25 01:32:58 +02:00
										 |  |  | 	enum AddNodeOption { | 
					
						
							|  |  |  | 		ADD_NODE, | 
					
						
							|  |  |  | 		ADD_INSTANCE, | 
					
						
							| 
									
										
										
										
											2022-01-18 16:35:12 +01:00
										 |  |  | 		ADD_PASTE, | 
					
						
							|  |  |  | 		ADD_MOVE, | 
					
						
							| 
									
										
										
										
											2020-08-25 01:32:58 +02:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 14:26:04 +02:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2019-04-05 10:18:21 +02:00
										 |  |  | 	enum SnapTarget { | 
					
						
							|  |  |  | 		SNAP_TARGET_NONE = 0, | 
					
						
							|  |  |  | 		SNAP_TARGET_PARENT, | 
					
						
							|  |  |  | 		SNAP_TARGET_SELF_ANCHORS, | 
					
						
							|  |  |  | 		SNAP_TARGET_SELF, | 
					
						
							|  |  |  | 		SNAP_TARGET_OTHER_NODE, | 
					
						
							|  |  |  | 		SNAP_TARGET_GUIDE, | 
					
						
							|  |  |  | 		SNAP_TARGET_GRID, | 
					
						
							|  |  |  | 		SNAP_TARGET_PIXEL | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	enum MenuOption { | 
					
						
							|  |  |  | 		SNAP_USE, | 
					
						
							| 
									
										
										
										
											2017-09-17 22:52:41 +02:00
										 |  |  | 		SNAP_USE_NODE_PARENT, | 
					
						
							|  |  |  | 		SNAP_USE_NODE_ANCHORS, | 
					
						
							|  |  |  | 		SNAP_USE_NODE_SIDES, | 
					
						
							| 
									
										
										
										
											2017-11-07 08:58:35 +01:00
										 |  |  | 		SNAP_USE_NODE_CENTER, | 
					
						
							| 
									
										
										
										
											2017-09-17 22:52:41 +02:00
										 |  |  | 		SNAP_USE_OTHER_NODES, | 
					
						
							|  |  |  | 		SNAP_USE_GRID, | 
					
						
							| 
									
										
										
										
											2017-10-18 23:55:02 +02:00
										 |  |  | 		SNAP_USE_GUIDES, | 
					
						
							| 
									
										
										
										
											2015-02-15 18:00:55 +10:00
										 |  |  | 		SNAP_USE_ROTATION, | 
					
						
							| 
									
										
										
										
											2019-10-30 15:18:57 +01:00
										 |  |  | 		SNAP_USE_SCALE, | 
					
						
							| 
									
										
										
										
											2015-02-20 22:21:59 +10:00
										 |  |  | 		SNAP_RELATIVE, | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		SNAP_CONFIGURE, | 
					
						
							|  |  |  | 		SNAP_USE_PIXEL, | 
					
						
							| 
									
										
										
										
											2017-08-19 18:29:37 +02:00
										 |  |  | 		SHOW_HELPERS, | 
					
						
							| 
									
										
										
										
											2017-08-29 21:50:18 +02:00
										 |  |  | 		SHOW_RULERS, | 
					
						
							| 
									
										
										
										
											2017-10-18 23:55:02 +02:00
										 |  |  | 		SHOW_GUIDES, | 
					
						
							| 
									
										
										
										
											2018-03-02 03:52:13 -05:00
										 |  |  | 		SHOW_ORIGIN, | 
					
						
							|  |  |  | 		SHOW_VIEWPORT, | 
					
						
							| 
									
										
										
										
											2018-09-20 02:41:19 +02:00
										 |  |  | 		SHOW_EDIT_LOCKS, | 
					
						
							| 
									
										
										
										
											2019-11-10 10:07:13 +01:00
										 |  |  | 		SHOW_TRANSFORMATION_GIZMOS, | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		LOCK_SELECTED, | 
					
						
							|  |  |  | 		UNLOCK_SELECTED, | 
					
						
							|  |  |  | 		GROUP_SELECTED, | 
					
						
							|  |  |  | 		UNGROUP_SELECTED, | 
					
						
							|  |  |  | 		ANIM_INSERT_KEY, | 
					
						
							|  |  |  | 		ANIM_INSERT_KEY_EXISTING, | 
					
						
							|  |  |  | 		ANIM_INSERT_POS, | 
					
						
							|  |  |  | 		ANIM_INSERT_ROT, | 
					
						
							|  |  |  | 		ANIM_INSERT_SCALE, | 
					
						
							|  |  |  | 		ANIM_COPY_POSE, | 
					
						
							|  |  |  | 		ANIM_PASTE_POSE, | 
					
						
							| 
									
										
										
										
											2014-05-04 01:36:59 +08:00
										 |  |  | 		ANIM_CLEAR_POSE, | 
					
						
							| 
									
										
										
										
											2019-08-24 22:58:16 +02:00
										 |  |  | 		CLEAR_GUIDES, | 
					
						
							| 
									
										
										
										
											2014-05-04 01:36:59 +08:00
										 |  |  | 		VIEW_CENTER_TO_SELECTION, | 
					
						
							|  |  |  | 		VIEW_FRAME_TO_SELECTION, | 
					
						
							| 
									
										
										
										
											2019-04-05 10:24:54 -03:00
										 |  |  | 		PREVIEW_CANVAS_SCALE, | 
					
						
							| 
									
										
										
										
											2014-07-06 11:49:27 -03:00
										 |  |  | 		SKELETON_MAKE_BONES, | 
					
						
							| 
									
										
											  
											
												New and improved IK system for Skeleton2D
This PR and commit adds a new IK system for 2D with the Skeleton2D node
that adds several new IK solvers, a way to control bones in a Skeleton2D
node similar to that in Skeleton3D. It also adds additional changes
and functionality.
This work was sponsored by GSoC 2020 and TwistedTwigleg.
Full list of changes:
* Adds a SkeletonModifier2D resource
  * This resource is the base where all IK code is written and executed
  * Has a function for clamping angles, since it is so commonly used
  * Modifiers are unique when duplicated so it works with instancing
* Adds a SkeletonModifierStack2D resource
  * This resource manages a series of SkeletonModification2Ds
  * This is what the Skeleton2D directly interfaces with to make IK possible
* Adds SkeletonModifier2D resources for LookAt, CCDIK, FABRIK, Jiggle, and TwoBoneIK
  * Each modification is in its own file
  * There is also a SkeletonModifier2D resource that acts as a stack for using multiple stacks together
* Adds a PhysicalBone2D node
  * Works similar to the PhysicalBone3D node, but uses a RigidBody2D node
* Changes to Skeleton2D listed below:
  * Skeleton2D now holds a single SkeletonModificationStack2D for IK
  * Skeleton2D now has a local_pose_override, which overrides the Bone2D position similar to how the overrides work in Skeleton3D
* Changes to Bone2D listed below:
  * The default_length property has been changed to length. Length is the length of the bone to its child bone node
  * New bone_angle property, which is the angle the bone has to its first child bone node
  * Bone2D caches its transform when not modified by IK for IK interpolation purposes
  * Bone2D draws its own editor gizmo, though this is stated to change in the future
* Changes to CanvasItemEditor listed below:
  * Bone2D gizmo drawing code removed
  * The 2D IK code is removed. Now Bone2D is the only bone system for 2D
* Transform2D now has a looking_at function for rotating to face a position
* Two new node notifications: NOTIFICATION_EDITOR_PRE_SAVE and NOTIFICATION_EDITOR_POST_SAVE
  * These notifications only are called in the editor right before and after saving a scene
  * Needed for not saving the IK position when executing IK in the editor
* Documentation for all the changes listed above.
											
										 
											2020-08-03 14:02:24 -04:00
										 |  |  | 		SKELETON_SHOW_BONES | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	enum DragType { | 
					
						
							|  |  |  | 		DRAG_NONE, | 
					
						
							| 
									
										
										
										
											2017-11-07 08:58:35 +01:00
										 |  |  | 		DRAG_BOX_SELECTION, | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		DRAG_LEFT, | 
					
						
							|  |  |  | 		DRAG_TOP_LEFT, | 
					
						
							|  |  |  | 		DRAG_TOP, | 
					
						
							|  |  |  | 		DRAG_TOP_RIGHT, | 
					
						
							|  |  |  | 		DRAG_RIGHT, | 
					
						
							|  |  |  | 		DRAG_BOTTOM_RIGHT, | 
					
						
							|  |  |  | 		DRAG_BOTTOM, | 
					
						
							|  |  |  | 		DRAG_BOTTOM_LEFT, | 
					
						
							| 
									
										
										
										
											2017-07-29 16:57:32 +02:00
										 |  |  | 		DRAG_ANCHOR_TOP_LEFT, | 
					
						
							|  |  |  | 		DRAG_ANCHOR_TOP_RIGHT, | 
					
						
							|  |  |  | 		DRAG_ANCHOR_BOTTOM_RIGHT, | 
					
						
							|  |  |  | 		DRAG_ANCHOR_BOTTOM_LEFT, | 
					
						
							| 
									
										
										
										
											2017-08-04 19:27:30 +02:00
										 |  |  | 		DRAG_ANCHOR_ALL, | 
					
						
							| 
									
										
										
										
											2021-06-04 11:39:46 -04:00
										 |  |  | 		DRAG_QUEUED, | 
					
						
							| 
									
										
										
										
											2018-09-09 22:17:47 +02:00
										 |  |  | 		DRAG_MOVE, | 
					
						
							| 
									
										
										
										
											2019-11-08 15:48:26 +01:00
										 |  |  | 		DRAG_MOVE_X, | 
					
						
							|  |  |  | 		DRAG_MOVE_Y, | 
					
						
							| 
									
										
										
										
											2018-09-10 14:39:46 +02:00
										 |  |  | 		DRAG_SCALE_X, | 
					
						
							|  |  |  | 		DRAG_SCALE_Y, | 
					
						
							| 
									
										
										
										
											2018-09-20 15:22:35 +02:00
										 |  |  | 		DRAG_SCALE_BOTH, | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		DRAG_ROTATE, | 
					
						
							|  |  |  | 		DRAG_PIVOT, | 
					
						
							| 
									
										
										
										
											2017-10-18 23:55:02 +02:00
										 |  |  | 		DRAG_V_GUIDE, | 
					
						
							|  |  |  | 		DRAG_H_GUIDE, | 
					
						
							|  |  |  | 		DRAG_DOUBLE_GUIDE, | 
					
						
							| 
									
										
										
										
											2019-04-07 16:43:21 +02:00
										 |  |  | 		DRAG_KEY_MOVE | 
					
						
							| 
									
										
										
										
											2014-05-09 15:11:24 +08:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-09 17:53:39 +08:00
										 |  |  | 	enum GridVisibility { | 
					
						
							|  |  |  | 		GRID_VISIBILITY_SHOW, | 
					
						
							|  |  |  | 		GRID_VISIBILITY_SHOW_WHEN_SNAPPING, | 
					
						
							|  |  |  | 		GRID_VISIBILITY_HIDE, | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-02 16:28:25 +02:00
										 |  |  | 	bool selection_menu_additive_selection = false; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-08 23:53:41 +03:00
										 |  |  | 	Tool tool = TOOL_SELECT; | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	Control *viewport = nullptr; | 
					
						
							|  |  |  | 	Control *viewport_scrollable = nullptr; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	HScrollBar *h_scroll = nullptr; | 
					
						
							|  |  |  | 	VScrollBar *v_scroll = nullptr; | 
					
						
							|  |  |  | 	HBoxContainer *hb = nullptr; | 
					
						
							| 
									
										
										
										
											2020-02-03 20:07:21 +01:00
										 |  |  | 	// Used for secondary menu items which are displayed depending on the currently selected node
 | 
					
						
							|  |  |  | 	// (such as MeshInstance's "Mesh" menu).
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	PanelContainer *context_menu_container = nullptr; | 
					
						
							|  |  |  | 	HBoxContainer *hbc_context_menu = nullptr; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-11 00:52:51 -03:00
										 |  |  | 	Transform2D transform; | 
					
						
							| 
									
										
										
										
											2022-02-09 17:53:39 +08:00
										 |  |  | 	GridVisibility grid_visibility = GRID_VISIBILITY_SHOW_WHEN_SNAPPING; | 
					
						
							| 
									
										
										
										
											2021-11-08 23:53:41 +03:00
										 |  |  | 	bool show_rulers = true; | 
					
						
							|  |  |  | 	bool show_guides = true; | 
					
						
							|  |  |  | 	bool show_origin = true; | 
					
						
							|  |  |  | 	bool show_viewport = true; | 
					
						
							|  |  |  | 	bool show_helpers = false; | 
					
						
							|  |  |  | 	bool show_edit_locks = true; | 
					
						
							|  |  |  | 	bool show_transformation_gizmos = true; | 
					
						
							| 
									
										
										
										
											2019-11-10 10:07:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-02 16:28:25 +02:00
										 |  |  | 	real_t zoom = 1.0; | 
					
						
							| 
									
										
										
										
											2018-03-15 15:12:16 +01:00
										 |  |  | 	Point2 view_offset; | 
					
						
							|  |  |  | 	Point2 previous_update_view_offset; | 
					
						
							| 
									
										
										
										
											2017-08-29 21:50:18 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-08 23:53:41 +03:00
										 |  |  | 	bool selected_from_canvas = false; | 
					
						
							| 
									
										
										
										
											2019-03-31 18:53:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-29 21:50:18 +02:00
										 |  |  | 	Point2 grid_offset; | 
					
						
							| 
									
										
										
										
											2022-05-02 16:28:25 +02:00
										 |  |  | 	Point2 grid_step = Point2(8, 8); // A power-of-two value works better as a default.
 | 
					
						
							|  |  |  | 	int primary_grid_steps = 8; | 
					
						
							|  |  |  | 	int grid_step_multiplier = 0; | 
					
						
							| 
									
										
										
										
											2017-08-29 21:50:18 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-02 16:28:25 +02:00
										 |  |  | 	real_t snap_rotation_step = 0.0; | 
					
						
							|  |  |  | 	real_t snap_rotation_offset = Math::deg2rad(15.0); | 
					
						
							|  |  |  | 	real_t snap_scale_step = 0.1f; | 
					
						
							| 
									
										
										
										
											2021-11-08 23:53:41 +03:00
										 |  |  | 	bool smart_snap_active = false; | 
					
						
							|  |  |  | 	bool grid_snap_active = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	bool snap_node_parent = true; | 
					
						
							|  |  |  | 	bool snap_node_anchors = true; | 
					
						
							|  |  |  | 	bool snap_node_sides = true; | 
					
						
							|  |  |  | 	bool snap_node_center = true; | 
					
						
							|  |  |  | 	bool snap_other_nodes = true; | 
					
						
							|  |  |  | 	bool snap_guides = true; | 
					
						
							|  |  |  | 	bool snap_rotation = false; | 
					
						
							|  |  |  | 	bool snap_scale = false; | 
					
						
							|  |  |  | 	bool snap_relative = false; | 
					
						
							|  |  |  | 	// Enable pixel snapping even if pixel snap rendering is disabled in the Project Settings.
 | 
					
						
							|  |  |  | 	// This results in crisper visuals by preventing 2D nodes from being placed at subpixel coordinates.
 | 
					
						
							|  |  |  | 	bool snap_pixel = true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	bool key_pos = true; | 
					
						
							|  |  |  | 	bool key_rot = true; | 
					
						
							|  |  |  | 	bool key_scale = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	bool pan_pressed = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	bool ruler_tool_active = false; | 
					
						
							| 
									
										
										
										
											2022-05-02 16:28:25 +02:00
										 |  |  | 	Point2 ruler_tool_origin; | 
					
						
							| 
									
										
										
										
											2020-08-25 01:32:58 +02:00
										 |  |  | 	Point2 node_create_position; | 
					
						
							| 
									
										
										
										
											2019-08-30 22:49:47 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	MenuOption last_option; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-04 22:39:07 +01:00
										 |  |  | 	struct _SelectResult { | 
					
						
							| 
									
										
										
										
											2020-11-24 10:12:55 +01:00
										 |  |  | 		CanvasItem *item = nullptr; | 
					
						
							| 
									
										
										
										
											2021-06-20 23:30:19 -04:00
										 |  |  | 		real_t z_index = 0; | 
					
						
							| 
									
										
										
										
											2020-11-24 10:12:55 +01:00
										 |  |  | 		bool has_z = true; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 		_FORCE_INLINE_ bool operator<(const _SelectResult &p_rr) const { | 
					
						
							| 
									
										
										
										
											2017-12-29 23:06:03 +01:00
										 |  |  | 			return has_z && p_rr.has_z ? p_rr.z_index < z_index : p_rr.has_z; | 
					
						
							| 
									
										
										
										
											2015-11-04 22:39:07 +01:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 	Vector<_SelectResult> selection_results; | 
					
						
							| 
									
										
										
										
											2018-06-12 11:01:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	struct _HoverResult { | 
					
						
							|  |  |  | 		Point2 position; | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 		Ref<Texture2D> icon; | 
					
						
							| 
									
										
										
										
											2018-06-12 11:01:24 +02:00
										 |  |  | 		String name; | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 	Vector<_HoverResult> hovering_results; | 
					
						
							| 
									
										
										
										
											2015-11-04 22:39:07 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-06 11:49:27 -03:00
										 |  |  | 	struct BoneList { | 
					
						
							| 
									
										
										
										
											2017-01-11 00:52:51 -03:00
										 |  |  | 		Transform2D xform; | 
					
						
							| 
									
										
										
										
											2021-06-20 23:30:19 -04:00
										 |  |  | 		real_t length = 0; | 
					
						
							| 
									
										
										
										
											2020-05-12 17:01:17 +02:00
										 |  |  | 		uint64_t last_pass = 0; | 
					
						
							| 
									
										
										
										
											2014-07-06 11:49:27 -03:00
										 |  |  | 	}; | 
					
						
							| 
									
										
										
										
											2018-05-04 16:46:32 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-08 23:53:41 +03:00
										 |  |  | 	uint64_t bone_last_frame = 0; | 
					
						
							| 
									
										
										
										
											2018-05-04 16:46:32 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	struct BoneKey { | 
					
						
							|  |  |  | 		ObjectID from; | 
					
						
							|  |  |  | 		ObjectID to; | 
					
						
							|  |  |  | 		_FORCE_INLINE_ bool operator<(const BoneKey &p_key) const { | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 			if (from == p_key.from) { | 
					
						
							| 
									
										
										
										
											2018-05-04 16:46:32 -03:00
										 |  |  | 				return to < p_key.to; | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2018-05-04 16:46:32 -03:00
										 |  |  | 				return from < p_key.from; | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2018-05-04 16:46:32 -03:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-13 15:04:37 +02:00
										 |  |  | 	HashMap<BoneKey, BoneList> bone_list; | 
					
						
							| 
									
										
										
										
											2015-04-20 19:38:02 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	struct PoseClipboard { | 
					
						
							|  |  |  | 		Vector2 pos; | 
					
						
							|  |  |  | 		Vector2 scale; | 
					
						
							| 
									
										
										
										
											2021-06-20 23:30:19 -04:00
										 |  |  | 		real_t rot = 0; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		ObjectID id; | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 	List<PoseClipboard> pose_clipboard; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	Button *select_button = nullptr; | 
					
						
							| 
									
										
										
										
											2018-09-10 14:39:46 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	Button *move_button = nullptr; | 
					
						
							|  |  |  | 	Button *scale_button = nullptr; | 
					
						
							|  |  |  | 	Button *rotate_button = nullptr; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	Button *list_select_button = nullptr; | 
					
						
							|  |  |  | 	Button *pivot_button = nullptr; | 
					
						
							|  |  |  | 	Button *pan_button = nullptr; | 
					
						
							| 
									
										
										
										
											2018-09-10 14:39:46 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	Button *ruler_button = nullptr; | 
					
						
							| 
									
										
										
										
											2019-08-30 22:49:47 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	Button *smart_snap_button = nullptr; | 
					
						
							|  |  |  | 	Button *grid_snap_button = nullptr; | 
					
						
							|  |  |  | 	MenuButton *snap_config_menu = nullptr; | 
					
						
							|  |  |  | 	PopupMenu *smartsnap_config_popup = nullptr; | 
					
						
							| 
									
										
										
										
											2017-09-17 22:52:41 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	Button *lock_button = nullptr; | 
					
						
							|  |  |  | 	Button *unlock_button = nullptr; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	Button *group_button = nullptr; | 
					
						
							|  |  |  | 	Button *ungroup_button = nullptr; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	MenuButton *skeleton_menu = nullptr; | 
					
						
							|  |  |  | 	Button *override_camera_button = nullptr; | 
					
						
							|  |  |  | 	MenuButton *view_menu = nullptr; | 
					
						
							|  |  |  | 	PopupMenu *grid_menu = nullptr; | 
					
						
							|  |  |  | 	HBoxContainer *animation_hb = nullptr; | 
					
						
							|  |  |  | 	MenuButton *animation_menu = nullptr; | 
					
						
							| 
									
										
										
										
											2017-10-04 00:47:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	Button *key_loc_button = nullptr; | 
					
						
							|  |  |  | 	Button *key_rot_button = nullptr; | 
					
						
							|  |  |  | 	Button *key_scale_button = nullptr; | 
					
						
							|  |  |  | 	Button *key_insert_button = nullptr; | 
					
						
							|  |  |  | 	Button *key_auto_insert_button = nullptr; | 
					
						
							| 
									
										
										
										
											2014-07-06 11:49:27 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	PopupMenu *selection_menu = nullptr; | 
					
						
							|  |  |  | 	PopupMenu *add_node_menu = nullptr; | 
					
						
							| 
									
										
										
										
											2015-11-04 22:39:07 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	Control *top_ruler = nullptr; | 
					
						
							|  |  |  | 	Control *left_ruler = nullptr; | 
					
						
							| 
									
										
										
										
											2017-08-29 21:50:18 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-04 11:39:46 -04:00
										 |  |  | 	Point2 drag_start_origin; | 
					
						
							| 
									
										
										
										
											2021-11-08 23:53:41 +03:00
										 |  |  | 	DragType drag_type = DRAG_NONE; | 
					
						
							|  |  |  | 	Point2 drag_from = Vector2(); | 
					
						
							|  |  |  | 	Point2 drag_to = Vector2(); | 
					
						
							| 
									
										
										
										
											2017-11-07 08:58:35 +01:00
										 |  |  | 	Point2 drag_rotation_center; | 
					
						
							|  |  |  | 	List<CanvasItem *> drag_selection; | 
					
						
							| 
									
										
										
										
											2021-11-08 23:53:41 +03:00
										 |  |  | 	int dragged_guide_index = -1; | 
					
						
							|  |  |  | 	Point2 dragged_guide_pos = Point2(); | 
					
						
							|  |  |  | 	bool is_hovering_h_guide = false; | 
					
						
							|  |  |  | 	bool is_hovering_v_guide = false; | 
					
						
							| 
									
										
										
										
											2017-11-07 08:58:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-02 16:28:25 +02:00
										 |  |  | 	bool updating_value_dialog = false; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-07 08:58:35 +01:00
										 |  |  | 	Point2 box_selecting_to; | 
					
						
							| 
									
										
										
										
											2017-10-18 23:55:02 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	Ref<StyleBoxTexture> select_sb; | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	Ref<Texture2D> select_handle; | 
					
						
							|  |  |  | 	Ref<Texture2D> anchor_handle; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-09 21:53:24 +02:00
										 |  |  | 	Ref<Shortcut> drag_pivot_shortcut; | 
					
						
							|  |  |  | 	Ref<Shortcut> set_pivot_shortcut; | 
					
						
							|  |  |  | 	Ref<Shortcut> multiply_grid_step_shortcut; | 
					
						
							|  |  |  | 	Ref<Shortcut> divide_grid_step_shortcut; | 
					
						
							| 
									
										
										
										
											2022-01-19 19:59:12 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	Ref<ViewPanner> panner; | 
					
						
							|  |  |  | 	bool warped_panning = true; | 
					
						
							|  |  |  | 	int pan_speed = 20; | 
					
						
							| 
									
										
										
										
											2022-01-23 13:49:53 +01:00
										 |  |  | 	void _scroll_callback(Vector2 p_scroll_vec, bool p_alt); | 
					
						
							| 
									
										
										
										
											2022-01-19 19:59:12 +01:00
										 |  |  | 	void _pan_callback(Vector2 p_scroll_vec); | 
					
						
							|  |  |  | 	void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt); | 
					
						
							| 
									
										
										
										
											2017-08-20 00:01:12 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-16 20:35:51 +02:00
										 |  |  | 	bool _is_node_locked(const Node *p_node); | 
					
						
							| 
									
										
										
										
											2018-10-25 19:08:32 +02:00
										 |  |  | 	bool _is_node_movable(const Node *p_node, bool p_popup_warning = false); | 
					
						
							| 
									
										
										
										
											2018-10-16 20:35:51 +02:00
										 |  |  | 	void _find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, Vector<_SelectResult> &r_items, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D()); | 
					
						
							| 
									
										
										
										
											2020-02-11 00:01:10 +01:00
										 |  |  | 	void _get_canvas_items_at_pos(const Point2 &p_pos, Vector<_SelectResult> &r_items, bool p_allow_locked = false); | 
					
						
							| 
									
										
										
										
											2018-04-24 21:55:28 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-08 21:35:41 +01:00
										 |  |  | 	void _find_canvas_items_in_rect(const Rect2 &p_rect, Node *p_node, List<CanvasItem *> *r_items, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D()); | 
					
						
							| 
									
										
										
										
											2017-11-07 08:58:35 +01:00
										 |  |  | 	bool _select_click_on_item(CanvasItem *item, Point2 p_click_pos, bool p_append); | 
					
						
							| 
									
										
										
										
											2015-11-04 22:39:07 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	ConfirmationDialog *snap_dialog = nullptr; | 
					
						
							| 
									
										
										
										
											2016-03-09 00:00:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	CanvasItem *ref_item = nullptr; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-07 08:58:35 +01:00
										 |  |  | 	void _save_canvas_item_state(List<CanvasItem *> p_canvas_items, bool save_bones = false); | 
					
						
							|  |  |  | 	void _restore_canvas_item_state(List<CanvasItem *> p_canvas_items, bool restore_bones = false); | 
					
						
							|  |  |  | 	void _commit_canvas_item_state(List<CanvasItem *> p_canvas_items, String action_name, bool commit_bones = false); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-07 23:30:54 +02:00
										 |  |  | 	Vector2 _anchor_to_position(const Control *p_control, Vector2 anchor); | 
					
						
							|  |  |  | 	Vector2 _position_to_anchor(const Control *p_control, Vector2 position); | 
					
						
							| 
									
										
										
										
											2017-07-11 00:14:22 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	void _popup_callback(int p_op); | 
					
						
							| 
									
										
										
										
											2021-11-08 23:53:41 +03:00
										 |  |  | 	bool updating_scroll = false; | 
					
						
							| 
									
										
										
										
											2021-06-20 23:30:19 -04:00
										 |  |  | 	void _update_scroll(real_t); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	void _update_scrollbars(); | 
					
						
							| 
									
										
										
										
											2015-02-15 18:00:55 +10:00
										 |  |  | 	void _snap_changed(); | 
					
						
							| 
									
										
										
										
											2015-11-04 22:39:07 +01:00
										 |  |  | 	void _selection_result_pressed(int); | 
					
						
							|  |  |  | 	void _selection_menu_hide(); | 
					
						
							| 
									
										
										
										
											2020-08-25 01:32:58 +02:00
										 |  |  | 	void _add_node_pressed(int p_result); | 
					
						
							|  |  |  | 	void _node_created(Node *p_node); | 
					
						
							|  |  |  | 	void _reset_create_position(); | 
					
						
							| 
									
										
										
										
											2022-02-15 21:44:22 -05:00
										 |  |  | 	void _update_editor_settings(); | 
					
						
							| 
									
										
										
										
											2022-02-09 17:53:39 +08:00
										 |  |  | 	bool _is_grid_visible() const; | 
					
						
							|  |  |  | 	void _prepare_grid_menu(); | 
					
						
							|  |  |  | 	void _on_grid_menu_id_pressed(int p_id); | 
					
						
							| 
									
										
										
										
											2015-11-04 22:39:07 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	UndoRedo *undo_redo = nullptr; | 
					
						
							| 
									
										
										
										
											2017-08-28 21:51:56 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-08 23:53:41 +03:00
										 |  |  | 	List<CanvasItem *> _get_edited_canvas_items(bool retrieve_locked = false, bool remove_canvas_item_if_parent_in_selection = true); | 
					
						
							| 
									
										
										
										
											2017-11-07 08:58:35 +01:00
										 |  |  | 	Rect2 _get_encompassing_rect_from_list(List<CanvasItem *> p_list); | 
					
						
							| 
									
										
										
										
											2019-06-26 15:08:25 +02:00
										 |  |  | 	void _expand_encompassing_rect_using_children(Rect2 &r_rect, const Node *p_node, bool &r_first, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D(), bool include_locked_nodes = true); | 
					
						
							| 
									
										
										
										
											2018-03-08 21:35:41 +01:00
										 |  |  | 	Rect2 _get_encompassing_rect(const Node *p_node); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	Object *_get_editor_data(Object *p_what); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-15 00:49:03 -03:00
										 |  |  | 	void _insert_animation_keys(bool p_location, bool p_rotation, bool p_scale, bool p_on_existing); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-09 08:35:57 -03:00
										 |  |  | 	void _keying_changed(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-11 15:59:52 +02:00
										 |  |  | 	virtual void shortcut_input(const Ref<InputEvent> &p_ev) override; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-22 16:24:29 +00:00
										 |  |  | 	void _draw_text_at_position(Point2 p_position, String p_string, Side p_side); | 
					
						
							|  |  |  | 	void _draw_margin_at_position(int p_value, Point2 p_position, Side p_side); | 
					
						
							| 
									
										
										
										
											2021-06-20 23:30:19 -04:00
										 |  |  | 	void _draw_percentage_at_position(real_t p_value, Point2 p_position, Side p_side); | 
					
						
							| 
									
										
										
										
											2017-11-07 08:58:35 +01:00
										 |  |  | 	void _draw_straight_line(Point2 p_from, Point2 p_to, Color p_color); | 
					
						
							| 
									
										
										
										
											2017-08-02 18:33:06 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-05 10:18:21 +02:00
										 |  |  | 	void _draw_smart_snapping(); | 
					
						
							| 
									
										
										
										
											2017-08-29 21:50:18 +02:00
										 |  |  | 	void _draw_rulers(); | 
					
						
							| 
									
										
										
										
											2017-10-18 23:55:02 +02:00
										 |  |  | 	void _draw_guides(); | 
					
						
							| 
									
										
										
										
											2017-08-28 21:51:56 +02:00
										 |  |  | 	void _draw_focus(); | 
					
						
							|  |  |  | 	void _draw_grid(); | 
					
						
							| 
									
										
										
										
											2019-08-30 22:49:47 +02:00
										 |  |  | 	void _draw_ruler_tool(); | 
					
						
							| 
									
										
										
										
											2019-03-31 18:53:24 +02:00
										 |  |  | 	void _draw_control_anchors(Control *control); | 
					
						
							| 
									
										
										
										
											2018-09-10 14:39:46 +02:00
										 |  |  | 	void _draw_control_helpers(Control *control); | 
					
						
							| 
									
										
										
										
											2017-08-28 21:51:56 +02:00
										 |  |  | 	void _draw_selection(); | 
					
						
							|  |  |  | 	void _draw_axis(); | 
					
						
							| 
									
										
										
										
											2018-03-10 11:56:27 +01:00
										 |  |  | 	void _draw_invisible_nodes_positions(Node *p_node, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D()); | 
					
						
							| 
									
										
										
										
											2018-03-08 21:12:49 +01:00
										 |  |  | 	void _draw_locks_and_groups(Node *p_node, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D()); | 
					
						
							| 
									
										
										
										
											2018-03-12 23:32:25 +01:00
										 |  |  | 	void _draw_hover(); | 
					
						
							| 
									
										
										
										
											2017-08-28 21:51:56 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void _draw_viewport(); | 
					
						
							| 
									
										
										
										
											2017-11-07 08:58:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	bool _gui_input_anchors(const Ref<InputEvent> &p_event); | 
					
						
							|  |  |  | 	bool _gui_input_move(const Ref<InputEvent> &p_event); | 
					
						
							|  |  |  | 	bool _gui_input_open_scene_on_double_click(const Ref<InputEvent> &p_event); | 
					
						
							| 
									
										
										
										
											2018-09-10 14:39:46 +02:00
										 |  |  | 	bool _gui_input_scale(const Ref<InputEvent> &p_event); | 
					
						
							| 
									
										
										
										
											2017-11-07 08:58:35 +01:00
										 |  |  | 	bool _gui_input_pivot(const Ref<InputEvent> &p_event); | 
					
						
							|  |  |  | 	bool _gui_input_resize(const Ref<InputEvent> &p_event); | 
					
						
							|  |  |  | 	bool _gui_input_rotate(const Ref<InputEvent> &p_event); | 
					
						
							|  |  |  | 	bool _gui_input_select(const Ref<InputEvent> &p_event); | 
					
						
							| 
									
										
										
										
											2019-08-30 22:49:47 +02:00
										 |  |  | 	bool _gui_input_ruler_tool(const Ref<InputEvent> &p_event); | 
					
						
							| 
									
										
										
										
											2019-07-28 17:00:05 +03:00
										 |  |  | 	bool _gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bool p_already_accepted); | 
					
						
							| 
									
										
										
										
											2017-11-07 08:58:35 +01:00
										 |  |  | 	bool _gui_input_rulers_and_guides(const Ref<InputEvent> &p_event); | 
					
						
							| 
									
										
										
										
											2018-03-12 23:32:25 +01:00
										 |  |  | 	bool _gui_input_hover(const Ref<InputEvent> &p_event); | 
					
						
							| 
									
										
										
										
											2017-08-29 21:50:18 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 22:33:25 +02:00
										 |  |  | 	void _gui_input_viewport(const Ref<InputEvent> &p_event); | 
					
						
							| 
									
										
										
										
											2020-03-26 21:35:12 +01:00
										 |  |  | 	void _update_cursor(); | 
					
						
							| 
									
										
										
										
											2017-10-15 22:33:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-31 18:53:24 +02:00
										 |  |  | 	void _selection_changed(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-28 14:37:52 -05:00
										 |  |  | 	void _focus_selection(int p_op); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-05 10:18:21 +02:00
										 |  |  | 	SnapTarget snap_target[2]; | 
					
						
							|  |  |  | 	Transform2D snap_transform; | 
					
						
							|  |  |  | 	void _snap_if_closer_float( | 
					
						
							| 
									
										
										
										
											2021-06-20 23:30:19 -04:00
										 |  |  | 			const real_t p_value, | 
					
						
							|  |  |  | 			real_t &r_current_snap, SnapTarget &r_current_snap_target, | 
					
						
							|  |  |  | 			const real_t p_target_value, const SnapTarget p_snap_target, | 
					
						
							|  |  |  | 			const real_t p_radius = 10.0); | 
					
						
							| 
									
										
										
										
											2019-04-05 10:18:21 +02:00
										 |  |  | 	void _snap_if_closer_point( | 
					
						
							|  |  |  | 			Point2 p_value, | 
					
						
							|  |  |  | 			Point2 &r_current_snap, SnapTarget (&r_current_snap_target)[2], | 
					
						
							| 
									
										
										
										
											2021-06-20 23:30:19 -04:00
										 |  |  | 			Point2 p_target_value, const SnapTarget p_snap_target, | 
					
						
							|  |  |  | 			const real_t rotation = 0.0, | 
					
						
							|  |  |  | 			const real_t p_radius = 10.0); | 
					
						
							| 
									
										
										
										
											2019-04-05 10:18:21 +02:00
										 |  |  | 	void _snap_other_nodes( | 
					
						
							|  |  |  | 			const Point2 p_value, | 
					
						
							|  |  |  | 			const Transform2D p_transform_to_snap, | 
					
						
							|  |  |  | 			Point2 &r_current_snap, SnapTarget (&r_current_snap_target)[2], | 
					
						
							|  |  |  | 			const SnapTarget p_snap_target, List<const CanvasItem *> p_exceptions, | 
					
						
							|  |  |  | 			const Node *p_current); | 
					
						
							| 
									
										
										
										
											2017-09-07 23:30:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	VBoxContainer *controls_vb = nullptr; | 
					
						
							|  |  |  | 	EditorZoomWidget *zoom_widget = nullptr; | 
					
						
							| 
									
										
										
										
											2021-06-20 23:30:19 -04:00
										 |  |  | 	void _update_zoom(real_t p_zoom); | 
					
						
							| 
									
										
										
										
											2022-02-15 16:48:55 +08:00
										 |  |  | 	void _shortcut_zoom_set(real_t p_zoom); | 
					
						
							| 
									
										
										
										
											2021-06-20 23:30:19 -04:00
										 |  |  | 	void _zoom_on_position(real_t p_zoom, Point2 p_position = Point2()); | 
					
						
							| 
									
										
										
										
											2019-10-10 19:41:45 +02:00
										 |  |  | 	void _button_toggle_smart_snap(bool p_status); | 
					
						
							|  |  |  | 	void _button_toggle_grid_snap(bool p_status); | 
					
						
							| 
									
										
										
										
											2019-04-06 22:55:01 +02:00
										 |  |  | 	void _button_override_camera(bool p_pressed); | 
					
						
							| 
									
										
										
										
											2017-11-07 08:58:35 +01:00
										 |  |  | 	void _button_tool_select(int p_index); | 
					
						
							| 
									
										
										
										
											2017-09-17 22:52:41 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-06 22:55:01 +02:00
										 |  |  | 	void _update_override_camera_button(bool p_game_running); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	HSplitContainer *left_panel_split = nullptr; | 
					
						
							|  |  |  | 	HSplitContainer *right_panel_split = nullptr; | 
					
						
							|  |  |  | 	VSplitContainer *bottom_split = nullptr; | 
					
						
							| 
									
										
										
										
											2014-12-29 08:37:25 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												New and improved IK system for Skeleton2D
This PR and commit adds a new IK system for 2D with the Skeleton2D node
that adds several new IK solvers, a way to control bones in a Skeleton2D
node similar to that in Skeleton3D. It also adds additional changes
and functionality.
This work was sponsored by GSoC 2020 and TwistedTwigleg.
Full list of changes:
* Adds a SkeletonModifier2D resource
  * This resource is the base where all IK code is written and executed
  * Has a function for clamping angles, since it is so commonly used
  * Modifiers are unique when duplicated so it works with instancing
* Adds a SkeletonModifierStack2D resource
  * This resource manages a series of SkeletonModification2Ds
  * This is what the Skeleton2D directly interfaces with to make IK possible
* Adds SkeletonModifier2D resources for LookAt, CCDIK, FABRIK, Jiggle, and TwoBoneIK
  * Each modification is in its own file
  * There is also a SkeletonModifier2D resource that acts as a stack for using multiple stacks together
* Adds a PhysicalBone2D node
  * Works similar to the PhysicalBone3D node, but uses a RigidBody2D node
* Changes to Skeleton2D listed below:
  * Skeleton2D now holds a single SkeletonModificationStack2D for IK
  * Skeleton2D now has a local_pose_override, which overrides the Bone2D position similar to how the overrides work in Skeleton3D
* Changes to Bone2D listed below:
  * The default_length property has been changed to length. Length is the length of the bone to its child bone node
  * New bone_angle property, which is the angle the bone has to its first child bone node
  * Bone2D caches its transform when not modified by IK for IK interpolation purposes
  * Bone2D draws its own editor gizmo, though this is stated to change in the future
* Changes to CanvasItemEditor listed below:
  * Bone2D gizmo drawing code removed
  * The 2D IK code is removed. Now Bone2D is the only bone system for 2D
* Transform2D now has a looking_at function for rotating to face a position
* Two new node notifications: NOTIFICATION_EDITOR_PRE_SAVE and NOTIFICATION_EDITOR_POST_SAVE
  * These notifications only are called in the editor right before and after saving a scene
  * Needed for not saving the IK position when executing IK in the editor
* Documentation for all the changes listed above.
											
										 
											2020-08-03 14:02:24 -04:00
										 |  |  | 	void _set_owner_for_node_and_children(Node *p_node, Node *p_owner); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	friend class CanvasItemEditorPlugin; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | protected: | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	void _notification(int p_what); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	HBoxContainer *get_panel_hb() { return hb; } | 
					
						
							| 
									
										
										
										
											2016-03-09 00:00:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	static CanvasItemEditor *singleton; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2017-09-07 23:30:54 +02:00
										 |  |  | 	enum SnapMode { | 
					
						
							|  |  |  | 		SNAP_GRID = 1 << 0, | 
					
						
							| 
									
										
										
										
											2017-10-18 23:55:02 +02:00
										 |  |  | 		SNAP_GUIDES = 1 << 1, | 
					
						
							|  |  |  | 		SNAP_PIXEL = 1 << 2, | 
					
						
							|  |  |  | 		SNAP_NODE_PARENT = 1 << 3, | 
					
						
							|  |  |  | 		SNAP_NODE_ANCHORS = 1 << 4, | 
					
						
							|  |  |  | 		SNAP_NODE_SIDES = 1 << 5, | 
					
						
							| 
									
										
										
										
											2017-11-07 08:58:35 +01:00
										 |  |  | 		SNAP_NODE_CENTER = 1 << 6, | 
					
						
							|  |  |  | 		SNAP_OTHER_NODES = 1 << 7, | 
					
						
							| 
									
										
										
										
											2017-10-18 23:55:02 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-07 08:58:35 +01:00
										 |  |  | 		SNAP_DEFAULT = SNAP_GRID | SNAP_GUIDES | SNAP_PIXEL, | 
					
						
							| 
									
										
										
										
											2017-09-07 23:30:54 +02:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-02 01:20:12 +02:00
										 |  |  | 	Point2 snap_point(Point2 p_target, unsigned int p_modes = SNAP_DEFAULT, unsigned int p_forced_modes = 0, const CanvasItem *p_self_canvas_item = nullptr, List<CanvasItem *> p_other_nodes_exceptions = List<CanvasItem *>()); | 
					
						
							| 
									
										
										
										
											2021-06-20 23:30:19 -04:00
										 |  |  | 	real_t snap_angle(real_t p_target, real_t p_start = 0) const; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-11 00:52:51 -03:00
										 |  |  | 	Transform2D get_canvas_transform() const { return transform; } | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	static CanvasItemEditor *get_singleton() { return singleton; } | 
					
						
							|  |  |  | 	Dictionary get_state() const; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	void set_state(const Dictionary &p_state); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void add_control_to_menu_panel(Control *p_control); | 
					
						
							| 
									
										
										
										
											2018-02-13 19:21:19 -02:00
										 |  |  | 	void remove_control_from_menu_panel(Control *p_control); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 20:31:22 +08:00
										 |  |  | 	void add_control_to_left_panel(Control *p_control); | 
					
						
							|  |  |  | 	void remove_control_from_left_panel(Control *p_control); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void add_control_to_right_panel(Control *p_control); | 
					
						
							|  |  |  | 	void remove_control_from_right_panel(Control *p_control); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-11 20:52:42 -03:00
										 |  |  | 	VSplitContainer *get_bottom_split(); | 
					
						
							| 
									
										
										
										
											2014-12-29 08:37:25 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	Control *get_viewport_control() { return viewport; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-18 10:49:37 +01:00
										 |  |  | 	Control *get_controls_container() { return controls_vb; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-18 14:06:57 +02:00
										 |  |  | 	void update_viewport(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 14:26:04 +02:00
										 |  |  | 	Tool get_current_tool() { return tool; } | 
					
						
							| 
									
										
										
										
											2019-08-21 15:34:06 +02:00
										 |  |  | 	void set_current_tool(Tool p_tool); | 
					
						
							| 
									
										
										
										
											2018-09-19 14:26:04 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	void set_undo_redo(UndoRedo *p_undo_redo) { undo_redo = p_undo_redo; } | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	void edit(CanvasItem *p_canvas_item); | 
					
						
							| 
									
										
										
										
											2016-07-28 14:37:52 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void focus_selection(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	EditorSelection *editor_selection = nullptr; | 
					
						
							| 
									
										
											  
											
												New and improved IK system for Skeleton2D
This PR and commit adds a new IK system for 2D with the Skeleton2D node
that adds several new IK solvers, a way to control bones in a Skeleton2D
node similar to that in Skeleton3D. It also adds additional changes
and functionality.
This work was sponsored by GSoC 2020 and TwistedTwigleg.
Full list of changes:
* Adds a SkeletonModifier2D resource
  * This resource is the base where all IK code is written and executed
  * Has a function for clamping angles, since it is so commonly used
  * Modifiers are unique when duplicated so it works with instancing
* Adds a SkeletonModifierStack2D resource
  * This resource manages a series of SkeletonModification2Ds
  * This is what the Skeleton2D directly interfaces with to make IK possible
* Adds SkeletonModifier2D resources for LookAt, CCDIK, FABRIK, Jiggle, and TwoBoneIK
  * Each modification is in its own file
  * There is also a SkeletonModifier2D resource that acts as a stack for using multiple stacks together
* Adds a PhysicalBone2D node
  * Works similar to the PhysicalBone3D node, but uses a RigidBody2D node
* Changes to Skeleton2D listed below:
  * Skeleton2D now holds a single SkeletonModificationStack2D for IK
  * Skeleton2D now has a local_pose_override, which overrides the Bone2D position similar to how the overrides work in Skeleton3D
* Changes to Bone2D listed below:
  * The default_length property has been changed to length. Length is the length of the bone to its child bone node
  * New bone_angle property, which is the angle the bone has to its first child bone node
  * Bone2D caches its transform when not modified by IK for IK interpolation purposes
  * Bone2D draws its own editor gizmo, though this is stated to change in the future
* Changes to CanvasItemEditor listed below:
  * Bone2D gizmo drawing code removed
  * The 2D IK code is removed. Now Bone2D is the only bone system for 2D
* Transform2D now has a looking_at function for rotating to face a position
* Two new node notifications: NOTIFICATION_EDITOR_PRE_SAVE and NOTIFICATION_EDITOR_POST_SAVE
  * These notifications only are called in the editor right before and after saving a scene
  * Needed for not saving the IK position when executing IK in the editor
* Documentation for all the changes listed above.
											
										 
											2020-08-03 14:02:24 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-27 10:36:51 +01:00
										 |  |  | 	CanvasItemEditor(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class CanvasItemEditorPlugin : public EditorPlugin { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	GDCLASS(CanvasItemEditorPlugin, EditorPlugin); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	CanvasItemEditor *canvas_item_editor = nullptr; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-07-10 11:34:39 +01:00
										 |  |  | 	virtual String get_name() const override { return "2D"; } | 
					
						
							|  |  |  | 	bool has_main_screen() const override { return true; } | 
					
						
							|  |  |  | 	virtual void edit(Object *p_object) override; | 
					
						
							|  |  |  | 	virtual bool handles(Object *p_object) const override; | 
					
						
							|  |  |  | 	virtual void make_visible(bool p_visible) override; | 
					
						
							|  |  |  | 	virtual Dictionary get_state() const override; | 
					
						
							|  |  |  | 	virtual void set_state(const Dictionary &p_state) override; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	CanvasItemEditor *get_canvas_item_editor() { return canvas_item_editor; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-27 10:36:51 +01:00
										 |  |  | 	CanvasItemEditorPlugin(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	~CanvasItemEditorPlugin(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-25 23:41:19 +09:00
										 |  |  | class CanvasItemEditorViewport : public Control { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	GDCLASS(CanvasItemEditorViewport, Control); | 
					
						
							| 
									
										
										
										
											2016-10-26 04:27:24 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-29 02:46:38 -04:00
										 |  |  | 	// The type of node that will be created when dropping texture into the viewport.
 | 
					
						
							|  |  |  | 	String default_texture_node_type; | 
					
						
							|  |  |  | 	// Node types that are available to select from when dropping texture into viewport.
 | 
					
						
							|  |  |  | 	Vector<String> texture_node_types; | 
					
						
							| 
									
										
										
										
											2016-10-26 04:27:24 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	Vector<String> selected_files; | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	Node *target_node = nullptr; | 
					
						
							| 
									
										
										
										
											2016-10-26 04:27:24 +09:00
										 |  |  | 	Point2 drop_pos; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-04 15:06:57 +02:00
										 |  |  | 	EditorData *editor_data = nullptr; | 
					
						
							|  |  |  | 	CanvasItemEditor *canvas_item_editor = nullptr; | 
					
						
							|  |  |  | 	Control *preview_node = nullptr; | 
					
						
							|  |  |  | 	AcceptDialog *accept = nullptr; | 
					
						
							|  |  |  | 	AcceptDialog *selector = nullptr; | 
					
						
							|  |  |  | 	Label *selector_label = nullptr; | 
					
						
							|  |  |  | 	Label *label = nullptr; | 
					
						
							|  |  |  | 	Label *label_desc = nullptr; | 
					
						
							|  |  |  | 	VBoxContainer *btn_group = nullptr; | 
					
						
							| 
									
										
										
										
											2017-01-10 01:04:31 -03:00
										 |  |  | 	Ref<ButtonGroup> button_group; | 
					
						
							| 
									
										
										
										
											2016-10-26 04:27:24 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void _on_mouse_exit(); | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	void _on_select_type(Object *selected); | 
					
						
							| 
									
										
										
										
											2017-11-12 10:50:06 +01:00
										 |  |  | 	void _on_change_type_confirmed(); | 
					
						
							|  |  |  | 	void _on_change_type_closed(); | 
					
						
							| 
									
										
										
										
											2021-07-29 02:46:38 -04:00
										 |  |  | 	Node *_make_texture_node_type(String texture_node_type); | 
					
						
							| 
									
										
										
										
											2016-10-26 04:27:24 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	void _create_preview(const Vector<String> &files) const; | 
					
						
							| 
									
										
										
										
											2016-10-26 04:27:24 +09:00
										 |  |  | 	void _remove_preview(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	bool _cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node); | 
					
						
							| 
									
										
										
										
											2018-01-09 01:05:15 -05:00
										 |  |  | 	bool _only_packed_scenes_selected() const; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	void _create_nodes(Node *parent, Node *child, String &path, const Point2 &p_point); | 
					
						
							|  |  |  | 	bool _create_instance(Node *parent, String &path, const Point2 &p_point); | 
					
						
							| 
									
										
										
										
											2016-10-26 04:27:24 +09:00
										 |  |  | 	void _perform_drop_data(); | 
					
						
							| 
									
										
										
										
											2017-11-22 05:28:02 +03:00
										 |  |  | 	void _show_resource_type_selector(); | 
					
						
							| 
									
										
										
										
											2022-02-15 21:44:22 -05:00
										 |  |  | 	void _update_theme(); | 
					
						
							| 
									
										
										
										
											2016-10-26 04:27:24 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  | 	void _notification(int p_what); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-07-10 11:34:39 +01:00
										 |  |  | 	virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const override; | 
					
						
							|  |  |  | 	virtual void drop_data(const Point2 &p_point, const Variant &p_data) override; | 
					
						
							| 
									
										
										
										
											2016-10-26 04:27:24 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-27 10:36:51 +01:00
										 |  |  | 	CanvasItemEditorViewport(CanvasItemEditor *p_canvas_item_editor); | 
					
						
							| 
									
										
										
										
											2017-08-24 12:51:28 -04:00
										 |  |  | 	~CanvasItemEditorViewport(); | 
					
						
							| 
									
										
										
										
											2016-10-26 04:27:24 +09:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-08 23:53:41 +03:00
										 |  |  | #endif //CANVAS_ITEM_EDITOR_PLUGIN_H
 |