pin selection of closest entity in map editor
Pressing the middle mouse button toggles a pin on the "closest entity" selector. The HUD will indicate the lock by showing "pinned" instead of "closest" entity. All actions, that would otherwise affect the closest entity, will affect the pinned entity instead. Deleting the locked entity will unlock it. toggleclosestentpin Toggles the pin on the "closest ent" selector. Bound to MOUSE3 by default. DOCREF togglelockclosestent
This commit is contained in:
@@ -27,6 +27,7 @@ bind MOUSE1 attack
|
||||
bind MOUSE2 altaction
|
||||
editbind MOUSE2 [ showmenu editing ]
|
||||
bind MOUSE3 weapon
|
||||
editbind MOUSE3 toggleclosestentpin
|
||||
bind MOUSE4 key_universaldelta_plus
|
||||
bind MOUSE5 key_universaldelta_minus
|
||||
bind BACKSPACE dropflag
|
||||
|
||||
@@ -1085,6 +1085,7 @@ void resetmap(bool mrproper)
|
||||
pruneundos();
|
||||
changedents.setsize(0);
|
||||
deleted_ents.setsize(0);
|
||||
pinnedclosestent = false;
|
||||
particlereset();
|
||||
if(mrproper)
|
||||
{
|
||||
|
||||
@@ -106,7 +106,7 @@ char *editinfo()
|
||||
{
|
||||
entity &c = ents[e];
|
||||
int t = c.type < MAXENTTYPES ? c.type : 0;
|
||||
formatstring(info)("closest entity: %s (%s)", entnames[t], formatentityattributes(c, true));
|
||||
formatstring(info)("%s entity: %s (%s)", pinnedclosestent ? "\fs\f3pinned\fr" : "closest", entnames[t], formatentityattributes(c, true));
|
||||
const char *slotinfo = "unassigned slot";
|
||||
if(t == MAPMODEL)
|
||||
{
|
||||
|
||||
@@ -485,6 +485,7 @@ extern void calcmapdims();
|
||||
extern bool empty_world(int factor, bool force);
|
||||
extern void remip(const block &b, int level = 0);
|
||||
extern void remipmore(const block &b, int level = 0);
|
||||
extern bool pinnedclosestent;
|
||||
extern int closestent();
|
||||
extern void deletesoundentity(entity &e);
|
||||
extern int findtype(const char *what);
|
||||
|
||||
@@ -128,9 +128,18 @@ void closestenttype(char *what)
|
||||
COMMAND(nextclosestent, "");
|
||||
COMMAND(closestenttype, "s");
|
||||
|
||||
bool pinnedclosestent = false;
|
||||
static int pinnedent = -1;
|
||||
COMMANDF(toggleclosestentpin, "", () { pinnedclosestent = ents.inrange((pinnedent = pinnedclosestent ? -1 : closestent())); });
|
||||
|
||||
int closestent() // used for delent and edit mode ent display
|
||||
{
|
||||
if(noteditmode("closestent")) return -1;
|
||||
if(pinnedclosestent)
|
||||
{
|
||||
if(ents.inrange(pinnedent) && ents[pinnedent].type != NOTUSED) return pinnedent;
|
||||
pinnedclosestent = false; // release lock when ent is deleted
|
||||
}
|
||||
int best = -1, bcnt = 0;
|
||||
float bdist = 99999;
|
||||
loopj(3)
|
||||
|
||||
Reference in New Issue
Block a user