Exemplo n.º 1
0
PxCollection* MakePhysXCollection(const TArray<UPhysicalMaterial*>& PhysicalMaterials, const TArray<UBodySetup*>& BodySetups, uint64 BaseId)
{
	QUICK_SCOPE_CYCLE_COUNTER(STAT_CreateSharedData);
	PxCollection* PCollection = PxCreateCollection();
	for (UPhysicalMaterial* PhysicalMaterial : PhysicalMaterials)
	{
		if (PhysicalMaterial)
		{
			PCollection->add(*PhysicalMaterial->GetPhysXMaterial());
		}
	}

	for (UBodySetup* BodySetup : BodySetups)
	{
		for(PxTriangleMesh* TriMesh : BodySetup->TriMeshes)
		{
			AddToCollection(PCollection, TriMesh);
		}

		for (const FKConvexElem& ConvexElem : BodySetup->AggGeom.ConvexElems)
		{
			AddToCollection(PCollection, ConvexElem.ConvexMesh);
			AddToCollection(PCollection, ConvexElem.ConvexMeshNegX);
		}
	}

	PxSerialization::createSerialObjectIds(*PCollection, PxSerialObjectId(BaseId));

	return PCollection;
}
Exemplo n.º 2
0
bool FCollectionManager::RenameCollection (FName CurrentCollectionName, ECollectionShareType::Type CurrentShareType, FName NewCollectionName, ECollectionShareType::Type NewShareType)
{
	if ( !ensure(CurrentShareType < ECollectionShareType::CST_All) || !ensure(NewShareType < ECollectionShareType::CST_All) )
	{
		// Bad share type
		LastError = LOCTEXT("Error_Internal", "There was an internal error.");
		return false;
	}

	// Get the object paths for the assets in the collection
	TArray<FName> ObjectPaths;
	if ( !GetAssetsInCollection(CurrentCollectionName, CurrentShareType, ObjectPaths) )
	{
		// Failed to get assets in the current collection
		return false;
	}

	// Create a new collection
	if ( !CreateCollection(NewCollectionName, NewShareType) )
	{
		// Failed to create collection
		return false;
	}

	if ( ObjectPaths.Num() > 0 )
	{
		// Add all the objects from the old collection to the new collection
		if ( !AddToCollection(NewCollectionName, NewShareType, ObjectPaths) )
		{
			// Failed to add paths to the new collection. Destroy the collection we created.
			DestroyCollection(NewCollectionName, NewShareType);
			return false;
		}
	}

	// Delete the old collection
	if ( !DestroyCollection(CurrentCollectionName, CurrentShareType) )
	{
		// Failed to destroy the old collection. Destroy the collection we created.
		DestroyCollection(NewCollectionName, NewShareType);
		return false;
	}

	// Success
	FCollectionNameType OriginalCollectionNameType( CurrentCollectionName, CurrentShareType );
	FCollectionNameType NewCollectionNameType( NewCollectionName, NewShareType );
	CollectionRenamedEvent.Broadcast( OriginalCollectionNameType, NewCollectionNameType );
	return true;
}
Exemplo n.º 3
0
void AddAll( collection c )
	{
	int i;
	extern void PrintTree( collection c );
	for(i=0;i<N;i++)
		{
		AddToCollection( c, &list[i] );
		PrintTree( c );
		if ( FindInCollection( c, &list[i] ) )
			{}
		else
			{
			printf("Add failure item %d, value %d\n",
					i, list[i] );
			}
		}
	}
Exemplo n.º 4
0
   void
   Messages::Refresh(bool update_recent_flags)
   {
      boost::lock_guard<boost::recursive_mutex> guard(_mutex);

	  // int startTime = GetTickCount();

      bool retrieveQueue = account_id_ == -1;

      if (retrieveQueue && last_refreshed_uid_ > 0)
      {
         /*
            We can't do partial refreshes of messages in the queue. Why? 
            Because we use the message UID to determine which part of the
            queue we need to read from the database, and UID's aren't given
            to messages before they are inserted into the queue.
         */
         ErrorManager::Instance()->ReportError(ErrorManager::Medium, 5204, "Messages::Refresh", "Refresh not supported on the current collection.");
         return;

      }

      SQLCommand command;

      // Build SQL statement that will be used to fetch list of messages.
      String sSQL;
      sSQL = "select * from hm_messages where "; 

      if (retrieveQueue)
         sSQL += " messagetype = 1 ";
      else
      {
         // Messages connected to a specific account
         sSQL += _T(" messageaccountid = @MESSAGEACCOUNTID ");
         command.AddParameter("@MESSAGEACCOUNTID", account_id_); 
      }
  
      // Should we fetch a specific folder?
      if (folder_id_ != -1)
      {
         sSQL.AppendFormat(_T(" and messagefolderid = @MESSAGEFOLDERID "));
         command.AddParameter("@MESSAGEFOLDERID", folder_id_); 
      }

      // Should we do an incremental refresh?
      if (last_refreshed_uid_ > 0)
      {
         sSQL.AppendFormat(_T(" and messageuid > @MESSAGEUID "));
         command.AddParameter("@MESSAGEUID", last_refreshed_uid_); 
      }

      if (retrieveQueue)
         sSQL += " order by messageid asc";
      else
         sSQL += " order by messageuid asc";


      command.SetQueryString(sSQL);

      std::shared_ptr<DALRecordset> pRS = Application::Instance()->GetDBManager()->OpenRecordset(command);
      if (!pRS)
         return;

      AddToCollection(pRS);

     
   }
Exemplo n.º 5
0
 // ADVANCED: Constructs the Bitmap from the specified pixel data //
 // The width and height are the width and height of the actual image //
 // while textureWidth and textureHeight are should be the next powers of two //
 // The pixel data should be an array of 4 * textureWidth * textureHeight elements //
 // which represent the color components of the pixels in groups of four components, //
 // line by line from top to bottom and each line left to right //
 Bitmap( int width, int height, int textureWidth, int textureHeight,
         float *pixelData, bool hasAlphaChannel = true )                            : bmp( 0 ), collisionPoly( 0 ), destroyBmp( false ), pendingLoad( 0 ), pivot( Vec2D( 0.0, 0.0 )), useDefaultPivot( true ), isSubBitmap( false ) { AddToCollection(); Load( width, height, textureWidth, textureHeight, pixelData, hasAlphaChannel ); }
Exemplo n.º 6
0
 Bitmap( int width, int height, Functor functor )                                   : bmp( 0 ), collisionPoly( 0 ), destroyBmp( true ), pendingLoad( 0 ), pivot( Vec2D( 0.0, 0.0 )), useDefaultPivot( true ), isSubBitmap( false ) { AddToCollection(); Load( width, height, functor ); }
Exemplo n.º 7
0
bool FCollectionManager::AddToCollection(FName CollectionName, ECollectionShareType::Type ShareType,  FName ObjectPath)
{
	TArray<FName> Paths;
	Paths.Add(ObjectPath);
	return AddToCollection(CollectionName, ShareType, Paths);
}