fix TabletAssetServer

This commit is contained in:
Alexander Ivash 2018-03-30 00:09:28 +03:00
parent e5da59a62f
commit 814cfa4587

View file

@ -40,6 +40,7 @@ Rectangle {
property var assetMappingsModel: Assets.mappingModel; property var assetMappingsModel: Assets.mappingModel;
property var currentDirectory; property var currentDirectory;
property var selectedItemCount: treeView.selection.selectedIndexes.length; property var selectedItemCount: treeView.selection.selectedIndexes.length;
property int updatesCount: 0; // this is used for notifying model-dependent bindings about model updates
Settings { Settings {
category: "Overlay.AssetServer" category: "Overlay.AssetServer"
@ -51,6 +52,9 @@ Rectangle {
ApplicationInterface.uploadRequest.connect(uploadClicked); ApplicationInterface.uploadRequest.connect(uploadClicked);
assetMappingsModel.errorGettingMappings.connect(handleGetMappingsError); assetMappingsModel.errorGettingMappings.connect(handleGetMappingsError);
assetMappingsModel.autoRefreshEnabled = true; assetMappingsModel.autoRefreshEnabled = true;
assetMappingsModel.updated.connect(function() {
++updatesCount;
});
reload(); reload();
} }
@ -850,12 +854,17 @@ Rectangle {
checked = Qt.binding(isChecked); checked = Qt.binding(isChecked);
} }
function getStatus() {
// kind of hack for ensuring getStatus() will be re-evaluated on updatesCount changes
return updatesCount, assetProxyModel.data(treeView.selection.currentIndex, 0x105);
}
function isEnabled() { function isEnabled() {
if (!treeView.selection.hasSelection) { if (!treeView.selection.hasSelection) {
return false; return false;
} }
var status = assetProxyModel.data(treeView.selection.currentIndex, 0x105); var status = getStatus();
if (status === "--") { if (status === "--") {
return false; return false;
} }
@ -880,7 +889,7 @@ Rectangle {
return false; return false;
} }
var status = assetProxyModel.data(treeView.selection.currentIndex, 0x105); var status = getStatus();
return isEnabled() && status !== "Not Baked"; return isEnabled() && status !== "Not Baked";
} }
} }