/*! \brief Removes the coordinate format \a formatToRemove from the list of results produced by the tool. */ void CoordinateConversionController::removeCoordinateFormat(const QString& formatToRemove) { if (formatToRemove.compare(m_inputFormat, Qt::CaseInsensitive) == 0) return; bool removed = false; auto it = m_options.begin(); auto itEnd = m_options.end(); for (; it != itEnd; ++it) { const auto& option = *it; if (isFormat(option, formatToRemove)) { m_options.erase(it); removed = true; break; } } if (!removed) return; if (m_results) m_results->removeResult(formatToRemove); if(runConversion()) convertPoint(); emit optionsChanged(); emit pointToConvertChanged(); }
bool hkvTextureTransformationRule::executeTransformation(const hkvTransformationInput& input, hkvTransformationOutput& output) const { Context context(input, output); bool ok = !context.m_canceled && (transferSourceProperties(context) == HK_SUCCESS); ok = ok && !context.m_canceled && (examineSourceFile(context) == HK_SUCCESS); ok = ok && !context.m_canceled && (determineOutputs(context) == HK_SUCCESS); ok = ok && !context.m_canceled && (makeIntermediateBaseName(context) == HK_SUCCESS); ok = ok && !context.m_canceled && (copySourceFileToTemp(context) == HK_SUCCESS); int numVariants = context.m_outputVariants.getSize(); for (int variantIdx = 0; ok && (variantIdx < numVariants); ++variantIdx) { const hkvTextureVariant& variant = context.m_outputVariants[variantIdx]; ok = ok && !context.m_canceled && (prepareTransformationSettings(context, variant) == HK_SUCCESS); if (ok && hkvFileHelper::fileExists(context.m_targetFile)) { continue; } ok = ok && !context.m_canceled && (runConversion(context) == HK_SUCCESS); ok = ok && !context.m_canceled && (moveTempFileToTarget(context) == HK_SUCCESS); if (ok) { notifyOutputWritten(context, variant.m_variantKey.cString()); } } cleanUpTempFiles(context); if (ok) { context.m_output.m_messages.pushBack(hkvAssetLogMessage( HKV_MESSAGE_CATEGORY_ASSET_TRANSFORMATION, HKV_MESSAGE_SEVERITY_INFO, "Texture transformed successfully.")); } else if (context.m_canceled) { deleteTargetFile(context); context.m_output.m_messages.pushBack(hkvAssetLogMessage( HKV_MESSAGE_CATEGORY_ASSET_TRANSFORMATION, HKV_MESSAGE_SEVERITY_WARNING, "Transformation of texture was canceled.")); } else { context.m_output.m_messages.pushBack(hkvAssetLogMessage( HKV_MESSAGE_CATEGORY_ASSET_TRANSFORMATION, HKV_MESSAGE_SEVERITY_ERROR, "Transformation of texture failed!")); } return ok; }