def start(c: Controller) -> None: """ Start the controller. :param c: The controller. """ c.start() c.communicate([{ "$type": "simulate_physics", "value": False }, { "$type": "create_empty_environment" }, { "$type": "set_render_quality", "render_quality": 0 }, { "$type": "set_post_process", "value": False }, { "$type": "create_avatar", "id": "a", "type": "A_Img_Caps_Kinematic" }, { "$type": "set_pass_masks", "pass_masks": ["_img"] }])
def start(c: Controller) -> None: """ Start the controller. :param c: The controller. """ print(f"Results will be saved to: {MissingMaterials.OUTPUT_FILE}") c.start() c.communicate([{ "$type": "simulate_physics", "value": False }, { "$type": "create_empty_environment" }, { "$type": "set_render_quality", "render_quality": 0 }, { "$type": "set_post_process", "value": False }, { "$type": "create_avatar", "id": "a", "type": "A_Img_Caps_Kinematic" }, { "$type": "set_pass_masks", "pass_masks": ["_img"] }])
def run(): # Create the asset bundle and the record. asset_bundle_paths, record_path = AssetBundleCreator( ).create_asset_bundle("cube.fbx", True, 123, "", 1) # Get the name of the bundle for this platform. For example, Windows -> "StandaloneWindows64" bundle = SYSTEM_TO_UNITY[system()] # Get the correct asset bundle path. for p in asset_bundle_paths: # Get the path to the asset bundle. if bundle in str(p.parent.resolve()): url = "file:///" + str(p.resolve()) # Launch the controller. c = Controller() c.start() # Create the environment. # Add the object. commands = [{ "$type": "create_empty_environment" }, { "$type": "add_object", "name": "cube", "url": url, "scale_factor": 1, "id": c.get_unique_id() }] # Create the avatar. commands.extend( TDWUtils.create_avatar(position={ "x": 0, "y": 0, "z": -3.6 })) c.communicate(commands) return
from tdw.controller import Controller from tdw.tdw_utils import TDWUtils from tdw.output_data import CompositeObjects, SegmentationColors from sticky_mitten_avatar.util import get_data """ Get default audio data for each sub-object of a composite object. """ if __name__ == "__main__": from argparse import ArgumentParser parser = ArgumentParser() parser.add_argument("--model", default="puzzle_box_composite") args = parser.parse_args() c = Controller() c.start() resp = c.communicate([ TDWUtils.create_empty_room(12, 12), c.get_add_object(model_name=args.model, object_id=0), { "$type": "send_composite_objects" }, { "$type": "send_segmentation_colors" } ]) c.communicate({"$type": "terminate"}) # Get the name of each object. colors = get_data(resp=resp, d_type=SegmentationColors) names = dict() for i in range(colors.get_num()): names[colors.get_object_id(i)] = colors.get_object_name(i)