2019-08-17 17:35:48 +02:00
|
|
|
tool
|
2019-08-12 15:58:42 +02:00
|
|
|
extends Object
|
|
|
|
class_name MMGenContext
|
|
|
|
|
2019-08-17 17:35:48 +02:00
|
|
|
var renderer : MMGenRenderer
|
2019-08-12 15:58:42 +02:00
|
|
|
var variants : Dictionary = {}
|
|
|
|
|
2019-10-20 16:22:06 +02:00
|
|
|
func _init(r : MMGenRenderer) -> void:
|
2019-08-17 17:35:48 +02:00
|
|
|
renderer = r
|
|
|
|
|
2019-10-20 16:22:06 +02:00
|
|
|
func has_variant(generator) -> bool:
|
2019-08-12 15:58:42 +02:00
|
|
|
return variants.has(generator)
|
|
|
|
|
2019-10-20 16:22:06 +02:00
|
|
|
func get_variant(generator, variant) -> int:
|
2019-08-12 15:58:42 +02:00
|
|
|
var rv = -1
|
|
|
|
if variants.has(generator):
|
2019-10-10 07:42:38 +02:00
|
|
|
rv = variants[generator].find(variant)
|
2019-08-12 15:58:42 +02:00
|
|
|
if rv == -1:
|
2019-10-10 07:42:38 +02:00
|
|
|
variants[generator].push_back(variant)
|
2019-08-12 15:58:42 +02:00
|
|
|
else:
|
2019-10-10 07:42:38 +02:00
|
|
|
variants[generator] = [variant]
|
2019-08-12 15:58:42 +02:00
|
|
|
return rv
|