Panda3D

Loading...
Searching...
No Matches
maxEgg.h
1/*
2 MaxEgg.h
3 Created by Steven "Sauce" Osman, Jan03
4 Modified and maintained by Ken Strickland, (02/01/03)-(05/15/03)
5 Modified and maintained by Corey Revilla, (05/22/03)-present
6 Carnegie Mellon University, Entetainment Technology Center
7
8 This file contains a 3dsMax exporter derived from discreet's own SceneExport
9 plug-in class; this exporter is basically a wrapper around the MaxToEgg
10 Panda-converter class, and just sets up the interface and environment
11 in which the MaxToEgg class can be "run" as if it were a standalone app.
12*/
13#ifndef __MaxEgg__H
14#define __MaxEgg__H
15
16#include "pandatoolbase.h"
17#include <sys/types.h>
18#include <sys/stat.h>
19#include <fcntl.h>
20#include <crtdbg.h>
21#include <errno.h>
22
23 using std::min;
24 using std::max;
25
26#include "eggGroup.h"
27#include "eggTable.h"
28#include "eggXfmSAnim.h"
29#include "eggData.h"
30#include "referenceCount.h"
31#include "pointerTo.h"
32#include "namable.h"
33
34#include <iostream>
35#include <fstream>
36#include <vector>
37
38#define WIN32_LEAN_AND_MEAN
39#include <windef.h>
40#include <windows.h>
41
42#include <Max.h>
43#include <iparamb2.h>
44#include <iparamm2.h>
45#include <istdplug.h>
46#include <iskin.h>
47#include <stdmat.h>
48#include <phyexp.h>
49#include <surf_api.h>
50#include <bipexp.h>
51#include <modstack.h>
52
53#include "eggCoordinateSystem.h"
54#include "eggGroup.h"
55#include "eggPolygon.h"
56#include "eggTextureCollection.h"
57#include "eggTexture.h"
58#include "eggVertex.h"
59#include "eggVertexPool.h"
60#include "eggNurbsCurve.h"
61#include "pandatoolbase.h"
62#include "eggXfmSAnim.h"
63#include "pathStore.h"
64
65#include "maxNodeDesc.h"
66#include "maxNodeTree.h"
67#include "maxOptionsDialog.h"
68#include "maxResource.h"
69#include "maxToEggConverter.h"
70
71#define MaxEggPlugin_CLASS_ID Class_ID(0x7ac0d6b7, 0x55731ef6)
72
73#pragma conform(forScope, off)
74
75/* Externed Globals
76 */
77 extern HINSTANCE hInstance;
78
79/* Global Functions
80 */
81 extern TCHAR *GetString(int id);
82
83/* This class defines the 3D Studio Max exporter itself. It is basically a
84 shell that is invoked by 3D Studio Max's export API. It then sets up
85 MaxToEgg instance and attempts to "fool it" into thinking that it is
86 actually being invoked as a standalone program. The thought behind this
87 is that some day MaxToEgg may well be a standalone program, provided that
88 a suitable interface to Max files can be connected from a standalone
89 program instead of a plugin.
90*/
91
92#if MAX_VERSION_MAJOR < 9
93 #define DefaultRemapDir NoRemap
94#endif
95
96 class MaxEggPlugin : public HelperObject
97{
98 MaxOptionsDialog **eggList;
99 int numEggs;
100 int maxEggs;
101
102 public:
103 bool autoOverwrite;
104 bool pview;
105 bool logOutput;
106
107 // Class vars
108 static Mesh mesh; // This plugin generates no geometry, this mesh is not passed on to 3D Studio.
109 static short meshBuilt;
110 static HWND hMaxEggParams;
111 static IObjParam *iObjParams;
112
113 // ConstructorDestructor
114 MaxEggPlugin();
115 virtual ~MaxEggPlugin();
116
117 // Other class Methods
118 void DoExport();
119 void UpdateUI();
120 void SaveCheckState();
121 void BuildMesh();
122
123 void AddEgg(MaxOptionsDialog *newEgg);
124 void RemoveEgg(int i);
125 MaxOptionsDialog *GetEgg(int i) { return (i >= 0 && i < numEggs) ? eggList[i] : nullptr; }
126
127 // Required implimented virtual methods: inherited virtual methods for
128 // Reference-management
129 RefResult NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message );
130 void GetMat(TimeValue t, INode* inod, ViewExp *vpt, Matrix3& mat);
131
132 // From BaseObject
133 int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt);
134 int Display(TimeValue t, INode* inode, ViewExp *vpt, int flags);
135 CreateMouseCallBack* GetCreateMouseCallBack();
136 void BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev);
137 void EndEditParams( IObjParam *ip, ULONG flags,Animatable *next);
138#if MAX_VERSION_MAJOR < 15
139 TCHAR *GetObjectName() { return GetString(IDS_LIBDESCRIPTION); }
140#else
141 const TCHAR *GetObjectName() { return GetString(IDS_LIBDESCRIPTION); }
142#endif
143
144 // From Object
145 ObjectState Eval(TimeValue time);
146 void InitNodeName(TSTR& s) { s = GetString(IDS_CLASS_NAME); }
147 Interval ObjectValidity(TimeValue time);
148 void Invalidate();
149 int DoOwnSelectHilite() { return 1; }
150
151 // From GeomObject
152 int IntersectRay(TimeValue t, Ray& r, PN_stdfloat& at) { return 0; }
153 void GetWorldBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box );
154 void GetLocalBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box );
155 void GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSel );
156
157 // Animatable methods
158 void DeleteThis() { delete this; }
159 Class_ID ClassID() { return MaxEggPlugin_CLASS_ID; }
160 void GetClassName(TSTR& s) { s = TSTR(GetString(IDS_CLASS_NAME)); }
161 TSTR SubAnimName(int i) { return TSTR(GetString(IDS_CLASS_NAME)); }
162
163 // From ref
164 RefTargetHandle Clone(RemapDir& remap = DefaultRemapDir());
165
166 // IO
167 IOResult Save(ISave *isave);
168 IOResult Load(ILoad *iload);
169};
170
171
172#endif // __MaxEgg__H
MaxOptionsDialog
Definition maxOptionsDialog.h:79
eggCoordinateSystem.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggData.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggGroup.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggNurbsCurve.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggPolygon.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggTable.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggTextureCollection.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggTexture.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggVertexPool.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggVertex.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggXfmSAnim.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
maxNodeDesc.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
maxNodeTree.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
maxToEggConverter.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
namable.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandatoolbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pathStore.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
referenceCount.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.