def fromGeneticInstanceToBlender(tree_creator, context, genetic_instance): """ Reads all the current Tree Creator parameters from the LSystem instance """ # LSystem part tree_creator.iterations = genetic_instance.lsystem.niterations tree_creator.nproductions = len(genetic_instance.lsystem.productions) tree_creator.ndefines = len(genetic_instance.lsystem.globalDefines) tree_creator.axiom = str(genetic_instance.lsystem.axiom) updateDefinesGui(tree_creator,context) updateProductionsGui(tree_creator,context) i = 0 keys = list(genetic_instance.lsystem.globalDefines.keys()) values = list(genetic_instance.lsystem.globalDefines.values()) for (def_name,def_value) in iterateOverDefines(tree_creator): # TODO: CHECK THIS!!!! THEY ARE IN A DICTIONARY! NOT ORDERED! setattr(tree_creator,def_name,str(keys[i])) setattr(tree_creator,def_value,values[i]) i+=1 i = 0 productions = genetic_instance.lsystem.productions for (namep,namec,names) in iterateOverProductions(tree_creator): setattr(tree_creator,namep,str(productions[i].predecessor)) setattr(tree_creator,namec,str(productions[i].condition)) setattr(tree_creator,names,str(productions[i].successor)) i+=1 # Turtle parameters part tp = genetic_instance.turtleParameters tree_creator.defaultRadius = tp.branch_radius tree_creator.tropism_susceptibility = tp.tropism_susceptibility tree_creator.canopy = tp.use_canopy tree_creator.details_scale = tp.details_scale #print(tp.trunk_material_choice) tree_creator.trunk_material = DetailsHandler.nameOfMaterial(tp.trunk_material_choice) #print(tree_creator.trunk_material) tree_creator.leaf_material = DetailsHandler.nameOfMaterial(tp.leaf_material_choice) tree_creator.leaf_object_name = DetailsHandler.nameOfLeafModel(tp.leaf_choice) tree_creator.bulb_object_name = DetailsHandler.nameOfBulbModel(tp.bulb_choice) tree_creator.flower_object_name = DetailsHandler.nameOfFlowerModel(tp.flower_choice) tree_creator.fruit_object_name = DetailsHandler.nameOfFruitModel(tp.fruit_choice)