From c79c291d552345e78b7370e7b99fa7d0b42e2104 Mon Sep 17 00:00:00 2001 From: TyroneMF Date: Thu, 25 Nov 2021 14:05:45 +0000 Subject: [PATCH 1/7] Add texture selections to slideshow --- addons/slideshow/CfgVehicles.hpp | 6 ++++++ addons/slideshow/functions/fnc_addSlideActions.sqf | 7 ++++--- addons/slideshow/functions/fnc_autoTransition.sqf | 6 +++--- addons/slideshow/functions/fnc_createSlideshow.sqf | 8 +++++--- addons/slideshow/functions/fnc_moduleInit.sqf | 3 ++- addons/slideshow/stringtable.xml | 6 ++++++ 6 files changed, 26 insertions(+), 10 deletions(-) diff --git a/addons/slideshow/CfgVehicles.hpp b/addons/slideshow/CfgVehicles.hpp index 6c11ba866c6..c7c0687913a 100644 --- a/addons/slideshow/CfgVehicles.hpp +++ b/addons/slideshow/CfgVehicles.hpp @@ -47,6 +47,12 @@ class CfgVehicles { typeName = "NUMBER"; defaultValue = 0; }; + class Selection { + displayName = CSTRING(Selection_DisplayName); + description = CSTRING(Selection_Description); + typeName = "NUMBER"; + defaultValue = 0; + }; }; class ModuleDescription { description = CSTRING(Description); diff --git a/addons/slideshow/functions/fnc_addSlideActions.sqf b/addons/slideshow/functions/fnc_addSlideActions.sqf index 6416c35748e..0da68388c03 100644 --- a/addons/slideshow/functions/fnc_addSlideActions.sqf +++ b/addons/slideshow/functions/fnc_addSlideActions.sqf @@ -9,6 +9,7 @@ * 2: Names * 3: Controller * 4: Current Slideshow + * 5: Texture Selection (default: 0) * * Return Value: * List of actions @@ -19,7 +20,7 @@ * Public: No */ -params ["_objects", "_images", "_names", "_controller", "_currentSlideshow"]; +params ["_objects", "_images", "_names", "_controller", "_currentSlideshow", "_selection"]; private _actions = []; { @@ -30,9 +31,9 @@ private _actions = []; _names select _forEachIndex, "", { - (_this select 2) params ["_objects", "_image", "_currentSlideshow"]; + (_this select 2) params ["_objects", "_image", "_currentSlideshow", "_selection"]; { - _x setObjectTextureGlobal [0, _image] + _x setObjectTextureGlobal [_selection, _image] } count _objects; [QGVAR(slideChanged), [_image, _currentSlideshow]] call CBA_fnc_localEvent; }, diff --git a/addons/slideshow/functions/fnc_autoTransition.sqf b/addons/slideshow/functions/fnc_autoTransition.sqf index 87fe488754b..c9128e1d486 100644 --- a/addons/slideshow/functions/fnc_autoTransition.sqf +++ b/addons/slideshow/functions/fnc_autoTransition.sqf @@ -19,7 +19,7 @@ * Public: No */ -params ["_objects", "_images", "_varString", "_currentSlideshow", "_duration"]; +params ["_objects", "_images", "_varString", "_currentSlideshow", "_duration", "_selection"]; // Get current slide number of this slideshow private _currentSlide = missionNamespace getVariable [_varString, 0]; @@ -34,11 +34,11 @@ private _image = _images select _currentSlide; // Set slide { - _x setObjectTextureGlobal [0, _image]; + _x setObjectTextureGlobal [_selection, _image]; } count _objects; [QGVAR(slideChanged), [_image, _currentSlideshow]] call CBA_fnc_localEvent; // Log current slide and execute Next slide TRACE_4("Auto-transition",_image,_currentSlide,count _images,_duration); -[FUNC(autoTransition), [_objects, _images, _varString, _currentSlideshow, _duration], _duration] call CBA_fnc_waitAndExecute; +[FUNC(autoTransition), [_objects, _images, _varString, _currentSlideshow, _duration, _selection], _duration] call CBA_fnc_waitAndExecute; diff --git a/addons/slideshow/functions/fnc_createSlideshow.sqf b/addons/slideshow/functions/fnc_createSlideshow.sqf index 0d84fa969b8..88b0d45150d 100644 --- a/addons/slideshow/functions/fnc_createSlideshow.sqf +++ b/addons/slideshow/functions/fnc_createSlideshow.sqf @@ -10,6 +10,7 @@ * 3: Action Names * 4: Slide Duration (0 disables automatic transitions) * 5: Set Name (default: localized "Slides") + * 6: Texture Selection (default: 0) * * Return Value: * Slideshow ID @@ -26,7 +27,8 @@ params [ ["_images", [], [[]] ], ["_names", [], [[]] ], ["_duration", 0, [0]], - ["_setName", localize LSTRING(Interaction), [""]] + ["_setName", localize LSTRING(Interaction), [""]], + ["_selection", 0, [0]] ]; // Verify data @@ -47,7 +49,7 @@ TRACE_5("Information",_objects,_controllers,_images,_names,_setName); if (isServer) then { // Default images on whiteboards (first image) { - _x setObjectTextureGlobal [0, _images select 0]; + _x setObjectTextureGlobal [_selection, _images select 0]; } count _objects; }; @@ -100,7 +102,7 @@ if (_duration == 0) then { missionNamespace setVariable [_varString, 0]; // Automatic transitions handler - [FUNC(autoTransition), [_objects, _images, _varString, _currentSlideshow, _duration], _duration] call CBA_fnc_waitAndExecute; + [FUNC(autoTransition), [_objects, _images, _varString, _currentSlideshow, _duration, _selection], _duration] call CBA_fnc_waitAndExecute; }; _currentSlideshow diff --git a/addons/slideshow/functions/fnc_moduleInit.sqf b/addons/slideshow/functions/fnc_moduleInit.sqf index a8cf27ceec8..58abe25f797 100644 --- a/addons/slideshow/functions/fnc_moduleInit.sqf +++ b/addons/slideshow/functions/fnc_moduleInit.sqf @@ -32,6 +32,7 @@ private _images = [_logic getVariable ["Images", ""], false, false] call EFUNC(c private _names = [_logic getVariable ["Names", ""], false, false] call EFUNC(common,parseList); private _setName = _logic getVariable ["SetName", ""]; private _duration = _logic getVariable ["Duration", 0]; +private _selection = _logic getVariable ["Selection", 0]; // Objects synced to the module { @@ -40,6 +41,6 @@ private _duration = _logic getVariable ["Duration", 0]; } count (synchronizedObjects _logic); // Prepare with actions -[_objects, _controllers, _images, _names, _duration, _setName] call FUNC(createSlideshow); +[_objects, _controllers, _images, _names, _duration, _selection, _setName] call FUNC(createSlideshow); INFO_1("Slideshow Module Initialized on %1 Objects",(count _objects)); diff --git a/addons/slideshow/stringtable.xml b/addons/slideshow/stringtable.xml index 10adfc64571..1f85517c599 100644 --- a/addons/slideshow/stringtable.xml +++ b/addons/slideshow/stringtable.xml @@ -244,5 +244,11 @@ 幻灯片 Slaytlar + + Texture Selection + + + Description + From f63c00f6aa8f668ec7b6ebcd513c181641982a8a Mon Sep 17 00:00:00 2001 From: TyroneMF Date: Thu, 25 Nov 2021 14:32:39 +0000 Subject: [PATCH 2/7] final fixes --- addons/slideshow/functions/fnc_addSlideActions.sqf | 2 +- addons/slideshow/functions/fnc_createSlideshow.sqf | 2 +- addons/slideshow/functions/fnc_moduleInit.sqf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/slideshow/functions/fnc_addSlideActions.sqf b/addons/slideshow/functions/fnc_addSlideActions.sqf index 0da68388c03..49c9cd3932e 100644 --- a/addons/slideshow/functions/fnc_addSlideActions.sqf +++ b/addons/slideshow/functions/fnc_addSlideActions.sqf @@ -39,7 +39,7 @@ private _actions = []; }, {true}, {}, - [_objects, _x, _currentSlideshow] + [_objects, _x, _currentSlideshow, _selection] ] call EFUNC(interact_menu,createAction), [], _controller diff --git a/addons/slideshow/functions/fnc_createSlideshow.sqf b/addons/slideshow/functions/fnc_createSlideshow.sqf index 88b0d45150d..841365d4c42 100644 --- a/addons/slideshow/functions/fnc_createSlideshow.sqf +++ b/addons/slideshow/functions/fnc_createSlideshow.sqf @@ -84,7 +84,7 @@ if (_duration == 0) then { {}, {true}, {(_this select 2) call FUNC(addSlideActions)}, - [_objects, _images, _names, _x, _currentSlideshow], + [_objects, _images, _names, _x, _currentSlideshow, _selection], [0, 0, 0], 2 ] call EFUNC(interact_menu,createAction); diff --git a/addons/slideshow/functions/fnc_moduleInit.sqf b/addons/slideshow/functions/fnc_moduleInit.sqf index 58abe25f797..783f1de720f 100644 --- a/addons/slideshow/functions/fnc_moduleInit.sqf +++ b/addons/slideshow/functions/fnc_moduleInit.sqf @@ -41,6 +41,6 @@ private _selection = _logic getVariable ["Selection", 0]; } count (synchronizedObjects _logic); // Prepare with actions -[_objects, _controllers, _images, _names, _duration, _selection, _setName] call FUNC(createSlideshow); +[_objects, _controllers, _images, _names, _duration, _setName, _selection] call FUNC(createSlideshow); INFO_1("Slideshow Module Initialized on %1 Objects",(count _objects)); From 158c37d97e243a79f34f054c4ae660dcd211d9ab Mon Sep 17 00:00:00 2001 From: TyroneMF Date: Thu, 25 Nov 2021 14:33:45 +0000 Subject: [PATCH 3/7] Update stringtable.xml --- addons/slideshow/stringtable.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/slideshow/stringtable.xml b/addons/slideshow/stringtable.xml index 1f85517c599..60032a85bc3 100644 --- a/addons/slideshow/stringtable.xml +++ b/addons/slideshow/stringtable.xml @@ -227,6 +227,12 @@ 每張幻燈片顯示的時間。 預設:0 (自動換圖已禁用) 每张幻灯片显示的时间。 预设:0 (自动换图已禁用) + + Texture Selection + + + Object Texture selection. Default: 0 + Slides Diapositives @@ -244,11 +250,5 @@ 幻灯片 Slaytlar - - Texture Selection - - - Description - From a87e0bc6011ed921cb97c655dbacc848a32a8be1 Mon Sep 17 00:00:00 2001 From: TyroneMF Date: Thu, 25 Nov 2021 14:43:33 +0000 Subject: [PATCH 4/7] update documentation --- docs/wiki/framework/slideshow-framework.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/wiki/framework/slideshow-framework.md b/docs/wiki/framework/slideshow-framework.md index ef1d7062fde..5d27cbc697b 100644 --- a/docs/wiki/framework/slideshow-framework.md +++ b/docs/wiki/framework/slideshow-framework.md @@ -40,13 +40,14 @@ Important notes: 3 | Action Names | Array | Required 4 | Slide Duration | Number | Optional (default: `0`, `0` disables automatic transitions) 5 | Set Name | String | Optional (default: localized `"Slides"`) +6 | Texture Selection | Number | Optional (default: `0`) **R** | None | None | Return value _Note: Set Name argument added in 3.9.1._ #### 2.1.1 Example -`[[object1, object2], [controller1], ["images\image1.paa", "images\image2.paa"], ["Action1", "Action2"], 5, "My Slides"] call ace_slideshow_fnc_createSlideshow;` +`[[object1, object2], [controller1], ["images\image1.paa", "images\image2.paa"], ["Action1", "Action2"], 5, "My Slides", 1] call ace_slideshow_fnc_createSlideshow;` | Arguments | Explanation ---| --------- | ----------- @@ -56,3 +57,4 @@ _Note: Set Name argument added in 3.9.1._ 3 | `["Action1", "Action2"]` | Action names for interaction menu if automatic transitions are not enabled 4 | `5` | 5s slide duration before change to next image 5 | `"My Slides"` | Main interaction point name, for easier distinguishing of multiple slideshow sets +6 | `1` | Uses texture selection 1 for objects with multiple options From e289b373caedac801cc254aee5a31d0af3a3d87b Mon Sep 17 00:00:00 2001 From: TyroneMF Date: Thu, 25 Nov 2021 14:53:31 +0000 Subject: [PATCH 5/7] Update addons/slideshow/functions/fnc_addSlideActions.sqf Co-authored-by: Filip Maciejewski --- addons/slideshow/functions/fnc_addSlideActions.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/slideshow/functions/fnc_addSlideActions.sqf b/addons/slideshow/functions/fnc_addSlideActions.sqf index 49c9cd3932e..29997861e55 100644 --- a/addons/slideshow/functions/fnc_addSlideActions.sqf +++ b/addons/slideshow/functions/fnc_addSlideActions.sqf @@ -20,7 +20,7 @@ * Public: No */ -params ["_objects", "_images", "_names", "_controller", "_currentSlideshow", "_selection"]; +params ["_objects", "_images", "_names", "_controller", "_currentSlideshow", ["_selection", 0]]; private _actions = []; { From 65e17869e64d23066dbcf5f1dcc79045bad4fb4e Mon Sep 17 00:00:00 2001 From: TyroneMF Date: Fri, 26 Nov 2021 11:25:42 +0000 Subject: [PATCH 6/7] Update transition header/example --- addons/slideshow/functions/fnc_autoTransition.sqf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/slideshow/functions/fnc_autoTransition.sqf b/addons/slideshow/functions/fnc_autoTransition.sqf index c9128e1d486..f57abdd8df6 100644 --- a/addons/slideshow/functions/fnc_autoTransition.sqf +++ b/addons/slideshow/functions/fnc_autoTransition.sqf @@ -9,12 +9,13 @@ * 2: State Variable Name * 3: Current Slideshow * 4: Duration (0 disables automatic transitions) + * 5: Texture Selection * * Return Value: * None * * Example: - * [objects, images, "ace_slideshow_slideshow1", duration] call ace_slideshow_fnc_autoTransition + * [objects, images, "ace_slideshow_slideshow1", duration, selection] call ace_slideshow_fnc_autoTransition * * Public: No */ From 12ad8ad18f0f35bd485b6f55e37b2466bc9a2f12 Mon Sep 17 00:00:00 2001 From: TyroneMF Date: Sat, 27 Nov 2021 10:25:18 +0000 Subject: [PATCH 7/7] Update addons/slideshow/stringtable.xml Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com> --- addons/slideshow/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/slideshow/stringtable.xml b/addons/slideshow/stringtable.xml index 60032a85bc3..937764d231f 100644 --- a/addons/slideshow/stringtable.xml +++ b/addons/slideshow/stringtable.xml @@ -231,7 +231,7 @@ Texture Selection - Object Texture selection. Default: 0 + Object texture selection. Default: 0 Slides