gltf_document_extension.cpp 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*************************************************************************/
  2. /* gltf_document_extension.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2021 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. #include "gltf_document_extension.h"
  31. #include "gltf_document.h"
  32. void GLTFDocumentExtension::_bind_methods() {
  33. // Import
  34. ClassDB::bind_method(D_METHOD("get_import_setting_keys"),
  35. &GLTFDocumentExtension::get_import_setting_keys);
  36. ClassDB::bind_method(D_METHOD("import_preflight", "document"),
  37. &GLTFDocumentExtension::import_preflight);
  38. ClassDB::bind_method(D_METHOD("get_import_setting", "key"),
  39. &GLTFDocumentExtension::get_import_setting);
  40. ClassDB::bind_method(D_METHOD("set_import_setting", "key", "value"),
  41. &GLTFDocumentExtension::set_import_setting);
  42. ClassDB::bind_method(D_METHOD("import_post", "document", "node"),
  43. &GLTFDocumentExtension::import_post);
  44. // Export
  45. ClassDB::bind_method(D_METHOD("get_export_setting_keys"),
  46. &GLTFDocumentExtension::get_export_setting_keys);
  47. ClassDB::bind_method(D_METHOD("get_export_setting", "key"),
  48. &GLTFDocumentExtension::get_export_setting);
  49. ClassDB::bind_method(D_METHOD("set_export_setting", "key", "value"),
  50. &GLTFDocumentExtension::set_export_setting);
  51. ClassDB::bind_method(D_METHOD("export_preflight", "document", "node"),
  52. &GLTFDocumentExtension::export_preflight);
  53. ClassDB::bind_method(D_METHOD("export_post", "document"),
  54. &GLTFDocumentExtension::export_post);
  55. }
  56. Array GLTFDocumentExtension::get_import_setting_keys() const {
  57. return import_settings.keys();
  58. }
  59. Variant GLTFDocumentExtension::get_import_setting(const StringName &p_key) const {
  60. if (!import_settings.has(p_key)) {
  61. return Variant();
  62. }
  63. return import_settings[p_key];
  64. }
  65. void GLTFDocumentExtension::set_import_setting(const StringName &p_key, Variant p_var) {
  66. import_settings[p_key] = p_var;
  67. }
  68. Array GLTFDocumentExtension::get_export_setting_keys() const {
  69. return import_settings.keys();
  70. }
  71. Variant GLTFDocumentExtension::get_export_setting(const StringName &p_key) const {
  72. if (!import_settings.has(p_key)) {
  73. return Variant();
  74. }
  75. return import_settings[p_key];
  76. }
  77. void GLTFDocumentExtension::set_export_setting(const StringName &p_key, Variant p_var) {
  78. import_settings[p_key] = p_var;
  79. }