本文整理汇总了C++中MDagModifier::deleteNode方法的典型用法代码示例。如果您正苦于以下问题:C++ MDagModifier::deleteNode方法的具体用法?C++ MDagModifier::deleteNode怎么用?C++ MDagModifier::deleteNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDagModifier
的用法示例。
在下文中一共展示了MDagModifier::deleteNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HelixBase_RemoveAllAimConstraints
MStatus HelixBase_RemoveAllAimConstraints(MObject & helixBase, const char *type) {
MStatus status;
MFnDagNode this_dagNode(helixBase, &status);
if (!status) {
status.perror("MFnDagNode::#ctor");
return status;
}
unsigned int this_childCount = this_dagNode.childCount(&status);
bool foundAimConstraint = false;
MDagModifier dagModifier;
if (!status) {
status.perror("MFnDagNode::childCount");
return status;
}
for(unsigned int i = 0; i < this_childCount; ++i) {
MObject child_object = this_dagNode.child(i, &status);
if (!status) {
if (status == MStatus::kInvalidParameter) {
/*
* There seems to be a bug in Maya when opening an already existing file that nodes are reported to have children but the MFnDagNode::child will fail
*/
return MStatus::kSuccess;
}
status.perror("MFnDagNode::child");
return status;
}
MFnDagNode child_dagNode(child_object, &status);
if (!status) {
status.perror("MFnDagNode::#ctor");
return status;
}
if (child_dagNode.typeName() == "aimConstraint") {
foundAimConstraint = true;
//std::cerr << "Found an old aimconstraint to delete named: " << child_dagNode.name().asChar() << std::endl;
// DEBUG:
/*if (child_object.isNull()) {
std::cerr << "The object is null! terminating!" << std::endl;
return MStatus::kSuccess;
}*/
// This is the operation that crashes Maya when creating a "New scene"
if (!(status = dagModifier.deleteNode(child_object))) {
status.perror("MDagModifier::deleteNode");
return status;
}
}
}
// Execute deletion and reset transformation into translation only
if (foundAimConstraint) {
if (!(status = dagModifier.doIt())) {
status.perror("MDagModifier::doIt");
return status;
}
MFnTransform this_transform(helixBase, &status);
if (!status) {
status.perror("MFnTransform::#ctor");
return status;
}
double rotation[] = { 0.0, 0.0, 0.0 };
if (!(status = this_transform.setRotation(rotation, MTransformationMatrix::kXYZ))) {
status.perror("MFnTransform::setRotation");
return status;
}
}
return MStatus::kSuccess;
}
示例2: create
//.........这里部分代码省略.........
{
fnCamera.setFilmFit(MFnCamera::kOverscanFilmFit);
}
}
if (schema.isConstant())
{
// no center of interest
fnCamera.setFocalLength(samp.getFocalLength());
fnCamera.setLensSqueezeRatio(samp.getLensSqueezeRatio());
// camera scale might be in the 3x3
// weirdo attrs that are in inches
fnCamera.setHorizontalFilmAperture(samp.getHorizontalAperture()/2.54);
fnCamera.setVerticalFilmAperture(samp.getVerticalAperture()/2.54);
fnCamera.setHorizontalFilmOffset(samp.getHorizontalFilmOffset()/2.54);
fnCamera.setVerticalFilmOffset(samp.getVerticalFilmOffset()/2.54);
// film fit offset might be in the 3x3
if (samp.getOverScanLeft() == samp.getOverScanRight() &&
samp.getOverScanTop() == samp.getOverScanBottom() &&
samp.getOverScanLeft() == samp.getOverScanTop())
{
fnCamera.setOverscan(samp.getOverScanLeft() + 1.0);
}
else
{
MString warn = iNode.getName().c_str();
warn += " has unsupported overscan values.";
MGlobal::displayWarning(warn);
}
fnCamera.setNearClippingPlane(samp.getNearClippingPlane());
fnCamera.setFarClippingPlane(samp.getFarClippingPlane());
// prescale, film translate H, V, roll pivot H,V, film roll value
// post scale might be in the 3x3
fnCamera.setFStop(samp.getFStop());
fnCamera.setFocusDistance(samp.getFocusDistance());
MTime sec(1.0, MTime::kSeconds);
fnCamera.setShutterAngle(Alembic::AbcGeom::DegreesToRadians(
360.0 * (samp.getShutterClose()-samp.getShutterOpen()) *
sec.as(MTime::uiUnit()) ));
for (std::size_t i = 0; i < numOps; ++i)
{
Alembic::AbcGeom::FilmBackXformOp & op = samp[i];
if (op.getHint() == "filmFitOffs")
{
double val = op.getChannelValue(0) *
samp.getHorizontalAperture() / 5.08;
if (val != 0.0)
{
fnCamera.setFilmFitOffset(val);
}
else
{
fnCamera.setFilmFitOffset(op.getChannelValue(1) *
samp.getHorizontalAperture() / 5.08);
}
}
else if (op.getHint() == "preScale")
{
fnCamera.setPreScale(1.0/op.getChannelValue(0));
}
else if (op.getHint() == "filmTranslate")
{
fnCamera.setFilmTranslateH(op.getChannelValue(0));
fnCamera.setFilmTranslateV(op.getChannelValue(1));
}
else if (op.getHint() == "postScale")
{
fnCamera.setPostScale(1.0/op.getChannelValue(0));
}
else if (op.getHint() == "cameraScale")
{
fnCamera.setCameraScale(op.getChannelValue(0));
}
}
}
// extra transform node is unfortuneatly automatically created above the
// camera, let's do some reparenting and delete that extra transform
MDagPath path;
fnCamera.getPath(path);
MObject camObj = path.node();
MDagModifier dagMod;
dagMod.reparentNode(camObj, iParent);
dagMod.doIt();
dagMod.deleteNode(obj);
dagMod.doIt();
return camObj;
}