mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 03:59:19 +02:00
feat(editor): include database, placing .inc templates from the node bank
This commit is contained in:
@@ -57,6 +57,7 @@ struct node_data;
|
||||
class basic_node;
|
||||
using group_handle = std::size_t;
|
||||
using layer_handle = std::uint16_t;
|
||||
using instance_handle = std::uint32_t;
|
||||
}
|
||||
|
||||
namespace Mtable
|
||||
|
||||
@@ -124,6 +124,10 @@ cParser::~cParser()
|
||||
// content of the processed file ended, following nodes belong to the parent layer again
|
||||
scene::Layers.close();
|
||||
}
|
||||
if (true == mInstanceFile)
|
||||
{
|
||||
scene::Layers.instance_end();
|
||||
}
|
||||
}
|
||||
|
||||
template <> glm::vec3 cParser::getToken(bool const ToLower, char const *Break)
|
||||
@@ -386,6 +390,14 @@ void cParser::startIncludeFromParser(cParser& srcParser, bool ToLower, std::stri
|
||||
if (mIncludeParser->mIncFile)
|
||||
{
|
||||
scene::Layers.template_used(includefile);
|
||||
// include of a template made directly by a layer file is handled by the editor as a whole. templates
|
||||
// included by that template are a part of it
|
||||
auto const site{include_site()};
|
||||
if (false == site.fixed && scene::Layers.instance() == 0 && mIncludeParser->mSize > 0)
|
||||
{
|
||||
scene::Layers.instance_begin(includefile, site.span);
|
||||
mIncludeParser->mInstanceFile = true;
|
||||
}
|
||||
}
|
||||
else if (mIncludeParser->mSize > 0)
|
||||
{
|
||||
|
||||
@@ -131,6 +131,7 @@ class cParser //: public std::stringstream
|
||||
std::size_t mLine { 0 }; // currently processed line
|
||||
bool mIncFile { false }; // the parser is processing an *.inc file
|
||||
bool mLayerFile { false }; // the parser is processing a file registered as scenery layer
|
||||
bool mInstanceFile { false }; // the parser is processing a template whose include is registered with the scenery layers
|
||||
std::streamoff mPosition { 0 }; // amount of bytes read from the stream so far
|
||||
std::streamoff mTokenBegin { 0 }; // location of the most recently read token
|
||||
std::streamoff mTokenEnd { 0 };
|
||||
|
||||
Reference in New Issue
Block a user