mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-02-08 14:50:05 +01:00
Updated the engine, and removed the mesh data resource addon, as the engine now has it built in.
This commit is contained in:
parent
dbb28005c5
commit
0425f14df0
2
HEADS
2
HEADS
@ -1 +1 @@
|
||||
{"engine": {"3.2": "94a0fc47f7b4e90f8973f9adbfd3312579ed2825", "master": "8c73e813134001e575b6f59e3b0100471c007410", "3.x": "c4864a0e5f73a375259503ea1485794a6aad6df7"}, "world_generator": {"master": "260c430f11b0b591eaf4714516419aa327d2842c"}, "entity_spell_system": {"master": "3536f01bacf5f54cefb32b768cd020a1f94d0ade"}, "ui_extensions": {"master": "80a3b96fc56991a0f88a1d441ed1e3cebaf3307a"}, "voxelman": {"master": "65485930a20f65844d496b4ba47dec5b6ed70b91"}, "texture_packer": {"master": "ae4d222fbaade063ed6f0bc9f3aaa53df68a7fed"}, "fastnoise": {"master": "46bb1f610bfb7171613b5c708d312bcf94e89356"}, "mesh_data_resource": {"master": "a062d871d49d954c5466b9de54b4075cb61cbef4"}, "procedural_animations": {"master": "f8aae42bf06b3936cc6bd24cb18e1c3ec9f78f4f"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "983090d21a08ebed30a5ce06681269819ab12e48"}, "mesh_utils": {"master": "b52a261c31f04fad624e5cfbcdcc4a45d61136da"}, "broken_seals_module": {"master": "52c5a81350db1c29d375c63d95010260911ec034"}, "thread_pool": {"master": "0917511d04bb1aa308385b63ec88d3c182990628"}, "terraman": {"master": "c72d8fc03295588fc18c5168ce351bd0c321ec5f"}, "pandemonium_engine": {"master": "d4c57cf537fc8f92d0f9ab7df1ed9dcf7a432de0"}}
|
||||
{"engine": {"3.2": "94a0fc47f7b4e90f8973f9adbfd3312579ed2825", "master": "8c73e813134001e575b6f59e3b0100471c007410", "3.x": "c4864a0e5f73a375259503ea1485794a6aad6df7"}, "world_generator": {"master": "260c430f11b0b591eaf4714516419aa327d2842c"}, "entity_spell_system": {"master": "3536f01bacf5f54cefb32b768cd020a1f94d0ade"}, "ui_extensions": {"master": "80a3b96fc56991a0f88a1d441ed1e3cebaf3307a"}, "voxelman": {"master": "65485930a20f65844d496b4ba47dec5b6ed70b91"}, "texture_packer": {"master": "ae4d222fbaade063ed6f0bc9f3aaa53df68a7fed"}, "fastnoise": {"master": "46bb1f610bfb7171613b5c708d312bcf94e89356"}, "mesh_data_resource": {"master": "a062d871d49d954c5466b9de54b4075cb61cbef4"}, "procedural_animations": {"master": "f8aae42bf06b3936cc6bd24cb18e1c3ec9f78f4f"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "983090d21a08ebed30a5ce06681269819ab12e48"}, "mesh_utils": {"master": "b52a261c31f04fad624e5cfbcdcc4a45d61136da"}, "broken_seals_module": {"master": "52c5a81350db1c29d375c63d95010260911ec034"}, "thread_pool": {"master": "0917511d04bb1aa308385b63ec88d3c182990628"}, "terraman": {"master": "c72d8fc03295588fc18c5168ce351bd0c321ec5f"}, "pandemonium_engine": {"master": "3406a11f5c9860176b6cf10b20b4ad9aa20a4c5f"}}
|
@ -1,255 +0,0 @@
|
||||
tool
|
||||
extends Control
|
||||
|
||||
var _plugin : EditorPlugin
|
||||
|
||||
export var uv_preview_path : NodePath
|
||||
export var uv_editor_path : NodePath
|
||||
|
||||
var uv_preview : Node
|
||||
var uv_editor : Node
|
||||
|
||||
func _enter_tree():
|
||||
uv_preview = get_node(uv_preview_path)
|
||||
uv_editor = get_node(uv_editor_path)
|
||||
|
||||
if _plugin && uv_editor:
|
||||
uv_editor.set_plugin(_plugin)
|
||||
|
||||
func set_plugin(plugin : EditorPlugin) -> void:
|
||||
_plugin = plugin
|
||||
|
||||
if uv_editor:
|
||||
uv_editor.set_plugin(plugin)
|
||||
|
||||
func set_mesh_data_resource(a : MeshDataResource) -> void:
|
||||
if uv_preview:
|
||||
uv_preview.set_mesh_data_resource(a)
|
||||
|
||||
if uv_editor:
|
||||
uv_editor.set_mesh_data_resource(a)
|
||||
|
||||
func set_mesh_data_instance(a : MeshDataInstance) -> void:
|
||||
if uv_preview:
|
||||
uv_preview.set_mesh_data_instance(a)
|
||||
|
||||
if uv_editor:
|
||||
uv_editor.set_mesh_data_instance(a)
|
||||
|
||||
func _unhandled_key_input(event : InputEventKey) -> void:
|
||||
if event.echo:
|
||||
return
|
||||
|
||||
if event.alt || event.shift || event.control || event.meta || event.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()
|
||||
|
||||
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()
|
||||
|
||||
#Edit modes
|
||||
func set_edit_mode_translate() -> void:
|
||||
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer/Translate.pressed = true
|
||||
|
||||
func set_edit_mode_rotate() -> void:
|
||||
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer/Rotate.pressed = true
|
||||
|
||||
func set_edit_mode_scale() -> void:
|
||||
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer/Scale.pressed = true
|
||||
|
||||
func on_edit_mode_translate_toggled(on : bool) -> void:
|
||||
if on:
|
||||
if _plugin:
|
||||
_plugin.set_translate()
|
||||
|
||||
func on_edit_mode_rotate_toggled(on : bool) -> void:
|
||||
if on:
|
||||
if _plugin:
|
||||
_plugin.set_rotate()
|
||||
|
||||
func on_edit_mode_scale_toggled(on : bool) -> void:
|
||||
if on:
|
||||
if _plugin:
|
||||
_plugin.set_scale()
|
||||
|
||||
#axis locks
|
||||
func get_axis_x() -> bool:
|
||||
return $VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisX.pressed
|
||||
|
||||
func get_axis_y() -> bool:
|
||||
return $VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisY.pressed
|
||||
|
||||
func get_axis_z() -> bool:
|
||||
return $VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisZ.pressed
|
||||
|
||||
func set_axis_x(on : bool) -> void:
|
||||
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisX.pressed = on
|
||||
|
||||
func set_axis_y(on : bool) -> void:
|
||||
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisY.pressed = on
|
||||
|
||||
func set_axis_z(on : bool) -> void:
|
||||
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisZ.pressed = on
|
||||
|
||||
func on_axis_x_toggled(on : bool) -> void:
|
||||
if _plugin:
|
||||
_plugin.set_axis_x(on)
|
||||
|
||||
func on_axis_y_toggled(on : bool) -> void:
|
||||
if _plugin:
|
||||
_plugin.set_axis_y(on)
|
||||
|
||||
func on_axis_z_toggled(on : bool) -> void:
|
||||
if _plugin:
|
||||
_plugin.set_axis_z(on)
|
||||
|
||||
#selection modes
|
||||
func on_selection_mode_vertex_toggled(on : bool) -> void:
|
||||
if on:
|
||||
if _plugin:
|
||||
_plugin.set_selection_mode_vertex()
|
||||
|
||||
func on_selection_mode_edge_toggled(on : bool) -> void:
|
||||
if on:
|
||||
if _plugin:
|
||||
_plugin.set_selection_mode_edge()
|
||||
|
||||
func on_selection_mode_face_toggled(on : bool) -> void:
|
||||
if on:
|
||||
if _plugin:
|
||||
_plugin.set_selection_mode_face()
|
||||
|
||||
func set_selection_mode_vertex() -> void:
|
||||
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3/Vertex.pressed = true
|
||||
|
||||
func set_selection_mode_edge() -> void:
|
||||
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3/Edge.pressed = true
|
||||
|
||||
func set_selection_mode_face() -> void:
|
||||
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3/Face.pressed = true
|
||||
|
||||
|
||||
func _on_Extrude_pressed():
|
||||
_plugin.extrude()
|
||||
|
||||
func _on_AddBox_pressed():
|
||||
_plugin.add_box()
|
||||
|
||||
func _on_UnwrapButton_pressed():
|
||||
_plugin.uv_unwrap()
|
||||
|
||||
func _on_add_triangle_pressed():
|
||||
_plugin.add_triangle()
|
||||
|
||||
func _on_add_quad_pressed():
|
||||
_plugin.add_quad()
|
||||
|
||||
func _on_split_pressed():
|
||||
_plugin.split()
|
||||
|
||||
func _on_connect_to_first_selected_pressed():
|
||||
_plugin.connect_to_first_selected()
|
||||
|
||||
func _on_connect_to_avg_pressed():
|
||||
_plugin.connect_to_avg()
|
||||
|
||||
func _on_connect_to_last_selected_pressed():
|
||||
_plugin.connect_to_last_selected()
|
||||
|
||||
func _on_disconnect_pressed():
|
||||
_plugin.disconnect_action()
|
||||
|
||||
func _on_add_triangle_at_pressed():
|
||||
_plugin.add_triangle_at()
|
||||
|
||||
func _on_add_auad_at_pressed():
|
||||
_plugin.add_quad_at()
|
||||
|
||||
func _oncreate_face_pressed():
|
||||
_plugin.create_face()
|
||||
|
||||
func _on_delete_pressed():
|
||||
_plugin.delete_selected()
|
||||
|
||||
func _on_GenNormals_pressed():
|
||||
_plugin.generate_normals()
|
||||
|
||||
func _on_RemDoubles_pressed():
|
||||
_plugin.remove_doubles()
|
||||
|
||||
func _on_MergeOptimize_pressed():
|
||||
_plugin.merge_optimize()
|
||||
|
||||
func _on_GenTangents_pressed():
|
||||
_plugin.generate_tangents()
|
||||
|
||||
func _on_mark_seam_pressed():
|
||||
_plugin.mark_seam()
|
||||
|
||||
func _on_unmark_seam_pressed():
|
||||
_plugin.unmark_seam()
|
||||
|
||||
func _on_apply_seams_pressed():
|
||||
_plugin.apply_seam()
|
||||
|
||||
func _on_uv_edit_pressed():
|
||||
$Popups/UVEditorPopup.popup_centered()
|
||||
|
||||
func on_pivot_average_toggled(on : bool):
|
||||
if on:
|
||||
_plugin.set_pivot_averaged()
|
||||
|
||||
func on_pivot_mdi_origin_toggled(on : bool):
|
||||
if on:
|
||||
_plugin.set_pivot_mdi_origin()
|
||||
|
||||
func on_pivot_world_origin_toggled(on : bool):
|
||||
if on:
|
||||
_plugin.set_pivot_world_origin()
|
||||
|
||||
func on_visual_indicator_outline_toggled(on : bool):
|
||||
_plugin.visual_indicator_outline_set(on)
|
||||
|
||||
func on_visual_indicator_seam_toggled(on : bool):
|
||||
_plugin.visual_indicator_seam_set(on)
|
||||
|
||||
func on_visual_indicator_handle_toggled(on : bool):
|
||||
_plugin.visual_indicator_handle_set(on)
|
||||
|
||||
func _on_select_all_pressed():
|
||||
_plugin.select_all()
|
||||
|
||||
func onhandle_selection_type_front_toggled(on : bool):
|
||||
if on:
|
||||
_plugin.handle_selection_type_front()
|
||||
|
||||
func onhandle_selection_type_back_toggled(on : bool):
|
||||
if on:
|
||||
_plugin.handle_selection_type_back()
|
||||
|
||||
func onhandle_selection_type_all_toggled(on : bool):
|
||||
if on:
|
||||
_plugin.handle_selection_type_all()
|
||||
|
||||
func _on_clean_mesh_pressed():
|
||||
_plugin.clean_mesh()
|
||||
|
||||
func _on_flip_face_pressed():
|
||||
_plugin.flip_selected_faces()
|
@ -1,769 +0,0 @@
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/MDIEd.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/button_groups/vertex_position_operation_bg.tres" type="ButtonGroup" id=2]
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/UVEditor.gd" type="Script" id=3]
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/uv_editor/UVEditor.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/button_groups/edit_mode_button_group.tres" type="ButtonGroup" id=5]
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/uv_editor/UVEditorPopup.gd" type="Script" id=6]
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/button_groups/pivot_button_group.tres" type="ButtonGroup" id=7]
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/button_groups/handle_selection_typen_group.tres" type="ButtonGroup" id=8]
|
||||
|
||||
[node name="MDIEd" type="PanelContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
uv_preview_path = NodePath("VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations/UVDisplay")
|
||||
uv_editor_path = NodePath("Popups/UVEditorPopup/UVEditor")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 1017.0
|
||||
margin_bottom = 593.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Actions" type="VBoxContainer" parent="VBoxContainer"]
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="Actions" type="HBoxContainer" parent="VBoxContainer/Actions"]
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 68.0
|
||||
alignment = 1
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/Actions/Actions"]
|
||||
margin_left = 457.0
|
||||
margin_right = 466.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Actions/Actions/VBoxContainer"]
|
||||
margin_right = 9.0
|
||||
margin_bottom = 20.0
|
||||
hint_tooltip = "Edit Mode"
|
||||
mouse_filter = 0
|
||||
size_flags_vertical = 7
|
||||
text = "E"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="VBoxContainer/Actions/Actions/VBoxContainer"]
|
||||
margin_top = 24.0
|
||||
margin_right = 9.0
|
||||
margin_bottom = 44.0
|
||||
hint_tooltip = "Active Axis"
|
||||
mouse_filter = 0
|
||||
size_flags_vertical = 7
|
||||
text = "A"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="Label3" type="Label" parent="VBoxContainer/Actions/Actions/VBoxContainer"]
|
||||
margin_top = 48.0
|
||||
margin_right = 9.0
|
||||
margin_bottom = 68.0
|
||||
hint_tooltip = "Selection Mode"
|
||||
mouse_filter = 0
|
||||
size_flags_vertical = 7
|
||||
text = "S"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="VBoxContainer/Actions/Actions"]
|
||||
margin_left = 470.0
|
||||
margin_right = 553.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Actions/Actions/VBoxContainer2"]
|
||||
margin_right = 83.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="Translate" type="Button" parent="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer"]
|
||||
margin_right = 25.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
hint_tooltip = "Translate"
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
pressed = true
|
||||
group = ExtResource( 2 )
|
||||
text = "T"
|
||||
|
||||
[node name="Rotate" type="Button" parent="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer"]
|
||||
margin_left = 29.0
|
||||
margin_right = 54.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
hint_tooltip = "Rotate"
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
group = ExtResource( 2 )
|
||||
text = "R"
|
||||
|
||||
[node name="Scale" type="Button" parent="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer"]
|
||||
margin_left = 58.0
|
||||
margin_right = 83.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
hint_tooltip = "Scale"
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
group = ExtResource( 2 )
|
||||
text = "S"
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/Actions/Actions/VBoxContainer2"]
|
||||
margin_top = 24.0
|
||||
margin_right = 83.0
|
||||
margin_bottom = 44.0
|
||||
|
||||
[node name="AxisX" type="Button" parent="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2"]
|
||||
margin_right = 25.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
pressed = true
|
||||
text = "X"
|
||||
|
||||
[node name="AxisY" type="Button" parent="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2"]
|
||||
margin_left = 29.0
|
||||
margin_right = 54.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
pressed = true
|
||||
text = "Y"
|
||||
|
||||
[node name="AxisZ" type="Button" parent="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2"]
|
||||
margin_left = 58.0
|
||||
margin_right = 83.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
pressed = true
|
||||
text = "Z"
|
||||
|
||||
[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer/Actions/Actions/VBoxContainer2"]
|
||||
margin_top = 48.0
|
||||
margin_right = 83.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="Vertex" type="Button" parent="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3"]
|
||||
margin_right = 25.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
hint_tooltip = "Vertex"
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
pressed = true
|
||||
group = ExtResource( 5 )
|
||||
text = "V"
|
||||
|
||||
[node name="Edge" type="Button" parent="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3"]
|
||||
margin_left = 29.0
|
||||
margin_right = 54.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
hint_tooltip = "Edge"
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
group = ExtResource( 5 )
|
||||
text = "E"
|
||||
|
||||
[node name="Face" type="Button" parent="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3"]
|
||||
margin_left = 58.0
|
||||
margin_right = 83.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
hint_tooltip = "Face"
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
group = ExtResource( 5 )
|
||||
text = "F"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
|
||||
margin_top = 72.0
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 76.0
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"]
|
||||
margin_top = 80.0
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 586.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
scroll_horizontal_enabled = false
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="VBoxContainer/ScrollContainer"]
|
||||
margin_right = 998.0
|
||||
margin_bottom = 674.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBoxContainer6" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
|
||||
margin_right = 998.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="Label4" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer6"]
|
||||
margin_right = 10.0
|
||||
margin_bottom = 20.0
|
||||
hint_tooltip = "Handle Selection type."
|
||||
mouse_filter = 0
|
||||
size_flags_vertical = 7
|
||||
text = "H"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="Front" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer6"]
|
||||
margin_left = 14.0
|
||||
margin_right = 339.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
hint_tooltip = "
|
||||
"
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
pressed = true
|
||||
group = ExtResource( 8 )
|
||||
text = "F"
|
||||
|
||||
[node name="Back" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer6"]
|
||||
margin_left = 343.0
|
||||
margin_right = 668.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
hint_tooltip = "Only select handles that face away
|
||||
the camera."
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
group = ExtResource( 8 )
|
||||
text = "B"
|
||||
|
||||
[node name="All" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer6"]
|
||||
margin_left = 672.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
hint_tooltip = "Ignore camera facing when selecting handles.
|
||||
"
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
group = ExtResource( 8 )
|
||||
text = "A"
|
||||
|
||||
[node name="HBoxContainer4" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
|
||||
margin_top = 24.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 44.0
|
||||
|
||||
[node name="Label4" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer4"]
|
||||
margin_right = 8.0
|
||||
margin_bottom = 20.0
|
||||
hint_tooltip = "Pivot"
|
||||
mouse_filter = 0
|
||||
size_flags_vertical = 7
|
||||
text = "P"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="Average" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer4"]
|
||||
margin_left = 12.0
|
||||
margin_right = 338.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
hint_tooltip = "Average"
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
pressed = true
|
||||
group = ExtResource( 7 )
|
||||
text = "A"
|
||||
|
||||
[node name="MDIOrigin" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer4"]
|
||||
margin_left = 342.0
|
||||
margin_right = 668.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
hint_tooltip = "Mesh Data Instance Origin"
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
group = ExtResource( 7 )
|
||||
text = "M"
|
||||
|
||||
[node name="WorldOrigin" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer4"]
|
||||
margin_left = 672.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
hint_tooltip = "World Origin"
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
group = ExtResource( 7 )
|
||||
text = "w"
|
||||
|
||||
[node name="HBoxContainer5" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
|
||||
margin_top = 48.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="Label4" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer5"]
|
||||
margin_right = 8.0
|
||||
margin_bottom = 20.0
|
||||
hint_tooltip = "Visual indicators"
|
||||
mouse_filter = 0
|
||||
size_flags_vertical = 7
|
||||
text = "V"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="Outline" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer5"]
|
||||
margin_left = 12.0
|
||||
margin_right = 338.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
hint_tooltip = "Outline"
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
pressed = true
|
||||
text = "O"
|
||||
|
||||
[node name="Seam" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer5"]
|
||||
margin_left = 342.0
|
||||
margin_right = 668.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
hint_tooltip = "Seam"
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
pressed = true
|
||||
text = "S"
|
||||
|
||||
[node name="Handle" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer5"]
|
||||
margin_left = 672.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 25, 20 )
|
||||
hint_tooltip = "Handle"
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
pressed = true
|
||||
text = "H"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
|
||||
margin_top = 72.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 76.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Select All" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
|
||||
margin_top = 80.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 100.0
|
||||
text = "Select All"
|
||||
|
||||
[node name="HSeparator5" type="HSeparator" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
|
||||
margin_top = 104.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 108.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VertexOps" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
|
||||
margin_top = 112.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 192.0
|
||||
|
||||
[node name="OperationsLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps"]
|
||||
margin_right = 998.0
|
||||
margin_bottom = 14.0
|
||||
text = "= Vertex ="
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="Operations" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps"]
|
||||
margin_top = 18.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 80.0
|
||||
|
||||
[node name="AddFace" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps/Operations"]
|
||||
margin_right = 998.0
|
||||
margin_bottom = 20.0
|
||||
text = "Create Face"
|
||||
|
||||
[node name="Split" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps/Operations"]
|
||||
visible = false
|
||||
margin_top = 24.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 44.0
|
||||
text = "Split"
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps/Operations"]
|
||||
margin_top = 24.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 38.0
|
||||
text = "Connect"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps/Operations"]
|
||||
margin_top = 42.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 62.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ConnectToFirst" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps/Operations/HBoxContainer"]
|
||||
margin_right = 330.0
|
||||
margin_bottom = 20.0
|
||||
hint_tooltip = "Move all vertices to the first one that was selected."
|
||||
size_flags_horizontal = 3
|
||||
text = "x<"
|
||||
|
||||
[node name="ConnectMed" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps/Operations/HBoxContainer"]
|
||||
margin_left = 334.0
|
||||
margin_right = 664.0
|
||||
margin_bottom = 20.0
|
||||
hint_tooltip = "Move all selected vertices to their average."
|
||||
size_flags_horizontal = 3
|
||||
text = ">x<"
|
||||
|
||||
[node name="ConnectToLast" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps/Operations/HBoxContainer"]
|
||||
margin_left = 668.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 20.0
|
||||
hint_tooltip = "Move all selected vertices to the last that was selected."
|
||||
size_flags_horizontal = 3
|
||||
text = ">x"
|
||||
|
||||
[node name="EdgeOps" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
|
||||
visible = false
|
||||
margin_top = 108.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 206.0
|
||||
|
||||
[node name="OperationsLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps"]
|
||||
margin_right = 998.0
|
||||
margin_bottom = 14.0
|
||||
text = "= Edge ="
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="Operations" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps"]
|
||||
margin_top = 18.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 98.0
|
||||
|
||||
[node name="Extrude" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps/Operations"]
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 20.0
|
||||
text = "Extrude"
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps/Operations"]
|
||||
margin_right = 998.0
|
||||
margin_bottom = 14.0
|
||||
text = "Append"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps/Operations"]
|
||||
margin_top = 18.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 38.0
|
||||
|
||||
[node name="TriAt" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps/Operations/HBoxContainer2"]
|
||||
margin_right = 497.0
|
||||
margin_bottom = 20.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Tri"
|
||||
|
||||
[node name="QuadAt" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps/Operations/HBoxContainer2"]
|
||||
margin_left = 501.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 20.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Quad"
|
||||
|
||||
[node name="SeamLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps/Operations"]
|
||||
margin_top = 42.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 56.0
|
||||
text = "Seam"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps/Operations"]
|
||||
margin_top = 60.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 80.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Mark" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps/Operations/HBoxContainer"]
|
||||
margin_right = 497.0
|
||||
margin_bottom = 20.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Mark"
|
||||
|
||||
[node name="Unmark" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps/Operations/HBoxContainer"]
|
||||
margin_left = 501.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 20.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Unmark"
|
||||
|
||||
[node name="FaceOps" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
|
||||
visible = false
|
||||
margin_right = 55.0
|
||||
margin_bottom = 38.0
|
||||
|
||||
[node name="OperationsLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/FaceOps"]
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 14.0
|
||||
text = "= Face ="
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="Operations" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2/FaceOps"]
|
||||
margin_top = 18.0
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 110.0
|
||||
|
||||
[node name="Delete" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/FaceOps/Operations"]
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 20.0
|
||||
text = "Delete"
|
||||
|
||||
[node name="Flip" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/FaceOps/Operations"]
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 20.0
|
||||
text = "Flip"
|
||||
|
||||
[node name="HSeparator4" type="HSeparator" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
|
||||
margin_top = 196.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 200.0
|
||||
|
||||
[node name="Operations" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
|
||||
margin_top = 204.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 568.0
|
||||
|
||||
[node name="OperationsLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Operations"]
|
||||
margin_right = 998.0
|
||||
margin_bottom = 14.0
|
||||
text = "= Operations ="
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="Operations" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Operations"]
|
||||
margin_top = 18.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 364.0
|
||||
|
||||
[node name="Label2" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations"]
|
||||
margin_right = 998.0
|
||||
margin_bottom = 14.0
|
||||
text = "Generate"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="GenNormals" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations"]
|
||||
margin_top = 18.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 38.0
|
||||
text = "Normals"
|
||||
|
||||
[node name="GenTangents" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations"]
|
||||
margin_top = 42.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 62.0
|
||||
text = "Tangents"
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations"]
|
||||
margin_top = 66.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 80.0
|
||||
text = "Optimizations"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="RemDoubles" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations"]
|
||||
margin_top = 84.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 104.0
|
||||
text = "Rem Doubles"
|
||||
|
||||
[node name="MergeOptimize" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations"]
|
||||
margin_top = 108.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 128.0
|
||||
text = "Full Merge"
|
||||
|
||||
[node name="Clean" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations"]
|
||||
margin_top = 132.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 152.0
|
||||
hint_tooltip = "Clean mesh for example for unused verts."
|
||||
text = "Clean"
|
||||
|
||||
[node name="Label3" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations"]
|
||||
margin_top = 156.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 170.0
|
||||
text = "UV"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="UVDisplay" type="Control" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations"]
|
||||
margin_top = 174.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 274.0
|
||||
rect_min_size = Vector2( 100, 100 )
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="UVEditButton" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations"]
|
||||
margin_top = 278.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 298.0
|
||||
text = "Edit"
|
||||
|
||||
[node name="ApplySeams" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations"]
|
||||
margin_top = 302.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 322.0
|
||||
text = "Apply seams"
|
||||
|
||||
[node name="UnwrapButton2" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations"]
|
||||
margin_top = 326.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 346.0
|
||||
text = "Unwrap"
|
||||
|
||||
[node name="HSeparator3" type="HSeparator" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
|
||||
margin_top = 572.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 576.0
|
||||
|
||||
[node name="Add" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
|
||||
margin_top = 580.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 666.0
|
||||
|
||||
[node name="AddLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Add"]
|
||||
margin_right = 998.0
|
||||
margin_bottom = 14.0
|
||||
text = "= Add ="
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="Add" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Add"]
|
||||
margin_top = 18.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 86.0
|
||||
|
||||
[node name="AddBox" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Add/Add"]
|
||||
margin_right = 998.0
|
||||
margin_bottom = 20.0
|
||||
text = "Box"
|
||||
|
||||
[node name="AddTriangle" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Add/Add"]
|
||||
margin_top = 24.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 44.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Tri"
|
||||
|
||||
[node name="AddQuad" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Add/Add"]
|
||||
margin_top = 48.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 68.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Quad"
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
|
||||
margin_top = 670.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 674.0
|
||||
|
||||
[node name="Popups" type="Control" parent="."]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 1017.0
|
||||
margin_bottom = 593.0
|
||||
mouse_filter = 2
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="UVEditorPopup" type="ConfirmationDialog" parent="Popups"]
|
||||
margin_left = 149.0
|
||||
margin_top = 35.0
|
||||
margin_right = 901.0
|
||||
margin_bottom = 803.0
|
||||
window_title = "UV Editor"
|
||||
resizable = true
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="UVEditor" parent="Popups/UVEditorPopup" instance=ExtResource( 4 )]
|
||||
margin_left = 8.0
|
||||
margin_top = 8.0
|
||||
margin_right = -8.0
|
||||
margin_bottom = -36.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer/Translate" to="." method="on_edit_mode_translate_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer/Rotate" to="." method="on_edit_mode_rotate_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer/Scale" to="." method="on_edit_mode_scale_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisX" to="." method="on_axis_x_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisY" to="." method="on_axis_y_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisZ" to="." method="on_axis_z_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3/Vertex" to="." method="on_selection_mode_vertex_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3/Vertex" to="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps" method="set_visible"]
|
||||
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3/Edge" to="." method="on_selection_mode_edge_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3/Edge" to="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps" method="set_visible"]
|
||||
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3/Face" to="." method="on_selection_mode_face_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3/Face" to="VBoxContainer/ScrollContainer/VBoxContainer2/FaceOps" method="set_visible"]
|
||||
[connection signal="toggled" from="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer6/Front" to="." method="onhandle_selection_type_front_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer6/Back" to="." method="onhandle_selection_type_back_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer6/All" to="." method="onhandle_selection_type_all_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer4/Average" to="." method="on_pivot_average_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer4/MDIOrigin" to="." method="on_pivot_mdi_origin_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer4/WorldOrigin" to="." method="on_pivot_world_origin_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer5/Outline" to="." method="on_visual_indicator_outline_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer5/Seam" to="." method="on_visual_indicator_seam_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer5/Handle" to="." method="on_visual_indicator_handle_toggled"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/Select All" to="." method="_on_select_all_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps/Operations/AddFace" to="." method="_oncreate_face_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps/Operations/Split" to="." method="_on_split_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps/Operations/HBoxContainer/ConnectToFirst" to="." method="_on_connect_to_first_selected_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps/Operations/HBoxContainer/ConnectMed" to="." method="_on_connect_to_avg_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps/Operations/HBoxContainer/ConnectToLast" to="." method="_on_connect_to_last_selected_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps/Operations/Extrude" to="." method="_on_Extrude_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps/Operations/HBoxContainer2/TriAt" to="." method="_on_add_triangle_at_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps/Operations/HBoxContainer2/QuadAt" to="." method="_on_add_auad_at_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps/Operations/HBoxContainer/Mark" to="." method="_on_mark_seam_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/EdgeOps/Operations/HBoxContainer/Unmark" to="." method="_on_unmark_seam_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/FaceOps/Operations/Delete" to="." method="_on_delete_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/FaceOps/Operations/Flip" to="." method="_on_flip_face_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations/GenNormals" to="." method="_on_GenNormals_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations/GenTangents" to="." method="_on_GenTangents_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations/RemDoubles" to="." method="_on_RemDoubles_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations/MergeOptimize" to="." method="_on_MergeOptimize_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations/Clean" to="." method="_on_clean_mesh_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations/UVEditButton" to="." method="_on_uv_edit_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations/ApplySeams" to="." method="_on_apply_seams_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/Operations/Operations/UnwrapButton2" to="." method="_on_UnwrapButton_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/Add/Add/AddBox" to="." method="_on_AddBox_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/Add/Add/AddTriangle" to="." method="_on_add_triangle_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/Add/Add/AddQuad" to="." method="_on_add_quad_pressed"]
|
@ -1,33 +0,0 @@
|
||||
tool
|
||||
extends EditorSpatialGizmoPlugin
|
||||
|
||||
const MDIGizmo = preload("res://addons/mesh_data_resource_editor/MIDGizmo.gd")
|
||||
|
||||
var plugin
|
||||
|
||||
func _init():
|
||||
create_material("main", Color(0.7, 0.7, 0.7))
|
||||
create_material("seam", Color(1, 0, 0), false, true)
|
||||
create_handle_material("handles")
|
||||
|
||||
func get_name():
|
||||
return "MDIGizmo"
|
||||
|
||||
func get_priority():
|
||||
return 100
|
||||
|
||||
func create_gizmo(spatial):
|
||||
if spatial is MeshDataInstance:
|
||||
var gizmo = MDIGizmo.new()
|
||||
|
||||
gizmo.set_editor_plugin(plugin)
|
||||
gizmo.set_spatial_node(spatial)
|
||||
gizmo.setup()
|
||||
plugin.register_gizmo(gizmo)
|
||||
|
||||
return gizmo
|
||||
else:
|
||||
return null
|
||||
|
||||
func is_handle_highlighted(gizmo, index):
|
||||
pass
|
File diff suppressed because it is too large
Load Diff
@ -1,63 +0,0 @@
|
||||
tool
|
||||
extends Control
|
||||
|
||||
var mesh_data_resource : MeshDataResource = null setget set_mesh_data_resource
|
||||
var background_texture : Texture = null
|
||||
|
||||
func set_mesh_data_resource(a : MeshDataResource):
|
||||
if mesh_data_resource:
|
||||
mesh_data_resource.disconnect("changed", self, "on_mdr_changed")
|
||||
|
||||
mesh_data_resource = a
|
||||
|
||||
if mesh_data_resource:
|
||||
mesh_data_resource.connect("changed", self, "on_mdr_changed")
|
||||
|
||||
update()
|
||||
|
||||
func set_mesh_data_instance(a : MeshDataInstance):
|
||||
if !a:
|
||||
background_texture = null
|
||||
|
||||
background_texture = a.texture
|
||||
|
||||
func on_mdr_changed():
|
||||
update()
|
||||
|
||||
func _draw():
|
||||
if background_texture:
|
||||
draw_texture_rect_region(background_texture, Rect2(Vector2(), get_size()), Rect2(Vector2(), background_texture.get_size()))
|
||||
|
||||
if !mesh_data_resource:
|
||||
return
|
||||
|
||||
if mesh_data_resource.array.size() != ArrayMesh.ARRAY_MAX:
|
||||
return
|
||||
|
||||
var uvs : PoolVector2Array = mesh_data_resource.array[ArrayMesh.ARRAY_TEX_UV]
|
||||
var indices : PoolIntArray = mesh_data_resource.array[ArrayMesh.ARRAY_INDEX]
|
||||
|
||||
if indices.size() % 3 == 0:
|
||||
for i in range(0, len(indices), 3):
|
||||
var c : Color = Color(1, 1, 1, 1)
|
||||
|
||||
if uvs[indices[i]].is_equal_approx(Vector2()) || uvs[indices[i + 1]].is_equal_approx(Vector2()):
|
||||
c = Color(1, 0, 0, 1)
|
||||
else:
|
||||
c = Color(1, 1, 1, 1)
|
||||
|
||||
draw_line(uvs[indices[i]] * get_size(), uvs[indices[i + 1]] * get_size(), c, 1, false)
|
||||
|
||||
if uvs[indices[i + 1]].is_equal_approx(Vector2()) || uvs[indices[i + 2]].is_equal_approx(Vector2()):
|
||||
c = Color(1, 0, 0, 1)
|
||||
else:
|
||||
c = Color(1, 1, 1, 1)
|
||||
|
||||
draw_line(uvs[indices[i + 1]] * get_size(), uvs[indices[i + 2]] * get_size(), c, 1, false)
|
||||
|
||||
if uvs[indices[i + 2]].is_equal_approx(Vector2()) || uvs[indices[i]].is_equal_approx(Vector2()):
|
||||
c = Color(1, 0, 0, 1)
|
||||
else:
|
||||
c = Color(1, 1, 1, 1)
|
||||
|
||||
draw_line(uvs[indices[i + 2]] * get_size(), uvs[indices[i]] * get_size(), c, 1, false)
|
@ -1,3 +0,0 @@
|
||||
[gd_resource type="ButtonGroup" format=2]
|
||||
|
||||
[resource]
|
@ -1,3 +0,0 @@
|
||||
[gd_resource type="ButtonGroup" format=2]
|
||||
|
||||
[resource]
|
@ -1,3 +0,0 @@
|
||||
[gd_resource type="ButtonGroup" format=2]
|
||||
|
||||
[resource]
|
@ -1,3 +0,0 @@
|
||||
[gd_resource type="ButtonGroup" format=2]
|
||||
|
||||
[resource]
|
Binary file not shown.
Before Width: | Height: | Size: 262 B |
@ -1,35 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon_h_mirror.png-c9b5d56c2156f7acd5e386f16839fcf5.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/mesh_data_resource_editor/icons/icon_h_mirror.png"
|
||||
dest_files=[ "res://.import/icon_h_mirror.png-c9b5d56c2156f7acd5e386f16839fcf5.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=1
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=false
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
Binary file not shown.
Before Width: | Height: | Size: 647 B |
@ -1,35 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon_rot_left.png-2ed07f01ee122a21258a76ad461d5351.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/mesh_data_resource_editor/icons/icon_rot_left.png"
|
||||
dest_files=[ "res://.import/icon_rot_left.png-2ed07f01ee122a21258a76ad461d5351.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=1
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=false
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
Binary file not shown.
Before Width: | Height: | Size: 5.4 KiB |
@ -1,35 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon_rot_right.png-3a55515ef21d5e1831970e70a893782c.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/mesh_data_resource_editor/icons/icon_rot_right.png"
|
||||
dest_files=[ "res://.import/icon_rot_right.png-3a55515ef21d5e1831970e70a893782c.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=1
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=false
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
Binary file not shown.
Before Width: | Height: | Size: 305 B |
@ -1,35 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon_v_mirror.png-e41ddad69d06b4e32f9d50b970311be7.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/mesh_data_resource_editor/icons/icon_v_mirror.png"
|
||||
dest_files=[ "res://.import/icon_v_mirror.png-e41ddad69d06b4e32f9d50b970311be7.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=1
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=false
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
@ -1,7 +0,0 @@
|
||||
[plugin]
|
||||
|
||||
name="mesh_data_resource_editor"
|
||||
description=""
|
||||
author="Relintai"
|
||||
version="1.0"
|
||||
script="plugin.gd"
|
@ -1,289 +0,0 @@
|
||||
tool
|
||||
extends EditorPlugin
|
||||
|
||||
const MDRMeshUtils = preload("res://addons/mesh_data_resource_editor/utilities/mdred_mesh_utils.gd")
|
||||
|
||||
const MdiGizmoPlugin = preload("res://addons/mesh_data_resource_editor/MDIGizmoPlugin.gd")
|
||||
const MDIEdGui = preload("res://addons/mesh_data_resource_editor/MDIEd.tscn")
|
||||
|
||||
var gizmo_plugin = MdiGizmoPlugin.new()
|
||||
var mdi_ed_gui : Control
|
||||
|
||||
var active_gizmos : Array
|
||||
|
||||
var current_mesh_data_instance : MeshDataInstance = null
|
||||
|
||||
func _enter_tree():
|
||||
gizmo_plugin = MdiGizmoPlugin.new()
|
||||
mdi_ed_gui = MDIEdGui.instance()
|
||||
mdi_ed_gui.set_plugin(self)
|
||||
active_gizmos = []
|
||||
|
||||
gizmo_plugin.plugin = self
|
||||
|
||||
add_control_to_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT, mdi_ed_gui)
|
||||
mdi_ed_gui.hide()
|
||||
|
||||
add_spatial_gizmo_plugin(gizmo_plugin)
|
||||
|
||||
set_input_event_forwarding_always_enabled()
|
||||
|
||||
func _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
|
||||
|
||||
#func enable_plugin():
|
||||
# print("enable_plugin")
|
||||
# pass
|
||||
#
|
||||
#func disable_plugin():
|
||||
# print("disable_plugin")
|
||||
# remove_spatial_gizmo_plugin(gizmo_plugin)
|
||||
# remove_control_from_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT, mdi_ed_gui)
|
||||
# mdi_ed_gui.queue_free()
|
||||
|
||||
func handles(object):
|
||||
#print("disable_plugin")
|
||||
|
||||
if object is MeshDataInstance:
|
||||
return true
|
||||
|
||||
return false
|
||||
|
||||
func edit(object):
|
||||
var mdi : MeshDataInstance = object as MeshDataInstance
|
||||
|
||||
if mdi:
|
||||
if current_mesh_data_instance && mdi.gizmo && current_mesh_data_instance.gizmo:
|
||||
mdi.gizmo.transfer_state_from(current_mesh_data_instance.gizmo)
|
||||
|
||||
mdi_ed_gui.set_mesh_data_resource(mdi.mesh_data)
|
||||
mdi_ed_gui.set_mesh_data_instance(mdi)
|
||||
|
||||
current_mesh_data_instance = mdi
|
||||
|
||||
func make_visible(visible):
|
||||
#print("make_visible")
|
||||
|
||||
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
|
||||
|
||||
func get_plugin_name():
|
||||
return "mesh_data_resource_editor"
|
||||
|
||||
|
||||
#func forward_spatial_gui_input(camera, event):
|
||||
# return forward_spatial_gui_input(0, camera, event)
|
||||
|
||||
func register_gizmo(gizmo):
|
||||
active_gizmos.append(gizmo)
|
||||
|
||||
func unregister_gizmo(gizmo):
|
||||
for i in range(active_gizmos.size()):
|
||||
if active_gizmos[i] == gizmo:
|
||||
active_gizmos.remove(i)
|
||||
return
|
||||
|
||||
func set_translate() -> void:
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_translate()
|
||||
|
||||
func set_scale() -> void:
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_scale()
|
||||
|
||||
func set_rotate() -> void:
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_rotate()
|
||||
|
||||
func set_axis_x(on : bool) -> void:
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_axis_x(on)
|
||||
|
||||
func set_axis_y(on : bool) -> void:
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_axis_y(on)
|
||||
|
||||
func set_axis_z(on : bool) -> void:
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_axis_z(on)
|
||||
|
||||
func set_selection_mode_vertex() -> void:
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_selection_mode_vertex()
|
||||
|
||||
func set_selection_mode_edge() -> void:
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_selection_mode_edge()
|
||||
|
||||
func set_selection_mode_face() -> void:
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_selection_mode_face()
|
||||
|
||||
func get_mdr() -> MeshDataResource:
|
||||
if current_mesh_data_instance:
|
||||
return current_mesh_data_instance.mesh_data
|
||||
|
||||
return null
|
||||
|
||||
|
||||
#func forward_spatial_gui_input(camera, event):
|
||||
# for g in active_gizmos:
|
||||
# if g.forward_spatial_gui_input(0, camera, event):
|
||||
# return true
|
||||
#
|
||||
# return false
|
||||
|
||||
func forward_spatial_gui_input(index, camera, event):
|
||||
if (!is_instance_valid(current_mesh_data_instance)):
|
||||
current_mesh_data_instance = null
|
||||
|
||||
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
|
||||
|
||||
return false
|
||||
|
||||
func add_box() -> void:
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.add_box()
|
||||
|
||||
func add_triangle() -> void:
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.add_triangle()
|
||||
|
||||
func add_quad() -> void:
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.add_quad()
|
||||
|
||||
func add_triangle_at() -> void:
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.add_triangle_at()
|
||||
|
||||
func add_quad_at() -> void:
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.add_quad_at()
|
||||
|
||||
func split():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.split()
|
||||
|
||||
func connect_action():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.connect_action()
|
||||
|
||||
func disconnect_action():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.disconnect_action()
|
||||
|
||||
func create_face():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.create_face()
|
||||
|
||||
func delete_selected():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.delete_selected()
|
||||
|
||||
func generate_normals():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.generate_normals()
|
||||
|
||||
func remove_doubles():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.remove_doubles()
|
||||
|
||||
func merge_optimize():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.merge_optimize()
|
||||
|
||||
func generate_tangents():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.generate_tangents()
|
||||
|
||||
func connect_to_first_selected():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.connect_to_first_selected()
|
||||
|
||||
func connect_to_avg():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.connect_to_avg()
|
||||
|
||||
func connect_to_last_selected():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.connect_to_last_selected()
|
||||
|
||||
func mark_seam():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.mark_seam()
|
||||
|
||||
func unmark_seam():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.unmark_seam()
|
||||
|
||||
func apply_seam():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.apply_seam()
|
||||
|
||||
func uv_unwrap() -> void:
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.uv_unwrap()
|
||||
|
||||
func set_pivot_averaged():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_pivot_averaged()
|
||||
|
||||
func set_pivot_mdi_origin():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_pivot_mdi_origin()
|
||||
|
||||
func set_pivot_world_origin():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.set_pivot_world_origin()
|
||||
|
||||
func visual_indicator_outline_set(on : bool):
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.visual_indicator_outline_set(on)
|
||||
|
||||
func visual_indicator_seam_set(on : bool):
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.visual_indicator_seam_set(on)
|
||||
|
||||
func visual_indicator_handle_set(on : bool):
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.visual_indicator_handle_set(on)
|
||||
|
||||
func select_all():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.select_all()
|
||||
|
||||
func handle_selection_type_front():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.handle_selection_type_front()
|
||||
|
||||
func handle_selection_type_back():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.handle_selection_type_back()
|
||||
|
||||
func handle_selection_type_all():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.handle_selection_type_all()
|
||||
|
||||
func extrude():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.extrude()
|
||||
|
||||
func clean_mesh():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.clean_mesh()
|
||||
|
||||
func flip_selected_faces():
|
||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||
current_mesh_data_instance.gizmo.flip_selected_faces()
|
File diff suppressed because it is too large
Load Diff
@ -1,263 +0,0 @@
|
||||
tool
|
||||
extends Object
|
||||
|
||||
#you can use MeshUtils.merge_mesh_array(arr) to get optimalized handle points. Just get the vertices from it.
|
||||
|
||||
static func get_handle_vertex_to_vertex_map(arrays : Array, handle_points : PoolVector3Array) -> Array:
|
||||
var handle_to_vertex_map : Array
|
||||
handle_to_vertex_map.resize(handle_points.size())
|
||||
|
||||
if handle_points.size() == 0:
|
||||
return handle_to_vertex_map
|
||||
|
||||
if arrays.size() != ArrayMesh.ARRAY_MAX || arrays[ArrayMesh.ARRAY_INDEX] == null:
|
||||
return handle_to_vertex_map
|
||||
|
||||
var vertices : PoolVector3Array = arrays[ArrayMesh.ARRAY_VERTEX]
|
||||
|
||||
if vertices.size() == 0:
|
||||
return handle_to_vertex_map
|
||||
|
||||
for i in range(handle_points.size()):
|
||||
var hv : Vector3 = handle_points[i]
|
||||
var iarr : PoolIntArray = PoolIntArray()
|
||||
|
||||
#find all verts that have the same position as the handle
|
||||
for j in range(vertices.size()):
|
||||
var vn : Vector3 = vertices[j]
|
||||
|
||||
if is_equal_approx(hv.x, vn.x) && is_equal_approx(hv.y, vn.y) && is_equal_approx(hv.z, vn.z):
|
||||
iarr.append(j)
|
||||
|
||||
handle_to_vertex_map[i] = iarr
|
||||
|
||||
return handle_to_vertex_map
|
||||
|
||||
#returns an array:
|
||||
#index 0 is the handle_points
|
||||
#index 1 is the handle_to_vertex_map
|
||||
static func get_handle_edge_to_vertex_map(arrays : Array) -> Array:
|
||||
var handle_to_vertex_map : Array
|
||||
var handle_points : PoolVector3Array
|
||||
|
||||
if arrays.size() != ArrayMesh.ARRAY_MAX || arrays[ArrayMesh.ARRAY_INDEX] == null:
|
||||
return [ handle_points, handle_to_vertex_map ]
|
||||
|
||||
var vertices : PoolVector3Array = arrays[ArrayMesh.ARRAY_VERTEX]
|
||||
|
||||
if vertices.size() == 0:
|
||||
return [ handle_points, handle_to_vertex_map ]
|
||||
|
||||
var arr : Array = Array()
|
||||
arr.resize(ArrayMesh.ARRAY_MAX)
|
||||
arr[ArrayMesh.ARRAY_VERTEX] = arrays[ArrayMesh.ARRAY_VERTEX]
|
||||
arr[ArrayMesh.ARRAY_INDEX] = arrays[ArrayMesh.ARRAY_INDEX]
|
||||
|
||||
var optimized_arrays : Array = MeshUtils.merge_mesh_array(arr)
|
||||
var optimized_verts : PoolVector3Array = optimized_arrays[ArrayMesh.ARRAY_VERTEX]
|
||||
var optimized_indices : PoolIntArray = optimized_arrays[ArrayMesh.ARRAY_INDEX]
|
||||
|
||||
var vert_to_optimized_vert_map : Array = get_handle_vertex_to_vertex_map(arrays, optimized_verts)
|
||||
|
||||
var edge_map : Dictionary = Dictionary()
|
||||
|
||||
for i in range(0, optimized_indices.size(), 3):
|
||||
for j in range(3):
|
||||
var i0 : int = optimized_indices[i + j]
|
||||
var i1 : int = optimized_indices[i + ((j + 1) % 3)]
|
||||
|
||||
var ei0 : int = min(i0, i1)
|
||||
var ei1 : int = max(i0, i1)
|
||||
|
||||
if !edge_map.has(ei0):
|
||||
edge_map[ei0] = PoolIntArray()
|
||||
|
||||
var etm : PoolIntArray = edge_map[ei0]
|
||||
|
||||
var found : bool = false
|
||||
for e in etm:
|
||||
if e == ei1:
|
||||
found = true
|
||||
break
|
||||
|
||||
if !found:
|
||||
etm.append(ei1)
|
||||
edge_map[ei0] = etm
|
||||
|
||||
for key in edge_map.keys():
|
||||
var indices : PoolIntArray = edge_map[key]
|
||||
|
||||
for indx in indices:
|
||||
var ei0 : int = key
|
||||
var ei1 : int = indx
|
||||
|
||||
var v0 : Vector3 = optimized_verts[ei0]
|
||||
var v1 : Vector3 = optimized_verts[ei1]
|
||||
|
||||
var emid : Vector3 = lerp(v0, v1, 0.5)
|
||||
handle_points.append(emid)
|
||||
var hindx : int = handle_points.size() - 1
|
||||
|
||||
var vm0 : PoolIntArray = vert_to_optimized_vert_map[ei0]
|
||||
var vm1 : PoolIntArray = vert_to_optimized_vert_map[ei1]
|
||||
|
||||
var vm : PoolIntArray = PoolIntArray()
|
||||
vm.append_array(vm0)
|
||||
|
||||
for vi in vm1:
|
||||
var found : bool = false
|
||||
for vit in vm:
|
||||
if vi == vit:
|
||||
found = true
|
||||
break
|
||||
|
||||
if !found:
|
||||
vm.append(vi)
|
||||
|
||||
handle_to_vertex_map.append(vm)
|
||||
|
||||
return [ handle_points, handle_to_vertex_map ]
|
||||
|
||||
#returns an array:
|
||||
#index 0 is the handle_points
|
||||
#index 1 is the handle_to_vertex_map
|
||||
static func get_handle_face_to_vertex_map(arrays : Array) -> Array:
|
||||
var handle_to_vertex_map : Array
|
||||
var handle_points : PoolVector3Array
|
||||
|
||||
if arrays.size() != ArrayMesh.ARRAY_MAX || arrays[ArrayMesh.ARRAY_INDEX] == null:
|
||||
return [ handle_points, handle_to_vertex_map ]
|
||||
|
||||
var vertices : PoolVector3Array = arrays[ArrayMesh.ARRAY_VERTEX]
|
||||
|
||||
if vertices.size() == 0:
|
||||
return [ handle_points, handle_to_vertex_map ]
|
||||
|
||||
var arr : Array = Array()
|
||||
arr.resize(ArrayMesh.ARRAY_MAX)
|
||||
arr[ArrayMesh.ARRAY_VERTEX] = arrays[ArrayMesh.ARRAY_VERTEX]
|
||||
arr[ArrayMesh.ARRAY_INDEX] = arrays[ArrayMesh.ARRAY_INDEX]
|
||||
|
||||
var optimized_arrays : Array = MeshUtils.merge_mesh_array(arr)
|
||||
var optimized_verts : PoolVector3Array = optimized_arrays[ArrayMesh.ARRAY_VERTEX]
|
||||
var optimized_indices : PoolIntArray = optimized_arrays[ArrayMesh.ARRAY_INDEX]
|
||||
|
||||
var vert_to_optimized_vert_map : Array = get_handle_vertex_to_vertex_map(arrays, optimized_verts)
|
||||
|
||||
for i in range(0, optimized_indices.size(), 3):
|
||||
var i0 : int = optimized_indices[i + 0]
|
||||
var i1 : int = optimized_indices[i + 1]
|
||||
var i2 : int = optimized_indices[i + 2]
|
||||
|
||||
var v0 : Vector3 = optimized_verts[i0]
|
||||
var v1 : Vector3 = optimized_verts[i1]
|
||||
var v2 : Vector3 = optimized_verts[i2]
|
||||
|
||||
var pmid : Vector3 = v0 + v1 + v2
|
||||
pmid /= 3
|
||||
handle_points.append(pmid)
|
||||
|
||||
var vm0 : PoolIntArray = vert_to_optimized_vert_map[i0]
|
||||
var vm1 : PoolIntArray = vert_to_optimized_vert_map[i1]
|
||||
var vm2 : PoolIntArray = vert_to_optimized_vert_map[i2]
|
||||
|
||||
var vm : PoolIntArray = PoolIntArray()
|
||||
vm.append_array(vm0)
|
||||
|
||||
for vi in vm1:
|
||||
var found : bool = false
|
||||
for vit in vm:
|
||||
if vi == vit:
|
||||
found = true
|
||||
break
|
||||
|
||||
if !found:
|
||||
vm.append(vi)
|
||||
|
||||
for vi in vm2:
|
||||
var found : bool = false
|
||||
for vit in vm:
|
||||
if vi == vit:
|
||||
found = true
|
||||
break
|
||||
|
||||
if !found:
|
||||
vm.append(vi)
|
||||
|
||||
handle_to_vertex_map.append(vm)
|
||||
|
||||
return [ handle_points, handle_to_vertex_map ]
|
||||
|
||||
static func calculate_map_midpoints(mesh : Array, vertex_map : Array) -> PoolVector3Array:
|
||||
return PoolVector3Array()
|
||||
|
||||
static func pool_int_arr_contains(arr : PoolIntArray, val : int) -> bool:
|
||||
for a in arr:
|
||||
if a == val:
|
||||
return true
|
||||
|
||||
return false
|
||||
|
||||
static func partition_mesh(mdr : MeshDataResource) -> Array:
|
||||
var partitions : Array = Array()
|
||||
|
||||
var arrays : Array = mdr.get_array()
|
||||
|
||||
if arrays.size() != ArrayMesh.ARRAY_MAX:
|
||||
return partitions
|
||||
|
||||
if arrays[ArrayMesh.ARRAY_INDEX] == null:
|
||||
return partitions
|
||||
|
||||
var indices : PoolIntArray = arrays[ArrayMesh.ARRAY_INDEX]
|
||||
|
||||
var triangle_count : int = indices.size() / 3
|
||||
var processed_triangles : PoolIntArray = PoolIntArray()
|
||||
|
||||
while triangle_count != processed_triangles.size():
|
||||
var partition : PoolIntArray = PoolIntArray()
|
||||
|
||||
var first : bool = true
|
||||
var triangle_added : bool = true
|
||||
while triangle_added:
|
||||
triangle_added = false
|
||||
for i in range(indices.size()):
|
||||
var triangle_index : int = i / 3
|
||||
|
||||
if pool_int_arr_contains(processed_triangles, triangle_index):
|
||||
continue
|
||||
|
||||
if first:
|
||||
first = false
|
||||
|
||||
# We have to be at the 0th index of a triangle
|
||||
partition.append(indices[i])
|
||||
partition.append(indices[i + 1])
|
||||
partition.append(indices[i + 2])
|
||||
|
||||
triangle_added = true
|
||||
break
|
||||
|
||||
var index : int = indices[i]
|
||||
|
||||
if pool_int_arr_contains(partition, index):
|
||||
processed_triangles.append(triangle_index)
|
||||
|
||||
var tri_start_index : int = i - (i % 3)
|
||||
|
||||
var i0 : int = indices[tri_start_index]
|
||||
var i1 : int = indices[tri_start_index + 1]
|
||||
var i2 : int = indices[tri_start_index + 2]
|
||||
|
||||
partition.append(i0)
|
||||
partition.append(i1)
|
||||
partition.append(i2)
|
||||
|
||||
triangle_added = true
|
||||
break
|
||||
|
||||
|
||||
partitions.append(partition)
|
||||
|
||||
|
||||
return partitions
|
@ -1,167 +0,0 @@
|
||||
tool
|
||||
extends Reference
|
||||
|
||||
var marker_size : float = 0.05
|
||||
|
||||
var _mdr : MeshDataResource
|
||||
|
||||
var lines : PoolVector3Array
|
||||
var seam_lines : PoolVector3Array
|
||||
|
||||
var _vertices : PoolVector3Array = PoolVector3Array()
|
||||
var _normals : PoolVector3Array = PoolVector3Array()
|
||||
var _indices : PoolIntArray = PoolIntArray()
|
||||
|
||||
func setup(mdr : MeshDataResource) -> void:
|
||||
_mdr = mdr
|
||||
|
||||
func reset() -> void:
|
||||
lines.resize(0)
|
||||
seam_lines.resize(0)
|
||||
_normals.resize(0)
|
||||
_vertices.resize(0)
|
||||
_indices.resize(0)
|
||||
|
||||
func initialize() -> bool:
|
||||
if !_mdr:
|
||||
return false
|
||||
|
||||
if _mdr.array.size() != ArrayMesh.ARRAY_MAX:
|
||||
return false
|
||||
|
||||
if _mdr.array[ArrayMesh.ARRAY_VERTEX] == null || _mdr.array[ArrayMesh.ARRAY_INDEX] == null:
|
||||
return false
|
||||
|
||||
var arr : Array = _mdr.array
|
||||
|
||||
_vertices = arr[ArrayMesh.ARRAY_VERTEX]
|
||||
|
||||
if _mdr.array[ArrayMesh.ARRAY_NORMAL] != null:
|
||||
_normals = arr[ArrayMesh.ARRAY_NORMAL]
|
||||
|
||||
_indices = arr[ArrayMesh.ARRAY_INDEX]
|
||||
|
||||
if _vertices.size() == 0:
|
||||
return false
|
||||
|
||||
return true
|
||||
|
||||
func get_vertex(index : int) -> Vector3:
|
||||
if index > _vertices.size():
|
||||
return Vector3()
|
||||
|
||||
var v : Vector3 = _vertices[index]
|
||||
|
||||
# This should reduce z fighting
|
||||
if _normals.size() > 0:
|
||||
var n : Vector3 = _normals[index]
|
||||
|
||||
v += n * 0.001
|
||||
|
||||
return v
|
||||
|
||||
func generate(mark_outline : bool, mark_handles : bool):
|
||||
reset()
|
||||
|
||||
if !initialize():
|
||||
return
|
||||
|
||||
if mark_outline:
|
||||
for i in range(0, _indices.size(), 3):
|
||||
for j in range(3):
|
||||
lines.append(get_vertex(_indices[i + j]))
|
||||
lines.append(get_vertex(_indices[i + ((j + 1) % 3)]))
|
||||
|
||||
if mark_handles:
|
||||
for i in range(_vertices.size()):
|
||||
var v : Vector3 = get_vertex(i)
|
||||
|
||||
var l : float = 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))
|
||||
|
||||
var seams : PoolIntArray = _mdr.seams
|
||||
|
||||
for i in range(0, seams.size(), 2):
|
||||
seam_lines.append(get_vertex(seams[i]))
|
||||
seam_lines.append(get_vertex(seams[i + 1]))
|
||||
|
||||
func generate_mark_edges(mark_outline : bool, mark_handles : bool):
|
||||
reset()
|
||||
|
||||
if !initialize():
|
||||
return
|
||||
|
||||
for i in range(0, _indices.size(), 3):
|
||||
for j in range(3):
|
||||
var i0 : int = _indices[i + j]
|
||||
var i1 : int = _indices[i + ((j + 1) % 3)]
|
||||
|
||||
var v0 : Vector3 = get_vertex(i0)
|
||||
var v1 : Vector3 = get_vertex(i1)
|
||||
|
||||
if mark_outline:
|
||||
lines.append(v0)
|
||||
lines.append(v1)
|
||||
|
||||
if mark_handles:
|
||||
var pmid : Vector3 = lerp(v0, v1, 0.5)
|
||||
var l : float = 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))
|
||||
|
||||
|
||||
var seams : PoolIntArray = _mdr.seams
|
||||
|
||||
for i in range(0, seams.size(), 2):
|
||||
seam_lines.append(get_vertex(seams[i]))
|
||||
seam_lines.append(get_vertex(seams[i + 1]))
|
||||
|
||||
func generate_mark_faces(mark_outline : bool, mark_handles : bool):
|
||||
reset()
|
||||
|
||||
if !initialize():
|
||||
return
|
||||
|
||||
if mark_outline:
|
||||
for i in range(0, _indices.size(), 3):
|
||||
for j in range(3):
|
||||
lines.append(get_vertex(_indices[i + j]))
|
||||
lines.append(get_vertex(_indices[i + ((j + 1) % 3)]))
|
||||
|
||||
if mark_handles:
|
||||
for i in range(0, _indices.size(), 3):
|
||||
var i0 : int = _indices[i + 0]
|
||||
var i1 : int = _indices[i + 1]
|
||||
var i2 : int = _indices[i + 2]
|
||||
|
||||
var v0 : Vector3 = get_vertex(i0)
|
||||
var v1 : Vector3 = get_vertex(i1)
|
||||
var v2 : Vector3 = get_vertex(i2)
|
||||
|
||||
var pmid : Vector3 = v0 + v1 + v2
|
||||
pmid /= 3
|
||||
var l : float = 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))
|
||||
|
||||
var seams : PoolIntArray = _mdr.seams
|
||||
|
||||
for i in range(0, seams.size(), 2):
|
||||
seam_lines.append(get_vertex(seams[i]))
|
||||
seam_lines.append(get_vertex(seams[i + 1]))
|
@ -1,18 +0,0 @@
|
||||
tool
|
||||
extends PanelContainer
|
||||
|
||||
func set_plugin(plugin : EditorPlugin) -> void:
|
||||
$ScrollContainer/MarginContainer/RectView.set_plugin(plugin)
|
||||
|
||||
func set_mesh_data_resource(a : MeshDataResource) -> void:
|
||||
$ScrollContainer/MarginContainer/RectView.set_mesh_data_resource(a)
|
||||
|
||||
func set_mesh_data_instance(a : MeshDataInstance) -> void:
|
||||
$ScrollContainer/MarginContainer/RectView.set_mesh_data_instance(a)
|
||||
|
||||
func ok_pressed() -> void:
|
||||
$ScrollContainer/MarginContainer/RectView.ok_pressed()
|
||||
|
||||
func cancel_pressed() -> void:
|
||||
$ScrollContainer/MarginContainer/RectView.cancel_pressed()
|
||||
|
@ -1,250 +0,0 @@
|
||||
tool
|
||||
extends Control
|
||||
|
||||
var MeshDecompose = preload("res://addons/mesh_data_resource_editor/utilities/mesh_decompose.gd")
|
||||
|
||||
var rect_editor_node_scene : PackedScene = preload("res://addons/mesh_data_resource_editor/uv_editor/RectViewNode.tscn")
|
||||
|
||||
export(NodePath) var zoom_widget_path : NodePath = ""
|
||||
|
||||
export(NodePath) var mirror_horizontal_button_path : NodePath = ""
|
||||
export(NodePath) var mirror_vertical_button_path : NodePath = ""
|
||||
|
||||
export(NodePath) var rotate_left_button_path : NodePath = ""
|
||||
export(NodePath) var rotate_amount_spinbox_path : NodePath = ""
|
||||
export(NodePath) var rotate_right_button_path : NodePath = ""
|
||||
|
||||
var _rect_scale : float = 1
|
||||
|
||||
var _mdr : MeshDataResource = null
|
||||
var _background_texture : Texture = null
|
||||
|
||||
var base_rect : Rect2 = Rect2(0, 0, 600, 600)
|
||||
var edited_resource_current_size : Vector2 = Vector2()
|
||||
|
||||
var _stored_uvs : PoolVector2Array = PoolVector2Array()
|
||||
|
||||
var _plugin : EditorPlugin = null
|
||||
var _undo_redo : UndoRedo = null
|
||||
|
||||
var selected_rect : Control = null
|
||||
|
||||
var rotation_amount : float = 45
|
||||
|
||||
func _enter_tree():
|
||||
var zoom_widget : Node = get_node_or_null(zoom_widget_path)
|
||||
|
||||
if zoom_widget && !zoom_widget.is_connected("zoom_changed", self, "on_zoom_changed"):
|
||||
zoom_widget.connect("zoom_changed", self, "on_zoom_changed")
|
||||
|
||||
var mirror_horizontal_button : Button = get_node_or_null(mirror_horizontal_button_path)
|
||||
if mirror_horizontal_button && !mirror_horizontal_button.is_connected("pressed", self, "on_mirror_horizontal_button_pressed"):
|
||||
mirror_horizontal_button.connect("pressed", self, "on_mirror_horizontal_button_pressed")
|
||||
|
||||
var mirror_vertical_button : Button = get_node_or_null(mirror_vertical_button_path)
|
||||
if mirror_vertical_button && !mirror_vertical_button.is_connected("pressed", self, "on_mirror_vertical_button_pressed"):
|
||||
mirror_vertical_button.connect("pressed", self, "on_mirror_vertical_button_pressed")
|
||||
|
||||
var rotate_left_button : Button = get_node_or_null(rotate_left_button_path)
|
||||
if rotate_left_button && !rotate_left_button.is_connected("pressed", self, "on_rotate_left_button_button_pressed"):
|
||||
rotate_left_button.connect("pressed", self, "on_rotate_left_button_button_pressed")
|
||||
|
||||
var rotate_amount_spinbox : SpinBox = get_node_or_null(rotate_amount_spinbox_path)
|
||||
if rotate_amount_spinbox:
|
||||
rotation_amount = rotate_amount_spinbox.value
|
||||
if !rotate_amount_spinbox.is_connected("value_changed", self, "on_rotate_amount_spinbox_changed"):
|
||||
rotate_amount_spinbox.connect("value_changed", self, "on_rotate_amount_spinbox_changed")
|
||||
|
||||
var rotate_right_button : Button = get_node_or_null(rotate_right_button_path)
|
||||
if rotate_right_button && !rotate_right_button.is_connected("pressed", self, "on_rotate_right_button_button_pressed"):
|
||||
rotate_right_button.connect("pressed", self, "on_rotate_right_button_button_pressed")
|
||||
|
||||
if !is_connected("visibility_changed", self, "on_visibility_changed"):
|
||||
connect("visibility_changed", self, "on_visibility_changed")
|
||||
|
||||
func on_mirror_horizontal_button_pressed() -> void:
|
||||
if selected_rect && is_instance_valid(selected_rect):
|
||||
selected_rect.mirror_horizontal()
|
||||
|
||||
func on_mirror_vertical_button_pressed() -> void:
|
||||
if selected_rect && is_instance_valid(selected_rect):
|
||||
selected_rect.mirror_vertical()
|
||||
|
||||
func on_rotate_left_button_button_pressed() -> void:
|
||||
if selected_rect && is_instance_valid(selected_rect):
|
||||
selected_rect.rotate_uvs(-rotation_amount)
|
||||
|
||||
func on_rotate_amount_spinbox_changed(val : float) -> void:
|
||||
rotation_amount = val
|
||||
|
||||
func on_rotate_right_button_button_pressed() -> void:
|
||||
if selected_rect && is_instance_valid(selected_rect):
|
||||
selected_rect.rotate_uvs(rotation_amount)
|
||||
|
||||
func set_plugin(plugin : EditorPlugin) -> void:
|
||||
_plugin = plugin
|
||||
|
||||
_undo_redo = _plugin.get_undo_redo()
|
||||
|
||||
func on_visibility_changed() -> void:
|
||||
if is_visible_in_tree():
|
||||
store_uvs()
|
||||
call_deferred("refresh")
|
||||
|
||||
func apply_zoom() -> void:
|
||||
var rect : Rect2 = base_rect
|
||||
edited_resource_current_size = rect.size
|
||||
rect.position = rect.position * _rect_scale
|
||||
rect.size = rect.size * _rect_scale
|
||||
set_custom_minimum_size(rect.size)
|
||||
|
||||
var p : MarginContainer = get_parent() as MarginContainer
|
||||
|
||||
p.add_constant_override("margin_left", min(rect.size.x / 4.0, 50 * _rect_scale))
|
||||
p.add_constant_override("margin_right", min(rect.size.x / 4.0, 50 * _rect_scale))
|
||||
p.add_constant_override("margin_top", min(rect.size.y / 4.0, 50 * _rect_scale))
|
||||
p.add_constant_override("margin_bottom", min(rect.size.y / 4.0, 50 * _rect_scale))
|
||||
|
||||
for c in get_children():
|
||||
c.set_editor_rect_scale(_rect_scale)
|
||||
|
||||
func on_zoom_changed(zoom : float) -> void:
|
||||
_rect_scale = zoom
|
||||
apply_zoom()
|
||||
|
||||
func _draw():
|
||||
draw_rect(Rect2(Vector2(), get_size()), Color(0.2, 0.2, 0.2, 1))
|
||||
|
||||
if _background_texture:
|
||||
draw_texture_rect_region(_background_texture, Rect2(Vector2(), get_size()), Rect2(Vector2(), _background_texture.get_size()))
|
||||
|
||||
func refresh() -> void:
|
||||
clear()
|
||||
|
||||
var rect : Rect2 = base_rect
|
||||
edited_resource_current_size = rect.size
|
||||
rect.position = rect.position * _rect_scale
|
||||
rect.size = rect.size * _rect_scale
|
||||
set_custom_minimum_size(rect.size)
|
||||
|
||||
apply_zoom()
|
||||
|
||||
refresh_rects()
|
||||
|
||||
func clear() -> void:
|
||||
pass
|
||||
|
||||
func refresh_rects() -> void:
|
||||
clear_rects()
|
||||
|
||||
if !_mdr:
|
||||
return
|
||||
|
||||
var partitions : Array = MeshDecompose.partition_mesh(_mdr)
|
||||
|
||||
for p in partitions:
|
||||
var s : Node = rect_editor_node_scene.instance()
|
||||
|
||||
add_child(s)
|
||||
s.set_editor_rect_scale(_rect_scale)
|
||||
s.edited_resource_parent_size = edited_resource_current_size
|
||||
s.set_edited_resource(_mdr, p)
|
||||
|
||||
func clear_rects():
|
||||
for c in get_children():
|
||||
c.queue_free()
|
||||
remove_child(c)
|
||||
|
||||
func set_mesh_data_resource(a : MeshDataResource) -> void:
|
||||
_mdr = a
|
||||
|
||||
func set_mesh_data_instance(a : MeshDataInstance) -> void:
|
||||
_background_texture = null
|
||||
|
||||
if a:
|
||||
_background_texture = a.texture
|
||||
|
||||
func on_edited_resource_changed() -> void:
|
||||
call_deferred("refresh")
|
||||
|
||||
func get_uvs(mdr : MeshDataResource) -> PoolVector2Array:
|
||||
if !_mdr:
|
||||
return PoolVector2Array()
|
||||
|
||||
var arrays : Array = _mdr.get_array()
|
||||
|
||||
if arrays.size() != ArrayMesh.ARRAY_MAX:
|
||||
return PoolVector2Array()
|
||||
|
||||
if arrays[ArrayMesh.ARRAY_TEX_UV] == null:
|
||||
return PoolVector2Array()
|
||||
|
||||
return arrays[ArrayMesh.ARRAY_TEX_UV]
|
||||
|
||||
func store_uvs() -> void:
|
||||
_stored_uvs.resize(0)
|
||||
|
||||
if !_mdr:
|
||||
return
|
||||
|
||||
var arrays : Array = _mdr.get_array()
|
||||
|
||||
if arrays.size() != ArrayMesh.ARRAY_MAX:
|
||||
return
|
||||
|
||||
if arrays[ArrayMesh.ARRAY_TEX_UV] == null:
|
||||
return
|
||||
|
||||
# Make sure it gets copied
|
||||
_stored_uvs.append_array(arrays[ArrayMesh.ARRAY_TEX_UV])
|
||||
|
||||
func apply_uvs(mdr : MeshDataResource, stored_uvs : PoolVector2Array) -> void:
|
||||
if !_mdr:
|
||||
return
|
||||
|
||||
var arrays : Array = _mdr.get_array()
|
||||
|
||||
if arrays.size() != ArrayMesh.ARRAY_MAX:
|
||||
return
|
||||
|
||||
if arrays[ArrayMesh.ARRAY_TEX_UV] == null:
|
||||
return
|
||||
|
||||
arrays[ArrayMesh.ARRAY_TEX_UV] = stored_uvs
|
||||
|
||||
_mdr.array = arrays
|
||||
|
||||
func ok_pressed() -> void:
|
||||
_undo_redo.create_action("UV Editor Accept")
|
||||
_undo_redo.add_do_method(self, "apply_uvs", _mdr, get_uvs(_mdr))
|
||||
_undo_redo.add_undo_method(self, "apply_uvs", _mdr, _stored_uvs)
|
||||
_undo_redo.commit_action()
|
||||
|
||||
func cancel_pressed() -> void:
|
||||
if !_mdr:
|
||||
return
|
||||
|
||||
var arrays : Array = _mdr.get_array()
|
||||
|
||||
if arrays.size() != ArrayMesh.ARRAY_MAX:
|
||||
return
|
||||
|
||||
# Make sure it gets copied
|
||||
var uvs : PoolVector2Array = PoolVector2Array()
|
||||
uvs.append_array(_stored_uvs)
|
||||
|
||||
_undo_redo.create_action("UV Editor Cancel")
|
||||
_undo_redo.add_do_method(self, "apply_uvs", _mdr, uvs)
|
||||
_undo_redo.add_undo_method(self, "apply_uvs", _mdr, get_uvs(_mdr))
|
||||
_undo_redo.commit_action()
|
||||
|
||||
_stored_uvs.resize(0)
|
||||
|
||||
func set_selected(node : Control) -> void:
|
||||
if selected_rect && is_instance_valid(selected_rect):
|
||||
selected_rect.set_selected(false)
|
||||
|
||||
selected_rect = node
|
||||
|
||||
if selected_rect:
|
||||
selected_rect.set_selected(true)
|
@ -1,418 +0,0 @@
|
||||
tool
|
||||
extends MarginContainer
|
||||
|
||||
enum DragType {
|
||||
DRAG_NONE = 0,
|
||||
DRAG_MOVE = 1,
|
||||
DRAG_RESIZE_TOP = 1 << 1,
|
||||
DRAG_RESIZE_RIGHT = 1 << 2,
|
||||
DRAG_RESIZE_BOTTOM = 1 << 3,
|
||||
DRAG_RESIZE_LEFT = 1 << 4
|
||||
};
|
||||
|
||||
var selected : bool = false
|
||||
|
||||
var _mdr : MeshDataResource = null
|
||||
var _indices : PoolIntArray = PoolIntArray()
|
||||
var _uvs : PoolVector2Array = PoolVector2Array()
|
||||
var _base_rect : Rect2 = Rect2(0, 0, 100, 100)
|
||||
var _uv_min : Vector2 = Vector2()
|
||||
var _uv_max : Vector2 = Vector2()
|
||||
|
||||
var edited_resource_parent_size : Vector2 = Vector2()
|
||||
|
||||
var _edited_resource_rect_border_color : Color = Color(0.8, 0.8, 0.8, 0.5)
|
||||
var _edited_resource_rect_color : Color = Color(0.5, 0.5, 0.5, 0.2)
|
||||
var _edited_resource_rect_selected_border_color : Color = Color(0.9, 0.9, 0.9, 0.8)
|
||||
var _edited_resource_rect_selected_color : Color = Color(0.5, 0.5, 0.5, 0.4)
|
||||
var _edited_resource_uv_mesh_color : Color = Color(1, 1, 1, 1)
|
||||
var _editor_rect_border_size : int = 2
|
||||
var _edited_resource_font_color : Color = Color(0, 0, 0, 1)
|
||||
var _editor_additional_text : String = ""
|
||||
|
||||
var drag_type : int
|
||||
var drag_offset : Vector2
|
||||
var drag_offset_far : Vector2
|
||||
|
||||
var _rect_scale : float = 1
|
||||
|
||||
func _draw():
|
||||
if selected:
|
||||
draw_rect(Rect2(Vector2(), get_size()), _edited_resource_rect_selected_color)
|
||||
draw_rect(Rect2(Vector2(), get_size()), _edited_resource_rect_selected_border_color, false, _editor_rect_border_size)
|
||||
else:
|
||||
draw_rect(Rect2(Vector2(), get_size()), _edited_resource_rect_color)
|
||||
draw_rect(Rect2(Vector2(), get_size()), _edited_resource_rect_border_color, false, _editor_rect_border_size)
|
||||
|
||||
if _mdr && _uvs.size() > 0:
|
||||
var c : Color = _edited_resource_uv_mesh_color
|
||||
|
||||
for i in range(0, len(_indices), 3):
|
||||
draw_line(_uvs[_indices[i]] * get_size(), _uvs[_indices[i + 1]] * get_size(), c, 1, false)
|
||||
draw_line(_uvs[_indices[i + 1]] * get_size(), _uvs[_indices[i + 2]] * get_size(), c, 1, false)
|
||||
draw_line(_uvs[_indices[i + 2]] * get_size(), _uvs[_indices[i]] * get_size(), c, 1, false)
|
||||
|
||||
func mirror_horizontal() -> void:
|
||||
var pia : PoolIntArray = PoolIntArray()
|
||||
for index in _indices:
|
||||
var found : bool = false
|
||||
|
||||
for i in pia:
|
||||
if i == index:
|
||||
found = true
|
||||
break
|
||||
|
||||
if found:
|
||||
continue
|
||||
|
||||
pia.append(index)
|
||||
|
||||
var uv : Vector2 = _uvs[index]
|
||||
uv.x = 1.0 - uv.x
|
||||
_uvs.set(index, uv)
|
||||
|
||||
apply_uv()
|
||||
update()
|
||||
|
||||
func mirror_vertical() -> void:
|
||||
var pia : PoolIntArray = PoolIntArray()
|
||||
for index in _indices:
|
||||
var found : bool = false
|
||||
|
||||
for i in pia:
|
||||
if i == index:
|
||||
found = true
|
||||
break
|
||||
|
||||
if found:
|
||||
continue
|
||||
|
||||
pia.append(index)
|
||||
|
||||
var uv : Vector2 = _uvs[index]
|
||||
uv.y = 1.0 - uv.y
|
||||
_uvs.set(index, uv)
|
||||
|
||||
apply_uv()
|
||||
update()
|
||||
|
||||
func rotate_uvs(amount : float) -> void:
|
||||
var t : Transform2D = Transform2D(deg2rad(amount), Vector2())
|
||||
|
||||
var pia : PoolIntArray = PoolIntArray()
|
||||
for index in _indices:
|
||||
var found : bool = false
|
||||
|
||||
for i in pia:
|
||||
if i == index:
|
||||
found = true
|
||||
break
|
||||
|
||||
if found:
|
||||
continue
|
||||
|
||||
pia.append(index)
|
||||
|
||||
var uv : Vector2 = _uvs[index]
|
||||
uv = t.xform(uv)
|
||||
_uvs.set(index, uv)
|
||||
|
||||
|
||||
re_normalize_uvs()
|
||||
apply_uv()
|
||||
update()
|
||||
|
||||
func refresh() -> void:
|
||||
if !_mdr:
|
||||
return
|
||||
|
||||
var rect : Rect2 = _base_rect
|
||||
rect.position *= _rect_scale
|
||||
rect.size *= _rect_scale
|
||||
|
||||
rect_position = rect.position
|
||||
rect_size = rect.size
|
||||
|
||||
update()
|
||||
|
||||
func set_editor_rect_scale(rect_scale) -> void:
|
||||
_rect_scale = rect_scale
|
||||
|
||||
refresh()
|
||||
|
||||
func set_edited_resource(mdr : MeshDataResource, indices : PoolIntArray):
|
||||
_mdr = mdr
|
||||
_indices = indices
|
||||
_uvs.resize(0)
|
||||
|
||||
var arrays : Array = _mdr.get_array()
|
||||
|
||||
if arrays.size() != ArrayMesh.ARRAY_MAX:
|
||||
return
|
||||
|
||||
if arrays[ArrayMesh.ARRAY_TEX_UV] == null:
|
||||
return
|
||||
|
||||
# Make sure it gets copied
|
||||
_uvs.append_array(arrays[ArrayMesh.ARRAY_TEX_UV])
|
||||
|
||||
set_up_base_rect()
|
||||
|
||||
refresh()
|
||||
|
||||
func set_up_base_rect() -> void:
|
||||
_base_rect = Rect2()
|
||||
|
||||
if !_mdr:
|
||||
return
|
||||
|
||||
if _uvs.size() == 0:
|
||||
return
|
||||
|
||||
var vmin : Vector2 = _uvs[_indices[0]]
|
||||
var vmax : Vector2 = vmin
|
||||
for i in range(1, _indices.size()):
|
||||
var uv : Vector2 = _uvs[_indices[i]]
|
||||
|
||||
if uv.x < vmin.x:
|
||||
vmin.x = uv.x
|
||||
|
||||
if uv.x > vmax.x:
|
||||
vmax.x = uv.x
|
||||
|
||||
if uv.y < vmin.y:
|
||||
vmin.y = uv.y
|
||||
|
||||
if uv.y > vmax.y:
|
||||
vmax.y = uv.y
|
||||
|
||||
_base_rect = Rect2(vmin.x, vmin.y, vmax.x - vmin.x, vmax.y - vmin.y)
|
||||
_base_rect.position *= edited_resource_parent_size
|
||||
_base_rect.size *= edited_resource_parent_size
|
||||
|
||||
_uv_min = vmin
|
||||
_uv_max = vmax
|
||||
|
||||
normalize_uvs()
|
||||
|
||||
func re_normalize_uvs() -> void:
|
||||
if _uvs.size() == 0:
|
||||
return
|
||||
|
||||
var vmin : Vector2 = _uvs[_indices[0]]
|
||||
var vmax : Vector2 = vmin
|
||||
for i in range(1, _indices.size()):
|
||||
var uv : Vector2 = _uvs[_indices[i]]
|
||||
|
||||
if uv.x < vmin.x:
|
||||
vmin.x = uv.x
|
||||
|
||||
if uv.x > vmax.x:
|
||||
vmax.x = uv.x
|
||||
|
||||
if uv.y < vmin.y:
|
||||
vmin.y = uv.y
|
||||
|
||||
if uv.y > vmax.y:
|
||||
vmax.y = uv.y
|
||||
|
||||
var xmm : float = vmax.x - vmin.x
|
||||
var ymm : float = vmax.y - vmin.y
|
||||
|
||||
if xmm == 0:
|
||||
xmm = 0.0000001
|
||||
|
||||
if ymm == 0:
|
||||
ymm = 0.0000001
|
||||
|
||||
for i in range(_uvs.size()):
|
||||
var uv : Vector2 = _uvs[i]
|
||||
|
||||
uv.x -= vmin.x
|
||||
uv.x /= xmm
|
||||
|
||||
uv.y -= vmin.y
|
||||
uv.y /= ymm
|
||||
|
||||
_uvs[i] = uv
|
||||
|
||||
func normalize_uvs() -> void:
|
||||
var xmm : float = _uv_max.x - _uv_min.x
|
||||
var ymm : float = _uv_max.y - _uv_min.y
|
||||
|
||||
if xmm == 0:
|
||||
xmm = 0.0000001
|
||||
|
||||
if ymm == 0:
|
||||
ymm = 0.0000001
|
||||
|
||||
for i in range(_uvs.size()):
|
||||
var uv : Vector2 = _uvs[i]
|
||||
|
||||
uv.x -= _uv_min.x
|
||||
uv.x /= xmm
|
||||
|
||||
uv.y -= _uv_min.y
|
||||
uv.y /= ymm
|
||||
|
||||
_uvs[i] = uv
|
||||
|
||||
func apply_uv() -> void:
|
||||
if !_mdr:
|
||||
return
|
||||
|
||||
var rect : Rect2 = get_rect()
|
||||
|
||||
#rect needs to be converted back
|
||||
rect.position /= _rect_scale
|
||||
rect.size /= _rect_scale
|
||||
rect.position /= edited_resource_parent_size
|
||||
rect.size /= edited_resource_parent_size
|
||||
|
||||
var arrays : Array = _mdr.get_array()
|
||||
|
||||
if arrays.size() != ArrayMesh.ARRAY_MAX:
|
||||
return
|
||||
|
||||
if arrays[ArrayMesh.ARRAY_TEX_UV] == null:
|
||||
return
|
||||
|
||||
var uvs : PoolVector2Array = arrays[ArrayMesh.ARRAY_TEX_UV]
|
||||
|
||||
for index in _indices:
|
||||
var uv : Vector2 = _uvs[index]
|
||||
|
||||
uv = uv * rect.size + rect.position
|
||||
|
||||
uvs[index] = uv
|
||||
|
||||
_uv_min = rect.position
|
||||
_uv_max = rect.position + rect.size
|
||||
|
||||
_base_rect = get_rect()
|
||||
|
||||
arrays[ArrayMesh.ARRAY_TEX_UV] = uvs
|
||||
_mdr.array = arrays
|
||||
|
||||
|
||||
#based on / ported from engine/scene/gui/dialogs.h and .cpp
|
||||
func _notification(p_what : int) -> void:
|
||||
if (p_what == NOTIFICATION_MOUSE_EXIT):
|
||||
# Reset the mouse cursor when leaving the resizable window border.
|
||||
if (_mdr && !drag_type):
|
||||
if (get_default_cursor_shape() != CURSOR_ARROW):
|
||||
set_default_cursor_shape(CURSOR_ARROW)
|
||||
|
||||
#based on / ported from engine/scene/gui/dialogs.h and .cpp
|
||||
func _gui_input(p_event : InputEvent) -> void:
|
||||
if (p_event is InputEventMouseButton) && (p_event.get_button_index() == BUTTON_LEFT):
|
||||
var mb : InputEventMouseButton = p_event as InputEventMouseButton
|
||||
|
||||
if (mb.is_pressed()):
|
||||
get_parent().set_selected(self)
|
||||
|
||||
# Begin a possible dragging operation.
|
||||
drag_type = _drag_hit_test(Vector2(mb.get_position().x, mb.get_position().y))
|
||||
|
||||
if (drag_type != DragType.DRAG_NONE):
|
||||
drag_offset = get_global_mouse_position() - get_position()
|
||||
|
||||
drag_offset_far = get_position() + get_size() - get_global_mouse_position()
|
||||
|
||||
elif (drag_type != DragType.DRAG_NONE && !mb.is_pressed()):
|
||||
# End a dragging operation.
|
||||
|
||||
apply_uv()
|
||||
|
||||
drag_type = DragType.DRAG_NONE
|
||||
|
||||
if p_event is InputEventMouseMotion:
|
||||
var mm : InputEventMouseMotion = p_event as InputEventMouseMotion
|
||||
|
||||
if (drag_type == DragType.DRAG_NONE):
|
||||
# Update the cursor while moving along the borders.
|
||||
var cursor = CURSOR_ARROW
|
||||
|
||||
var preview_drag_type : int = _drag_hit_test(Vector2(mm.get_position().x, mm.get_position().y))
|
||||
|
||||
var top_left : int = DragType.DRAG_RESIZE_TOP + DragType.DRAG_RESIZE_LEFT
|
||||
var bottom_right : int = DragType.DRAG_RESIZE_BOTTOM + DragType.DRAG_RESIZE_RIGHT
|
||||
var top_right : int = DragType.DRAG_RESIZE_TOP + DragType.DRAG_RESIZE_RIGHT
|
||||
var bottom_left : int = DragType.DRAG_RESIZE_BOTTOM + DragType.DRAG_RESIZE_LEFT
|
||||
|
||||
match (preview_drag_type):
|
||||
DragType.DRAG_RESIZE_TOP:
|
||||
cursor = CURSOR_VSIZE
|
||||
DragType.DRAG_RESIZE_BOTTOM:
|
||||
cursor = CURSOR_VSIZE
|
||||
DragType.DRAG_RESIZE_LEFT:
|
||||
cursor = CURSOR_HSIZE
|
||||
DragType.DRAG_RESIZE_RIGHT:
|
||||
cursor = CURSOR_HSIZE
|
||||
top_left:
|
||||
cursor = CURSOR_FDIAGSIZE
|
||||
bottom_right:
|
||||
cursor = CURSOR_FDIAGSIZE
|
||||
top_right:
|
||||
cursor = CURSOR_BDIAGSIZE
|
||||
bottom_left:
|
||||
cursor = CURSOR_BDIAGSIZE
|
||||
|
||||
if (get_cursor_shape() != cursor):
|
||||
set_default_cursor_shape(cursor);
|
||||
|
||||
else:
|
||||
# Update while in a dragging operation.
|
||||
var global_pos : Vector2 = get_global_mouse_position()
|
||||
|
||||
var rect : Rect2 = get_rect()
|
||||
var min_size : Vector2 = get_combined_minimum_size()
|
||||
|
||||
if (drag_type == DragType.DRAG_MOVE):
|
||||
rect.position = global_pos - drag_offset
|
||||
else:
|
||||
if (drag_type & DragType.DRAG_RESIZE_TOP):
|
||||
var bottom : int = rect.position.y + rect.size.y
|
||||
var max_y : int = bottom - min_size.y
|
||||
rect.position.y = min(global_pos.y - drag_offset.y, max_y)
|
||||
rect.size.y = bottom - rect.position.y
|
||||
elif (drag_type & DragType.DRAG_RESIZE_BOTTOM):
|
||||
rect.size.y = global_pos.y - rect.position.y + drag_offset_far.y
|
||||
|
||||
if (drag_type & DragType.DRAG_RESIZE_LEFT):
|
||||
var right : int = rect.position.x + rect.size.x
|
||||
var max_x : int = right - min_size.x
|
||||
rect.position.x = min(global_pos.x - drag_offset.x, max_x)
|
||||
rect.size.x = right - rect.position.x
|
||||
elif (drag_type & DragType.DRAG_RESIZE_RIGHT):
|
||||
rect.size.x = global_pos.x - rect.position.x + drag_offset_far.x
|
||||
|
||||
set_size(rect.size)
|
||||
set_position(rect.position)
|
||||
|
||||
#based on / ported from engine/scene/gui/dialogs.h and .cpp
|
||||
func _drag_hit_test(pos : Vector2) -> int:
|
||||
var drag_type : int = DragType.DRAG_NONE
|
||||
|
||||
var scaleborder_size : int = 5 #get_constant("scaleborder_size", "WindowDialog")
|
||||
|
||||
var rect : Rect2 = get_rect()
|
||||
|
||||
if (pos.y < (scaleborder_size)):
|
||||
drag_type = DragType.DRAG_RESIZE_TOP
|
||||
elif (pos.y >= (rect.size.y - scaleborder_size)):
|
||||
drag_type = DragType.DRAG_RESIZE_BOTTOM
|
||||
|
||||
if (pos.x < scaleborder_size):
|
||||
drag_type |= DragType.DRAG_RESIZE_LEFT
|
||||
elif (pos.x >= (rect.size.x - scaleborder_size)):
|
||||
drag_type |= DragType.DRAG_RESIZE_RIGHT
|
||||
|
||||
if (drag_type == DragType.DRAG_NONE):
|
||||
drag_type = DragType.DRAG_MOVE
|
||||
|
||||
return drag_type
|
||||
|
||||
func set_selected(val : bool) -> void:
|
||||
selected = val
|
||||
update()
|
@ -1,11 +0,0 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/uv_editor/RectViewNode.gd" type="Script" id=1]
|
||||
|
||||
[node name="RectViewNode" type="MarginContainer"]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
@ -1,121 +0,0 @@
|
||||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/uv_editor/RectEditor.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/widgets/EditorZoomWidget.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/uv_editor/RectView.gd" type="Script" id=3]
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/icons/icon_v_mirror.png" type="Texture" id=4]
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/icons/icon_h_mirror.png" type="Texture" id=5]
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/icons/icon_rot_right.png" type="Texture" id=6]
|
||||
[ext_resource path="res://addons/mesh_data_resource_editor/icons/icon_rot_left.png" type="Texture" id=7]
|
||||
|
||||
[node name="UVEditor" type="PanelContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 1017.0
|
||||
margin_bottom = 593.0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="ScrollContainer"]
|
||||
margin_right = 700.0
|
||||
margin_bottom = 700.0
|
||||
custom_constants/margin_right = 50
|
||||
custom_constants/margin_top = 50
|
||||
custom_constants/margin_left = 50
|
||||
custom_constants/margin_bottom = 50
|
||||
|
||||
[node name="RectView" type="Control" parent="ScrollContainer/MarginContainer"]
|
||||
margin_left = 50.0
|
||||
margin_top = 50.0
|
||||
margin_right = 650.0
|
||||
margin_bottom = 650.0
|
||||
rect_min_size = Vector2( 600, 600 )
|
||||
script = ExtResource( 3 )
|
||||
zoom_widget_path = NodePath("../../../Control/HBoxContainer/EditorZoomWidget")
|
||||
mirror_horizontal_button_path = NodePath("../../../Control/HBoxContainer/HorizontalMirror")
|
||||
mirror_vertical_button_path = NodePath("../../../Control/HBoxContainer/VerticalMirror")
|
||||
rotate_left_button_path = NodePath("../../../Control/HBoxContainer/RotLeft")
|
||||
rotate_amount_spinbox_path = NodePath("../../../Control/HBoxContainer/SpinBox")
|
||||
rotate_right_button_path = NodePath("../../../Control/HBoxContainer/RotRight")
|
||||
|
||||
[node name="Control" type="VBoxContainer" parent="."]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 1017.0
|
||||
margin_bottom = 593.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Control"]
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 24.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="EditorZoomWidget" parent="Control/HBoxContainer" instance=ExtResource( 2 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 115.0
|
||||
margin_bottom = 24.0
|
||||
custom_constants/separation = -8
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VSeparator2" type="VSeparator" parent="Control/HBoxContainer"]
|
||||
margin_left = 119.0
|
||||
margin_right = 123.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="HorizontalMirror" type="Button" parent="Control/HBoxContainer"]
|
||||
margin_left = 127.0
|
||||
margin_right = 155.0
|
||||
margin_bottom = 24.0
|
||||
hint_tooltip = "Mirror the selected island horizontally.."
|
||||
icon = ExtResource( 5 )
|
||||
|
||||
[node name="VerticalMirror" type="Button" parent="Control/HBoxContainer"]
|
||||
margin_left = 159.0
|
||||
margin_right = 187.0
|
||||
margin_bottom = 24.0
|
||||
hint_tooltip = "Mirror the selected island vertically."
|
||||
icon = ExtResource( 4 )
|
||||
|
||||
[node name="VSeparator" type="VSeparator" parent="Control/HBoxContainer"]
|
||||
margin_left = 191.0
|
||||
margin_right = 195.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="RotLeft" type="Button" parent="Control/HBoxContainer"]
|
||||
margin_left = 199.0
|
||||
margin_right = 227.0
|
||||
margin_bottom = 24.0
|
||||
hint_tooltip = "Rotate left."
|
||||
icon = ExtResource( 7 )
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="Control/HBoxContainer"]
|
||||
margin_left = 231.0
|
||||
margin_right = 305.0
|
||||
margin_bottom = 24.0
|
||||
hint_tooltip = "Rotate amount in degrees."
|
||||
max_value = 360.0
|
||||
value = 45.0
|
||||
allow_greater = true
|
||||
allow_lesser = true
|
||||
|
||||
[node name="RotRight" type="Button" parent="Control/HBoxContainer"]
|
||||
margin_left = 309.0
|
||||
margin_right = 337.0
|
||||
margin_bottom = 24.0
|
||||
hint_tooltip = "Rotate right."
|
||||
icon = ExtResource( 6 )
|
@ -1,15 +0,0 @@
|
||||
tool
|
||||
extends ConfirmationDialog
|
||||
|
||||
func _enter_tree():
|
||||
if !is_connected("confirmed", self, "on_ok_pressed"):
|
||||
connect("confirmed", self, "on_ok_pressed")
|
||||
|
||||
if !get_cancel().is_connected("pressed", self, "on_cancel_pressed"):
|
||||
get_cancel().connect("pressed", self, "on_cancel_pressed")
|
||||
|
||||
func on_ok_pressed() -> void:
|
||||
$UVEditor.ok_pressed()
|
||||
|
||||
func on_cancel_pressed() -> void:
|
||||
$UVEditor.cancel_pressed()
|
@ -1,218 +0,0 @@
|
||||
tool
|
||||
extends HBoxContainer
|
||||
|
||||
#This is a port of godot 4.0's EditorZoomWidget
|
||||
|
||||
#/*************************************************************************/
|
||||
#/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
||||
#/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
#/* */
|
||||
#/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
#/* a copy of this software and associated documentation files (the */
|
||||
#/* "Software"), to deal in the Software without restriction, including */
|
||||
#/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
#/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
#/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
#/* the following conditions: */
|
||||
#/* */
|
||||
#/* The above copyright notice and this permission notice shall be */
|
||||
#/* included in all copies or substantial portions of the Software. */
|
||||
#/* */
|
||||
#/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
#/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
#/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
#/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
#/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
#/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
#/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
#/*************************************************************************/
|
||||
|
||||
var zoom_minus : Button
|
||||
var zoom_reset : Button
|
||||
var zoom_plus : Button
|
||||
|
||||
var EDSCALE : float = 1
|
||||
|
||||
export(float) var zoom : float = 1.0 setget set_zoom, get_zoom
|
||||
|
||||
signal zoom_changed(zoom)
|
||||
|
||||
func _init() -> void:
|
||||
# Zoom buttons
|
||||
zoom_minus = Button.new()
|
||||
zoom_minus.set_flat(true)
|
||||
add_child(zoom_minus)
|
||||
zoom_minus.connect("pressed", self, "_button_zoom_minus")
|
||||
zoom_minus.set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_minus", tr("Zoom Out"), KEY_MASK_CMD | KEY_MINUS))
|
||||
zoom_minus.set_focus_mode(FOCUS_NONE)
|
||||
|
||||
zoom_reset = Button.new()
|
||||
zoom_reset.set_flat(true)
|
||||
add_child(zoom_reset)
|
||||
zoom_reset.add_constant_override("outline_size", 1)
|
||||
zoom_reset.add_color_override("font_outline_color", Color(0, 0, 0))
|
||||
zoom_reset.add_color_override("font_color", Color(1, 1, 1))
|
||||
zoom_reset.connect("pressed", self, "_button_zoom_reset")
|
||||
zoom_reset.set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_reset", tr("Zoom Reset"), KEY_MASK_CMD | KEY_0))
|
||||
zoom_reset.set_focus_mode(FOCUS_NONE)
|
||||
#Prevent the button's size from changing when the text size changes
|
||||
zoom_reset.set_custom_minimum_size(Vector2(75, 0))
|
||||
|
||||
zoom_plus = Button.new()
|
||||
zoom_plus.set_flat(true)
|
||||
add_child(zoom_plus)
|
||||
zoom_plus.connect("pressed", self, "_button_zoom_plus")
|
||||
zoom_plus.set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_plus", tr("Zoom In"), KEY_MASK_CMD | KEY_EQUAL)) # Usually direct access key for PLUS
|
||||
zoom_plus.set_focus_mode(FOCUS_NONE)
|
||||
|
||||
_update_zoom_label()
|
||||
|
||||
add_constant_override("separation", round(-8))
|
||||
|
||||
func get_zoom() -> float:
|
||||
return zoom
|
||||
|
||||
func set_zoom(p_zoom : float) -> void:
|
||||
if (p_zoom > 0 && p_zoom != zoom):
|
||||
zoom = p_zoom;
|
||||
_update_zoom_label();
|
||||
|
||||
func set_zoom_by_increments(p_increment_count : int, p_integer_only : bool) -> void:
|
||||
# Remove editor scale from the index computation.
|
||||
var zoom_noscale : float = zoom / max(1, EDSCALE)
|
||||
var CMP_EPSILON : float = 0.00001
|
||||
|
||||
if (p_integer_only):
|
||||
# Only visit integer scaling factors above 100%, and fractions with an integer denominator below 100%
|
||||
# (1/2 = 50%, 1/3 = 33.33%, 1/4 = 25%, …).
|
||||
# This is useful when working on pixel art projects to avoid distortion.
|
||||
# This algorithm is designed to handle fractional start zoom values correctly
|
||||
# (e.g. 190% will zoom up to 200% and down to 100%).
|
||||
if (zoom_noscale + p_increment_count * 0.001 >= 1.0 - CMP_EPSILON):
|
||||
# New zoom is certain to be above 100%.
|
||||
if (p_increment_count >= 1):
|
||||
# Zooming.
|
||||
set_zoom(floor(zoom_noscale + p_increment_count) * max(1, EDSCALE))
|
||||
else:
|
||||
# Dezooming.
|
||||
set_zoom(ceil(zoom_noscale + p_increment_count) * max(1, EDSCALE))
|
||||
else:
|
||||
if (p_increment_count >= 1):
|
||||
# Zooming. Convert the current zoom into a denominator.
|
||||
var new_zoom : float = 1.0 / ceil(1.0 / zoom_noscale - p_increment_count)
|
||||
if (is_equal_approx(zoom_noscale, new_zoom)):
|
||||
# New zoom is identical to the old zoom, so try again.
|
||||
# This can happen due to floating-point precision issues.
|
||||
new_zoom = 1.0 / ceil(1.0 / zoom_noscale - p_increment_count - 1)
|
||||
|
||||
set_zoom(new_zoom * max(1, EDSCALE));
|
||||
else:
|
||||
# Dezooming. Convert the current zoom into a denominator.
|
||||
var new_zoom : float = 1.0 / floor(1.0 / zoom_noscale - p_increment_count)
|
||||
if (is_equal_approx(zoom_noscale, new_zoom)):
|
||||
# New zoom is identical to the old zoom, so try again.
|
||||
# This can happen due to floating-point precision issues.
|
||||
new_zoom = 1.0 / floor(1.0 / zoom_noscale - p_increment_count + 1)
|
||||
|
||||
set_zoom(new_zoom * max(1, EDSCALE))
|
||||
else:
|
||||
# Base increment factor defined as the twelveth root of two.
|
||||
# This allow a smooth geometric evolution of the zoom, with the advantage of
|
||||
# visiting all integer power of two scale factors.
|
||||
# note: this is analogous to the 'semitones' interval in the music world
|
||||
# In order to avoid numerical imprecisions, we compute and edit a zoom index
|
||||
# with the following relation: zoom = 2 ^ (index / 12)
|
||||
|
||||
if (zoom < CMP_EPSILON || p_increment_count == 0):
|
||||
return
|
||||
|
||||
# zoom = 2**(index/12) => log2(zoom) = index/12
|
||||
var closest_zoom_index : float = round(log(zoom_noscale) * 12.0 / log(2.0))
|
||||
|
||||
var new_zoom_index : float = closest_zoom_index + p_increment_count
|
||||
var new_zoom : float = pow(2.0, new_zoom_index / 12.0)
|
||||
|
||||
# Restore Editor scale transformation
|
||||
new_zoom *= max(1, EDSCALE)
|
||||
|
||||
set_zoom(new_zoom)
|
||||
|
||||
|
||||
func _update_zoom_label() -> void:
|
||||
var zoom_text : String = ""
|
||||
|
||||
# The zoom level displayed is relative to the editor scale
|
||||
# (like in most image editors). Its lower bound is clamped to 1 as some people
|
||||
# lower the editor scale to increase the available real estate,
|
||||
# even if their display doesn't have a particularly low DPI.
|
||||
|
||||
if (zoom >= 10):
|
||||
# Don't show a decimal when the zoom level is higher than 1000 %.
|
||||
#zoom_text = (rtos(round((zoom / max(1, EDSCALE)) * 100))) + " %"
|
||||
zoom_text = (String(round((zoom / max(1, EDSCALE)) * 100))) + " %"
|
||||
else:
|
||||
var v : float = (zoom / max(1, EDSCALE)) * 100
|
||||
var val : float = floor(v / 0.1 + 0.5) * 0.1
|
||||
|
||||
# zoom_text = (rtos(val)) + " %"
|
||||
zoom_text = (String(val)) + " %"
|
||||
|
||||
zoom_reset.set_text(zoom_text)
|
||||
|
||||
func _button_zoom_minus() -> void:
|
||||
set_zoom_by_increments(-6, Input.is_key_pressed(KEY_ALT));
|
||||
emit_signal("zoom_changed", zoom);
|
||||
|
||||
func _button_zoom_reset() -> void:
|
||||
set_zoom(1.0 * max(1, EDSCALE));
|
||||
emit_signal("zoom_changed", zoom);
|
||||
|
||||
func _button_zoom_plus() -> void:
|
||||
set_zoom_by_increments(6, Input.is_key_pressed(KEY_ALT));
|
||||
emit_signal("zoom_changed", zoom);
|
||||
|
||||
func _notification(p_what : int) -> void:
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED):
|
||||
zoom_minus.icon = get_icon("ZoomLess", "EditorIcons")
|
||||
zoom_plus.icon = get_icon("ZoomMore", "EditorIcons")
|
||||
|
||||
#from godot editor/editor_Settings.cpp
|
||||
func ED_SHORTCUT(p_path : String, p_name : String, p_keycode : int, editor_settings : EditorSettings = null) -> ShortCut:
|
||||
if OS.get_name() == "OSX":
|
||||
# Use Cmd+Backspace as a general replacement for Delete shortcuts on macOS
|
||||
if (p_keycode == KEY_DELETE):
|
||||
p_keycode = KEY_MASK_CMD | KEY_BACKSPACE
|
||||
|
||||
var ie : InputEventKey = null
|
||||
if (p_keycode):
|
||||
ie = InputEventKey.new()
|
||||
|
||||
ie.set_unicode(p_keycode & KEY_CODE_MASK)
|
||||
ie.set_scancode(p_keycode & KEY_CODE_MASK)
|
||||
ie.set_shift(bool(p_keycode & KEY_MASK_SHIFT))
|
||||
ie.set_alt(bool(p_keycode & KEY_MASK_ALT))
|
||||
ie.set_control(bool(p_keycode & KEY_MASK_CTRL))
|
||||
ie.set_metakey(bool(p_keycode & KEY_MASK_META))
|
||||
|
||||
if (!editor_settings):
|
||||
var sc : ShortCut
|
||||
sc = ShortCut.new()
|
||||
sc.set_name(p_name)
|
||||
sc.set_shortcut(ie)
|
||||
sc.set_meta("original", ie)
|
||||
return sc
|
||||
|
||||
var sc : ShortCut = editor_settings.get_shortcut(p_path)
|
||||
if (sc.is_valid()):
|
||||
sc.set_name(p_name); #keep name (the ones that come from disk have no name)
|
||||
sc.set_meta("original", ie); #to compare against changes
|
||||
return sc;
|
||||
|
||||
sc = ShortCut.new()
|
||||
sc.set_name(p_name)
|
||||
sc.set_shortcut(ie)
|
||||
sc.set_meta("original", ie) #to compare against changes
|
||||
editor_settings.add_shortcut(p_path, sc)
|
||||
|
||||
return sc
|
||||
|
@ -1,8 +0,0 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/world_generator/widgets/EditorZoomWidget.gd" type="Script" id=1]
|
||||
|
||||
[node name="EditorZoomWidget" type="HBoxContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
@ -1,207 +0,0 @@
|
||||
tool
|
||||
extends Container
|
||||
|
||||
#From https://github.com/EricEzaM/godot-color-palette
|
||||
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2020 Eric M
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
|
||||
var columns: int = 1 setget set_columns
|
||||
var _min_x : int = 0
|
||||
|
||||
func _notification(p_what):
|
||||
match p_what:
|
||||
NOTIFICATION_SORT_CHILDREN:
|
||||
var col_minw: Dictionary # Max of min_width of all controls in each col (indexed by col).
|
||||
var row_minh: Dictionary # Max of min_height of all controls in each row (indexed by row).
|
||||
var col_expanded: Array # Columns which have the SIZE_EXPAND flag set.
|
||||
var row_expanded: Array # Rows which have the SIZE_EXPAND flag set.
|
||||
|
||||
var hsep = get_constant("hseparation", "GridContainer")
|
||||
var vsep = get_constant("vseparation", "GridContainer")
|
||||
|
||||
var min_columns = 1
|
||||
_min_x = 0
|
||||
|
||||
if get_child_count() > 0:
|
||||
min_columns = int(floor(rect_size.x / (get_child(0).get_combined_minimum_size().x + hsep)))
|
||||
|
||||
self.columns = min_columns
|
||||
|
||||
var max_col = min(get_child_count(), columns)
|
||||
var max_row = ceil(float(get_child_count()) / float(columns))
|
||||
|
||||
# Compute the per-column/per-row data.
|
||||
var valid_controls_index = 0
|
||||
for i in range(get_child_count()):
|
||||
var c: Control = get_child(i)
|
||||
if !c or !c.is_visible_in_tree():
|
||||
continue
|
||||
|
||||
var row = valid_controls_index / columns
|
||||
var col = valid_controls_index % columns
|
||||
valid_controls_index += 1
|
||||
|
||||
var ms: Vector2 = c.get_combined_minimum_size()
|
||||
|
||||
if _min_x < ms.x:
|
||||
_min_x = ms.x
|
||||
|
||||
if col_minw.has(col):
|
||||
col_minw[col] = max(col_minw[col], ms.x)
|
||||
else:
|
||||
col_minw[col] = ms.x
|
||||
if row_minh.has(row):
|
||||
row_minh[row] = max(row_minh[row], ms.y)
|
||||
else:
|
||||
row_minh[row] = ms.y
|
||||
|
||||
if c.get_h_size_flags() & SIZE_EXPAND:
|
||||
col_expanded.push_front(col)
|
||||
|
||||
if c.get_v_size_flags() & SIZE_EXPAND:
|
||||
row_expanded.push_front(row)
|
||||
|
||||
# Consider all empty columns expanded.
|
||||
for i in range(valid_controls_index, columns):
|
||||
col_expanded.push_front(i)
|
||||
|
||||
# Evaluate the remaining space for expanded columns/rows.
|
||||
var remaining_space: Vector2 = get_size()
|
||||
|
||||
for e in col_minw.keys():
|
||||
if !col_expanded.has(e):
|
||||
remaining_space.x -= col_minw.get(e)
|
||||
|
||||
for e in row_minh.keys():
|
||||
if !row_expanded.has(e):
|
||||
remaining_space.y -= row_minh.get(e)
|
||||
|
||||
remaining_space.y -= vsep * max(max_row - 1, 0)
|
||||
remaining_space.x -= hsep * max(max_col - 1, 0)
|
||||
|
||||
var can_fit = false
|
||||
while !can_fit && col_expanded.size() > 0:
|
||||
# Check if all minwidth constraints are OK if we use the remaining space.
|
||||
can_fit = true
|
||||
var max_index = col_expanded.front()
|
||||
|
||||
for e in col_expanded:
|
||||
if col_minw.has(e):
|
||||
if col_minw[e] > col_minw[max_index]:
|
||||
max_index = e
|
||||
if can_fit && (remaining_space.x / col_expanded.size()) < col_minw[e]:
|
||||
can_fit = false
|
||||
|
||||
# If not, the column with maximum minwidth is not expanded.
|
||||
if (!can_fit):
|
||||
col_expanded.erase(max_index)
|
||||
remaining_space.x -= col_minw[max_index]
|
||||
|
||||
can_fit = false
|
||||
while !can_fit && row_expanded.size() > 0:
|
||||
# Check if all minheight constraints are OK if we use the remaining space.
|
||||
can_fit = true
|
||||
var max_index = row_expanded.front()
|
||||
|
||||
for e in row_expanded:
|
||||
if row_minh[e] > row_minh[max_index]:
|
||||
max_index = e
|
||||
if can_fit && (remaining_space.y / row_expanded.size()) < row_minh[e]:
|
||||
can_fit = false
|
||||
|
||||
# If not, the row with maximum minheight is not expanded.
|
||||
if (!can_fit):
|
||||
row_expanded.erase(max_index)
|
||||
remaining_space.y -= row_minh[max_index]
|
||||
|
||||
# Finally, fit the nodes.
|
||||
var col_expand = remaining_space.x / col_expanded.size() if col_expanded.size() > 0 else 0
|
||||
var row_expand = remaining_space.y / row_expanded.size() if row_expanded.size() > 0 else 0
|
||||
|
||||
var col_ofs = 0
|
||||
var row_ofs = 0
|
||||
|
||||
valid_controls_index = 0
|
||||
for i in range(get_child_count()):
|
||||
var c: Control = get_child(i)
|
||||
if (!c || !c.is_visible_in_tree()):
|
||||
continue
|
||||
var row = valid_controls_index / columns
|
||||
var col = valid_controls_index % columns
|
||||
valid_controls_index += 1
|
||||
|
||||
if (col == 0):
|
||||
col_ofs = 0
|
||||
if (row > 0):
|
||||
row_ofs += (row_expand if row_expanded.has(row - 1) else row_minh[row - 1]) + vsep
|
||||
|
||||
var p = Vector2(col_ofs, row_ofs)
|
||||
var s = Vector2(col_expand if col_expanded.has(col) else col_minw[col], row_expand if row_expanded.has(row) else row_minh[row])
|
||||
|
||||
fit_child_in_rect(c, Rect2(p, s))
|
||||
|
||||
col_ofs += s.x + hsep
|
||||
|
||||
NOTIFICATION_THEME_CHANGED:
|
||||
minimum_size_changed()
|
||||
|
||||
func _get_minimum_size():
|
||||
# Only worry about max height, not width (since it does width automatically)
|
||||
var row_minh: Dictionary
|
||||
|
||||
var vsep = get_constant("vseparation", "GridContainer")
|
||||
|
||||
var max_row = 0
|
||||
|
||||
var valid_controls_index = 0
|
||||
for i in range(get_child_count()):
|
||||
|
||||
var c: Control = get_child(i)
|
||||
if !c or !c.is_visible():
|
||||
continue
|
||||
var row = valid_controls_index / columns
|
||||
valid_controls_index += 1
|
||||
|
||||
var ms = c.get_combined_minimum_size()
|
||||
|
||||
if row_minh.has(row):
|
||||
row_minh[row] = max(row_minh[row], ms.y)
|
||||
else:
|
||||
row_minh[row] = ms.y
|
||||
max_row = max(row, max_row)
|
||||
|
||||
var ms: Vector2
|
||||
ms.x = _min_x
|
||||
|
||||
for e in row_minh.keys():
|
||||
ms.y += row_minh.get(e)
|
||||
|
||||
ms.y += vsep * max_row
|
||||
|
||||
return ms
|
||||
|
||||
|
||||
func set_columns(p_columns: int):
|
||||
columns = p_columns
|
||||
minimum_size_changed()
|
@ -246,53 +246,53 @@ _global_script_classes=[ {
|
||||
"path": "res://addons/world_generator/resources/zone.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
@"GEBrighten": "",
|
||||
@"BrushPrefabs": "",
|
||||
@"GameModule": "",
|
||||
@"PlayerGD": "",
|
||||
@"CharacterSkeketonAttachPoint": "",
|
||||
@"WorldGeneratorSettings": "",
|
||||
@"MMNode": "",
|
||||
@"GECut": "",
|
||||
@"GEBrush": "",
|
||||
@"GEBrighten": "",
|
||||
@"GECanvas": "",
|
||||
@"SpeedResource": "",
|
||||
@"PlayerMaster": "",
|
||||
@"MobGD": "",
|
||||
@"WorldGenRaycast": "",
|
||||
@"GEDarken": "",
|
||||
@"GEBrush": "",
|
||||
@"GECut": "",
|
||||
@"MMNode": "",
|
||||
@"WorldGeneratorSettings": "",
|
||||
@"CharacterSkeketonAttachPoint": "",
|
||||
@"PlayerGD": "",
|
||||
@"GameModule": "",
|
||||
@"GELayer": "",
|
||||
@"EntityDataGD": "",
|
||||
@"EntityAIGD": "",
|
||||
@"WorldGenWorld": "",
|
||||
@"Continent": "",
|
||||
@"GERect": "",
|
||||
@"GEBucket": "",
|
||||
@"GEDarken": "",
|
||||
@"WorldGenRaycast": "",
|
||||
@"MobGD": "",
|
||||
@"PlayerMaster": "",
|
||||
@"SpeedResource": "",
|
||||
@"GEAction": "",
|
||||
@"SpellGD": "",
|
||||
@"SpellEffectVisualBasic": "",
|
||||
@"GEBucket": "",
|
||||
@"GERect": "",
|
||||
@"Continent": "",
|
||||
@"WorldGenWorld": "",
|
||||
@"EntityAIGD": "",
|
||||
@"EntityDataGD": "",
|
||||
@"NetworkedPlayerGD": "",
|
||||
@"TerrainWorldGenerator": "",
|
||||
@"UIWindowModule": "",
|
||||
@"Zone": "",
|
||||
@"SpellEffectVisualBasic": "",
|
||||
@"SpellGD": "",
|
||||
@"GELine": "",
|
||||
@"ManaResource": "",
|
||||
@"UIGuiChildModule": "",
|
||||
@"Menu": "",
|
||||
@"Main": "",
|
||||
@"WorldGenBaseResource": "",
|
||||
@"GEPasteCut": "",
|
||||
@"Zone": "",
|
||||
@"UIWindowModule": "",
|
||||
@"TerrainWorldGenerator": "",
|
||||
@"GEUtils": "",
|
||||
@"HealthResource": "",
|
||||
@"ItemTemplateGD": "",
|
||||
@"DisplayPlayerGD": "",
|
||||
@"SubZone": "",
|
||||
@"MMNodeUniversalProperty": "",
|
||||
@"GEPasteCut": "",
|
||||
@"WorldGenBaseResource": "",
|
||||
@"Main": "",
|
||||
@"Menu": "",
|
||||
@"UIGuiChildModule": "",
|
||||
@"ManaResource": "",
|
||||
@"GERainbow": "",
|
||||
@"LayeredTextureMaker": "",
|
||||
@"MMMateial": "",
|
||||
@"MMNodeUniversalProperty": "",
|
||||
@"SubZone": "",
|
||||
@"DisplayPlayerGD": "",
|
||||
@"ItemTemplateGD": "",
|
||||
@"HealthResource": "",
|
||||
@"GEMultiLine": "",
|
||||
@"GEPencil": "",
|
||||
@"GEMultiLine": ""
|
||||
@"MMMateial": "",
|
||||
@"LayeredTextureMaker": ""
|
||||
}
|
||||
|
||||
[application]
|
||||
@ -344,7 +344,7 @@ window/size/ui_scale_touch=1.0
|
||||
|
||||
[editor_plugins]
|
||||
|
||||
enabled=PoolStringArray( "res://addons/Godoxel/plugin.cfg", "res://addons/data_manager/plugin.cfg", "res://addons/mat_maker_gd/plugin.cfg", "res://addons/mesh_data_resource_editor/plugin.cfg", "res://addons/world_generator/plugin.cfg" )
|
||||
enabled=PoolStringArray( "res://addons/Godoxel/plugin.cfg", "res://addons/data_manager/plugin.cfg", "res://addons/mat_maker_gd/plugin.cfg", "res://addons/world_generator/plugin.cfg" )
|
||||
|
||||
[ess]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user