material-maker/addons/material_maker/engine/gen_context.gd
Hugo Locurcio 93c84650cd
Add return type hints to all scripts
This also simplifies some functions.

This partially addresses #30.
2019-10-20 16:35:45 +02:00

23 lines
467 B
GDScript

tool
extends Object
class_name MMGenContext
var renderer : MMGenRenderer
var variants : Dictionary = {}
func _init(r : MMGenRenderer) -> void:
renderer = r
func has_variant(generator) -> bool:
return variants.has(generator)
func get_variant(generator, variant) -> int:
var rv = -1
if variants.has(generator):
rv = variants[generator].find(variant)
if rv == -1:
variants[generator].push_back(variant)
else:
variants[generator] = [variant]
return rv