scene_debugger_object.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /**************************************************************************/
  2. /* scene_debugger_object.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  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. #pragma once
  31. #ifdef DEBUG_ENABLED
  32. #include "scene/main/node.h"
  33. class SceneDebuggerObject {
  34. private:
  35. void _parse_script_properties(Script *p_script, ScriptInstance *p_instance);
  36. public:
  37. typedef Pair<PropertyInfo, Variant> SceneDebuggerProperty;
  38. ObjectID id;
  39. String class_name;
  40. List<SceneDebuggerProperty> properties;
  41. SceneDebuggerObject(ObjectID p_id);
  42. SceneDebuggerObject(Object *p_obj);
  43. SceneDebuggerObject() {}
  44. void serialize(Array &r_arr, int p_max_size = 1 << 20);
  45. void deserialize(const Array &p_arr);
  46. void deserialize(uint64_t p_id, const String &p_class_name, const Array &p_props);
  47. };
  48. class SceneDebuggerTree {
  49. public:
  50. struct RemoteNode {
  51. int child_count = 0;
  52. String name;
  53. String type_name;
  54. ObjectID id;
  55. String scene_file_path;
  56. uint8_t view_flags = 0;
  57. enum ViewFlags {
  58. VIEW_HAS_VISIBLE_METHOD = 1 << 1,
  59. VIEW_VISIBLE = 1 << 2,
  60. VIEW_VISIBLE_IN_TREE = 1 << 3,
  61. };
  62. RemoteNode(int p_child, const String &p_name, const String &p_type, ObjectID p_id, const String p_scene_file_path, int p_view_flags) {
  63. child_count = p_child;
  64. name = p_name;
  65. type_name = p_type;
  66. id = p_id;
  67. scene_file_path = p_scene_file_path;
  68. view_flags = p_view_flags;
  69. }
  70. RemoteNode() {}
  71. };
  72. List<RemoteNode> nodes;
  73. void serialize(Array &r_arr);
  74. void deserialize(const Array &p_arr);
  75. SceneDebuggerTree(Node *p_root);
  76. SceneDebuggerTree() {}
  77. };
  78. #endif // DEBUG_ENABLED