Photon Editor Library 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
DesignerSceneReader.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <Common/Container/TStdUnorderedStringMap.h>
6#include <SDL/SdlCommandParser.h>
7
8#include <string>
9#include <unordered_map>
10
11namespace ph::editor
12{
13
14class DesignerScene;
15class DesignerObject;
16
20class DesignerSceneReader : public SdlCommandParser
21{
22public:
24 explicit DesignerSceneReader(const Path& sceneWorkingDirectory);
25
29 void read();
30
40 void setSceneInfo(std::string sceneName, DesignerScene* scene);
41
42protected:
43 bool beginCommand(
44 ESdlCommandType commandType,
45 const SdlClass* targetClass,
46 SdlInputContext* out_ctx) override;
47
48 void endCommand() override;
49
50 ISdlResource* createResource(
51 std::string_view resourceName,
52 const SdlInputContext& ctx,
53 ESdlCommandType commandType) override;
54
55 void initResource(
56 std::string_view resourceName,
57 ISdlResource* resource,
58 const SdlInputContext& ctx,
59 SdlInputClauses& clauses,
60 ESdlCommandType commandType) override;
61
62 ISdlResource* getResource(
63 std::string_view resourceName,
64 const SdlInputContext& ctx) override;
65
66 void runExecutor(
67 std::string_view executorName,
68 const SdlInputContext& ctx,
69 ISdlResource* targetResource,
70 SdlInputClauses& clauses,
71 ESdlCommandType commandType) override;
72
74 const SemanticVersion& version,
75 const SdlInputContext& ctx) override;
76
78 std::string_view packetName,
79 const SdlInputClauses& packet,
80 const SdlInputContext& ctx) override;
81
82private:
83 void readScene();
84 void readSceneMetaInfo();
85
86 std::string m_sceneName;
87 DesignerScene* m_scene;
88 DesignerSceneMetaInfo m_metaInfo;
89 TStdUnorderedStringMap<DesignerObject*> m_nameToNewObjs;
90};
91
92}// end namespace ph
Definition DesignerScene.h:58
Definition DesignerSceneMetaInfo.h:16
Loading utility for designer scene. Loads .pds (Photon Designer Scene) file.
Definition DesignerSceneReader.h:21
void endCommand() override
Definition DesignerSceneReader.cpp:87
void setSceneInfo(std::string sceneName, DesignerScene *scene)
Definition DesignerSceneReader.cpp:56
void commandVersionSet(const SemanticVersion &version, const SdlInputContext &ctx) override
Definition DesignerSceneReader.cpp:195
void runExecutor(std::string_view executorName, const SdlInputContext &ctx, ISdlResource *targetResource, SdlInputClauses &clauses, ESdlCommandType commandType) override
Definition DesignerSceneReader.cpp:181
ISdlResource * getResource(std::string_view resourceName, const SdlInputContext &ctx) override
Definition DesignerSceneReader.cpp:169
ISdlResource * createResource(std::string_view resourceName, const SdlInputContext &ctx, ESdlCommandType commandType) override
Definition DesignerSceneReader.cpp:90
void storeNamedDataPacket(std::string_view packetName, const SdlInputClauses &packet, const SdlInputContext &ctx) override
Definition DesignerSceneReader.cpp:200
bool beginCommand(ESdlCommandType commandType, const SdlClass *targetClass, SdlInputContext *out_ctx) override
Definition DesignerSceneReader.cpp:68
DesignerSceneReader()
Definition DesignerSceneReader.cpp:20
void read()
Read the entire designer scene. Scene information must be provided via setSceneInfo() prior to callin...
Definition DesignerSceneReader.cpp:36
void initResource(std::string_view resourceName, ISdlResource *resource, const SdlInputContext &ctx, SdlInputClauses &clauses, ESdlCommandType commandType) override
Definition DesignerSceneReader.cpp:147
Definition ph_editor.h:10