filter/displacement: Fix unicode support

Related: #359
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2020-11-28 23:32:51 +01:00 committed by Xaymar
parent 9fb75fc4f2
commit 73dfb580cb

View file

@ -33,14 +33,7 @@ using namespace streamfx::filter::displacement;
displacement_instance::displacement_instance(obs_data_t* data, obs_source_t* context) displacement_instance::displacement_instance(obs_data_t* data, obs_source_t* context)
: obs::source_instance(data, context) : obs::source_instance(data, context)
{ {
std::string effect = ""; _effect = gs::effect::create(streamfx::data_file_path("effects/displace.effect").u8string());
{
char* buf = obs_module_file("effects/displace.effect");
effect = buf;
bfree(buf);
}
_effect = gs::effect::create(effect);
update(data); update(data);
} }
@ -141,12 +134,8 @@ const char* displacement_factory::get_name()
void displacement_factory::get_defaults2(obs_data_t* data) void displacement_factory::get_defaults2(obs_data_t* data)
{ {
{ obs_data_set_default_string(data, ST_FILE,
char* disp = obs_module_file("examples/normal-maps/neutral.png"); streamfx::data_file_path("examples/normal-maps/neutral.png").u8string().c_str());
obs_data_set_default_string(data, ST_FILE, disp);
bfree(disp);
}
obs_data_set_default_double(data, ST_SCALE, 0.0); obs_data_set_default_double(data, ST_SCALE, 0.0);
obs_data_set_default_double(data, ST_SCALE_TYPE, 0.0); obs_data_set_default_double(data, ST_SCALE_TYPE, 0.0);
} }
@ -159,9 +148,7 @@ obs_properties_t* displacement_factory::get_properties2(displacement_instance* d
if (data) { if (data) {
path = data->get_file(); path = data->get_file();
} else { } else {
char* buf = obs_module_file("examples/normal-maps/neutral.png"); path = streamfx::data_file_path("examples/normal-maps/neutral.png").u8string();
path = buf;
bfree(buf);
} }
{ {