import Atoms
import Atoms.ui.constants
from Atoms.singletons import get_atoms_variation_filters_singleton
class NewVariationFilter:
def filter(self, variations, atomsNode, origin_data):
variations = Atoms.Variations()
atv = Atoms.AgentTypeVariation()
varGeo1 = Atoms.VariationGeometry()
varGeo1.setGeometryFile("${ATOMS_DATA}/variations/geometries/atomsRobot/robot1_body.geos")
atv.setGeometry("body",varGeo1)
varGeo2 = Atoms.VariationGeometry()
varGeo2.setGeometryFile("${ATOMS_DATA}/variations/geometries/atomsRobot/robot1_head.geos")
atv.setGeometry("head",varGeo2)
material1 = Atoms.VariationMaterial()
material1.setMaterialFile("")
atv.setMaterial("robot1_material",material1)
geoGroup = Atoms.VariationGroup(atv)
geoGroup.addCombination("body","robot1_material")
geoGroup.addCombination("head","robot1_material")
atv.setGroup("Robot1", geoGroup)
atv.setLookFile("${ATOMS_DATA}/variations/materials/atomsRobot/lookFile.ass")
variations.setAgentTypeVariation("atomsRobot", atv)
print variations.toString(True)
#to write the variation table a json st]irng use variations.toString(False)
#to load a variation object from a stirng use Atoms.loadVariationFromString(json_string) or Atoms.loadVariationFromFile(json_file_path)
return variations
def load():
filters = get_atoms_variation_filters_singleton()
filters.append(NewVariationFilter())
|