MCPcopy Create free account
hub / github.com/bumptop/BumpTop / convert

Method convert

trunk/win/Source/BT_FileSystemPile.cpp:503–581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

501}
502
503FileSystemActor *FileSystemPile::convert(Pile *softPile, QString newDirPath)
504{
505 LOG_LINE_REACHED();
506
507 FileSystemActor *fsData = NULL;
508 QString newPath;
509 Vec3 newPos;
510
511 // Convert Soft Pile to Hard Pile
512 if (softPile->getPileType() == SoftPile && !owner)
513 {
514 for (uint i = 0; i < softPile->getNumItems(); i++)
515 {
516 fsData = (FileSystemActor *) (*softPile)[i];
517
518 // Check if this item can be put into a soft Pile
519 if (!fsData->isPilable(HardPile))
520 {
521 return NULL;
522 }
523 }
524
525 if (softPile->getNumItems() == 0) return NULL;
526
527 // Create the Directory that this can be moved into (May fail if exists - Thats ok)
528 if (fsManager->createDirectory(newDirPath))
529 {
530 // Create the new Actor
531 fsData = (FileSystemActor *) softPile->getLastItem();
532 owner = FileSystemActorFactory::createFileSystemActor(newDirPath);
533 owner->setDimsToDefault();
534 owner->setGlobalPose(Mat34(true));
535 owner->setFilePath(newDirPath);
536
537 // Semi-Pileize the owner
538 owner->setPileizedPile(this);
539 owner->hideAndDisable();
540
541 // Add all items to the new pile
542 for (int i = 0; i < softPile->getNumItems(); i++)
543 {
544 fsData = (FileSystemActor *) (*softPile)[i];
545 fsData->setParent(NULL);
546
547 if (addToPile(fsData))
548 {
549 // Success, remove item from pile
550 softPile->clear(i);
551 fsData->setParent(this);
552 i--;
553 }else{
554 // Failed the move
555 fsData->setParent(softPile);
556 }
557 }
558
559 // Update this Pile to reflect a full HardPile
560 setText(owner->getText());

Callers 2

SoftPileToFolderIconFunction · 0.45
Key_NameSoftPileFunction · 0.45

Calls 14

DeletePileFunction · 0.85
createDirectoryMethod · 0.80
setPileizedPileMethod · 0.80
hideAndDisableMethod · 0.80
setTextFunction · 0.50
stackClass · 0.50
isPilableMethod · 0.45
setFilePathMethod · 0.45
setParentMethod · 0.45
clearMethod · 0.45
getTextMethod · 0.45
getGlobalPositionMethod · 0.45

Tested by

no test coverage detected