void Renderer::write( /*const*/ liqRibShaveData* pData, const MString &ribFileName, const structJob ¤tJob, const bool bReference) { CM_TRACE_FUNC("Renderer::write("<<pData->getFullPathName()<<","<<ribFileName.asChar()<<","<<currentJob.name.asChar()<<",ref="<<bReference<<")"); assert(liqglo.m_ribFileOpen&&"rm_writeShaveData.cpp"); if( !bReference ){//write data at first time if( !currentJob.isShadow ){ assert(pData->getRibFileFullPath().length()==0&&"rm_writeShaveData.cpp"); } pData->setRibFileFullPath(ribFileName); //1)make a reference RiReadArchive( const_cast< RtToken >( pData->getRibFileFullPath().asChar() ), NULL, RI_NULL ); //2)call shave command to write the rib file(not support motion blur) MString cmd("shaveWriteRib -hairNode \""+pData->objDagPath.partialPathName()+"\" \""+pData->getRibFileFullPath()+"\";"); if( MFAIL(MGlobal::executeCommand(cmd, true) )){ liquidMessage2(messageError,"write shave rib file fail: [%s]", cmd.asChar()); } }else{ //write the reference assert(pData->getRibFileFullPath() == ribFileName); RiReadArchive( const_cast< RtToken >( pData->getRibFileFullPath().asChar() ), NULL, RI_NULL ); } }
static void makeCubes(std::vector<cube> &cubes, MString &name, MStatus *stat) { MFnMesh fnMesh; MObject result; MFloatPointArray points; MIntArray faceCounts; MIntArray faceConnects; int index_offset = 0; for (std::vector<cube>::iterator cit = cubes.begin(); cit != cubes.end(); ++cit) { point3 diag = cit->diagonal(); float scale = diag.x; point3 pos = cit->start + (diag * .5f); MFloatVector mpos(pos.x, pos.y, pos.z); addCube(scale, mpos, index_offset * (8), points, faceCounts, faceConnects); index_offset += 1; } unsigned int vtx_cnt = points.length(); unsigned int face_cnt = faceCounts.length(); MObject newMesh = fnMesh.create( /* numVertices */ vtx_cnt, /* numFaces */ face_cnt, points, faceCounts, faceConnects, MObject::kNullObj, stat); /* Harden all edges. */ int n_edges = fnMesh.numEdges(stat); for (int i = 0; i < n_edges; ++i) { fnMesh.setEdgeSmoothing(i, false); } fnMesh.cleanupEdgeSmoothing(); /* Must be called after editing edges. */ fnMesh.updateSurface(); /* Assign Shader. */ MSelectionList sel_list; if (!MFAIL(sel_list.add("initialShadingGroup"))) { MObject set_obj; sel_list.getDependNode(0, set_obj); MFnSet set(set_obj); set.addMember(newMesh); } /* Give it a swanky name. */ MFnDagNode parent(fnMesh.parent(0)); name = parent.setName("polyMengerSponge", false, stat); }
// // Deregister node to plugin // MStatus curveColliderLocator::Deregister(MFnPlugin& ioPlugin) { // Deregister the node // MStatus status = ioPlugin.deregisterNode(id); if (MFAIL(status)) return MReturnStatus(status, "Failed to deregister " MAYA_CURVECOLLIDERLOCATOR_NAME " locator"); else Registered = false; return status; }
void Renderer::generate_shavehair(liqRibNodePtr &ribNode__, liqRibShaveData* pData, const int degree) { CM_TRACE_FUNC("generate_pfxhair("<<ribNode__->getTransformNodeFullPath().asChar()<<")"); MStatus status; shaveAPI::HairInfo hairInfo; status = shaveAPI::exportAllHair(&hairInfo); if(MFAIL(status)){ liquidMessage2(messageError,"shaveAPI::exportAllHair(&hairInfo)=[%s]", status.errorString().asChar()); return; } //todo }
// // Register node to plugin // MStatus curveColliderLocator::Register(MFnPlugin& ioPlugin) { MStatus status = ioPlugin.registerNode(MAYA_CURVECOLLIDERLOCATOR_NAME, id, &creator, &initialize, MPxNode::kLocatorNode); if (!status) { status.perror("registerLocator"); } if (MFAIL(status)) return MReturnStatus(status, "Failed to register " MAYA_CURVECOLLIDERLOCATOR_NAME " locator"); else Registered = true; return status; }