mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-24 12:25:11 +00:00
filter-blur: Properly set Image(s) filter for path property
This commit is contained in:
parent
43136b00c4
commit
9f28144b0b
2 changed files with 24 additions and 3 deletions
|
@ -140,6 +140,12 @@ filter::blur::blur_factory::blur_factory()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Translation Cache
|
||||
/// File Filter for Images
|
||||
translation_map.insert({std::string("image-filter"), std::string(P_TRANSLATE(S_FILETYPE_IMAGES))
|
||||
+ std::string(" (" T_FILEFILTERS_IMAGE ");;")
|
||||
+ std::string("* (*.*)")});
|
||||
}
|
||||
|
||||
filter::blur::blur_factory::~blur_factory() {}
|
||||
|
@ -222,6 +228,16 @@ void filter::blur::blur_factory::generate_kernel_textures()
|
|||
generate_gaussian_kernels();
|
||||
}
|
||||
|
||||
std::string& const filter::blur::blur_factory::get_translation(std::string const key)
|
||||
{
|
||||
static std::string none("");
|
||||
auto found = translation_map.find(key);
|
||||
if (found != translation_map.end()) {
|
||||
return found->second;
|
||||
}
|
||||
return none;
|
||||
}
|
||||
|
||||
void* filter::blur::blur_factory::create(obs_data_t* data, obs_source_t* parent)
|
||||
{
|
||||
if (get()->sources.empty()) {
|
||||
|
@ -615,7 +631,8 @@ obs_properties_t* filter::blur::blur_instance::get_properties()
|
|||
p = obs_properties_add_bool(pr, P_MASK_REGION_INVERT, P_TRANSLATE(P_MASK_REGION_INVERT));
|
||||
obs_property_set_long_description(p, P_TRANSLATE(P_DESC(P_MASK_REGION_INVERT)));
|
||||
/// Image
|
||||
p = obs_properties_add_path(pr, P_MASK_IMAGE, P_TRANSLATE(P_MASK_IMAGE), OBS_PATH_FILE, P_TRANSLATE(""), nullptr);
|
||||
p = obs_properties_add_path(pr, P_MASK_IMAGE, P_TRANSLATE(P_MASK_IMAGE), OBS_PATH_FILE,
|
||||
filter::blur::blur_factory::get()->get_translation("image-filter").c_str(), nullptr);
|
||||
obs_property_set_long_description(p, P_TRANSLATE(P_DESC(P_MASK_IMAGE)));
|
||||
/// Source
|
||||
p = obs_properties_add_list(pr, P_MASK_SOURCE, P_TRANSLATE(P_MASK_SOURCE), OBS_COMBO_TYPE_LIST,
|
||||
|
|
|
@ -67,6 +67,8 @@ namespace filter {
|
|||
std::shared_ptr<gs::effect> mask_effect;
|
||||
std::shared_ptr<gs::effect> blur_effect;
|
||||
|
||||
std::map<std::string, std::string> translation_map;
|
||||
|
||||
std::vector<double_t> gaussian_widths;
|
||||
std::map<uint8_t, std::shared_ptr<std::vector<float_t>>> gaussian_kernels;
|
||||
|
||||
|
@ -85,6 +87,8 @@ namespace filter {
|
|||
void generate_gaussian_kernels();
|
||||
void generate_kernel_textures();
|
||||
|
||||
std::string& const get_translation(std::string const key);
|
||||
|
||||
static void* create(obs_data_t* settings, obs_source_t* self);
|
||||
static void destroy(void* source);
|
||||
|
||||
|
|
Loading…
Reference in a new issue