Panda3D
 All Classes Functions Variables Enumerations
mayaBlendDesc.cxx
00001 // Filename: mayaBlendDesc.cxx
00002 // Created by:  drose (10Feb04)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "mayaBlendDesc.h"
00016 #include "config_mayaegg.h"
00017 
00018 TypeHandle MayaBlendDesc::_type_handle;
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: MayaBlendDesc::Constructor
00022 //       Access: Public
00023 //  Description: 
00024 ////////////////////////////////////////////////////////////////////
00025 MayaBlendDesc::
00026 MayaBlendDesc(MFnBlendShapeDeformer &deformer, int weight_index) :
00027   _deformer(deformer.object()),
00028   _weight_index(weight_index)
00029 {
00030   ostringstream strm;
00031   strm << _deformer.name().asChar() << "." << _weight_index;
00032   set_name(strm.str());
00033 
00034   _anim = (EggSAnimData *)NULL;
00035 }
00036 
00037 ////////////////////////////////////////////////////////////////////
00038 //     Function: MayaBlendDesc::Destructor
00039 //       Access: Public
00040 //  Description: 
00041 ////////////////////////////////////////////////////////////////////
00042 MayaBlendDesc::
00043 ~MayaBlendDesc() {
00044 }
00045 
00046 ////////////////////////////////////////////////////////////////////
00047 //     Function: MayaBlendDesc::set_slider
00048 //       Access: Public
00049 //  Description: Moves the Maya slider associated with this blend
00050 //               shape to the indicated value.  This will move all the
00051 //               affected vertices.
00052 ////////////////////////////////////////////////////////////////////
00053 void MayaBlendDesc::
00054 set_slider(PN_stdfloat value) {
00055   MStatus status = _deformer.setWeight(_weight_index, value);
00056   if (!status) {
00057     mayaegg_cat.warning()
00058       << "Unable to set slider " << get_name() << "\n";
00059   }
00060 }
00061 
00062 ////////////////////////////////////////////////////////////////////
00063 //     Function: MayaBlendDesc::get_slider
00064 //       Access: Public
00065 //  Description: Returns the current position of the Maya slider
00066 //               associated with this blend shape.
00067 ////////////////////////////////////////////////////////////////////
00068 PN_stdfloat MayaBlendDesc::
00069 get_slider() const {
00070   return _deformer.weight(_weight_index);
00071 }
00072 
00073 ////////////////////////////////////////////////////////////////////
00074 //     Function: MayaBlendDesc::clear_egg
00075 //       Access: Private
00076 //  Description: Clears the egg pointers from this blend desc.
00077 ////////////////////////////////////////////////////////////////////
00078 void MayaBlendDesc::
00079 clear_egg() {
00080   _anim = (EggSAnimData *)NULL;
00081 }
 All Classes Functions Variables Enumerations