Skip to content
Snippets Groups Projects
Commit 177a6a2e authored by Jonas Johan Solsvik's avatar Jonas Johan Solsvik
Browse files

Watcher.cpp and friends - renamings, no new functionality

parent bdceb9d6
No related branches found
No related tags found
No related merge requests found
Use shader introspection find which shaders need to attach to the uniform block points, resulting in sets of shaders where binding point would be the key.
this way we can loop through them
\ No newline at end of file
......@@ -29,8 +29,14 @@ private:
static std::vector<FileEvent> events;
public:
static constexpr char EventDiscovered[] = "discovered";
static constexpr char EventModified[] = "modified";
static constexpr char EventDeleted[] = "deleted";
static constexpr char EventMoved[] = "moved";
static constexpr char EventCreated[] = "created";
static auto popEvents(std::string eventType, std::string collection)->std::vector<FileEvent>;
static void discoverFiles();
static void pollEvents();
};
}
......@@ -29,7 +29,7 @@ auto MaterialSystem::getById(C::ID materialID) -> const Material&
void MaterialSystem::reload()
{
MaterialSystem::m_materials.clear();
Watcher::discoverFiles();
Watcher::pollEvents();
MaterialSystem::load();
for(auto onUpdate : MaterialSystem::m_updateCallbacks)
......
......@@ -76,7 +76,7 @@ void ModelSystem::reload()
ShaderSystem::unbindAll();
// Finally load new data
Watcher::discoverFiles();
Watcher::pollEvents();
ModelSystem::load();
}
......
......@@ -228,7 +228,7 @@ void ShaderSystem::reload()
// Load from file again
Watcher::discoverFiles();
Watcher::pollEvents();
ShaderSystem::load();
for(auto onUpdate : ShaderSystem::m_updateCallbacks)
{
......
......@@ -36,7 +36,8 @@ auto Watcher::popEvents(std::string eventType, std::string collection)->std::vec
return result;
}
void Watcher::discoverFiles()
void Watcher::pollEvents()
{
using namespace std::chrono_literals;
......@@ -45,13 +46,15 @@ void Watcher::discoverFiles()
FILE* pipe = popen(PYTHON_COMMAND, "r");
if (!pipe) {
printf("FAILED OPENING the pipe\n");
printf("FAILED OPENING python pipe\n");
return;
}
printf("OPENING python pipe %s\n", PYTHON_COMMAND);
char* msg;
while (msg = fgets(data, DATA_SIZE, pipe)) {
printf("msg %s", msg);
printf("event %s", msg);
std::stringstream ss;
......@@ -63,10 +66,10 @@ void Watcher::discoverFiles()
}
if (int notclosed = pclose(pipe); notclosed) {
printf("FAILED CLOSING the pipe\n");
printf("FAILED CLOSING python pipe\n");
return;
}
printf("CLOSING the pipe\n");
printf("CLOSING python pipe\n");
}
}
......
......@@ -46,7 +46,7 @@ int main()
Init::GLEW();
Init::OpenGL(C::ClearColor); //(0.05f, 0.06f, 0.075f, 1.0f) for sexy dark blue-grey
Watcher::discoverFiles();
Watcher::pollEvents();
// Load resource subsystems
TextureSystem::load();
......
......@@ -32,7 +32,7 @@ private:
public:
static auto popEvents(std::string eventType, std::string collection)->std::vector<FileEvent>;
static void discoverFiles();
static void pollEvents();
};
......@@ -58,7 +58,7 @@ auto Watcher::popEvents(std::string eventType, std::string collection)->std::vec
return result;
}
void Watcher::discoverFiles()
void Watcher::pollEvents()
{
using namespace std::chrono_literals;
......@@ -92,7 +92,7 @@ void Watcher::discoverFiles()
}
int main()
{
Watcher::discoverFiles();
Watcher::pollEvents();
auto tevents = Watcher::popEvents("discovered", "textures");
auto mevents = Watcher::popEvents("discovered", "shaders");
auto matevents = Watcher::popEvents("discovered", "materials");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment