mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-24 04:15:11 +00:00
filter-color-grade: Implement Tool selection for OBS Studio 24.x
This commit is contained in:
parent
d0b39186ea
commit
93ba39545f
2 changed files with 59 additions and 1 deletions
|
@ -108,23 +108,28 @@ Filter.Blur.Mask.Multiplier.Description="Multiply the final mask value by this v
|
|||
|
||||
# Filter - Color Grade
|
||||
Filter.ColorGrade="Color Grading"
|
||||
Filter.ColorGrade.Tool="Color Grading Tool"
|
||||
Filter.ColorGrade.Lift="Lift"
|
||||
Filter.ColorGrade.Lift.Red="Red Lift"
|
||||
Filter.ColorGrade.Lift.Green="Green Lift"
|
||||
Filter.ColorGrade.Lift.Blue="Blue Lift"
|
||||
Filter.ColorGrade.Lift.All="All Lift"
|
||||
Filter.ColorGrade.Gamma="Gamma"
|
||||
Filter.ColorGrade.Gamma.Red="Red Gamma"
|
||||
Filter.ColorGrade.Gamma.Green="Green Gamma"
|
||||
Filter.ColorGrade.Gamma.Blue="Blue Gamma"
|
||||
Filter.ColorGrade.Gamma.All="All Gamma"
|
||||
Filter.ColorGrade.Gain="Gain"
|
||||
Filter.ColorGrade.Gain.Red="Red Gain"
|
||||
Filter.ColorGrade.Gain.Green="Green Gain"
|
||||
Filter.ColorGrade.Gain.Blue="Blue Gain"
|
||||
Filter.ColorGrade.Gain.All="All Gain"
|
||||
Filter.ColorGrade.Offset="Offset"
|
||||
Filter.ColorGrade.Offset.Red="Red Offset"
|
||||
Filter.ColorGrade.Offset.Green="Green Offset"
|
||||
Filter.ColorGrade.Offset.Blue="Blue Offset"
|
||||
Filter.ColorGrade.Offset.All="All Offset"
|
||||
Filter.ColorGrade.Tint="Tint"
|
||||
Filter.ColorGrade.Tint.Shadow.Red="Shadow Red Tint"
|
||||
Filter.ColorGrade.Tint.Shadow.Green="Shadow Green Tint"
|
||||
Filter.ColorGrade.Tint.Shadow.Blue="Shadow Blue Tint"
|
||||
|
@ -134,6 +139,7 @@ Filter.ColorGrade.Tint.Midtone.Blue="Midtone Blue Tint"
|
|||
Filter.ColorGrade.Tint.Highlight.Red="Highlight Red Tint"
|
||||
Filter.ColorGrade.Tint.Highlight.Green="Highlight Green Tint"
|
||||
Filter.ColorGrade.Tint.Highlight.Blue="Highlight Blue Tint"
|
||||
Filter.ColorGrade.Correction="Color Correction"
|
||||
Filter.ColorGrade.Correction.Hue="Hue Shift"
|
||||
Filter.ColorGrade.Correction.Saturation="Saturation"
|
||||
Filter.ColorGrade.Correction.Lightness="Lightness"
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#endif
|
||||
|
||||
#define ST "Filter.ColorGrade"
|
||||
#define ST_TOOL ST ".Tool"
|
||||
#define ST_LIFT ST ".Lift"
|
||||
#define ST_LIFT_(x) ST_LIFT "." D_VSTR(x)
|
||||
#define ST_GAMMA ST ".Gamma"
|
||||
|
@ -73,6 +74,7 @@ const char* get_name(void*)
|
|||
|
||||
void get_defaults(obs_data_t* data)
|
||||
{
|
||||
obs_data_set_default_string(data, ST_TOOL, ST_CORRECTION);
|
||||
obs_data_set_default_double(data, ST_LIFT_(RED), 0);
|
||||
obs_data_set_default_double(data, ST_LIFT_(GREEN), 0);
|
||||
obs_data_set_default_double(data, ST_LIFT_(BLUE), 0);
|
||||
|
@ -104,10 +106,60 @@ void get_defaults(obs_data_t* data)
|
|||
obs_data_set_default_double(data, ST_CORRECTION_(CONTRAST), 100.0);
|
||||
}
|
||||
|
||||
bool tool_modified(obs_properties_t* props, obs_property_t* property, obs_data_t* settings)
|
||||
{
|
||||
const std::string mode{obs_data_get_string(settings, ST_TOOL)};
|
||||
|
||||
std::vector<std::pair<std::string, std::vector<std::string>>> tool_to_property{
|
||||
{ST_LIFT, {ST_LIFT_(RED), ST_LIFT_(GREEN), ST_LIFT_(BLUE), ST_LIFT_(ALL)}},
|
||||
{ST_GAMMA, {ST_GAMMA_(RED), ST_GAMMA_(GREEN), ST_GAMMA_(BLUE), ST_GAMMA_(ALL)}},
|
||||
{ST_GAIN, {ST_GAIN_(RED), ST_GAIN_(GREEN), ST_GAIN_(BLUE), ST_GAIN_(ALL)}},
|
||||
{ST_OFFSET, {ST_OFFSET_(RED), ST_OFFSET_(GREEN), ST_OFFSET_(BLUE), ST_OFFSET_(ALL)}},
|
||||
{ST_TINT,
|
||||
{
|
||||
ST_TINT_(TONE_LOW, RED),
|
||||
ST_TINT_(TONE_LOW, GREEN),
|
||||
ST_TINT_(TONE_LOW, BLUE),
|
||||
ST_TINT_(TONE_MID, RED),
|
||||
ST_TINT_(TONE_MID, GREEN),
|
||||
ST_TINT_(TONE_MID, BLUE),
|
||||
ST_TINT_(TONE_HIG, RED),
|
||||
ST_TINT_(TONE_HIG, GREEN),
|
||||
ST_TINT_(TONE_HIG, BLUE),
|
||||
}},
|
||||
{ST_CORRECTION,
|
||||
{ST_CORRECTION_(HUE), ST_CORRECTION_(SATURATION), ST_CORRECTION_(LIGHTNESS), ST_CORRECTION_(CONTRAST)}},
|
||||
};
|
||||
|
||||
for (auto kv : tool_to_property) {
|
||||
if (mode == kv.first) {
|
||||
for (auto kv2 : kv.second) {
|
||||
obs_property_set_visible(obs_properties_get(props, kv2.c_str()), true);
|
||||
}
|
||||
} else {
|
||||
for (auto kv2 : kv.second) {
|
||||
obs_property_set_visible(obs_properties_get(props, kv2.c_str()), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
obs_properties_t* get_properties(void*)
|
||||
{
|
||||
obs_properties_t* pr = obs_properties_create();
|
||||
|
||||
if (util::are_property_groups_broken()) {
|
||||
auto p =
|
||||
obs_properties_add_list(pr, ST_TOOL, P_TRANSLATE(ST_TOOL), OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
|
||||
obs_property_list_add_string(p, P_TRANSLATE(ST_LIFT), ST_LIFT);
|
||||
obs_property_list_add_string(p, P_TRANSLATE(ST_GAMMA), ST_GAMMA);
|
||||
obs_property_list_add_string(p, P_TRANSLATE(ST_GAIN), ST_GAIN);
|
||||
obs_property_list_add_string(p, P_TRANSLATE(ST_OFFSET), ST_OFFSET);
|
||||
obs_property_list_add_string(p, P_TRANSLATE(ST_TINT), ST_TINT);
|
||||
obs_property_list_add_string(p, P_TRANSLATE(ST_CORRECTION), ST_CORRECTION);
|
||||
obs_property_set_modified_callback(p, &tool_modified);
|
||||
}
|
||||
|
||||
{
|
||||
obs_properties_t* grp = pr;
|
||||
if (!util::are_property_groups_broken()) {
|
||||
|
@ -193,7 +245,7 @@ obs_properties_t* get_properties(void*)
|
|||
obs_properties_t* grp = pr;
|
||||
if (!util::are_property_groups_broken()) {
|
||||
grp = obs_properties_create();
|
||||
obs_properties_add_group(pr, ST_OFFSET, P_TRANSLATE(ST_OFFSET), OBS_GROUP_NORMAL, grp);
|
||||
obs_properties_add_group(pr, ST_CORRECTION, P_TRANSLATE(ST_CORRECTION), OBS_GROUP_NORMAL, grp);
|
||||
}
|
||||
|
||||
obs_properties_add_float_slider(grp, ST_CORRECTION_(HUE), P_TRANSLATE(ST_CORRECTION_(HUE)), -180, 180.0, 0.01);
|
||||
|
|
Loading…
Reference in a new issue