Closed RachithP closed 6 months ago
@RachithP Let's make this include_super_flag=1
cast operation more explicit. Please make a Python enum that matches the C++ enum, similar to how we do this (including comments) in the legacy env.py
.
# before
unreal_set_actor_location_and_rotation_func = spear_instance.game_world_service.find_function_by_name(
uclass=unreal_actor_class, name="K2_SetActorLocationAndRotation", include_super_flag=1)
# after
unreal_set_actor_location_and_rotation_func = spear_instance.game_world_service.find_function_by_name(
uclass=unreal_actor_class, name="K2_SetActorLocationAndRotation", include_super_flag=EIncludeSuperFlag.IncludeSuper.value)
I don't love adding these implicitly coupled enums in our code because I worry about the maintenance cost. But it's better than requiring totally unlabeled integers to be passed into Python service functions.
In this case, we could get away with a single boolean arg, and we wouldn't need to go to the trouble of creating a Python enum. But I think we'll have to do this same kind of thing a few more times in the very near future (e.g., with SpawnActor
), so I'd rather be consistent about our usage of enums in this kind of setting.
@RachithP Let's also include that game_world_service.get_static_class(class_name)
in a follow-up PR too. (In conversation recently, we agreed that get_class
and get_static_class
would both be good to have.) Then we could clean up this code.
# before
unreal_actor_classes = list(set([ spear_instance.game_world_service.get_class(unreal_actor) for unreal_actor in unreal_actors.values() ]))
assert len(unreal_actor_classes) == 1
unreal_actor_class = unreal_actor_classes[0]
# after
unreal_actor_static_class = spear_instance.game_world_service.get_static_class("AActor")
assert unreal_actor_static_class
apartment_0000
scene, I've addedStableNameComponent
to all chair actors, and set their mobility to movable.