Example #1
0
void UsdMayaJobExportArgs::AddFilteredTypeName(const MString& typeName)
{
    MNodeClass cls(typeName);
    unsigned int id = cls.typeId().id();
    if (id == 0) {
        TF_WARN("Given excluded node type '%s' does not exist; ignoring",
                typeName.asChar());
        return;
    }
    _filteredTypeIds.insert(id);
    // We also insert all inherited types - only way to query this is through mel,
    // which is slower, but this should be ok, as these queries are only done
    // "up front" when the export starts, not per-node
    MString queryCommand("nodeType -isTypeName -derived ");
    queryCommand += typeName;
    MStringArray inheritedTypes;
    MStatus status = MGlobal::executeCommand(queryCommand, inheritedTypes, false, false);
    if (!status) {
        TF_WARN("Error querying derived types for '%s': %s",
                typeName.asChar(), status.errorString().asChar());
        return;
    }

    for (unsigned int i=0; i < inheritedTypes.length(); ++i) {
        if (inheritedTypes[i].length() == 0) continue;
        id = MNodeClass(inheritedTypes[i]).typeId().id();
        if (id == 0) {
            // Unfortunately, the returned list will often include weird garbage, like
            // "THconstraint" for "constraint", which cannot be converted to a MNodeClass,
            // so just ignore these...
            continue;
        }
        _filteredTypeIds.insert(id);
    }
}
Example #2
0
void ShopperDatabase::removeEntry(const QString &item)
{
   QSqlQuery query;
    QString queryCommand("DELETE FROM shoppingList WHERE item = :i");
    query.prepare(queryCommand);

    query.bindValue(":i",item.simplified());

    if(!query.exec()) {
        qWarning(query.lastError().driverText().toLocal8Bit());
        qWarning(query.lastQuery().toLocal8Bit());
        return;
    }
}
Example #3
0
void ShopperDatabase::updateEntry(const QString &oldEntry, const QString &newEntry)
{
    QSqlQuery query;
    QString queryCommand("UPDATE shoppingList SET item = :i WHERE item = :j");
    query.prepare(queryCommand);

        query.bindValue(":i",newEntry);
        query.bindValue(":j",oldEntry);

    if(!query.exec()) {
        qWarning(query.lastError().driverText().toLocal8Bit());
        qWarning(query.lastQuery().toLocal8Bit());
        return;
    }

}
Example #4
0
void ShopperDatabase::addEntry(const QString &cat, const QString &newEntry)
{
    QSqlQuery query;
    QString category;
    if(cat.isEmpty())
        category = "General";
    else
        category = cat;
        QString queryCommand("INSERT INTO shoppingList (category,item) VALUES (:c, :i)");

        query.prepare(queryCommand);
        query.bindValue(":c",category.simplified());
        query.bindValue(":i",newEntry.simplified());

        if(!query.exec()) {
            qWarning(query.lastError().driverText().toLocal8Bit());
            qWarning(query.lastQuery().toLocal8Bit());
            return;
            //        }
    }

}