// --------------------------------------------- // Extract information about the print job directly from the job // --------------------------------------------- DWORD CGreenPrintMonitorThread::JobPagesFromJobId( HANDLE hPrinter, DWORD JobId ) { DWORD JobPages = 0; BOOL IsSpooling = FALSE; DWORD SpoolingTime = 0; do { DWORD cbNeeded = 0; if ( !GetJob( hPrinter, JobId, 1, NULL, 0, &cbNeeded ) ) { JOB_INFO_1 *pJobInfo = (JOB_INFO_1 *)LocalAlloc( LMEM_ZEROINIT, cbNeeded ); if ( NULL != pJobInfo ) { if ( GetJob( hPrinter, JobId, 1, (LPBYTE)pJobInfo, cbNeeded, &cbNeeded ) ) { JobPages = pJobInfo->TotalPages; // --------------------------------------------- // Note: depending on the size of the document it can make minutes to entirely spool, // so we check the state before returning so we get an accurate page count // --------------------------------------------- IsSpooling = pJobInfo->Status & JOB_STATUS_SPOOLING; } LocalFree( pJobInfo ); pJobInfo = NULL; } } // --------------------------------------------- // We won't wait forever for a document to spool since we can't trust windows // --------------------------------------------- if ( IsSpooling ) { Sleep( 500 ); SpoolingTime += 500; } } while ( IsSpooling && SpoolingTime < ( MAX_SPOOLING_TIME_IN_MINS * ( 60 * 1000 ) ) ); return JobPages; }
int vMover::GetMaxOriginFatiguePoint( bool bOriginal ) { int nSta, nStr, nDex; if( bOriginal ) { nSta = m_nSta; nStr = m_nStr; nDex = m_nDex; } else { nSta = GetSta(); nStr = GetStr(); nDex = GetDex(); } if( IsPlayer() ) { JobProp* pProperty = g_prj.GetJobProp( GetJob() ); float factor = pProperty->fFactorMaxFP; return (int)( (((GetLevel()*2.0f) + (nSta*6.0f))*factor) + (nSta*factor) ); } return ( ( GetLevel() * 2 ) + ( nStr * 7 ) + ( nSta *2 ) + ( nDex * 4 ) ); }
int vMover::GetMaxOriginHitPoint( bool bOriginal ) { if( IsInvalidObj(this) ) return 0; if( IsPlayer() ) { int nSta; if( bOriginal ) nSta = m_nSta; else nSta = GetSta(); JobProp* pProperty = g_prj.GetJobProp( GetJob() ); float b = ( (pProperty->fFactorMaxHP * GetLevel() ) / 2.0f ) * ( ( GetLevel() + 1.0f ) / 4.0f ) * ( 1.0f + nSta / 50.0f ) + ( nSta * 10.0f ); return (int)b + (int)80.0f; } else { MoverProp* pMoverProp = g_prj.GetMoverProp( GetIndex() ); return int( pMoverProp->dwAddHp * g_prj.GetMonsterHitpointRate() * pMoverProp->m_fHitPoint_Rate ); } return 0; }
void* JobPoolWorker::Entry() { #ifdef LINUX XInitThreads(); #endif while ( true ) { // Did we get a request to terminate? if (TestDestroy()) break; Job *job = GetJob(); if (job) { // Call user's implementation for processing request ProcessJob(job); delete job; job = NULL; } else { wxMutexLocker mutLock(*lock); if (idleThreads > 5) { break; } } } wxMutexLocker mutLock(*lock); numThreads--; return NULL; }
// 保存数据 bool CPlayer::SaveData(google::protobuf::Message *pMsg) { // 没有加载数据的时候,不保存数据 if (!m_LoadDataSucc) return true; if (!pMsg) return false; if (PackData()) { svrData::LoadPlayerData *data = (svrData::LoadPlayerData *)pMsg; m_LastSaveTime = CTimer::GetTime(); data->set_account(GetAccount()); data->set_name(GetName()); data->set_nguid(GetGuid()); data->set_nsex(GetSex()); data->set_njob(GetJob()); data->set_nlevel(GetLevel()); data->set_ncreatetime(GetCreateTime()); data->set_nlogintime(GetLoginTime()); data->set_nmapid(GetMapID()); data->set_nx(GetNowPosX()); data->set_ny(GetNowPosY()); data->set_nz(GetNowPosZ()); data->set_data(g_Base64Data); return true; } return false; }
void* JobPoolWorker::Entry() { #ifdef LINUX XInitThreads(); #endif while ( !stopped ) { // Did we get a request to terminate? if (TestDestroy()) break; Job *job = GetJob(); if (job) { // Call user's implementation for processing request ProcessJob(job); if (job->DeleteWhenComplete()) { delete job; } job = NULL; } else { std::unique_lock<std::mutex> mutLock(*lock); if (idleThreads > 5) { break; } } } std::unique_lock<std::mutex> mutLock(*lock); numThreads--; return NULL; }
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- AlembicCurves::AlembicCurves(SceneNodePtr eNode, AlembicWriteJob *in_Job, Abc::OObject oParent) : AlembicObject(eNode, in_Job, oParent) { MObject nRef = GetRef(); MFnNurbsCurve node(nRef); MStatus status; MObject abcCurveId = node.attribute("abcCurveId", &status); if (status == MStatus::kSuccess) { const int cId = MPlug(nRef, abcCurveId).asInt(); if (cId != 0) { this->accumRef = AlembicCurveAccumulator::GetAccumulator(cId, nRef, eNode, in_Job, oParent); return; } } const bool animTS = (GetJob()->GetAnimatedTs() > 0); mObject = AbcG::OCurves(GetMyParent(), eNode->name, animTS); mSchema = mObject.getSchema(); // create all properties Abc::OCompoundProperty comp = mSchema.getArbGeomParams(); mRadiusProperty = Abc::OFloatArrayProperty(comp, ".radius", mSchema.getMetaData(), animTS); mColorProperty = Abc::OC4fArrayProperty(comp, ".color", mSchema.getMetaData(), animTS); mFaceIndexProperty = Abc::OInt32ArrayProperty(comp, ".face_index", mSchema.getMetaData(), animTS); mVertexIndexProperty = Abc::OInt32ArrayProperty( comp, ".vertex_index", mSchema.getMetaData(), animTS); mKnotVectorProperty = Abc::OFloatArrayProperty(comp, ".knot_vector", mSchema.getMetaData(), animTS); }
BOOL AbortThisJob( _In_ PLCMINIPORT pIniPort ) /*++ Tells if the job should be aborted. A job should be aborted if it has been deleted or it needs to be restarted. --*/ { BOOL bRet = FALSE; DWORD dwNeeded = 0; LPJOB_INFO_1 pJobInfo = NULL; dwNeeded = 0; GetJob(pIniPort->hPrinter, pIniPort->JobId, 1, NULL, 0, &dwNeeded); if ( GetLastError() != ERROR_INSUFFICIENT_BUFFER ) goto Done; pJobInfo = (LPJOB_INFO_1) AllocSplMem(dwNeeded); if ( !pJobInfo || !GetJob(pIniPort->hPrinter, pIniPort->JobId, 1, (LPBYTE)pJobInfo, dwNeeded, &dwNeeded)) goto Done; bRet = (pJobInfo->Status & JOB_STATUS_DELETING) || (pJobInfo->Status & JOB_STATUS_DELETED) || (pJobInfo->Status & JOB_STATUS_RESTART); Done: if ( pJobInfo ) FreeSplMem(pJobInfo); return bRet; }
AlembicHair::AlembicHair(SceneNodePtr eNode, AlembicWriteJob *in_Job, Abc::OObject oParent) : AlembicObject(eNode, in_Job, oParent) { const bool animTS = (GetJob()->GetAnimatedTs() > 0); mObject = AbcG::OCurves(GetMyParent(), eNode->name, animTS); mSchema = mObject.getSchema(); // create all properties mRadiusProperty = Abc::OFloatArrayProperty(mSchema, ".radius", mSchema.getMetaData(), animTS); mColorProperty = Abc::OC4fArrayProperty(mSchema, ".color", mSchema.getMetaData(), animTS); }
CStdString CInfoLoader::GetInfo(int info) { // Refresh if need be if (m_refreshTime < CTimeUtils::GetFrameTime() && !m_busy) { // queue up the job m_busy = true; CJobManager::GetInstance().AddJob(GetJob(), this); } if (m_busy) { return BusyInfo(info); } return TranslateInfo(info); }
/* * sig * * arguments: * int signo: the signal being sent * * returns: none * * This should handle signals sent to tsh. */ static void sig(int signo) { if(signo == SIGINT){ if(crpid>0) kill(-crpid,SIGINT); } else if(signo == SIGTSTP){ if(crpid>0){ kill(-crpid,SIGTSTP); AddJob(crpid, crName, "Stopped"); bgjobL* child = GetJob(crpid); printf("[%d] %s %s\n", child->jid, child->status, child->name); } } } /* sig */
int vMover::GetMaxOriginManaPoint( bool bOriginal ) { int nInt = 0; if( bOriginal ) nInt = m_nInt; else nInt = GetInt(); if( IsPlayer() ) { JobProp* pProperty = g_prj.GetJobProp( GetJob() ); float factor = pProperty->fFactorMaxMP; int nMaxMP = (int)( ((((GetLevel()*2.0f) + ( nInt*8.0f))*factor) + 22.0f)+( nInt*factor) ); return nMaxMP; } return ( ( GetLevel() * 2 ) + ( nInt * 8 ) + 22 ); }
uint32 FSimplygonRESTClient::Run() { while (SwarmTask->GetState() != SRS_ASSETDOWNLOADED) { switch (SwarmTask->GetState()) { case SRS_UNKNOWN: UploadAsset(TEXT("UE4_TEST"), SwarmTask->ZipFilePath); break; case SRS_FAILED: return 0; break; case SRS_ASSETUPLOADED: CreateJob(TEXT("UE4_TEST"), SwarmTask->InputAssetId); break; case SRS_JOBCREATED: UploadJobSettings(SwarmTask->JobId, SwarmTask->SplFilePath); break; case SRS_JOBSETTINGSUPLOADED: ProcessJob(SwarmTask->JobId); break; case SRS_JOBPROCESSING: GetJob(SwarmTask->JobId); break; case SRS_JOBPROCESSED: DownloadAsset(SwarmTask->OutputAssetId); break; case SRS_ASSETDOWNLOADED: break; } if (SwarmTask->GetState() == SRS_FAILED) { break; } FPlatformProcess::Sleep(0.5); } return 0; }
void Loop() // Main worker thread loop { Job job; UserThread * ut; #pragma warning(disable: 4127) while( true ){ {Lock lk( mutex ); while( !availableJobs ) // No available jobs condition_jobReady.wait( lk ); // Wait for a job to become ready do{ ut = userThreadGroup.Advance(lk); } // Get a UserThread from the circular list while( ut->Empty() ); // Make sure it has a job GetJob( ut, job, lk ); // Get a job } ut->Run( job, mutex ); // Run the job } #pragma warning(default: 4127) }
void Wait() { UserThread *ut = userThreadGroup.Current( mutex ); for( bool jobAvailable=true; jobAvailable; ) // Run every available job { Job job; {Lock lk( mutex ); // Find a job jobAvailable = !ut->Empty(); if( jobAvailable ) GetJob ( ut, job, lk ); else userThreadGroup.Deactivate( ut, lk ); // All jobs have been deployed, deactivate queue. } if( jobAvailable ) // Run the job ut->Run( job, mutex ); } while( !ut->Done() ) // Wait for worker threads to exit. boost::thread::yield(); userThreadGroup.Remove( ut, mutex ); }
void CView::OnFilePrint() { // get default print info CPrintInfo printInfo; ASSERT(printInfo.m_pPD != NULL); // must be set if (LOWORD(GetCurrentMessage()->wParam) == ID_FILE_PRINT_DIRECT) { CCommandLineInfo* pCmdInfo = AfxGetApp()->m_pCmdInfo; if (pCmdInfo != NULL) { if (pCmdInfo->m_nShellCommand == CCommandLineInfo::FilePrintTo) { printInfo.m_pPD->m_pd.hDC = ::CreateDC(pCmdInfo->m_strDriverName, pCmdInfo->m_strPrinterName, pCmdInfo->m_strPortName, NULL); if (printInfo.m_pPD->m_pd.hDC == NULL) { AfxMessageBox(AFX_IDP_FAILED_TO_START_PRINT); return; } } } printInfo.m_bDirect = TRUE; } if (OnPreparePrinting(&printInfo)) { // hDC must be set (did you remember to call DoPreparePrinting?) ASSERT(printInfo.m_pPD->m_pd.hDC != NULL); // gather file to print to if print-to-file selected CString strOutput; if (printInfo.m_pPD->m_pd.Flags & PD_PRINTTOFILE && !printInfo.m_bDocObject) { // construct CFileDialog for browsing CString strDef(MAKEINTRESOURCE(AFX_IDS_PRINTDEFAULTEXT)); CString strPrintDef(MAKEINTRESOURCE(AFX_IDS_PRINTDEFAULT)); CString strFilter(MAKEINTRESOURCE(AFX_IDS_PRINTFILTER)); CString strCaption(MAKEINTRESOURCE(AFX_IDS_PRINTCAPTION)); CFileDialog dlg(FALSE, strDef, strPrintDef, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, strFilter, NULL, 0); dlg.m_ofn.lpstrTitle = strCaption; if (dlg.DoModal() != IDOK) return; // set output device to resulting path name strOutput = dlg.GetPathName(); } // set up document info and start the document printing process CString strTitle; CDocument* pDoc = GetDocument(); if (pDoc != NULL) strTitle = pDoc->GetTitle(); else EnsureParentFrame()->GetWindowText(strTitle); DOCINFO docInfo; memset(&docInfo, 0, sizeof(DOCINFO)); docInfo.cbSize = sizeof(DOCINFO); docInfo.lpszDocName = strTitle; CString strPortName; if (strOutput.IsEmpty()) { docInfo.lpszOutput = NULL; strPortName = printInfo.m_pPD->GetPortName(); } else { docInfo.lpszOutput = strOutput; AfxGetFileTitle(strOutput, strPortName.GetBuffer(_MAX_PATH), _MAX_PATH); } // setup the printing DC CDC dcPrint; if (!printInfo.m_bDocObject) { dcPrint.Attach(printInfo.m_pPD->m_pd.hDC); // attach printer dc dcPrint.m_bPrinting = TRUE; } OnBeginPrinting(&dcPrint, &printInfo); if (!printInfo.m_bDocObject) dcPrint.SetAbortProc(_AfxAbortProc); // disable main window while printing & init printing status dialog // Store the Handle of the Window in a temp so that it can be enabled // once the printing is finished CWnd * hwndTemp = AfxGetMainWnd(); hwndTemp->EnableWindow(FALSE); CPrintingDialog dlgPrintStatus(this); CString strTemp; dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_DOCNAME, strTitle); dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_PRINTERNAME, printInfo.m_pPD->GetDeviceName()); dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_PORTNAME, strPortName); dlgPrintStatus.ShowWindow(SW_SHOW); dlgPrintStatus.UpdateWindow(); // start document printing process if (!printInfo.m_bDocObject) { printInfo.m_nJobNumber = dcPrint.StartDoc(&docInfo); if (printInfo.m_nJobNumber == SP_ERROR) { // enable main window before proceeding hwndTemp->EnableWindow(TRUE); // cleanup and show error message OnEndPrinting(&dcPrint, &printInfo); dlgPrintStatus.DestroyWindow(); dcPrint.Detach(); // will be cleaned up by CPrintInfo destructor AfxMessageBox(AFX_IDP_FAILED_TO_START_PRINT); return; } } // Guarantee values are in the valid range UINT nEndPage = printInfo.GetToPage(); UINT nStartPage = printInfo.GetFromPage(); if (nEndPage < printInfo.GetMinPage()) nEndPage = printInfo.GetMinPage(); if (nEndPage > printInfo.GetMaxPage()) nEndPage = printInfo.GetMaxPage(); if (nStartPage < printInfo.GetMinPage()) nStartPage = printInfo.GetMinPage(); if (nStartPage > printInfo.GetMaxPage()) nStartPage = printInfo.GetMaxPage(); int nStep = (nEndPage >= nStartPage) ? 1 : -1; nEndPage = (nEndPage == 0xffff) ? 0xffff : nEndPage + nStep; VERIFY(strTemp.LoadString(AFX_IDS_PRINTPAGENUM)); // If it's a doc object, we don't loop page-by-page // because doc objects don't support that kind of levity. BOOL bError = FALSE; if (printInfo.m_bDocObject) { OnPrepareDC(&dcPrint, &printInfo); OnPrint(&dcPrint, &printInfo); } else { // begin page printing loop for (printInfo.m_nCurPage = nStartPage; printInfo.m_nCurPage != nEndPage; printInfo.m_nCurPage += nStep) { OnPrepareDC(&dcPrint, &printInfo); // check for end of print if (!printInfo.m_bContinuePrinting) break; // write current page TCHAR szBuf[80]; ATL_CRT_ERRORCHECK_SPRINTF(_sntprintf_s(szBuf, _countof(szBuf), _countof(szBuf) - 1, strTemp, printInfo.m_nCurPage)); dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_PAGENUM, szBuf); // set up drawing rect to entire page (in logical coordinates) printInfo.m_rectDraw.SetRect(0, 0, dcPrint.GetDeviceCaps(HORZRES), dcPrint.GetDeviceCaps(VERTRES)); dcPrint.DPtoLP(&printInfo.m_rectDraw); // attempt to start the current page if (dcPrint.StartPage() < 0) { bError = TRUE; break; } // must call OnPrepareDC on newer versions of Windows because // StartPage now resets the device attributes. OnPrepareDC(&dcPrint, &printInfo); ASSERT(printInfo.m_bContinuePrinting); // page successfully started, so now render the page OnPrint(&dcPrint, &printInfo); // If the user restarts the job when it's spooling, all // subsequent calls to EndPage returns < 0. The first time // GetLastError returns ERROR_PRINT_CANCELLED if (dcPrint.EndPage() < 0 && (GetLastError()!= ERROR_SUCCESS)) { HANDLE hPrinter; if (!OpenPrinter(LPTSTR(printInfo.m_pPD->GetDeviceName().GetBuffer()), &hPrinter, NULL)) { bError = TRUE; break; } DWORD cBytesNeeded; if(!GetJob(hPrinter,printInfo.m_nJobNumber,1,NULL,0,&cBytesNeeded)) { if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) { bError = TRUE; break; } } JOB_INFO_1 *pJobInfo; if((pJobInfo = (JOB_INFO_1 *)malloc(cBytesNeeded))== NULL) { bError = TRUE; break; } DWORD cBytesUsed; BOOL bRet = GetJob(hPrinter,printInfo.m_nJobNumber,1,LPBYTE(pJobInfo),cBytesNeeded,&cBytesUsed); DWORD dwJobStatus = pJobInfo->Status; free(pJobInfo); pJobInfo = NULL; // if job status is restart, just continue if(!bRet || !(dwJobStatus & JOB_STATUS_RESTART) ) { bError = TRUE; break; } } if(!_AfxAbortProc(dcPrint.m_hDC, 0)) { bError = TRUE; break; } } } // cleanup document printing process if (!printInfo.m_bDocObject) { if (!bError) dcPrint.EndDoc(); else dcPrint.AbortDoc(); } hwndTemp->EnableWindow(); // enable main window OnEndPrinting(&dcPrint, &printInfo); // clean up after printing dlgPrintStatus.DestroyWindow(); dcPrint.Detach(); // will be cleaned up by CPrintInfo destructor } }
MStatus AlembicHair::Save(double time, unsigned int timeIndex, bool isFirstFrame) { ESS_PROFILE_SCOPE("AlembicHair::Save"); MStatus status; // access the geometry MFnPfxGeometry node(GetRef()); // save the metadata SaveMetaData(this); // save the attributes if (isFirstFrame) { Abc::OCompoundProperty cp; Abc::OCompoundProperty up; if (AttributesWriter::hasAnyAttr(node, *GetJob())) { cp = mSchema.getArbGeomParams(); up = mSchema.getUserProperties(); } mAttrs = AttributesWriterPtr( new AttributesWriter(cp, up, GetMyParent(), node, timeIndex, *GetJob()) ); } else { mAttrs->write(); } // prepare the bounding box Abc::Box3d bbox; // check if we have the global cache option const bool globalCache = GetJob()->GetOption(L"exportInGlobalSpace").asInt() > 0; MRenderLineArray mainLines, leafLines, flowerLines; node.getLineData(mainLines, leafLines, flowerLines, true, false, mNumSamples == 0, false, false, mNumSamples == 0, false, true, globalCache); // first we need to count the number of points unsigned int vertexCount = 0; for (unsigned int i = 0; i < (unsigned int)mainLines.length(); i++) { vertexCount += mainLines.renderLine(i, &status).getLine().length(); } mPosVec.resize(vertexCount); unsigned int offset = 0; if (mNumSamples == 0) { mNbVertices.resize((size_t)mainLines.length()); mRadiusVec.resize(vertexCount); mColorVec.resize(vertexCount); for (unsigned int i = 0; i < (unsigned int)mainLines.length(); i++) { const MRenderLine &line = mainLines.renderLine(i, &status); const MVectorArray &positions = line.getLine(); const MDoubleArray &radii = line.getWidth(); const MVectorArray &colors = line.getColor(); const MVectorArray &transparencies = line.getTransparency(); mNbVertices[i] = positions.length(); for (unsigned int j = 0; j < positions.length(); j++) { const MVector &opos = positions[j]; Imath::V3f &ipos = mPosVec[offset]; ipos.x = (float)opos.x; ipos.y = (float)opos.y; ipos.z = (float)opos.z; bbox.extendBy(Imath::V3d(ipos)); mRadiusVec[offset] = (float)radii[j]; const MVector &ocol = colors[j]; Imath::C4f &icol = mColorVec[offset]; icol.r = (float)ocol.x; icol.g = (float)ocol.y; icol.b = (float)ocol.z; icol.a = 1.0f - (float)transparencies[j].x; offset++; } } } else { for (unsigned int i = 0; i < (unsigned int)mainLines.length(); i++) { const MRenderLine &line = mainLines.renderLine(i, &status); const MVectorArray &positions = line.getLine(); for (unsigned int j = 0; j < positions.length(); j++) { const MVector &opos = positions[j]; Imath::V3f &ipos = mPosVec[offset]; ipos.x = (float)opos.x; ipos.y = (float)opos.y; ipos.z = (float)opos.z; bbox.extendBy(Imath::V3d(ipos)); offset++; } } } // store the positions to the samples mSample.setPositions(Abc::P3fArraySample(&mPosVec.front(), mPosVec.size())); mSample.setSelfBounds(bbox); if (mNumSamples == 0) { mSample.setCurvesNumVertices(Abc::Int32ArraySample(mNbVertices)); mSample.setWrap(AbcG::kNonPeriodic); mSample.setType(AbcG::kLinear); mRadiusProperty.set( Abc::FloatArraySample(&mRadiusVec.front(), mRadiusVec.size())); mColorProperty.set( Abc::C4fArraySample(&mColorVec.front(), mColorVec.size())); } // save the sample mSchema.set(mSample); mNumSamples++; return MStatus::kSuccess; }
MStatus AlembicCurves::Save(double time, unsigned int timeIndex, bool isFirstFrame) { ESS_PROFILE_SCOPE("AlembicCurves::Save"); if (this->accumRef.get() != 0) { accumRef->save(GetRef(), time); ++mNumSamples; return MStatus::kSuccess; } // access the geometry MFnNurbsCurve node(GetRef()); // save the metadata SaveMetaData(this); // save the attributes if (isFirstFrame) { Abc::OCompoundProperty cp; Abc::OCompoundProperty up; if (AttributesWriter::hasAnyAttr(node, *GetJob())) { cp = mSchema.getArbGeomParams(); up = mSchema.getUserProperties(); } mAttrs = AttributesWriterPtr( new AttributesWriter(cp, up, GetMyParent(), node, timeIndex, *GetJob()) ); } else { mAttrs->write(); } // prepare the bounding box Abc::Box3d bbox; // check if we have the global cache option const bool globalCache = GetJob()->GetOption(L"exportInGlobalSpace").asInt() > 0; Abc::M44f globalXfo; if (globalCache) { globalXfo = GetGlobalMatrix(GetRef()); } MPointArray positions; node.getCVs(positions); mPosVec.resize(positions.length()); for (unsigned int i = 0; i < positions.length(); i++) { const MPoint &outPos = positions[i]; Imath::V3f &inPos = mPosVec[i]; inPos.x = (float)outPos.x; inPos.y = (float)outPos.y; inPos.z = (float)outPos.z; if (globalCache) { globalXfo.multVecMatrix(inPos, inPos); } bbox.extendBy(inPos); } // store the positions to the samples mSample.setPositions(Abc::P3fArraySample(&mPosVec.front(), mPosVec.size())); mSample.setSelfBounds(bbox); if (mNumSamples == 0) { // knot vector! MDoubleArray knots; node.getKnots(knots); mKnotVec.resize(knots.length()); for (unsigned int i = 0; i < knots.length(); ++i) { mKnotVec[i] = (float)knots[i]; } mKnotVectorProperty.set(Abc::FloatArraySample(mKnotVec)); mNbVertices.push_back(node.numCVs()); mSample.setCurvesNumVertices(Abc::Int32ArraySample(mNbVertices)); if (node.form() == MFnNurbsCurve::kOpen) { mSample.setWrap(AbcG::kNonPeriodic); } else { mSample.setWrap(AbcG::kPeriodic); } if (node.degree() == 3) { mSample.setType(AbcG::kCubic); } else { mSample.setType(AbcG::kLinear); } MPlug widthPlug = node.findPlug("width"); if (!widthPlug.isNull()) { mRadiusVec.push_back(widthPlug.asFloat()); } else { mRadiusVec.push_back(1.0); } mRadiusProperty.set( Abc::FloatArraySample(&mRadiusVec.front(), mRadiusVec.size())); } // save the sample mSchema.set(mSample); mNumSamples++; return MStatus::kSuccess; }