gfx-shader: Add defaults

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2020-03-31 22:34:22 +02:00
parent d5dffbbe03
commit ac8844b305
5 changed files with 21 additions and 3 deletions

View file

@ -139,7 +139,9 @@ const char* filter::shader::shader_factory::get_name()
return D_TRANSLATE(ST);
}
void filter::shader::shader_factory::get_defaults2(obs_data_t* data) {}
void filter::shader::shader_factory::get_defaults2(obs_data_t* data) {
gfx::shader::shader::defaults(data);
}
obs_properties_t* filter::shader::shader_factory::get_properties2(shader::shader_instance* data)
{

View file

@ -171,6 +171,14 @@ try {
return false;
}
void gfx::shader::shader::defaults(obs_data_t* data)
{
obs_data_set_default_string(data, ST_SHADER_FILE, "");
obs_data_set_default_string(data, ST_SHADER_TECHNIQUE, "");
obs_data_set_default_string(data, ST_SHADER_SIZE_WIDTH, "100.0 %");
obs_data_set_default_string(data, ST_SHADER_SIZE_HEIGHT, "100.0 %");
}
void gfx::shader::shader::properties(obs_properties_t* pr)
{
_have_current_params = false;

View file

@ -93,6 +93,8 @@ namespace gfx {
bool load_shader(const std::filesystem::path& file, const std::string& tech, bool& shader_dirty,
bool& param_dirty);
static void defaults(obs_data_t* data);
void properties(obs_properties_t* props);
bool on_properties_modified(obs_properties_t* props, obs_property_t* prop, obs_data_t* data);

View file

@ -106,7 +106,10 @@ const char* shader::shader_factory::get_name()
return D_TRANSLATE(ST);
}
void shader::shader_factory::get_defaults2(obs_data_t* data) {}
void shader::shader_factory::get_defaults2(obs_data_t* data)
{
gfx::shader::shader::defaults(data);
}
obs_properties_t* shader::shader_factory::get_properties2(shader::shader_instance* data)
{

View file

@ -126,7 +126,10 @@ const char* transition::shader::shader_factory::get_name()
return D_TRANSLATE(ST);
}
void transition::shader::shader_factory::get_defaults2(obs_data_t* data) {}
void transition::shader::shader_factory::get_defaults2(obs_data_t* data)
{
gfx::shader::shader::defaults(data);
}
obs_properties_t* transition::shader::shader_factory::get_properties2(shader::shader_instance* data)
{