Add missing text parameter types for event-based extensions (#5689)

* Replace "effect parameter" with "effect property" in the UI and documentation.
* Inline property fields for effect name and property.
This commit is contained in:
D8H
2023-09-27 11:05:19 +02:00
committed by GitHub
parent b5b7edafb1
commit 9f4b12ce8a
16 changed files with 107 additions and 86 deletions

View File

@@ -1277,9 +1277,9 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
// Deprecated
obj.AddAction("SetEffectDoubleParameter",
_("Effect parameter (number)"),
_("Change the value of a parameter of an effect.") + "\n" +
_("You can find the parameter names (and change the effect "
_("Effect property (number)"),
_("Change the value of a property of an effect.") + "\n" +
_("You can find the property names (and change the effect "
"names) in the effects window."),
_("Set _PARAM2_ to _PARAM3_ for effect _PARAM1_ of _PARAM0_"),
_("Effects"),
@@ -1287,17 +1287,17 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
"res/actions/effect.png")
.AddParameter("object", _("Object"))
.AddParameter("objectEffectName", _("Effect name"))
.AddParameter("objectEffectParameterName", _("Parameter name"))
.AddParameter("objectEffectParameterName", _("Property name"))
.AddParameter("expression", _("New value"))
.MarkAsSimple()
.SetHidden();
// Deprecated
obj.AddAction("SetEffectStringParameter",
_("Effect parameter (string)"),
_("Change the value (string) of a parameter of an effect.") +
_("Effect property (string)"),
_("Change the value (string) of a property of an effect.") +
"\n" +
_("You can find the parameter names (and change the effect "
_("You can find the property names (and change the effect "
"names) in the effects window."),
_("Set _PARAM2_ to _PARAM3_ for effect _PARAM1_ of _PARAM0_"),
_("Effects"),
@@ -1305,16 +1305,16 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
"res/actions/effect.png")
.AddParameter("object", _("Object"))
.AddParameter("objectEffectName", _("Effect name"))
.AddParameter("objectEffectParameterName", _("Parameter name"))
.AddParameter("objectEffectParameterName", _("Property name"))
.AddParameter("string", _("New value"))
.MarkAsSimple()
.SetHidden();
// Deprecated
obj.AddAction("SetEffectBooleanParameter",
_("Effect parameter (enable or disable)"),
_("Enable or disable a parameter of an effect.") + "\n" +
_("You can find the parameter names (and change the effect "
_("Effect property (enable or disable)"),
_("Enable or disable a property of an effect.") + "\n" +
_("You can find the property names (and change the effect "
"names) in the effects window."),
_("Enable _PARAM2_ for effect _PARAM1_ of _PARAM0_: _PARAM3_"),
_("Effects"),
@@ -1322,8 +1322,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
"res/actions/effect.png")
.AddParameter("object", _("Object"))
.AddParameter("objectEffectName", _("Effect name"))
.AddParameter("objectEffectParameterName", _("Parameter name"))
.AddParameter("yesorno", _("Enable?"))
.AddParameter("objectEffectParameterName", _("Property name"))
.AddParameter("yesorno", _("Enable this property"))
.MarkAsSimple()
.SetHidden();

View File

@@ -444,9 +444,9 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
extension
.AddAction(
"SetLayerEffectParameter",
_("Effect parameter (number)"),
_("Change the value of a parameter of an effect.") + "\n" +
_("You can find the parameter names (and change the effect "
_("Effect property (number)"),
_("Change the value of a property of an effect.") + "\n" +
_("You can find the property names (and change the effect "
"names) in the effects window."),
_("Set _PARAM3_ to _PARAM4_ for effect _PARAM2_ of layer _PARAM1_"),
_("Effects"),
@@ -456,16 +456,16 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
.AddParameter("layer", _("Layer"), "", true)
.SetDefaultValue("\"\"")
.AddParameter("layerEffectName", _("Effect name"))
.AddParameter("layerEffectParameterName", _("Parameter name"))
.AddParameter("layerEffectParameterName", _("Property name"))
.AddParameter("expression", _("New value"))
.MarkAsAdvanced();
extension
.AddAction(
"SetLayerEffectStringParameter",
_("Effect parameter (string)"),
_("Change the value (string) of a parameter of an effect.") + "\n" +
_("You can find the parameter names (and change the effect "
_("Effect property (string)"),
_("Change the value (string) of a property of an effect.") + "\n" +
_("You can find the property names (and change the effect "
"names) in the effects window."),
_("Set _PARAM3_ to _PARAM4_ for effect _PARAM2_ of layer _PARAM1_"),
_("Effects"),
@@ -475,16 +475,16 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
.AddParameter("layer", _("Layer"), "", true)
.SetDefaultValue("\"\"")
.AddParameter("layerEffectName", _("Effect name"))
.AddParameter("layerEffectParameterName", _("Parameter name"))
.AddParameter("layerEffectParameterName", _("Property name"))
.AddParameter("string", _("New value"))
.MarkAsAdvanced();
extension
.AddAction(
"SetLayerEffectBooleanParameter",
_("Effect parameter (enable or disable)"),
_("Enable or disable a parameter of an effect.") + "\n" +
_("You can find the parameter names (and change the effect "
_("Effect property (enable or disable)"),
_("Enable or disable a property of an effect.") + "\n" +
_("You can find the property names (and change the effect "
"names) in the effects window."),
_("Enable _PARAM3_ for effect _PARAM2_ of layer _PARAM1_: _PARAM4_"),
_("Effects"),
@@ -494,8 +494,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
.AddParameter("layer", _("Layer"), "", true)
.SetDefaultValue("\"\"")
.AddParameter("layerEffectName", _("Effect name"))
.AddParameter("layerEffectParameterName", _("Parameter name"))
.AddParameter("yesorno", _("Enable this parameter"))
.AddParameter("layerEffectParameterName", _("Property name"))
.AddParameter("yesorno", _("Enable this property"))
.MarkAsAdvanced();
extension

View File

@@ -52,9 +52,9 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsEffectExtension(
.MarkAsSimple();
aut.AddScopedAction("SetEffectDoubleParameter",
_("Effect parameter (number)"),
_("Change the value of a parameter of an effect.") + "\n" +
_("You can find the parameter names (and change the effect "
_("Effect property (number)"),
_("Change the value of a property of an effect.") + "\n" +
_("You can find the property names (and change the effect "
"names) in the effects window."),
_("Set _PARAM3_ to _PARAM4_ for effect _PARAM2_ of _PARAM0_"),
_("Effects"),
@@ -63,15 +63,15 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsEffectExtension(
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "EffectBehavior")
.AddParameter("objectEffectName", _("Effect name"))
.AddParameter("objectEffectParameterName", _("Parameter name"))
.AddParameter("objectEffectParameterName", _("Property name"))
.AddParameter("expression", _("New value"))
.MarkAsSimple();
aut.AddScopedAction("SetEffectStringParameter",
_("Effect parameter (string)"),
_("Change the value (string) of a parameter of an effect.") +
_("Effect property (string)"),
_("Change the value (string) of a property of an effect.") +
"\n" +
_("You can find the parameter names (and change the effect "
_("You can find the property names (and change the effect "
"names) in the effects window."),
_("Set _PARAM3_ to _PARAM4_ for effect _PARAM2_ of _PARAM0_"),
_("Effects"),
@@ -80,14 +80,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsEffectExtension(
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "EffectBehavior")
.AddParameter("objectEffectName", _("Effect name"))
.AddParameter("objectEffectParameterName", _("Parameter name"))
.AddParameter("objectEffectParameterName", _("Property name"))
.AddParameter("string", _("New value"))
.MarkAsSimple();
aut.AddScopedAction("SetEffectBooleanParameter",
_("Effect parameter (enable or disable)"),
_("Enable or disable a parameter of an effect.") + "\n" +
_("You can find the parameter names (and change the effect "
_("Effect property (enable or disable)"),
_("Enable or disable a property of an effect.") + "\n" +
_("You can find the property names (and change the effect "
"names) in the effects window."),
_("Enable _PARAM3_ for effect _PARAM2_ of _PARAM0_: _PARAM4_"),
_("Effects"),
@@ -96,8 +96,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsEffectExtension(
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "EffectBehavior")
.AddParameter("objectEffectName", _("Effect name"))
.AddParameter("objectEffectParameterName", _("Parameter name"))
.AddParameter("yesorno", _("Enable?"))
.AddParameter("objectEffectParameterName", _("Property name"))
.AddParameter("yesorno", _("Enable this property"))
.MarkAsSimple();
aut.AddScopedCondition("IsEffectEnabled",

View File

@@ -578,15 +578,15 @@ void SetupProjectWithDummyPlatform(gd::Project& project,
extension
->AddExpression(
"LayerEffectParameter",
_("Effect parameter (number)"),
_("Return the value of a parameter of an effect."),
_("Effect property (number)"),
_("Return the value of a property of an effect."),
_("Effects"),
"")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
.SetDefaultValue("\"\"")
.AddParameter("layerEffectName", _("Effect name"))
.AddParameter("layerEffectParameterName", _("Parameter name"));
.AddParameter("layerEffectParameterName", _("Property name"));
}
{

View File

@@ -43,7 +43,7 @@ namespace gdjs {
// But be careful about the existing member of the filter (consider
// updating the filter uniforms directly).
// You can also access to the effect parameters, classified by type:
// You can also access to the effect properties, classified by type:
// `effectData.doubleParameters.opacity`
// `effectData.stringParameters.someImage`
// `effectData.stringParameters.someColor`

View File

@@ -391,9 +391,9 @@ namespace gdjs {
}
/**
* Change an effect parameter value (for parameters that are numbers).
* Change an effect property value (for properties that are numbers).
* @param name The name of the effect to update.
* @param parameterName The name of the parameter to update.
* @param parameterName The name of the property to update.
* @param value The new value (number).
*/
setEffectDoubleParameter(
@@ -410,9 +410,9 @@ namespace gdjs {
}
/**
* Change an effect parameter value (for parameters that are strings).
* Change an effect property value (for properties that are strings).
* @param name The name of the effect to update.
* @param parameterName The name of the parameter to update.
* @param parameterName The name of the property to update.
* @param value The new value (string).
*/
setEffectStringParameter(
@@ -429,9 +429,9 @@ namespace gdjs {
}
/**
* Change an effect parameter value (for parameters that are booleans).
* Change an effect property value (for properties that are booleans).
* @param name The name of the effect to update.
* @param parameterName The name of the parameter to update.
* @param parameterName The name of the property to update.
* @param value The new value (boolean).
*/
setEffectBooleanParameter(

View File

@@ -311,11 +311,11 @@ namespace gdjs {
};
/**
* Update a layer effect parameter (with a number).
* Update a layer effect property (with a number).
* @param instanceContainer the container owning the layer
* @param layer The name of the layer
* @param effect The name of the effect
* @param parameter The parameter to update
* @param parameter The property to update
* @param value The new value
*/
export const setLayerEffectDoubleParameter = function (
@@ -334,11 +334,11 @@ namespace gdjs {
};
/**
* Update a layer effect parameter (with a string).
* Update a layer effect property (with a string).
* @param instanceContainer the container owning the layer
* @param layer The name of the layer
* @param effect The name of the effect
* @param parameter The parameter to update
* @param parameter The property to update
* @param value The new value
*/
export const setLayerEffectStringParameter = function (
@@ -357,11 +357,11 @@ namespace gdjs {
};
/**
* Enable or disable a layer effect parameter (boolean).
* Enable or disable a layer effect property (boolean).
* @param instanceContainer the container owning the layer
* @param layer The name of the layer
* @param effect The name of the effect
* @param parameter The parameter to update
* @param parameter The property to update
* @param value The new value
*/
export const setLayerEffectBooleanParameter = function (

View File

@@ -6,9 +6,9 @@
namespace gdjs {
export interface EffectHandler {
/**
* Change an effect parameter value (for parameters that are numbers).
* Change an effect property value (for properties that are numbers).
* @param name The name of the effect to update.
* @param parameterName The name of the parameter to update.
* @param parameterName The name of the property to update.
* @param value The new value (number).
*/
setEffectDoubleParameter(
@@ -18,9 +18,9 @@ namespace gdjs {
): boolean;
/**
* Change an effect parameter value (for parameters that are strings).
* Change an effect property value (for properties that are strings).
* @param name The name of the effect to update.
* @param parameterName The name of the parameter to update.
* @param parameterName The name of the property to update.
* @param value The new value (string).
*/
setEffectStringParameter(
@@ -30,9 +30,9 @@ namespace gdjs {
): boolean;
/**
* Change an effect parameter value (for parameters that are booleans).
* Change an effect property value (for properties that are booleans).
* @param name The name of the effect to update.
* @param parameterName The name of the parameter to update.
* @param parameterName The name of the property to update.
* @param value The new value (boolean).
*/
setEffectBooleanParameter(

View File

@@ -131,11 +131,11 @@ namespace gdjs {
}
/**
* Update the parameter of an effect (with a number).
* Update the property of an effect (with a number).
* @param rendererEffects The collection of PixiJS filters.
* @param name The effect name
* @param parameterName The parameter name
* @param value The new value for the parameter
* @param parameterName The property name
* @param value The new value for the property
*/
setEffectDoubleParameter(
rendererEffects: RendererEffects,
@@ -150,11 +150,11 @@ namespace gdjs {
}
/**
* Update the parameter of an effect (with a string).
* Update the property of an effect (with a string).
* @param rendererEffects The collection of PixiJS filters.
* @param name The effect name
* @param parameterName The parameter name
* @param value The new value for the parameter
* @param parameterName The property name
* @param value The new value for the property
*/
setEffectStringParameter(
rendererEffects: RendererEffects,
@@ -169,11 +169,11 @@ namespace gdjs {
}
/**
* Enable or disable the parameter of an effect (boolean).
* Enable or disable the property of an effect (boolean).
* @param rendererEffects The collection of PixiJS filters.
* @param name The effect name
* @param parameterName The parameter name
* @param value The new value for the parameter
* @param parameterName The property name
* @param value The new value for the property
*/
setEffectBooleanParameter(
rendererEffects: RendererEffects,
@@ -188,7 +188,7 @@ namespace gdjs {
}
/**
* Updates all the effect parameters.
* Updates all the effect properties.
* @param rendererEffects
* @param effectData
*/

View File

@@ -1078,9 +1078,9 @@ namespace gdjs {
}
/**
* Change an effect parameter value (for parameters that are numbers).
* Change an effect property value (for properties that are numbers).
* @param name The name of the effect to update.
* @param parameterName The name of the parameter to update.
* @param parameterName The name of the property to update.
* @param value The new value (number).
*/
setEffectDoubleParameter(
@@ -1100,9 +1100,9 @@ namespace gdjs {
}
/**
* Change an effect parameter value (for parameters that are strings).
* Change an effect property value (for properties that are strings).
* @param name The name of the effect to update.
* @param parameterName The name of the parameter to update.
* @param parameterName The name of the property to update.
* @param value The new value (string).
*/
setEffectStringParameter(
@@ -1122,9 +1122,9 @@ namespace gdjs {
}
/**
* Change an effect parameter value (for parameters that are booleans).
* Change an effect property value (for properties that are booleans).
* @param name The name of the effect to update.
* @param parameterName The name of the parameter to update.
* @param parameterName The name of the property to update.
* @param value The new value (boolean).
*/
setEffectBooleanParameter(

View File

@@ -181,9 +181,9 @@ const translateTypeToHumanReadableDescription = type => {
if (type === 'identifier') return "🔤 Name (String)";
if (type === 'sceneName') return "🔤 Name of a scene (String)";
if (type === 'layerEffectName') return "🔤 Layer Effect Name (String)";
if (type === 'layerEffectParameterName') return "🔤 Layer Effect Parameter Name (String)";
if (type === 'layerEffectParameterName') return "🔤 Layer Effect Property Name (String)";
if (type === 'objectEffectName') return "🔤 Object Effect Name (String)";
if (type === 'objectEffectParameterName') return "🔤 Object Effect Parameter Name (String)";
if (type === 'objectEffectParameterName') return "🔤 Object Effect Property Name (String)";
if (type === 'objectPointName') return "🔤 Object Point Name (String)";
if (type === 'objectAnimationName') return "🔤 Object Animation Name (String)";
if (type === 'functionParameterName') return "🔤 Function Parameter Name (String)";
@@ -215,9 +215,9 @@ const translateTypeToHumanReadableType = type => {
if (type === 'identifier') return "string";
if (type === 'sceneName') return "scene name";
if (type === 'layerEffectName') return "layer effect name";
if (type === 'layerEffectParameterName') return "layer effect parameter name";
if (type === 'layerEffectParameterName') return "layer effect property name";
if (type === 'objectEffectName') return "object effect name";
if (type === 'objectEffectParameterName') return "object effect parameter name";
if (type === 'objectEffectParameterName') return "object effect property name";
if (type === 'objectPointName') return "object point name";
if (type === 'objectAnimationName') return "object animation name";
if (type === 'functionParameterName') return "function parameter name";

View File

@@ -276,7 +276,7 @@ const Effect = React.forwardRef(
{ type: 'separator' },
{
type: 'checkbox',
label: i18n._(t`Show Parameter Names`),
label: i18n._(t`Show Properties Names`),
checked: showEffectParameterNames,
click: () =>
setShowEffectParameterNames(!showEffectParameterNames),
@@ -304,7 +304,7 @@ const Effect = React.forwardRef(
showEffectParameterNames
? parameterName =>
i18n._(
t`Parameter name in events: \`${parameterName}\` `
t`Property name in events: \`${parameterName}\` `
)
: undefined
}

View File

@@ -112,6 +112,26 @@ export default function ValueTypeEditor({
value="objectAnimationName"
label={t`Object animation (text)`}
/>
<SelectOption
value="layerEffectName"
label={t`Layer effect (text)`}
/>
<SelectOption
value="layerEffectParameterName"
label={t`Layer effect property (text)`}
/>
<SelectOption
value="objectEffectName"
label={t`Object effect (text)`}
/>
<SelectOption
value="objectEffectParameterName"
label={t`Object effect property (text)`}
/>
<SelectOption
value="leaderboardId"
label={t`Leaderboad (text)`}
/>
<SelectOption value="identifier" label={t`Identifier (text)`} />
<SelectOption value="scenevar" label={t`Scene variable`} />
{!isExpressionType && (

View File

@@ -165,7 +165,7 @@ export default React.forwardRef<ParameterFieldProps, ParameterFieldInterface>(
leftIcon={<TypeCursorSelect />}
style={style}
primary
label={<Trans>Select an Effect Parameter</Trans>}
label={<Trans>Select an Effect Property</Trans>}
onClick={switchFieldType}
/>
) : (

View File

@@ -156,9 +156,9 @@ const userFriendlyTypeName: { [string]: MessageDescriptor } = {
forceMultiplier: t`Instant or permanent force`,
sceneName: t`Scene name`,
layerEffectName: t`Layer effect name`,
layerEffectParameterName: t`Layer effect parameter name`,
layerEffectParameterName: t`Layer effect property name`,
objectEffectName: t`Object effect name`,
objectEffectParameterName: t`Object effect parameter name`,
objectEffectParameterName: t`Object effect property name`,
objectPointName: t`Object point name`,
objectAnimationName: t`Object animation name`,
functionParameterName: t`Parameter name`,

View File

@@ -226,6 +226,7 @@ const propertyKeywordCouples: Array<Array<string>> = [
['Horizontal', 'Vertical'],
['Acceleration', 'Deceleration'],
['Duration', 'Easing'],
['EffectName', 'EffectProperty'],
];
const uncapitalize = str => {