def new_state(settings): state = {} state = {"counter" : 1.0, "world" : None, "keyboard" : new_keyboard(), "interface" : None, "animations" : []} state.update(settings) state["interface"] = thing_blank(new_id(state), "Interface") state["world"] = new_world(state) return state
def thing_move_read(state): thing = {} text = None with open("/".join([state["things_dir"], state["thing_name"]])) as f: text = f.read() map = json.loads(text) geometry = state["geometries"][map["geometry_name"]] thing = thing_new(new_id(state), "Object", map["position"], map["rotates"], [], geometry, map["bounds"]) return thing
def task_new(state, name): task = {} task = { "id": new_id(state), "name": name, "status": "run", "signal_on_exit": [], "waiting_on": [], "time_start": 0.0, "step": 0.0, "animations": {} } return task
def start(argv, state): text = None with open("/".join([state["animations_dir"], state["animation_name"]])) as f: text = f.read() animation = json.loads(text) state["animation"] = animation geometries = {} for action in animation["actions"]: if (action["type"] == "vertices"): with open("/".join([state["geometries_dir"], action["geometry_name"]])) as f: text = f.read() geometry = {"vertices" : json.loads(text), "id" : new_id(state)} geometries[action["geometry_name"]] = geometry state["geometries"] = geometries thing = thing_move_read(state) state["world"]["children"].append(thing) return
def start(argv, state): text = None with open("/".join([state["animations_dir"], state["animation_name"]])) as f: text = f.read() animation = json.loads(text) state["animation"] = animation geometries = {} for action in animation["actions"]: if (action["type"] == "vertices"): with open("/".join( [state["geometries_dir"], action["geometry_name"]])) as f: text = f.read() geometry = {"vertices": json.loads(text), "id": new_id(state)} geometries[action["geometry_name"]] = geometry state["geometries"] = geometries thing = thing_move_read(state) state["world"]["children"].append(thing) return
def new_world(state): world = {} world = thing_blank(new_id(state), "World") return world
def new_world(state): world = {} world = thing_new(new_id(state), "World", [0.0, 0.0, 0.0], [], [], None) return world
def task_new(state, name): task = {} task = {"id" : new_id(state), "name" : name, "status" : "run", "signal_on_exit" : [], "waiting_on" : [], "time_start" : 0.0, "step" : 0.0, "animations" : {}} return task