mirror of
https://github.com/electronicarts/CnC_Renegade.git
synced 2025-12-16 07:31:40 -05:00
Initial commit of Command & Conquer Renegade source code.
This commit is contained in:
477
Code/Tools/max2w3d/AlphaModifier.cpp
Normal file
477
Code/Tools/max2w3d/AlphaModifier.cpp
Normal file
@@ -0,0 +1,477 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project name : Buccaneer Bay *
|
||||
* *
|
||||
* File name : AlphaModifier.cpp *
|
||||
* *
|
||||
* Programmer : Mike Lytle *
|
||||
* *
|
||||
* Start date : 11/1/1999 *
|
||||
* *
|
||||
* Last update : 11/1/1999 *
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#include "AlphaModifier.h"
|
||||
|
||||
enum Alpha_Messages
|
||||
{
|
||||
AM_NOTHING,
|
||||
AM_UPDATE_DATA,
|
||||
AM_INITIALIZE,
|
||||
AM_BOX_CHECKED,
|
||||
};
|
||||
|
||||
enum Dialog_Controls
|
||||
{
|
||||
DL_EDIT_VALUE,
|
||||
DL_FIND_CHECK_BOX,
|
||||
};
|
||||
|
||||
void AlphaModifierClass::ModifyObject(TimeValue t, ModContext &mc, ObjectState *os, INode *node)
|
||||
{
|
||||
if (!os->obj->IsSubClassOf(triObjectClassID))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get a mesh from input object
|
||||
TriObject *object = (TriObject*)os->obj;
|
||||
|
||||
Mesh *mesh = &object->mesh;
|
||||
|
||||
assert(mesh);
|
||||
|
||||
int numVert = mesh->getNumVerts();
|
||||
int i = 0;
|
||||
float *vdata = NULL;
|
||||
|
||||
// Get parameters from pblock
|
||||
float sparam = 0.0f;
|
||||
Interval valid = LocalValidity(t);
|
||||
int pass = 1;
|
||||
|
||||
pblock->GetValue(DL_EDIT_VALUE, t, sparam, valid);
|
||||
|
||||
// If needed a control could be put into the dialog box to specify which
|
||||
// pass to apply the alpha values to. At this time, it was decided to
|
||||
// not implement this because of the complexity to the artist and the
|
||||
// performance issues in game.
|
||||
//pblock->GetValue(DL_EDIT_PASS, t, pass, valid);
|
||||
|
||||
|
||||
// Start from 0.
|
||||
pass -= 1;
|
||||
assert(pass >= 0);
|
||||
|
||||
// Use a channel for each pass.
|
||||
vdata = mesh->vertexFloat(ALPHA_VERTEX_CHANNEL + pass);
|
||||
|
||||
if (!vdata)
|
||||
{
|
||||
// Turn on the channel for vertex alpha support.
|
||||
mesh->setVDataSupport(ALPHA_VERTEX_CHANNEL + pass);
|
||||
vdata = mesh->vertexFloat(ALPHA_VERTEX_CHANNEL + pass);
|
||||
|
||||
assert(vdata);
|
||||
|
||||
for (i = 0; i < numVert; i++)
|
||||
{
|
||||
if (mesh->VertSel()[i])
|
||||
{
|
||||
vdata[i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Tracks the state of the FIND check box.
|
||||
int box_checked = 0;
|
||||
|
||||
|
||||
if (Message == AM_UPDATE_DATA)
|
||||
{
|
||||
// The user has updated the dialog box, so update the data.
|
||||
assert(vdata);
|
||||
|
||||
pblock->GetValue(DL_FIND_CHECK_BOX, t, box_checked, valid);
|
||||
if (!box_checked)
|
||||
{
|
||||
for (i = 0; i < numVert; i++)
|
||||
{
|
||||
if (SelectedVertices[i])
|
||||
{
|
||||
vdata[i] = sparam;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Message == AM_BOX_CHECKED)
|
||||
{
|
||||
pblock->GetValue(DL_FIND_CHECK_BOX, t, box_checked, valid);
|
||||
}
|
||||
|
||||
|
||||
// The user is trying to find vertices with certain values.
|
||||
if (box_checked)
|
||||
{
|
||||
assert(vdata);
|
||||
// Find the vertices that have the user entered value.
|
||||
for (i = 0; i < numVert; i++)
|
||||
{
|
||||
if (vdata[i] == sparam)
|
||||
{
|
||||
mesh->VertSel().Set(i);
|
||||
SelectedVertices.Set(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
mesh->VertSel().Clear(i);
|
||||
SelectedVertices.Clear(i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Message == AM_INITIALIZE)
|
||||
{
|
||||
assert(vdata);
|
||||
|
||||
SelectedVertices = mesh->VertSel();
|
||||
|
||||
for (i = 0; i < numVert; i++)
|
||||
{
|
||||
if (SelectedVertices[i])
|
||||
{
|
||||
// Set the value in the dialog box to the value of the
|
||||
// first selected vertex.
|
||||
pblock->SetValue(DL_EDIT_VALUE, t, vdata[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Always select the vertices that have been saved by the modifier.
|
||||
// This must be done because the mesh changes each time ModfiyObject is called.
|
||||
for (i = 0; i < numVert; i++)
|
||||
{
|
||||
if (SelectedVertices[i])
|
||||
{
|
||||
mesh->VertSel().Set(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
mesh->VertSel().Clear(i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Display the vertices.
|
||||
mesh->SetDispFlag(DISP_SELVERTS | DISP_VERTTICKS);
|
||||
mesh->selLevel = MESH_VERTEX;
|
||||
object->UpdateValidity(SELECT_CHAN_NUM, object->ChannelValidity (t, SELECT_CHAN_NUM));
|
||||
|
||||
// Clear messages.
|
||||
Message = AM_NOTHING;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*===========================================================================*\
|
||||
| NotifyInputChanged is called each time the input object is changed in some way
|
||||
| We can find out how it was changed by checking partID and message
|
||||
\*===========================================================================*/
|
||||
|
||||
void AlphaModifierClass::NotifyInputChanged(Interval changeInt, PartID partID, RefMessage message, ModContext *mc)
|
||||
{
|
||||
if( (partID&PART_TOPO) || (partID&PART_GEOM) || (partID&PART_SELECT) )
|
||||
{
|
||||
NotifyDependents(FOREVER, PART_OBJ, REFMSG_CHANGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*===========================================================================*\
|
||||
| Class Descriptor OSM
|
||||
\*===========================================================================*/
|
||||
|
||||
class AlphaClassDesc : public ClassDesc2 {
|
||||
public:
|
||||
int IsPublic() { return TRUE; }
|
||||
void * Create( BOOL loading ) { return new AlphaModifierClass; }
|
||||
const TCHAR * ClassName() { return Get_String(IDS_ALPHA_MODIFIER_CLASS); }
|
||||
SClass_ID SuperClassID() { return OSM_CLASS_ID; }
|
||||
Class_ID ClassID() { return ALPHA_MODIFIER_CLASSID; }
|
||||
const TCHAR* Category() { return _T(""); }
|
||||
|
||||
HINSTANCE HInstance() { return AppInstance; }
|
||||
|
||||
// Hardwired name, used by MAX Script as unique identifier
|
||||
const TCHAR* InternalName() { return _T("AlphaMod"); }
|
||||
};
|
||||
|
||||
static AlphaClassDesc AlphaCD;
|
||||
ClassDesc* Get_Alpha_Desc() {return &AlphaCD;}
|
||||
|
||||
/*===========================================================================*\
|
||||
| Paramblock2 Descriptor
|
||||
\*===========================================================================*/
|
||||
static ParamBlockDesc2 alpha_param_blk
|
||||
(
|
||||
//rollout
|
||||
0, _T("AlphaModifierParams"), 0, &AlphaCD, P_AUTO_CONSTRUCT + P_AUTO_UI, 0,
|
||||
IDD_ALPHA_MODIFIER, IDS_PARAMETERS, 0, 0, NULL,
|
||||
|
||||
// params
|
||||
|
||||
DL_EDIT_VALUE, _T("Custom Data Value"), TYPE_FLOAT, P_ANIMATABLE, IDS_ALPHA_MODIFIER_CLASS,
|
||||
p_default, 0.0f,
|
||||
p_range, 0.0f, 100.0f,
|
||||
p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_ALPHA_EDIT, IDC_ALPHA_SPIN, 1.0f,
|
||||
end,
|
||||
|
||||
DL_FIND_CHECK_BOX, _T("1 Custom Data Value"), TYPE_BOOL, 0, IDS_ALPHA_MODIFIER_CLASS,
|
||||
p_default, FALSE,
|
||||
p_ui, TYPE_SINGLECHEKBOX, IDC_ALPHA_CHECKBOX,
|
||||
p_enabled, TRUE,
|
||||
end,
|
||||
|
||||
/*
|
||||
DL_EDIT_PASS, _T("2 Custom Data Value"), TYPE_INT, P_ANIMATABLE, IDS_ALPHA_MODIFIER_CLASS,
|
||||
p_default, 1,
|
||||
p_range, 1, 4,
|
||||
p_ui, TYPE_SPINNER, EDITTYPE_INT, IDC_ALPHA_EDIT2, IDC_ALPHA_SPIN2, 1.0,
|
||||
end,
|
||||
*/
|
||||
|
||||
end
|
||||
);
|
||||
|
||||
|
||||
/*===========================================================================*\
|
||||
| Basic implementation of a dialog handler
|
||||
\*===========================================================================*/
|
||||
|
||||
BOOL AlphaModDlgProc::DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
int id = LOWORD(wParam);
|
||||
int code = HIWORD(wParam);
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
AlphaModifier->Message = AM_INITIALIZE;
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
switch (code)
|
||||
{
|
||||
case EN_UPDATE:
|
||||
break;
|
||||
case EN_SETFOCUS:
|
||||
break;
|
||||
case EN_KILLFOCUS:
|
||||
break;
|
||||
case EN_CHANGE:
|
||||
break;
|
||||
}
|
||||
if (id == IDC_ALPHA_EDIT)
|
||||
{
|
||||
AlphaModifier->Message = AM_UPDATE_DATA;
|
||||
}
|
||||
if (id == IDC_ALPHA_CHECKBOX)
|
||||
{
|
||||
AlphaModifier->Message = AM_BOX_CHECKED;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
if (id == IDC_ALPHA_EDIT)
|
||||
{
|
||||
AlphaModifier->Message = AM_UPDATE_DATA;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*===========================================================================*\
|
||||
| Constructor
|
||||
| Ask the ClassDesc2 to make the AUTO_CONSTRUCT paramblocks and wire them in
|
||||
\*===========================================================================*/
|
||||
|
||||
AlphaModifierClass::AlphaModifierClass()
|
||||
{
|
||||
AlphaCD.MakeAutoParamBlocks(this);
|
||||
assert(pblock);
|
||||
Message = 0;
|
||||
}
|
||||
|
||||
|
||||
/*===========================================================================*\
|
||||
| Invalidate our UI (or the recently changed parameter)
|
||||
\*===========================================================================*/
|
||||
|
||||
void AlphaModifierClass::InvalidateUI()
|
||||
{
|
||||
alpha_param_blk.InvalidateUI(pblock->LastNotifyParamID());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*===========================================================================*\
|
||||
| Open and Close dialog UIs
|
||||
| We ask the ClassDesc2 to handle Beginning and Ending EditParams for us
|
||||
\*===========================================================================*/
|
||||
|
||||
void AlphaModifierClass::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev )
|
||||
{
|
||||
|
||||
AlphaCD.BeginEditParams(ip, this, flags, prev);
|
||||
|
||||
alpha_param_blk.SetUserDlgProc(new AlphaModDlgProc(this));
|
||||
}
|
||||
|
||||
void AlphaModifierClass::EndEditParams( IObjParam *ip, ULONG flags,Animatable *next )
|
||||
{
|
||||
AlphaCD.EndEditParams(ip, this, flags, next);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*===========================================================================*\
|
||||
| Standard clone
|
||||
\*===========================================================================*/
|
||||
|
||||
|
||||
RefTargetHandle AlphaModifierClass::Clone(RemapDir& remap)
|
||||
{
|
||||
AlphaModifierClass* newmod = new AlphaModifierClass();
|
||||
newmod->ReplaceReference(0,pblock->Clone(remap));
|
||||
return(newmod);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*===========================================================================*\
|
||||
| Subanim & References support
|
||||
\*===========================================================================*/
|
||||
|
||||
Animatable* AlphaModifierClass::SubAnim(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return pblock;
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
TSTR AlphaModifierClass::SubAnimName(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return Get_String(IDS_PARAMETERS);
|
||||
default: return _T("");
|
||||
}
|
||||
}
|
||||
|
||||
RefTargetHandle AlphaModifierClass::GetReference(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return pblock;
|
||||
default:
|
||||
assert(TRUE);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void AlphaModifierClass::SetReference(int i, RefTargetHandle rtarg)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: pblock = (IParamBlock2*)rtarg; break;
|
||||
default:
|
||||
assert(TRUE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
RefResult AlphaModifierClass::NotifyRefChanged
|
||||
(
|
||||
Interval changeInt,
|
||||
RefTargetHandle hTarget,
|
||||
PartID& partID,
|
||||
RefMessage message
|
||||
)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case REFMSG_CHANGE:
|
||||
{
|
||||
alpha_param_blk.InvalidateUI();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return REF_SUCCEED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*===========================================================================*\
|
||||
| The validity of our parameters
|
||||
| Start at FOREVER, and intersect with the validity of each item
|
||||
\*===========================================================================*/
|
||||
|
||||
Interval AlphaModifierClass::GetValidity(TimeValue t)
|
||||
{
|
||||
float f;
|
||||
Interval valid = FOREVER;
|
||||
pblock->GetValue(DL_EDIT_VALUE, t, f, valid);
|
||||
return valid;
|
||||
}
|
||||
|
||||
Interval AlphaModifierClass::LocalValidity(TimeValue t)
|
||||
{
|
||||
return GetValidity(t);
|
||||
}
|
||||
|
||||
|
||||
|
||||
154
Code/Tools/max2w3d/AlphaModifier.h
Normal file
154
Code/Tools/max2w3d/AlphaModifier.h
Normal file
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project name : Buccaneer Bay *
|
||||
* *
|
||||
* File name : AlphaModifier.h *
|
||||
* *
|
||||
* Programmer : Mike Lytle *
|
||||
* *
|
||||
* Start date : 11/1/1999 *
|
||||
* *
|
||||
* Last update : 11/1/1999 *
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
#ifndef ALPHA_MODIFIER_H
|
||||
#define ALPHA_MODIFIER_H
|
||||
|
||||
|
||||
#include <max.h>
|
||||
#include "iparamm2.h"
|
||||
#include "istdplug.h"
|
||||
#include "meshadj.h"
|
||||
#include "modstack.h"
|
||||
#include "macrorec.h"
|
||||
#include "resource.h"
|
||||
#include "dllmain.h"
|
||||
|
||||
|
||||
#define ALPHA_MODIFIER_CLASSID Class_ID(0x518970b3, 0x37d73373)
|
||||
|
||||
|
||||
extern ClassDesc* Get_Alpha_Desc();
|
||||
|
||||
#define ALPHA_VERTEX_CHANNEL 10
|
||||
|
||||
class AlphaModifierClass : public Modifier
|
||||
{
|
||||
public:
|
||||
|
||||
// Global parameter block
|
||||
IParamBlock2 *pblock;
|
||||
|
||||
|
||||
//Constructor/Destructor
|
||||
AlphaModifierClass();
|
||||
~AlphaModifierClass() {}
|
||||
void DeleteThis() { delete this;}
|
||||
|
||||
|
||||
// Plugin identification
|
||||
void GetClassName(TSTR& s) { s= TSTR(Get_String(IDS_ALPHA_MODIFIER_CLASS));}
|
||||
virtual Class_ID ClassID() { return ALPHA_MODIFIER_CLASSID;}
|
||||
TCHAR *GetObjectName() { return Get_String(IDS_ALPHA_MODIFIER_CLASS);}
|
||||
|
||||
|
||||
// Defines the behavior for this modifier
|
||||
// This is currently setup to be basic geometry
|
||||
// modification of deformable objects
|
||||
ChannelMask ChannelsUsed() {return PART_GEOM|PART_TOPO|PART_SELECT|PART_SUBSEL_TYPE;}
|
||||
ChannelMask ChannelsChanged() {return PART_GEOM|PART_TOPO|PART_SELECT|PART_SUBSEL_TYPE;}
|
||||
Class_ID InputType() { return triObjectClassID;}
|
||||
BOOL ChangeTopology() {return FALSE;}
|
||||
|
||||
|
||||
// Calculate the local validity from the parameters
|
||||
Interval LocalValidity(TimeValue t);
|
||||
Interval GetValidity(TimeValue t);
|
||||
|
||||
|
||||
// Object modification and notification of change
|
||||
void ModifyObject(TimeValue t, ModContext &mc, ObjectState *os, INode *node);
|
||||
void NotifyInputChanged(Interval changeInt, PartID partID, RefMessage message, ModContext *mc);
|
||||
|
||||
|
||||
// Reference support
|
||||
int NumRefs() { return 1;}
|
||||
RefTargetHandle GetReference(int i);
|
||||
void SetReference(int i, RefTargetHandle rtarg);
|
||||
RefTargetHandle Clone(RemapDir& remap = NoRemap());
|
||||
RefResult NotifyRefChanged( Interval changeInt,RefTargetHandle hTarget, PartID& partID, RefMessage message);
|
||||
|
||||
// SubAnim support
|
||||
int NumSubs() { return 0;}
|
||||
Animatable* SubAnim(int i);
|
||||
TSTR SubAnimName(int i);
|
||||
|
||||
// Direct paramblock access
|
||||
int NumParamBlocks() {return 1;}
|
||||
IParamBlock2* GetParamBlock(int i) { return pblock;}
|
||||
IParamBlock2* GetParamBlockByID(BlockID id) {return (pblock->ID() == id) ? pblock : NULL;}
|
||||
int GetParamBlockIndex(int id) {return id;}
|
||||
|
||||
// Does not use createmouse callbacks
|
||||
CreateMouseCallBack* GetCreateMouseCallBack() {return NULL;}
|
||||
|
||||
// Load and unload our UI
|
||||
void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev);
|
||||
void EndEditParams(IObjParam *ip, ULONG flags,Animatable *next);
|
||||
void InvalidateUI();
|
||||
|
||||
// Message saved from window messages.
|
||||
int Message;
|
||||
|
||||
// Selected vertices.
|
||||
BitArray SelectedVertices;
|
||||
};
|
||||
|
||||
|
||||
/*===========================================================================*\
|
||||
| Dialog Processor
|
||||
\*===========================================================================*/
|
||||
|
||||
class AlphaModDlgProc : public ParamMap2UserDlgProc
|
||||
{
|
||||
public:
|
||||
AlphaModifierClass *AlphaModifier;
|
||||
|
||||
AlphaModDlgProc() {}
|
||||
AlphaModDlgProc(AlphaModifierClass *alpha_m) {AlphaModifier = alpha_m;}
|
||||
|
||||
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
void DeleteThis() {}
|
||||
|
||||
void SetThing(ReferenceTarget *m) {AlphaModifier = (AlphaModifierClass*)m;}
|
||||
};
|
||||
|
||||
|
||||
#endif //ALPHA_MODIFIER_H
|
||||
|
||||
|
||||
|
||||
226
Code/Tools/max2w3d/AppData.cpp
Normal file
226
Code/Tools/max2w3d/AppData.cpp
Normal file
@@ -0,0 +1,226 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : G *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tools/max2w3d/AppData.cpp $*
|
||||
* *
|
||||
* $Author:: Greg_h $*
|
||||
* *
|
||||
* $Modtime:: 9/26/00 4:24p $*
|
||||
* *
|
||||
* $Revision:: 4 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
/*
|
||||
** AppData.cpp - Implementation of some Westwood
|
||||
** extensions to the MAXScript language.
|
||||
*/
|
||||
|
||||
#include <MaxScrpt.h> // Main MAXScript header
|
||||
#include <MaxObj.h> // MAX* Wrapper objects
|
||||
#include <Strings.h> // MAX String class
|
||||
#include <definsfn.h> // def_* functions to create static function headers
|
||||
|
||||
#include "w3dutil.h" // W3DAppData*Struct accessor functions!
|
||||
#include "w3ddesc.h"
|
||||
|
||||
|
||||
/*
|
||||
** Let MAXScript know we're implementing new built-in functions.
|
||||
*/
|
||||
def_visible_primitive(copy_app_data, "wwCopyAppData");
|
||||
def_visible_primitive(set_origin_app_data, "wwSetOriginAppData");
|
||||
def_visible_primitive(get_hierarchy_file, "wwGetHierarchyFile");
|
||||
|
||||
|
||||
/*
|
||||
**
|
||||
** MAXScript Function:
|
||||
** wwCopyAppData - Usage: wwCopyAppData to_node from_node
|
||||
**
|
||||
** Copies all AppData associated with from_node to to_node.
|
||||
** This is needed for W3D flags such as Export Geometry
|
||||
** and Export Transform to get passed on to their
|
||||
** instances/copies/references.
|
||||
*/
|
||||
Value * copy_app_data_cf (Value **arg_list, int count)
|
||||
{
|
||||
// Verify the number and type of the arguments.
|
||||
check_arg_count("wwCopyAppData", 2, count);
|
||||
type_check(arg_list[0], MAXNode, "Target INode");
|
||||
type_check(arg_list[1], MAXNode, "Source INode");
|
||||
|
||||
// Get the INode pointers that were passed in.
|
||||
INode *dest_node = arg_list[0]->to_node();
|
||||
INode *src_node = arg_list[1]->to_node();
|
||||
|
||||
/*
|
||||
** Copy W3DAppData0Struct
|
||||
*/
|
||||
W3DAppData0Struct *app_data_0 = GetW3DAppData0(src_node);
|
||||
if (app_data_0 != NULL) {
|
||||
|
||||
// App Data 0 is now obsolete, not fatal if we don't find one
|
||||
W3DAppData0Struct *copy_data_0 = new W3DAppData0Struct;
|
||||
if (copy_data_0 == NULL)
|
||||
throw RuntimeError("Out of memory.");
|
||||
|
||||
// Copy the app data and give it to the target node.
|
||||
*copy_data_0 = *app_data_0;
|
||||
dest_node->AddAppDataChunk(W3DUtilityClassID, UTILITY_CLASS_ID, W3D_APPDATA_0,
|
||||
sizeof(W3DAppData0Struct), copy_data_0);
|
||||
}
|
||||
|
||||
/*
|
||||
** Copy W3DAppData1Struct
|
||||
*/
|
||||
W3DAppData1Struct *app_data_1 = GetW3DAppData1(src_node);
|
||||
if (app_data_1 == NULL)
|
||||
throw RuntimeError("Unable to retrieve W3DAppData1Struct from object: ", arg_list[1]);
|
||||
|
||||
W3DAppData1Struct *copy_data_1 = new W3DAppData1Struct;
|
||||
if (copy_data_1 == NULL)
|
||||
throw RuntimeError("Out of memory.");
|
||||
|
||||
// Copy the app data and give it to the target node.
|
||||
*copy_data_1 = *app_data_1;
|
||||
dest_node->AddAppDataChunk(W3DUtilityClassID, UTILITY_CLASS_ID, W3D_APPDATA_1,
|
||||
sizeof(W3DAppData1Struct), copy_data_1);
|
||||
|
||||
|
||||
/*
|
||||
** Copy W3DAppData2Struct
|
||||
*/
|
||||
W3DAppData2Struct *app_data_2 = GetW3DAppData2(src_node);
|
||||
if (app_data_2 == NULL)
|
||||
throw RuntimeError("Unable to retrieve W3DAppData1Struct from object: ", arg_list[1]);
|
||||
|
||||
W3DAppData2Struct *copy_data_2 = new W3DAppData2Struct;
|
||||
if (copy_data_2 == NULL)
|
||||
throw RuntimeError("Out of memory.");
|
||||
|
||||
// Copy the app data and give it to the target node.
|
||||
*copy_data_2 = *app_data_2;
|
||||
dest_node->AddAppDataChunk(W3DUtilityClassID, UTILITY_CLASS_ID, W3D_APPDATA_2,
|
||||
sizeof(W3DAppData2Struct), copy_data_2);
|
||||
|
||||
/*
|
||||
** Copy W3DDazzleAppDataStruct if one is present.
|
||||
*/
|
||||
W3DDazzleAppDataStruct *dazzle_app_data = GetW3DDazzleAppData(src_node);
|
||||
if (dazzle_app_data != NULL) {
|
||||
|
||||
W3DDazzleAppDataStruct *copy_dazzle_data = new W3DDazzleAppDataStruct;
|
||||
if (copy_dazzle_data == NULL)
|
||||
throw RuntimeError("Out of memory.");
|
||||
|
||||
|
||||
// Copy the app data and give it to the target node.
|
||||
*copy_dazzle_data = *dazzle_app_data;
|
||||
dest_node->AddAppDataChunk(W3DUtilityClassID, UTILITY_CLASS_ID, W3D_DAZZLE_APPDATA,
|
||||
sizeof(W3DDazzleAppDataStruct), copy_dazzle_data);
|
||||
}
|
||||
|
||||
return &ok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
**
|
||||
** MAXScript Function:
|
||||
** wwSetOriginAppData - Usage: wwSetOriginAppData origin_node
|
||||
**
|
||||
** Sets the AppData associated with the given node to values
|
||||
** appropriate to an origin. (ie. turn off Export Geometry and
|
||||
** Export Transform)
|
||||
*/
|
||||
Value * set_origin_app_data_cf (Value **arg_list, int count)
|
||||
{
|
||||
// Check the arguments that were passed to this function.
|
||||
check_arg_count("wwSetOriginAppData", 1, count);
|
||||
type_check(arg_list[0], MAXNode, "Origin INode");
|
||||
|
||||
// Get the INode that we were given.
|
||||
INode *origin = arg_list[0]->to_node();
|
||||
|
||||
// Get the node's W3DAppData2Struct, and modify it accordingly.
|
||||
W3DAppData2Struct *data = GetW3DAppData2(origin);
|
||||
if (data == NULL)
|
||||
throw RuntimeError("Unable to retrieve W3DAppData0Struct from object: ", arg_list[0]);
|
||||
|
||||
// Turn off Export Geometry and Export Hierarchy.
|
||||
data->Enable_Export_Geometry(false);
|
||||
data->Enable_Export_Transform(false);
|
||||
|
||||
return &ok;
|
||||
}
|
||||
|
||||
/*
|
||||
**
|
||||
** MAXScript Function:
|
||||
** wwGetHierarchyFile - Usage: wwGetHierarchyFile()
|
||||
**
|
||||
** Returns the relative pathname of the file that will be loaded
|
||||
** during W3D export to get the hierarchy tree. If no such file
|
||||
** will be loaded, the return value is the MAXScript undefined.
|
||||
**
|
||||
*/
|
||||
Value * get_hierarchy_file_cf (Value **arg_list, int count)
|
||||
{
|
||||
// Check that we weren't passed any arguments.
|
||||
check_arg_count("wwGetHierarchyFile", 0, count);
|
||||
|
||||
// Retrieve the export options from the scene.
|
||||
W3dExportOptionsStruct *options = NULL;
|
||||
AppDataChunk * appdata = MAXScript_interface->GetScenePointer()->GetAppDataChunk(W3D_EXPORTER_CLASS_ID,SCENE_EXPORT_CLASS_ID,0);
|
||||
if (appdata)
|
||||
options = (W3dExportOptionsStruct*)(appdata->data);
|
||||
|
||||
// If we didn't get any options, return undefined.
|
||||
if (!options)
|
||||
return &undefined;
|
||||
|
||||
// Return the relative path to the htree file if it's available.
|
||||
// Otherwise, return the absolute path.
|
||||
one_typed_value_local(String* htree_file);
|
||||
if (options->RelativeHierarchyFilename[0] != 0)
|
||||
vl.htree_file = new String(options->RelativeHierarchyFilename);
|
||||
else if (options->HierarchyFilename[0] != 0)
|
||||
vl.htree_file = new String(options->HierarchyFilename);
|
||||
else
|
||||
{
|
||||
// Neither filename is available, return undefined.
|
||||
pop_value_locals();
|
||||
return &undefined;
|
||||
}
|
||||
return_value(vl.htree_file);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
Code/Tools/max2w3d/Debug/AlphaModifier.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/AlphaModifier.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/AppData.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/AppData.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/ExportAll.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/ExportAll.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/ExportAllDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/ExportAllDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/FPMatNav.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/FPMatNav.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/FormClass.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/FormClass.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/GMaxMtlDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/GMaxMtlDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/GameMtl.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/GameMtl.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/GameMtlDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/GameMtlDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/GameMtlForm.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/GameMtlForm.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/GameMtlPassDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/GameMtlPassDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/GameMtlShaderDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/GameMtlShaderDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/GameMtlTextureDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/GameMtlTextureDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/GameMtlVertexMaterialDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/GameMtlVertexMaterialDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/InputDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/InputDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/PCToPS2Material.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/PCToPS2Material.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/PS2GameMtl.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/PS2GameMtl.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/PS2GameMtlShaderDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/PS2GameMtlShaderDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/SceneSetup.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/SceneSetup.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/SceneSetupDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/SceneSetupDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/SkinCopy.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/SkinCopy.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/SnapPoints.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/SnapPoints.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/Utility.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/Utility.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/aabtreebuilder.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/aabtreebuilder.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/animationcompressionsettings.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/animationcompressionsettings.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/bchannel.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/bchannel.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/boneicon.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/boneicon.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/bpick.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/bpick.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/colboxsave.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/colboxsave.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/dazzlesave.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/dazzlesave.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/dllmain.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/dllmain.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/exportlog.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/exportlog.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/floaterdialog.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/floaterdialog.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/gamemaps.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/gamemaps.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/genlodextensiondialog.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/genlodextensiondialog.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/genmtlnamesdialog.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/genmtlnamesdialog.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/gennamesdialog.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/gennamesdialog.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/geometryexporttask.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/geometryexporttask.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/gridsnapmodifier.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/gridsnapmodifier.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/hiersave.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/hiersave.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/hlodsave.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/hlodsave.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/logdlg.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/logdlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/max2w3d.pch
Normal file
BIN
Code/Tools/max2w3d/Debug/max2w3d.pch
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/max2w3d.res
Normal file
BIN
Code/Tools/max2w3d/Debug/max2w3d.res
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/maxworldinfo.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/maxworldinfo.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/meshbuild.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/meshbuild.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/meshcon.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/meshcon.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/meshsave.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/meshsave.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/motion.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/motion.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/namedsel.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/namedsel.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/nullsave.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/nullsave.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/presetexportoptionsdialog.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/presetexportoptionsdialog.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/rcmenu.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/rcmenu.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/realcrc.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/realcrc.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/simpdib.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/simpdib.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/skin.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/skin.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/skindata.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/skindata.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/util.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/util.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/vchannel.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/vchannel.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/vxl.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/vxl.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/vxldbg.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/vxldbg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/vxllayer.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/vxllayer.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/w3dappdata.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/w3dappdata.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/w3ddesc.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/w3ddesc.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/w3ddlg.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/w3ddlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/w3dexp.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/w3dexp.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/w3dmtl.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/w3dmtl.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/Debug/w3dutil.sbr
Normal file
BIN
Code/Tools/max2w3d/Debug/w3dutil.sbr
Normal file
Binary file not shown.
343
Code/Tools/max2w3d/Export.ms
Normal file
343
Code/Tools/max2w3d/Export.ms
Normal file
@@ -0,0 +1,343 @@
|
||||
--
|
||||
-- Command & Conquer Renegade(tm)
|
||||
-- Copyright 2025 Electronic Arts Inc.
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
|
||||
------------------------------------------------------------------------
|
||||
--
|
||||
-- Export.ms - This file contains two batch exporting scripts. The first
|
||||
-- "exportDependants" will export the current scene, and any others in
|
||||
-- the current directory that depend on it for their skeletons. The
|
||||
-- second, "exportDirectoryTree" will export and and all Max files in
|
||||
-- a given directory tree. Both of these scripts have equivalent macro
|
||||
-- definitions, making it simple to add them as buttons to a toolbar.
|
||||
--
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
-- EXP_replace_extension is a utility function used by the scripts in this
|
||||
-- file to replace the ".max" or ".w3d" of the given filename with a given
|
||||
-- extension (including the dot, ie. ".w3d")
|
||||
function EXP_replace_extension
|
||||
max_filename -- x:\abc\blah.max or blah.max
|
||||
extension -- .w3d
|
||||
= (
|
||||
-- Find the ".max" extension in the filename.
|
||||
local dot_index = findString max_filename ".MAX"
|
||||
if dot_index == undefined then
|
||||
(
|
||||
dot_index = findString max_filename ".W3D"
|
||||
if dot_index == undefined then
|
||||
return max_filename
|
||||
)
|
||||
|
||||
return (replace max_filename dot_index 4 extension)
|
||||
)
|
||||
|
||||
|
||||
-- USER-CALLABLE: exportW3D exports the current scene as a W3D file.
|
||||
-- It takes a flag to determine whether it should display any dialogs
|
||||
-- during the export. This makes the function suitable for batch exports.
|
||||
function exportW3D
|
||||
show_dialogs:true
|
||||
w3d_name:undefined
|
||||
= (
|
||||
if w3d_name == undefined then
|
||||
(
|
||||
-- Get the name of the current scene as a W3D file.
|
||||
w3d_name = EXP_replace_extension (maxFilePath + maxFileName) ".w3d"
|
||||
if show_dialogs == true then
|
||||
(
|
||||
-- Allow the user to possibly choose a different name.
|
||||
w3d_name = getSaveFileName caption:"Select File to Export" \
|
||||
filename:w3d_name types:"w3d (*.W3D)|*.w3d|"
|
||||
|
||||
-- The dialog above will prompt the user to overwrite an
|
||||
-- existing file. If the user chooses yes, the exportFile
|
||||
-- call below will prompt him once again to overwrite the
|
||||
-- file. The solution to this is to delete the w3d file.
|
||||
if w3d_name != undefined then
|
||||
deleteFile w3d_name
|
||||
)
|
||||
-- If the user canceled the name selection, or there was some
|
||||
-- sort of error, return false.
|
||||
if w3d_name == undefined then
|
||||
return false
|
||||
)
|
||||
|
||||
-- Print an exporting message.
|
||||
local short_name = filenameFromPath w3d_name
|
||||
print("Exporting " + short_name + "...")
|
||||
|
||||
-- Export the scene, showing the export options if appropriate.
|
||||
if show_dialogs == true then
|
||||
exportFile w3d_name
|
||||
else
|
||||
exportFile w3d_name #noPrompt
|
||||
|
||||
return true
|
||||
)
|
||||
|
||||
-- The macro script definition for the "Export as W3D" toolbar button.
|
||||
macroScript Export_As_W3D
|
||||
category:"Westwood Scripts"
|
||||
buttonText:"OLD - Export as W3D - OLD"
|
||||
toolTip:"This button should not be used anymore"
|
||||
icon:#("SchematicView", 1)
|
||||
(
|
||||
messageBox "This button is being phased out. Please use Export_As instead."
|
||||
)
|
||||
|
||||
-- The macro script definition for the "Export" toolbar button.
|
||||
macroScript Export
|
||||
category:"Westwood Scripts"
|
||||
buttonText:"Export"
|
||||
toolTip:"Export the current scene as a W3D file without prompting"
|
||||
icon:#("GameTools", 2)
|
||||
(
|
||||
exportW3D show_dialogs:false
|
||||
)
|
||||
|
||||
-- The macro script definition for the "Export As..." toolbar button
|
||||
macroScript Export_As
|
||||
category:"Westwood Scripts"
|
||||
buttonText:"Export As..."
|
||||
toolTip:"Export the current scene as a W3D file"
|
||||
icon:#("GameTools", 3)
|
||||
(
|
||||
exportW3D()
|
||||
)
|
||||
|
||||
|
||||
-- USER-CALLABLE: exportDependants will export the current scene, and
|
||||
-- and other scenes in the same directory that depend on the current
|
||||
-- one for their hierarchy.
|
||||
function exportDependants
|
||||
= (
|
||||
local current_scene = undefined
|
||||
|
||||
-- Export the current scene.
|
||||
if checkForSave() == false then
|
||||
(
|
||||
-- User aborted the save.
|
||||
return ok
|
||||
)
|
||||
else
|
||||
(
|
||||
-- The user saved changes (or the scene was unchanged).
|
||||
-- Grab the name of the scene file.
|
||||
current_scene = maxFilePath + maxFileName
|
||||
)
|
||||
if current_scene == "" then
|
||||
(
|
||||
-- This is an empty scene, don't export.
|
||||
return ok
|
||||
)
|
||||
|
||||
-- Export the current scene as a W3D file.
|
||||
local export_file = EXP_replace_extension current_scene ".w3d"
|
||||
local short_name = filenameFromPath export_file
|
||||
exportW3D w3d_name:export_file
|
||||
|
||||
-- Get (and sort) the list of all other MAX files
|
||||
-- in the same directory as the current scene.
|
||||
local pattern = maxFilePath
|
||||
pattern = pattern + "*.max"
|
||||
local files = getFiles pattern
|
||||
sort files
|
||||
|
||||
-- Open and export each file in turn.
|
||||
local exported_count = 1
|
||||
for f in files do
|
||||
(
|
||||
-- Don't export the original scene again.
|
||||
if f != current_scene then
|
||||
(
|
||||
-- Load the Max scene.
|
||||
if (loadMaxFile f) != true then
|
||||
(
|
||||
print("Unable to load " + f)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Get the name of the hierarchy the scene depends on.
|
||||
-- wwGetHierarchyFile returns a relative pathname if it
|
||||
-- is available, otherwise it returns an absolute path.
|
||||
local htree_file = wwGetHierarchyFile()
|
||||
if (htree_file == undefined) or
|
||||
((htree_file as name != short_name as name) and
|
||||
(htree_file as name != current_scene as name)) then
|
||||
(
|
||||
-- The filenames don't match, or the scene doesn't
|
||||
-- depend on a hierarchy at all.
|
||||
local filename = filenameFromPath f
|
||||
print (filename + " does not depend on " + short_name)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- This scene gets its hierarchy from the original.
|
||||
-- Re-export it (last export settings automatically used).
|
||||
local w3d_file = EXP_replace_extension f ".w3d"
|
||||
if (exportW3D w3d_name:w3d_file show_dialogs:false) then
|
||||
exported_count += 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Load up the original scene again and show how many files were re-exported.
|
||||
loadMaxFile current_scene
|
||||
print ("Export process finished! " + exported_count as string + " files exported.")
|
||||
return ok
|
||||
)
|
||||
|
||||
|
||||
-- The macro script definition for the "Export Dependants" toolbar button.
|
||||
macroScript Export_Dependants
|
||||
category:"Westwood Scripts"
|
||||
buttonText:"Export Dependants"
|
||||
toolTip:"Export all dependant scenes"
|
||||
icon:#("Maxscript", 3)
|
||||
(
|
||||
exportDependants()
|
||||
)
|
||||
|
||||
|
||||
-- USER-CALLABLE: exportDirectoryTree exports all MAX scenes in a directory
|
||||
-- and all it's subdirectories. All scenes are exported with their last
|
||||
-- export settings. Scenes that have never been exported are done so with
|
||||
-- default settings as defined in max2w3d (currently exports: hierarchy,
|
||||
-- animation, geometry).
|
||||
global EXP_exported = #() -- array of exported scenes
|
||||
function exportDirectoryTree
|
||||
dir:undefined
|
||||
= (
|
||||
-- If no directory was given, get it from the user using a directory
|
||||
-- selection dialog.
|
||||
local recursive = true
|
||||
if dir == undefined then
|
||||
(
|
||||
local ar = #(maxFilePath, true)
|
||||
local res = wwExportTreeSettings ar
|
||||
if res == undefined then
|
||||
return 0
|
||||
dir = res[1]
|
||||
recursive = res[2]
|
||||
EXP_exported = #()
|
||||
)
|
||||
|
||||
-- Append a trailing backslash if the path doesn't have one.
|
||||
if dir[dir.count] != "\\" then
|
||||
dir = dir + "\\"
|
||||
|
||||
-- Export all max files in the current directory.
|
||||
local exported_count = 0
|
||||
local files = getFiles(dir + "*.max")
|
||||
sort files
|
||||
for f in files do
|
||||
(
|
||||
-- Load 'er up.
|
||||
if (loadMaxFile f) != true then
|
||||
(
|
||||
print("Unable to load " + f)
|
||||
continue
|
||||
)
|
||||
|
||||
-- Check if this scene requires another to be exported first.
|
||||
local htree_file = wwGetHierarchyFile()
|
||||
if htree_file != undefined then
|
||||
(
|
||||
-- Convert the relative path to an absolute one.
|
||||
local htree_abs = wwGetAbsolutePath htree_file dir
|
||||
local max_file = EXP_replace_extension htree_abs ".max"
|
||||
|
||||
-- Has the scene been exported yet?
|
||||
if (findItem EXP_exported (max_file as Name)) == 0 then
|
||||
(
|
||||
-- It hasn't been exported. Do so now.
|
||||
|
||||
-- Load the max file.
|
||||
if (loadMaxFile max_file) != true then
|
||||
(
|
||||
print("WARNING: " + max_file + " could not be opened, but " + \
|
||||
f + " depends on " + htree_abs + "!")
|
||||
|
||||
-- Proceed with the export only if a previous W3D file exists.
|
||||
if (getFiles htree_abs).count == 0 then
|
||||
continue
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Export the w3d file
|
||||
if (exportW3D w3d_name:w3d_file show_dialogs:false) == true then
|
||||
(
|
||||
-- Add the scene to the array of exported scenes.
|
||||
append EXP_exported (max_file as Name)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Show an error message
|
||||
print("ERROR: " + htree_abs + " not exported, but " + \
|
||||
f + " depends on it!")
|
||||
continue
|
||||
)
|
||||
|
||||
-- Load the previous scene up again so we can export it.
|
||||
loadMaxFile f
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Export it as a W3D file, if it hasn't been already exported.
|
||||
if (findItem EXP_exported (f as Name)) == 0 then
|
||||
(
|
||||
local w3d_file = EXP_replace_extension f ".w3d"
|
||||
if (exportW3D w3d_name:w3d_file show_dialogs:false) then
|
||||
(
|
||||
-- Add the scene to the array of exported scenes.
|
||||
append EXP_exported (f as Name)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Recurse through all subdirectories.
|
||||
if recursive == true then
|
||||
(
|
||||
local folders = getDirectories(dir + "*")
|
||||
sort folders
|
||||
for d in folders do
|
||||
(
|
||||
print ("Entering " + d)
|
||||
exportDirectoryTree dir:d
|
||||
)
|
||||
)
|
||||
|
||||
return EXP_exported.count
|
||||
)
|
||||
|
||||
-- The macro script definition for the "Export Directory Tree" toolbar button.
|
||||
macroScript Export_Directory_Tree
|
||||
category:"Westwood Scripts"
|
||||
buttonText:"Export Directory Tree"
|
||||
toolTip:"Export all MAX files in a folder and all its sub-folders"
|
||||
icon:#("SchematicView", 2)
|
||||
(
|
||||
local count = exportDirectoryTree()
|
||||
print (count as string + " files exported")
|
||||
if count > 0 then
|
||||
resetMaxFile #noPrompt
|
||||
)
|
||||
|
||||
116
Code/Tools/max2w3d/ExportAll.cpp
Normal file
116
Code/Tools/max2w3d/ExportAll.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : G *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tools/max2w3d/ExportAll.cpp $*
|
||||
* *
|
||||
* $Author:: Andre_a $*
|
||||
* *
|
||||
* $Modtime:: 10/15/99 2:08p $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* wwExportTreeSettings -- Returns the directory to export, and recursive flag. *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
/*
|
||||
** ExportAll.cpp - Implements wwExportTreeSettings, which presents the user with a dialog
|
||||
** to allow them to choose which directory they want to export, and whether they want to
|
||||
** export all subdirectories as well. These settings are then passed back so that a script
|
||||
** can go through the directory (and maybe the subdirectories) and export all .max files
|
||||
** it finds.
|
||||
*/
|
||||
|
||||
|
||||
#include "ExportAllDlg.h"
|
||||
|
||||
#undef STRICT
|
||||
#include <MaxScrpt.h>
|
||||
#include <Arrays.h>
|
||||
#include <Strings.h>
|
||||
#include <definsfn.h>
|
||||
|
||||
|
||||
/*
|
||||
** Let MAXScript know we're implementing new built-in functions.
|
||||
*/
|
||||
def_visible_primitive(export_tree_settings, "wwExportTreeSettings");
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* export_tree_settings_cf - Returns the directory to export, and recursive flag. *
|
||||
* *
|
||||
* wwExportTreeSettings - Usage: wwExportTreeSettings #(<initial path>, <recursive>) *
|
||||
* *
|
||||
* INPUT: A MaxScript array containing two values: *
|
||||
* initial_path (string) - the initial export directory *
|
||||
* recursive (bool) - the initial recursive setting *
|
||||
* *
|
||||
* OUTPUT: An array of the same format containing the values the user chose. *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 10/4/1999 AJA : Created. *
|
||||
*=============================================================================================*/
|
||||
Value * export_tree_settings_cf (Value **arg_list, int count)
|
||||
{
|
||||
// We want an array as an argument
|
||||
check_arg_count("wwExportAll", 1, count);
|
||||
type_check(arg_list[0], Array, "Parameter array");
|
||||
|
||||
// Grab the two values out of the array.
|
||||
// First value is a string whose value is the initial value for the directory.
|
||||
// Second value is a bool, true for a recursive export.
|
||||
ExportAllDlg dlg(MAXScript_interface);
|
||||
Array *args = (Array*)(arg_list[0]);
|
||||
char *temp = (args->get(1))->to_string();
|
||||
int len = strlen(temp);
|
||||
if (len < MAX_PATH)
|
||||
strcpy(dlg.m_Directory, temp);
|
||||
else
|
||||
{
|
||||
strncpy(dlg.m_Directory, temp, MAX_PATH-1);
|
||||
dlg.m_Directory[MAX_PATH-1] = 0;
|
||||
}
|
||||
dlg.m_Recursive = (args->get(2))->to_bool();
|
||||
|
||||
// Show the dialog to let the user change the settings.
|
||||
if (dlg.DoModal() == IDCANCEL)
|
||||
return &undefined;
|
||||
|
||||
// Create the array we will return to MaxScript.
|
||||
one_typed_value_local(Array *result);
|
||||
vl.result = new Array(2);
|
||||
vl.result->append(new String(dlg.m_Directory));
|
||||
if (dlg.m_Recursive)
|
||||
vl.result->append(&true_value);
|
||||
else
|
||||
vl.result->append(&false_value);
|
||||
|
||||
// Return the new values.
|
||||
return_value(vl.result);
|
||||
}
|
||||
219
Code/Tools/max2w3d/ExportAllDlg.cpp
Normal file
219
Code/Tools/max2w3d/ExportAllDlg.cpp
Normal file
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : G *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tools/max2w3d/ExportAllDlg.cpp $*
|
||||
* *
|
||||
* $Author:: Andre_a $*
|
||||
* *
|
||||
* $Modtime:: 10/15/99 4:25p $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
|
||||
// ExportAllDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "ExportAllDlg.h"
|
||||
#include <Max.h>
|
||||
#include <assert.h>
|
||||
#include <shlobj.h> // SHBrowseForFolder
|
||||
|
||||
|
||||
static BOOL CALLBACK _thunk_dialog_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ExportAllDlg dialog
|
||||
|
||||
|
||||
ExportAllDlg::ExportAllDlg (Interface *max_interface)
|
||||
{
|
||||
m_Directory[0] = '\0';
|
||||
m_Recursive = TRUE;
|
||||
m_hWnd = NULL;
|
||||
assert(max_interface != NULL);
|
||||
m_MaxInterface = max_interface;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ExportAllDlg Methods
|
||||
|
||||
int ExportAllDlg::DoModal (void)
|
||||
{
|
||||
// Put up the dialog box.
|
||||
BOOL result = DialogBoxParam(AppInstance, MAKEINTRESOURCE(IDD_EXPORT_ALL),
|
||||
m_MaxInterface->GetMAXHWnd(), (DLGPROC)_thunk_dialog_proc,
|
||||
(LPARAM)this);
|
||||
|
||||
// Return IDOK if the user accepted the new settings.
|
||||
return (result == 1) ? IDOK : IDCANCEL;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ExportAllDlg DialogProc
|
||||
|
||||
BOOL CALLBACK _thunk_dialog_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static ExportAllDlg *dialog = NULL;
|
||||
|
||||
if (uMsg == WM_INITDIALOG)
|
||||
{
|
||||
dialog = (ExportAllDlg*)lParam;
|
||||
dialog->m_hWnd = hWnd;
|
||||
}
|
||||
|
||||
if (dialog)
|
||||
return dialog->DialogProc(hWnd, uMsg, wParam, lParam);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL CALLBACK ExportAllDlg::DialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
int code = HIWORD(wParam);
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
|
||||
/*******************************************************************
|
||||
* WM_INITDIALOG
|
||||
*
|
||||
* Initialize all of the custom controls for the dialog box
|
||||
*
|
||||
*******************************************************************/
|
||||
case WM_INITDIALOG:
|
||||
|
||||
OnInitDialog();
|
||||
return TRUE;
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
* WM_COMMAND
|
||||
*
|
||||
*
|
||||
*******************************************************************/
|
||||
case WM_COMMAND:
|
||||
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
|
||||
if (OnOK() == FALSE)
|
||||
return TRUE;
|
||||
|
||||
SetCursor(LoadCursor(NULL, IDC_WAIT));
|
||||
EndDialog(m_hWnd, 1);
|
||||
break;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(m_hWnd, 0);
|
||||
break;
|
||||
|
||||
case IDC_BROWSE:
|
||||
OnBrowse();
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ExportAllDlg message handlers
|
||||
|
||||
void ExportAllDlg::OnInitDialog (void)
|
||||
{
|
||||
CenterWindow(m_hWnd, m_MaxInterface->GetMAXHWnd());
|
||||
SetCursor(LoadCursor(NULL, IDC_ARROW));
|
||||
|
||||
// Set the check box state.
|
||||
CheckDlgButton(m_hWnd, IDC_RECURSIVE, m_Recursive);
|
||||
|
||||
// Set the default directory.
|
||||
HWND edit = GetDlgItem(m_hWnd, IDC_DIRECTORY);
|
||||
assert(edit != NULL);
|
||||
SetWindowText(edit, m_Directory);
|
||||
}
|
||||
|
||||
void ExportAllDlg::OnBrowse()
|
||||
{
|
||||
char folder_name[MAX_PATH];
|
||||
BROWSEINFO bi;
|
||||
ZeroMemory(&bi, sizeof(bi));
|
||||
bi.hwndOwner = m_hWnd;
|
||||
bi.pszDisplayName = folder_name;
|
||||
bi.lpszTitle = "Select a folder for export...";
|
||||
bi.ulFlags = BIF_RETURNONLYFSDIRS;
|
||||
|
||||
// Browse for a folder.
|
||||
LPITEMIDLIST il = SHBrowseForFolder(&bi);
|
||||
if (il)
|
||||
{
|
||||
// Get the path of the folder.
|
||||
if (SHGetPathFromIDList(il, folder_name))
|
||||
{
|
||||
HWND edit = GetDlgItem(m_hWnd, IDC_DIRECTORY);
|
||||
assert(edit != NULL);
|
||||
SetWindowText(edit, folder_name);
|
||||
}
|
||||
else
|
||||
MessageBox(m_hWnd, "Error getting pathname with SHGetPathFromIDList()",
|
||||
"Error", MB_OK | MB_ICONSTOP);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL ExportAllDlg::OnOK (void)
|
||||
{
|
||||
// Get the directory chosen by the user. If none is entered,
|
||||
// freak on the user.
|
||||
char dir[_MAX_PATH];
|
||||
HWND edit = GetDlgItem(m_hWnd, IDC_DIRECTORY);
|
||||
assert(edit != NULL);
|
||||
if (GetWindowText(edit, dir, sizeof(dir)) == 0)
|
||||
{
|
||||
// The edit box is empty, that's not a valid choice.
|
||||
MessageBox(m_hWnd, "You must choose a directory to export",
|
||||
"Invalid Directory", MB_OK);
|
||||
SetFocus(edit);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// TODO: Validate the directory as one that actually exists.
|
||||
|
||||
// Store the values from the dialog in our class members.
|
||||
strcpy(m_Directory, dir);
|
||||
m_Recursive = (IsDlgButtonChecked(m_hWnd, IDC_RECURSIVE) == BST_CHECKED) ? TRUE : FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
81
Code/Tools/max2w3d/ExportAllDlg.h
Normal file
81
Code/Tools/max2w3d/ExportAllDlg.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : G *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tools/max2w3d/ExportAllDlg.h $*
|
||||
* *
|
||||
* $Author:: Andre_a $*
|
||||
* *
|
||||
* $Modtime:: 10/15/99 4:25p $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
#ifndef EXPORTALLDLG_H
|
||||
#define EXPORTALLDLG_H
|
||||
|
||||
#include "dllmain.h"
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
class Interface;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ExportAllDlg dialog
|
||||
|
||||
class ExportAllDlg
|
||||
{
|
||||
public:
|
||||
|
||||
// Construction
|
||||
ExportAllDlg (Interface *max_interface);
|
||||
|
||||
// Methods
|
||||
int DoModal (void);
|
||||
|
||||
// DialogProc
|
||||
BOOL CALLBACK DialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
// Dialog data associated with GUI components.
|
||||
char m_Directory[_MAX_PATH]; // edit box
|
||||
BOOL m_Recursive; // check box
|
||||
|
||||
// Dialog data
|
||||
enum { IDD = IDD_EXPORT_ALL };
|
||||
HWND m_hWnd;
|
||||
Interface *m_MaxInterface;
|
||||
|
||||
protected:
|
||||
|
||||
// Message Handlers
|
||||
void OnInitDialog (void);
|
||||
void OnBrowse (void);
|
||||
BOOL OnOK (void); // TRUE if ok to close dialog
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
102
Code/Tools/max2w3d/FPMatNav.cpp
Normal file
102
Code/Tools/max2w3d/FPMatNav.cpp
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**********************************************************************
|
||||
*<
|
||||
FILE: FPMatNav.cpp
|
||||
|
||||
DESCRIPTION: Function published access for material navigator messages
|
||||
|
||||
CREATED BY: Michael Russo
|
||||
|
||||
HISTORY: 02-08-2002 Created
|
||||
|
||||
*> Copyright (c) 2000, All Rights Reserved.
|
||||
**********************************************************************/
|
||||
#if defined W3D_GMAXDEV
|
||||
|
||||
#include "Max.h"
|
||||
#include "GMaxMtlDlg.h"
|
||||
#include "GameMtlForm.h"
|
||||
#include "GameMtl.h"
|
||||
#include "resource.h"
|
||||
|
||||
extern GMaxMtlDlg * GMaxMaterialDialog;
|
||||
extern GameMtlActionCB* Game_Mtl_ActionCB;
|
||||
|
||||
|
||||
//============================================================================================
|
||||
FPMatNav fpMatNav(FPMATNAV_INTERFACE, _T("MaterialNavNotify"), 0, NULL, FP_CORE,
|
||||
IFPMatNav::idLaunch, _T("Launch"), 0, TYPE_VOID, 0, 0,
|
||||
IFPMatNav::idSetMultiMaterialTabBySlot, _T("SetMultiMaterialTabBySlot"), 0, TYPE_VOID, 0, 3,
|
||||
_T("slot"), 0, TYPE_INT,
|
||||
_T("SubMtlTexIndex"), 0, TYPE_INT,
|
||||
_T("Element"), 0, TYPE_INT,
|
||||
IFPMatNav::idSetMaterialTabBySlot, _T("SetMaterialTabBySlot"), 0, TYPE_VOID, 0, 2,
|
||||
_T("slot"), 0, TYPE_INT,
|
||||
_T("Element"), 0, TYPE_INT,
|
||||
IFPMatNav::idSetMultiMaterialBySlot, _T("SetMultiMaterialBySlot"), 0, TYPE_VOID, 0, 2,
|
||||
_T("slot"), 0, TYPE_INT,
|
||||
_T("Element"), 0, TYPE_INT,
|
||||
IFPMatNav::idSetMaterialBySlot, _T("SetMaterialBySlot"), 0, TYPE_VOID, 0, 1,
|
||||
_T("slot"), 0, TYPE_INT,
|
||||
end
|
||||
);
|
||||
|
||||
IFPMatNav *FPMatNav::m_pIFPMatNavCallback = NULL;
|
||||
|
||||
//============================================================================================
|
||||
void FPMatNav::Launch(){
|
||||
if( m_pIFPMatNavCallback ) {
|
||||
m_pIFPMatNavCallback->Launch();
|
||||
}
|
||||
}
|
||||
//============================================================================================
|
||||
void FPMatNav::SetMultiMaterialTabBySlot( int iSlot, int iSubMtlTexIndex, int iElement ){
|
||||
if( m_pIFPMatNavCallback ) {
|
||||
m_pIFPMatNavCallback->SetMultiMaterialTabBySlot(iSlot, iSubMtlTexIndex, iElement);
|
||||
}
|
||||
}
|
||||
//============================================================================================
|
||||
void FPMatNav::SetMaterialTabBySlot( int iSlot, int iElement ){
|
||||
if( m_pIFPMatNavCallback ) {
|
||||
m_pIFPMatNavCallback->SetMaterialTabBySlot(iSlot, iElement);
|
||||
}
|
||||
}
|
||||
//============================================================================================
|
||||
void FPMatNav::SetMultiMaterialBySlot( int iSlot, int iIndex ){
|
||||
if( m_pIFPMatNavCallback ) {
|
||||
m_pIFPMatNavCallback->SetMultiMaterialBySlot(iSlot, iIndex);
|
||||
}
|
||||
}
|
||||
//============================================================================================
|
||||
void FPMatNav::SetMaterialBySlot(int iSlot ){
|
||||
if( m_pIFPMatNavCallback ) {
|
||||
m_pIFPMatNavCallback->SetMaterialBySlot(iSlot);
|
||||
}else{
|
||||
if(NULL == GMaxMaterialDialog){
|
||||
Game_Mtl_ActionCB->ExecuteAction(IDA_GAMEMTL_DODLG);
|
||||
}
|
||||
//Retry
|
||||
if( NULL != GMaxMaterialDialog && m_pIFPMatNavCallback ) {
|
||||
m_pIFPMatNavCallback->SetMaterialBySlot(iSlot);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
108
Code/Tools/max2w3d/FPMatNav.h
Normal file
108
Code/Tools/max2w3d/FPMatNav.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**********************************************************************
|
||||
*<
|
||||
FILE: FPMatNav.h
|
||||
|
||||
DESCRIPTION: Function published access for material navigator messages
|
||||
|
||||
CREATED BY: Michael Russo
|
||||
|
||||
HISTORY: 02-08-2002 Created
|
||||
|
||||
*> Copyright (c) 2000, All Rights Reserved.
|
||||
**********************************************************************/
|
||||
#if !defined __FPMATNAV__
|
||||
#define __FPMATNAV__
|
||||
|
||||
|
||||
#include "max.h"
|
||||
#include "iFnPub.h"
|
||||
|
||||
#define FPMATNAV_INTERFACE Interface_ID(0x60151ad4, 0x3b325af3)
|
||||
|
||||
inline class IFPMatNav* GetFPMatNav() {
|
||||
return (IFPMatNav*)GetCOREInterface(FPMATNAV_INTERFACE);
|
||||
}
|
||||
|
||||
|
||||
#define MATNAV_ELEMENT_UNKNOWN -1
|
||||
#define MATNAV_ELEMENT_AMBIENT 0
|
||||
#define MATNAV_ELEMENT_DIFFUSE 1
|
||||
#define MATNAV_ELEMENT_COLOR 2
|
||||
#define MATNAV_ELEMENT_LEVEL 3
|
||||
#define MATNAV_ELEMENT_GLOSSINESS 4
|
||||
#define MATNAV_ELEMENT_SELFILLUM 5
|
||||
#define MATNAV_ELEMENT_BUMP 6
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IFPMatNav fSetMultiMaterialBySlot
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class IFPMatNav
|
||||
{
|
||||
public:
|
||||
virtual void Launch(void) = 0;
|
||||
virtual void SetMultiMaterialTabBySlot( int iSlot, int iSubMtlTexIndex, int iElement ) = 0;
|
||||
virtual void SetMaterialTabBySlot( int iSlot, int iElement ) = 0;
|
||||
virtual void SetMultiMaterialBySlot( int iSlot, int iIndex ) = 0;
|
||||
virtual void SetMaterialBySlot( int iSlot ) = 0;
|
||||
|
||||
// function IDs
|
||||
enum { idLaunch, idSetMultiMaterialTabBySlot,
|
||||
idSetMaterialTabBySlot, idSetMultiMaterialBySlot,
|
||||
idSetMaterialBySlot };
|
||||
};
|
||||
|
||||
class FPMatNav : public IFPMatNav, public FPStaticInterface
|
||||
{
|
||||
public:
|
||||
//
|
||||
// Setup Callback
|
||||
//
|
||||
void SetIFPMatNavCallback( IFPMatNav *pIFPMatNav ) { m_pIFPMatNavCallback = pIFPMatNav; };
|
||||
|
||||
//
|
||||
// IFPMatNav Methods
|
||||
//
|
||||
void Launch(void);
|
||||
void SetMultiMaterialTabBySlot( int iSlot, int iSubMtlTexIndex, int iElement );
|
||||
void SetMaterialTabBySlot( int iSlot, int iElement );
|
||||
void SetMultiMaterialBySlot( int iSlot, int iIndex );
|
||||
void SetMaterialBySlot( int iSlot );
|
||||
|
||||
DECLARE_DESCRIPTOR(FPMatNav)
|
||||
BEGIN_FUNCTION_MAP
|
||||
VFN_0(IFPMatNav::idLaunch, Launch);
|
||||
VFN_3(IFPMatNav::idSetMultiMaterialTabBySlot, SetMultiMaterialTabBySlot, TYPE_INT, TYPE_INT, TYPE_INT);
|
||||
VFN_2(IFPMatNav::idSetMaterialTabBySlot, SetMaterialTabBySlot, TYPE_INT, TYPE_INT);
|
||||
VFN_2(IFPMatNav::idSetMultiMaterialBySlot, SetMultiMaterialBySlot, TYPE_INT, TYPE_INT);
|
||||
VFN_1(IFPMatNav::idSetMaterialBySlot, SetMaterialBySlot, TYPE_INT);
|
||||
END_FUNCTION_MAP
|
||||
|
||||
public:
|
||||
static IFPMatNav *m_pIFPMatNavCallback;
|
||||
|
||||
};
|
||||
|
||||
extern FPMatNav fpMatNav;
|
||||
|
||||
#endif
|
||||
|
||||
234
Code/Tools/max2w3d/FormClass.cpp
Normal file
234
Code/Tools/max2w3d/FormClass.cpp
Normal file
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : FormClass *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tools/max2w3d/FormClass.cpp $*
|
||||
* *
|
||||
* Author:: Greg Hjelstrom *
|
||||
* *
|
||||
* $Modtime:: 11/09/98 3:02a $*
|
||||
* *
|
||||
* $Revision:: 2 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* FormClass::Create_Form -- Loads the dialog template and initializes *
|
||||
* FormClass::fnFormProc -- windows proc which thunks into the virtual Dialog_Proc *
|
||||
* FormClass::ExecuteDlgInit -- Initializes controls in the dialog template *
|
||||
* FormClass::ExecuteDlgInit -- Initializes the controls in the dialog template *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
#include "FormClass.H"
|
||||
#include "Dllmain.H"
|
||||
|
||||
// hard-coded resource id which VC special cases for MFC... >:-)
|
||||
#define RT_DLGINIT MAKEINTRESOURCE(240)
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* FormClass::Create_Form -- Loads the dialog template and initializes *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/6/98 GTH : Created. *
|
||||
*=============================================================================================*/
|
||||
HWND
|
||||
FormClass::Create_Form
|
||||
(
|
||||
HWND parent_wnd,
|
||||
UINT template_id
|
||||
)
|
||||
{
|
||||
// call PreCreateWindow to get prefered extended style
|
||||
CREATESTRUCT cs = { 0 };
|
||||
cs.style = WS_CHILD;
|
||||
|
||||
m_hWnd = ::CreateDialogParam( AppInstance,
|
||||
MAKEINTRESOURCE (template_id),
|
||||
parent_wnd,
|
||||
fnFormProc,
|
||||
(LPARAM)this);
|
||||
|
||||
assert(m_hWnd);
|
||||
|
||||
// Remove the caption from the dialog (if there was any)
|
||||
::SetWindowLong (m_hWnd,
|
||||
GWL_STYLE,
|
||||
::GetWindowLong (m_hWnd, GWL_STYLE) & (~WS_CAPTION));
|
||||
|
||||
::GetWindowRect (m_hWnd, &m_FormRect);
|
||||
|
||||
ExecuteDlgInit(MAKEINTRESOURCE(template_id));
|
||||
|
||||
return m_hWnd;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* FormClass::fnFormProc -- windows proc which thunks into the virtual Dialog_Proc *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/6/98 GTH : Created. *
|
||||
*=============================================================================================*/
|
||||
BOOL WINAPI
|
||||
FormClass::fnFormProc
|
||||
(
|
||||
HWND dlg_wnd,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam
|
||||
)
|
||||
{
|
||||
FormClass *pform = (FormClass *)::GetProp (dlg_wnd, "FORMCLASS");
|
||||
|
||||
if (message == WM_INITDIALOG) {
|
||||
pform = (FormClass *)lparam;
|
||||
::SetProp (dlg_wnd, "FORMCLASS", (HANDLE)pform);
|
||||
} else if (message == WM_DESTROY) {
|
||||
::RemoveProp (dlg_wnd, "FORMCLASS");
|
||||
}
|
||||
|
||||
BOOL retval = FALSE;
|
||||
if (pform) {
|
||||
retval = pform->Dialog_Proc (dlg_wnd, message, wparam, lparam);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* FormClass::ExecuteDlgInit -- Initializes controls in the dialog template *
|
||||
* *
|
||||
* This code was lifted straight out of MFC. It does some "interesting" things like putting *
|
||||
* strings into combo boxes which are typed in the resource editor. *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/6/98 GTH : Created. *
|
||||
*=============================================================================================*/
|
||||
BOOL FormClass::ExecuteDlgInit(LPCTSTR lpszResourceName)
|
||||
{
|
||||
// find resource handle
|
||||
LPVOID lpResource = NULL;
|
||||
HGLOBAL hResource = NULL;
|
||||
if (lpszResourceName != NULL)
|
||||
{
|
||||
HINSTANCE hInst = AppInstance;
|
||||
HRSRC hDlgInit = ::FindResource(hInst, lpszResourceName, RT_DLGINIT);
|
||||
if (hDlgInit != NULL)
|
||||
{
|
||||
// load it
|
||||
hResource = LoadResource(hInst, hDlgInit);
|
||||
if (hResource == NULL)
|
||||
return FALSE;
|
||||
// lock it
|
||||
lpResource = LockResource(hResource);
|
||||
assert(lpResource != NULL);
|
||||
}
|
||||
}
|
||||
|
||||
// execute it
|
||||
BOOL bResult = ExecuteDlgInit(lpResource);
|
||||
|
||||
// cleanup
|
||||
if (lpResource != NULL && hResource != NULL)
|
||||
{
|
||||
UnlockResource(hResource);
|
||||
FreeResource(hResource);
|
||||
}
|
||||
return bResult;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* FormClass::ExecuteDlgInit -- Initializes the controls in the dialog template *
|
||||
* *
|
||||
* As the above ExecuteDlgInit function, this was lifted from MFC... *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 11/6/98 GTH : Created. *
|
||||
*=============================================================================================*/
|
||||
BOOL FormClass::ExecuteDlgInit(LPVOID lpResource)
|
||||
{
|
||||
BOOL bSuccess = TRUE;
|
||||
if (lpResource != NULL)
|
||||
{
|
||||
UNALIGNED WORD* lpnRes = (WORD*)lpResource;
|
||||
while (bSuccess && *lpnRes != 0)
|
||||
{
|
||||
WORD nIDC = *lpnRes++;
|
||||
WORD nMsg = *lpnRes++;
|
||||
DWORD dwLen = *((UNALIGNED DWORD*&)lpnRes)++;
|
||||
|
||||
// In Win32 the WM_ messages have changed. They have
|
||||
// to be translated from the 32-bit values to 16-bit
|
||||
// values here.
|
||||
#define WIN16_LB_ADDSTRING 0x0401
|
||||
#define WIN16_CB_ADDSTRING 0x0403
|
||||
|
||||
if (nMsg == WIN16_LB_ADDSTRING)
|
||||
nMsg = LB_ADDSTRING;
|
||||
else if (nMsg == WIN16_CB_ADDSTRING)
|
||||
nMsg = CB_ADDSTRING;
|
||||
|
||||
// check for invalid/unknown message types
|
||||
assert(nMsg == LB_ADDSTRING || nMsg == CB_ADDSTRING);
|
||||
|
||||
if (nMsg == LB_ADDSTRING || nMsg == CB_ADDSTRING)
|
||||
{
|
||||
// List/Combobox returns -1 for error
|
||||
if (::SendDlgItemMessageA(m_hWnd, nIDC, nMsg, 0, (LONG)lpnRes) == -1)
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
|
||||
// skip past data
|
||||
lpnRes = (WORD*)((LPBYTE)lpnRes + (UINT)dwLen);
|
||||
}
|
||||
}
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
72
Code/Tools/max2w3d/FormClass.h
Normal file
72
Code/Tools/max2w3d/FormClass.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : max2w3d *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tools/max2w3d/FormClass.h $*
|
||||
* *
|
||||
* Author:: Greg Hjelstrom *
|
||||
* *
|
||||
* $Modtime:: 11/13/98 9:34a $*
|
||||
* *
|
||||
* $Revision:: 3 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef __FORMCLASS_H
|
||||
#define __FORMCLASS_H
|
||||
|
||||
#include <Max.h>
|
||||
|
||||
|
||||
class FormClass : public ParamDlg
|
||||
{
|
||||
public:
|
||||
FormClass (void)
|
||||
: m_hWnd (NULL) {}
|
||||
~FormClass (void) {}
|
||||
|
||||
HWND Create_Form (HWND parent_wnd, UINT template_id);
|
||||
void Show (bool show_flag = true) { ::ShowWindow (m_hWnd, show_flag ? SW_SHOW : SW_HIDE); }
|
||||
virtual BOOL Dialog_Proc (HWND dlg_wnd, UINT message, WPARAM wparam, LPARAM lparam) = 0;
|
||||
HWND Get_Hwnd(void) { return m_hWnd; }
|
||||
virtual void Invalidate(void) { InvalidateRect(m_hWnd,NULL,0); }
|
||||
|
||||
protected:
|
||||
|
||||
BOOL ExecuteDlgInit(LPVOID lpResource);
|
||||
BOOL ExecuteDlgInit(LPCTSTR lpszResourceName);
|
||||
|
||||
static BOOL WINAPI fnFormProc (HWND dlg_wnd, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
HWND m_hWnd;
|
||||
RECT m_FormRect;
|
||||
};
|
||||
|
||||
#endif //__FORMCLASS_H
|
||||
1215
Code/Tools/max2w3d/GMaxMtlDlg.cpp
Normal file
1215
Code/Tools/max2w3d/GMaxMtlDlg.cpp
Normal file
File diff suppressed because it is too large
Load Diff
172
Code/Tools/max2w3d/GMaxMtlDlg.h
Normal file
172
Code/Tools/max2w3d/GMaxMtlDlg.h
Normal file
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***********************************************************************************************
|
||||
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : Max2W3d *
|
||||
* *
|
||||
* $Archive:: /Commando/Code/Tools/max2w3d/GMaxMtlDlg.h $*
|
||||
* *
|
||||
* Author:: Greg Hjelstrom *
|
||||
* *
|
||||
* $Modtime:: 3/19/02 4:18p $*
|
||||
* *
|
||||
* $Revision:: 9 $*
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef GMAXMTLDLG_H
|
||||
#define GMAXMTLDLG_H
|
||||
#if defined W3D_GMAXDEV
|
||||
|
||||
class GameMtl;
|
||||
class GameMtlPassDlg;
|
||||
|
||||
#include "imtledit.h"
|
||||
#include "FPMatNav.h"
|
||||
#include "Ref.h"
|
||||
#include "Notify.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// GMaxMtlDlg
|
||||
//
|
||||
// Dialog box interface in the material editor for GameMtl
|
||||
// This is basically a cannibalized version of the Standard
|
||||
// Max material's dialog.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
#define FPMATNAV_INTERFACE Interface_ID(0x60151ad4, 0x3b325af3)
|
||||
|
||||
class GMaxMtlDlg: public ParamDlg , public IFPMatNav //,public ReferenceMaker
|
||||
{
|
||||
public:
|
||||
void DestroyDialog();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Methods
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
GMaxMtlDlg(HWND hwMtlEdit, IMtlParams *imp, GameMtl *m);
|
||||
~GMaxMtlDlg();
|
||||
|
||||
//============================================================================================
|
||||
virtual void Launch(void);
|
||||
virtual void SetMultiMaterialTabBySlot( int iSlot, int iSubMtlTexIndex, int iElement );
|
||||
virtual void SetMaterialTabBySlot( int iSlot, int iElement );
|
||||
virtual void SetMultiMaterialBySlot( int iSlot, int iIndex );
|
||||
virtual void SetMaterialBySlot( int iSlot );
|
||||
//============================================================================================
|
||||
// From ParamDlg:
|
||||
Class_ID ClassID(void);
|
||||
void SetThing(ReferenceTarget *m);
|
||||
ReferenceTarget* GetThing(void) { return (ReferenceTarget*)TheMtl; }
|
||||
void DeleteThis() { delete this; }
|
||||
void SetTime(TimeValue t);
|
||||
void ReloadDialog(void);
|
||||
void ActivateDlg(BOOL onOff);
|
||||
|
||||
void Invalidate(void);
|
||||
void Update_Display(void) {GetCOREInterface()->ForceCompleteRedraw(TRUE);}
|
||||
void Reset(GameMtl* mtl);
|
||||
void Reinitialize(GameMtl* new_mtl, bool update_multimtl = true);
|
||||
void SetMultimaterial(Mtl* mtl){Game_multi_mtl = mtl; Current_Submtl_Index = 0;}
|
||||
void DoMaterialNavigator();
|
||||
void DoGetMaterial();
|
||||
void ApplyToSelection(GameMtl* mtl);
|
||||
void DoNewMaterial();
|
||||
void DeleteMtl();
|
||||
void DeleteAllSceneMtl();
|
||||
void AddToolTip(HWND hControl, UINT strID);
|
||||
void LoadButtonBitmaps(HWND hDlg);
|
||||
void DeleteNodeMaterial(INode* node, MtlBase* mtl);
|
||||
void ShowHideControls();
|
||||
void NextSibling();
|
||||
void PreviousSibling();
|
||||
void SetCurrentPage(int i){CurrentPage = i;}
|
||||
bool HasMultiMtl(){return Game_multi_mtl != NULL;}
|
||||
void SetMtl(GameMtl* mtl){TheMtl = mtl;}
|
||||
GameMtl* GetMtl(){return TheMtl;}
|
||||
bool IsVisible(){ return HwndEdit && IsWindowVisible(HwndEdit);}
|
||||
GameMtl* ConvertStdMtl(Mtl* stdmtl);
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Max interface pointer
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Interface* Ip;
|
||||
|
||||
protected:
|
||||
|
||||
void Build_Dialog(HWND hParent = NULL);
|
||||
void Make_PropertySheet(HWND hParent);
|
||||
void Make_Floater(HWND hParent);
|
||||
Mtl* Game_multi_mtl;
|
||||
HBITMAP HGetMtlBmp;
|
||||
HBITMAP HBrowseMtlBmp;
|
||||
HBITMAP HAssignMtlBmp;
|
||||
HBITMAP HDeleteMtlBmp;
|
||||
HBITMAP HNewMtlBmp;
|
||||
HBITMAP HNextSiblingBmp;
|
||||
HBITMAP HPreviousSiblingBmp;
|
||||
int Current_Submtl_Index; //
|
||||
bool DontShowMtlType; //
|
||||
bool DontShowDeleteAll; //
|
||||
int CurrentPage; //Which prop page is currently active
|
||||
BOOL DisplacementMapProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
BOOL SurfaceTypeProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
BOOL PassCountProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
void Set_Pass_Count_Dialog(void);
|
||||
|
||||
enum { MAX_PASSES = 4 };
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Windows handles
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
HWND HwndEdit; // window handle of the materials editor dialog
|
||||
HWND HwndPassCount; // Rollup pass count panel
|
||||
HWND HwndSurfaceType; // Rollup surface type panel
|
||||
HWND HwndDisplacementMap;
|
||||
HPALETTE HpalOld;
|
||||
|
||||
GameMtlPassDlg * PassDialog[MAX_PASSES];
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Material dialog interface
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
IMtlParams * IParams; // interface to the material editor
|
||||
GameMtl * TheMtl; // current mtl being edited.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Member variables
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
TimeValue CurTime;
|
||||
int IsActive;
|
||||
friend BOOL CALLBACK DisplacementMapDlgProc(HWND, UINT, WPARAM,LPARAM);
|
||||
friend BOOL CALLBACK SurfaceTypePanelDlgProc(HWND, UINT, WPARAM,LPARAM);
|
||||
friend BOOL CALLBACK PassCountPanelDlgProc(HWND, UINT, WPARAM,LPARAM);
|
||||
friend class GameMtl;
|
||||
};
|
||||
GameMtl* GetMtlFromSelection();
|
||||
#endif
|
||||
#endif
|
||||
BIN
Code/Tools/max2w3d/GMax_Hybrid/AlphaModifier.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/AlphaModifier.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/AppData.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/AppData.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/ExportAll.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/ExportAll.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/ExportAllDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/ExportAllDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/FPMatNav.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/FPMatNav.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/FormClass.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/FormClass.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/GMaxMtlDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/GMaxMtlDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/GameMtl.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/GameMtl.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/GameMtlDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/GameMtlDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/GameMtlForm.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/GameMtlForm.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/GameMtlPassDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/GameMtlPassDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/GameMtlShaderDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/GameMtlShaderDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/GameMtlTextureDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/GameMtlTextureDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/GameMtlVertexMaterialDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/GameMtlVertexMaterialDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/InputDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/InputDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/PCToPS2Material.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/PCToPS2Material.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/PS2GameMtl.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/PS2GameMtl.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/PS2GameMtlShaderDlg.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/PS2GameMtlShaderDlg.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/max2w3d/GMax_Hybrid/SceneSetup.sbr
Normal file
BIN
Code/Tools/max2w3d/GMax_Hybrid/SceneSetup.sbr
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user