Skip to content

Commit

Permalink
plugins: Remove dynamic default path properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Warchamp7 committed Apr 10, 2024
1 parent 16e86f2 commit b67338c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
16 changes: 2 additions & 14 deletions plugins/image-source/image-source.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,28 +306,16 @@ static const char *image_filter =

static obs_properties_t *image_source_properties(void *data)
{
struct image_source *s = data;
struct dstr path = {0};
UNUSED_PARAMETER(data);

obs_properties_t *props = obs_properties_create();

if (s && s->file && *s->file) {
const char *slash;

dstr_copy(&path, s->file);
dstr_replace(&path, "\\", "/");
slash = strrchr(path.array, '/');
if (slash)
dstr_resize(&path, slash - path.array + 1);
}

obs_properties_add_path(props, "file", obs_module_text("File"),
OBS_PATH_FILE, image_filter, path.array);
OBS_PATH_FILE, image_filter, NULL);
obs_properties_add_bool(props, "unload",
obs_module_text("UnloadWhenNotShowing"));
obs_properties_add_bool(props, "linear_alpha",
obs_module_text("LinearAlpha"));
dstr_free(&path);

return props;
}
Expand Down
14 changes: 5 additions & 9 deletions plugins/obs-filters/color-grade-filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ static void color_grade_filter_defaults(obs_data_t *settings)

static obs_properties_t *color_grade_filter_properties(void *data)
{
struct lut_filter_data *s = data;
UNUSED_PARAMETER(data);
struct dstr path = {0};
const char *slash;

Expand All @@ -391,14 +391,10 @@ static obs_properties_t *color_grade_filter_properties(void *data)

dstr_cat(&filter_str, "PNG/Cube (*.cube *.png)");

if (s && s->file && *s->file) {
dstr_copy(&path, s->file);
} else {
char *lut_dir = obs_module_file("LUTs");
dstr_copy(&path, lut_dir);
dstr_cat_ch(&path, '/');
bfree(lut_dir);
}
char *lut_dir = obs_module_file("LUTs");
dstr_copy(&path, lut_dir);
dstr_cat_ch(&path, '/');
bfree(lut_dir);

dstr_replace(&path, "\\", "/");
slash = strrchr(path.array, '/');
Expand Down

0 comments on commit b67338c

Please sign in to comment.