{"id":13339693,"url":"https://github.com/PushkinStudio/PsData","last_synced_at":"2025-03-11T14:32:17.063Z","repository":{"id":48369578,"uuid":"148456310","full_name":"PushkinStudio/PsData","owner":"PushkinStudio","description":"Flexible data model plugin for Unreal Engine 4","archived":false,"fork":false,"pushed_at":"2024-12-27T13:10:14.000Z","size":935,"stargazers_count":43,"open_issues_count":3,"forks_count":16,"subscribers_count":17,"default_branch":"develop","last_synced_at":"2024-12-27T14:25:25.784Z","etag":null,"topics":["cpp14","datamodel","magic","ue4","ue4-plugin","unreal-engine","unreal-engine-4"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PushkinStudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-12T09:34:26.000Z","updated_at":"2024-12-27T13:10:19.000Z","dependencies_parsed_at":"2023-02-12T02:18:12.266Z","dependency_job_id":null,"html_url":"https://github.com/PushkinStudio/PsData","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PushkinStudio%2FPsData","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PushkinStudio%2FPsData/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PushkinStudio%2FPsData/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PushkinStudio%2FPsData/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PushkinStudio","download_url":"https://codeload.github.com/PushkinStudio/PsData/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243052054,"owners_count":20228326,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp14","datamodel","magic","ue4","ue4-plugin","unreal-engine","unreal-engine-4"],"created_at":"2024-07-29T19:21:15.275Z","updated_at":"2025-03-11T14:32:16.642Z","avatar_url":"https://github.com/PushkinStudio.png","language":"C++","readme":"# PsData\n\nFlexible data model plugin for Unreal Engine 4\n\n## Examples\n\nDefine PsData classes:\n\n```cpp\n// Assume that you project called 'Foo'\n\n#include \"PsDataAPI.h\"\n\n// Enum\n\nUENUM(BlueprintType)\nenum class EFooDamageType : uint8\n{\n    None = 0,\n    Pure = 1,\n    Physical = 2,\n    Psi = 3,\n    Pierce = 4\n};\nDESCRIBE_ENUM(EFooDamageType);\n\n// Character data class\n\nUCLASS()\nclass UFooCharacterData : public UPsData\n{\n    GENERATED_BODY()\n\n    /** Weapon damage type */\n    DPROP(EFooDamageType, DamageType);\n\n    /** Current health value */\n    /** DMETA(Event) means that this property can fire events when it will changed */\n    DMETA(Event)\n    DPROP(int32, Health);\n\n    /** Equipmented weapon */\n    /** This is property with other PsData class type */\n    DPROP(UFooWeaponData*, EquipmentedWeapon);\n\n    /** Current location on the battlefield */\n    /** DMETA(Strict) means that this property was be constructed by default and cannot be null or be reset */\n    DMETA(Strict)\n    DPROP(UFooPointData*, Location);\n\n    /** Abilities */\n    /** This is array property */\n    DARRAY(UFooBattleAbilityData*, BattleAbilities);\n\n    /** Link to the character prototype */\n    DPROP(FString, CharacterProtoId);\n    DLINK(UFooCharacterProtoData, CharacterProtoId, Prototypes.Characters);\n\n    /** Link to the current battle target */\n    /** DMETA(Nullable) means that this link can be null */\n    DPROP(FString, TargetId);\n    DMETA(Nullable)\n    DLINK(UFooCharacterData, TargetId, Game.Battle.Characters);\n\nprotected:\n    /** Some kind of constructor */\n    void InitProperties() override\n    {\n        SetDamageType(EFooDamageType::Physical);\n    }\n};\n\nUCLASS()\nclass UFooPointData : public UPsData\n{\n    GENERATED_BODY()\n\n    DMETA(Event, Bubbles)\n    DPROP(int32, X);\n\n    DMETA(Event, Bubbles)\n    DPROP(int32, Y);\n\npublic:\n    FIntPoint GetIntPoint() const\n    {\n        return FIntPoint{GetX(), GetY()};\n    }\n};\n```\n\nRoot of the model:\n\n```cpp\n// Root of the data model\n\nUCLASS(Blueprintable, BlueprintType)\nclass UFooRootData : public UPsData\n{\n    /** Game state */\n    DMETA(Strict)\n    DPROP(UFooGameData*, Game);\n\n\n    /** Static world data */\n    DMETA(Strict)\n    DPROP_CONST(UFooPrototypesData*, Prototypes, FFooPrototypesDataAccessor);\n};\n\n\n////////////////////////////////////////////////////////\n// Accessors for mutation of root data const members\n\nclass FFooPrototypesDataAccessor\n{\nprivate:\n    // Only classes that need modifying static world data\n    friend UFooDataController;\n\n    static UFooPrototypesData* GetMutablePrototypes(UFooRootData* RootData)\n    {\n        return RootData-\u003eGetMutablePrototypes();\n    }\n};\n```\n\nWork with the model:\n\n```cpp\nvoid UFooDataController::Init()\n{\n    // Create root node\n    RootData = NewObject\u003cUFooRootData\u003e();\n\n    // Get pointer to the mutable data\n    auto PrototypesData = FFooPrototypesDataAccessor::GetMutablePrototypes(RootData);\n\n    // Deserialize from UDataTable asset PrototypesDataTableAsset\n    auto Deserializer = FPsDataTableDeserializer(PrototypesDataTableAsset, PrototypesData-\u003eGetCharacters());\n    PrototypesData-\u003eDataDeserialize(\u0026Deserializer);\n\n    auto Characters = PrototypesData-\u003eGetCharacters();\n    for (auto const Proto : Characters) {\n        auto GameCharacter = NewObject\u003cUFooCharacterData\u003e();\n        GameCharacter-\u003eSetCharacterProtoId(Proto-\u003eGetDataKey());\n        // Setup character...\n\n        // Add into the game state\n        RootData-\u003eGetGame()-\u003eGetCharacters().Add(GameCharacter);\n    }\n    //...\n}\n```\n","funding_links":[],"categories":["Various (no categorie name found hihi ) :"],"sub_categories":["Videos"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPushkinStudio%2FPsData","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPushkinStudio%2FPsData","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPushkinStudio%2FPsData/lists"}