int dump_flight_entry(BG_FlightRecorderRegistry_t* logregistry, uint64_t entry_num) { char scratch[1024]; char * buffer=scratch; size_t bufferSize=sizeof(scratch); size_t length = 0; const BG_FlightRecorderLog_t* logentry = &logregistry->flightlog[entry_num]; BG_FlightRecorderFormatter_t* fmt = &logregistry->flightformatter[logentry->id]; length = snprintf(buffer, bufferSize, "TB=%016lx %s:%-2d ", (LUS)logentry->timestamp, fmt->id_str, logentry->hwthread); bufferSize -= length; buffer += length; length = snprintf(buffer, bufferSize, "%6ld(%s)",(LUS)entry_num, logregistry->registryName); bufferSize -= length; buffer += length; //MHERE; switch(fmt->type) { case FLIGHTRECORDER_PRINTF: length = snprintf(buffer, bufferSize, fmt->formatString, logentry->data[0], logentry->data[1], logentry->data[2], logentry->data[3]); bufferSize -= length; buffer += length; break; case FLIGHTRECORDER_FUNC: fmt->formatFunction(bufferSize, buffer, logentry, fmt->anchorPtr); length = strlen(buffer); bufferSize -= length; buffer += length; break; default: MPRINT("fmt->type for flight recorder is invalid \n"); return -EINVAL; break; } MPRINT("%s\n",scratch); return 0; }
int dump_block(block_t *block) { int i = 0; MPRINT("block_size: %zd\n", block->block_size); for(i = 0; i < block->block_size; i++) { MPRINT("%02X", (uint8_t)(block->data[i])); } MPRINT("\n"); return 0; }
/** Push a control-plane message * * This function is called ONLY from the originating thread. * * @param[in] c the control structure * @param[in] rb the callers ring buffer for message allocation. * @param[in] id the ident of this message. * @param[in] data the data to write to the control plane * @param[in] data_size the size of the data to write to the control plane. * @return * - -2 on ring buffer full * - <0 on error * - 0 on success */ int fr_control_message_push(fr_control_t *c, fr_ring_buffer_t *rb, uint32_t id, void *data, size_t data_size) { fr_control_message_t *m; (void) talloc_get_type_abort(c, fr_control_t); MPRINT("CONTROL push aq %p\n", c->aq); /* * Get a message. If we can't get one, do garbage * collection. Get another, and if that fails, we're * done. */ m = fr_control_message_alloc(c, rb, id, data, data_size); if (!m) { (void) fr_control_gc(c, rb); m = fr_control_message_alloc(c, rb, id, data, data_size); if (!m) { fr_strerror_printf("Failed allocationg after GC"); return -2; } } if (!fr_atomic_queue_push(c->aq, m)) { m->status = FR_CONTROL_MESSAGE_DONE; fr_strerror_printf("Failed pushing message to atomic queue."); return -1; } return 0; }
//----------------------------------------------------------------- MStatus ByronsPolyTools::undoIt() //----------------------------------------------------------------- { MStatus status; if(CMDactionMode == 0 || CMDactionMode == 4 || CMDactionMode == 5 || CMDactionMode == 6 || operationMode == 0) { MPRINT("Mache BPT rueckgaengig") status = undoModifyPoly(); // MGlobal::setActiveSelectionList(origList); // MGlobal:: setComponentSelectionMask(undoMask); if( status == MS::kSuccess ) { setResult( "Undone BPT" ); } else { displayError( "Undo failed!" ); } } //in jedem Fall die Original selection und mask wiederherstellen MGlobal::setActiveSelectionList(origList); MGlobal:: setComponentSelectionMask(undoMask); return status; }
/** Pop control-plane message * * This function is called ONLY from the receiving thread. * * @param[in] aq the recipients atomic queue for control-plane messages * @param[out] p_id the ident of this message. * @param[in,out] data where the data is stored * @param[in] data_size the size of the buffer where we store the data. * @return * - <0 the size of the data we need to read the next message * - 0 this kevent is not for us. * - >0 the amount of data we've read */ ssize_t fr_control_message_pop(fr_atomic_queue_t *aq, uint32_t *p_id, void *data, size_t data_size) { uint8_t *p; fr_control_message_t *m; MPRINT("CONTROL pop aq %p\n", aq); if (!fr_atomic_queue_pop(aq, (void **) &m)) return 0; rad_assert(m->status == FR_CONTROL_MESSAGE_USED); /* * There isn't enough room to store the data, die. */ if (data_size < m->data_size) { fr_strerror_printf("Allocation size should be at least %zd", m->data_size); return -(m->data_size); } p = (uint8_t *) m; data_size = m->data_size; memcpy(data, p + sizeof(*m), data_size); m->status = FR_CONTROL_MESSAGE_DONE; *p_id = m->id; return data_size; }
void mudm_dumphex(unsigned char *dmpPtr, int len) { unsigned char temp[]=" "; int i=0; while (len >= 16) { // do 16 byte chunks MPRINT("%.16llx %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x \n", (long long unsigned int) dmpPtr,dmpPtr[0],dmpPtr[1],dmpPtr[2],dmpPtr[3],dmpPtr[4],dmpPtr[5],dmpPtr[6],dmpPtr[7], dmpPtr[8],dmpPtr[9],dmpPtr[10],dmpPtr[11],dmpPtr[12],dmpPtr[13],dmpPtr[14],dmpPtr[15]); dmpPtr +=16; len -= 16; } for (i=0;i<len;i++)temp[i]=dmpPtr[i]; if (0 != len) { // more to do MPRINT("%.16llx %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x \n", (long long unsigned int) dmpPtr,temp[0],temp[1],temp[2],temp[3],temp[4],temp[5],temp[6],temp[7], temp[8],temp[9],temp[10],temp[11],temp[12],temp[13],temp[14],temp[15]); } } //dumphex
/* Below we implement example from "help interp1" in octave 2.9.9 * xf=[0:0.05:10]; yf = sin(2*pi*xf/5); * xp=[0:10]; yp = sin(2*pi*xp/5); * lin=interp1(xp,yp,xf); */ int main (int argc, const char * argv[]) { int retval = vsip_init((void*)0); vsip_length N0 = 11; vsip_length N = 201; vsip_length M = 3; vsip_mview_f *yf = vsip_mcreate_f(M,N,VSIP_ROW,VSIP_MEM_NONE); vsip_vview_f *xf = vsip_vcreate_f(N,VSIP_MEM_NONE); vsip_vview_f *xp = vsip_vcreate_f(N0,VSIP_MEM_NONE); vsip_mview_f *yp = vsip_mcreate_f(M,N0,VSIP_COL,VSIP_MEM_NONE); vsip_vview_f *yp0 = vsip_mrowview_f(yp,0); vsip_vview_f *yp1 = vsip_mrowview_f(yp,1); vsip_vview_f *yp2 = vsip_mrowview_f(yp,2); vsip_vramp_f(0.0,1.0,xp); vsip_vramp_f(0.0,0.05,xf); vsip_svmul_f(2.0/5.0 * M_PI,xp,yp0); vsip_svadd_f(M_PI/8.0,yp0,yp1); vsip_svadd_f(M_PI/8.0,yp1,yp2); vsip_vsin_f(yp0,yp0); vsip_vsin_f(yp1,yp1); vsip_vsin_f(yp2,yp2); printf("xp = ");VPRINT(xp); printf("yp = ");MPRINT(yp); printf("xf = ");VPRINT(xf); vsip_minterp_linear_f(xp,yp,VSIP_ROW,xf,yf); printf("linear = "); MPRINT(yf); vsip_vdestroy_f(yp0); vsip_vdestroy_f(yp1); vsip_vdestroy_f(yp2); vsip_valldestroy_f(xf); vsip_valldestroy_f(xp); vsip_malldestroy_f(yp); vsip_malldestroy_f(yf); vsip_finalize((void*)0); return retval; }
//--------------------------------------------- void nodeRemovedCB(MObject& node, void* data) //--------------------------------------------- { //ptr umwandeln softTransformationToolCtx * ctxPtr = (softTransformationToolCtx*) data; if(ctxPtr->lastMesh.node() == node) { MPRINT("WARNUNG - MESH geloescht") ctxPtr->emergency = true; MGlobal::executeCommand("setToolTo selectSuperContext", false, false); } INVIS(MFnDependencyNode depNodeFn(node);)
//---------------------------------------------------------------------------- MStatus BPT_InsertVtx::compute(const MPlug& plug, MDataBlock& data) //---------------------------------------------------------------------------- { // FactoryWerte setzen // (hier ueueberall eventuell noch MCheck nutzen fueuer Debug wenn nueuetig) MStatus status; MDataHandle stateHandle = data.outputValue(state); if(stateHandle.asShort() == 1) { MDataHandle inMeshHandle = data.inputValue(IVinMesh); MDataHandle outMeshHandle = data.outputValue(IVoutMesh); // inMesh direkt an outMesh und MObject mesh an factory geben outMeshHandle.set(inMeshHandle.asMesh()); outMeshHandle.setClean(); } else { if( (plug == IVoutMesh) ) { if(meshDirty) { MPRINT("COMPLETE COMPUTE!!!!!!!!!!!!!!!!!!!!!!!!!!!") status = doCompleteCompute(data); INVIS(cout<<"MeshDirty ist "<<meshDirty<<endl;) meshDirty = false; INVIS(cout<<"--------------------------------"<<endl;) MFnDependencyNode depNodeFn(thisMObject()); INVIS(cout<<"---------------"<<endl;) INVIS(cout<<depNodeFn.name().asChar()<<endl;)
void dump_flightlog_leadup(BG_FlightRecorderRegistry_t* logregistry, uint64_t entry_num,uint64_t num2dump) { uint64_t i; uint64_t num_dumped=0; uint64_t logsize = logregistry->flightsize; MPRINT(" \n \n"); if (entry_num >= (num2dump -1)) { for (i=(entry_num - num2dump); i<=entry_num; i++) { dump_flight_entry(logregistry, i); num_dumped++; } } else { for (i=logsize-(num2dump-(entry_num + 1) ); i<logsize; i++) { dump_flight_entry(logregistry, i); num_dumped++; } for (i=0; i<=entry_num; i++) { dump_flight_entry(logregistry, i); num_dumped++; } } return; }
//----------------------------------------------------------------- MStatus ByronsPolyTools::redoIt() //----------------------------------------------------------------- { MStatus status; // Process the polyModifierCmd // if(CMDactionMode == 0 || CMDactionMode == 4 || CMDactionMode == 5 || CMDactionMode == 6 || operationMode == 0) { MPRINT("Mache BPT redo") status = redoModifyPoly(); // MSelectionList nullList; // MGlobal::setActiveSelectionList(nullList); if( status == MS::kSuccess ) { setResult( "Redone BPT" ); } else { displayError( "Redo failed. Your undo stack has been flushed." ); } } else { // Wenn mesh nicht veraendert wird, wird einfach so die Factory gerufen fBPTfty.redoFty(); setResult( "BPTOperation succeeded" ); } return status; }
uint64_t poll_pkt_message(struct my_context * mcontext,struct pkt_controls * pkt_ctls){ uint64_t unfreed_req_id = 0; int mudm_status_error=0; int refid_list_length = 0; uint64_t refid_list[NUM_REFID]; uint32_t error_list[NUM_REFID]; uint32_t ret_val[NUM_REFID]; uint64_t ref_desc_count = -1; uint64_t timestamp; struct pkt_descriptor * pktd = NULL; struct pkt_descriptor * last_in_pktd2repost_list = NULL; struct pkt_descriptor * last_in_pktd2free_list = NULL; struct pkt_descriptor * pktd2free_list = NULL; struct pkt_descriptor * pktd2repost_list = NULL; //if (NULL == pkt_ctls-> pkt_reqid_list) return 0; //checked before calling into here SPIN_LOCK(pkt_ctls->pkt_list_lock); pktd = pkt_ctls-> pkt_reqid_list; pkt_ctls-> pkt_reqid_list = NULL; //detach the list SPIN_UNLOCK(pkt_ctls->pkt_list_lock); if ( unlikely(NULL==pktd) ) return 0; // comment the next line out to cause job hang ref_desc_count = MUSPI_getHwDescCount (pkt_ctls ->IdToInjFifo); timestamp=GetTimeBase2(); while (pktd != NULL){ if (ref_desc_count >= pktd->desc_cnt){ MUDM_MU_PKT_PCOMP( &mcontext->mudm_hi_wrap_flight_recorder,pktd,pktd->ccontext,pktd->desc_cnt,pktd->req_id); if (pktd->req_id){ refid_list[refid_list_length]=pktd->req_id; pktd->req_id=0; error_list[refid_list_length]=pktd->error_val; pktd->error_val=0; refid_list_length++; } if (pktd2free_list){ last_in_pktd2free_list->next = pktd; pktd->prev = last_in_pktd2free_list; last_in_pktd2free_list = pktd; } else { pktd2free_list = pktd; last_in_pktd2free_list = pktd; pktd2free_list->prev = NULL; } pktd=pktd->next; last_in_pktd2free_list->next = NULL; //if the list saturates, return resources //and then send back refid list if ( unlikely(NUM_REFID==refid_list_length) ){ PRINT("FLUSHING: refid_list_length=%d \n", refid_list_length); SPIN_LOCK(pkt_ctls->pkt_list_lock); last_in_pktd2free_list->next = pkt_ctls->pkt_free_list; pkt_ctls->pkt_free_list = pktd2free_list; SPIN_UNLOCK(pkt_ctls->pkt_list_lock); pktd2free_list = NULL; mudm_status_error = (mcontext->status)( (void *) refid_list,error_list,mcontext->callback_context,ret_val,refid_list_length); mudm_status_error=0; refid_list_length=0; }//end of flushing the list } else {// NOT (ref_desc_count >= pktd->desc_cnt) if (pktd->req_id){ unfreed_req_id ++; } //96000000000ull is about 1 minute on a 1.6hz machine #define TOO_MANY_CYCLES 192000000000ull if ( likely(pktd->timestamp) ){ if ( unlikely( ( (timestamp - pktd->timestamp)> (TOO_MANY_CYCLES) ) && (timestamp > pktd->timestamp) ) ){ if (mcontext->StuckState==0){ uint64_t cycles_per_sec = microsec2cycles(mcontext->personality,1000000); uint64_t seconds_diff = (timestamp - pktd->timestamp)/cycles_per_sec; uint64_t num_uninjected_descriptors = log_injfifo_info (pktd->ccontext->injfifo_ctls,&mcontext->mudm_hi_wrap_flight_recorder,MUDMRAS_STUCK_INJ_RESETCOMPUTES); uint64_t entry_num = MUDM_STUCK_PKT(&mcontext->mudm_hi_wrap_flight_recorder,pktd->timestamp,timestamp,pktd->ccontext,pktd->req_id); MPRINT("num_uninjected_descriptors=%llu \n",(LLUS)num_uninjected_descriptors); MPRINT("STUCK pktd=%p timestamp=%llx pktd->timestamp=%llx pktd->desc_cnt=%llu ref_desc_count=%llu req_id=%llx\n",pktd,(LLUS)timestamp, (LLUS)pktd->timestamp,(LLUS)pktd->desc_cnt,(LLUS)ref_desc_count,(LLUS)pktd->req_id ); MPRINT("STUCKTIME=%llu (seconds) \n", (LLUS)seconds_diff); dump_flightlog_leadup(&mcontext->mudm_hi_wrap_flight_recorder, entry_num,10); dump_ccontext_info(pktd->ccontext); mcontext->StuckState = 1; //extra dumping at free time //! \todo TODO fix RAS info for stuck packet MUDM_RASBEGIN(5); MUDM_RASPUSH((uint64_t)pktd) MUDM_RASPUSH(timestamp) MUDM_RASPUSH(pktd->timestamp) MUDM_RASPUSH(pktd->desc_cnt) MUDM_RASPUSH(ref_desc_count) MUDM_RASFINAL(MUDMRAS_STUCK_PKT); }//end of dumping info for stuck packet pktd->timestamp = 0; } } if (pktd2repost_list){ last_in_pktd2repost_list->next = pktd; pktd->prev = last_in_pktd2repost_list; last_in_pktd2repost_list = pktd; } else{ pktd2repost_list = pktd; last_in_pktd2repost_list = pktd; pktd->prev=NULL; } pktd=pktd->next; last_in_pktd2repost_list->next=NULL; }//endofelse }//endwhile if (pktd2free_list){ PRINT("FLUSHING: refid_list_length=%d \n", refid_list_length); SPIN_LOCK(pkt_ctls->pkt_list_lock); last_in_pktd2free_list->next = pkt_ctls->pkt_free_list; pkt_ctls->pkt_free_list = pktd2free_list; SPIN_UNLOCK(pkt_ctls->pkt_list_lock); } if (pktd2repost_list){ SPIN_LOCK(pkt_ctls->pkt_list_lock); last_in_pktd2repost_list->next = pkt_ctls-> pkt_reqid_list; pkt_ctls-> pkt_reqid_list = pktd2repost_list; SPIN_UNLOCK(pkt_ctls->pkt_list_lock); } if (refid_list_length){ mudm_status_error = (mcontext->status)( (void *) refid_list,error_list,mcontext->callback_context,ret_val,refid_list_length); } if ( unlikely(mudm_status_error !=0) ){ int i=0; for (i=0;i<refid_list_length;i++){ if (ret_val[i])MPRINT("mudm_status_error i=%d refid_list[i]=%p ret_val[i]=%llx \n",i,(void *)refid_list[i],(LLUS)ret_val[i]); } } return unfreed_req_id; }
~CheckNode() { MPRINT("CheckNode 0x%x destroyed\n", this); }
int mlog_reverse_process(struct mlog_handle *loghandle, mlog_cb_t cb, void *data, void *catdata) { struct mlog_log_hdr *mlh = loghandle->mgh_hdr; struct mlog_process_cat_data *cd = catdata; void *buf = NULL; int ret = 0, first_index = 1, index, idx; MENTRY(); MTFS_ALLOC(buf, MLOG_CHUNK_SIZE); if (buf == NULL) { ret = -ENOMEM; goto out; } if (cd != NULL) first_index = cd->mpcd_first_idx + 1; if (cd != NULL && cd->mpcd_last_idx) index = cd->mpcd_last_idx; else index = MLOG_BITMAP_BYTES * 8 - 1; while (ret == 0) { struct mlog_rec_hdr *rec; struct mlog_rec_tail *tail; /* skip records not set in bitmap */ while (index >= first_index && !ext2_test_bit(index, mlh->mlh_bitmap)) --index; MASSERT(index >= first_index - 1); if (index == first_index - 1) break; /* get the buf with our target record; avoid old garbage */ memset(buf, 0, MLOG_CHUNK_SIZE); ret = mlog_prev_block(loghandle, index, buf, MLOG_CHUNK_SIZE); if (ret) { goto out_free; } rec = buf; idx = le32_to_cpu(rec->mrh_index); if (idx < index) MDEBUG("index %u : idx %u\n", index, idx); while (idx < index) { rec = ((void *)rec + le32_to_cpu(rec->mrh_len)); idx ++; } tail = (void *)rec + le32_to_cpu(rec->mrh_len) - sizeof(*tail); /* process records in buffer, starting where we found one */ while ((void *)tail > buf) { rec = (void *)tail - le32_to_cpu(tail->mrt_len) + sizeof(*tail); if (rec->mrh_index == 0) { /* no more records */ ret = 0; goto out_free; } /* if set, process the callback on this record */ if (ext2_test_bit(index, mlh->mlh_bitmap)) { ret = cb(loghandle, rec, data); if (ret == MLOG_PROC_BREAK) { MPRINT("recovery from log: %llx:%x" " stopped\n", loghandle->mgh_id.mgl_oid, loghandle->mgh_id.mgl_ogen); goto out_free; } if (ret) { goto out_free; } } /* previous record, still in buffer? */ --index; if (index < first_index) { ret = 0; goto out_free; } tail = (void *)rec - sizeof(*tail); } } out_free: MTFS_FREE(buf, MLOG_CHUNK_SIZE); out: MRETURN(ret); }
BusQueue::~BusQueue() { MPRINT("BusQueue 0x%x destroyed\n", this); free(inst_name); slot->unref(); }
BusSlot::~BusSlot() { MPRINT("BusSlot 0x%x destroyed\n", this); }
/* * Return 1 if matched, return 0 if not. * Reutrn -errno if error. */ static int mtfs_parse_kallsyms(char *line, const char *module_name, const char *symbol_name, unsigned long *address) { int ret = 0; int word_num = 0; unsigned long tmp_address = 0; char *word = NULL; char *endp = NULL; char *next_word = line; char *symbol = NULL; char *tmp_module_name = NULL; while ((word = strsep(&next_word, " "))) { if (!*word) { MERROR("empty word: %s\n", line); ret = -EINVAL; continue; } word_num++; if (word_num > 3) { MERROR("more words than expected: %s\n", line); ret = -EINVAL; break; } if (word_num == 1) { tmp_address = mtfs_strtoul(word, &endp, 16); if (*endp != '\0' && !isspace((unsigned char)*endp)) { MERROR("invalid address, number expected: %s\n", line); ret = -EINVAL; break; } } else if (word_num == 3) { symbol = word; for (endp = symbol; *endp != '\0'; endp++) { /* There might be */ if (*endp == '\t') { *endp = '\0'; tmp_module_name = endp + 1; break; } } if (tmp_module_name) { if (*tmp_module_name != '[') { MERROR("invalid module name, should start with [: %s\n", line); ret = -EINVAL; break; } tmp_module_name++; for (endp = tmp_module_name; *endp != '\0'; endp++); endp--; if (endp <= tmp_module_name || *endp != ']') { MERROR("invalid module name, should end with ]: %s\n", line); ret = -EINVAL; break; } *endp = '\0'; } if (module_name) { if (!tmp_module_name || strcmp(module_name, tmp_module_name)) { continue; } } if (strcmp(symbol_name, symbol) == 0) { ret = 1; *address = tmp_address; break; } } } MPRINT("%016lx%s\n", tmp_address, symbol); return ret; }
//---------------------------------------------------------------------------- MStatus BPT_InsertVtx::doCompleteCompute( MDataBlock& data ) //---------------------------------------------------------------------------- { SPEED("Berechne EdgeSplit neu: "); MStatus status; MPRINT("MACHE KOMPLETTE BERECHNUNG") MDataHandle inMeshHandle = data.inputValue(IVinMesh); MDataHandle outMeshHandle = data.outputValue(IVoutMesh); //splitCount setzen MDataHandle countHandle = data.inputValue(IVcount); fIVfty.setCount(countHandle.asInt()); MDataHandle spinHandle = data.inputValue(IVspin); fIVfty.setSpin(spinHandle.asInt()); int initialVtxCount; //wird spueueter benueuetigt, um das ValidIndicesArray gleich in der rictigen grueueueuee zu erstellen und zu schreiben //gleich zu beginn muss der MeshPath initialisiert werden, damit der MeshPath an die fty ueuebergeben werden kann // Dies geschieht besser durch die STE - sie ist darauf ausgelegt softTransformationEngine::gatherAttributeObjects(thisMObject()); softTransformationEngine::saveMeshPathes(); fIVfty.setMeshPath(meshPath); MDataHandle rHandle = data.inputValue(IVslideRelative); fIVfty.setRelative(rHandle.asInt()); MDataHandle nRelativeHandle = data.inputValue(IVnormalRelative); fIVfty.setNormalRelative(nRelativeHandle.asInt()); //selection setzen MFnIntArrayData intDataArray; MDataHandle arrayHandle = data.inputValue(IVselEdgeIDs); intDataArray.setObject(arrayHandle.data()); fIVfty.setEdgeIDs( intDataArray.array() ); arrayHandle = data.inputValue(IVselVertIDs); intDataArray.setObject(arrayHandle.data()); fIVfty.setVertIDs(intDataArray.array()); // optionen holen arrayHandle = data.inputValue(IVoptions); intDataArray.setObject(arrayHandle.data()); MIntArray optionsArray(intDataArray.array()); fIVfty.setOptions(optionsArray); MDataHandle slideHandle = data.inputValue(IVslide); fIVfty.setSlide(slideHandle.asDouble()); //whichSide attribute wird nur fueuer SLide selbst verwendet und kann nicht bereits beim command gestetzt werden MObject inMeshRef = inMeshHandle.asMesh(); fIVfty.setMesh(inMeshRef); MFnMesh meshFn(inMeshHandle.asMesh()); initialVtxCount = meshFn.numVertices(); //ACTION try { status = fIVfty.doIt(); } catch(...) { MGlobal::displayError(" An unknown, severe, error occoured.\nIf it happens again in this situation, please write a bug report.\nPlease undo the operation and save your work!"); return MS::kUnknownParameter; } MObject newOutMesh = fIVfty.getMesh(); outMeshHandle.set(newOutMesh); // --------------------- // SOFT TRANSFORMATION // --------------------- // VtxSet setzen - hier reicht es, wenn er einfach die neuen Vtx nimmt softTransformationEngine::setVtxSet(data); //------------SELECTION ROUTINE---------------------- //nur wenn sich spin nicht verueuendert hat, darf ne neue selection gemacht werden - dies wird auch von der IV berueuecksichtigt //die selection wird nur noch einmal ausgefueuehrt, weshalb scriptJobInitiated nicht mehr gesetzt wird vom scriptjob if( optionsArray[6] && !scriptJobInitated && !(meshPath.apiType() == MFn::kInvalid) ) { //auf jeden Fall erstmal die neuen Vertizen holen, damit die anderen prozeduren auch darauf arbeiten kueuennen //alles neuen Vertces sollen gewueuehlt werden, also einfach alle Indices eintragen vom initialVtxCount //bis zum jetzigen VtxCount MIntArray validEdges, validFaces; componentConverter CC(newOutMesh); int i = 0; meshFn.setObject(newOutMesh); int newCount = meshFn.numVertices(); validIndices.clear(); validIndices.setLength(newCount - initialVtxCount); for(; initialVtxCount < newCount; initialVtxCount++) validIndices[i++] = initialVtxCount; if(optionsArray[6] == 1 || optionsArray[6] == 2) //select edges { CC.getContainedEdges(validIndices,validEdges); } BPT_Helpers helper; if(optionsArray[6] == 2) //select Faces { CC.getConnectedFaces(validEdges,validFaces); //jetzt kann gleich alles beendet werden, da hiernach keine componente mehr kommt, in die man faces umwandeln mueuesste validIndices.clear(); validIndices.append(2); helper.addIntArrayToLHS(validIndices,validFaces); } if(optionsArray[6] == 1) {//edges fertigmachen validIndices.clear(); validIndices.append(1); helper.addIntArrayToLHS(validIndices,validEdges); } else if(optionsArray[6] == 5) validIndices.insert(3,0); //component Mode umschalten bei bedarf if(optionsArray[5]) { MSelectionMask::SelectionType type = MSelectionMask::kSelectMeshVerts; if(optionsArray[6] == 5) { type = MSelectionMask::kSelectMeshVerts; } else if(optionsArray[6] == 2) { type = MSelectionMask::kSelectMeshFaces; } else if(optionsArray[6] == 1) { type = MSelectionMask::kSelectMeshEdges; } MSelectionMask mask(type); MGlobal:: setComponentSelectionMask(mask); } eID = MEventMessage::addEventCallback("idle",IV_makeSelection,this); scriptJobInitated = true; } else {//ansonsten muss die SelectionList neu aufgebaut werden, allerdings ohne komponenten //diese Aktion solte auch nur einmal ausgefueuehrt werden //gegenwueuertige selection holen MSelectionList currentList; MSelectionList newList; MGlobal::getActiveSelectionList(currentList); //durch die Liste iterieren und Komponenten Filtern MItSelectionList selIter(currentList); MObject currentObj; for( ; !selIter.isDone();selIter.next() ) { selIter.getDependNode(currentObj); newList.add(currentObj); } MGlobal::setActiveSelectionList(newList, MGlobal::kAddToList); } return status; }
MStatus BPTfty_NH::doIt() { SPEED(" MACHE NON- TOPO - CHANGE AKTION "); switch(mode) { case 1: { //erstmal alle Edges holen MIntArray allEdges; MIntArray edgeLoops; //enthält die fertige EL auswahl zum anwählen // cout<<"MAIN: "<<"hole alle edgeIndices"<<endl; getAllEdgeIndices(allEdges); // cout<<"MAIN: "<<"finde edgeLoops"<<endl; findEdgeLoops(allEdges,edgeLoops); // cout<<"MAIN: "<<"Wähle Komponenten an"<<endl; selectComponents(edgeLoops,"edges"); switchComponentModeIfNeeded(); break; } //edgeRing auswählen case 2: { MIntArray allEdges; MIntArray edgeRings; // cout<<"MAIN: "<<"hole alle edgeIndices"<<endl; getAllEdgeIndices(allEdges); // cout<<"MAIN: "<<"finde edgeRings"<<endl; findEdgeRings(allEdges,edgeRings); // cout<<"MAIN: "<<"Wähle Komponenten an"<<endl; selectComponents(edgeRings,"edges"); switchComponentModeIfNeeded(); break; } //boundary erstellen case 3: { MStatus status; MItMeshPolygon polyIter(fMesh,&status); convertAllToFaces(polyIDs,vertIDs,edgeIDs); INVIS(if(status == MS::kFailure)) INVIS(cout <<"FEHLER, fMesh ist nicht angekommen in fty"<<endl;) MIntArray EdgeTmp; //invertSelection(polyIDs, polyIter.count(),inverted); faceGetContainedEdgeIndices(polyIDs, EdgeTmp); //faceGetContainedEdgeIndices(inverted, Edge2Tmp); MIntArray outline; helper.memoryPrune(EdgeTmp,outline); //outline finalisieren durch : allEdges - inner edges (in outline momentan) helper.memoryArrayRemove(EdgeTmp,outline); selectComponents(EdgeTmp,"edges"); //selectComponents(memoryMatch(EdgeTmp,Edge2Tmp),"edges"); switchComponentModeIfNeeded(); break; } case 7: { MPRINT("WILL GROWEN") SPEED(" GROWING "); MItMeshVertex vertIter(fMesh); MItMeshPolygon polyIter(fMesh); MItMeshEdge edgeIter(fMesh); if(vertIDs.length() != 0) { growVtxSelection(vertIDs,vertIter,polyIter, true); } else if(edgeIDs.length() != 0) { growEdgeSelection(edgeIDs,edgeIter,0); } else if(polyIDs.length() != 0) {//jetzt muss faceIDs an der reihe sein, da ja eine auswahl vorhanden sein muss, wenn er in fty ist //->diese auswahl koennen aber auch UVs sein growFaceSelection(polyIDs,edgeIter,polyIter.count()); } break; } case 8: { MPRINT("will shrinken") SPEED(" SHRINKING "); MItMeshVertex vertIter(fMesh); MItMeshPolygon polyIter(fMesh); MItMeshEdge edgeIter(fMesh); MIntArray allVtx; if(vertIDs.length() != 0) { schrinkVtxSelection(vertIDs,vertIter,polyIter, true); } else if(edgeIDs.length() != 0) { shrinkEdgeSelection(edgeIDs,edgeIter,polyIter.count()); } else if(polyIDs.length() != 0) {//jetzt muss faceIDs an der reihe sein, da ja eine auswahl vorhanden sein muss, wenn er in fty ist shrinkFaceSelection(polyIDs,edgeIter,polyIter.count()); } break; } }