1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 15:29:55 +00:00

add ability to use display names

This commit is contained in:
cody glassman 2022-05-25 19:17:31 -07:00
parent 11845e7d9b
commit 424b828ff8
4 changed files with 25 additions and 17 deletions

View file

@ -600,6 +600,11 @@ namespace fx
expect<Lexer::String>();
uniform->mHeader = std::get<Lexer::String>(mToken).value;
}
else if (key == "display_name")
{
expect<Lexer::String>();
uniform->mDisplayName = std::get<Lexer::String>(mToken).value;
}
else
error(Misc::StringUtils::format("unexpected key '%s'", std::string{key}));

View file

@ -103,6 +103,7 @@ namespace fx
struct UniformBase
{
std::string mName;
std::string mDisplayName;
std::string mHeader;
std::string mTechniqueName;
std::string mDescription;

View file

@ -78,7 +78,7 @@ namespace fx
void UniformBase::init(const std::shared_ptr<fx::Types::UniformBase>& uniform)
{
mLabel->setCaption(uniform->mName);
mLabel->setCaption(uniform->mDisplayName.empty() ? uniform->mName : uniform->mDisplayName);
if (uniform->mDescription.empty())
{

View file

@ -413,24 +413,25 @@ To use the sampler, define the appropriately named `sampler2D` in any of your pa
It is possible to define settings for your shaders that can be adjusted by either users or a Lua script.
+-----------------+----------+----------+----------+---------+----------+--------------+---------+
| Block | default | min | max | static | step | description | header |
+=================+==========+==========+==========+=========+==========+==============+=========+
|``uniform_bool`` | boolean | x | x | boolean | x | string | string |
+-----------------+----------+----------+----------+---------+----------+--------------+---------+
|``uniform_float``| float | float | float | boolean | float | string | string |
+-----------------+----------+----------+----------+---------+----------+--------------+---------+
|``uniform_int`` | integer | integer | integer | boolean | integer | string | string |
+-----------------+----------+----------+----------+---------+----------+--------------+---------+
|``uniform_vec2`` | vec2 | vec2 | vec2 | boolean | vec2 | string | string |
+-----------------+----------+----------+----------+---------+----------+--------------+---------+
|``uniform_vec3`` | vec3 | vec3 | vec3 | boolean | vec3 | string | string |
+-----------------+----------+----------+----------+---------+----------+--------------+---------+
|``uniform_vec4`` | vec4 | vec4 | vec4 | boolean | vec4 | string | string |
+-----------------+----------+----------+----------+---------+----------+--------------+---------+
+-----------------+----------+----------+----------+---------+----------+--------------+-------------------+---------+
| Block | default | min | max | static | step | description | display_name | header |
+=================+==========+==========+==========+=========+==========+==============+===================+=========+
|``uniform_bool`` | boolean | x | x | boolean | x | string | string | string |
+-----------------+----------+----------+----------+---------+----------+--------------+-------------------+---------+
|``uniform_float``| float | float | float | boolean | float | string | string | string |
+-----------------+----------+----------+----------+---------+----------+--------------+-------------------+---------+
|``uniform_int`` | integer | integer | integer | boolean | integer | string | string | string |
+-----------------+----------+----------+----------+---------+----------+--------------+-------------------+---------+
|``uniform_vec2`` | vec2 | vec2 | vec2 | boolean | vec2 | string | string | string |
+-----------------+----------+----------+----------+---------+----------+--------------+-------------------+---------+
|``uniform_vec3`` | vec3 | vec3 | vec3 | boolean | vec3 | string | string | string |
+-----------------+----------+----------+----------+---------+----------+--------------+-------------------+---------+
|``uniform_vec4`` | vec4 | vec4 | vec4 | boolean | vec4 | string | string | string |
+-----------------+----------+----------+----------+---------+----------+--------------+-------------------+---------+
The ``description`` field is used to display a toolip when viewed in the in-game HUD. The ``header`` field
field can be used to organize uniforms into groups in the HUD.
field can be used to organize uniforms into groups in the HUD. The ``display_name`` field can be used to create a
more user friendly uniform name for display in the HUD.
If you would like a uniform to be adjustable with Lua API you `must` set ``static = false;``. Doing this
will also remove the uniform from the players HUD.
@ -580,6 +581,7 @@ desaturation to apply to the scene. Here we setup a new variable of type
max = 1.0;
step = 0.05;
static = true;
display_name = "Desaturation Factor";
description = "Desaturation factor. A value of 1.0 is full grayscale.";
}