2
0
Эх сурвалжийг харах

first pass at (so far useless) mayapview plugin

David Rose 23 жил өмнө
parent
commit
fa9028eec6

+ 30 - 0
pandatool/src/mayaprogs/Sources.pp

@@ -66,3 +66,33 @@
     mayaCopy.cxx mayaCopy.h
     mayaCopy.cxx mayaCopy.h
 
 
 #end bin_target
 #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
+  

+ 60 - 0
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
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#include "pandaFramework.h"
+
+#include "pre_maya_include.h"
+#include <maya/MSimple.h>
+#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;
+}