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; ZoomIn = Key1;
ZoomOut = Key2; ZoomOut = Key2;
GetState = Key3; GetState = Key3;
ResetPatch = KeyF10;
/*************** /***************
*This is the the light settings *This is the the light settings

View file

@ -145,7 +145,7 @@ std::vector<CZoneSymmetrisation> symVector;
// Painter modes // Painter modes
enum TModePaint { ModeTile, ModeColor, ModeDisplace}; 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 // Set mode
modeSelect=ModeGetState; modeSelect=ModeGetState;
// Mode reset zone
if (AsyncListener.isKeyDown ((TKey)PainterKeys[ResetPatch]))
{
// Set mode
modeSelect=ModeResetPatch;
}
// Mode picking // Mode picking
if (AsyncListener.isKeyDown ((TKey)PainterKeys[Fill0])) if (AsyncListener.isKeyDown ((TKey)PainterKeys[Fill0]))
{ {
@ -2891,6 +2898,8 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi
SetCursor (bankCont->HFill); SetCursor (bankCont->HFill);
else if (pData->pobj->TileTrick) else if (pData->pobj->TileTrick)
SetCursor (bankCont->HTrick); SetCursor (bankCont->HTrick);
else if (modeSelect==ModeResetPatch)
SetCursor (LoadCursor (NULL, IDC_NO));
else else
SetCursor (LoadCursor (NULL, IDC_ARROW)); SetCursor (LoadCursor (NULL, IDC_ARROW));
@ -3140,9 +3149,30 @@ private:
_FillTile.fillColor (mesh1, patch, _VectMesh, maxToNel (color1), (uint16)(256.f*opa1), PaintColor); _FillTile.fillColor (mesh1, patch, _VectMesh, maxToNel (color1), (uint16)(256.f*opa1), PaintColor);
else if (nModeTexture==ModeDisplace) else if (nModeTexture==ModeDisplace)
// Fill this patch with the current color // Fill this patch with the current displace
_FillTile.fillDisplace (mesh1, patch, _VectMesh, bank); _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 // Pick with right mouse

View file

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

View file

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