mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 04:21:50 +00:00
Merge pull request #843 from MihailRis/common-vc-funcs
new functions and settings
This commit is contained in:
commit
025e32eec1
33 changed files with 617 additions and 421 deletions
|
|
@ -61,16 +61,19 @@ std::unique_ptr<UiDocument> UiDocument::read(
|
|||
const scriptenv& penv,
|
||||
const std::string& name,
|
||||
const io::path& file,
|
||||
const std::string& fileName
|
||||
const std::string& fileName,
|
||||
scriptenv&& env
|
||||
) {
|
||||
const std::string text = io::read_string(file);
|
||||
auto xmldoc = xml::parse(file.string(), text);
|
||||
|
||||
auto env = penv == nullptr
|
||||
? scripting::create_doc_environment(scripting::get_root_environment(), name)
|
||||
: scripting::create_doc_environment(penv, name);
|
||||
if (env == nullptr) {
|
||||
env = penv == nullptr
|
||||
? scripting::create_doc_environment(scripting::get_root_environment(), name)
|
||||
: scripting::create_doc_environment(penv, name);
|
||||
}
|
||||
|
||||
gui::UiXmlReader reader(gui, scriptenv(env));
|
||||
gui::UiXmlReader reader(gui, env);
|
||||
auto view = reader.readXML(file.string(), *xmldoc->getRoot());
|
||||
view->setId("root");
|
||||
UiDocScript script {};
|
||||
|
|
@ -82,9 +85,3 @@ std::unique_ptr<UiDocument> UiDocument::read(
|
|||
}
|
||||
return std::make_unique<UiDocument>(name, script, view, env);
|
||||
}
|
||||
|
||||
std::shared_ptr<gui::UINode> UiDocument::readElement(
|
||||
gui::GUI& gui, const io::path& file, const std::string& fileName
|
||||
) {
|
||||
return read(gui, nullptr, file.name(), file, fileName)->getRoot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,9 +50,7 @@ public:
|
|||
const scriptenv& parent_env,
|
||||
const std::string& name,
|
||||
const io::path& file,
|
||||
const std::string& fileName
|
||||
);
|
||||
static std::shared_ptr<gui::UINode> readElement(
|
||||
gui::GUI&, const io::path& file, const std::string& fileName
|
||||
const std::string& fileName,
|
||||
scriptenv&& env = nullptr
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue