add new zone box visuals,
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
//bls 4
|
||||
|
||||
// This file should not exist. Fix later...
|
||||
// -------------------------------------------------------------------
|
||||
@ -61,6 +60,8 @@ function NDM_BoxSelect::onStartMode(%this, %client, %lastMode)
|
||||
//Switch away from this mode
|
||||
function NDM_BoxSelect::onChangeMode(%this, %client, %nextMode)
|
||||
{
|
||||
%client.ndBoxCleared();
|
||||
|
||||
if(%nextMode == $NDM::StackSelect)
|
||||
{
|
||||
//Clear selection
|
||||
@ -107,6 +108,8 @@ function NDM_BoxSelect::onChangeMode(%this, %client, %nextMode)
|
||||
//Kill this mode
|
||||
function NDM_BoxSelect::onKillMode(%this, %client)
|
||||
{
|
||||
%client.ndBoxCleared();
|
||||
|
||||
//Destroy selection
|
||||
if(isObject(%client.ndSelection))
|
||||
%client.ndSelection.delete();
|
||||
@ -164,6 +167,7 @@ function NDM_BoxSelect::onSelectObject(%this, %client, %obj, %pos, %normal)
|
||||
else
|
||||
{
|
||||
%client.ndSelectionBox.zoneBrick = "";
|
||||
%client.ndSelectionBox.setNormalColors();
|
||||
%box = %obj.getWorldBox();
|
||||
%p1 = getWords(%box, 0, 2);
|
||||
%p2 = getWords(%box, 3, 5);
|
||||
@ -186,6 +190,7 @@ function NDM_BoxSelect::onSelectObject(%this, %client, %obj, %pos, %normal)
|
||||
} else if (isObject(%obj.physicalZone)) {
|
||||
%box = ndGetBoxFromZone(%obj);
|
||||
%client.ndSelectionBox.zoneBrick = %obj;
|
||||
%client.ndSelectionBox.setZoneColors();
|
||||
} else {
|
||||
%box = ndGetPlateBoxFromRayCast(%pos, %normal);
|
||||
}
|
||||
@ -208,7 +213,7 @@ function ndRound(%v, %step) {
|
||||
return mFloor(%v/%step + 0.5)*%step;
|
||||
}
|
||||
|
||||
function ndCorrectBox(%box) {
|
||||
function ndSnapBoxToGrid(%box) {
|
||||
%xl = ndRound(getWord(%box, 0), 0.5);
|
||||
%yl = ndRound(getWord(%box, 1), 0.5);
|
||||
%zl = ndRound(getWord(%box, 2), 0.2);
|
||||
@ -226,19 +231,16 @@ function ndGetBoxFromRom(%b) {
|
||||
%bh = getWords(%box, 3, 5);
|
||||
%bl = vectorAdd(%bl, "0 0 " SPC (%db.brickSizeZ * 0.2));
|
||||
%bh = vectorAdd(%bh, "0 0 " SPC (%db.logicRomZ * 0.2));
|
||||
return ndCorrectBox(%bl SPC %bh);
|
||||
return ndSnapBoxToGrid(%bl SPC %bh);
|
||||
}
|
||||
|
||||
function ndGetBoxFromZone(%b) {
|
||||
%z = %b.physicalZone;
|
||||
%pos = %z.position;
|
||||
%scale = %z.getScale();
|
||||
%sx = getWord(%scale, 0);
|
||||
%sy = getWord(%scale, 1);
|
||||
%sz = getWord(%scale, 2);
|
||||
%bl = vectorAdd(%pos, 0 SPC -%sy SPC 0);
|
||||
%bh = vectorAdd(%pos, %sx SPC 0 SPC %sz);
|
||||
return ndCorrectBox(%bl SPC %bh);
|
||||
%bl = vectorAdd(%pos, 0 SPC -%getWord(%scale,1) SPC 0);
|
||||
%bh = vectorAdd(%pos, getWord(%scale,0) SPC 0 SPC getWord(%scale,2));
|
||||
return ndSnapBoxToGrid(%bl SPC %bh);
|
||||
}
|
||||
|
||||
|
||||
@ -366,12 +368,18 @@ function ndApplyZoneEvent(%brick, %p1a, %p2a, %client) {
|
||||
if(%brick.eventOutput[%i] $= "setZoneBox") {
|
||||
%brick.eventOutputParameter[%i, 1] = %p1;
|
||||
%brick.eventOutputParameter[%i, 2] = %p2;
|
||||
|
||||
// update event
|
||||
%brick.setZoneBox(%p1,%p2, %brick.eventOutputParameter[%i,3], 0);
|
||||
if(isFunction("fxDtsBrick", "triggerPropertyOnLoad"))
|
||||
%brick.triggerPropertyOnLoad();
|
||||
|
||||
// inform client
|
||||
messageClient(%client, 'MsgError', "");
|
||||
commandToClient(%client, 'centerPrint',
|
||||
"<font:Verdana:20>\c6Applied selection box to zone event \c3" @ %i
|
||||
@ "\c6 on brick, and re-created zone.", 5);
|
||||
%brick.setZoneBox(%p1, %p2,
|
||||
%brick.eventOutputParameter[%i,3], 0);
|
||||
@ "\c6 on brick,<br>\c6re-created zone, and triggered propertyOnLoad events.", 5);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user