digraph RobotState {
  RfromJsonObj [ label="Robot.fromJsonObj"]
  PfromJsonObj [ label="Part.fromJsonObj"]
  loadParts [ label="Robot.loadParts(whenIntegrated=robot.addGUI(gui,options)" ]
  pLoad [ label="Part.load" ]
  cLoad [ label="ChildPart.load" ]
  addSTL [ label="ChildPart.addSTL(whenDone=ChildPart.onLoaded(part)" ]
  RNew [ label="Robot.new" ]
  pintegrate [ label="Part.integrate" ]
  rintegratePart [ label="Robot.integratePart" ]
  rFullyLoaded [ label="Robot.fullyLoaded" ]
  pFullyLoaded [ label="Part.fullyLoaded" ]
  cFullyLoaded [ label="ChildPart.fullyLoaded" ]

  RNew -> loadParts -> addGUI
  loadParts->pLoad
  pLoad->cLoad
  cLoad -> addSTL
  RfromJsonObj -> PfromJsonObj
  PfromJsonObj -> PfromJsonObj [ label="subParts" ]
  RfromJsonObj -> RNew
  addSTL -> onCreate [ label="stl==null" ]
  pintegrate -> rintegratePart
  pintegrate -> integrateChild
  rintegratePart -> rFullyLoaded
  rFullyLoaded -> pFullyLoaded
  rFullyLoaded -> addGUI [ label="callback via whenIntegrated" ]
  pFullyLoaded -> cFullyLoaded
  cFullyLoaded -> calcSize
  addSTL -> onLoad 
  onLoad -> onCreate [ label="stl!=null" ]
  onCreate -> onLoaded [ label="callback via whenDone" ]
  onLoaded -> pintegrate
}