Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options: Add support for "--reset-option-name" for libf3d options #2013

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions application/F3DStarter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,16 @@ class F3DStarter::F3DInternals

try
{
// Assume this is a libf3d option and set the value
libOptions.setAsString(libf3dOptionName, value);
// Assume this is a libf3d option
if (value == "Default")
{
// "Default" is a special value that lets users reset a libf3d option
libOptions.reset(libf3dOptionName);
}
else
{
libOptions.setAsString(libf3dOptionName, value);
}

// Log the option if needed
if (logOptions)
Expand Down
1 change: 1 addition & 0 deletions application/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ f3d_test(NAME TestUpDirectionNoSign DATA suzanne.ply ARGS --up=X)
f3d_test(NAME TestTextureMatCap DATA suzanne.ply ARGS --texture-matcap=${F3D_SOURCE_DIR}/testing/data/skin.png)
f3d_test(NAME TestTextureMatCapWithTCoords DATA WaterBottle.glb ARGS --texture-matcap=${F3D_SOURCE_DIR}/testing/data/skin.png)
f3d_test(NAME TestConfigOrder DATA suzanne.ply ARGS CONFIG ${F3D_SOURCE_DIR}/testing/configs/config_order.json) # `.+` > `.*` alphabetically but overridden by the order
f3d_test(NAME TestConfigAndDefault DATA dragon.vtu ARGS --coloring-scalar-bar=Default CONFIG ${F3D_SOURCE_DIR}/testing/configs/complex.json UI)
f3d_test(NAME TestOutputStream DATA suzanne.ply ARGS --verbose=quiet --output=- REGEXP "^.PNG" NO_BASELINE NO_OUTPUT)
f3d_test(NAME TestOutputStreamInfo DATA suzanne.ply ARGS --verbose=info --output=- REGEXP "redirected to stderr" NO_BASELINE NO_OUTPUT)

Expand Down
2 changes: 2 additions & 0 deletions doc/user/OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ As documented, only the `--option=value` syntax is supported. The syntax `--opti

All options are parsed according to their type, see the [parsing documentation](PARSING.md) for more details.

It is possible to reset [libf3d options](../libf3d/OPTIONS.md) to their default value using the `--options=Default` syntax.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not completely convinced this is the right approach. wdyt @Meakk ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like it tbh.
What about --reset-coloring-scalar-bar?
Warning handling in GCC do something similar with -Wfoo/-Wno-foo.
It may be a bit trickier to implement but I'd prefer something like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like that @Meakk ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I think it's better and avoid potential issue with the reserved keyword.


## Filename templating

The destination filename used by `--output` or to save screenshots using `--screenshot-filename` can use the following template variables:
Expand Down
3 changes: 3 additions & 0 deletions testing/baselines/TestConfigAndDefault.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.