mirror of
https://github.com/Relintai/voxelman.git
synced 2025-01-27 15:19:18 +01:00
Work on an editor plugin. Removed it from the build.
This commit is contained in:
parent
b0b38396c4
commit
6e8d135f0d
2
SCsub
2
SCsub
@ -58,6 +58,8 @@ sources = [
|
||||
|
||||
"clutter/ground_clutter.cpp",
|
||||
"clutter/ground_clutter_foliage.cpp",
|
||||
|
||||
#"prop_tool/prop_tool_editor_plugin.cpp",
|
||||
]
|
||||
|
||||
if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes':
|
||||
|
66
prop_tool/prop_tool_editor_plugin.cpp
Normal file
66
prop_tool/prop_tool_editor_plugin.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
#include "prop_tool_editor_plugin.h"
|
||||
|
||||
#include "editor/editor_scale.h"
|
||||
|
||||
void PropDataEditor::edit(const Ref<PropData> &prop) {
|
||||
}
|
||||
|
||||
|
||||
void PropDataEditor::_bind_methods() {
|
||||
}
|
||||
|
||||
PropDataEditor::PropDataEditor(EditorNode *p_editor) {
|
||||
set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
set_custom_minimum_size(Size2(0, 200) * EDSCALE);
|
||||
|
||||
Tree *tree = memnew(Tree);
|
||||
tree->set_custom_minimum_size(Size2(100, 0) * EDSCALE);
|
||||
add_child(tree);
|
||||
|
||||
ViewportContainer *container = memnew(ViewportContainer);
|
||||
container->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
container->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
container->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
add_child(container);
|
||||
|
||||
Viewport *viewport = memnew(Viewport);
|
||||
viewport->set_size(Size2(400, 400));
|
||||
container->add_child(viewport);
|
||||
|
||||
set_split_offset(200 * EDSCALE);
|
||||
}
|
||||
PropDataEditor::~PropDataEditor() {
|
||||
}
|
||||
|
||||
void PropDataEditorPlugin::edit(Object *p_object) {
|
||||
}
|
||||
|
||||
bool PropDataEditorPlugin::handles(Object *p_object) const {
|
||||
|
||||
bool handles = p_object->is_class("PropData");
|
||||
|
||||
if (handles) {
|
||||
prop_editor_button->show();
|
||||
} else {
|
||||
prop_editor_button->hide();
|
||||
}
|
||||
|
||||
return handles;
|
||||
}
|
||||
|
||||
void PropDataEditorPlugin::make_visible(bool p_visible) {
|
||||
}
|
||||
|
||||
PropDataEditorPlugin::PropDataEditorPlugin(EditorNode *p_node) {
|
||||
|
||||
editor = p_node;
|
||||
|
||||
prop_editor = memnew(PropDataEditor(editor));
|
||||
|
||||
prop_editor_button = add_control_to_bottom_panel(prop_editor, "Prop");
|
||||
|
||||
prop_editor->hide();
|
||||
}
|
||||
|
||||
PropDataEditorPlugin::~PropDataEditorPlugin() {
|
||||
}
|
54
prop_tool/prop_tool_editor_plugin.h
Normal file
54
prop_tool/prop_tool_editor_plugin.h
Normal file
@ -0,0 +1,54 @@
|
||||
#ifndef PROP_TOOL_EDITOR_PLUGIN_H
|
||||
#define PROP_TOOL_EDITOR_PLUGIN_H
|
||||
|
||||
#include "editor/editor_plugin.h"
|
||||
#include "editor/pane_drag.h"
|
||||
|
||||
#include "scene/gui/graph_edit.h"
|
||||
#include "scene/gui/menu_button.h"
|
||||
#include "scene/main/viewport.h"
|
||||
|
||||
#include "../props/prop_data.h"
|
||||
|
||||
#include "scene/gui/viewport_container.h"
|
||||
|
||||
#include "editor/plugins/spatial_editor_plugin.h"
|
||||
|
||||
class PropDataEditor : public HSplitContainer {
|
||||
GDCLASS(PropDataEditor, HSplitContainer);
|
||||
|
||||
public:
|
||||
void edit(const Ref<PropData> &prop);
|
||||
|
||||
PropDataEditor() {}
|
||||
PropDataEditor(EditorNode *p_editor);
|
||||
~PropDataEditor();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class PropDataEditorPlugin : public EditorPlugin {
|
||||
|
||||
GDCLASS(PropDataEditorPlugin, EditorPlugin);
|
||||
|
||||
public:
|
||||
virtual String get_name() const { return "PropData"; }
|
||||
bool has_main_screen() const { return false; }
|
||||
virtual void edit(Object *p_object);
|
||||
virtual bool handles(Object *p_object) const;
|
||||
virtual void make_visible(bool p_visible);
|
||||
|
||||
PropDataEditorPlugin(EditorNode *p_node);
|
||||
~PropDataEditorPlugin();
|
||||
|
||||
protected:
|
||||
private:
|
||||
PropDataEditor *prop_editor;
|
||||
ToolButton *prop_editor_button;
|
||||
EditorNode *editor;
|
||||
};
|
||||
|
||||
#endif
|
@ -43,6 +43,8 @@
|
||||
#include "clutter/ground_clutter.h"
|
||||
#include "clutter/ground_clutter_foliage.h"
|
||||
|
||||
//#include "prop_tool/prop_tool_editor_plugin.h"
|
||||
|
||||
void register_voxelman_types() {
|
||||
ClassDB::register_class<VoxelmanQueue>();
|
||||
ClassDB::register_class<VoxelmanUnboundedQueue>();
|
||||
@ -86,6 +88,10 @@ void register_voxelman_types() {
|
||||
ClassDB::register_class<WorldArea>();
|
||||
|
||||
ClassDB::register_class<GroundClutterFoliage>();
|
||||
|
||||
//#ifdef TOOLS_ENABLED
|
||||
// EditorPlugins::add_by_type<PropToolEditorPlugin>();
|
||||
//#endif
|
||||
}
|
||||
|
||||
void unregister_voxelman_types() {
|
||||
|
Loading…
Reference in New Issue
Block a user