Exemplo n.º 1
0
void Model::update( float delta )
{
	mesh = meshHandle.Resolve();

	if( !mesh || !mesh->isLoaded() )
		return;

	if( !modelBuilt ) build();

	if(updateSkin)
	{
		updateSkinning();
		updateSkin = false;
	}

	if( mesh->isAnimated() )
	{
		if( animations.empty() )
			setAnimation( mesh->getBindPose().get() );

		if( animationEnabled )
		{
			updateAnimations(delta);
			updateFinalAnimationBones();
		}

		updateAttachments();
	}

	//updateDebugRenderable();
	Geometry::update(delta);
}
Exemplo n.º 2
0
void XFE_ComposeAttachFolderView::deleteAttachment(int pos)
{
    if (pos<0 || pos>=_numAttachments)
        return;

    // abort if attachment adding or delivery is in progress
    if (!verifySafeToAttach())
        return;
    
    if (_attachments[pos].url)
        XP_FREE(_attachments[pos].url);

    // remove from internal attachment list
    for (int i=pos;i<_numAttachments-1;i++)
        _attachments[i]=_attachments[i+1];    
    _numAttachments--;
    updateAttachments();
    
    // remove icon from attach panel
    if (_attachPanel) {
        _attachPanel->removeItem(pos);
        _attachPanel->updateDisplay();
    }
}
Exemplo n.º 3
0
int XFE_ComposeAttachFolderView::addAttachments(const char **items,int numItems,int pre_existing,Boolean attach_binary)
{
    // lock out addition of existing attachments after first time through
    _addedExistingAttachments=TRUE;
    
    // abort if attachment adding or delivery is in progress
    // (and not adding pre_exisiting attachments)
    if (!pre_existing && !verifySafeToAttach())
        return FALSE;

    if (!items || numItems==0)
        return FALSE;

    int addStatus=FALSE;
    
    // desired type is NULL == as-is (used to read from format toggle buttons.)
    char *desiredType=NULL;

    // if an icon has focus, restore it when we remap the pane
    Widget focusWidget=XmGetFocusWidget(getBaseWidget());
    if (focusWidget && XtParent(focusWidget)!=_attachPanel->pane())
        focusWidget=NULL;
    
    _attachPanel->unmapPane();
    for (int i=0;i<numItems;i++) {
        // is there space in the list?
        if (_numAttachments>=_maxAttachments) {
            char *msg=PR_smprintf(XP_GetString(XFE_MN_TOO_MANY_ATTACHMENTS));
            if (msg) {
                fe_Alert_2(getBaseWidget(),msg);
                XP_FREE(msg);
            }
            break;
        }

        // is the item already attached?
        int duplicate=FALSE;
        for (int j=0;j<_numAttachments;j++) {
            if (strcmp(items[i],_attachments[j].url)==0) {
                char *msg=PR_smprintf(XP_GetString(XFE_MN_ITEM_ALREADY_ATTACHED),items[i]);
                if (msg) {
                    fe_Alert_2(getBaseWidget(),msg);
                    XP_FREE(msg);
                }
                duplicate=TRUE;
                break;
            }
        }
        if (duplicate)
            continue;

        // nyi - hack "addbook:add?vcard=" URL to be vcard data, and accept as attachment
        // (then turn back on dragging of addbook:add URL's in XFE_HTMLDrag)
        // WinFE does this already.

        // is it a valid attachment?
        if ((!pre_existing) && (!validateAttachment(getBaseWidget(),items[i])))
            continue;

        // at least one attachment was accepted, return success status
        addStatus=TRUE;
        
        // add to internal attachment list
        struct MSG_AttachmentData m = { 0 };
        m.url=XP_STRDUP(items[i]);
        m.desired_type=desiredType;
        if (attach_binary)
            m.real_type= "application/octet-stream";
        else if (IsWebJumper(m.url))
            m.real_type= "text/webjumper";
        else
            m.real_type=NULL;
        _attachments[_numAttachments]=m;
        _numAttachments++;

        char *itemLabel=parseItemLabel(items[i]);
        
        // add icon to attachment panel
        _attachPanel->addItem(items[i],itemLabel);
        XP_FREE(itemLabel);
    }

    // always select last-added item
    if (addStatus && _attachPanel->numItems()>0) {
        _attachPanel->selectItem(_attachPanel->items()[_attachPanel->numItems()-1]);
        if (!pre_existing) {
            focusWidget=_attachPanel->items()[_attachPanel->numItems()-1]->image();
        }
    }
    
    // update attachment panel
    _attachPanel->updateDisplay();
    _attachPanel->mapPane();

    // restore focus if we had it before the unmapPane()
    if (focusWidget)
        XmProcessTraversal(focusWidget,XmTRAVERSE_CURRENT);

    // update internal attachment list, if not adding pre-exisiting attachments
    if (addStatus && !pre_existing)
        updateAttachments();    

    // pop attachment folder to top, if not adding pre-exisiting attachments
    if (!pre_existing) {
        getParent()->doCommand(xfeCmdViewAttachments);
    }

    return addStatus;
}