Skip to content

Copy entity keyvalues onto clipboard - #153

Draft
Mikk155 wants to merge 3 commits into
wootguy:masterfrom
Mikk155:copy-keyvalues-onto-clipboard
Draft

Mikk155 wants to merge 3 commits into
wootguy:masterfrom
Mikk155:copy-keyvalues-onto-clipboard

Conversation

@Mikk155

@Mikk155 Mikk155 commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

when using the "Copy" button it will copy the keyvalues into clipboard with the following format:

!!EPAIRS
"classname" "info_player_start"
"angles" "0 0 0"

when pressing the "Paste" button in a entity in J.A.C.K (Maybe svencraft too?) this will suscessfully copy one entity from a BSP using BSPGuy into JACK.

Issues:

  • As i am not experienced with linux this currently only works in windows.
    • Solved with ImGui
  • when copying multiple entities from BSPGuy it will only copy the last entity's classname. maybe it could take up the first entity that the user selected instead.
    • Now it copies the first entity selected.
  • There is no "Paste" from clipboard, i couldn't tell how would be the best way to do this without affecting the current behaviour of Copy/Paste.
  • Can not currently Paste strings copied outside of BSPGuy, could probably be a issue with ImGui::GetClipboardText?

This is more of a prototype idea that can be completed later. it'll be useful to copy/paste entities to/from BSPGuy/JACK.

@wootguy

wootguy commented Sep 5, 2026

Copy link
Copy Markdown
Owner

A good idea but there should be a toggle for this in setting to change the clipboard data format. Currently it's set up to work with .ent files and includes the curly braces. Also, the copy/paste buttons in the keyvalue editor are a bit special and don't fully copy an entity. The classname, origin, and model aren't included. I'll leave this as an open issue for now. I don't want to merge in an incomplete feature then forget about it.

@Mikk155

Mikk155 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

should be a toggle for this in setting to change

Agree. i wanted to do it like that having an option to toggle this behaviour but i'm not familiar with the workspace.

Currently it's set up to work with .ent files and includes the curly braces

I were trying to copy a ent (from the Copy button) but it never copied the pairs. it only copied the pairs when Ctrl+c/x on a entity.
So merging this wouldn't conflict in the short terms unless a commit is made to fix that "Copy" button not copying the object.

@wootguy
wootguy force-pushed the master branch 4 times, most recently from 05b616e to 59e334b Compare September 5, 2026 20:36
@wootguy

wootguy commented Sep 5, 2026

Copy link
Copy Markdown
Owner

So merging this wouldn't conflict in the short terms unless a commit is made to fix that "Copy" button not copying the object.

This doesn't conflict with the other copy-paste options, but I still don't want to merge in something incomplete with no intention to finish it soon. I'll probably end up removing/redoing it while getting bug reports in the meantime.

@Mikk155
Mikk155 marked this pull request as draft September 5, 2026 21:26
@Mikk155

Mikk155 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Makes sense, i'm converting this to a Draft pull request for now.
If i get to complete something else i may push here and ask for review.

Mikk155 and others added 2 commits September 6, 2026 11:42
Use ImGui clipboard to copy/paste content over.

Create a utility lambda to get a StringMap with model (BSP), classname and origin purged since some codes were repeated.

Add option to use JACK/Hammer-like copy/paste

use stringstream instead of string to build the JACK string.
@Mikk155
Mikk155 marked this pull request as ready for review September 6, 2026 21:06

@wootguy wootguy left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

So I haven't used J.A.C.K. much and didn't understand how its copy-paste feature worked. It has 2 separate copy-paste methods like in bspguy. Only one of them uses the !!EPAIRS format. The other doesn't copy anything to the clipboard.

I was thinking the new setting should make bspguy use !!EPAIRS for all forms of copy-paste inside bspguy. The idea was that you could Ctrl+C an entity in bspguy and Ctrl+V it into Jack. That doesn't work because Jack limits you to using the Paste button in Object Properties. Your idea to limit this to the Copy/Paste buttons like in Jack makes sense now. No need for a new setting.

I tried it out and it's working one way. I can copy keys from bspguy into Jack. It's not working the other way around though. The Paste button in bspguy doesn't light up when I Copy from Jack.

@Mikk155

Mikk155 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor Author

It's not working the other way around though. The Paste button in bspguy doesn't light up when I Copy from Jack.

I am not entirelly sure why this happens, could probably be a bug in ImGui? it seems ImGui::GetClipboardText is empty when you copy text somewhere else outside of bspguy

@wootguy

wootguy commented Sep 13, 2026

Copy link
Copy Markdown
Owner

If that's the case then copying entity text should be broken too.

{
"targetname" "buh"
"classname" "trigger_relay"
}

Try copying this and seeing what happens in Editor::canPasteEnts when you open the Edit menu. I get the entity text and can paste the entity.

@Mikk155

Mikk155 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Sorry for the delay i've been busy lately.
If you think this has some priority you can take over the branch before i do. otherwise i'll continue with the pull request when i get some spare time.

So in short the idea would be to make use of !!EPAIRS in bspguy for all kind of copy-pasting? i can imagine a simple setup where everything selected is copied except for brush models and origin. classname would still be copied but in within BSPGuy we skip the paste of classname if you prefeer it that way, i'd personally would do it like JACK that it clean up all data on the selected entity and paste all of the copied pairs even classname.

I would still recomend to have this in the entity's copy/paste property and as additional feature the editor could copy and paste selected ents like JACK actually does. keeping all the same data of the copied entities, even origin offsets between them, how does that sounds?

@Mikk155
Mikk155 marked this pull request as draft September 17, 2026 22:23
@wootguy

wootguy commented Sep 18, 2026 •

Copy link
Copy Markdown
Owner

No problem, take your time.

So in short the idea would be to make use of !!EPAIRS in bspguy for all kind of copy-pasting?

I was originally thinking this, but it wont work as expected. You would be able to copy an entity from bspguy to Jack, but not the other way around. Jack doesn't copy anything to clipboard unless you use the special Copy button, which isn't a full copy of the entity (origin and BSP model are missing).

I would still recomend to have this in the entity's copy/paste property and as additional feature the editor could copy and paste selected ents like JACK actually does. keeping all the same data of the copied entities, even origin offsets between them, how does that sounds?

If you mean to match Jack's implementation, then that sounds good. That was the intention of these buttons but I just sort of did what I thought made sense instead of testing exactly what Jack does. It looks like classname is copied in Jack, so bspguy should be doing that too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to copy entities in J.A.C.K. format

2 participants