#pragma once #include "CoreMinimal.h" #include "Misc/MujocoOptions.h" #include "tinyxml2.h" class UMujocoGeomComponent; class UMujocoJointComponent; class UMujocoSiteComponent; class UMujocoActuatorComponent; class UMujocoEqualityComponent; class UMujocoTendonComponent; class UCameraComponent; class USpringArmComponent; class UMujocoBodyComponent; class USCS_Node; class UStaticMesh; class UBlueprint; class LUCKYMUJOCO_API FMujocoXmlGenerator { bool VisitGeomComponent(USCS_Node* SCSNode, UMujocoGeomComponent* GeomComponent, tinyxml2::XMLElement* Element); bool VisitJointComponent(USCS_Node* SCSNode, UMujocoJointComponent* JointComponent, tinyxml2::XMLElement* Element); bool VisitSiteComponent(USCS_Node* SCSNode, UMujocoSiteComponent* SiteComponent, tinyxml2::XMLElement* Element); bool VisitActuatorComponent(USCS_Node* SCSNode, UMujocoActuatorComponent* ActuatorComponent, tinyxml2::XMLElement* Element); bool VisitEqualityComponent(USCS_Node* SCSNode, UMujocoEqualityComponent* EqualityComponent, tinyxml2::XMLElement* Element); bool VisitTendonComponent(USCS_Node* SCSNode, UMujocoTendonComponent* TendonComponent, tinyxml2::XMLElement* Element); bool VisitCameraComponent(USCS_Node* SCSNode, UCameraComponent* CameraComponent, tinyxml2::XMLElement* Element, USpringArmComponent* SpringArmComponent = nullptr); bool VisitSpringArm(USCS_Node* SCSNode, USpringArmComponent* SpringArmComponent, tinyxml2::XMLElement* Element); bool VisitBodyComponent(USCS_Node* SCSNode, UMujocoBodyComponent* BodyComponent, tinyxml2::XMLElement* Element); bool ParseExportOptions(UMujocoExportOptions* Data, tinyxml2::XMLElement* Element); bool ParseBlueprintAsset(UBlueprint* BlueprintAsset, tinyxml2::XMLElement* Root); bool ParseActorAsset(AActor* Actor, tinyxml2::XMLElement* Root); TMap> ObjectMap; public: /** * Generate the XML file used by the MuJoCo headless scene representing the physics simulation * @param ExportOptions TODO - What they can be? * @param Objects Actors and Components to be added to the scene * @param ExportFilename pretty much that * @param ContactExclusion a list of pairs that should be patched in the xml file for contact exclusion (no friction, no collision) * TODO ContactExclusion should be stored as a property of MujocoActor and not passed in the scene init */ TUniquePtr GenerateMujocoXml( const TObjectPtr& ExportOptions, const TArray& Objects, const FString& ExportFilename, TMap ContactExclusion); };