Panda3D
mayaBlendDesc.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file mayaBlendDesc.cxx
10  * @author drose
11  * @date 2004-02-10
12  */
13 
14 #include "mayaBlendDesc.h"
15 #include "config_mayaegg.h"
16 
17 TypeHandle MayaBlendDesc::_type_handle;
18 
19 /**
20  *
21  */
22 MayaBlendDesc::
23 MayaBlendDesc(MFnBlendShapeDeformer &deformer, int weight_index) :
24  _deformer(deformer.object()),
25  _weight_index(weight_index)
26 {
27  std::ostringstream strm;
28  strm << _deformer.name().asChar() << "." << _weight_index;
29  set_name(strm.str());
30 
31  _anim = nullptr;
32 }
33 
34 /**
35  *
36  */
37 MayaBlendDesc::
38 ~MayaBlendDesc() {
39 }
40 
41 /**
42  * Moves the Maya slider associated with this blend shape to the indicated
43  * value. This will move all the affected vertices.
44  */
45 void MayaBlendDesc::
46 set_slider(PN_stdfloat value) {
47  MStatus status = _deformer.setWeight(_weight_index, value);
48  if (!status) {
49  mayaegg_cat.warning()
50  << "Unable to set slider " << get_name() << "\n";
51  }
52 }
53 
54 /**
55  * Returns the current position of the Maya slider associated with this blend
56  * shape.
57  */
58 PN_stdfloat MayaBlendDesc::
59 get_slider() const {
60  return _deformer.weight(_weight_index);
61 }
62 
63 /**
64  * Clears the egg pointers from this blend desc.
65  */
66 void MayaBlendDesc::
67 clear_egg() {
68  _anim = nullptr;
69 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_slider(PN_stdfloat value)
Moves the Maya slider associated with this blend shape to the indicated value.
PN_stdfloat get_slider() const
Returns the current position of the Maya slider associated with this blend shape.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81