from tdw.librarian import ModelRecord, MaterialLibrarian from tdw.output_data import OutputData, Transforms from tdw_physics.rigidbodies_dataset import (RigidbodiesDataset, get_random_xyz_transform, get_range, handle_random_transform_args) from tdw_physics.util import (MODEL_LIBRARIES, get_parser, xyz_to_arr, arr_to_xyz, str_to_xyz, none_or_str, none_or_int, int_or_bool) from tdw_physics.target_controllers.dominoes import Dominoes, MultiDominoes, get_args from tdw_physics.postprocessing.labels import is_trial_valid MODEL_NAMES = [r.name for r in MODEL_LIBRARIES['models_flex.json'].records] M = MaterialLibrarian() MATERIAL_TYPES = M.get_material_types() MATERIAL_NAMES = {mtype: [m.name for m in M.get_all_materials_of_type(mtype)] \ for mtype in MATERIAL_TYPES} def get_gravity_args(dataset_dir: str, parse=True): common = get_parser(dataset_dir, get_help=False) domino, domino_postproc = get_args(dataset_dir, parse=False) parser = ArgumentParser(parents=[common, domino], conflict_handler='resolve', fromfile_prefix_chars='@') parser.add_argument( "--ramp", type=int,
print(vars(parser.parse_args())) return args if __name__ == '__main__': # args = get_collide_args("collide") # print([m.name for m in MODEL_LIBRARIES['models_full.json'].records \ # if 'incline' == m.wcategory]) # c = SceneLibrarian() # print([r.name for r in c.search_records(search="room")]) c = MaterialLibrarian() ms = c.get_material_types() print(ms) print([m.name for m in c.get_all_materials_of_type("Plastic")]) # metal = [m for m in c.get_all_materials_of_type("Metal") if "steel_rusty" in m.name] # print(metal[0], metal[0].name) # for m in ms: # more_ms = c.get_all_materials_of_type(m) # print(m, [_m.name for _m in more_ms]) # C = MultiDominoes() # m = C.get_add_material("steel_rusty") # print(m)