Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lab - reload surface mesh with selection #8647

Open
janetournois opened this issue Dec 6, 2024 · 1 comment
Open

Lab - reload surface mesh with selection #8647

janetournois opened this issue Dec 6, 2024 · 1 comment

Comments

@janetournois
Copy link
Member

Issue Details

  • Load a surface mesh, and a selection (either from two separate files or stored in one file like .om file format
  • make operations (or not)
  • click "Reload Item From File"

Depending on the operations scenario, Lab either crashes, or does not reload the selection.

Indeed, in MainWindow.cpp, the function reloadItem() does not take into account the "dependent" items like the selection_item. This should be fixed

Environment

  • CGAL version: 6.0.1
@Nerdgirl50
Copy link

void MainWindow::reloadItem(Item* item) {
if (!item) {
qDebug() << "No item provided for reload.";
return;
}

// Step 1: Identify and store dependent items
QList<Item*> dependentItems;
if (item->hasDependencies()) {
    dependentItems = item->getDependencies();
}

// Step 2: Reload the main item
bool reloadSuccessful = item->reloadFromFile();
if (!reloadSuccessful) {
    qDebug() << "Failed to reload item from file.";
    return;
}

// Step 3: Handle dependent items
for (Item* dependentItem : dependentItems) {
    if (dependentItem) {
        bool dependentReloadSuccessful = dependentItem->reloadFromFile();
        if (!dependentReloadSuccessful) {
            qDebug() << "Failed to reload dependent item:" << dependentItem->name();
            // Optionally, recreate or update dependent items as needed
        }
    }
}

// Step 4: Update UI and consistency
updateUI();
qDebug() << "Reloaded item and its dependencies successfully.";

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants