Format files using updated file_format.sh

This commit is contained in:
Aaron Franke
2020-10-01 14:23:54 -04:00
parent fe9fd7d7e4
commit 918a289ee2
79 changed files with 512 additions and 512 deletions

View File

@@ -29,7 +29,7 @@ func apply_pressed():
var selected_nodes = editor_selection.get_selected_nodes()
if selected_nodes.size() == 0:
printerr("Material Creator: Can't apply the material, because there are no nodes selected!")
var material = _silly_resource_from_values().make_material()
# Go through the selected nodes and see if they have the "set_surface_material"
# function (which only MeshInstance has by default). If they do, then set the material
@@ -46,23 +46,23 @@ func save_file_selected(path):
file.open(path, File.WRITE)
file.store_string(silly_resource.make_json())
file.close()
return true
func load_file_selected(path):
var file = File.new()
var SpatialMaterial_Silly = null
# Make a new silly resource (which in this case actually is a node)
# and initialize it
var silly_resource = silly_material_resource.new()
silly_resource.init()
# If the file exists, then open it
if file.file_exists(path):
file.open(path, File.READ)
# Get the JSON string and convert it into a silly material.
var json_dict_as_string = file.get_line()
if json_dict_as_string != null:
@@ -70,15 +70,15 @@ func load_file_selected(path):
else:
file.close()
return false
get_node("VBoxContainer/AlbedoColorPicker").color = silly_resource.albedo_color
get_node("VBoxContainer/MetallicSlider").value = silly_resource.metallic_strength
get_node("VBoxContainer/RoughnessSlider").value = silly_resource.roughness_strength
# Close the file and return true (success!)
file.close()
return true
#else: If the file does not exist, then return false (failure)
return false
@@ -91,10 +91,10 @@ func _silly_resource_from_values():
# Make a new silly resource (which in this case actually is a node) and initialize it
var silly_resource = silly_material_resource.new()
silly_resource.init()
# Assign the values
silly_resource.albedo_color = color
silly_resource.metallic_strength = metallic
silly_resource.roughness_strength = roughness
return silly_resource

View File

@@ -21,15 +21,15 @@ func init():
# into the JSON format
func make_json():
var json_dict = {}
json_dict["albedo_color"] = {}
json_dict["albedo_color"]["r"] = albedo_color.r
json_dict["albedo_color"]["g"] = albedo_color.g
json_dict["albedo_color"]["b"] = albedo_color.b
json_dict["metallic_strength"] = metallic_strength
json_dict["roughness_strength"] = roughness_strength
return to_json(json_dict)
@@ -37,11 +37,11 @@ func make_json():
# fill in our data.
func from_json(json_dict_as_string):
var json_dict = parse_json(json_dict_as_string)
albedo_color.r = json_dict["albedo_color"]["r"]
albedo_color.g = json_dict["albedo_color"]["g"]
albedo_color.b = json_dict["albedo_color"]["b"]
metallic_strength = json_dict["metallic_strength"]
roughness_strength = json_dict["roughness_strength"]
@@ -49,9 +49,9 @@ func from_json(json_dict_as_string):
# Make a SpatialMaterial using our variables.
func make_material():
var mat = SpatialMaterial.new()
mat.albedo_color = albedo_color
mat.metallic = metallic_strength
mat.roughness = roughness_strength
return mat