a lot of stuff

This commit is contained in:
Vysyr committed 2026-10-27 19:57:03 +01:00
1 parent 86f54deb01
commit a3a80dfa16
35 files changed
+407

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
import unreal
sub = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)
actors = sub.get_all_level_actors()
unreal.log(f"{len(actors)} actors in level")
+16
View File
@@ -0,0 +1,16 @@
import unreal
OLD = unreal.load_asset("/Game/ImportedAssets/Trees/SM_tree04.SM_tree04")
NEW = unreal.load_asset("/Game/ImportedAssets/Trees/SM_tree01.SM_tree01")
sub = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)
actors = sub.get_all_level_actors()
old_mesh_count = 0
for actor in actors:
comp = actor.get_component_by_class(unreal.StaticMeshComponent)
if comp and comp.static_mesh == OLD:
old_mesh_count += 1
print(f"Found {old_mesh_count} instances of the old mesh")
+19
View File
@@ -0,0 +1,19 @@
import unreal
OLD = unreal.load_asset("/Game/ImportedAssets/Trees/SM_tree04.SM_tree04")
NEW = unreal.load_asset("/Game/ImportedAssets/Trees/SM_tree01.SM_tree01")
sub = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)
actors = sub.get_all_level_actors()
old_mesh_count = 0
with unreal.ScopedEditorTransaction("Swap meshes"):
for actor in actors:
comp = actor.get_component_by_class(unreal.StaticMeshComponent)
if comp and comp.static_mesh == OLD:
comp.set_editor_property("static_mesh", NEW)
# comp.set_static_mesh(NEW) -- tak tez mozna ale undo nie zadziala bo zmiana nie jest robiona przez edytor wiec jej on nie rejestruje
old_mesh_count += 1
unreal.log(f"Swapped {old_mesh_count} meshes")