Example #1
0
void AssemblyItem::do_delete()
{
    if (!allows_deletion())
        return;

    const char* assembly_name = m_assembly.get_name();

    if (ask_assembly_deletion_confirmation(assembly_name) != QMessageBox::Yes)
        return;

    const UniqueID assembly_uid = m_assembly.get_uid();

    // Remove all assembly instances and their corresponding project items.
    remove_assembly_instances(
        m_editor_context.m_item_registry,
        m_parent,
        assembly_uid);

    // Remove and delete the assembly.
    m_parent.assemblies().remove(assembly_uid);

    // Mark the project as modified.
    m_editor_context.m_project_builder.slot_notify_project_modification();

    // Remove and delete the assembly item.
    delete this;
}
Example #2
0
void AssemblyItem::do_delete()
{
    if (!allows_deletion())
        return;

    const char* assembly_name = m_assembly.get_name();

    if (ask_assembly_deletion_confirmation(assembly_name) != QMessageBox::Yes)
        return;

    const UniqueID assembly_uid = m_assembly.get_uid();

    // Remove all assembly instances and their corresponding project items.
    remove_assembly_instances(
        m_project_builder.get_item_registry(),
        m_parent,
        assembly_uid);

    // Remove and delete the assembly.
    m_parent.assemblies().remove(assembly_uid);

    // Mark the project as modified.
    m_project_builder.notify_project_modification();

    // Remove and delete the assembly item.
    ItemBase* assembly_item = m_project_builder.get_item_registry().get_item(assembly_uid);
    m_project_builder.get_item_registry().remove(assembly_uid);
    delete assembly_item;

    // At this point 'this' no longer exists.
}
Example #3
0
void ObjectItem::do_delete()
{
    if (!allows_deletion())
        return;

    const UniqueID object_uid = m_entity->get_uid();

    // Remove all object instances and their corresponding project items.
    remove_object_instances(
        m_project_builder.get_item_registry(),
        m_parent,
        object_uid);

    // Remove and delete the object.
    m_parent.objects().remove(m_parent.objects().get_by_uid(object_uid));

    // Mark the project as modified.
    m_project_builder.notify_project_modification();

    // Remove and delete the object item.
    ItemBase* object_item = m_project_builder.get_item_registry().get_item(object_uid);
    m_project_builder.get_item_registry().remove(object_uid);
    delete object_item;

    // At this point 'this' no longer exists.
}
Example #4
0
void ObjectItem::slot_delete()
{
    if (!allows_deletion())
        return;

    m_project_builder.remove_object(m_assembly, m_object->get_uid());

    // 'this' no longer exists at this point.
}
Example #5
0
void ObjectItem::slot_delete()
{
    if (!allows_deletion())
        return;

    m_project_builder.remove_object(
        m_parent,
        m_parent_item,
        m_entity->get_uid());

    // 'this' no longer exists at this point.
}
Example #6
0
void AssemblyItem::slot_delete()
{
    if (!allows_deletion())
        return;

    const char* assembly_name = impl->m_assembly->get_name();

    if (ask_assembly_deletion_confirmation(assembly_name) != QMessageBox::Yes)
        return;

    impl->m_project_builder.remove_assembly(impl->m_assembly->get_uid());

    // 'this' no longer exists at this point.
}
void AssemblyInstanceItem::do_delete()
{
    if (!allows_deletion())
        return;

    const UniqueID assembly_instance_uid = m_entity->get_uid();

    // Remove and delete the assembly instance.
    m_parent.assembly_instances().remove(assembly_instance_uid);
    
    // Mark the scene and the project as modified.
    m_project_builder.get_project().get_scene()->bump_version_id();
    m_project_builder.notify_project_modification();

    // Remove and delete the assembly instance item.
    ItemBase* assembly_instance_item = m_project_builder.get_item_registry().get_item(assembly_instance_uid);
    m_project_builder.get_item_registry().remove(assembly_instance_uid);
    delete assembly_instance_item;

    // At this point 'this' no longer exists.
}