Runtime Attribute Access

Runtime Attribute Access

You can use the following classes for accessing attributes:

  • BehaviourModuleBoolAttributeCache

  • BehaviourModuleIntAttributeCache

  • BehaviourModuleDoubleAttributeCache

  • BehaviourModuleVector2AttributeCache

  • BehaviourModuleVector3AttributeCache

  • BehaviourModuleVector4AttributeCache

  • BehaviourModuleMatrixAttributeCache

  • BehaviourModuleStringAttributeCache

 

import Atoms import AtomsCore import AtomsMath import os class TestOverrides(Atoms.BehaviourModule): def __init__(self): Atoms.BehaviourModule.__init__(self) self.addAttribute("boolAttr", AtomsCore.BoolMetadata(), True) def initFrame(self, agents, agentGroup): attributes = self.attributes() ba = Atoms.BehaviourModuleBoolAttributeCache(attributes, "boolAttr", self.name()) for a in agents: value = ba.getAttributeValue(agent.groupId(), agent.groupIdStr(), agent.metadata()) print(value) @staticmethod def category(): return "Python"

Copyright © 2017, Toolchefs LTD.