mirror of
https://github.com/Relintai/material-maker.git
synced 2024-12-23 21:16:54 +01:00
Removed in-editor Material Maker (now obsolete thanks to the import plugin)
This commit is contained in:
parent
9a4800883f
commit
69871b32f2
@ -1,4 +1,3 @@
|
|||||||
tool
|
|
||||||
extends GraphEdit
|
extends GraphEdit
|
||||||
class_name MMGraphEdit
|
class_name MMGraphEdit
|
||||||
|
|
||||||
@ -42,6 +41,7 @@ func offset_from_global_position(global_position) -> Vector2:
|
|||||||
|
|
||||||
func add_node(node) -> void:
|
func add_node(node) -> void:
|
||||||
add_child(node)
|
add_child(node)
|
||||||
|
move_child(node, 0)
|
||||||
node.connect("close_request", self, "remove_node", [ node ])
|
node.connect("close_request", self, "remove_node", [ node ])
|
||||||
|
|
||||||
func connect_node(from, from_slot, to, to_slot):
|
func connect_node(from, from_slot, to, to_slot):
|
||||||
@ -163,10 +163,11 @@ func new_material() -> void:
|
|||||||
top_generator = loader.create_gen({nodes=[{name="Material", type="material","parameters":{"size":11}}], connections=[]})
|
top_generator = loader.create_gen({nodes=[{name="Material", type="material","parameters":{"size":11}}], connections=[]})
|
||||||
if top_generator != null:
|
if top_generator != null:
|
||||||
add_child(top_generator)
|
add_child(top_generator)
|
||||||
|
move_child(top_generator, 0)
|
||||||
update_view(top_generator)
|
update_view(top_generator)
|
||||||
|
center_view()
|
||||||
set_save_path(null)
|
set_save_path(null)
|
||||||
set_need_save(false)
|
set_need_save(false)
|
||||||
center_view()
|
|
||||||
|
|
||||||
func get_free_name(type) -> String:
|
func get_free_name(type) -> String:
|
||||||
var i = 0
|
var i = 0
|
||||||
@ -197,10 +198,11 @@ func load_file(filename) -> void:
|
|||||||
top_generator = MMGenLoader.load_gen(filename)
|
top_generator = MMGenLoader.load_gen(filename)
|
||||||
if top_generator != null:
|
if top_generator != null:
|
||||||
add_child(top_generator)
|
add_child(top_generator)
|
||||||
|
move_child(top_generator, 0)
|
||||||
update_view(top_generator)
|
update_view(top_generator)
|
||||||
|
center_view()
|
||||||
set_save_path(filename)
|
set_save_path(filename)
|
||||||
set_need_save(false)
|
set_need_save(false)
|
||||||
center_view()
|
|
||||||
|
|
||||||
func save_file(filename) -> void:
|
func save_file(filename) -> void:
|
||||||
var data = top_generator.serialize()
|
var data = top_generator.serialize()
|
||||||
|
@ -9,12 +9,12 @@
|
|||||||
[ext_resource path="res://addons/material_maker/icons/icons.svg" type="Texture" id=7]
|
[ext_resource path="res://addons/material_maker/icons/icons.svg" type="Texture" id=7]
|
||||||
[ext_resource path="res://addons/material_maker/node_factory.gd" type="Script" id=8]
|
[ext_resource path="res://addons/material_maker/node_factory.gd" type="Script" id=8]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=3]
|
[sub_resource type="AtlasTexture" id=1]
|
||||||
flags = 4
|
flags = 4
|
||||||
atlas = ExtResource( 7 )
|
atlas = ExtResource( 7 )
|
||||||
region = Rect2( 96, 32, 32, 32 )
|
region = Rect2( 96, 32, 32, 32 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=4]
|
[sub_resource type="AtlasTexture" id=2]
|
||||||
flags = 4
|
flags = 4
|
||||||
atlas = ExtResource( 7 )
|
atlas = ExtResource( 7 )
|
||||||
region = Rect2( 96, 64, 32, 32 )
|
region = Rect2( 96, 64, 32, 32 )
|
||||||
@ -155,7 +155,7 @@ margin_right = 44.0
|
|||||||
margin_bottom = 38.0
|
margin_bottom = 38.0
|
||||||
hint_tooltip = "Show 3D preview"
|
hint_tooltip = "Show 3D preview"
|
||||||
toggle_mode = true
|
toggle_mode = true
|
||||||
icon = SubResource( 3 )
|
icon = SubResource( 1 )
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/HBoxContainer/ProjectsPane/HBoxContainer"]
|
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/HBoxContainer/ProjectsPane/HBoxContainer"]
|
||||||
visible = false
|
visible = false
|
||||||
@ -169,7 +169,7 @@ margin_top = 3.0
|
|||||||
margin_right = 32.0
|
margin_right = 32.0
|
||||||
margin_bottom = 35.0
|
margin_bottom = 35.0
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
texture = SubResource( 4 )
|
texture = SubResource( 2 )
|
||||||
|
|
||||||
[node name="Preview3DUI" parent="VBoxContainer/HBoxContainer/ProjectsPane/HBoxContainer/HBoxContainer" instance=ExtResource( 5 )]
|
[node name="Preview3DUI" parent="VBoxContainer/HBoxContainer/ProjectsPane/HBoxContainer/HBoxContainer" instance=ExtResource( 5 )]
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
tool
|
|
||||||
extends MMGraphNodeBase
|
extends MMGraphNodeBase
|
||||||
class_name MMGraphNodeGeneric
|
class_name MMGraphNodeGeneric
|
||||||
|
|
||||||
|
@ -1,47 +1,17 @@
|
|||||||
tool
|
tool
|
||||||
extends EditorPlugin
|
extends EditorPlugin
|
||||||
|
|
||||||
var mm_button = null
|
|
||||||
var material_maker = null
|
|
||||||
var importer = null
|
var importer = null
|
||||||
|
|
||||||
func _enter_tree() -> void:
|
func _enter_tree() -> void:
|
||||||
add_tool_menu_item("Material Maker", self, "open_material_maker")
|
|
||||||
importer = preload("res://addons/material_maker/import_plugin/ptex_import.gd").new(self)
|
importer = preload("res://addons/material_maker/import_plugin/ptex_import.gd").new(self)
|
||||||
add_import_plugin(importer)
|
add_import_plugin(importer)
|
||||||
|
|
||||||
func _exit_tree() -> void:
|
func _exit_tree() -> void:
|
||||||
remove_tool_menu_item("Material Maker")
|
|
||||||
if material_maker != null:
|
|
||||||
material_maker.hide()
|
|
||||||
material_maker.queue_free()
|
|
||||||
material_maker = null
|
|
||||||
if importer != null:
|
if importer != null:
|
||||||
remove_import_plugin(importer)
|
remove_import_plugin(importer)
|
||||||
importer = null
|
importer = null
|
||||||
|
|
||||||
func _get_state() -> Dictionary:
|
|
||||||
return { mm_button=mm_button, material_maker=material_maker }
|
|
||||||
|
|
||||||
func _set_state(s) -> void:
|
|
||||||
mm_button = s.mm_button
|
|
||||||
material_maker = s.material_maker
|
|
||||||
|
|
||||||
func open_material_maker(__) -> void:
|
|
||||||
if material_maker == null:
|
|
||||||
material_maker = preload("res://addons/material_maker/window_dialog.tscn").instance()
|
|
||||||
var panel = material_maker.get_node("MainWindow")
|
|
||||||
panel.editor_interface = get_editor_interface()
|
|
||||||
panel.connect("quit", self, "close_material_maker")
|
|
||||||
add_child(material_maker)
|
|
||||||
material_maker.popup_centered()
|
|
||||||
|
|
||||||
func close_material_maker() -> void:
|
|
||||||
if material_maker != null:
|
|
||||||
material_maker.hide()
|
|
||||||
material_maker.queue_free()
|
|
||||||
material_maker = null
|
|
||||||
|
|
||||||
func generate_material(ptex_filename: String) -> Material:
|
func generate_material(ptex_filename: String) -> Material:
|
||||||
var generator = MMGenLoader.load_gen(ptex_filename)
|
var generator = MMGenLoader.load_gen(ptex_filename)
|
||||||
add_child(generator)
|
add_child(generator)
|
||||||
|
@ -17,16 +17,14 @@ void fragment() {
|
|||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id=2]
|
[sub_resource type="ShaderMaterial" id=2]
|
||||||
shader = SubResource( 1 )
|
shader = SubResource( 1 )
|
||||||
shader_param/size = Vector2( 371, 198 )
|
shader_param/size = Vector2( 64, 64 )
|
||||||
|
|
||||||
[node name="Preview2D" type="ColorRect"]
|
[node name="Preview2D" type="ColorRect"]
|
||||||
material = SubResource( 2 )
|
material = SubResource( 2 )
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
margin_left = 17.0
|
margin_right = -1216.0
|
||||||
margin_top = 17.0
|
margin_bottom = -656.0
|
||||||
margin_right = -892.0
|
|
||||||
margin_bottom = -505.0
|
|
||||||
rect_min_size = Vector2( 64, 64 )
|
rect_min_size = Vector2( 64, 64 )
|
||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
size_flags_horizontal = 0
|
size_flags_horizontal = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user