沿着curve画cylinder
来源:互联网 发布:数据库第六版课后答案 编辑:程序博客网 时间:2024/04/30 02:29
画几条curve,选中,然后post1,沿着curve画出5个cylinder
#include <maya/MArgList.h>
#include <maya/MFnPlugin.h>
#include <maya/MPxCommand.h>
#include <maya/MString.h>
#include <maya/MDagPath.h>
#include <maya/MSelectionList.h>
#include <maya/MItSelectionList.h>
#include <maya/MGlobal.h>
#include <maya/MFnNurbsCurve.h>
#include <maya/MPoint.h>
// Use helper macro to register a command with Maya. It creates and
// registers a command that does not support undo or redo. The
// created class derives off of MPxCommand.
//
class Posts1Cmd : public MPxCommand
{
public:
virtual MStatus doIt( const MArgList& args );
static void *creator(){return new Posts1Cmd;}
};
MStatus Posts1Cmd ::doIt( const MArgList& args )
{
const int nPosts = 5;
const double radius = 0.5;
const double height = 0.5;
MSelectionList selection;
MGlobal::getActiveSelectionList(selection);
MDagPath dagPath;
MFnNurbsCurve curveFn;
double heightRatio = height / radius;
MItSelectionList iter(selection , MFn::kNurbsCurve);
for ( ; !iter.isDone(); iter.next() )
{
iter.getDagPath(dagPath);
curveFn.setObject(dagPath);
double tStart,tEnd;
curveFn.getKnotDomain(tStart, tEnd );
MPoint pt;
unsigned int i;
double t;
double tIncr = (tEnd - tStart )/(nPosts - 1 );
for ( i=0, t=tStart; i<nPosts; i++, t+=tIncr )
{
curveFn.getPointAtParam( t, pt, MSpace::kWorld);
pt.y += 0.5 * height;
MGlobal::executeCommand( MString("cylinder -pivot ") + pt.x + " " + pt.y + " " + pt.z + "-radius 0.5 -axis 0 1 0 -heightRatio " + heightRatio );
}
}
return MS::kSuccess;
}
MStatus initializePlugin(MObject obj)
{
MFnPlugin pluginFn(obj,"lijy","1.0");
MStatus stat;
stat = pluginFn.registerCommand("post1",Posts1Cmd::creator);
if(!stat)
stat.perror("registerCommand failed");
return stat;
}
MStatus uninitializePlugin(MObject obj)
{
MFnPlugin pluginFn(obj);
MStatus stat;
stat = pluginFn.deregisterCommand("post1");
if(!stat)
stat.perror("deregisterCommand failed");
return stat;
}
- 沿着curve画cylinder
- Cylinder
- Curve
- achartengine画柱状图沿着x轴移动不能沿着y轴移动 谁知道怎么弄啊???
- Tilt Cylinder
- Cylinder oj55
- Curve Fitting
- curve代码
- Learning Curve
- Curve Estimation
- ROC Curve
- drawing Curve
- Animation Curve
- Interpolate-Curve
- Curve Bezier
- FLASH中如何使一个物体沿着自己画的路径运动?
- 沿着,还是放弃...
- 沿着汕头的海岸线
- 期待自己做得越好
- 最强世界杯大片
- 写给自己
- windows ADAM
- flash全屏代码
- 沿着curve画cylinder
- usb-skeleton.c 之 01--首先整体欣赏欣赏usb-skeleton.c 多的了得!!
- WINDOWS下搭建LDAP服务器
- 新的开始
- Sicily 1252 Defining Moment(字符串递归)
- 夜,依旧寂寞心照不宣!
- paste in vim command line
- DSF
- ASPAJAXExtSetup.msi及AJAX Control TollKit安装包下载地址及安装方法