Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Maya

Code Block
languagepy
themeEclipse
linenumberstrue
import Atoms

smi = Atoms.StateMachines.instance()

from AtomsMaya.hostbridge.atomsgroup import MayaAtomsGroupHostBridge
from AtomsMaya.hostbridge.commands import MayaCommandsHostBridge

nh = MayaAtomsGroupHostBridge()
nh.set_app_obj("tcAgentGroupNodeShape1")

ag = nh.get_agent_group()

ids = ag.agentLocalIds()

for agent_id in ids:
    agent = ag.agent(agent_id)
    sm = smi.stateMachine(agent.agentType().metadata()["stateMachine"].value())
    if not  sm:
        continue

    state = agent.metadata()["state"].value()
    current_state = agent.metadata()["currentState"].value()

    if current_state != state:
        print(sm.connections()[(current_state, state)].name())


Houdini

Code Block
languagepy
themeEclipse
linenumberstrue
import Atoms

smi = Atoms.StateMachines.instance()

from AtomsHoudini.hostbridge.atomsgroup import HoudiniAtomsGroupHostBridge
from AtomsHoudini.hostbridge.commands import HoudiniCommandsHostBridge

nh = HoudiniAtomsGroupHostBridge()
nh.set_app_obj("tcAgentGroupNodeShape1/obj/AgentGroupName")

ag = nh.get_agent_group()

ids = ag.agentLocalIds()

for agent_id in ids:
    agent = ag.agent(agent_id)
    sm = smi.stateMachine(agent.agentType().metadata()["stateMachine"].value())
    if not  sm:
        continue

    state = agent.metadata()["state"].value()
    current_state = agent.metadata()["currentState"].value()

    if current_state != state:
        print(sm.connections()[(current_state, state)].name())