mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-28 14:47:13 +01:00
Work on the logic port for the rest of mdr ed's classes.
This commit is contained in:
parent
49d2b181a1
commit
b0c2deab78
@ -37,6 +37,11 @@ if 'TOOLS_ENABLED' in env["CPPDEFINES"]:
|
||||
module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_view_popup.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_view.cpp")
|
||||
|
||||
#module_env.add_source_files(env.modules_sources,"editor/mdi_ed_plugin.cpp")
|
||||
#module_env.add_source_files(env.modules_sources,"editor/mdi_ed.cpp")
|
||||
#module_env.add_source_files(env.modules_sources,"editor/mdi_gizmo_plugin.cpp")
|
||||
#module_env.add_source_files(env.modules_sources,"editor/mdi_gizmo.cpp")
|
||||
|
||||
module_env.add_source_files(env.modules_sources,"nodes/mesh_data_instance.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"nodes/mesh_data_instance_2d.cpp")
|
||||
|
||||
|
@ -22,6 +22,9 @@ SOFTWARE.
|
||||
|
||||
#include "mdi_ed.h"
|
||||
|
||||
#include "core/os/keyboard.h"
|
||||
#include "mdi_ed_plugin.h"
|
||||
|
||||
void MDIEd::_enter_tree() {
|
||||
/*
|
||||
uv_preview = get_node(uv_preview_path)
|
||||
@ -58,35 +61,35 @@ void MDIEd::set_mesh_data_instance(MeshDataInstance *a) {
|
||||
*/
|
||||
}
|
||||
void MDIEd::_unhandled_key_input(Ref<InputEventKey> event) {
|
||||
/*
|
||||
if event.echo:
|
||||
return
|
||||
if (event->is_echo()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if event.alt || event.shift || event.control || event.meta || event.command:
|
||||
return
|
||||
if (event->get_alt() || event->get_shift() || event->get_control() || event->get_metakey() || event->get_command()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if event.scancode == KEY_G:
|
||||
set_edit_mode_translate()
|
||||
elif event.scancode == KEY_H:
|
||||
set_edit_mode_rotate()
|
||||
elif event.scancode == KEY_J:
|
||||
set_edit_mode_scale()
|
||||
uint32_t scancode = event->get_scancode();
|
||||
|
||||
elif event.scancode == KEY_V:
|
||||
set_axis_x(!get_axis_x())
|
||||
elif event.scancode == KEY_B:
|
||||
set_axis_y(!get_axis_y())
|
||||
elif event.scancode == KEY_N:
|
||||
set_axis_z(!get_axis_z())
|
||||
|
||||
elif event.scancode == KEY_K:
|
||||
set_selection_mode_vertex()
|
||||
elif event.scancode == KEY_L:
|
||||
set_selection_mode_edge()
|
||||
elif event.scancode == KEY_SEMICOLON:
|
||||
set_selection_mode_face()
|
||||
|
||||
*/
|
||||
if (scancode == KEY_G) {
|
||||
set_edit_mode_translate();
|
||||
} else if (scancode == KEY_H) {
|
||||
set_edit_mode_rotate();
|
||||
} else if (scancode == KEY_J) {
|
||||
set_edit_mode_scale();
|
||||
} else if (scancode == KEY_V) {
|
||||
set_axis_x(!get_axis_x());
|
||||
} else if (scancode == KEY_B) {
|
||||
set_axis_y(!get_axis_y());
|
||||
} else if (scancode == KEY_N) {
|
||||
set_axis_z(!get_axis_z());
|
||||
} else if (scancode == KEY_K) {
|
||||
set_selection_mode_vertex();
|
||||
} else if (scancode == KEY_L) {
|
||||
set_selection_mode_edge();
|
||||
} else if (scancode == KEY_SEMICOLON) {
|
||||
set_selection_mode_face();
|
||||
}
|
||||
}
|
||||
|
||||
//Edit modes
|
||||
@ -107,25 +110,25 @@ void MDIEd::set_edit_mode_scale() {
|
||||
}
|
||||
|
||||
void MDIEd::on_edit_mode_translate_toggled(bool on) {
|
||||
/*
|
||||
if on:
|
||||
if _plugin:
|
||||
_plugin.set_translate()
|
||||
*/
|
||||
if (on) {
|
||||
if (_plugin) {
|
||||
_plugin->set_translate();
|
||||
}
|
||||
}
|
||||
}
|
||||
void MDIEd::on_edit_mode_rotate_toggled(bool on) {
|
||||
/*
|
||||
if on:
|
||||
if _plugin:
|
||||
_plugin.set_rotate()
|
||||
*/
|
||||
if (on) {
|
||||
if (_plugin) {
|
||||
_plugin->set_rotate();
|
||||
}
|
||||
}
|
||||
}
|
||||
void MDIEd::on_edit_mode_scale_toggled(bool on) {
|
||||
/*
|
||||
if on:
|
||||
if _plugin:
|
||||
_plugin.set_scale()
|
||||
*/
|
||||
if (on) {
|
||||
if (_plugin) {
|
||||
_plugin->set_scale();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//axis locks
|
||||
@ -161,45 +164,48 @@ void MDIEd::set_axis_z(bool on) {
|
||||
}
|
||||
|
||||
void MDIEd::on_axis_x_toggled(bool on) {
|
||||
/*
|
||||
if _plugin:
|
||||
_plugin.set_axis_x(on)
|
||||
*/
|
||||
if (on) {
|
||||
if (_plugin) {
|
||||
_plugin->set_axis_x(on);
|
||||
}
|
||||
}
|
||||
}
|
||||
void MDIEd::on_axis_y_toggled(bool on) {
|
||||
/*
|
||||
if _plugin:
|
||||
_plugin.set_axis_y(on)
|
||||
*/
|
||||
if (on) {
|
||||
if (_plugin) {
|
||||
_plugin->set_axis_y(on);
|
||||
}
|
||||
}
|
||||
}
|
||||
void MDIEd::on_axis_z_toggled(bool on) {
|
||||
/*
|
||||
if _plugin:
|
||||
_plugin.set_axis_z(on)
|
||||
*/
|
||||
if (on) {
|
||||
if (_plugin) {
|
||||
_plugin->set_axis_z(on);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//selection modes
|
||||
void MDIEd::on_selection_mode_vertex_toggled(bool on) {
|
||||
/*
|
||||
if on:
|
||||
if _plugin:
|
||||
_plugin.set_selection_mode_vertex()
|
||||
*/
|
||||
if (on) {
|
||||
if (_plugin) {
|
||||
_plugin->set_selection_mode_vertex();
|
||||
}
|
||||
}
|
||||
}
|
||||
void MDIEd::on_selection_mode_edge_toggled(bool on) {
|
||||
/*
|
||||
if on:
|
||||
if _plugin:
|
||||
_plugin.set_selection_mode_edge()
|
||||
*/
|
||||
if (on) {
|
||||
if (_plugin) {
|
||||
_plugin->set_selection_mode_edge();
|
||||
}
|
||||
}
|
||||
}
|
||||
void MDIEd::on_selection_mode_face_toggled(bool on) {
|
||||
/*
|
||||
if on:
|
||||
if _plugin:
|
||||
_plugin.set_selection_mode_face()
|
||||
*/
|
||||
if (on) {
|
||||
if (_plugin) {
|
||||
_plugin->set_selection_mode_face();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEd::set_selection_mode_vertex() {
|
||||
@ -219,109 +225,67 @@ void MDIEd::set_selection_mode_face() {
|
||||
}
|
||||
|
||||
void MDIEd::_on_Extrude_pressed() {
|
||||
/*
|
||||
_plugin.extrude()
|
||||
*/
|
||||
_plugin->extrude();
|
||||
}
|
||||
void MDIEd::_on_AddBox_pressed() {
|
||||
/*
|
||||
_plugin.add_box()
|
||||
*/
|
||||
_plugin->add_box();
|
||||
}
|
||||
void MDIEd::_on_UnwrapButton_pressed() {
|
||||
/*
|
||||
_plugin.uv_unwrap()
|
||||
*/
|
||||
_plugin->uv_unwrap();
|
||||
}
|
||||
void MDIEd::_on_add_triangle_pressed() {
|
||||
/*
|
||||
_plugin.add_triangle()
|
||||
*/
|
||||
_plugin->add_triangle();
|
||||
}
|
||||
void MDIEd::_on_add_quad_pressed() {
|
||||
/*
|
||||
_plugin.add_quad()
|
||||
*/
|
||||
_plugin->add_quad();
|
||||
}
|
||||
void MDIEd::_on_split_pressed() {
|
||||
/*
|
||||
_plugin.split()
|
||||
*/
|
||||
_plugin->split();
|
||||
}
|
||||
void MDIEd::_on_connect_to_first_selected_pressed() {
|
||||
/*
|
||||
_plugin.connect_to_first_selected()
|
||||
*/
|
||||
_plugin->connect_to_first_selected();
|
||||
}
|
||||
void MDIEd::_on_connect_to_avg_pressed() {
|
||||
/*
|
||||
_plugin.connect_to_avg()
|
||||
*/
|
||||
_plugin->connect_to_avg();
|
||||
}
|
||||
void MDIEd::_on_connect_to_last_selected_pressed() {
|
||||
/*
|
||||
_plugin.connect_to_last_selected()
|
||||
*/
|
||||
_plugin->connect_to_last_selected();
|
||||
}
|
||||
void MDIEd::_on_disconnect_pressed() {
|
||||
/*
|
||||
_plugin.disconnect_action()
|
||||
*/
|
||||
_plugin->disconnect_action();
|
||||
}
|
||||
void MDIEd::_on_add_triangle_at_pressed() {
|
||||
/*
|
||||
_plugin.add_triangle_at()
|
||||
*/
|
||||
_plugin->add_triangle_at();
|
||||
}
|
||||
void MDIEd::_on_add_auad_at_pressed() {
|
||||
/*
|
||||
_plugin.add_quad_at()
|
||||
*/
|
||||
_plugin->add_quad_at();
|
||||
}
|
||||
void MDIEd::_oncreate_face_pressed() {
|
||||
/*
|
||||
_plugin.create_face()
|
||||
*/
|
||||
_plugin->create_face();
|
||||
}
|
||||
void MDIEd::_on_delete_pressed() {
|
||||
/*
|
||||
_plugin.delete_selected()
|
||||
*/
|
||||
_plugin->delete_selected();
|
||||
}
|
||||
void MDIEd::_on_GenNormals_pressed() {
|
||||
/*
|
||||
_plugin.generate_normals()
|
||||
*/
|
||||
_plugin->generate_normals();
|
||||
}
|
||||
void MDIEd::_on_RemDoubles_pressed() {
|
||||
/*
|
||||
_plugin.remove_doubles()
|
||||
*/
|
||||
_plugin->remove_doubles();
|
||||
}
|
||||
void MDIEd::_on_MergeOptimize_pressed() {
|
||||
/*
|
||||
_plugin.merge_optimize()
|
||||
*/
|
||||
_plugin->merge_optimize();
|
||||
}
|
||||
void MDIEd::_on_GenTangents_pressed() {
|
||||
/*
|
||||
_plugin.generate_tangents()
|
||||
*/
|
||||
_plugin->generate_tangents();
|
||||
}
|
||||
void MDIEd::_on_mark_seam_pressed() {
|
||||
/*
|
||||
_plugin.mark_seam()
|
||||
*/
|
||||
_plugin->mark_seam();
|
||||
}
|
||||
void MDIEd::_on_unmark_seam_pressed() {
|
||||
/*
|
||||
_plugin.unmark_seam()
|
||||
*/
|
||||
_plugin->unmark_seam();
|
||||
}
|
||||
void MDIEd::_on_apply_seams_pressed() {
|
||||
/*
|
||||
_plugin.apply_seam()
|
||||
*/
|
||||
_plugin->apply_seam();
|
||||
}
|
||||
void MDIEd::_on_uv_edit_pressed() {
|
||||
/*
|
||||
@ -330,72 +294,52 @@ void MDIEd::_on_uv_edit_pressed() {
|
||||
}
|
||||
|
||||
void MDIEd::on_pivot_average_toggled(bool on) {
|
||||
/*
|
||||
if on:
|
||||
_plugin.set_pivot_averaged()
|
||||
*/
|
||||
if (on) {
|
||||
_plugin->set_pivot_averaged();
|
||||
}
|
||||
}
|
||||
void MDIEd::on_pivot_mdi_origin_toggled(bool on) {
|
||||
/*
|
||||
if on:
|
||||
_plugin.set_pivot_mdi_origin()
|
||||
*/
|
||||
if (on) {
|
||||
_plugin->set_pivot_mdi_origin();
|
||||
}
|
||||
}
|
||||
void MDIEd::on_pivot_world_origin_toggled(bool on) {
|
||||
if (on) {
|
||||
_plugin->set_pivot_world_origin();
|
||||
}
|
||||
/*
|
||||
if on:
|
||||
_plugin.set_pivot_world_origin()
|
||||
*/
|
||||
}
|
||||
void MDIEd::on_visual_indicator_outline_toggled(bool on) {
|
||||
/*
|
||||
_plugin.visual_indicator_outline_set(on)
|
||||
*/
|
||||
_plugin->visual_indicator_outline_set(on);
|
||||
}
|
||||
void MDIEd::on_visual_indicator_seam_toggled(bool on) {
|
||||
/*
|
||||
_plugin.visual_indicator_seam_set(on)
|
||||
*/
|
||||
_plugin->visual_indicator_seam_set(on);
|
||||
}
|
||||
void MDIEd::on_visual_indicator_handle_toggled(bool on) {
|
||||
/*
|
||||
_plugin.visual_indicator_handle_set(on)
|
||||
*/
|
||||
_plugin->visual_indicator_handle_set(on);
|
||||
}
|
||||
void MDIEd::_on_select_all_pressed() {
|
||||
/*
|
||||
_plugin.select_all()
|
||||
*/
|
||||
_plugin->select_all();
|
||||
}
|
||||
|
||||
void MDIEd::onhandle_selection_type_front_toggled(bool on) {
|
||||
/*
|
||||
if on:
|
||||
_plugin.handle_selection_type_front()
|
||||
*/
|
||||
_plugin->handle_selection_type_front();
|
||||
}
|
||||
void MDIEd::onhandle_selection_type_back_toggled(bool on) {
|
||||
/*
|
||||
if on:
|
||||
_plugin.handle_selection_type_back()
|
||||
*/
|
||||
_plugin->handle_selection_type_back();
|
||||
}
|
||||
void MDIEd::onhandle_selection_type_all_toggled(bool on) {
|
||||
/*
|
||||
if on:
|
||||
_plugin.handle_selection_type_all()
|
||||
*/
|
||||
_plugin->handle_selection_type_all();
|
||||
}
|
||||
|
||||
void MDIEd::_on_clean_mesh_pressed() {
|
||||
/*
|
||||
_plugin.clean_mesh()
|
||||
*/
|
||||
_plugin->clean_mesh();
|
||||
}
|
||||
void MDIEd::_on_flip_face_pressed() {
|
||||
/*
|
||||
_plugin.flip_selected_faces()
|
||||
*/
|
||||
_plugin->flip_selected_faces();
|
||||
}
|
||||
|
||||
MDIEd::MDIEd() {
|
||||
|
@ -25,6 +25,11 @@ SOFTWARE.
|
||||
|
||||
#include "scene/gui/control.h"
|
||||
|
||||
class EditorPlugin;
|
||||
class MeshDataResource;
|
||||
class MeshDataInstance;
|
||||
class MDIEdPlugin;
|
||||
|
||||
class MDIEd : public Control {
|
||||
GDCLASS(MDIEd, Control);
|
||||
|
||||
@ -106,7 +111,7 @@ public:
|
||||
MDIEd();
|
||||
~MDIEd();
|
||||
|
||||
EditorPlugin *_plugin;
|
||||
MDIEdPlugin *_plugin;
|
||||
|
||||
//export var uv_preview_path : NodePath
|
||||
//export var uv_editor_path : NodePath
|
||||
|
@ -22,391 +22,384 @@ SOFTWARE.
|
||||
|
||||
#include "mdi_ed_plugin.h"
|
||||
|
||||
#include "../nodes/mesh_data_instance.h"
|
||||
#include "mdi_ed.h"
|
||||
#include "mdi_gizmo.h"
|
||||
#include "mdi_gizmo_plugin.h"
|
||||
|
||||
void MDIEdPlugin::_enter_tree() {
|
||||
/*
|
||||
gizmo_plugin = MdiGizmoPlugin.new()
|
||||
mdi_ed_gui = MDIEdGui.instance()
|
||||
mdi_ed_gui.set_plugin(self)
|
||||
active_gizmos = []
|
||||
gizmo_plugin = memnew(MDIGizmoPlugin);
|
||||
mdi_ed_gui = memnew(MDIEd);
|
||||
mdi_ed_gui->set_plugin(this);
|
||||
active_gizmos.clear();
|
||||
|
||||
gizmo_plugin.plugin = self
|
||||
gizmo_plugin->plugin = this;
|
||||
|
||||
add_control_to_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT, mdi_ed_gui)
|
||||
mdi_ed_gui.hide()
|
||||
add_control_to_container(EditorPlugin::CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT, mdi_ed_gui);
|
||||
mdi_ed_gui->hide();
|
||||
|
||||
add_spatial_gizmo_plugin(gizmo_plugin)
|
||||
add_spatial_gizmo_plugin(gizmo_plugin);
|
||||
|
||||
set_input_event_forwarding_always_enabled()
|
||||
*/
|
||||
set_input_event_forwarding_always_enabled();
|
||||
}
|
||||
void MDIEdPlugin::_exit_tree() {
|
||||
/*
|
||||
#print("_exit_tree")
|
||||
//print("_exit_tree")
|
||||
|
||||
remove_spatial_gizmo_plugin(gizmo_plugin)
|
||||
#remove_control_from_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT, mdi_ed_gui)
|
||||
mdi_ed_gui.queue_free()
|
||||
pass
|
||||
*/
|
||||
remove_spatial_gizmo_plugin(gizmo_plugin);
|
||||
//remove_control_from_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT, mdi_ed_gui)
|
||||
mdi_ed_gui->queue_delete();
|
||||
}
|
||||
|
||||
bool MDIEdPlugin::handles(Object *object) {
|
||||
/*
|
||||
#print("disable_plugin")
|
||||
bool MDIEdPlugin::handles(Object *object) const {
|
||||
//print("disable_plugin")
|
||||
|
||||
if object is MeshDataInstance:
|
||||
return true
|
||||
if (object->is_class("MeshDataInstance")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
void MDIEdPlugin::edit(Object *object) {
|
||||
/*
|
||||
var mdi : MeshDataInstance = object as MeshDataInstance
|
||||
MeshDataInstance *mdi = Object::cast_to<MeshDataInstance>(object);
|
||||
|
||||
if mdi:
|
||||
if current_mesh_data_instance && mdi.gizmo && current_mesh_data_instance.gizmo:
|
||||
mdi.gizmo.transfer_state_from(current_mesh_data_instance.gizmo)
|
||||
if (mdi) {
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = mdi->get_gizmo();
|
||||
Ref<MDIGizmo> c = current_mesh_data_instance->get_gizmo();
|
||||
|
||||
mdi_ed_gui.set_mesh_data_resource(mdi.mesh_data)
|
||||
mdi_ed_gui.set_mesh_data_instance(mdi)
|
||||
if (g.is_valid() && c.is_valid()) {
|
||||
g->transfer_state_from(c);
|
||||
}
|
||||
}
|
||||
|
||||
current_mesh_data_instance = mdi
|
||||
*/
|
||||
mdi_ed_gui->set_mesh_data_resource(mdi->get_mesh_data());
|
||||
mdi_ed_gui->set_mesh_data_instance(mdi);
|
||||
}
|
||||
|
||||
current_mesh_data_instance = mdi;
|
||||
}
|
||||
void MDIEdPlugin::make_visible(bool visible) {
|
||||
/*
|
||||
#print("make_visible")
|
||||
if (visible) {
|
||||
mdi_ed_gui->show();
|
||||
}
|
||||
|
||||
if visible:
|
||||
mdi_ed_gui.show()
|
||||
else:
|
||||
#mdi_ed_gui.hide()
|
||||
#figure out how to hide it when something else gets selected, don't hide on unselect
|
||||
pass
|
||||
*/
|
||||
//else:
|
||||
// #mdi_ed_gui.hide()
|
||||
// #figure out how to hide it when something else gets selected, don't hide on unselect
|
||||
// pass
|
||||
}
|
||||
|
||||
void MDIEdPlugin::get_plugin_name() {
|
||||
/*
|
||||
return "mesh_data_resource_editor"
|
||||
*/
|
||||
String MDIEdPlugin::get_name() const {
|
||||
return "MeshDataResourceEditor";
|
||||
}
|
||||
|
||||
void MDIEdPlugin::register_gizmo(MDIGizmo *gizmo) {
|
||||
/*
|
||||
active_gizmos.append(gizmo)
|
||||
*/
|
||||
void MDIEdPlugin::register_gizmo(Ref<MDIGizmo> gizmo) {
|
||||
active_gizmos.push_back(gizmo);
|
||||
}
|
||||
void MDIEdPlugin::unregister_gizmo(MDIGizmo *gizmo) {
|
||||
/*
|
||||
for i in range(active_gizmos.size()):
|
||||
if active_gizmos[i] == gizmo:
|
||||
active_gizmos.remove(i)
|
||||
return
|
||||
*/
|
||||
void MDIEdPlugin::unregister_gizmo(Ref<MDIGizmo> gizmo) {
|
||||
for (int i = 0; i < active_gizmos.size(); ++i) {
|
||||
if (active_gizmos[i] == gizmo) {
|
||||
active_gizmos.remove(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::set_translate() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_translate()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->set_translate();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::set_scale() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_scale()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->set_scale();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::set_rotate() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_rotate()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->set_rotate();
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::set_axis_x(bool on) {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_axis_x(on)
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->set_axis_x(on);
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::set_axis_y(bool on) {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_axis_y(on)
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->set_axis_y(on);
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::set_axis_z(bool on) {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_axis_z(on)
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->set_axis_z(on);
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::set_selection_mode_vertex() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_selection_mode_vertex()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->set_selection_mode_vertex();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::set_selection_mode_edge() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_selection_mode_edge()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->set_selection_mode_edge();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::set_selection_mode_face() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_selection_mode_face()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->set_selection_mode_face();
|
||||
}
|
||||
}
|
||||
|
||||
Ref<MeshDataResource> MDIEdPlugin::get_mdr() {
|
||||
/*
|
||||
if current_mesh_data_instance:
|
||||
return current_mesh_data_instance.mesh_data
|
||||
if (current_mesh_data_instance) {
|
||||
return current_mesh_data_instance->get_mesh_data();
|
||||
}
|
||||
|
||||
return null
|
||||
*/
|
||||
return Ref<MeshDataResource>();
|
||||
}
|
||||
|
||||
bool MDIEdPlugin::forward_spatial_gui_input(int index, Camera *camera, const Ref<InputEvent> &p_event) {
|
||||
/*
|
||||
if (!is_instance_valid(current_mesh_data_instance)):
|
||||
current_mesh_data_instance = null
|
||||
if (!ObjectDB::instance_validate(current_mesh_data_instance)) {
|
||||
current_mesh_data_instance = nullptr;
|
||||
}
|
||||
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
if current_mesh_data_instance.gizmo.forward_spatial_gui_input(index, camera, event):
|
||||
return true
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
if (g.is_valid() && g->forward_spatial_gui_input(index, camera, p_event)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
void MDIEdPlugin::add_box() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.add_box()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->add_box();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::add_triangle() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.add_triangle()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->add_triangle();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::add_quad() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.add_quad()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->add_quad();
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::add_triangle_at() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.add_triangle_at()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->add_triangle_at();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::add_quad_at() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.add_quad_at()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->add_quad_at();
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::split() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.split()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->split();
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::connect_action() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.connect_action()
|
||||
*/
|
||||
}
|
||||
void MDIEdPlugin::disconnect_action() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.disconnect_action()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->disconnect_action();
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::create_face() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.create_face()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->create_face();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::delete_selected() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.delete_selected()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->delete_selected();
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::generate_normals() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.generate_normals()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->generate_normals();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::remove_doubles() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.remove_doubles()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->remove_doubles();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::merge_optimize() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.merge_optimize()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->merge_optimize();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::generate_tangents() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.generate_tangents()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->generate_tangents();
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::connect_to_first_selected() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.connect_to_first_selected()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->connect_to_first_selected();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::connect_to_avg() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.connect_to_avg()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->connect_to_avg();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::connect_to_last_selected() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.connect_to_last_selected()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->connect_to_last_selected();
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::mark_seam() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.mark_seam()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->mark_seam();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::unmark_seam() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.unmark_seam()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->unmark_seam();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::apply_seam() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.apply_seam()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->apply_seam();
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::uv_unwrap() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.uv_unwrap()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->uv_unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::set_pivot_averaged() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_pivot_averaged()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->set_pivot_averaged();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::set_pivot_mdi_origin() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_pivot_mdi_origin()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->set_translate();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::set_pivot_world_origin() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_pivot_world_origin()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->set_pivot_world_origin();
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::visual_indicator_outline_set(bool on) {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.visual_indicator_outline_set(on)
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->visual_indicator_outline_set(on);
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::visual_indicator_seam_set(bool on) {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.visual_indicator_seam_set(on)
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->visual_indicator_seam_set(on);
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::visual_indicator_handle_set(bool on) {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.visual_indicator_handle_set(on)
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->visual_indicator_handle_set(on);
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::select_all() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.select_all()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->select_all();
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::handle_selection_type_front() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.handle_selection_type_front()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->handle_selection_type_front();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::handle_selection_type_back() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.handle_selection_type_back()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->handle_selection_type_back();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::handle_selection_type_all() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.handle_selection_type_all()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->handle_selection_type_all();
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::extrude() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.extrude()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->extrude();
|
||||
}
|
||||
}
|
||||
void MDIEdPlugin::clean_mesh() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.clean_mesh()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->clean_mesh();
|
||||
}
|
||||
}
|
||||
|
||||
void MDIEdPlugin::flip_selected_faces() {
|
||||
/*
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.flip_selected_faces()
|
||||
*/
|
||||
if (current_mesh_data_instance) {
|
||||
Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
|
||||
g->flip_selected_faces();
|
||||
}
|
||||
}
|
||||
|
||||
MDIEdPlugin::MDIEdPlugin() {
|
||||
current_mesh_data_instance = nullptr;
|
||||
/*
|
||||
|
||||
const MDRMeshUtils = preload("res://addons/mesh_data_resource_editor/utilities/mdred_mesh_utils.gd")
|
||||
|
@ -27,27 +27,29 @@ SOFTWARE.
|
||||
|
||||
#include "core/os/input_event.h"
|
||||
|
||||
//TODO:
|
||||
//Remove gizmo registration, it's not needed anymore
|
||||
|
||||
class Camera;
|
||||
class MDIGizmo;
|
||||
class MeshDataResource;
|
||||
class MdiGizmoPlugin;
|
||||
class MDIGizmoPlugin;
|
||||
class MeshDataInstance;
|
||||
class MDIEd;
|
||||
|
||||
class MDIEdPlugin : public EditorPlugin {
|
||||
GDCLASS(MDIEdPlugin, EditorPlugin);
|
||||
|
||||
public:
|
||||
void _enter_tree();
|
||||
void _exit_tree();
|
||||
|
||||
bool handles(Object *object);
|
||||
bool handles(Object *object) const;
|
||||
void edit(Object *object);
|
||||
void make_visible(bool visible);
|
||||
|
||||
void get_plugin_name();
|
||||
String get_name() const;
|
||||
|
||||
void register_gizmo(MDIGizmo *gizmo);
|
||||
void unregister_gizmo(MDIGizmo *gizmo);
|
||||
void register_gizmo(Ref<MDIGizmo> gizmo);
|
||||
void unregister_gizmo(Ref<MDIGizmo> gizmo);
|
||||
|
||||
void set_translate();
|
||||
void set_scale();
|
||||
@ -74,7 +76,6 @@ public:
|
||||
|
||||
void split();
|
||||
|
||||
void connect_action();
|
||||
void disconnect_action();
|
||||
|
||||
void create_face();
|
||||
@ -117,12 +118,12 @@ public:
|
||||
MDIEdPlugin();
|
||||
~MDIEdPlugin();
|
||||
|
||||
MdiGizmoPlugin *gizmo_plugin;
|
||||
Control mdi_ed_gui;
|
||||
MDIGizmoPlugin *gizmo_plugin;
|
||||
MDIEd mdi_ed_gui;
|
||||
|
||||
Array active_gizmos;
|
||||
Vector<Ref<MDIGizmo>> active_gizmos;
|
||||
|
||||
Ref<MeshDataInstance> current_mesh_data_instance;
|
||||
MeshDataInstance *current_mesh_data_instance;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,7 @@ SOFTWARE.
|
||||
|
||||
class Camera;
|
||||
class MeshDataResource;
|
||||
class MeshOutlineGenerator;
|
||||
class MDREDMeshOutline;
|
||||
class InputEvent;
|
||||
class EditorPlugin;
|
||||
class UndoRedo;
|
||||
@ -83,14 +83,14 @@ public:
|
||||
|
||||
void select_all();
|
||||
|
||||
bool selection_click(int index, Camera *camera, const Ref<InputEvent> &event);
|
||||
bool selection_click(int index, Camera *camera, const Ref<InputEventMouse> &event);
|
||||
bool is_point_visible(Vector3 point_orig, Vector3 camera_pos, Transform gt);
|
||||
|
||||
void selection_click_select_front_or_back(int index, Camera *camera, const Ref<InputEvent> &event);
|
||||
void selection_click_select_through(int index, Camera *camera, const Ref<InputEvent> &event);
|
||||
void selection_drag(int index, Camera *camera, const Ref<InputEvent> &event);
|
||||
void selection_drag_rect_select_front_back(int index, Camera *camera, const Ref<InputEvent> &event);
|
||||
void selection_drag_rect_select_through(int index, Camera *camera, const Ref<InputEvent> &event);
|
||||
bool selection_click_select_front_or_back(int index, Camera *camera, const Ref<InputEventMouse> &event);
|
||||
bool selection_click_select_through(int index, Camera *camera, const Ref<InputEventMouse> &event);
|
||||
void selection_drag(int index, Camera *camera, const Ref<InputEventMouse> &event);
|
||||
void selection_drag_rect_select_front_back(int index, Camera *camera, const Ref<InputEventMouse> &event);
|
||||
void selection_drag_rect_select_through(int index, Camera *camera, const Ref<InputEventMouse> &event);
|
||||
bool forward_spatial_gui_input(int index, Camera *camera, const Ref<InputEvent> &event);
|
||||
void add_to_all_selected(Vector3 ofs);
|
||||
|
||||
@ -185,7 +185,7 @@ public:
|
||||
void set_pivot_mdi_origin();
|
||||
void set_pivot_world_origin();
|
||||
|
||||
void transfer_state_from(EditorSpatialGizmo *other);
|
||||
void transfer_state_from(const Ref<MDIGizmo> &other);
|
||||
|
||||
void visual_indicator_outline_set(bool on);
|
||||
void visual_indicator_seam_set(bool on);
|
||||
@ -224,7 +224,7 @@ public:
|
||||
Array _handle_to_vertex_map;
|
||||
PoolIntArray _selected_points;
|
||||
|
||||
Ref<MeshOutlineGenerator> _mesh_outline_generator;
|
||||
Ref<MDREDMeshOutline> _mesh_outline_generator;
|
||||
|
||||
bool _handle_drag_op;
|
||||
PoolVector3Array _drag_op_orig_verices;
|
||||
|
@ -22,6 +22,10 @@ SOFTWARE.
|
||||
|
||||
#include "mdi_gizmo_plugin.h"
|
||||
|
||||
#include "../nodes/mesh_data_instance.h"
|
||||
#include "mdi_gizmo.h"
|
||||
#include "mdi_ed_plugin.h"
|
||||
|
||||
String MDIGizmoPlugin::get_name() const {
|
||||
return "MDIGizmo";
|
||||
}
|
||||
@ -33,19 +37,21 @@ bool MDIGizmoPlugin::is_handle_highlighted(const EditorSpatialGizmo *p_gizmo, in
|
||||
}
|
||||
|
||||
Ref<EditorSpatialGizmo> MDIGizmoPlugin::create_gizmo(Spatial *p_spatial) {
|
||||
/*
|
||||
if spatial is MeshDataInstance:
|
||||
var gizmo = MDIGizmo.new()
|
||||
MeshDataInstance* mdi = Object::cast_to<MeshDataInstance>(p_spatial);
|
||||
|
||||
gizmo.set_editor_plugin(plugin)
|
||||
gizmo.set_spatial_node(spatial)
|
||||
gizmo.setup()
|
||||
plugin.register_gizmo(gizmo)
|
||||
if (mdi) {
|
||||
Ref<MDIGizmo> gizmo;
|
||||
gizmo.instance();
|
||||
|
||||
return gizmo
|
||||
else:
|
||||
return null
|
||||
*/
|
||||
gizmo->set_editor_plugin(plugin);
|
||||
gizmo->set_spatial_node(p_spatial);
|
||||
gizmo->setup();
|
||||
plugin->register_gizmo(gizmo);
|
||||
|
||||
return gizmo;
|
||||
} else {
|
||||
return Ref<EditorSpatialGizmo>();
|
||||
}
|
||||
}
|
||||
|
||||
MDIGizmoPlugin::MDIGizmoPlugin() {
|
||||
|
@ -90,8 +90,8 @@ void MDREDMeshOutline::generate(bool mark_outline, bool mark_handles) {
|
||||
if (mark_outline) {
|
||||
for (int i = 0; i < _indices.size(); i += 3) {
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
lines.append(get_vertex(_indices[i + j]));
|
||||
lines.append(get_vertex(_indices[i + ((j + 1) % 3)]));
|
||||
lines.push_back(get_vertex(_indices[i + j]));
|
||||
lines.push_back(get_vertex(_indices[i + ((j + 1) % 3)]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -102,20 +102,20 @@ void MDREDMeshOutline::generate(bool mark_outline, bool mark_handles) {
|
||||
|
||||
float l = marker_size;
|
||||
|
||||
lines.append(v + Vector3(l, 0, 0));
|
||||
lines.append(v + Vector3(-l, 0, 0));
|
||||
lines.append(v + Vector3(0, 0, l));
|
||||
lines.append(v + Vector3(0, 0, -l));
|
||||
lines.append(v + Vector3(0, l, 0));
|
||||
lines.append(v + Vector3(0, -l, 0));
|
||||
lines.push_back(v + Vector3(l, 0, 0));
|
||||
lines.push_back(v + Vector3(-l, 0, 0));
|
||||
lines.push_back(v + Vector3(0, 0, l));
|
||||
lines.push_back(v + Vector3(0, 0, -l));
|
||||
lines.push_back(v + Vector3(0, l, 0));
|
||||
lines.push_back(v + Vector3(0, -l, 0));
|
||||
}
|
||||
}
|
||||
|
||||
PoolIntArray seams = _mdr->get_seams();
|
||||
|
||||
for (int i = 0; i < seams.size(); i += 2) {
|
||||
seam_lines.append(get_vertex(seams[i]));
|
||||
seam_lines.append(get_vertex(seams[i + 1]));
|
||||
seam_lines.push_back(get_vertex(seams[i]));
|
||||
seam_lines.push_back(get_vertex(seams[i + 1]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,20 +135,20 @@ void MDREDMeshOutline::generate_mark_edges(bool mark_outline, bool mark_handles)
|
||||
Vector3 v1 = get_vertex(i1);
|
||||
|
||||
if (mark_outline) {
|
||||
lines.append(v0);
|
||||
lines.append(v1);
|
||||
lines.push_back(v0);
|
||||
lines.push_back(v1);
|
||||
}
|
||||
|
||||
if (mark_handles) {
|
||||
Vector3 pmid = v0.linear_interpolate(v1, 0.5);
|
||||
float l = marker_size;
|
||||
|
||||
lines.append(pmid + Vector3(l, 0, 0));
|
||||
lines.append(pmid + Vector3(-l, 0, 0));
|
||||
lines.append(pmid + Vector3(0, 0, l));
|
||||
lines.append(pmid + Vector3(0, 0, -l));
|
||||
lines.append(pmid + Vector3(0, l, 0));
|
||||
lines.append(pmid + Vector3(0, -l, 0));
|
||||
lines.push_back(pmid + Vector3(l, 0, 0));
|
||||
lines.push_back(pmid + Vector3(-l, 0, 0));
|
||||
lines.push_back(pmid + Vector3(0, 0, l));
|
||||
lines.push_back(pmid + Vector3(0, 0, -l));
|
||||
lines.push_back(pmid + Vector3(0, l, 0));
|
||||
lines.push_back(pmid + Vector3(0, -l, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -156,8 +156,8 @@ void MDREDMeshOutline::generate_mark_edges(bool mark_outline, bool mark_handles)
|
||||
PoolIntArray seams = _mdr->get_seams();
|
||||
|
||||
for (int i = 0; i < seams.size(); i += 2) {
|
||||
seam_lines.append(get_vertex(seams[i]));
|
||||
seam_lines.append(get_vertex(seams[i + 1]));
|
||||
seam_lines.push_back(get_vertex(seams[i]));
|
||||
seam_lines.push_back(get_vertex(seams[i + 1]));
|
||||
}
|
||||
}
|
||||
void MDREDMeshOutline::generate_mark_faces(bool mark_outline, bool mark_handles) {
|
||||
@ -170,8 +170,8 @@ void MDREDMeshOutline::generate_mark_faces(bool mark_outline, bool mark_handles)
|
||||
if (mark_outline) {
|
||||
for (int i = 0; i < _indices.size(); i += 3) {
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
lines.append(get_vertex(_indices[i + j]));
|
||||
lines.append(get_vertex(_indices[i + ((j + 1) % 3)]));
|
||||
lines.push_back(get_vertex(_indices[i + j]));
|
||||
lines.push_back(get_vertex(_indices[i + ((j + 1) % 3)]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -190,20 +190,20 @@ void MDREDMeshOutline::generate_mark_faces(bool mark_outline, bool mark_handles)
|
||||
pmid /= 3;
|
||||
float l = marker_size;
|
||||
|
||||
lines.append(pmid + Vector3(l, 0, 0));
|
||||
lines.append(pmid + Vector3(-l, 0, 0));
|
||||
lines.append(pmid + Vector3(0, 0, l));
|
||||
lines.append(pmid + Vector3(0, 0, -l));
|
||||
lines.append(pmid + Vector3(0, l, 0));
|
||||
lines.append(pmid + Vector3(0, -l, 0));
|
||||
lines.push_back(pmid + Vector3(l, 0, 0));
|
||||
lines.push_back(pmid + Vector3(-l, 0, 0));
|
||||
lines.push_back(pmid + Vector3(0, 0, l));
|
||||
lines.push_back(pmid + Vector3(0, 0, -l));
|
||||
lines.push_back(pmid + Vector3(0, l, 0));
|
||||
lines.push_back(pmid + Vector3(0, -l, 0));
|
||||
}
|
||||
}
|
||||
|
||||
PoolIntArray seams = _mdr->get_seams();
|
||||
|
||||
for (int i = 0; i < seams.size(); i += 2) {
|
||||
seam_lines.append(get_vertex(seams[i]));
|
||||
seam_lines.append(get_vertex(seams[i + 1]));
|
||||
seam_lines.push_back(get_vertex(seams[i]));
|
||||
seam_lines.push_back(get_vertex(seams[i + 1]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,8 +49,8 @@ public:
|
||||
|
||||
Ref<MeshDataResource> _mdr;
|
||||
|
||||
PoolVector3Array lines;
|
||||
PoolVector3Array seam_lines;
|
||||
Vector<Vector3> lines;
|
||||
Vector<Vector3> seam_lines;
|
||||
|
||||
PoolVector3Array _vertices;
|
||||
PoolVector3Array _normals;
|
||||
|
Loading…
Reference in New Issue
Block a user