Skip to content

Commit e653e70

Browse files
authored
[Reviewed] [Labeled button] Avoid unnecessary opacity changes (#2001)
- Don't show in changelog
1 parent 299ab8c commit e653e70

File tree

2 files changed

+129
-36
lines changed

2 files changed

+129
-36
lines changed

extensions/reviewed/PanelSpriteButton.json

Lines changed: 125 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"author": "",
33
"category": "User interface",
44
"extensionNamespace": "",
5-
"fullName": "Panel sprite button",
5+
"fullName": "Labeled button",
66
"gdevelopVersion": ">=5.5.230",
77
"helpPath": "/objects/button",
88
"iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI5LDIzSDNjLTEuMSwwLTItMC45LTItMlYxMWMwLTEuMSwwLjktMiwyLTJoMjZjMS4xLDAsMiwwLjksMiwydjEwQzMxLDIyLjEsMzAuMSwyMywyOSwyM3oiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMywxOUwxMywxOWMtMS4xLDAtMi0wLjktMi0ydi0yYzAtMS4xLDAuOS0yLDItMmgwYzEuMSwwLDIsMC45LDIsMnYyQzE1LDE4LjEsMTQuMSwxOSwxMywxOXoiLz4NCjxsaW5lIGNsYXNzPSJzdDAiIHgxPSIxOCIgeTE9IjEzIiB4Mj0iMTgiIHkyPSIxOSIvPg0KPGxpbmUgY2xhc3M9InN0MCIgeDE9IjIxIiB5MT0iMTMiIHgyPSIxOCIgeTI9IjE3Ii8+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iMjEiIHkxPSIxOSIgeDI9IjE5IiB5Mj0iMTYiLz4NCjwvc3ZnPg0K",
99
"name": "PanelSpriteButton",
1010
"previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Interface Elements/Interface Elements_interface_ui_button_ok_cta_clock_tap.svg",
11-
"shortDescription": "A button that can be customized.",
12-
"version": "2.1.1",
11+
"shortDescription": "A button with a label.",
12+
"version": "2.1.2",
1313
"description": [
1414
"A button that can be used for menus and most labelled buttons of a game. The button can be customized with a background for each state and a label. It handles user interactions and a simple condition can be used to check if it is clicked.",
1515
"",
@@ -1172,12 +1172,27 @@
11721172
"value": "Idle",
11731173
"type": "Choice",
11741174
"label": "State",
1175-
"extraInformation": [
1176-
"Idle",
1177-
"Hovered",
1178-
"PressedInside",
1179-
"PressedOutside",
1180-
"Validated"
1175+
"choices": [
1176+
{
1177+
"label": "Idle",
1178+
"value": "Idle"
1179+
},
1180+
{
1181+
"label": "Hovered",
1182+
"value": "Hovered"
1183+
},
1184+
{
1185+
"label": "PressedInside",
1186+
"value": "PressedInside"
1187+
},
1188+
{
1189+
"label": "PressedOutside",
1190+
"value": "PressedOutside"
1191+
},
1192+
{
1193+
"label": "Validated",
1194+
"value": "Validated"
1195+
}
11811196
],
11821197
"hidden": true,
11831198
"name": "State"
@@ -1211,7 +1226,29 @@
12111226
"name": "Index"
12121227
}
12131228
],
1214-
"sharedPropertyDescriptors": []
1229+
"propertiesFolderStructure": {
1230+
"folderName": "__ROOT",
1231+
"children": [
1232+
{
1233+
"propertyName": "ShouldCheckHovering"
1234+
},
1235+
{
1236+
"propertyName": "State"
1237+
},
1238+
{
1239+
"propertyName": "TouchId"
1240+
},
1241+
{
1242+
"propertyName": "TouchIsInside"
1243+
},
1244+
{
1245+
"propertyName": "MouseIsInside"
1246+
},
1247+
{
1248+
"propertyName": "Index"
1249+
}
1250+
]
1251+
}
12151252
}
12161253
],
12171254
"eventsBasedObjects": [
@@ -1224,8 +1261,8 @@
12241261
"areaMinZ": 0,
12251262
"assetStoreTag": "menu buttons",
12261263
"defaultName": "Button",
1227-
"description": "A button that can be customized.",
1228-
"fullName": "Button (panel sprite)",
1264+
"description": "Button with a label.",
1265+
"fullName": "Labeled button",
12291266
"isInnerAreaFollowingParentSize": true,
12301267
"isUsingLegacyInstancesRenderer": false,
12311268
"name": "PanelSpriteButton",
@@ -1464,6 +1501,7 @@
14641501
"ambientLightColorB": 200,
14651502
"ambientLightColorG": 200,
14661503
"ambientLightColorR": 200,
1504+
"camera2DPlaneMaxDrawingDistance": 5000,
14671505
"camera3DFarPlaneDistance": 10000,
14681506
"camera3DFieldOfView": 45,
14691507
"camera3DNearPlaneDistance": 3,
@@ -1523,6 +1561,7 @@
15231561
"initialVariables": []
15241562
}
15251563
],
1564+
"editionSettings": {},
15261565
"eventsFunctions": [
15271566
{
15281567
"fullName": "",
@@ -1963,26 +2002,45 @@
19632002
"parameters": [
19642003
"Pressed"
19652004
]
1966-
},
1967-
{
1968-
"type": {
1969-
"value": "Tween::RemoveTween"
1970-
},
1971-
"parameters": [
1972-
"Hovered",
1973-
"Tween",
1974-
"\"Fadeout\""
1975-
]
1976-
},
2005+
}
2006+
],
2007+
"events": [
19772008
{
1978-
"type": {
1979-
"value": "OpacityCapability::OpacityBehavior::SetValue"
1980-
},
1981-
"parameters": [
1982-
"Hovered",
1983-
"Opacity",
1984-
"=",
1985-
"255"
2009+
"type": "BuiltinCommonInstructions::Standard",
2010+
"conditions": [
2011+
{
2012+
"type": {
2013+
"value": "NumberVariable"
2014+
},
2015+
"parameters": [
2016+
"HoveredFadeOutDuration",
2017+
">",
2018+
"0"
2019+
]
2020+
}
2021+
],
2022+
"actions": [
2023+
{
2024+
"type": {
2025+
"value": "Tween::RemoveTween"
2026+
},
2027+
"parameters": [
2028+
"Hovered",
2029+
"Tween",
2030+
"\"Fadeout\""
2031+
]
2032+
},
2033+
{
2034+
"type": {
2035+
"value": "OpacityCapability::OpacityBehavior::SetValue"
2036+
},
2037+
"parameters": [
2038+
"Hovered",
2039+
"Opacity",
2040+
"=",
2041+
"255"
2042+
]
2043+
}
19862044
]
19872045
}
19882046
]
@@ -2673,21 +2731,53 @@
26732731
"type": "Number",
26742732
"unit": "Pixel",
26752733
"label": "",
2734+
"group": "States",
26762735
"hidden": true,
26772736
"name": "LabelOffset"
26782737
},
26792738
{
26802739
"value": "",
26812740
"type": "Choice",
26822741
"label": "",
2683-
"extraInformation": [
2684-
"Label.Text=LabelText",
2685-
"BitmapLabel.Text=LabelText"
2742+
"choices": [
2743+
{
2744+
"label": "Label.Text=LabelText",
2745+
"value": "Label.Text=LabelText"
2746+
},
2747+
{
2748+
"label": "BitmapLabel.Text=LabelText",
2749+
"value": "BitmapLabel.Text=LabelText"
2750+
}
26862751
],
26872752
"hidden": true,
26882753
"name": "_PropertyMapping"
26892754
}
2690-
]
2755+
],
2756+
"propertiesFolderStructure": {
2757+
"folderName": "__ROOT",
2758+
"children": [
2759+
{
2760+
"propertyName": "LabelText"
2761+
},
2762+
{
2763+
"propertyName": "_PropertyMapping"
2764+
},
2765+
{
2766+
"folderName": "States",
2767+
"children": [
2768+
{
2769+
"propertyName": "HoveredFadeOutDuration"
2770+
},
2771+
{
2772+
"propertyName": "PressedLabelOffsetY"
2773+
},
2774+
{
2775+
"propertyName": "LabelOffset"
2776+
}
2777+
]
2778+
}
2779+
]
2780+
}
26912781
}
26922782
]
26932783
}

scripts/lib/ExtensionsValidatorExceptions.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,10 @@ const extensionsAllowedProperties = {
635635
javaScriptObjectAllowedProperties: [],
636636
},
637637
PlaygamaBridge: {
638-
gdjsAllowedProperties: ['_playgamaBridgeExtension'],
638+
gdjsAllowedProperties: [
639+
'_playgamaBridgeExtension',
640+
'registerRuntimeScenePostEventsCallback',
641+
],
639642
gdjsEvtToolsAllowedProperties: [],
640643
runtimeSceneAllowedProperties: [],
641644
javaScriptObjectAllowedProperties: [],

0 commit comments

Comments
 (0)