Work on the logic port for the rest of mdr ed's classes.

This commit is contained in:
Relintai 2022-04-13 02:08:30 +02:00
parent 49d2b181a1
commit b0c2deab78
10 changed files with 1194 additions and 1165 deletions

View File

@ -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_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/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.cpp")
module_env.add_source_files(env.modules_sources,"nodes/mesh_data_instance_2d.cpp") module_env.add_source_files(env.modules_sources,"nodes/mesh_data_instance_2d.cpp")

View File

@ -22,6 +22,9 @@ SOFTWARE.
#include "mdi_ed.h" #include "mdi_ed.h"
#include "core/os/keyboard.h"
#include "mdi_ed_plugin.h"
void MDIEd::_enter_tree() { void MDIEd::_enter_tree() {
/* /*
uv_preview = get_node(uv_preview_path) 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) { void MDIEd::_unhandled_key_input(Ref<InputEventKey> event) {
/* if (event->is_echo()) {
if event.echo: return;
return }
if event.alt || event.shift || event.control || event.meta || event.command: if (event->get_alt() || event->get_shift() || event->get_control() || event->get_metakey() || event->get_command()) {
return return;
}
if event.scancode == KEY_G: uint32_t scancode = event->get_scancode();
set_edit_mode_translate()
elif event.scancode == KEY_H:
set_edit_mode_rotate()
elif event.scancode == KEY_J:
set_edit_mode_scale()
elif event.scancode == KEY_V: if (scancode == KEY_G) {
set_axis_x(!get_axis_x()) set_edit_mode_translate();
elif event.scancode == KEY_B: } else if (scancode == KEY_H) {
set_axis_y(!get_axis_y()) set_edit_mode_rotate();
elif event.scancode == KEY_N: } else if (scancode == KEY_J) {
set_axis_z(!get_axis_z()) set_edit_mode_scale();
} else if (scancode == KEY_V) {
elif event.scancode == KEY_K: set_axis_x(!get_axis_x());
set_selection_mode_vertex() } else if (scancode == KEY_B) {
elif event.scancode == KEY_L: set_axis_y(!get_axis_y());
set_selection_mode_edge() } else if (scancode == KEY_N) {
elif event.scancode == KEY_SEMICOLON: set_axis_z(!get_axis_z());
set_selection_mode_face() } 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 //Edit modes
@ -107,25 +110,25 @@ void MDIEd::set_edit_mode_scale() {
} }
void MDIEd::on_edit_mode_translate_toggled(bool on) { void MDIEd::on_edit_mode_translate_toggled(bool on) {
/* if (on) {
if on: if (_plugin) {
if _plugin: _plugin->set_translate();
_plugin.set_translate() }
*/ }
} }
void MDIEd::on_edit_mode_rotate_toggled(bool on) { void MDIEd::on_edit_mode_rotate_toggled(bool on) {
/* if (on) {
if on: if (_plugin) {
if _plugin: _plugin->set_rotate();
_plugin.set_rotate() }
*/ }
} }
void MDIEd::on_edit_mode_scale_toggled(bool on) { void MDIEd::on_edit_mode_scale_toggled(bool on) {
/* if (on) {
if on: if (_plugin) {
if _plugin: _plugin->set_scale();
_plugin.set_scale() }
*/ }
} }
//axis locks //axis locks
@ -161,45 +164,48 @@ void MDIEd::set_axis_z(bool on) {
} }
void MDIEd::on_axis_x_toggled(bool on) { void MDIEd::on_axis_x_toggled(bool on) {
/* if (on) {
if _plugin: if (_plugin) {
_plugin.set_axis_x(on) _plugin->set_axis_x(on);
*/ }
}
} }
void MDIEd::on_axis_y_toggled(bool on) { void MDIEd::on_axis_y_toggled(bool on) {
/* if (on) {
if _plugin: if (_plugin) {
_plugin.set_axis_y(on) _plugin->set_axis_y(on);
*/ }
}
} }
void MDIEd::on_axis_z_toggled(bool on) { void MDIEd::on_axis_z_toggled(bool on) {
/* if (on) {
if _plugin: if (_plugin) {
_plugin.set_axis_z(on) _plugin->set_axis_z(on);
*/ }
}
} }
//selection modes //selection modes
void MDIEd::on_selection_mode_vertex_toggled(bool on) { void MDIEd::on_selection_mode_vertex_toggled(bool on) {
/* if (on) {
if on: if (_plugin) {
if _plugin: _plugin->set_selection_mode_vertex();
_plugin.set_selection_mode_vertex() }
*/ }
} }
void MDIEd::on_selection_mode_edge_toggled(bool on) { void MDIEd::on_selection_mode_edge_toggled(bool on) {
/* if (on) {
if on: if (_plugin) {
if _plugin: _plugin->set_selection_mode_edge();
_plugin.set_selection_mode_edge() }
*/ }
} }
void MDIEd::on_selection_mode_face_toggled(bool on) { void MDIEd::on_selection_mode_face_toggled(bool on) {
/* if (on) {
if on: if (_plugin) {
if _plugin: _plugin->set_selection_mode_face();
_plugin.set_selection_mode_face() }
*/ }
} }
void MDIEd::set_selection_mode_vertex() { void MDIEd::set_selection_mode_vertex() {
@ -219,109 +225,67 @@ void MDIEd::set_selection_mode_face() {
} }
void MDIEd::_on_Extrude_pressed() { void MDIEd::_on_Extrude_pressed() {
/* _plugin->extrude();
_plugin.extrude()
*/
} }
void MDIEd::_on_AddBox_pressed() { void MDIEd::_on_AddBox_pressed() {
/* _plugin->add_box();
_plugin.add_box()
*/
} }
void MDIEd::_on_UnwrapButton_pressed() { void MDIEd::_on_UnwrapButton_pressed() {
/* _plugin->uv_unwrap();
_plugin.uv_unwrap()
*/
} }
void MDIEd::_on_add_triangle_pressed() { void MDIEd::_on_add_triangle_pressed() {
/* _plugin->add_triangle();
_plugin.add_triangle()
*/
} }
void MDIEd::_on_add_quad_pressed() { void MDIEd::_on_add_quad_pressed() {
/* _plugin->add_quad();
_plugin.add_quad()
*/
} }
void MDIEd::_on_split_pressed() { void MDIEd::_on_split_pressed() {
/* _plugin->split();
_plugin.split()
*/
} }
void MDIEd::_on_connect_to_first_selected_pressed() { 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() { void MDIEd::_on_connect_to_avg_pressed() {
/* _plugin->connect_to_avg();
_plugin.connect_to_avg()
*/
} }
void MDIEd::_on_connect_to_last_selected_pressed() { void MDIEd::_on_connect_to_last_selected_pressed() {
/* _plugin->connect_to_last_selected();
_plugin.connect_to_last_selected()
*/
} }
void MDIEd::_on_disconnect_pressed() { void MDIEd::_on_disconnect_pressed() {
/* _plugin->disconnect_action();
_plugin.disconnect_action()
*/
} }
void MDIEd::_on_add_triangle_at_pressed() { void MDIEd::_on_add_triangle_at_pressed() {
/* _plugin->add_triangle_at();
_plugin.add_triangle_at()
*/
} }
void MDIEd::_on_add_auad_at_pressed() { void MDIEd::_on_add_auad_at_pressed() {
/* _plugin->add_quad_at();
_plugin.add_quad_at()
*/
} }
void MDIEd::_oncreate_face_pressed() { void MDIEd::_oncreate_face_pressed() {
/* _plugin->create_face();
_plugin.create_face()
*/
} }
void MDIEd::_on_delete_pressed() { void MDIEd::_on_delete_pressed() {
/* _plugin->delete_selected();
_plugin.delete_selected()
*/
} }
void MDIEd::_on_GenNormals_pressed() { void MDIEd::_on_GenNormals_pressed() {
/* _plugin->generate_normals();
_plugin.generate_normals()
*/
} }
void MDIEd::_on_RemDoubles_pressed() { void MDIEd::_on_RemDoubles_pressed() {
/* _plugin->remove_doubles();
_plugin.remove_doubles()
*/
} }
void MDIEd::_on_MergeOptimize_pressed() { void MDIEd::_on_MergeOptimize_pressed() {
/* _plugin->merge_optimize();
_plugin.merge_optimize()
*/
} }
void MDIEd::_on_GenTangents_pressed() { void MDIEd::_on_GenTangents_pressed() {
/* _plugin->generate_tangents();
_plugin.generate_tangents()
*/
} }
void MDIEd::_on_mark_seam_pressed() { void MDIEd::_on_mark_seam_pressed() {
/* _plugin->mark_seam();
_plugin.mark_seam()
*/
} }
void MDIEd::_on_unmark_seam_pressed() { void MDIEd::_on_unmark_seam_pressed() {
/* _plugin->unmark_seam();
_plugin.unmark_seam()
*/
} }
void MDIEd::_on_apply_seams_pressed() { void MDIEd::_on_apply_seams_pressed() {
/* _plugin->apply_seam();
_plugin.apply_seam()
*/
} }
void MDIEd::_on_uv_edit_pressed() { void MDIEd::_on_uv_edit_pressed() {
/* /*
@ -330,72 +294,52 @@ void MDIEd::_on_uv_edit_pressed() {
} }
void MDIEd::on_pivot_average_toggled(bool on) { void MDIEd::on_pivot_average_toggled(bool on) {
/* if (on) {
if on: _plugin->set_pivot_averaged();
_plugin.set_pivot_averaged() }
*/
} }
void MDIEd::on_pivot_mdi_origin_toggled(bool on) { void MDIEd::on_pivot_mdi_origin_toggled(bool on) {
/* if (on) {
if on: _plugin->set_pivot_mdi_origin();
_plugin.set_pivot_mdi_origin() }
*/
} }
void MDIEd::on_pivot_world_origin_toggled(bool on) { void MDIEd::on_pivot_world_origin_toggled(bool on) {
if (on) {
_plugin->set_pivot_world_origin();
}
/* /*
if on: if on:
_plugin.set_pivot_world_origin() _plugin.set_pivot_world_origin()
*/ */
} }
void MDIEd::on_visual_indicator_outline_toggled(bool on) { 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) { 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) { 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() { void MDIEd::_on_select_all_pressed() {
/* _plugin->select_all();
_plugin.select_all()
*/
} }
void MDIEd::onhandle_selection_type_front_toggled(bool on) { void MDIEd::onhandle_selection_type_front_toggled(bool on) {
/* _plugin->handle_selection_type_front();
if on:
_plugin.handle_selection_type_front()
*/
} }
void MDIEd::onhandle_selection_type_back_toggled(bool on) { void MDIEd::onhandle_selection_type_back_toggled(bool on) {
/* _plugin->handle_selection_type_back();
if on:
_plugin.handle_selection_type_back()
*/
} }
void MDIEd::onhandle_selection_type_all_toggled(bool on) { void MDIEd::onhandle_selection_type_all_toggled(bool on) {
/* _plugin->handle_selection_type_all();
if on:
_plugin.handle_selection_type_all()
*/
} }
void MDIEd::_on_clean_mesh_pressed() { void MDIEd::_on_clean_mesh_pressed() {
/* _plugin->clean_mesh();
_plugin.clean_mesh()
*/
} }
void MDIEd::_on_flip_face_pressed() { void MDIEd::_on_flip_face_pressed() {
/* _plugin->flip_selected_faces();
_plugin.flip_selected_faces()
*/
} }
MDIEd::MDIEd() { MDIEd::MDIEd() {

View File

@ -25,6 +25,11 @@ SOFTWARE.
#include "scene/gui/control.h" #include "scene/gui/control.h"
class EditorPlugin;
class MeshDataResource;
class MeshDataInstance;
class MDIEdPlugin;
class MDIEd : public Control { class MDIEd : public Control {
GDCLASS(MDIEd, Control); GDCLASS(MDIEd, Control);
@ -106,7 +111,7 @@ public:
MDIEd(); MDIEd();
~MDIEd(); ~MDIEd();
EditorPlugin *_plugin; MDIEdPlugin *_plugin;
//export var uv_preview_path : NodePath //export var uv_preview_path : NodePath
//export var uv_editor_path : NodePath //export var uv_editor_path : NodePath

View File

@ -22,391 +22,384 @@ SOFTWARE.
#include "mdi_ed_plugin.h" #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() { void MDIEdPlugin::_enter_tree() {
/* gizmo_plugin = memnew(MDIGizmoPlugin);
gizmo_plugin = MdiGizmoPlugin.new() mdi_ed_gui = memnew(MDIEd);
mdi_ed_gui = MDIEdGui.instance() mdi_ed_gui->set_plugin(this);
mdi_ed_gui.set_plugin(self) active_gizmos.clear();
active_gizmos = []
gizmo_plugin.plugin = self gizmo_plugin->plugin = this;
add_control_to_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT, mdi_ed_gui) add_control_to_container(EditorPlugin::CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT, mdi_ed_gui);
mdi_ed_gui.hide() 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() { void MDIEdPlugin::_exit_tree() {
/* //print("_exit_tree")
#print("_exit_tree")
remove_spatial_gizmo_plugin(gizmo_plugin) remove_spatial_gizmo_plugin(gizmo_plugin);
#remove_control_from_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT, mdi_ed_gui) //remove_control_from_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT, mdi_ed_gui)
mdi_ed_gui.queue_free() mdi_ed_gui->queue_delete();
pass
*/
} }
bool MDIEdPlugin::handles(Object *object) { bool MDIEdPlugin::handles(Object *object) const {
/* //print("disable_plugin")
#print("disable_plugin")
if object is MeshDataInstance: if (object->is_class("MeshDataInstance")) {
return true return true;
}
return false return false;
*/
} }
void MDIEdPlugin::edit(Object *object) { void MDIEdPlugin::edit(Object *object) {
/* MeshDataInstance *mdi = Object::cast_to<MeshDataInstance>(object);
var mdi : MeshDataInstance = object as MeshDataInstance
if mdi: if (mdi) {
if current_mesh_data_instance && mdi.gizmo && current_mesh_data_instance.gizmo: if (current_mesh_data_instance) {
mdi.gizmo.transfer_state_from(current_mesh_data_instance.gizmo) 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) if (g.is_valid() && c.is_valid()) {
mdi_ed_gui.set_mesh_data_instance(mdi) 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) { void MDIEdPlugin::make_visible(bool visible) {
/* if (visible) {
#print("make_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
*/
} }
void MDIEdPlugin::get_plugin_name() { //else:
/* // #mdi_ed_gui.hide()
return "mesh_data_resource_editor" // #figure out how to hide it when something else gets selected, don't hide on unselect
*/ // pass
} }
void MDIEdPlugin::register_gizmo(MDIGizmo *gizmo) { String MDIEdPlugin::get_name() const {
/* return "MeshDataResourceEditor";
active_gizmos.append(gizmo) }
*/
void MDIEdPlugin::register_gizmo(Ref<MDIGizmo> gizmo) {
active_gizmos.push_back(gizmo);
}
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::unregister_gizmo(MDIGizmo *gizmo) {
/*
for i in range(active_gizmos.size()):
if active_gizmos[i] == gizmo:
active_gizmos.remove(i)
return
*/
} }
void MDIEdPlugin::set_translate() { void MDIEdPlugin::set_translate() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.set_translate() g->set_translate();
*/ }
} }
void MDIEdPlugin::set_scale() { void MDIEdPlugin::set_scale() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.set_scale() g->set_scale();
*/ }
} }
void MDIEdPlugin::set_rotate() { void MDIEdPlugin::set_rotate() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.set_rotate() g->set_rotate();
*/ }
} }
void MDIEdPlugin::set_axis_x(bool on) { void MDIEdPlugin::set_axis_x(bool on) {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.set_axis_x(on) g->set_axis_x(on);
*/ }
} }
void MDIEdPlugin::set_axis_y(bool on) { void MDIEdPlugin::set_axis_y(bool on) {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.set_axis_y(on) g->set_axis_y(on);
*/ }
} }
void MDIEdPlugin::set_axis_z(bool on) { void MDIEdPlugin::set_axis_z(bool on) {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.set_axis_z(on) g->set_axis_z(on);
*/ }
} }
void MDIEdPlugin::set_selection_mode_vertex() { void MDIEdPlugin::set_selection_mode_vertex() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.set_selection_mode_vertex() g->set_selection_mode_vertex();
*/ }
} }
void MDIEdPlugin::set_selection_mode_edge() { void MDIEdPlugin::set_selection_mode_edge() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.set_selection_mode_edge() g->set_selection_mode_edge();
*/ }
} }
void MDIEdPlugin::set_selection_mode_face() { void MDIEdPlugin::set_selection_mode_face() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.set_selection_mode_face() g->set_selection_mode_face();
*/ }
} }
Ref<MeshDataResource> MDIEdPlugin::get_mdr() { Ref<MeshDataResource> MDIEdPlugin::get_mdr() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance: return current_mesh_data_instance->get_mesh_data();
return current_mesh_data_instance.mesh_data }
return null return Ref<MeshDataResource>();
*/
} }
bool MDIEdPlugin::forward_spatial_gui_input(int index, Camera *camera, const Ref<InputEvent> &p_event) { bool MDIEdPlugin::forward_spatial_gui_input(int index, Camera *camera, const Ref<InputEvent> &p_event) {
/* if (!ObjectDB::instance_validate(current_mesh_data_instance)) {
if (!is_instance_valid(current_mesh_data_instance)): current_mesh_data_instance = nullptr;
current_mesh_data_instance = null }
if current_mesh_data_instance && current_mesh_data_instance.gizmo: if (current_mesh_data_instance) {
if current_mesh_data_instance.gizmo.forward_spatial_gui_input(index, camera, event): Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
return true if (g.is_valid() && g->forward_spatial_gui_input(index, camera, p_event)) {
return true;
}
}
return false return false;
*/
} }
void MDIEdPlugin::add_box() { void MDIEdPlugin::add_box() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.add_box() g->add_box();
*/ }
} }
void MDIEdPlugin::add_triangle() { void MDIEdPlugin::add_triangle() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.add_triangle() g->add_triangle();
*/ }
} }
void MDIEdPlugin::add_quad() { void MDIEdPlugin::add_quad() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.add_quad() g->add_quad();
*/ }
} }
void MDIEdPlugin::add_triangle_at() { void MDIEdPlugin::add_triangle_at() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.add_triangle_at() g->add_triangle_at();
*/ }
} }
void MDIEdPlugin::add_quad_at() { void MDIEdPlugin::add_quad_at() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.add_quad_at() g->add_quad_at();
*/ }
} }
void MDIEdPlugin::split() { void MDIEdPlugin::split() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.split() 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() { void MDIEdPlugin::disconnect_action() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.disconnect_action() g->disconnect_action();
*/ }
} }
void MDIEdPlugin::create_face() { void MDIEdPlugin::create_face() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.create_face() g->create_face();
*/ }
} }
void MDIEdPlugin::delete_selected() { void MDIEdPlugin::delete_selected() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.delete_selected() g->delete_selected();
*/ }
} }
void MDIEdPlugin::generate_normals() { void MDIEdPlugin::generate_normals() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.generate_normals() g->generate_normals();
*/ }
} }
void MDIEdPlugin::remove_doubles() { void MDIEdPlugin::remove_doubles() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.remove_doubles() g->remove_doubles();
*/ }
} }
void MDIEdPlugin::merge_optimize() { void MDIEdPlugin::merge_optimize() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.merge_optimize() g->merge_optimize();
*/ }
} }
void MDIEdPlugin::generate_tangents() { void MDIEdPlugin::generate_tangents() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.generate_tangents() g->generate_tangents();
*/ }
} }
void MDIEdPlugin::connect_to_first_selected() { void MDIEdPlugin::connect_to_first_selected() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.connect_to_first_selected() g->connect_to_first_selected();
*/ }
} }
void MDIEdPlugin::connect_to_avg() { void MDIEdPlugin::connect_to_avg() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.connect_to_avg() g->connect_to_avg();
*/ }
} }
void MDIEdPlugin::connect_to_last_selected() { void MDIEdPlugin::connect_to_last_selected() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.connect_to_last_selected() g->connect_to_last_selected();
*/ }
} }
void MDIEdPlugin::mark_seam() { void MDIEdPlugin::mark_seam() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.mark_seam() g->mark_seam();
*/ }
} }
void MDIEdPlugin::unmark_seam() { void MDIEdPlugin::unmark_seam() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.unmark_seam() g->unmark_seam();
*/ }
} }
void MDIEdPlugin::apply_seam() { void MDIEdPlugin::apply_seam() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.apply_seam() g->apply_seam();
*/ }
} }
void MDIEdPlugin::uv_unwrap() { void MDIEdPlugin::uv_unwrap() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.uv_unwrap() g->uv_unwrap();
*/ }
} }
void MDIEdPlugin::set_pivot_averaged() { void MDIEdPlugin::set_pivot_averaged() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.set_pivot_averaged() g->set_pivot_averaged();
*/ }
} }
void MDIEdPlugin::set_pivot_mdi_origin() { void MDIEdPlugin::set_pivot_mdi_origin() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.set_pivot_mdi_origin() g->set_translate();
*/ }
} }
void MDIEdPlugin::set_pivot_world_origin() { void MDIEdPlugin::set_pivot_world_origin() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.set_pivot_world_origin() g->set_pivot_world_origin();
*/ }
} }
void MDIEdPlugin::visual_indicator_outline_set(bool on) { void MDIEdPlugin::visual_indicator_outline_set(bool on) {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.visual_indicator_outline_set(on) g->visual_indicator_outline_set(on);
*/ }
} }
void MDIEdPlugin::visual_indicator_seam_set(bool on) { void MDIEdPlugin::visual_indicator_seam_set(bool on) {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.visual_indicator_seam_set(on) g->visual_indicator_seam_set(on);
*/ }
} }
void MDIEdPlugin::visual_indicator_handle_set(bool on) { void MDIEdPlugin::visual_indicator_handle_set(bool on) {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.visual_indicator_handle_set(on) g->visual_indicator_handle_set(on);
*/ }
} }
void MDIEdPlugin::select_all() { void MDIEdPlugin::select_all() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.select_all() g->select_all();
*/ }
} }
void MDIEdPlugin::handle_selection_type_front() { void MDIEdPlugin::handle_selection_type_front() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.handle_selection_type_front() g->handle_selection_type_front();
*/ }
} }
void MDIEdPlugin::handle_selection_type_back() { void MDIEdPlugin::handle_selection_type_back() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.handle_selection_type_back() g->handle_selection_type_back();
*/ }
} }
void MDIEdPlugin::handle_selection_type_all() { void MDIEdPlugin::handle_selection_type_all() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.handle_selection_type_all() g->handle_selection_type_all();
*/ }
} }
void MDIEdPlugin::extrude() { void MDIEdPlugin::extrude() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.extrude() g->extrude();
*/ }
} }
void MDIEdPlugin::clean_mesh() { void MDIEdPlugin::clean_mesh() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.clean_mesh() g->clean_mesh();
*/ }
} }
void MDIEdPlugin::flip_selected_faces() { void MDIEdPlugin::flip_selected_faces() {
/* if (current_mesh_data_instance) {
if current_mesh_data_instance && current_mesh_data_instance.gizmo: Ref<MDIGizmo> g = current_mesh_data_instance->get_gizmo();
current_mesh_data_instance.gizmo.flip_selected_faces() g->flip_selected_faces();
*/ }
} }
MDIEdPlugin::MDIEdPlugin() { MDIEdPlugin::MDIEdPlugin() {
current_mesh_data_instance = nullptr;
/* /*
const MDRMeshUtils = preload("res://addons/mesh_data_resource_editor/utilities/mdred_mesh_utils.gd") const MDRMeshUtils = preload("res://addons/mesh_data_resource_editor/utilities/mdred_mesh_utils.gd")

View File

@ -27,27 +27,29 @@ SOFTWARE.
#include "core/os/input_event.h" #include "core/os/input_event.h"
//TODO:
//Remove gizmo registration, it's not needed anymore
class Camera; class Camera;
class MDIGizmo; class MDIGizmo;
class MeshDataResource; class MeshDataResource;
class MdiGizmoPlugin; class MDIGizmoPlugin;
class MeshDataInstance; class MeshDataInstance;
class MDIEd;
class MDIEdPlugin : public EditorPlugin { class MDIEdPlugin : public EditorPlugin {
GDCLASS(MDIEdPlugin, EditorPlugin);
public: public:
void _enter_tree(); void _enter_tree();
void _exit_tree(); void _exit_tree();
bool handles(Object *object); bool handles(Object *object) const;
void edit(Object *object); void edit(Object *object);
void make_visible(bool visible); void make_visible(bool visible);
void get_plugin_name(); String get_name() const;
void register_gizmo(MDIGizmo *gizmo); void register_gizmo(Ref<MDIGizmo> gizmo);
void unregister_gizmo(MDIGizmo *gizmo); void unregister_gizmo(Ref<MDIGizmo> gizmo);
void set_translate(); void set_translate();
void set_scale(); void set_scale();
@ -74,7 +76,6 @@ public:
void split(); void split();
void connect_action();
void disconnect_action(); void disconnect_action();
void create_face(); void create_face();
@ -117,12 +118,12 @@ public:
MDIEdPlugin(); MDIEdPlugin();
~MDIEdPlugin(); ~MDIEdPlugin();
MdiGizmoPlugin *gizmo_plugin; MDIGizmoPlugin *gizmo_plugin;
Control mdi_ed_gui; MDIEd mdi_ed_gui;
Array active_gizmos; Vector<Ref<MDIGizmo>> active_gizmos;
Ref<MeshDataInstance> current_mesh_data_instance; MeshDataInstance *current_mesh_data_instance;
protected: protected:
static void _bind_methods(); static void _bind_methods();

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ SOFTWARE.
class Camera; class Camera;
class MeshDataResource; class MeshDataResource;
class MeshOutlineGenerator; class MDREDMeshOutline;
class InputEvent; class InputEvent;
class EditorPlugin; class EditorPlugin;
class UndoRedo; class UndoRedo;
@ -83,14 +83,14 @@ public:
void select_all(); 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); 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); bool selection_click_select_front_or_back(int index, Camera *camera, const Ref<InputEventMouse> &event);
void selection_click_select_through(int index, Camera *camera, const Ref<InputEvent> &event); bool selection_click_select_through(int index, Camera *camera, const Ref<InputEventMouse> &event);
void selection_drag(int index, Camera *camera, const Ref<InputEvent> &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<InputEvent> &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<InputEvent> &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); bool forward_spatial_gui_input(int index, Camera *camera, const Ref<InputEvent> &event);
void add_to_all_selected(Vector3 ofs); void add_to_all_selected(Vector3 ofs);
@ -185,7 +185,7 @@ public:
void set_pivot_mdi_origin(); void set_pivot_mdi_origin();
void set_pivot_world_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_outline_set(bool on);
void visual_indicator_seam_set(bool on); void visual_indicator_seam_set(bool on);
@ -224,7 +224,7 @@ public:
Array _handle_to_vertex_map; Array _handle_to_vertex_map;
PoolIntArray _selected_points; PoolIntArray _selected_points;
Ref<MeshOutlineGenerator> _mesh_outline_generator; Ref<MDREDMeshOutline> _mesh_outline_generator;
bool _handle_drag_op; bool _handle_drag_op;
PoolVector3Array _drag_op_orig_verices; PoolVector3Array _drag_op_orig_verices;

View File

@ -22,6 +22,10 @@ SOFTWARE.
#include "mdi_gizmo_plugin.h" #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 { String MDIGizmoPlugin::get_name() const {
return "MDIGizmo"; return "MDIGizmo";
} }
@ -33,19 +37,21 @@ bool MDIGizmoPlugin::is_handle_highlighted(const EditorSpatialGizmo *p_gizmo, in
} }
Ref<EditorSpatialGizmo> MDIGizmoPlugin::create_gizmo(Spatial *p_spatial) { Ref<EditorSpatialGizmo> MDIGizmoPlugin::create_gizmo(Spatial *p_spatial) {
/* MeshDataInstance* mdi = Object::cast_to<MeshDataInstance>(p_spatial);
if spatial is MeshDataInstance:
var gizmo = MDIGizmo.new()
gizmo.set_editor_plugin(plugin) if (mdi) {
gizmo.set_spatial_node(spatial) Ref<MDIGizmo> gizmo;
gizmo.setup() gizmo.instance();
plugin.register_gizmo(gizmo)
return gizmo gizmo->set_editor_plugin(plugin);
else: gizmo->set_spatial_node(p_spatial);
return null gizmo->setup();
*/ plugin->register_gizmo(gizmo);
return gizmo;
} else {
return Ref<EditorSpatialGizmo>();
}
} }
MDIGizmoPlugin::MDIGizmoPlugin() { MDIGizmoPlugin::MDIGizmoPlugin() {

View File

@ -90,8 +90,8 @@ void MDREDMeshOutline::generate(bool mark_outline, bool mark_handles) {
if (mark_outline) { if (mark_outline) {
for (int i = 0; i < _indices.size(); i += 3) { for (int i = 0; i < _indices.size(); i += 3) {
for (int j = 0; j < 4; ++j) { for (int j = 0; j < 4; ++j) {
lines.append(get_vertex(_indices[i + j])); lines.push_back(get_vertex(_indices[i + j]));
lines.append(get_vertex(_indices[i + ((j + 1) % 3)])); 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; float l = marker_size;
lines.append(v + Vector3(l, 0, 0)); lines.push_back(v + Vector3(l, 0, 0));
lines.append(v + Vector3(-l, 0, 0)); lines.push_back(v + Vector3(-l, 0, 0));
lines.append(v + Vector3(0, 0, l)); lines.push_back(v + Vector3(0, 0, l));
lines.append(v + Vector3(0, 0, -l)); lines.push_back(v + Vector3(0, 0, -l));
lines.append(v + Vector3(0, l, 0)); lines.push_back(v + Vector3(0, l, 0));
lines.append(v + Vector3(0, -l, 0)); lines.push_back(v + Vector3(0, -l, 0));
} }
} }
PoolIntArray seams = _mdr->get_seams(); PoolIntArray seams = _mdr->get_seams();
for (int i = 0; i < seams.size(); i += 2) { for (int i = 0; i < seams.size(); i += 2) {
seam_lines.append(get_vertex(seams[i])); seam_lines.push_back(get_vertex(seams[i]));
seam_lines.append(get_vertex(seams[i + 1])); 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); Vector3 v1 = get_vertex(i1);
if (mark_outline) { if (mark_outline) {
lines.append(v0); lines.push_back(v0);
lines.append(v1); lines.push_back(v1);
} }
if (mark_handles) { if (mark_handles) {
Vector3 pmid = v0.linear_interpolate(v1, 0.5); Vector3 pmid = v0.linear_interpolate(v1, 0.5);
float l = marker_size; float l = marker_size;
lines.append(pmid + Vector3(l, 0, 0)); lines.push_back(pmid + Vector3(l, 0, 0));
lines.append(pmid + Vector3(-l, 0, 0)); lines.push_back(pmid + Vector3(-l, 0, 0));
lines.append(pmid + Vector3(0, 0, l)); lines.push_back(pmid + Vector3(0, 0, l));
lines.append(pmid + Vector3(0, 0, -l)); lines.push_back(pmid + Vector3(0, 0, -l));
lines.append(pmid + Vector3(0, l, 0)); lines.push_back(pmid + Vector3(0, l, 0));
lines.append(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(); PoolIntArray seams = _mdr->get_seams();
for (int i = 0; i < seams.size(); i += 2) { for (int i = 0; i < seams.size(); i += 2) {
seam_lines.append(get_vertex(seams[i])); seam_lines.push_back(get_vertex(seams[i]));
seam_lines.append(get_vertex(seams[i + 1])); seam_lines.push_back(get_vertex(seams[i + 1]));
} }
} }
void MDREDMeshOutline::generate_mark_faces(bool mark_outline, bool mark_handles) { 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) { if (mark_outline) {
for (int i = 0; i < _indices.size(); i += 3) { for (int i = 0; i < _indices.size(); i += 3) {
for (int j = 0; j < 3; ++j) { for (int j = 0; j < 3; ++j) {
lines.append(get_vertex(_indices[i + j])); lines.push_back(get_vertex(_indices[i + j]));
lines.append(get_vertex(_indices[i + ((j + 1) % 3)])); 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; pmid /= 3;
float l = marker_size; float l = marker_size;
lines.append(pmid + Vector3(l, 0, 0)); lines.push_back(pmid + Vector3(l, 0, 0));
lines.append(pmid + Vector3(-l, 0, 0)); lines.push_back(pmid + Vector3(-l, 0, 0));
lines.append(pmid + Vector3(0, 0, l)); lines.push_back(pmid + Vector3(0, 0, l));
lines.append(pmid + Vector3(0, 0, -l)); lines.push_back(pmid + Vector3(0, 0, -l));
lines.append(pmid + Vector3(0, l, 0)); lines.push_back(pmid + Vector3(0, l, 0));
lines.append(pmid + Vector3(0, -l, 0)); lines.push_back(pmid + Vector3(0, -l, 0));
} }
} }
PoolIntArray seams = _mdr->get_seams(); PoolIntArray seams = _mdr->get_seams();
for (int i = 0; i < seams.size(); i += 2) { for (int i = 0; i < seams.size(); i += 2) {
seam_lines.append(get_vertex(seams[i])); seam_lines.push_back(get_vertex(seams[i]));
seam_lines.append(get_vertex(seams[i + 1])); seam_lines.push_back(get_vertex(seams[i + 1]));
} }
} }

View File

@ -49,8 +49,8 @@ public:
Ref<MeshDataResource> _mdr; Ref<MeshDataResource> _mdr;
PoolVector3Array lines; Vector<Vector3> lines;
PoolVector3Array seam_lines; Vector<Vector3> seam_lines;
PoolVector3Array _vertices; PoolVector3Array _vertices;
PoolVector3Array _normals; PoolVector3Array _normals;