Dear all,
I'm looking for an equivalent of a python dictionary with tuples as keys in FPC.
In Python the following is possible:
dict = {(key1, key2):value1}
The keys and values are all objects (as in instances of a class). I don't need to store the actual values as keys, a hash would be sufficient but I don't know how to generate one hash of multiple objects. The number of keys can vary.
I will try to briefly explain why I need this functionality. In my game engine I have materials, which can be used by my mesh class. Each material will compile one shader at the moment, which is generated at runtime with only the code that is needed. Because the same material can be used for let's say a cube and a character (which can be deformed by an armature), I would actually need two shaders for each combination. Similar to blender I use modifiers for that. So the cube object has no modifiers while the character has an armature modifier. There are also other modifiers. For a dictionary to find the right shader of a material I would do this in python:
Material1_dict = {
(None):Shader1, #for all meshes with no modifiers
(armature_mod):Shader2, #for all meshes that use the specific armature modifier
(armature_mod, some_other_modifier): Shader3} #for all meshes that use the armature modifier and some other modifier
I don't need to do the same in FPC so you are very welcome to point out a better solution. Maybe I think to complicated. I would like to point out that I would like to keep the amount of shaders as low as possible because changing the shader is expensive.
Please ask if you don't understand my explanations. Thanks in advance for any suggestions.