support maya on windows

This commit is contained in:
David Rose 2002-04-11 23:52:05 +00:00
parent 44cf5899d3
commit 678d14ce4b
17 changed files with 136 additions and 42 deletions

View File

@ -358,6 +358,7 @@
// Is Maya installed? This matters only to programs in PANDATOOL. // Is Maya installed? This matters only to programs in PANDATOOL.
#define MAYA_LOCATION /usr/aw/maya3.0 #define MAYA_LOCATION /usr/aw/maya3.0
#defer MAYA_LIBS $[if $[WINDOWS_PLATFORM],Foundation.lib OpenMaya.lib]
#defer HAVE_MAYA $[isdir $[MAYA_LOCATION]] #defer HAVE_MAYA $[isdir $[MAYA_LOCATION]]

View File

@ -213,7 +213,8 @@
#if $[and $[HAVE_MAYA],$[MAYA_LOCATION]] #if $[and $[HAVE_MAYA],$[MAYA_LOCATION]]
#define maya_ipath $[MAYA_LOCATION]/include #define maya_ipath $[MAYA_LOCATION]/include
#define maya_lpath $[MAYA_LOCATION]/lib #define maya_lpath $[MAYA_LOCATION]/lib
#define maya_ld $[MAYA_LOCATION]/bin/mayald #define maya_ld $[wildcard $[MAYA_LOCATION]/bin/mayald]
#define maya_libs $[MAYA_LIBS]
#endif #endif
#if $[HAVE_IPC] #if $[HAVE_IPC]

View File

@ -1,5 +1,16 @@
#define DIRECTORY_IF_MAYA yes #define DIRECTORY_IF_MAYA yes
#define binary_name maya2egg
#if $[UNIX_PLATFORM]
// On Unix, we need maya2egg to be a script that sets the
// LD_LIBRARY_PATH variable and then invokes the application. On
// Windows, this path seems to get built into the executable so
// there's no need. (Don't know why they didn't decide to compile
// it in also on Unix.)
#set binary_name maya2egg_bin
#begin sed_bin_target #begin sed_bin_target
#define TARGET maya2egg #define TARGET maya2egg
@ -8,14 +19,19 @@
#end sed_bin_target #end sed_bin_target
#endif // $[UNIX_PLATFORM]
#begin bin_target #begin bin_target
#define USE_MAYA yes #define USE_MAYA yes
#define TARGET maya2egg_bin #define TARGET $[binary_name]
#define LOCAL_LIBS \ #define LOCAL_LIBS \
eggbase progbase eggbase progbase
#define OTHER_LIBS \ #define OTHER_LIBS \
egg:c linmath:c putil:c express:c panda:m \ egg:c pandaegg:m \
dtoolutil:c dtoolbase:c dconfig:c dtool:m linmath:c putil:c panda:m \
express:c pandaexpress:m \
dtoolutil:c dtoolbase:c dconfig:c dtoolconfig:m dtool:m pystub
#define UNIX_SYS_LIBS \ #define UNIX_SYS_LIBS \
m m

View File

@ -19,7 +19,7 @@
#ifndef GLOBAL_PARAMETERS_H #ifndef GLOBAL_PARAMETERS_H
#define GLOBAL_PARAMETERS_H #define GLOBAL_PARAMETERS_H
#include <pandatoolbase.h> #include "pandatoolbase.h"
extern int verbose; extern int verbose;
extern bool polygon_output; extern bool polygon_output;

View File

@ -19,15 +19,17 @@
#include "mayaFile.h" #include "mayaFile.h"
#include "mayaShader.h" #include "mayaShader.h"
#include "global_parameters.h" #include "global_parameters.h"
#include "maya_funcs.h"
#include <eggData.h> #include "eggData.h"
#include <eggGroup.h> #include "eggGroup.h"
#include <eggVertex.h> #include "eggVertex.h"
#include <eggVertexPool.h> #include "eggVertexPool.h"
#include <eggNurbsSurface.h> #include "eggNurbsSurface.h"
#include <eggNurbsCurve.h> #include "eggNurbsCurve.h"
#include <eggPolygon.h> #include "eggPolygon.h"
#include "pre_maya_include.h"
#include <maya/MArgList.h> #include <maya/MArgList.h>
#include <maya/MColor.h> #include <maya/MColor.h>
#include <maya/MDagPath.h> #include <maya/MDagPath.h>
@ -55,6 +57,7 @@
#include <maya/MTransformationMatrix.h> #include <maya/MTransformationMatrix.h>
#include <maya/MVector.h> #include <maya/MVector.h>
#include <maya/MTesselationParams.h> #include <maya/MTesselationParams.h>
#include "post_maya_include.h"
MayaFile:: MayaFile::
MayaFile() { MayaFile() {
@ -727,10 +730,10 @@ make_polyset(const MDagPath &dag_path, MFnMesh mesh,
// Determine the shader for this particular polygon. // Determine the shader for this particular polygon.
int index = pi.index(); int index = pi.index();
assert(index >= 0 && index < poly_shader_indices.length()); assert(index >= 0 && index < (int)poly_shader_indices.length());
int shader_index = poly_shader_indices[index]; int shader_index = poly_shader_indices[index];
if (shader_index != -1) { if (shader_index != -1) {
assert(shader_index >= 0 && shader_index < shaders.length()); assert(shader_index >= 0 && shader_index < (int)shaders.length());
MObject engine = shaders[shader_index]; MObject engine = shaders[shader_index];
MayaShader *shader = MayaShader *shader =
_shaders.find_shader_for_shading_engine(engine); _shaders.find_shader_for_shading_engine(engine);

View File

@ -19,11 +19,9 @@
#ifndef MAYAFILE_H #ifndef MAYAFILE_H
#define MAYAFILE_H #define MAYAFILE_H
#include <pandatoolbase.h> #include "pandatoolbase.h"
#include "mayaShaders.h" #include "mayaShaders.h"
#include "eggTextureCollection.h"
#include <eggTextureCollection.h>
class EggData; class EggData;
class EggGroup; class EggGroup;

View File

@ -21,10 +21,11 @@
#include "mayaFile.h" #include "mayaFile.h"
#include "global_parameters.h" #include "global_parameters.h"
#include <eggPrimitive.h> #include "eggPrimitive.h"
#include <eggTexture.h> #include "eggTexture.h"
#include <eggTextureCollection.h> #include "eggTextureCollection.h"
#include "pre_maya_include.h"
#include <maya/MFnDependencyNode.h> #include <maya/MFnDependencyNode.h>
#include <maya/MFnLambertShader.h> #include <maya/MFnLambertShader.h>
#include <maya/MPlug.h> #include <maya/MPlug.h>
@ -32,6 +33,7 @@
#include <maya/MColor.h> #include <maya/MColor.h>
#include <maya/MObject.h> #include <maya/MObject.h>
#include <maya/MStatus.h> #include <maya/MStatus.h>
#include "post_maya_include.h"
MayaShader:: MayaShader::
MayaShader(MObject engine) { MayaShader(MObject engine) {

View File

@ -19,12 +19,10 @@
#ifndef MAYASHADER_H #ifndef MAYASHADER_H
#define MAYASHADER_H #define MAYASHADER_H
#include <pandatoolbase.h> #include "pandatoolbase.h"
#include <luse.h> #include "luse.h"
#include <lmatrix.h> #include "lmatrix.h"
#include <string>
class MObject; class MObject;
class MayaFile; class MayaFile;

View File

@ -19,13 +19,16 @@
#include "mayaShaders.h" #include "mayaShaders.h"
#include "mayaShader.h" #include "mayaShader.h"
#include "global_parameters.h" #include "global_parameters.h"
#include "maya_funcs.h"
#include "pre_maya_include.h"
#include <maya/MStatus.h> #include <maya/MStatus.h>
#include <maya/MObject.h> #include <maya/MObject.h>
#include <maya/MFnDependencyNode.h> #include <maya/MFnDependencyNode.h>
#include <maya/MPlug.h> #include <maya/MPlug.h>
#include <maya/MPlugArray.h> #include <maya/MPlugArray.h>
#include <maya/MFn.h> #include <maya/MFn.h>
#include "post_maya_include.h"
MayaShader *MayaShaders:: MayaShader *MayaShaders::
find_shader_for_node(MObject node) { find_shader_for_node(MObject node) {

View File

@ -19,10 +19,9 @@
#ifndef MAYASHADERS_H #ifndef MAYASHADERS_H
#define MAYASHADERS_H #define MAYASHADERS_H
#include <pandatoolbase.h> #include "pandatoolbase.h"
#include "pmap.h" #include "pmap.h"
#include <string>
class MayaShader; class MayaShader;
class MObject; class MObject;

View File

@ -19,7 +19,9 @@
#include "mayaToEgg.h" #include "mayaToEgg.h"
#include "global_parameters.h" #include "global_parameters.h"
#include "pre_maya_include.h"
#include <maya/MGlobal.h> #include <maya/MGlobal.h>
#include "post_maya_include.h"
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: MayaToEgg::Constructor // Function: MayaToEgg::Constructor

View File

@ -19,11 +19,9 @@
#ifndef MAYATOEGG_H #ifndef MAYATOEGG_H
#define MAYATOEGG_H #define MAYATOEGG_H
#include <pandatoolbase.h> #include "pandatoolbase.h"
#include "mayaFile.h" #include "mayaFile.h"
#include "somethingToEgg.h"
#include <somethingToEgg.h>
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : MayaToEgg // Class : MayaToEgg

View File

@ -16,12 +16,6 @@
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#include <maya/MFnAttribute.h>
#include <maya/MPlug.h>
#include <maya/MStatus.h>
#include <maya/MFnDependencyNode.h>
#include <maya/MObject.h>
template<class ValueType> template<class ValueType>
bool bool
get_maya_attribute(MObject &node, const string &attribute_name, get_maya_attribute(MObject &node, const string &attribute_name,

View File

@ -18,12 +18,14 @@
#include "maya_funcs.h" #include "maya_funcs.h"
#include "pre_maya_include.h"
#include <maya/MObject.h> #include <maya/MObject.h>
#include <maya/MAngle.h> #include <maya/MAngle.h>
#include <maya/MFnDependencyNode.h> #include <maya/MFnDependencyNode.h>
#include <maya/MStatus.h> #include <maya/MStatus.h>
#include <maya/MFnStringData.h> #include <maya/MFnStringData.h>
#include <maya/MFnNumericData.h> #include <maya/MFnNumericData.h>
#include "post_maya_include.h"
bool bool
get_bool_attribute(MObject &node, const string &attribute_name, get_bool_attribute(MObject &node, const string &attribute_name,

View File

@ -19,11 +19,18 @@
#ifndef MAYA_FUNCS_H #ifndef MAYA_FUNCS_H
#define MAYA_FUNCS_H #define MAYA_FUNCS_H
#include <pandatoolbase.h> #include "pandatoolbase.h"
#include "luse.h"
#include <luse.h> #include "pre_maya_include.h"
#include <maya/MFnAttribute.h>
#include <string> #include <maya/MPlug.h>
#include <maya/MStatus.h>
#include <maya/MFnDependencyNode.h>
#include <maya/MObject.h>
#include <maya/MString.h>
#include <maya/MVector.h>
#include "post_maya_include.h"
class MObject; class MObject;
@ -55,6 +62,17 @@ get_string_attribute(MObject &node, const string &attribute_name,
void void
describe_maya_attribute(MObject &node, const string &attribute_name); describe_maya_attribute(MObject &node, const string &attribute_name);
// Also, we must define some output functions for Maya objects, since
// we can't use those built into Maya (which forward-defines the
// ostream type incorrectly).
INLINE ostream &operator << (ostream &out, const MString &str) {
return out << str.asChar();
}
INLINE ostream &operator << (ostream &out, const MVector &vec) {
return out << vec.x << " " << vec.y << " " << vec.z;
}
#include "maya_funcs.I" #include "maya_funcs.I"
#endif #endif

View File

@ -0,0 +1,24 @@
// Filename: post_maya_include.h
// Created by: drose (11Apr02)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
// This header file works in conjunction with pre_maya_include.h; it
// cleans up some of the definitions that it left open.
// Remove the symbols defined from pre_maya_include.h.
#undef ostream
#undef istream

View File

@ -0,0 +1,35 @@
// Filename: pre_maya_include.h
// Created by: drose (11Apr02)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
// This header file defines a few things that are necessary to define
// before including any Maya headers, just to work around some of
// Maya's assumptions about the compiler. It must not try to protect
// itself from multiple inclusion with #ifdef .. #endif, since it must
// be used each time it is included.
// Maya will try to typedef bool unless this symbol is defined.
#ifndef _BOOL
#define _BOOL 1
#endif
// Maya tries to make a forward declaration for class ostream, but
// this is not necessarily a class! Curses. We can't use any of the
// built-in Maya stream operators, and we have to protect ourselves
// from them.
#define ostream maya_ostream
#define istream maya_istream