mirror of
https://github.com/Relintai/material-maker.git
synced 2024-11-13 06:27:18 +01:00
Updated remote to automatically show configurations with "True" and "False" configs as toggle buttons.
This commit is contained in:
parent
724c03feeb
commit
421af6e439
@ -169,6 +169,7 @@ func _get_shader_code(uv : String, output_index : int, context : MMGenContext) -
|
||||
coef_str = "vec3(%.9f, %.9f, %.9f)" % [ coef[0] * sum[0], coef[1] * sum[1], coef[2] * sum[2] ]
|
||||
"rgba":
|
||||
coef_str = "vec4(%.9f, %.9f, %.9f, %.9f)" % [ coef[0] * sum[0], coef[1] * sum[1], coef[2] * sum[2], coef[3] * sum[3] ]
|
||||
if src_code.has(convolution_params.input_type):
|
||||
rv.code += "%s_%d += %s*%s;\n" % [ genname, variant_index, coef_str, src_code[convolution_params.input_type] ]
|
||||
for t in src_code.textures.keys():
|
||||
rv.textures[t] = src_code.textures[t]
|
||||
|
@ -80,9 +80,13 @@ func get_parameter_defs() -> Array:
|
||||
for w in widgets:
|
||||
match w.type:
|
||||
"config_control":
|
||||
var p : Dictionary = { name=w.name, label=w.label, type="enum", values=[] }
|
||||
var p : Dictionary = { name=w.name, label=w.label, type="enum" }
|
||||
var configurations = w.configurations.keys()
|
||||
configurations.sort()
|
||||
if configurations == [ "False", "True" ]:
|
||||
p.type = "boolean"
|
||||
else:
|
||||
p.values=[]
|
||||
for c in configurations:
|
||||
p.values.push_back({ name=c, value=c })
|
||||
rv.append(p)
|
||||
@ -119,6 +123,8 @@ func set_parameter(p : String, v) -> void:
|
||||
if node != null:
|
||||
node.set_parameter(w.widget, v)
|
||||
"config_control":
|
||||
if v is bool:
|
||||
v = 1 if v else 0
|
||||
if v < widget.configurations.size():
|
||||
var configurations = widget.configurations.keys()
|
||||
configurations.sort()
|
||||
|
@ -40,7 +40,7 @@ func update_node() -> void:
|
||||
control.name = p.name
|
||||
controls[control.name] = control
|
||||
add_control(generator.get_widget(p.name).label, control)
|
||||
if generator.widgets[i].type == "config_control":
|
||||
if generator.widgets[i].type == "config_control" and control is OptionButton:
|
||||
var current = null
|
||||
if control.get_item_count() > 0:
|
||||
control.selected = generator.parameters[p.name]
|
||||
@ -60,6 +60,7 @@ func _on_value_changed(new_value, variable : String) -> void:
|
||||
if widget.type == "config_control":
|
||||
var configuration_count = widget.configurations.size()
|
||||
var control = controls[variable]
|
||||
if control is OptionButton:
|
||||
if new_value < configuration_count:
|
||||
._on_value_changed(new_value, variable)
|
||||
var current = control.get_item_text(new_value)
|
||||
@ -82,7 +83,7 @@ func _on_value_changed(new_value, variable : String) -> void:
|
||||
generator.remove_configuration(variable, current)
|
||||
_:
|
||||
print(command)
|
||||
else:
|
||||
return
|
||||
._on_value_changed(new_value, variable)
|
||||
|
||||
func do_add_configuration(config_name : String, param_name : String) -> void:
|
||||
|
Loading…
Reference in New Issue
Block a user