material_editor_plugin.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*************************************************************************/
  2. /* material_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 MATERIAL_EDITOR_PLUGIN_H
  31. #define MATERIAL_EDITOR_PLUGIN_H
  32. #include "editor/property_editor.h"
  33. // FIXME: Disabled as (according to reduz) users were complaining that it gets in the way
  34. // Waiting for PropertyEditor rewrite (planned for 3.1) to be refactored.
  35. #if 0
  36. #include "editor/editor_node.h"
  37. #include "editor/editor_plugin.h"
  38. #include "scene/3d/camera.h"
  39. #include "scene/3d/light.h"
  40. #include "scene/3d/mesh_instance.h"
  41. #include "scene/resources/material.h"
  42. class MaterialEditor : public Control {
  43. GDCLASS(MaterialEditor, Control);
  44. Viewport *viewport;
  45. MeshInstance *sphere_instance;
  46. MeshInstance *box_instance;
  47. DirectionalLight *light1;
  48. DirectionalLight *light2;
  49. Camera *camera;
  50. Ref<Mesh> sphere_mesh;
  51. Ref<Mesh> box_mesh;
  52. TextureButton *sphere_switch;
  53. TextureButton *box_switch;
  54. TextureButton *light_1_switch;
  55. TextureButton *light_2_switch;
  56. Ref<Material> material;
  57. void _button_pressed(Node* p_button);
  58. bool first_enter;
  59. protected:
  60. void _notification(int p_what);
  61. void _gui_input(InputEvent p_event);
  62. static void _bind_methods();
  63. public:
  64. void edit(Ref<Material> p_material);
  65. MaterialEditor();
  66. };
  67. class MaterialEditorPlugin : public EditorPlugin {
  68. GDCLASS( MaterialEditorPlugin, EditorPlugin );
  69. MaterialEditor *material_editor;
  70. EditorNode *editor;
  71. public:
  72. virtual String get_name() const { return "Material"; }
  73. bool has_main_screen() const { return false; }
  74. virtual void edit(Object *p_node);
  75. virtual bool handles(Object *p_node) const;
  76. virtual void make_visible(bool p_visible);
  77. MaterialEditorPlugin(EditorNode *p_node);
  78. ~MaterialEditorPlugin();
  79. };
  80. #endif
  81. class SpatialMaterialConversionPlugin : public EditorResourceConversionPlugin {
  82. GDCLASS(SpatialMaterialConversionPlugin, EditorResourceConversionPlugin)
  83. public:
  84. virtual String converts_to() const;
  85. virtual bool handles(const Ref<Resource> &p_resource) const;
  86. virtual Ref<Resource> convert(const Ref<Resource> &p_resource);
  87. };
  88. class ParticlesMaterialConversionPlugin : public EditorResourceConversionPlugin {
  89. GDCLASS(ParticlesMaterialConversionPlugin, EditorResourceConversionPlugin)
  90. public:
  91. virtual String converts_to() const;
  92. virtual bool handles(const Ref<Resource> &p_resource) const;
  93. virtual Ref<Resource> convert(const Ref<Resource> &p_resource);
  94. };
  95. #endif // MATERIAL_EDITOR_PLUGIN_H