From fa9028eec6bcc963bad41fe6b7b5827903a9b03e Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 11 Mar 2003 02:29:31 +0000 Subject: [PATCH] first pass at (so far useless) mayapview plugin --- pandatool/src/mayaprogs/Sources.pp | 30 ++++++++++++++ pandatool/src/mayaprogs/mayaPview.cxx | 60 +++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100755 pandatool/src/mayaprogs/mayaPview.cxx diff --git a/pandatool/src/mayaprogs/Sources.pp b/pandatool/src/mayaprogs/Sources.pp index 345a077f44..0affbed85f 100644 --- a/pandatool/src/mayaprogs/Sources.pp +++ b/pandatool/src/mayaprogs/Sources.pp @@ -66,3 +66,33 @@ mayaCopy.cxx mayaCopy.h #end bin_target + + +#begin lib_target + #define USE_PACKAGES maya + #define TARGET mayapview + #define LOCAL_LIBS mayaegg maya + #define OTHER_LIBS \ + egg:c pandaegg:m \ + framework: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 \ + m + + #if $[WINDOWS_PLATFORM] + // Explicitly export the maya initialize and shutdown functions. + #define LINKER_FLAGS $[LINKER_FLAGS] /export:initializePlugin /export:uninitializePlugin + // On Windows, Maya expects its plugins to be named with a .mll + // extension, but it's a perfectly normal dll otherwise. This + // ppremake hack achieves that filename. + #define dlllib mll + #endif + + #define SOURCES \ + mayaPview.cxx + +#end lib_target + \ No newline at end of file diff --git a/pandatool/src/mayaprogs/mayaPview.cxx b/pandatool/src/mayaprogs/mayaPview.cxx new file mode 100755 index 0000000000..39aeb7d8c2 --- /dev/null +++ b/pandatool/src/mayaprogs/mayaPview.cxx @@ -0,0 +1,60 @@ +// Filename: mayaPview.cxx +// Created by: drose (10Mar03) +// +//////////////////////////////////////////////////////////////////// +// +// 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 . +// +//////////////////////////////////////////////////////////////////// + +#include "pandaFramework.h" + +#include "pre_maya_include.h" +#include +#include "post_maya_include.h" + +static PandaFramework framework; +static bool opened_framework = false; + +// This Maya macro sets up a class that meets the plug-in requirements +// for a simple command. +DeclareSimpleCommand(MayaPview, "VR Studio", "1.0"); + +MStatus MayaPview:: +doIt(const MArgList &) { + if (!opened_framework) { + int argc = 0; + char **argv = NULL; + framework.open_framework(argc, argv); + framework.set_window_title("Panda Viewer"); + framework.enable_default_keys(); + } + + WindowFramework *window = framework.open_window(); + if (window == (WindowFramework *)NULL) { + // Couldn't open a window. + nout << "Couldn't open a window!\n"; + return MS::kFailure; + } + + // We've successfully opened a window. + + window->enable_keyboard(); + window->setup_trackball(); + + window->load_default_model(framework.get_models()); + window->loop_animations(); + + framework.clear_exit_flag(); + framework.main_loop(); + return MS::kSuccess; +}