diff --git a/modules/world/mesher/mesher.cpp b/modules/world/mesher/mesher.cpp deleted file mode 100644 index f777725..0000000 --- a/modules/world/mesher/mesher.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include "mesher.h" -CompoundTransvoxel::CompoundTransvoxel() : VoxelMesherTransvoxel() -{ -} - -CompoundTransvoxel::~CompoundTransvoxel() -{ -} - -void CompoundTransvoxel::build(VoxelMesher::Output &output, const VoxelMesher::Input &input) -{ - VoxelMesherTransvoxel::build(output, input); -} - -Ref CompoundTransvoxel::duplicate(bool p_subresources) const -{ - return VoxelMesherTransvoxel::duplicate(p_subresources); -} - -int CompoundTransvoxel::get_used_channels_mask() const -{ - return VoxelMesherTransvoxel::get_used_channels_mask(); -} - -void CompoundTransvoxelInspector::open_scene(Object *button) -{ - CompoundTransvoxel *obj = Object::cast_to(button->get_meta("what")); - fd->set_meta("what", obj); - fd->popup_centered_ratio(); -} - -CompoundTransvoxelInspector::CompoundTransvoxelInspector(): EditorInspectorPlugin() -{ -} - -void CompoundTransvoxel::_bind_methods() -{ -} -void CompoundTransvoxelInspector::_bind_methods() -{ - ClassDB::bind_method(D_METHOD("open_scene", "button"), &CompoundTransvoxelInspector::open_scene); -} -bool CompoundTransvoxelInspector::can_handle(Object *p_object) -{ - return Object::cast_to(p_object) != NULL; -} -void CompoundTransvoxelInspector::scenes_selected(const PoolVector &p_paths) -{ - struct CompoundTransvoxel::place_item it; - for (int i = 0; i < p_paths.size(); i++) { - Ref t = Ref(ResourceLoader::load(p_paths[i])); - ERR_CONTINUE_MSG(!t.is_valid(), "'" + p_paths[i] + "' is not a valid scene."); - it.scene = t; - } -} -void CompoundTransvoxelInspector::parse_begin(Object *p_object) -{ - int i; - CompoundTransvoxel *obj = Object::cast_to(p_object); - if (!obj) - return; - VBoxContainer *control = memnew(VBoxContainer); - fd = memnew(EditorFileDialog); - fd->set_access(EditorFileDialog::ACCESS_RESOURCES); - fd->set_mode(EditorFileDialog::MODE_OPEN_FILE); - fd->set_resizable(true); - List extensions; - ResourceLoader::get_recognized_extensions_for_type("Texture", &extensions); - for (List::Element *E = extensions.front(); E; E = E->next()) { - fd->add_filter("*." + E->get() + " ; " + E->get().to_upper()); - } - fd->connect("files_selected", this, "scenes_selected"); - - control->add_child(fd); - for (i = 0; i < obj->items.size(); i++) { - HBoxContainer *vcontrol = memnew(HBoxContainer); - Button *open_scene = memnew(Button); - open_scene->set_text("Select scene..."); - open_scene->connect("pressed", this, "open_scene", Node::make_binds(open_scene)); - open_scene->set_meta("what", &obj->items[i]); - vcontrol->add_child(open_scene); - Label *l1 = memnew(Label); - l1->set_text("scene path: "); - vcontrol->add_child(l1); - /* full instance */ - Label *l2 = memnew(Label); - l2->set_text("full instance: "); - vcontrol->add_child(l2); - CheckBox *cb1 = memnew(CheckBox); - vcontrol->add_child(cb1); - /* use collision */ - Label *l3 = memnew(Label); - l3->set_text("use collision: "); - vcontrol->add_child(l3); - CheckBox *cb2 = memnew(CheckBox); - vcontrol->add_child(cb2); - /* priority */ - Label *l4 = memnew(Label); - l4->set_text("priority: "); - vcontrol->add_child(l4); -#if 0 - SpinBox *sb1 = memnew(SpinBox); - vcontrol->add_child(sb1); -#endif - control->add_child(vcontrol); - } - Button *addbutton = memnew(Button); - addbutton->set_text("+"); - control->add_child(addbutton); - add_custom_control(control); -} - - diff --git a/modules/world/mesher/mesher.h b/modules/world/mesher/mesher.h deleted file mode 100644 index cf6b632..0000000 --- a/modules/world/mesher/mesher.h +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include -#include - -class CompoundTransvoxel: public VoxelMesherTransvoxel -{ - GDCLASS(CompoundTransvoxel, VoxelMesherTransvoxel) - friend class CompoundTransvoxelInspector; -protected: - struct place_item { - Ref scene; - String scene_path; - bool full_instance; - bool use_collision; - int priority; - }; - List items; -public: - CompoundTransvoxel(); - ~CompoundTransvoxel(); - void build(VoxelMesher::Output &output, const VoxelMesher::Input &input) override; - Ref duplicate(bool p_subresources = false) const override; - int get_used_channels_mask() const override; -protected: - static void _bind_methods(); -}; - -class CompoundTransvoxelInspector: public EditorInspectorPlugin { - GDCLASS(CompoundTransvoxelInspector, EditorInspectorPlugin) -public: - virtual bool can_handle(Object *p_object); - CompoundTransvoxelInspector(); -private: - EditorFileDialog *fd; -protected: - void open_scene(Object *button); - void scenes_selected(const PoolVector &p_paths); - void parse_begin(Object *p_object); - static void _bind_methods(); -}; - -class CompoundTransvoxelEditorPlugin : public EditorPlugin { - GDCLASS(CompoundTransvoxelEditorPlugin, EditorPlugin) -public: - virtual String get_name() const { return "CompoundTransvoxel"; } - - CompoundTransvoxelEditorPlugin(EditorNode *p_node) - { - Ref plugin; - plugin.instance(); - add_inspector_plugin(plugin); - } -}; -