Removed unused mesher

This commit is contained in:
Segey Lapin
2021-10-25 18:04:32 +03:00
parent 601c14fa87
commit 5e69025beb
2 changed files with 0 additions and 167 deletions

View File

@@ -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<Resource> 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<CompoundTransvoxel>(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<CompoundTransvoxel>(p_object) != NULL;
}
void CompoundTransvoxelInspector::scenes_selected(const PoolVector<String> &p_paths)
{
struct CompoundTransvoxel::place_item it;
for (int i = 0; i < p_paths.size(); i++) {
Ref<PackedScene> t = Ref<PackedScene>(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<CompoundTransvoxel>(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<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("Texture", &extensions);
for (List<String>::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);
}

View File

@@ -1,54 +0,0 @@
#include <modules/voxel/meshers/transvoxel/voxel_mesher_transvoxel.h>
#include <editor/editor_plugin.h>
#include <scene/resources/packed_scene.h>
class CompoundTransvoxel: public VoxelMesherTransvoxel
{
GDCLASS(CompoundTransvoxel, VoxelMesherTransvoxel)
friend class CompoundTransvoxelInspector;
protected:
struct place_item {
Ref<PackedScene> scene;
String scene_path;
bool full_instance;
bool use_collision;
int priority;
};
List<struct place_item> items;
public:
CompoundTransvoxel();
~CompoundTransvoxel();
void build(VoxelMesher::Output &output, const VoxelMesher::Input &input) override;
Ref<Resource> 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<String> &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<CompoundTransvoxelInspector> plugin;
plugin.instance();
add_inspector_plugin(plugin);
}
};