//----------------------------------------------------------------------------- // addObject() //----------------------------------------------------------------------------- BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) { // object->extractAttachmentItemID(); // Same object reattached if (isObjectAttached(object)) { LL_INFOS() << "(same object re-attached)" << LL_ENDL; LL_INFOS("Attachment") << object->getID() << " ("<<object->getAttachmentPointName()<<") OBJECT re-attached" << LL_ENDL; removeObject(object); // Pass through anyway to let setupDrawable() // re-connect object to the joint correctly } // [SL:KB] - Patch: Appearance-Misc | Checked: Catznip-3.0.0a (2011-01-13) | Added: Catznip-2.4.0h // LLViewerJointAttachment::removeObject() sets the object's item to the NULL UUID so we need to extract it *after* the block above object->extractAttachmentItemID(); // [/SL:KB] // Two instances of the same inventory item attached -- // Request detach, and kill the object in the meantime. if (getAttachedObject(object->getAttachmentItemID())) { LL_INFOS() << "(same object re-attached)" << LL_ENDL; LL_INFOS("Attachment") << object->getID() << " ("<<object->getAttachmentPointName()<<") ITEM re-attached" << LL_ENDL; object->markDead(); // If this happens to be attached to self, then detach. LLVOAvatarSelf::detachAttachmentIntoInventory(object->getAttachmentItemID()); return FALSE; } mAttachedObjects.push_back(object); setupDrawable(object); if (mIsHUDAttachment) { if (object->mText.notNull()) { object->mText->setOnHUDAttachment(TRUE); } LLViewerObject::const_child_list_t& child_list = object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); iter != child_list.end(); ++iter) { LLViewerObject* childp = *iter; if (childp && childp->mText.notNull()) { childp->mText->setOnHUDAttachment(TRUE); } } } calcLOD(); mUpdateXform = TRUE; return TRUE; }
//----------------------------------------------------------------------------- // addObject() //----------------------------------------------------------------------------- BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) { object->extractAttachmentItemID(); if (isObjectAttached(object)) { llinfos << "(same object re-attached)" << llendl; removeObject(object); // Pass through anyway to let setupDrawable() // re-connect object to the joint correctly } // Two instances of the same inventory item attached -- // Request detach, and kill the object in the meantime. if (getAttachedObject(object->getAttachmentItemID())) { llinfos << "(same object re-attached)" << llendl; object->markDead(); // If this happens to be attached to self, then detach. LLVOAvatar::detachAttachmentIntoInventory(object->getAttachmentItemID()); return FALSE; } mAttachedObjects.push_back(object); setupDrawable(object); if (mIsHUDAttachment) { if (object->mText.notNull()) { object->mText->setOnHUDAttachment(TRUE); } LLViewerObject::const_child_list_t& child_list = object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); iter != child_list.end(); ++iter) { LLViewerObject* childp = *iter; if (childp && childp->mText.notNull()) { childp->mText->setOnHUDAttachment(TRUE); } } } calcLOD(); mUpdateXform = TRUE; return TRUE; }
//----------------------------------------------------------------------------- // addObject() //----------------------------------------------------------------------------- BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) { // object->extractAttachmentItemID(); if (isObjectAttached(object)) { llinfos << "(same object re-attached)" << llendl; removeObject(object); // Pass through anyway to let setupDrawable() // re-connect object to the joint correctly } object->extractAttachmentItemID(); mAttachedObjects.push_back(object); setupDrawable(object); if (mIsHUDAttachment) { if (object->mText.notNull()) { object->mText->setOnHUDAttachment(TRUE); } LLViewerObject::const_child_list_t& child_list = object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); iter != child_list.end(); ++iter) { LLViewerObject* childp = *iter; if (childp && childp->mText.notNull()) { childp->mText->setOnHUDAttachment(TRUE); } } } calcLOD(); mUpdateXform = TRUE; return TRUE; }
//----------------------------------------------------------------------------- // addObject() //----------------------------------------------------------------------------- BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) { if (mAttachedObject) { llwarns << "Attempted to attach object where an attachment already exists!" << llendl; if (mAttachedObject == object) { llinfos << "(same object re-attached)" << llendl; removeObject(mAttachedObject); // Pass through anyway to let setupDrawable() // re-connect object to the joint correctly } else { llinfos << "(objects differ, removing existing object)" << llendl; // Rather hacky, but no-one can think of something // better to do for this case. gObjectList.killObject(mAttachedObject); // Proceed with new object attachment } } mAttachedObject = object; LLUUID item_id; // Find the inventory item ID of the attached object LLNameValue* item_id_nv = object->getNVPair("AttachItemID"); if( item_id_nv ) { const char* s = item_id_nv->getString(); if( s ) { item_id.set( s ); lldebugs << "getNVPair( AttachItemID ) = " << item_id << llendl; } } mItemID = item_id; LLDrawable* drawablep = object->mDrawable; if (drawablep) { //if object is active, make it static if(drawablep->isActive()) { drawablep->makeStatic(FALSE) ; } setupDrawable(drawablep); } if (mIsHUDAttachment) { if (object->mText.notNull()) { object->mText->setOnHUDAttachment(TRUE); } LLViewerObject::const_child_list_t& child_list = object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); iter != child_list.end(); iter++) { LLViewerObject* childp = *iter; if (childp && childp->mText.notNull()) { childp->mText->setOnHUDAttachment(TRUE); } } } calcLOD(); mUpdateXform = TRUE; return TRUE; }
int main(int argc, char **argv) { GDISPLAY *video, *feedback; GPOINT *gPoints; XEvent event; WSETUP *wayv; WGESTURE *gaction; MATRIX *gesture; VECTOR *vector; int gPosition = 0; char *file; printf("wayV version %s\n", VERSION); /* Decide what configuration file to open */ if(argc != 2) file = strdup(SETUPFILE); else file = strdup(argv[1]); if((wayv = readSetup(file)) == NULL) exit(BAD); // writeSetup(wayv, SETUPOUT); /* Setup the display */ if(!(video = setupDrawable(wayv->pretty, wayv->pretty->window, argc, argv))) { printf("Cannot connected to X server\n"); return BAD; } /* Setup the mouse/pointer as an input device */ setupPointer(wayv, video); /* Allocate memory to store the gesture points */ gPoints = setupGPoints(wayv->universe->maxgpoints); if(wayv->pretty->display[0] == 'i') handleDrawableWindow(video, MAP); setupSignals(); /* Process the events */ while(1) { XNextEvent(video->display, &event); switch(event.type) { case MotionNotify: if(gPosition < wayv->universe->maxgpoints) { gPoints[gPosition].x = event.xmotion.x; gPoints[gPosition].y = event.xmotion.y; if(wayv->pretty->display[0] == 'y') writePixels(video, (int)gPoints[gPosition-1].x - GDEF_BORDER, (int)gPoints[gPosition-1].y - GDEF_BORDER, (int)gPoints[gPosition].x - GDEF_BORDER, (int)gPoints[gPosition].y - GDEF_BORDER); else if(wayv->pretty->display[0] == 'i') writePixels(video, (int)gPoints[gPosition-1].x, (int)gPoints[gPosition-1].y, (int)gPoints[gPosition].x, (int)gPoints[gPosition].y); gPosition++; } break; case ButtonPress: if(wayv->pretty->display[0] == 'y') handleDrawableWindow(video, MAP); gPosition = 0; gPoints[gPosition].x = event.xbutton.x; gPoints[gPosition].y = event.xbutton.y; gPosition++; break; case ButtonRelease: if(wayv->pretty->display[0] == 'y') handleDrawableWindow(video, UNMAP); gPoints[gPosition].x = GEND; gPoints[gPosition].y = GEND; gesture = gridGPoints(gPoints, wayv->universe->xgrid, wayv->universe->ygrid); vector = vectGPoints(gPoints, wayv->universe->xgrid, wayv->universe->ygrid, wayv->universe->maxvectors); printf("\n\n=======Gesture======="); printMat(gesture); printVec(vector); if(wayv->pretty->display[0] != 'n') handleDrawableWindow(video, CLEAR); if((gaction = findGesture(wayv, gesture, vector, wayv->think))) { printf("Is Action : %s\n", gaction->name); performAction(wayv, gaction, video, gPoints); /* Fork off program to handle feedback window */ if(wayv->pretty->feedback[0] == 'y' && fork() == 0) { feedback = writeText(gaction->action); waitMilli(wayv->pretty->wait); handleDrawableWindow(feedback, DESTROY); close(ConnectionNumber(video->display)); setsid(); exit(BAD); } } freeMat(gesture); free(vector); break; case ClientMessage: if(event.xclient.data.l[0] == video->wmdelete) { closeDisplay(video); exit(GOOD); } break; } } }