void exportCurve(MFnDagNode & theDagNode, WorldBuilderBase & theParentTransform, SceneBuilder & theSceneBuilder) { MAKE_SCOPE_TIMER(CurveExporter_exportCurve); if (theDagNode.isIntermediateObject()) { return; } string myCurveName = string(theDagNode.name().asChar()); DB(AC_TRACE << "Exporting curve: " << myCurveName << endl); MFnNurbsCurve myMCurve(theDagNode.object()); DB( cerr << "Number of cvs: " << myMCurve.numCVs() << endl; cerr << "Number of spans: " << myMCurve.numSpans() << endl; cerr << "Number of knots: " << myMCurve.numKnots() << endl; cerr << "Degree: " << myMCurve.degree() << endl; cerr << "Length: " << myMCurve.length() << endl; for (double d = 0.0; d <= 1.0; d += 0.1) { MPoint myPoint; myMCurve.getPointAtParam(d, myPoint); cerr << "Point at param " << d << ": " << myPoint.x << ", " << myPoint.y << ", " << myPoint.z << endl; } int myCvCount = myMCurve.numCVs(); for (int i = 0; i < myCvCount; ++i) { MPoint myPoint; myMCurve.getCV(i, myPoint); cerr << "CV " << i << ": " << myPoint.x << ", " << myPoint.y << ", " << myPoint.z << endl; } int myKnotCount = myMCurve.numKnots(); for (int i = 0; i < myKnotCount; ++i) { double knotParam; knotParam = myMCurve.knot(i); MPoint myPoint; myMCurve.getPointAtParam(knotParam, myPoint); cerr << "Point at knot# " << i << ": " << myPoint.x << ", " << myPoint.y << ", " << myPoint.z << endl; } )
bool polyExporter::isVisible(MFnDagNode & fnDag, MStatus& status) //Summary: determines if the given DAG node is currently visible //Args : fnDag - the DAG node to check //Returns: true if the node is visible; // false otherwise { if(fnDag.isIntermediateObject()) return false; MPlug visPlug = fnDag.findPlug("visibility", &status); if (MStatus::kFailure == status) { MGlobal::displayError("MPlug::findPlug"); return false; } else { bool visible; status = visPlug.getValue(visible); if (MStatus::kFailure == status) { MGlobal::displayError("MPlug::getValue"); } return visible; } }
bool IsVisible(MFnDagNode& node) { MStatus stat; if (node.isIntermediateObject()) return false; bool visibility = true; MFnDependencyNode depFn(node.object(), &stat); if (!stat) MGlobal::displayInfo("Problem getting dep from " + node.name()); if (!getBool(MString("visibility"), depFn, visibility)) MGlobal::displayInfo("Problem getting visibility attr from " + node.name()); if (!visibility) return false; getBool(MString("overrideVisibility"), depFn, visibility); if (!visibility) return false; return true; }
// -------------------------------------------------------------------- bool SceneGraph::getIsExportNode ( const MDagPath& dagPath, bool& isForced, bool& isVisible ) { // Does this dagPath already exist? If so, only recurse if FollowInstancedChildren() is set. MFnDagNode dagFn ( dagPath ); String dagNodeName = dagFn.name().asChar(); bool isSceneRoot = dagPath.length() == 0; // Ignore default and intermediate nodes (history items) bool isIntermediateObject = dagFn.isIntermediateObject(); if ( ( dagFn.isDefaultNode() && !isSceneRoot ) || isIntermediateObject ) { return false; } MString nodeName = dagPath.partialPathName(); if ( nodeName == MString ( NIMA_INTERNAL_PHYSIKS ) ) { // Skip this node, which is only used // by Nima as a work-around for a Maya bug. return false; } // If we are not already forcing this node, its children // check whether we should be forcing it (skinning of hidden joints). isForced = isForcedNode ( dagPath ); DagHelper::getPlugValue ( dagPath.node(), ATTR_VISIBILITY, isVisible ); bool isInstanced = dagPath.isInstanced(); uint instanceNumber = dagPath.instanceNumber(); if ( !isForced ) { // Check for visibility if ( !ExportOptions::exportInvisibleNodes() && !isVisible ) { // Check if the visibility of the element is animated. AnimationSampleCache* animationCache = mDocumentExporter->getAnimationCache(); if ( !AnimationHelper::isAnimated ( animationCache, dagPath.node(), ATTR_VISIBILITY ) ) { return false; } } else if ( !isVisible && !ExportOptions::exportDefaultCameras() ) { // Check for the default camera transform names. if ( nodeName == CAMERA_PERSP || nodeName == CAMERA_TOP || nodeName == CAMERA_SIDE || nodeName == CAMERA_FRONT || nodeName == CAMERA_PERSP_SHAPE || nodeName == CAMERA_TOP_SHAPE || nodeName == CAMERA_SIDE_SHAPE || nodeName == CAMERA_FRONT_SHAPE ) return false; } } isForced &= !isVisible; if ( !isForced ) { // We don't want to process manipulators if ( dagPath.hasFn ( MFn::kManipulator ) || dagPath.hasFn ( MFn::kViewManip ) ) return false; // Check for constraints which are not exported //if ( !ExportOptions::exportConstraints() && dagPath.hasFn ( MFn::kConstraint ) ) return false; if ( dagPath.hasFn ( MFn::kConstraint ) ) return false; // Check set membership exclusion/inclusion if ( SetHelper::isExcluded ( dagPath ) ) return false; } return true; }