Merge pull request #11270 from birarda/feat/auto-bake

refuse to perform mapping operations in /.baked/
This commit is contained in:
Stephen Birarda 2017-08-31 13:06:28 -07:00 committed by GitHub
commit b1bc899121
6 changed files with 40 additions and 20 deletions

View file

@ -533,11 +533,18 @@ void AssetServer::handleSetMappingOperation(ReceivedMessage& message, SharedNode
auto assetHash = message.read(SHA256_HASH_LENGTH).toHex();
if (setMapping(assetPath, assetHash)) {
replyPacket.writePrimitive(AssetServerError::NoError);
// don't process a set mapping operation that is inside the hidden baked folder
if (assetPath.startsWith(HIDDEN_BAKED_CONTENT_FOLDER)) {
qCDebug(asset_server) << "Refusing to process a set mapping operation inside" << HIDDEN_BAKED_CONTENT_FOLDER;
replyPacket.writePrimitive(AssetServerError::PermissionDenied);
} else {
replyPacket.writePrimitive(AssetServerError::MappingOperationFailed);
if (setMapping(assetPath, assetHash)) {
replyPacket.writePrimitive(AssetServerError::NoError);
} else {
replyPacket.writePrimitive(AssetServerError::MappingOperationFailed);
}
}
} else {
replyPacket.writePrimitive(AssetServerError::PermissionDenied);
}
@ -551,7 +558,14 @@ void AssetServer::handleDeleteMappingsOperation(ReceivedMessage& message, Shared
QStringList mappingsToDelete;
for (int i = 0; i < numberOfDeletedMappings; ++i) {
mappingsToDelete << message.readString();
auto mapping = message.readString();
if (!mapping.startsWith(HIDDEN_BAKED_CONTENT_FOLDER)) {
mappingsToDelete << mapping;
} else {
qCDebug(asset_server) << "Refusing to delete mapping" << mapping
<< "that is inside" << HIDDEN_BAKED_CONTENT_FOLDER;
}
}
if (deleteMappings(mappingsToDelete)) {
@ -569,11 +583,18 @@ void AssetServer::handleRenameMappingOperation(ReceivedMessage& message, SharedN
QString oldPath = message.readString();
QString newPath = message.readString();
if (renameMapping(oldPath, newPath)) {
replyPacket.writePrimitive(AssetServerError::NoError);
if (oldPath.startsWith(HIDDEN_BAKED_CONTENT_FOLDER) || newPath.startsWith(HIDDEN_BAKED_CONTENT_FOLDER)) {
qCDebug(asset_server) << "Cannot rename" << oldPath << "to" << newPath
<< "since one of the paths is inside" << HIDDEN_BAKED_CONTENT_FOLDER;
replyPacket.writePrimitive(AssetServerError::PermissionDenied);
} else {
replyPacket.writePrimitive(AssetServerError::MappingOperationFailed);
if (renameMapping(oldPath, newPath)) {
replyPacket.writePrimitive(AssetServerError::NoError);
} else {
replyPacket.writePrimitive(AssetServerError::MappingOperationFailed);
}
}
} else {
replyPacket.writePrimitive(AssetServerError::PermissionDenied);
}

View file

@ -17,11 +17,7 @@
# which uses the MIT license (https://github.com/ufz-vislab/VtkFbxConverter/blob/master/LICENSE.txt)
if (NOT FBX_VERSION)
if (WIN32)
set(FBX_VERSION 2017.1)
else()
set(FBX_VERSION 2017.0.1)
endif()
set(FBX_VERSION 2017.1)
endif()
string(REGEX REPLACE "^([0-9]+).*$" "\\1" FBX_VERSION_MAJOR "${FBX_VERSION}")
@ -29,7 +25,7 @@ string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*$" "\\1" FBX_VERSION_MINOR "${FBX_VER
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" FBX_VERSION_PATCH "${FBX_VERSION}")
set(FBX_MAC_LOCATIONS "/Applications/Autodesk/FBX\ SDK/${FBX_VERSION}")
set(FBX_LINUX_LOCATIONS "/usr/local/lib/gcc4/x64/debug/")
set(FBX_LINUX_LOCATIONS "/usr/local/fbxsdk")
if (WIN32)
string(REGEX REPLACE "\\\\" "/" WIN_PROGRAM_FILES_X64_DIRECTORY $ENV{ProgramW6432})
@ -73,7 +69,7 @@ function(_fbx_find_library _name _lib _suffix)
find_library(${_name}
NAMES ${_lib}
HINTS ${FBX_SEARCH_LOCATIONS}
PATH_SUFFIXES lib/${fbx_compiler}/${_suffix} lib/${fbx_compiler}/ub/${_suffix} lib/${VS_PREFIX}/x64/${_suffix}
PATH_SUFFIXES lib/${fbx_compiler}/${_suffix} lib/${fbx_compiler}/x64/${_suffix} lib/${fbx_compiler}/ub/${_suffix} lib/${VS_PREFIX}/x64/${_suffix}
)
mark_as_advanced(${_name})

View file

@ -9,9 +9,11 @@ if (FBX_FOUND)
target_link_libraries(${TARGET_NAME} ${FBX_LIBRARIES})
endif ()
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${FBX_INCLUDE_DIR})
endif ()
set_target_properties(${TARGET_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_DEFAULT_BUILD TRUE)
if (UNIX)
target_link_libraries(${TARGET_NAME} ${CMAKE_DL_LIBS})
endif (UNIX)
endif ()
link_hifi_libraries(shared model networking ktx image)
include_hifi_library_headers(gpu)

View file

@ -47,7 +47,7 @@ const QStringList TextureBaker::getSupportedFormats() {
auto formats = QImageReader::supportedImageFormats();
QStringList stringFormats;
std::transform(formats.begin(), formats.end(), std::back_inserter(stringFormats),
[](auto& format) -> QString { return format; });
[](QByteArray& format) -> QString { return format; });
return stringFormats;
}

View file

@ -449,7 +449,7 @@ void generateMips(gpu::Texture* texture, QImage& image, int face = -1) {
class SequentialTaskDispatcher : public nvtt::TaskDispatcher {
public:
virtual void dispatch(nvtt::Task* task, void* context, int count) {
virtual void dispatch(nvtt::Task* task, void* context, int count) override {
for (int i = 0; i < count; i++) {
task(context, i);
}

View file

@ -87,8 +87,6 @@ bool isValidHash(const AssetHash& hash) {
QString bakingStatusToString(BakingStatus status) {
switch (status) {
case Unrelevant:
return "--";
case NotBaked:
return "Not Baked";
case Pending:
@ -99,5 +97,8 @@ QString bakingStatusToString(BakingStatus status) {
return "Baked";
case Error:
return "Error";
case Unrelevant:
default:
return "--";
}
}