canvas_item_editor_plugin.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. /*************************************************************************/
  2. /* canvas_item_editor_plugin.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef CONTROL_EDITOR_PLUGIN_H
  31. #define CONTROL_EDITOR_PLUGIN_H
  32. #include "editor/editor_node.h"
  33. #include "editor/editor_plugin.h"
  34. #include "scene/2d/canvas_item.h"
  35. #include "scene/gui/box_container.h"
  36. #include "scene/gui/check_box.h"
  37. #include "scene/gui/label.h"
  38. #include "scene/gui/panel_container.h"
  39. #include "scene/gui/spin_box.h"
  40. /**
  41. @author Juan Linietsky <reduzio@gmail.com>
  42. */
  43. class CanvasItemEditorViewport;
  44. class CanvasItemEditorSelectedItem : public Object {
  45. GDCLASS(CanvasItemEditorSelectedItem, Object);
  46. public:
  47. Variant undo_state;
  48. Vector2 undo_pivot;
  49. Transform2D prev_xform;
  50. float prev_rot;
  51. Rect2 prev_rect;
  52. Vector2 prev_pivot;
  53. float prev_anchors[4];
  54. Transform2D pre_drag_xform;
  55. Rect2 pre_drag_rect;
  56. CanvasItemEditorSelectedItem() { prev_rot = 0; }
  57. };
  58. class CanvasItemEditor : public VBoxContainer {
  59. GDCLASS(CanvasItemEditor, VBoxContainer);
  60. EditorNode *editor;
  61. enum Tool {
  62. TOOL_SELECT,
  63. TOOL_LIST_SELECT,
  64. TOOL_MOVE,
  65. TOOL_ROTATE,
  66. TOOL_EDIT_PIVOT,
  67. TOOL_PAN,
  68. TOOL_MAX
  69. };
  70. enum MenuOption {
  71. SNAP_USE,
  72. SNAP_USE_NODE_PARENT,
  73. SNAP_USE_NODE_ANCHORS,
  74. SNAP_USE_NODE_SIDES,
  75. SNAP_USE_OTHER_NODES,
  76. SNAP_USE_GRID,
  77. SNAP_USE_GUIDES,
  78. SNAP_USE_ROTATION,
  79. SNAP_RELATIVE,
  80. SNAP_CONFIGURE,
  81. SNAP_USE_PIXEL,
  82. SHOW_GRID,
  83. SHOW_HELPERS,
  84. SHOW_RULERS,
  85. SHOW_GUIDES,
  86. LOCK_SELECTED,
  87. UNLOCK_SELECTED,
  88. GROUP_SELECTED,
  89. UNGROUP_SELECTED,
  90. ANCHORS_AND_MARGINS_PRESET_TOP_LEFT,
  91. ANCHORS_AND_MARGINS_PRESET_TOP_RIGHT,
  92. ANCHORS_AND_MARGINS_PRESET_BOTTOM_LEFT,
  93. ANCHORS_AND_MARGINS_PRESET_BOTTOM_RIGHT,
  94. ANCHORS_AND_MARGINS_PRESET_CENTER_LEFT,
  95. ANCHORS_AND_MARGINS_PRESET_CENTER_RIGHT,
  96. ANCHORS_AND_MARGINS_PRESET_CENTER_TOP,
  97. ANCHORS_AND_MARGINS_PRESET_CENTER_BOTTOM,
  98. ANCHORS_AND_MARGINS_PRESET_CENTER,
  99. ANCHORS_AND_MARGINS_PRESET_TOP_WIDE,
  100. ANCHORS_AND_MARGINS_PRESET_LEFT_WIDE,
  101. ANCHORS_AND_MARGINS_PRESET_RIGHT_WIDE,
  102. ANCHORS_AND_MARGINS_PRESET_BOTTOM_WIDE,
  103. ANCHORS_AND_MARGINS_PRESET_VCENTER_WIDE,
  104. ANCHORS_AND_MARGINS_PRESET_HCENTER_WIDE,
  105. ANCHORS_AND_MARGINS_PRESET_WIDE,
  106. ANCHORS_PRESET_TOP_LEFT,
  107. ANCHORS_PRESET_TOP_RIGHT,
  108. ANCHORS_PRESET_BOTTOM_LEFT,
  109. ANCHORS_PRESET_BOTTOM_RIGHT,
  110. ANCHORS_PRESET_CENTER_LEFT,
  111. ANCHORS_PRESET_CENTER_RIGHT,
  112. ANCHORS_PRESET_CENTER_TOP,
  113. ANCHORS_PRESET_CENTER_BOTTOM,
  114. ANCHORS_PRESET_CENTER,
  115. ANCHORS_PRESET_TOP_WIDE,
  116. ANCHORS_PRESET_LEFT_WIDE,
  117. ANCHORS_PRESET_RIGHT_WIDE,
  118. ANCHORS_PRESET_BOTTOM_WIDE,
  119. ANCHORS_PRESET_VCENTER_WIDE,
  120. ANCHORS_PRESET_HCENTER_WIDE,
  121. ANCHORS_PRESET_WIDE,
  122. MARGINS_PRESET_TOP_LEFT,
  123. MARGINS_PRESET_TOP_RIGHT,
  124. MARGINS_PRESET_BOTTOM_LEFT,
  125. MARGINS_PRESET_BOTTOM_RIGHT,
  126. MARGINS_PRESET_CENTER_LEFT,
  127. MARGINS_PRESET_CENTER_RIGHT,
  128. MARGINS_PRESET_CENTER_TOP,
  129. MARGINS_PRESET_CENTER_BOTTOM,
  130. MARGINS_PRESET_CENTER,
  131. MARGINS_PRESET_TOP_WIDE,
  132. MARGINS_PRESET_LEFT_WIDE,
  133. MARGINS_PRESET_RIGHT_WIDE,
  134. MARGINS_PRESET_BOTTOM_WIDE,
  135. MARGINS_PRESET_VCENTER_WIDE,
  136. MARGINS_PRESET_HCENTER_WIDE,
  137. MARGINS_PRESET_WIDE,
  138. ANIM_INSERT_KEY,
  139. ANIM_INSERT_KEY_EXISTING,
  140. ANIM_INSERT_POS,
  141. ANIM_INSERT_ROT,
  142. ANIM_INSERT_SCALE,
  143. ANIM_COPY_POSE,
  144. ANIM_PASTE_POSE,
  145. ANIM_CLEAR_POSE,
  146. VIEW_CENTER_TO_SELECTION,
  147. VIEW_FRAME_TO_SELECTION,
  148. SKELETON_MAKE_BONES,
  149. SKELETON_CLEAR_BONES,
  150. SKELETON_SHOW_BONES,
  151. SKELETON_SET_IK_CHAIN,
  152. SKELETON_CLEAR_IK_CHAIN
  153. };
  154. enum DragType {
  155. DRAG_NONE,
  156. DRAG_LEFT,
  157. DRAG_TOP_LEFT,
  158. DRAG_TOP,
  159. DRAG_TOP_RIGHT,
  160. DRAG_RIGHT,
  161. DRAG_BOTTOM_RIGHT,
  162. DRAG_BOTTOM,
  163. DRAG_BOTTOM_LEFT,
  164. DRAG_ANCHOR_TOP_LEFT,
  165. DRAG_ANCHOR_TOP_RIGHT,
  166. DRAG_ANCHOR_BOTTOM_RIGHT,
  167. DRAG_ANCHOR_BOTTOM_LEFT,
  168. DRAG_ANCHOR_ALL,
  169. DRAG_ALL,
  170. DRAG_ROTATE,
  171. DRAG_PIVOT,
  172. DRAG_NODE_2D,
  173. DRAG_V_GUIDE,
  174. DRAG_H_GUIDE,
  175. DRAG_DOUBLE_GUIDE,
  176. };
  177. enum KeyMoveMODE {
  178. MOVE_VIEW_BASE,
  179. MOVE_LOCAL_BASE,
  180. MOVE_LOCAL_WITH_ROT
  181. };
  182. EditorSelection *editor_selection;
  183. bool additive_selection;
  184. Tool tool;
  185. bool first_update;
  186. Control *viewport;
  187. Control *viewport_base;
  188. Control *viewport_scrollable;
  189. bool can_move_pivot;
  190. HScrollBar *h_scroll;
  191. VScrollBar *v_scroll;
  192. HBoxContainer *hb;
  193. ToolButton *zoom_minus;
  194. ToolButton *zoom_reset;
  195. ToolButton *zoom_plus;
  196. Transform2D transform;
  197. bool show_grid;
  198. bool show_rulers;
  199. bool show_guides;
  200. bool show_helpers;
  201. float zoom;
  202. Point2 grid_offset;
  203. Point2 grid_step;
  204. int grid_step_multiplier;
  205. float snap_rotation_step;
  206. float snap_rotation_offset;
  207. bool snap_active;
  208. bool snap_node_parent;
  209. bool snap_node_anchors;
  210. bool snap_node_sides;
  211. bool snap_other_nodes;
  212. bool snap_grid;
  213. bool snap_guides;
  214. bool snap_rotation;
  215. bool snap_relative;
  216. bool snap_pixel;
  217. bool skeleton_show_bones;
  218. bool box_selecting;
  219. Point2 box_selecting_to;
  220. bool key_pos;
  221. bool key_rot;
  222. bool key_scale;
  223. void _tool_select(int p_index);
  224. MenuOption last_option;
  225. struct _SelectResult {
  226. CanvasItem *item;
  227. float z;
  228. bool has_z;
  229. _FORCE_INLINE_ bool operator<(const _SelectResult &p_rr) const {
  230. return has_z && p_rr.has_z ? p_rr.z < z : p_rr.has_z;
  231. }
  232. };
  233. Vector<_SelectResult> selection_results;
  234. struct BoneList {
  235. Transform2D xform;
  236. Vector2 from;
  237. Vector2 to;
  238. ObjectID bone;
  239. uint64_t last_pass;
  240. };
  241. uint64_t bone_last_frame;
  242. Map<ObjectID, BoneList> bone_list;
  243. Transform2D bone_orig_xform;
  244. struct BoneIK {
  245. Variant orig_state;
  246. Vector2 pos;
  247. float len;
  248. Node2D *node;
  249. };
  250. List<BoneIK> bone_ik_list;
  251. struct PoseClipboard {
  252. Vector2 pos;
  253. Vector2 scale;
  254. float rot;
  255. ObjectID id;
  256. };
  257. List<PoseClipboard> pose_clipboard;
  258. ToolButton *select_button;
  259. ToolButton *list_select_button;
  260. ToolButton *move_button;
  261. ToolButton *rotate_button;
  262. ToolButton *snap_button;
  263. MenuButton *snap_config_menu;
  264. PopupMenu *smartsnap_config_popup;
  265. ToolButton *pivot_button;
  266. ToolButton *pan_button;
  267. ToolButton *lock_button;
  268. ToolButton *unlock_button;
  269. ToolButton *group_button;
  270. ToolButton *ungroup_button;
  271. MenuButton *skeleton_menu;
  272. MenuButton *view_menu;
  273. HBoxContainer *animation_hb;
  274. MenuButton *animation_menu;
  275. MenuButton *presets_menu;
  276. PopupMenu *anchors_and_margins_popup;
  277. PopupMenu *anchors_popup;
  278. Button *key_loc_button;
  279. Button *key_rot_button;
  280. Button *key_scale_button;
  281. Button *key_insert_button;
  282. PopupMenu *selection_menu;
  283. Control *top_ruler;
  284. Control *left_ruler;
  285. //PopupMenu *popup;
  286. DragType drag;
  287. Point2 drag_from;
  288. Point2 drag_point_from;
  289. bool updating_value_dialog;
  290. Point2 display_rotate_from;
  291. Point2 display_rotate_to;
  292. int edited_guide_index;
  293. Point2 edited_guide_pos;
  294. Ref<StyleBoxTexture> select_sb;
  295. Ref<Texture> select_handle;
  296. Ref<Texture> anchor_handle;
  297. Ref<ShortCut> drag_pivot_shortcut;
  298. Ref<ShortCut> set_pivot_shortcut;
  299. Ref<ShortCut> multiply_grid_step_shortcut;
  300. Ref<ShortCut> divide_grid_step_shortcut;
  301. int handle_len;
  302. bool _is_part_of_subscene(CanvasItem *p_item);
  303. void _find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, Vector<_SelectResult> &r_items, int limit = 0);
  304. void _find_canvas_items_at_rect(const Rect2 &p_rect, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, List<CanvasItem *> *r_items);
  305. void _select_click_on_empty_area(Point2 p_click_pos, bool p_append, bool p_box_selection);
  306. bool _select_click_on_item(CanvasItem *item, Point2 p_click_pos, bool p_append, bool p_drag);
  307. ConfirmationDialog *snap_dialog;
  308. CanvasItem *ref_item;
  309. void _edit_set_pivot(const Vector2 &mouse_pos);
  310. void _add_canvas_item(CanvasItem *p_canvas_item);
  311. void _remove_canvas_item(CanvasItem *p_canvas_item);
  312. void _clear_canvas_items();
  313. void _key_move(const Vector2 &p_dir, bool p_snap, KeyMoveMODE p_move_mode);
  314. void _list_select(const Ref<InputEventMouseButton> &b);
  315. DragType _get_resize_handle_drag_type(const Point2 &p_click, Vector2 &r_point);
  316. void _prepare_drag(const Point2 &p_click_pos);
  317. DragType _get_anchor_handle_drag_type(const Point2 &p_click, Vector2 &r_point);
  318. Vector2 _anchor_to_position(const Control *p_control, Vector2 anchor);
  319. Vector2 _position_to_anchor(const Control *p_control, Vector2 position);
  320. void _popup_callback(int p_op);
  321. bool updating_scroll;
  322. void _update_scroll(float);
  323. void _update_scrollbars();
  324. void _update_cursor();
  325. void incbeg(float &beg, float &end, float inc, float minsize, bool p_symmetric);
  326. void incend(float &beg, float &end, float inc, float minsize, bool p_symmetric);
  327. void _append_canvas_item(CanvasItem *p_item);
  328. void _snap_changed();
  329. void _selection_result_pressed(int);
  330. void _selection_menu_hide();
  331. UndoRedo *undo_redo;
  332. Point2 _find_topleftmost_point();
  333. void _build_bones_list(Node *p_node);
  334. void _get_encompassing_rect(Node *p_node, Rect2 &r_rect, const Transform2D &p_xform);
  335. Object *_get_editor_data(Object *p_what);
  336. CanvasItem *_get_single_item();
  337. int get_item_count();
  338. void _keying_changed();
  339. void _unhandled_key_input(const Ref<InputEvent> &p_ev);
  340. void _draw_text_at_position(Point2 p_position, String p_string, Margin p_side);
  341. void _draw_margin_at_position(int p_value, Point2 p_position, Margin p_side);
  342. void _draw_percentage_at_position(float p_value, Point2 p_position, Margin p_side);
  343. void _draw_rulers();
  344. void _draw_guides();
  345. void _draw_focus();
  346. void _draw_grid();
  347. void _draw_selection();
  348. void _draw_axis();
  349. void _draw_bones();
  350. void _draw_locks_and_groups(Node *p_node, const Transform2D &p_xform);
  351. void _draw_viewport();
  352. void _draw_viewport_base();
  353. void _gui_input_viewport(const Ref<InputEvent> &p_event);
  354. void _gui_input_viewport_base(const Ref<InputEvent> &p_event);
  355. void _focus_selection(int p_op);
  356. void _snap_if_closer_float(float p_value, float p_target_snap, float &r_current_snap, bool &r_snapped, float p_radius = 10.0);
  357. void _snap_if_closer_point(Point2 p_value, Point2 p_target_snap, Point2 &r_current_snap, bool (&r_snapped)[2], real_t rotation = 0.0, float p_radius = 10.0);
  358. void _snap_other_nodes(Point2 p_value, Point2 &r_current_snap, bool (&r_snapped)[2], const Node *p_current, const CanvasItem *p_to_snap = NULL);
  359. void _set_anchors_preset(Control::LayoutPreset p_preset);
  360. void _set_margins_preset(Control::LayoutPreset p_preset);
  361. void _set_anchors_and_margins_preset(Control::LayoutPreset p_preset);
  362. void _zoom_on_position(float p_zoom, Point2 p_position = Point2());
  363. void _zoom_minus();
  364. void _zoom_reset();
  365. void _zoom_plus();
  366. void _toggle_snap(bool p_status);
  367. HSplitContainer *palette_split;
  368. VSplitContainer *bottom_split;
  369. friend class CanvasItemEditorPlugin;
  370. protected:
  371. void _notification(int p_what);
  372. static void _bind_methods();
  373. void end_drag();
  374. void box_selection_start(Point2 &click);
  375. bool box_selection_end();
  376. HBoxContainer *get_panel_hb() { return hb; }
  377. struct compare_items_x {
  378. bool operator()(const CanvasItem *a, const CanvasItem *b) const {
  379. return a->get_global_transform().elements[2].x < b->get_global_transform().elements[2].x;
  380. }
  381. };
  382. struct compare_items_y {
  383. bool operator()(const CanvasItem *a, const CanvasItem *b) const {
  384. return a->get_global_transform().elements[2].y < b->get_global_transform().elements[2].y;
  385. }
  386. };
  387. struct proj_vector2_x {
  388. float get(const Vector2 &v) { return v.x; }
  389. void set(Vector2 &v, float f) { v.x = f; }
  390. };
  391. struct proj_vector2_y {
  392. float get(const Vector2 &v) { return v.y; }
  393. void set(Vector2 &v, float f) { v.y = f; }
  394. };
  395. template <class P, class C>
  396. void space_selected_items();
  397. static CanvasItemEditor *singleton;
  398. public:
  399. enum SnapMode {
  400. SNAP_GRID = 1 << 0,
  401. SNAP_GUIDES = 1 << 1,
  402. SNAP_PIXEL = 1 << 2,
  403. SNAP_NODE_PARENT = 1 << 3,
  404. SNAP_NODE_ANCHORS = 1 << 4,
  405. SNAP_NODE_SIDES = 1 << 5,
  406. SNAP_OTHER_NODES = 1 << 6,
  407. SNAP_DEFAULT = 0x07,
  408. };
  409. Point2 snap_point(Point2 p_target, unsigned int p_modes = SNAP_DEFAULT, const CanvasItem *p_canvas_item = NULL, unsigned int p_forced_modes = 0);
  410. float snap_angle(float p_target, float p_start = 0) const;
  411. Transform2D get_canvas_transform() const { return transform; }
  412. static CanvasItemEditor *get_singleton() { return singleton; }
  413. Dictionary get_state() const;
  414. void set_state(const Dictionary &p_state);
  415. void add_control_to_menu_panel(Control *p_control);
  416. HSplitContainer *get_palette_split();
  417. VSplitContainer *get_bottom_split();
  418. Control *get_viewport_control() { return viewport; }
  419. void set_undo_redo(UndoRedo *p_undo_redo) { undo_redo = p_undo_redo; }
  420. void edit(CanvasItem *p_canvas_item);
  421. void focus_selection();
  422. CanvasItemEditor(EditorNode *p_editor);
  423. };
  424. class CanvasItemEditorPlugin : public EditorPlugin {
  425. GDCLASS(CanvasItemEditorPlugin, EditorPlugin);
  426. CanvasItemEditor *canvas_item_editor;
  427. EditorNode *editor;
  428. public:
  429. virtual String get_name() const { return "2D"; }
  430. bool has_main_screen() const { return true; }
  431. virtual void edit(Object *p_object);
  432. virtual bool handles(Object *p_object) const;
  433. virtual void make_visible(bool p_visible);
  434. virtual Dictionary get_state() const;
  435. virtual void set_state(const Dictionary &p_state);
  436. CanvasItemEditor *get_canvas_item_editor() { return canvas_item_editor; }
  437. CanvasItemEditorPlugin(EditorNode *p_node);
  438. ~CanvasItemEditorPlugin();
  439. };
  440. class CanvasItemEditorViewport : public Control {
  441. GDCLASS(CanvasItemEditorViewport, Control);
  442. String default_type;
  443. Vector<String> types;
  444. Vector<String> selected_files;
  445. Node *target_node;
  446. Point2 drop_pos;
  447. EditorNode *editor;
  448. EditorData *editor_data;
  449. CanvasItemEditor *canvas;
  450. Node2D *preview_node;
  451. AcceptDialog *accept;
  452. WindowDialog *selector;
  453. Label *selector_label;
  454. Label *label;
  455. Label *label_desc;
  456. VBoxContainer *btn_group;
  457. Ref<ButtonGroup> button_group;
  458. void _on_mouse_exit();
  459. void _on_select_type(Object *selected);
  460. void _on_change_type();
  461. void _create_preview(const Vector<String> &files) const;
  462. void _remove_preview();
  463. bool _cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node);
  464. void _create_nodes(Node *parent, Node *child, String &path, const Point2 &p_point);
  465. bool _create_instance(Node *parent, String &path, const Point2 &p_point);
  466. void _perform_drop_data();
  467. static void _bind_methods();
  468. protected:
  469. void _notification(int p_what);
  470. public:
  471. virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const;
  472. virtual void drop_data(const Point2 &p_point, const Variant &p_data);
  473. CanvasItemEditorViewport(EditorNode *p_node, CanvasItemEditor *p_canvas);
  474. ~CanvasItemEditorViewport();
  475. };
  476. #endif