Fixed a few problems reported by Godot 3.1a2

This commit is contained in:
Rodolphe Suescun 2018-11-04 15:43:02 +01:00
parent 59add0d468
commit 7f4cc79a47
18 changed files with 23 additions and 20 deletions

View File

@ -0,0 +1 @@
{"connections":[{"from":"colorize_0","from_port":0,"to":"Material","to_port":0},{"from":"perlin_0","from_port":0,"to":"blend_0","to_port":1},{"from":"pattern_0","from_port":0,"to":"blend_0","to_port":0},{"from":"blend_0","from_port":0,"to":"transform_0","to_port":0},{"from":"transform_0","from_port":0,"to":"colorize_0","to_port":0},{"from":"colorize_1","from_port":0,"to":"transform_0","to_port":4},{"from":"pattern_1","from_port":0,"to":"colorize_1","to_port":0},{"from":"transform_0","from_port":0,"to":"normal_map_0","to_port":0},{"from":"normal_map_0","from_port":0,"to":"Material","to_port":4}],"nodes":[{"name":"perlin_0","node_position":{"x":-254,"y":101},"parameters":{"iterations":4,"persistence":1,"scale_x":32,"scale_y":4},"type":"perlin"},{"name":"pattern_0","node_position":{"x":-272,"y":-14},"parameters":{"mix":0,"x_scale":1,"x_wave":0,"y_scale":1,"y_wave":3},"type":"pattern"},{"name":"blend_0","node_position":{"x":-4,"y":18},"parameters":{"amount":1,"blend_type":2},"type":"blend"},{"name":"pattern_1","node_position":{"x":-295,"y":245},"parameters":{"mix":0,"x_scale":4,"x_wave":4,"y_scale":1,"y_wave":3},"type":"pattern"},{"name":"colorize_1","node_position":{"x":-8,"y":207},"parameters":{"gradient":{"points":[{"a":1,"b":1,"g":1,"pos":0,"r":1},{"a":1,"b":0.765625,"g":0.765625,"pos":1,"r":0.765625}],"type":"Gradient"}},"type":"colorize"},{"name":"transform_0","node_position":{"x":206,"y":16},"parameters":{"repeat":false,"rotate":0,"scale_x":1.6,"scale_y":1,"translate_x":0,"translate_y":0},"type":"transform"},{"name":"colorize_0","node_position":{"x":435,"y":12},"parameters":{"gradient":{"points":[{"a":0,"b":0,"g":0.5,"pos":0.081818,"r":0.125},{"a":1,"b":0,"g":0.5,"pos":0.145455,"r":0.125},{"a":1,"b":0,"g":0.203125,"pos":0.436364,"r":0.050781},{"a":1,"b":0,"g":0.362165,"pos":0.727273,"r":0.090541},{"a":1,"b":0,"g":0.203125,"pos":1,"r":0.050781}],"type":"Gradient"}},"type":"colorize"},{"name":"normal_map_0","node_position":{"x":459.70459,"y":136},"parameters":{"amount":0.5,"size":2},"type":"normal_map"},{"name":"Material","node_position":{"x":790,"y":-6},"parameters":{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"ao_light_affect":1,"depth_scale":1,"emission_energy":1,"metallic":0,"normal_scale":1,"resolution":1,"roughness":1},"type":"material"}]}

View File

@ -1 +1 @@
{"connections":[{"from":"colorize_0","from_port":0,"to":"Material","to_port":0},{"from":"custom_0","from_port":0,"to":"colorize_0","to_port":0}],"nodes":[{"name":"Material","node_position":{"x":200,"y":0},"parameters":{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"ao_light_affect":1,"depth_scale":1,"emission_energy":1,"metallic":1,"normal_scale":1,"resolution":1,"roughness":1},"type":"material"},{"name":"colorize_0","node_position":{"x":1.25,"y":77.75},"parameters":{"gradient":{"points":[{"a":1,"b":0,"g":0,"pos":0,"r":1},{"a":1,"b":0,"g":0.96875,"pos":0.2,"r":1},{"a":1,"b":0.0625,"g":1,"pos":0.4,"r":0},{"a":1,"b":1,"g":1,"pos":0.618182,"r":0},{"a":1,"b":0.965909,"g":0,"pos":0.818182,"r":0},{"a":1,"b":1,"g":0,"pos":1,"r":0.9375}],"type":"Gradient"}},"type":"colorize"},{"model_data":{"global":"float mandelbrot(vec2 uv) {\n float di = 1.0;\n vec2 z = vec2(0.0);\n float m2 = 0.0;\n vec2 dz = vec2(0.0);\n for( int i=0; i<200; i++ )\n {\n if (m2>1024.0 ) {\n\t\t\tdi=0.0;\n\t\t\tbreak;\n\t\t}\n\n\t\t// Z' -> 2·Z·Z' + 1\n dz = 2.0*vec2(z.x*dz.x-z.y*dz.y, z.x*dz.y + z.y*dz.x) + vec2(1.0,0.0);\n\t\t\t\n // Z -> Z² + c\t\t\t\n z = vec2( z.x*z.x - z.y*z.y, 2.0*z.x*z.y ) + uv;\n\t\t\t\n m2 = dot(z,z);\n }\n\n // distance\t\n\t// d(c) = |Z|·log|Z|/|Z'|\n\tfloat d = 0.5*sqrt(dot(z,z)/dot(dz,dz))*log(dot(z,z));\n if( di>0.5 ) d=0.0;\n\treturn d;\n}","instance":"float $(name)_xyz(vec2 uv) {\n\treturn mandelbrot(uv);\n}","name":"Mandelbrot","outputs":[{"f":"clamp($(name)_xyz(vec2($(x), $(y))+$(scale)*(2.0*$(uv)-1.0))*$(contrast), 0.0, 1.0)"}],"parameters":[{"label":"Scale","max":3,"min":0,"name":"scale","step":0.0001,"type":"float","widget":"spinbox"},{"label":"X","max":2,"min":-2,"name":"x","step":0.0001,"type":"float","widget":"spinbox"},{"label":"Y","max":2,"min":-2,"name":"y","step":0.0001,"type":"float","widget":"spinbox"},{"label":"Contrast","max":10000,"min":1,"name":"contrast","step":0.0001,"type":"float","widget":"spinbox"}]},"name":"custom_0","node_position":{"x":-211,"y":208},"parameters":{"contrast":10,"scale":1,"x":0,"y":0},"type":"custom"}]} {"connections":[{"from":"custom_0","from_port":0,"to":"colorize_0","to_port":0},{"from":"colorize_0","from_port":0,"to":"Material","to_port":3}],"nodes":[{"name":"Material","node_position":{"x":200,"y":0},"parameters":{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"ao_light_affect":1,"depth_scale":1,"emission_energy":1,"metallic":1,"normal_scale":1,"resolution":1,"roughness":1},"type":"material"},{"model_data":{"global":"float mandelbrot(vec2 uv) {\n float di = 1.0;\n vec2 z = vec2(0.0);\n float m2 = 0.0;\n vec2 dz = vec2(0.0);\n for( int i=0; i<200; i++ )\n {\n if (m2>1024.0 ) {\n\t\t\tdi=0.0;\n\t\t\tbreak;\n\t\t}\n\n\t\t// Z' -> 2·Z·Z' + 1\n dz = 2.0*vec2(z.x*dz.x-z.y*dz.y, z.x*dz.y + z.y*dz.x) + vec2(1.0,0.0);\n\t\t\t\n // Z -> Z² + c\t\t\t\n z = vec2( z.x*z.x - z.y*z.y, 2.0*z.x*z.y ) + uv;\n\t\t\t\n m2 = dot(z,z);\n }\n\n // distance\t\n\t// d(c) = |Z|·log|Z|/|Z'|\n\tfloat d = 0.5*sqrt(dot(z,z)/dot(dz,dz))*log(dot(z,z));\n if( di>0.5 ) d=0.0;\n\treturn d;\n}","instance":"float $(name)_xyz(vec2 uv) {\n\treturn mandelbrot(uv);\n}","name":"Mandelbrot","outputs":[{"f":"clamp($(name)_xyz(vec2($(x), $(y))+$(scale)*(2.0*$(uv)-1.0))*$(contrast), 0.0, 1.0)"}],"parameters":[{"label":"Scale","max":3,"min":0,"name":"scale","step":0.0001,"type":"float","widget":"spinbox"},{"label":"X","max":2,"min":-2,"name":"x","step":0.0001,"type":"float","widget":"spinbox"},{"label":"Y","max":2,"min":-2,"name":"y","step":0.0001,"type":"float","widget":"spinbox"},{"label":"Contrast","max":10000,"min":1,"name":"contrast","step":0.0001,"type":"float","widget":"spinbox"}]},"name":"custom_0","node_position":{"x":-211,"y":208},"parameters":{"contrast":10,"scale":1,"x":0,"y":0},"type":"custom"},{"name":"colorize_0","node_position":{"x":-99.75,"y":-7.25},"parameters":{"gradient":{"points":[{"a":1,"b":0,"g":0,"pos":0,"r":1},{"a":1,"b":0,"g":0.96875,"pos":0.2,"r":1},{"a":1,"b":0.0625,"g":1,"pos":0.4,"r":0},{"a":1,"b":1,"g":1,"pos":0.618182,"r":0},{"a":1,"b":0.965909,"g":0,"pos":0.818182,"r":0},{"a":1,"b":1,"g":0,"pos":1,"r":0.9375}],"type":"Gradient"}},"type":"colorize"}]}

View File

@ -101,7 +101,7 @@ func clear_material():
func new_material(): func new_material():
clear_material() clear_material()
create_node({name="Material", type="material"}) create_nodes({name="Material", type="material"})
set_save_path(null) set_save_path(null)
center_view() center_view()

View File

@ -20,7 +20,6 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
script = ExtResource( 1 ) script = ExtResource( 1 )
_sections_unfolded = [ "Anchor", "Grow Direction", "Margin", "Rect", "Size Flags", "custom_constants" ]
[node name="VBoxContainer" type="VBoxContainer" parent="." index="0"] [node name="VBoxContainer" type="VBoxContainer" parent="." index="0"]
@ -35,7 +34,6 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
alignment = 0 alignment = 0
_sections_unfolded = [ "Anchor", "Margin", "Size Flags" ]
[node name="Menu" type="HBoxContainer" parent="VBoxContainer" index="0"] [node name="Menu" type="HBoxContainer" parent="VBoxContainer" index="0"]
@ -170,7 +168,6 @@ size_flags_vertical = 3
split_offset = 0 split_offset = 0
collapsed = false collapsed = false
dragger_visibility = 0 dragger_visibility = 0
_sections_unfolded = [ "Size Flags" ]
[node name="VBoxContainer" type="VSplitContainer" parent="VBoxContainer/HBoxContainer" index="0"] [node name="VBoxContainer" type="VSplitContainer" parent="VBoxContainer/HBoxContainer" index="0"]
@ -189,7 +186,6 @@ size_flags_vertical = 3
split_offset = 0 split_offset = 0
collapsed = false collapsed = false
dragger_visibility = 0 dragger_visibility = 0
_sections_unfolded = [ "Size Flags" ]
[node name="Library" type="Tree" parent="VBoxContainer/HBoxContainer/VBoxContainer" index="0"] [node name="Library" type="Tree" parent="VBoxContainer/HBoxContainer/VBoxContainer" index="0"]

View File

@ -148,6 +148,9 @@ func reset():
generated = false generated = false
generated_variants = [] generated_variants = []
func _get_shader_code(uv, slot = 0):
pass
func get_shader_code(uv, slot = 0): func get_shader_code(uv, slot = 0):
var rv var rv
if slot == 0: if slot == 0:

View File

@ -22,7 +22,7 @@ func _ready():
$blend_type.add_item(BLEND_TYPES[i].name, i) $blend_type.add_item(BLEND_TYPES[i].name, i)
initialize_properties([ $blend_type, $HBoxContainer/amount ]) initialize_properties([ $blend_type, $HBoxContainer/amount ])
func _get_shader_code(uv): func _get_shader_code(uv, slot = 0):
var rv = { defs="", code="" } var rv = { defs="", code="" }
var src0 = get_source(0) var src0 = get_source(0)
var src1 = get_source(1) var src1 = get_source(1)

View File

@ -4,7 +4,7 @@ extends "res://addons/material_maker/node_base.gd"
func _ready(): func _ready():
initialize_properties([ $gradient ]) initialize_properties([ $gradient ])
func _get_shader_code(uv): func _get_shader_code(uv, slot = 0):
var rv = { defs="", code="" } var rv = { defs="", code="" }
var src = get_source() var src = get_source()
if src == null: if src == null:

View File

@ -1,7 +1,7 @@
tool tool
extends "res://addons/material_maker/node_base.gd" extends "res://addons/material_maker/node_base.gd"
func _get_shader_code(uv): func _get_shader_code(uv, slot = 0):
var rv = { defs="", code="" } var rv = { defs="", code="" }
var src0 = get_source(0) var src0 = get_source(0)
var src1 = get_source(1) var src1 = get_source(1)

View File

@ -1,7 +1,7 @@
tool tool
extends "res://addons/material_maker/node_base.gd" extends "res://addons/material_maker/node_base.gd"
func _get_shader_code(uv): func _get_shader_code(uv, slot = 0):
var rv = { defs="", code="" } var rv = { defs="", code="" }
rv.rgb = "vec3(1.0)" rv.rgb = "vec3(1.0)"
return rv return rv

View File

@ -6,7 +6,7 @@ var suffix = "suffix"
func _ready(): func _ready():
initialize_properties([ $resolution ]) initialize_properties([ $resolution ])
func _get_shader_code(uv): func _get_shader_code(uv, slot = 0):
var rv = { defs="", code="", f="0.0" } var rv = { defs="", code="", f="0.0" }
var src = get_source() var src = get_source()
if src != null: if src != null:

View File

@ -48,7 +48,7 @@ func _rerender():
if !has_textures: if !has_textures:
do_update_materials(current_material_list) do_update_materials(current_material_list)
func _get_shader_code(uv): func _get_shader_code(uv, slot = 0):
var rv = { defs="", code="", f="0.0" } var rv = { defs="", code="", f="0.0" }
var src = get_source() var src = get_source()
if src != null: if src != null:

View File

@ -46,7 +46,7 @@ func get_textures():
list[name] = final_texture list[name] = final_texture
return list return list
func _get_shader_code(uv): func _get_shader_code(uv, slot = 0):
var rv = { defs="", code="" } var rv = { defs="", code="" }
var src = get_source() var src = get_source()
if src == null: if src == null:

View File

@ -7,7 +7,7 @@ const ConfigControl = preload("res://addons/material_maker/widgets/linked_widget
func _ready(): func _ready():
pass pass
func _get_shader_code(uv): func _get_shader_code(uv, slot = 0):
var rv = { defs="", code="" } var rv = { defs="", code="" }
rv.rgb = "vec3(1.0)" rv.rgb = "vec3(1.0)"
return rv return rv

View File

@ -5,7 +5,7 @@ func _ready():
set_slot(0, true, 0, Color(0.5, 0.5, 1), true, 0, Color(0.5, 0.5, 1)) set_slot(0, true, 0, Color(0.5, 0.5, 1), true, 0, Color(0.5, 0.5, 1))
initialize_properties([ $HBoxContainer1/translate_x, $HBoxContainer2/translate_y, $HBoxContainer3/rotate, $HBoxContainer4/scale_x, $HBoxContainer5/scale_y, $repeat ]) initialize_properties([ $HBoxContainer1/translate_x, $HBoxContainer2/translate_y, $HBoxContainer3/rotate, $HBoxContainer4/scale_x, $HBoxContainer5/scale_y, $repeat ])
func _get_shader_code(uv): func _get_shader_code(uv, slot = 0):
var rv = { defs="", code="" } var rv = { defs="", code="" }
var src = get_source() var src = get_source()
if src == null: if src == null:

View File

@ -4,7 +4,7 @@ extends "res://addons/material_maker/node_base.gd"
func _ready(): func _ready():
initialize_properties([ $amount ]) initialize_properties([ $amount ])
func _get_shader_code(uv): func _get_shader_code(uv, slot = 0):
var epsilon = 0.01 var epsilon = 0.01
var rv = { defs="", code="" } var rv = { defs="", code="" }
var src0 = get_source(0) var src0 = get_source(0)

View File

@ -77,7 +77,7 @@ func add_cursor(x, color):
func _gui_input(ev): func _gui_input(ev):
if ev is InputEventMouseButton && ev.button_index == 1 && ev.doubleclick && ev.position.y > 15: if ev is InputEventMouseButton && ev.button_index == 1 && ev.doubleclick && ev.position.y > 15:
var p = max(0, min(ev.position.x, rect_size.x-GradientCursor.WIDTH)) var p = max(0, min(ev.position.x, rect_size.x-GradientCursor.WIDTH))
add_cursor(p, get_color(p)) add_cursor(p, get_gradient_color(p))
update_value() update_value()
# Showing a color picker popup to change a cursor's color # Showing a color picker popup to change a cursor's color
@ -103,7 +103,7 @@ func get_sorted_cursors():
array.sort_custom(GradientCursor, "sort") array.sort_custom(GradientCursor, "sort")
return array return array
func get_color(x): func get_gradient_color(x):
return value.get_color(x / (rect_size.x - GradientCursor.WIDTH)) return value.get_color(x / (rect_size.x - GradientCursor.WIDTH))
func update_shader(): func update_shader():

View File

@ -34,6 +34,9 @@ func get_widget_type(widget):
func _ready(): func _ready():
set_process_input(false) set_process_input(false)
func add_linked(node, widget):
pass
func can_link_to(c): func can_link_to(c):
return c != null return c != null

View File

@ -9,8 +9,8 @@ signal no_more_tabs
func _ready(): func _ready():
pass pass
func add_child(control): func add_child(control, legible_unique_name = false):
.add_child(control) .add_child(control, legible_unique_name)
if !(control is Tabs): if !(control is Tabs):
$Tabs.add_tab(control.name) $Tabs.add_tab(control.name)
move_child(control, $Tabs.get_tab_count()-1) move_child(control, $Tabs.get_tab_count()-1)