//==============================
// FindTargetPath
static void FindTargetPath( OvrVRMenuMgr const & menuMgr,
                            menuHandle_t const curHandle, Array< menuHandle_t > & targetPath )
{
    VRMenuObject * obj = menuMgr.ToObject( curHandle );
    if ( obj != NULL )
    {
        FindTargetPath( menuMgr, obj->GetParentHandle(), targetPath );
        targetPath.PushBack( curHandle );
    }
}
//==============================
// FindTargetPath
static void FindTargetPath( OvrGuiSys & guiSys, 
        menuHandle_t const curHandle, Array< menuHandle_t > & targetPath ) 
{
	VRMenuObject * obj = guiSys.GetVRMenuMgr().ToObject( curHandle );
	if ( obj != NULL )
	{
		FindTargetPath( guiSys, obj->GetParentHandle(), targetPath );
		targetPath.PushBack( curHandle );
	}
}
示例#3
0
//==================================
// VRMenuMgrLocal::FreeObject
// Frees a menu object.  If the object is a child of a parent object, this will
// also remove the child from the parent.
void VRMenuMgrLocal::FreeObject( menuHandle_t const handle )
{
	int index;
	UInt32 id;
	DecomposeHandle( handle, index, id );
	if ( !HandleComponentsAreValid( index, id ) )
	{
		return;
	}
	if ( ObjectList[index] == NULL )
	{
		// already freed
		return;
	}

	VRMenuObject * obj = ObjectList[index];
	// remove this object from its parent's child list
	if ( obj->GetParentHandle().IsValid() )
	{
		VRMenuObject * parentObj = ToObject( obj->GetParentHandle() );
		if ( parentObj != NULL )
		{
			parentObj->RemoveChild( *this, handle );
		}
	}

    // free all of this object's children
    obj->FreeChildren( *this );

	delete obj;

	// empty the slot
	ObjectList[index] = NULL;
	// add the index to the free list
	FreeList.PushBack( index );
	
	CondenseList();
}