当前位置: 首页>>代码示例>>C++>>正文


C++ MDagModifier::deleteNode方法代码示例

本文整理汇总了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;
	}
开发者ID:andreaforapani,项目名称:vHelix,代码行数:85,代码来源:Utility.cpp

示例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;
}
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:101,代码来源:CameraHelper.cpp


注:本文中的MDagModifier::deleteNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。