import unreal
asset_path = "/Game/ArchVis/Mesh"
def add_box_collision (static_mesh):
# 代わりに .SPHERE, .CAPSULE, .NDOP10_X, .NDOP10_Y, .NDOP10_Z, .NDOP18, .NDOP26 を使用することもできます。
shape_type = unreal.ScriptingCollisionShapeType.BOX
unreal.EditorStaticMeshLibrary.add_simple_collisions(static_mesh, shape_type)
unreal.EditorAssetLibrary.save_loaded_asset(static_mesh)
# get a list of all Assets in the path.
all_assets = unreal.EditorAssetLibrary.list_assets(asset_path)
# load them all into memory.
all_assets_loaded = [unreal.EditorAssetLibrary.load_asset(a) for a in all_assets]
# filter the list to include only Static Meshes.
static_mesh_assets = unreal.EditorFilterLibrary.by_class(all_assets_loaded, unreal.StaticMesh)
# run the function above on each Static Mesh in the list.
map(add_box_collision, static_mesh_assets)
import unreal
asset_path = "/Game/ArchVis/Mesh"
def set_convex_collision (static_mesh):
unreal.EditorStaticMeshLibrary.set_convex_decomposition_collisions(static_mesh, 4, 12, 460000)
unreal.EditorAssetLibrary.save_loaded_asset(static_mesh)
# get a list of all Assets in the path.
all_assets = unreal.EditorAssetLibrary.list_assets(asset_path)# load them all into memory.
all_assets_loaded = [unreal.EditorAssetLibrary.load_asset(a) for a in all_assets]# filter the list to include only Static Meshes.
static_mesh_assets = unreal.EditorFilterLibrary.by_class(all_assets_loaded, unreal.StaticMesh)# run the function above on each Static Mesh in the list.
map(set_convex_collision, static_mesh_assets)
import unreal
asset_path = "/Game/ArchVis/Mesh"
def remove_collisions (static_mesh):
unreal.EditorStaticMeshLibrary.remove_collisions(static_mesh)
unreal.EditorAssetLibrary.save_loaded_asset(static_mesh)
# get a list of all Assets in the path.
all_assets = unreal.EditorAssetLibrary.list_assets(asset_path)# load them all into memory.
all_assets_loaded = [unreal.EditorAssetLibrary.load_asset(a) for a in all_assets]# filter the list to include only Static Meshes.
static_mesh_assets = unreal.EditorFilterLibrary.by_class(all_assets_loaded, unreal.StaticMesh)# run the function above on each Static Mesh in the list.
map(remove_collision, static_mesh_assets)
import unreal
asset_path = "/Game/ArchVis/Mesh"
def use_lod_for_collisions (static_mesh):
static_mesh.set_editor_property("lod_for_collision", 3)
unreal.EditorAssetLibrary.save_loaded_asset(static_mesh)
# get a list of all Assets in the path.
all_assets = unreal.EditorAssetLibrary.list_assets(asset_path)
# load them all into memory.
all_assets_loaded = [unreal.EditorAssetLibrary.load_asset(a) for a in all_assets]
# filter the list to include only Static Meshes.
static_mesh_assets = unreal.EditorFilterLibrary.by_class(all_assets_loaded, unreal.StaticMesh)
# run the function above on each Static Mesh in the list.
map(use_lod_for_collision, static_mesh_assets)