Add Samba dancing sublevel source
This commit is contained in:
parent
5747f0e2cd
commit
cb26b51250
16 changed files with 146 additions and 2 deletions
|
|
@ -57,6 +57,7 @@ Important maps/assets:
|
|||
- Demo map: `/Game/LedVolume/Maps/L_LedVolume_Demo_Single`
|
||||
- Rotating cube sublevel exists for earlier voxelization tests: `/Game/LedVolume/Maps/L_RotatingCube_Sublevel`
|
||||
- Rotating 3D snowflake source level: `/Game/LedVolume/Maps/L_RotatingSnowflake_Sublevel`
|
||||
- Samba Dancing FBX source level: `/Game/LedVolume/Maps/L_SambaDancing_Sublevel`; imported assets live in `/Game/LedVolume/Sources/SambaDancing`.
|
||||
- Remote Control preset: `/Game/LedVolume/RemoteControl/RCP_LedVolumeLive`
|
||||
|
||||
## Remote Control / Minimized Editor Notes
|
||||
|
|
@ -103,7 +104,7 @@ Remote Control exposure rule:
|
|||
- The preset builder has an explicit exposure list in `Source/ledcube3d/ledcube3d.cpp`; add every new controllable property there in the same change.
|
||||
- Do not blindly auto-expose every reflected field; UE Remote Control can crash on unsupported/stale fields in an existing preset.
|
||||
- If a parameter needs a convenient user choice, prefer an enum preset property over asking the user to type raw asset paths.
|
||||
- The current sublevel source selector is `SublevelSourcePreset` with `Custom`, `RotatingCube`, and `RotatingSnowflake`.
|
||||
- The current sublevel source selector is `SublevelSourcePreset` with `Custom`, `RotatingCube`, `RotatingSnowflake`, and `SambaDancing`.
|
||||
- `VoxelizedSublevel` is still exposed for custom source maps.
|
||||
|
||||
Sublevel source notes:
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
BIN
Content/LedVolume/Maps/L_SambaDancing_Sublevel.umap
Normal file
BIN
Content/LedVolume/Maps/L_SambaDancing_Sublevel.umap
Normal file
Binary file not shown.
BIN
Content/LedVolume/Sources/SambaDancing/Ch14_1001_Diffuse.uasset
Normal file
BIN
Content/LedVolume/Sources/SambaDancing/Ch14_1001_Diffuse.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/LedVolume/Sources/SambaDancing/Ch14_1001_Normal.uasset
Normal file
BIN
Content/LedVolume/Sources/SambaDancing/Ch14_1001_Normal.uasset
Normal file
Binary file not shown.
BIN
Content/LedVolume/Sources/SambaDancing/Ch14_1001_Specular.uasset
Normal file
BIN
Content/LedVolume/Sources/SambaDancing/Ch14_1001_Specular.uasset
Normal file
Binary file not shown.
BIN
Content/LedVolume/Sources/SambaDancing/Ch14_Body.uasset
Normal file
BIN
Content/LedVolume/Sources/SambaDancing/Ch14_Body.uasset
Normal file
Binary file not shown.
BIN
Content/LedVolume/Sources/SambaDancing/Samba_Dancing.uasset
Normal file
BIN
Content/LedVolume/Sources/SambaDancing/Samba_Dancing.uasset
Normal file
Binary file not shown.
BIN
Content/LedVolume/Sources/SambaDancing/Samba_Dancing_Anim.uasset
Normal file
BIN
Content/LedVolume/Sources/SambaDancing/Samba_Dancing_Anim.uasset
Normal file
Binary file not shown.
Binary file not shown.
108
Scripts/CreateSambaDancingSublevel.py
Normal file
108
Scripts/CreateSambaDancingSublevel.py
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
import unreal
|
||||
|
||||
|
||||
FBX_PATH = r"C:\Users\post\Downloads\Samba Dancing.fbx"
|
||||
SOURCE_DIR = "/Game/LedVolume/Sources/SambaDancing"
|
||||
MAP_PATH = "/Game/LedVolume/Maps/L_SambaDancing_Sublevel"
|
||||
SOURCE_TAG = "LedVoxelSource"
|
||||
|
||||
|
||||
def ensure_directory(path):
|
||||
if not unreal.EditorAssetLibrary.does_directory_exist(path):
|
||||
unreal.EditorAssetLibrary.make_directory(path)
|
||||
|
||||
|
||||
def set_prop(obj, name, value):
|
||||
obj.set_editor_property(name, value)
|
||||
|
||||
|
||||
def import_fbx():
|
||||
ensure_directory("/Game/LedVolume")
|
||||
ensure_directory("/Game/LedVolume/Sources")
|
||||
ensure_directory(SOURCE_DIR)
|
||||
|
||||
task = unreal.AssetImportTask()
|
||||
task.set_editor_property("filename", FBX_PATH)
|
||||
task.set_editor_property("destination_path", SOURCE_DIR)
|
||||
task.set_editor_property("automated", True)
|
||||
task.set_editor_property("replace_existing", True)
|
||||
task.set_editor_property("save", True)
|
||||
|
||||
options = unreal.FbxImportUI()
|
||||
options.set_editor_property("import_mesh", True)
|
||||
options.set_editor_property("import_as_skeletal", True)
|
||||
options.set_editor_property("import_animations", True)
|
||||
options.set_editor_property("mesh_type_to_import", unreal.FBXImportType.FBXIT_SKELETAL_MESH)
|
||||
options.set_editor_property("create_physics_asset", False)
|
||||
|
||||
task.set_editor_property("options", options)
|
||||
unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks([task])
|
||||
|
||||
imported = [unreal.EditorAssetLibrary.load_asset(path) for path in task.get_editor_property("imported_object_paths")]
|
||||
imported = [asset for asset in imported if asset]
|
||||
|
||||
skeletal_mesh = next((asset for asset in imported if isinstance(asset, unreal.SkeletalMesh)), None)
|
||||
animation = next((asset for asset in imported if isinstance(asset, unreal.AnimSequence)), None)
|
||||
|
||||
if not skeletal_mesh:
|
||||
assets = unreal.EditorAssetLibrary.list_assets(SOURCE_DIR, recursive=True, include_folder=False)
|
||||
loaded = [unreal.EditorAssetLibrary.load_asset(path) for path in assets]
|
||||
skeletal_mesh = next((asset for asset in loaded if isinstance(asset, unreal.SkeletalMesh)), None)
|
||||
animation = next((asset for asset in loaded if isinstance(asset, unreal.AnimSequence)), None)
|
||||
|
||||
if not skeletal_mesh:
|
||||
raise RuntimeError("Samba FBX import did not produce a SkeletalMesh.")
|
||||
|
||||
return skeletal_mesh, animation
|
||||
|
||||
|
||||
def clear_current_level():
|
||||
for actor in unreal.EditorLevelLibrary.get_all_level_actors():
|
||||
if not isinstance(actor, unreal.WorldSettings):
|
||||
unreal.EditorLevelLibrary.destroy_actor(actor)
|
||||
|
||||
|
||||
def create_level(skeletal_mesh, animation):
|
||||
ensure_directory("/Game/LedVolume/Maps")
|
||||
if unreal.EditorAssetLibrary.does_asset_exist(MAP_PATH):
|
||||
unreal.EditorLevelLibrary.load_level(MAP_PATH)
|
||||
else:
|
||||
unreal.EditorLevelLibrary.new_level(MAP_PATH)
|
||||
clear_current_level()
|
||||
|
||||
actor = unreal.EditorLevelLibrary.spawn_actor_from_class(unreal.SkeletalMeshActor, unreal.Vector(0, 0, 0), unreal.Rotator(0, 0, 0))
|
||||
actor.set_actor_label("LED_Source_Samba_Dancing")
|
||||
actor.tags = [unreal.Name(SOURCE_TAG)]
|
||||
|
||||
component = actor.get_editor_property("skeletal_mesh_component")
|
||||
set_prop(component, "skeletal_mesh_asset", skeletal_mesh)
|
||||
set_prop(component, "relative_location", unreal.Vector(0, 0, 0))
|
||||
set_prop(component, "relative_rotation", unreal.Rotator(0, 0, 0))
|
||||
set_prop(component, "relative_scale3d", unreal.Vector(1.0, 1.0, 1.0))
|
||||
set_prop(component, "visibility_based_anim_tick_option", unreal.VisibilityBasedAnimTickOption.ALWAYS_TICK_POSE_AND_REFRESH_BONES)
|
||||
|
||||
if animation:
|
||||
component.set_animation_mode(unreal.AnimationMode.ANIMATION_SINGLE_NODE)
|
||||
component.set_animation(animation)
|
||||
component.play(True)
|
||||
unreal.log(f"Samba animation assigned: {animation.get_path_name()}")
|
||||
else:
|
||||
unreal.log_warning("No AnimSequence imported from Samba FBX; level will contain the skeletal mesh pose only.")
|
||||
|
||||
light = unreal.EditorLevelLibrary.spawn_actor_from_class(unreal.DirectionalLight, unreal.Vector(-250, -350, 500), unreal.Rotator(-45, 30, 0))
|
||||
light.set_actor_label("Samba_Source_Preview_Light")
|
||||
|
||||
camera = unreal.EditorLevelLibrary.spawn_actor_from_class(unreal.CineCameraActor, unreal.Vector(260, -420, 220), unreal.Rotator(-18, 34, 0))
|
||||
camera.set_actor_label("Samba_Source_Preview_Camera")
|
||||
|
||||
unreal.EditorLoadingAndSavingUtils.save_dirty_packages(True, True)
|
||||
unreal.log(f"Created Samba sublevel: {MAP_PATH}")
|
||||
|
||||
|
||||
def main():
|
||||
skeletal_mesh, animation = import_fbx()
|
||||
create_level(skeletal_mesh, animation)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "Components/HierarchicalInstancedStaticMeshComponent.h"
|
||||
#include "Components/InstancedStaticMeshComponent.h"
|
||||
#include "Components/SkeletalMeshComponent.h"
|
||||
#include "Components/StaticMeshComponent.h"
|
||||
#include "Engine/Level.h"
|
||||
#include "Engine/LevelStreamingDynamic.h"
|
||||
|
|
@ -1337,6 +1338,20 @@ void ALedVolumeDisplayActor::HideVoxelizedSublevelSourceActors() const
|
|||
MeshComponent->SetHiddenInGame(true);
|
||||
#if WITH_EDITOR
|
||||
MeshComponent->SetIsTemporarilyHiddenInEditor(true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
TInlineComponentArray<USkeletalMeshComponent*> SkeletalMeshComponents;
|
||||
SourceActor->GetComponents(SkeletalMeshComponents);
|
||||
for (USkeletalMeshComponent* SkeletalMeshComponent : SkeletalMeshComponents)
|
||||
{
|
||||
if (SkeletalMeshComponent)
|
||||
{
|
||||
SkeletalMeshComponent->VisibilityBasedAnimTickOption = EVisibilityBasedAnimTickOption::AlwaysTickPoseAndRefreshBones;
|
||||
SkeletalMeshComponent->SetHiddenInGame(true);
|
||||
#if WITH_EDITOR
|
||||
SkeletalMeshComponent->SetIsTemporarilyHiddenInEditor(true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -1589,6 +1604,21 @@ FLinearColor ALedVolumeDisplayActor::SampleWorldVoxelColor(const FVector& WorldP
|
|||
return SolidColor;
|
||||
}
|
||||
}
|
||||
|
||||
TInlineComponentArray<USkeletalMeshComponent*> SkeletalMeshComponents;
|
||||
SourceActor->GetComponents(SkeletalMeshComponents);
|
||||
for (const USkeletalMeshComponent* SkeletalMeshComponent : SkeletalMeshComponents)
|
||||
{
|
||||
if (!SkeletalMeshComponent || !SkeletalMeshComponent->GetSkeletalMeshAsset())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SkeletalMeshComponent->Bounds.GetBox().IsInside(WorldPosition))
|
||||
{
|
||||
return SolidColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EmptyVoxelColor;
|
||||
|
|
|
|||
|
|
@ -680,6 +680,10 @@ void ALedVolumeRemoteControlActor::ApplySublevelSourcePreset()
|
|||
{
|
||||
VoxelizedSublevel = TSoftObjectPtr<UWorld>(FSoftObjectPath(TEXT("/Game/LedVolume/Maps/L_RotatingSnowflake_Sublevel.L_RotatingSnowflake_Sublevel")));
|
||||
}
|
||||
else if (SublevelSourcePreset == ELedSublevelSourcePreset::SambaDancing)
|
||||
{
|
||||
VoxelizedSublevel = TSoftObjectPtr<UWorld>(FSoftObjectPath(TEXT("/Game/LedVolume/Maps/L_SambaDancing_Sublevel.L_SambaDancing_Sublevel")));
|
||||
}
|
||||
}
|
||||
|
||||
void ALedVolumeRemoteControlActor::QueueApply()
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ enum class ELedSublevelSourcePreset : uint8
|
|||
{
|
||||
Custom UMETA(DisplayName = "Custom"),
|
||||
RotatingCube UMETA(DisplayName = "Rotating Cube"),
|
||||
RotatingSnowflake UMETA(DisplayName = "Rotating Snowflake")
|
||||
RotatingSnowflake UMETA(DisplayName = "Rotating Snowflake"),
|
||||
SambaDancing UMETA(DisplayName = "Samba Dancing")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue