void SkeletonSlot::SetToSetupPose() { SetColor(mModel->Color()); StringRef attachmentName = mModel->AttachmentName(); SetAttachment(attachmentName); }
/***************************************************************************** * SetAttachment: recursively set the b_attached flag of a subtree. ***************************************************************************** * This function is used by the attach and detach functions to propagate * the b_attached flag in a subtree. *****************************************************************************/ static void SetAttachment( vlc_object_t *p_this, vlc_bool_t b_attached ) { int i_index; for( i_index = p_this->i_children ; i_index-- ; ) { SetAttachment( p_this->pp_children[i_index], b_attached ); } p_this->b_attached = b_attached; }
void SkeletonSlot::SetAttachment(const StringRef& attachmentName) { if (attachmentName.IsEmpty()) { SetAttachment(nullptr); return; } if (mAttachment != nullptr&&mAttachment->Name() == attachmentName) { return; } ISkeletonAttachmentModel* attachment = mSkeleton->AvatarModel()->FindAttachment(mModel, attachmentName); if (attachment == nullptr) { Log::AssertFailedFormat("Cannot find slot attachment:{}", attachmentName.c_str()); return; } SetAttachment(attachment); }
void CSprite::Precache( void ) { PRECACHE_MODEL( (char *)STRING(pev->model) ); // Reset attachment after save/restore if ( pev->aiment ) SetAttachment( pev->aiment, pev->body ); else { // Clear attachment pev->skin = 0; pev->body = 0; } }
//----------------------------------------------------------------------------- // Purpose: Fixup parent after restore //----------------------------------------------------------------------------- void CSprite::OnRestore() { BaseClass::OnRestore(); // Reset attachment after save/restore if ( GetFollowedEntity() ) { SetAttachment( GetFollowedEntity(), m_nAttachment ); } else { // Clear attachment m_hAttachedToEntity = NULL; m_nAttachment = 0; } }
/** **************************************************************************** * detach object from its parent ***************************************************************************** * This function removes all links between an object and its parent. *****************************************************************************/ void __vlc_object_detach( vlc_object_t *p_this ) { vlc_mutex_lock( &structure_lock ); if( !p_this->p_parent ) { msg_Err( p_this, "object is not attached" ); vlc_mutex_unlock( &structure_lock ); return; } /* Climb up the tree to see whether we are connected with the root */ if( p_this->p_parent->b_attached ) { SetAttachment( p_this, VLC_FALSE ); } DetachObject( p_this ); vlc_mutex_unlock( &structure_lock ); }
/** **************************************************************************** * attach object to a parent object ***************************************************************************** * This function sets p_this as a child of p_parent, and p_parent as a parent * of p_this. This link can be undone using vlc_object_detach. *****************************************************************************/ void __vlc_object_attach( vlc_object_t *p_this, vlc_object_t *p_parent ) { vlc_mutex_lock( &structure_lock ); /* Attach the parent to its child */ p_this->p_parent = p_parent; /* Attach the child to its parent */ INSERT_ELEM( p_parent->pp_children, p_parent->i_children, p_parent->i_children, p_this ); /* Climb up the tree to see whether we are connected with the root */ if( p_parent->b_attached ) { SetAttachment( p_this, VLC_TRUE ); } vlc_mutex_unlock( &structure_lock ); }
/* =============== idCameraView::Event_SetAttachments ================ */ void idCameraView::Event_SetAttachments( ) { SetAttachment( &attachedTo, "attachedTo" ); SetAttachment( &attachedView, "attachedView" ); }
void SkeletonSlot::SetAttachmentFromModel() { SetAttachment(mModel->AttachmentName()); }