Skip to content
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d05a5f3
Show 3DEN comments in Zeus
Timi007 Dec 26, 2024
28e4f2f
Make icons smaller and hide line behind icon
Timi007 Dec 26, 2024
0935239
Spelling
Timi007 Dec 26, 2024
d2b1a84
Add tooltip to comments
Timi007 Dec 29, 2024
be9ba01
Fix 3DEN event handlers added again when returning from preview
Timi007 Dec 29, 2024
c6a094e
Save comment when starting preview
Timi007 Dec 29, 2024
58482f1
Move gui to file
Timi007 Dec 29, 2024
4e8bd2d
Add zeus comments
Timi007 Dec 30, 2024
83f9d1e
Allow deleting comments
Timi007 Dec 30, 2024
8256b2c
Add type for zeus/3DEN comment & cleanup
Timi007 Dec 30, 2024
d66d336
Merge to one package
Timi007 Dec 30, 2024
4c44b03
Remove module
Timi007 Dec 31, 2024
045bc1a
Allow editing and pick color of comments
Timi007 Dec 31, 2024
f346539
Adapt to be more consistent with area_markers
Timi007 Jan 4, 2025
e5bcece
Add 3DEN checkbox attribute for ignoring comments
Timi007 Jan 4, 2025
6359e65
Use LINKFUNC
Timi007 Jan 6, 2025
2fa657a
Fix obsolete param
Timi007 Jan 6, 2025
dbd3231
Add ability to move comment
Timi007 Jan 9, 2025
b3e916a
Cleanup
Timi007 Jan 10, 2025
f44d79c
Add documentation
Timi007 Jan 10, 2025
bdbc943
Remove module dependency
Timi007 Jan 10, 2025
98133f6
Fix JIP problems
Timi007 Jan 10, 2025
3bf6e7f
Fix spelling
Timi007 Jan 10, 2025
4e8d409
Add comment feature to README
Timi007 Jan 12, 2025
d1cc8c8
Add option to lock position
Timi007 Jan 15, 2025
3dc2d03
Use toolbox instead of checkbox
Timi007 Jan 17, 2025
4a4e223
Merge branch 'master' into comments
Timi007 Mar 6, 2025
9ddd08d
Update addons/comments/functions/fnc_moveComment.sqf
BrettMayson Feb 7, 2026
c7318ef
add events to docs
BrettMayson Feb 7, 2026
ed9faa5
remove the word comment
BrettMayson Feb 7, 2026
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
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ PlayerBot
Ryan180602
shukari
SilentSpike
Timi007
Toinane
Tuupertunut
veteran29
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Special thanks to the [ACE3 Team](https://ace3.acemod.org/team) for their open s
- Settings to control Zeus camera properties such as speed and available vision modes.
- Zeus camera flashlight for easier editing at night.
- New waypoint types such as paradrop available through Zeus.
- Ability to place comments and see comments created in 3DEN.

## Contributing

Expand Down
1 change: 1 addition & 0 deletions addons/comments/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x\zen\addons\comments
61 changes: 61 additions & 0 deletions addons/comments/Cfg3DEN.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
class Cfg3DEN {
class Attributes {
class Default;
class GVAR(hiddenAttribute): Default {
onLoad = QUOTE((ctrlParentControlsGroup ctrlParentControlsGroup (_this select 0)) ctrlShow false);
};
};

class Mission {
class Scenario {
class AttributeCategories {
class ADDON {
displayName = STR_DISPLAY_NAME;
collapsed = 1;

class Attributes {
class GVAR(3DENComments) {
displayName = STR_DISPLAY_NAME;
property = QGVAR(3DENComments);
control = QGVAR(hiddenAttribute);
tooltip = "";
defaultValue = "[]";
expression = "";
wikiType = "[[Array]]";
};
};
};
};
};
};

class EventHandlers {
class ADDON {
// Arguments are for debugging
onMissionSave = QUOTE(['onMissionSave'] call FUNC(save3DENComments));
onMissionAutosave = QUOTE(['onMissionAutosave'] call FUNC(save3DENComments));
onBeforeMissionPreview = QUOTE(['onBeforeMissionPreview'] call FUNC(save3DENComments));
};
};

class Comment {
class AttributeCategories {
class ADDON {
displayName = ECSTRING(main,DisplayName);
collapsed = 0;

class Attributes {
class GVAR(showComment) {
displayName = CSTRING(ShowCommentInZeus);
tooltip = CSTRING(ShowCommentInZeus_Description);
property = QGVAR(showComment);
control = "CheckboxState";
defaultValue = "true";
expression = "";
wikiType = "[[Bool]]";
};
};
};
};
};
};
9 changes: 9 additions & 0 deletions addons/comments/CfgContext.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class EGVAR(context_menu,actions) {
class GVAR(createComment) {
displayName = STR_CREATE_COMMENT;
icon = COMMENT_ICON;
condition = QGVAR(enabled);
statement = QUOTE([_position] call FUNC(openDialog));
priority = 35;
};
};
17 changes: 17 additions & 0 deletions addons/comments/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class Extended_PreStart_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_preStart));
};
};

class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit));
};
};

class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_postInit));
};
};
23 changes: 23 additions & 0 deletions addons/comments/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
PREP(addDrawEventHandler);
PREP(createComment);
PREP(createIcon);
PREP(deleteComment);
PREP(deleteIcon);
PREP(drawComments);
PREP(is3DENComment);
PREP(moveComment);
PREP(onCommentCreated);
PREP(onCommentDeleted);
PREP(onCommentUpdated);
PREP(onDraw);
PREP(onDraw3D);
PREP(onKeyDown);
PREP(onMouseButtonDown);
PREP(onMouseButtonUp);
PREP(onMouseDblClick);
PREP(onMouseMoving);
PREP(onUnload);
PREP(openDialog);
PREP(save3DENComments);
PREP(updateComment);
PREP(updateIcon);
19 changes: 19 additions & 0 deletions addons/comments/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "script_component.hpp"

if (isServer) then {
[QGVAR(createComment), LINKFUNC(createComment)] call CBA_fnc_addEventHandler;
[QGVAR(deleteComment), LINKFUNC(deleteComment)] call CBA_fnc_addEventHandler;
[QGVAR(updateComment), LINKFUNC(updateComment)] call CBA_fnc_addEventHandler;
};

if (hasInterface) then {
GVAR(comments) = createHashMapFromArray getMissionConfigValue [QGVAR(3DENComments), []];
TRACE_1("Loaded 3DEN Comments from mission",GVAR(comments));

[QGVAR(commentCreated), LINKFUNC(onCommentCreated)] call CBA_fnc_addEventHandler;
Comment thread
BrettMayson marked this conversation as resolved.
[QGVAR(commentDeleted), LINKFUNC(onCommentDeleted)] call CBA_fnc_addEventHandler;
[QGVAR(commentUpdated), LINKFUNC(onCommentUpdated)] call CBA_fnc_addEventHandler;

["zen_curatorDisplayLoaded", LINKFUNC(addDrawEventHandler)] call CBA_fnc_addEventHandler;
["zen_curatorDisplayUnloaded", LINKFUNC(onUnload)] call CBA_fnc_addEventHandler;
};
27 changes: 27 additions & 0 deletions addons/comments/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "script_component.hpp"

ADDON = false;

PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

if (isServer) then {
// Unique ID for creating comments
GVAR(nextID) = 0;
};

if (hasInterface) then {
// Map of all comments
// Keys are comment IDs and values are the data
GVAR(comments) = createHashMap;
GVAR(icons) = createHashMap;

GVAR(draw3DAdded) = false;

GVAR(movingComment) = [];
};

#include "initSettings.inc.sqf"

ADDON = true;
3 changes: 3 additions & 0 deletions addons/comments/XEH_preStart.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "script_component.hpp"

#include "XEH_PREP.hpp"
22 changes: 22 additions & 0 deletions addons/comments/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "script_component.hpp"

class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"zen_dialog"};
author = ECSTRING(main,Author);
authors[] = {"Timi007"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};

PRELOAD_ADDONS;

#include "CfgEventHandlers.hpp"
#include "Cfg3DEN.hpp"
#include "CfgContext.hpp"
#include "gui.hpp"
37 changes: 37 additions & 0 deletions addons/comments/functions/fnc_addDrawEventHandler.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "script_component.hpp"
/*
* Author: Timi007
* Function triggered every time the Zeus/Curator display is opened.
* Adds the draw event handlers to display 3DEN comments in 3D and on the map.
*
* Arguments:
* 0: Zeus Display <DISPLAY>
*
* Return Value:
* None
*
* Example:
* [_display] call zen_comments_fnc_addDrawEventHandler
*
* Public: No
*/

params ["_display"];
TRACE_1("Zeus display opened",_display);

if (!GVAR(enabled) && !GVAR(enabled3DEN)) exitWith {};

[{
{_x call FUNC(createIcon)} forEach GVAR(comments);
}] call CBA_fnc_execNextFrame; // Run next frame so display is loaded in FUNC(createIcon)

if (!GVAR(draw3DAdded)) then {
LOG("Adding Draw3D.");
addMissionEventHandler ["Draw3D", {call FUNC(onDraw3D)}];
GVAR(draw3DAdded) = true;
};

// MapDraw EH needs to be added every time the Zeus display is opened.
LOG("Adding map draw.");
private _ctrlMap = _display displayCtrl IDC_RSCDISPLAYCURATOR_MAINMAP;
_ctrlMap ctrlAddEventHandler ["Draw", {call FUNC(onDraw)}];
44 changes: 44 additions & 0 deletions addons/comments/functions/fnc_createComment.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include "script_component.hpp"
/*
* Author: Timi007
* Creates a new comment in Zeus.
*
* Arguments:
* 0: Position ASL <ARRAY>
* 1: Title <STRING>
* 2: Tooltip <STRING> (default: "")
* 3: Comment color (RGBA) <ARRAY> (default: yellow)
* 4: Creator <STRING> (default: "")
* 5: Lock position <BOOLEAN> (default: false)
*
* Return Value:
* Id of the created comment <STRING>.
*
* Example:
* [[0, 0, 0], "My Comment", "This is a nice comment", [1, 0, 0, 0.7], "Joe", false] call zen_comments_fnc_createComment
*
* Public: No
*/

if (!isServer) exitWith {
[QGVAR(createComment), _this] call CBA_fnc_serverEvent;
};

params [
["_position", [0, 0, 0], [[]], 3],
["_title", "", [""]],
["_tooltip", "", [""]],
["_color", DEFAULT_COLOR, [[]], 4],
["_creator", "", [""]],
["_lockPosition", false, [false]]
];

private _id = format ["%1:%2", COMMENT_TYPE_ZEUS, GVAR(nextID)];
private _data = [_position, _title, _tooltip, _color, _creator, _lockPosition];
GVAR(nextID) = GVAR(nextID) + 1;

private _jipId = format [QGVAR(%1), _id];
[QGVAR(commentCreated), [_id, _data], _jipId] call CBA_fnc_globalEventJIP;
TRACE_2("Comment created",_id,_data);

_id
31 changes: 31 additions & 0 deletions addons/comments/functions/fnc_createIcon.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "script_component.hpp"
/*
* Author: Timi007
* Creates an icon control for the comment.
*
* Arguments:
* 0: Unique comment id <STRING>
*
* Return Value:
* Icon control for the comment <CONTROL>.
*
* Example:
* ["zeus:0"] call zen_comments_fnc_createIcon
*
* Public: No
*/

params ["_id"];

private _display = findDisplay IDD_RSCDISPLAYCURATOR;
if (isNull _display || !(_id in GVAR(comments))) exitWith {};

(GVAR(comments) get _id) params ["", "", ["_tooltip", ""]];

private _ctrlIcon = _display ctrlCreate [QGVAR(RscActiveCommentIcon), -1];
_ctrlIcon setVariable [QGVAR(comment), _id];
_ctrlIcon ctrlSetTooltip _tooltip;

GVAR(icons) set [_id, _ctrlIcon];

_ctrlIcon
30 changes: 30 additions & 0 deletions addons/comments/functions/fnc_deleteComment.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "script_component.hpp"
/*
* Author: Timi007
* Deletes the comment.
*
* Arguments:
* 0: Comment id <STRING>
*
* Return Value:
* None
*
* Example:
* ["zeus:2"] call zen_comments_fnc_deleteComment
*
* Public: No
*/

if (!isServer) exitWith {
[QGVAR(deleteComment), _this] call CBA_fnc_serverEvent;
};

params ["_id"];

// JIP event IDs are globally unique. For 3DEN comments, there won't be a created
// event but for Zeus ones the created JIP event will be overwritten with this
// deleted event that shares the same JIP ID, meaning that we don't have to remove
// the created JIP event.
private _jipId = format [QGVAR(%1), _id];
[QGVAR(commentDeleted), [_id], _jipId] call CBA_fnc_globalEventJIP;
TRACE_1("Comment deleted",_id);
22 changes: 22 additions & 0 deletions addons/comments/functions/fnc_deleteIcon.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "script_component.hpp"
/*
* Author: Timi007
* Deletes the icon control of comment.
*
* Arguments:
* 0: Comment id <STRING>
*
* Return Value:
* None
*
* Example:
* ["zeus:2"] call zen_comments_fnc_deleteIcon
*
* Public: No
*/

params ["_id"];

if (_id in GVAR(icons)) then {
ctrlDelete (GVAR(icons) deleteAt _id);
};
Loading