Changed: Improved formatting

--HG--
branch : develop
feature/pipeline-tools
kervala 8 years ago
parent 91a1f4e34b
commit 3fb4424909

@ -21,7 +21,8 @@ static WNDPROC colorSwatchOriginalWndProc;
static HIMAGELIST hButtonImages = NULL;
static void LoadImages() {
static void LoadImages()
{
if (hButtonImages) return;
HBITMAP hBitmap, hMask;
hButtonImages = ImageList_Create(15, 14, ILC_MASK, 2, 0); // 17 is kluge to center square. -SA
@ -35,7 +36,8 @@ static void LoadImages() {
ClassDesc* GetVertexPaintDesc();
class VertexPaintClassDesc:public ClassDesc {
class VertexPaintClassDesc :public ClassDesc
{
public:
int IsPublic() { return 1; }
void * Create(BOOL loading = FALSE) { return new VertexPaint(); }
@ -49,8 +51,7 @@ class VertexPaintClassDesc:public ClassDesc {
static VertexPaintClassDesc VertexPaintDesc;
ClassDesc* GetVertexPaintDesc() { return &VertexPaintDesc; }
static INT_PTR CALLBACK VertexPaintDlgProc(
HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR CALLBACK VertexPaintDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
int numPoints;
VertexPaint *mod = (VertexPaint*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
@ -82,7 +83,8 @@ static INT_PTR CALLBACK VertexPaintDlgProc(
}
}
switch (msg) {
switch (msg)
{
case WM_INITDIALOG:
LoadImages();
mod = (VertexPaint*)lParam;
@ -159,7 +161,8 @@ static INT_PTR CALLBACK VertexPaintDlgProc(
break;
case WM_COMMAND:
switch(LOWORD(wParam)) {
switch (LOWORD(wParam))
{
case IDC_PAINT:
mod->ActivatePaint(mod->iPaintButton->IsChecked());
break;
@ -206,19 +209,18 @@ static INT_PTR CALLBACK VertexPaintDlgProc(
}
// Subclass procedure
LRESULT APIENTRY colorSwatchSubclassWndProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
LRESULT APIENTRY colorSwatchSubclassWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
switch (uMsg) {
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_LBUTTONDBLCLK: {
case WM_LBUTTONDBLCLK:
{
HWND hPanel = GetParent(hwnd);
LONG_PTR mod = GetWindowLongPtr(hPanel, GWLP_USERDATA);
if (mod) {
if (mod)
{
((VertexPaint*)mod)->PaletteButton(hwnd);
}
}
@ -242,7 +244,8 @@ ICustButton* VertexPaint::iPickButton = NULL;
IColorSwatch* VertexPaint::iColor = NULL;
COLORREF VertexPaint::lastWeightColor = RGB(85, 85, 85);
COLORREF VertexPaint::lastPhaseColor = RGB(0, 0, 0);
COLORREF VertexPaint::palColors[] = {
COLORREF VertexPaint::palColors[] =
{
//RGB(32, 32, 32), RGB( 96,96,96), RGB( 160,160,160), RGB(224,224,224) };
RGB(0, 0, 0), RGB(85,85,85), RGB(170,170,170), RGB(255,255,255),
RGB(42, 42, 42), RGB(127, 127, 127), RGB(212, 212, 212) };
@ -400,13 +403,9 @@ void VertexPaint::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev )
this->ip = ip;
editMod = this;
if (!hParams) {
hParams = ip->AddRollupPage(
hInstance,
MAKEINTRESOURCE(IDD_PANEL),
VertexPaintDlgProc,
GetString(IDS_PARAMS),
(LPARAM)this);
if (!hParams)
{
hParams = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_PANEL), VertexPaintDlgProc, GetString(IDS_PARAMS), (LPARAM)this);
// Subclass the palette controls
hPaletteWnd[0] = GetDlgItem(hParams, IDC_PALETTE_1);
@ -418,7 +417,8 @@ void VertexPaint::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev )
hPaletteWnd[6] = GetDlgItem(hParams, IDC_PALETTE_7);
int i;
for (i=0; i<NUMPALETTES; i++) {
for (i = 0; i < NUMPALETTES; i++)
{
colorSwatchOriginalWndProc = (WNDPROC)SetWindowLongPtr(hPaletteWnd[i], GWLP_WNDPROC, (LONG_PTR)colorSwatchSubclassWndProc);
}
@ -457,7 +457,8 @@ void VertexPaint::EndEditParams( IObjParam *ip, ULONG flags,Animatable *next)
ModContextList list;
INodeTab nodes;
ip->GetModContexts(list, nodes);
for (int i=0; i<list.Count(); i++) {
for (int i = 0; i < list.Count(); i++)
{
VertexPaintData *vd = (VertexPaintData*)list[i]->localData;
if (vd) vd->FreeCache();
}
@ -482,9 +483,7 @@ void VertexPaint::EndEditParams( IObjParam *ip, ULONG flags,Animatable *next)
//From ReferenceMaker
RefResult VertexPaint::NotifyRefChanged(
Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message)
RefResult VertexPaint::NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate)
{
return REF_SUCCEED;
}
@ -531,8 +530,10 @@ IOResult VertexPaint::Load(ILoad *iload)
int version = 1;
Modifier::Load(iload);
while (IO_OK==(res=iload->OpenChunk())) {
switch(iload->CurChunkID()) {
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case VERSION_CHUNKID:
iload->Read(&version, sizeof(version), &nb);
break;
@ -573,7 +574,8 @@ IOResult VertexPaint::SaveLocalData(ISave *isave, LocalModData *ld)
isave->BeginChunk(COLORLIST_CHUNKID);
numColors = d->GetNumColors();
res = isave->Write(&numColors, sizeof(int), &nb);
for (int i=0; i<numColors ; i++) {
for (int i = 0; i < numColors; i++)
{
col = d->GetColorData(i);
isave->Write(&col.color, sizeof(col.color), &nb);
}
@ -582,7 +584,8 @@ IOResult VertexPaint::SaveLocalData(ISave *isave, LocalModData *ld)
return IO_OK;
}
IOResult VertexPaint::LoadLocalData(ILoad *iload, LocalModData **pld) {
IOResult VertexPaint::LoadLocalData(ILoad *iload, LocalModData **pld)
{
VertexPaintData *d = new VertexPaintData;
IOResult res;
ULONG nb;
@ -592,8 +595,10 @@ IOResult VertexPaint::LoadLocalData(ILoad *iload, LocalModData **pld) {
*pld = d;
while (IO_OK==(res=iload->OpenChunk())) {
switch(iload->CurChunkID()) {
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case VERSION_CHUNKID:
iload->Read(&version, sizeof(version), &nb);
break;
@ -601,7 +606,8 @@ IOResult VertexPaint::LoadLocalData(ILoad *iload, LocalModData **pld) {
{
iload->Read(&numColors, sizeof(int), &nb);
d->AllocColorData(numColors);
for (int i=0; i<numColors; i++) {
for (int i = 0; i < numColors; i++)
{
iload->Read(&col.color, sizeof(col.color), &nb);
d->SetColor(i, col);
}
@ -617,7 +623,8 @@ IOResult VertexPaint::LoadLocalData(ILoad *iload, LocalModData **pld) {
void VertexPaint::PaletteButton(HWND hWnd)
{
IColorSwatch* iPal = GetIColorSwatch(hWnd);
if (iPal && iColor) {
if (iPal && iColor)
{
iColor->SetColor(iPal->GetColor(), TRUE);
}
}
@ -625,7 +632,8 @@ void VertexPaint::PaletteButton(HWND hWnd)
void VertexPaint::InitPalettes()
{
IColorSwatch* c;
for (int i=0; i<NUMPALETTES; i++) {
for (int i = 0; i < NUMPALETTES; i++)
{
c = GetIColorSwatch(hPaletteWnd[i]);
c->SetColor(palColors[i]);
ReleaseIColorSwatch(c);
@ -635,7 +643,8 @@ void VertexPaint::InitPalettes()
void VertexPaint::SavePalettes()
{
IColorSwatch* c;
for (int i=0; i<NUMPALETTES; i++) {
for (int i = 0; i < NUMPALETTES; i++)
{
c = GetIColorSwatch(hPaletteWnd[i]);
palColors[i] = c->GetColor();
ReleaseIColorSwatch(c);
@ -1141,17 +1150,20 @@ LocalModData* VertexPaintData::Clone()
{
VertexPaintData* d = new VertexPaintData();
if (colordata) {
if (colordata)
{
d->colordata = new ColorData[numColors];
d->numColors = numColors;
for (int i=0; i<numColors; i++) {
for (int i = 0; i < numColors; i++)
{
d->colordata[i] = colordata[i];
}
}
if (nverts)
{
d->nverts = new NVert[numnverts];
for(int i = 0 ; i < numnverts ; i++ ) {
for (int i = 0; i < numnverts; i++)
{
d->nverts[i] = nverts[i];
}
@ -1159,7 +1171,8 @@ LocalModData* VertexPaintData::Clone()
if (nvcverts)
{
d->nvcverts = new NVert[numnvcverts];
for(int i = 0 ; i < numnvcverts ; i++ ) {
for (int i = 0; i < numnvcverts; i++)
{
d->nvcverts[i] = nvcverts[i];
}
@ -1168,7 +1181,6 @@ LocalModData* VertexPaintData::Clone()
return d;
}
void VertexPaintData::SynchVerts(Mesh &m)
{
if (mesh == NULL)

Loading…
Cancel
Save