Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Zeus and 3DEN comments #785

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

Add Zeus and 3DEN comments #785

wants to merge 23 commits into from

Conversation

Timi007
Copy link

@Timi007 Timi007 commented Dec 26, 2024

Hello everyone! I would like to donate a feature from one of my mods.

When merged this pull request will:

  • Import 3DEN comments and show them in Zeus 3D and on the map
  • Allow curators to create, edit and delete comments using the context menu

How it works

All comments get stored in as a scenario attribute that is available during mission runtime. Currently, only the comment name is displayed and the description/tooltip is ignored. For it to work, the mission must be saved before preview. You can also hide an 3DEN comment by including the directive #ZEN_IGNORE# in the description/tooltip of the comment.

zen_3den_comments_zeus

TODO

  • Documentation
  • MP Testing
  • Moving comments

I also plan on adding the ability to create comments as Zeus during mission runtime. I think a module and context menu action would be nice. How do you handle internal dependencies? Should the module and action be implemented in their respective addons modules and context_actions? Or should they be implemented in this addon and depend on modules and context_menu for the classes and API?

Furthermore, I cannot store the comments without saving (I thought I could do it with the new OnBeforeMissionPreview event, but it does not work for me). And displaying tooltips on 3D icons is also not possible. So if anyone has some idea on how to solve these problems, I would be grateful.

@mharis001 mharis001 added the feature Adds a new feature label Dec 26, 2024
@mharis001 mharis001 added this to the 1.16.0 milestone Dec 26, 2024
@mharis001
Copy link
Member

You should implement the modules/context menu actions in this component. In terms of tooltips, maybe you could try using 2D icons similarly to how the doors component works.

Copy link
Member

@mharis001 mharis001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some initial style comments.

What is the reason for not using the GUI controls for drawing the icons as well? Not suggesting that is the best approach but curious on whether its just for visuals?

addons/comments/initSettings.inc.sqf Outdated Show resolved Hide resolved
addons/comments/initSettings.inc.sqf Outdated Show resolved Hide resolved
addons/comments/initSettings.inc.sqf Outdated Show resolved Hide resolved
addons/comments/stringtable.xml Show resolved Hide resolved
@Timi007
Copy link
Author

Timi007 commented Dec 30, 2024

Just some initial style comments.

What is the reason for not using the GUI controls for drawing the icons as well? Not suggesting that is the best approach but curious on whether its just for visuals?

The icons are GUI controls. Do you want to turn the text (comment title and creator) into GUI controls? If so, I thought about it. I'll need to try it out first, as I'm not sure how it will look visually with the scaling at distance. So for now I'm using drawIcon for text because it seemes easier for me. I will try to make a prototype that only uses GUI controls.

This is how it currently looks (left 3D, right map):
zen_comments

@mharis001
Copy link
Member

mharis001 commented Dec 31, 2024

Just a couple things to consider:

  • Using a HashMap to store the comments and storing both the 3DEN and Zeus created ones in one data structure.
  • Editing comments by double clicking them.
  • Do we need the module? 3DEN just uses the context menu for placing comments right?
  • Allowing color to be set per comment. Not sure if this is bloat or unnecessary.
  • Wish list: Moving comments (this would be quite involved).

As for the text scaling, I would say let's try to mimic the behaviour of 3DEN.

@mharis001
Copy link
Member

Does this handle a 3DEN comment being deleted by a client and then later another client connects? Is that comment also deleted for the JIP client?

@mharis001
Copy link
Member

This has some similarities with the area_markers component. I think using some of the approaches found in that could be useful. For example, how creating, deleting, and updating markers works as well as how those changes are reflected in the editable icons.

@Timi007
Copy link
Author

Timi007 commented Dec 31, 2024

Just a couple things to consider:

  • Using a HashMap to store the comments and storing both the 3DEN and Zeus created ones in one data structure.
  • Editing comments by double clicking them.
  • Do we need the module? 3DEN just uses the context menu for placing comments right?
  • Allowing color to be set per comment. Not sure if this is bloat or unnecessary.
  • Wish list: Moving comments (this would be quite involved).

As for the text scaling, I would say let's try to mimic the behaviour of 3DEN.

  • Will do
  • Will do
  • That's right. In hindsight, maybe we don't need the module.
  • I'm also unsure. But I think it would be nice. It allows users to "categorize" their comments. Maybe a dropdown with color presets is more user friendly instead of a color picker?
  • Will consider it but for now low priority
  • IIRC 3DEN doesn't scale comments at distance but just hides them after 750m. The icon scaling (but not text) is a Zeus thing. Currently, I've combined it to: Hide after 750m (3DEN), don't scale text (3DEN/Zeus), icon scales (Zeus)

Does this handle a 3DEN comment being deleted by a client and then later another client connects? Is that comment also deleted for the JIP client?

No, I think it doesn't. Good catch. I will do a MP test when thr PR is close to merging.

This has some similarities with the area_markers component. I think using some of the approaches found in that could be useful. For example, how creating, deleting, and updating markers works as well as how those changes are reflected in the editable icons.

Yeah, I already try to implement this similar to that component.

@mharis001
Copy link
Member

mharis001 commented Dec 31, 2024

Tried it out in-game. Works pretty well in terms of the visuals👍.

I messed around with some of the refactoring/cleanup I commented about earlier but ran out of time. Here is the diff in case you want to get a better idea of what I meant: Timi007/ZEN@comments...zen-mod:ZEN:comments

Pretty much what you have, mainly just using a HashMap and code style similar to the rest of the code base.

@Timi007
Copy link
Author

Timi007 commented Dec 31, 2024

Tried it out in-game. Works pretty well in terms of the visuals👍.

I messed around with some of the refactoring/cleanup I commented about earlier but ran out of time. Here is the diff in case you want to get a better idea of what I meant: Timi007/[email protected]:ZEN:comments

Pretty much what you have, mainly just using a HashMap and code style similar to the rest of the code base.

Oh, I just pushed a commit with my changed including editing comments. I will incorporate your code style into my changes.

@Timi007 Timi007 changed the title Show 3DEN comments in Zeus Add Zeus and 3DEN comments Dec 31, 2024
@mharis001
Copy link
Member

Instead of the ignore string, we could add a 3DEN checkbox attribute to comments for ignoring them.

@Timi007
Copy link
Author

Timi007 commented Jan 10, 2025

Do you know how to change the cursor in Zeus? Also, I think a mechanic for locking the position of comments would be nice. Do you have any ideas about how this mechanic could look like?

@Timi007 Timi007 marked this pull request as ready for review January 10, 2025 19:10
@mharis001
Copy link
Member

I don't there is a way to change the cursor. In terms of locking, probably just a checkbox in the dialog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adds a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants