Add key in patch painter to reset a patch mesh

--HG--
branch : develop
This commit is contained in:
kaetemi 2014-12-04 13:21:45 +01:00
parent b762356a16
commit 90f1234ed0
4 changed files with 36 additions and 2 deletions

View file

@ -176,6 +176,7 @@ LockBorders = KeyL;
ZoomIn = Key1;
ZoomOut = Key2;
GetState = Key3;
ResetPatch = KeyF10;
/***************
*This is the the light settings

View file

@ -145,7 +145,7 @@ std::vector<CZoneSymmetrisation> symVector;
// Painter modes
enum TModePaint { ModeTile, ModeColor, ModeDisplace};
enum TModeMouse { ModePaint, ModeSelect, ModePick, ModeFill, ModeGetState };
enum TModeMouse { ModePaint, ModeSelect, ModePick, ModeFill, ModeGetState, ModeResetPatch };
/*-------------------------------------------------------------------*/
@ -2585,6 +2585,13 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi
// Set mode
modeSelect=ModeGetState;
// Mode reset zone
if (AsyncListener.isKeyDown ((TKey)PainterKeys[ResetPatch]))
{
// Set mode
modeSelect=ModeResetPatch;
}
// Mode picking
if (AsyncListener.isKeyDown ((TKey)PainterKeys[Fill0]))
{
@ -2891,6 +2898,8 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi
SetCursor (bankCont->HFill);
else if (pData->pobj->TileTrick)
SetCursor (bankCont->HTrick);
else if (modeSelect==ModeResetPatch)
SetCursor (LoadCursor (NULL, IDC_NO));
else
SetCursor (LoadCursor (NULL, IDC_ARROW));
@ -3140,9 +3149,30 @@ private:
_FillTile.fillColor (mesh1, patch, _VectMesh, maxToNel (color1), (uint16)(256.f*opa1), PaintColor);
else if (nModeTexture==ModeDisplace)
// Fill this patch with the current color
// Fill this patch with the current displace
_FillTile.fillDisplace (mesh1, patch, _VectMesh, bank);
}
else if (modeSelect==ModeResetPatch)
{
int np = _VectMesh[mesh1].PMesh->numPatches;
for (int pp = 0; pp < np; ++pp)
{
// Fill default tile
_FillTile.fillTile (mesh1, pp, _VectMesh, -1, 0, 0, true, bank);
// Fill default color
_FillTile.fillColor (mesh1, pp, _VectMesh, CRGBA(255, 255, 255), 256, PaintColor);
// Backup current displace, fill default, restore
int bkdt = _Pobj->DisplaceTile;
int bkdts = _Pobj->DisplaceTileSet;
_Pobj->DisplaceTile = 0;
_Pobj->DisplaceTileSet = -1;
_FillTile.fillDisplace (mesh1, pp, _VectMesh, bank);
_Pobj->DisplaceTile = bkdt;
_Pobj->DisplaceTileSet = bkdts;
}
}
}
}
// Pick with right mouse

View file

@ -43,6 +43,7 @@ uint PainterKeys[KeyCounter]=
Key1,
Key2,
KeyI,
KeyF10,
};
// Keys
@ -77,6 +78,7 @@ const char* PainterKeysName[KeyCounter]=
"ZoomIn",
"ZoomOut",
"GetState",
"ResetPatch",
};
// Light settings

View file

@ -122,6 +122,7 @@ enum PainterKeysType
ZoomIn,
ZoomOut,
GetState,
ResetPatch,
KeyCounter
};