From ccacdcd5bb523f9b896a120ae4e4ae4c8c8037a4 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 28 May 2008 20:43:52 +0000 Subject: [PATCH] whoops --- pandatool/src/maya/maya_funcs.T | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/pandatool/src/maya/maya_funcs.T b/pandatool/src/maya/maya_funcs.T index a22901cb27..04ecfab83f 100644 --- a/pandatool/src/maya/maya_funcs.T +++ b/pandatool/src/maya/maya_funcs.T @@ -3,3 +3,52 @@ // //////////////////////////////////////////////////////////////////// // +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////// +// Function: get_maya_attribute +// Description: A generic function to extract an attribute of some +// type from an MObject. This is used to implement +// get_bool_attribute(), etc. +//////////////////////////////////////////////////////////////////// +template +bool +get_maya_attribute(MObject &node, const string &attribute_name, + ValueType &value) { + bool status = false; + + MPlug plug; + if (get_maya_plug(node, attribute_name, plug)) { + status = plug.getValue(value); + } + + return status; +} + +//////////////////////////////////////////////////////////////////// +// Function: set_maya_attribute +// Description: A generic function to set an attribute of some +// type on an MObject. This is used to implement +// set_bool_attribute(), etc. +//////////////////////////////////////////////////////////////////// +template +bool +set_maya_attribute(MObject &node, const string &attribute_name, + ValueType &value) { + bool status = false; + + MPlug plug; + if (get_maya_plug(node, attribute_name, plug)) { + status = plug.setValue(value); + } + + return status; +}