[ui] Inspector3D: add media contextual menu

Contextual menu to expose additional actions:
 * open media containing folder
 * copy media path
 * advanced manual control over media (un)loading
+ fix MediaLibrary to avoid binding loop on 'visible' when directly modifying 'request' property
This commit is contained in:
Yann Lanthony 2018-12-10 13:23:20 +01:00
parent 272cd24fb9
commit c3750a33c3
3 changed files with 37 additions and 5 deletions

View file

@ -194,10 +194,8 @@ Entity {
if(attribute) {
model.source = rawSource;
}
// auto-restore entity if raw source is in cache ...
// auto-restore entity if raw source is in cache
model.requested = forceRequest || (!model.valid && model.requested) || cache.contains(rawSource);
// ... and update media visibility (useful if media was hidden but loaded back from cache)
model.visible = model.requested;
model.valid = Filepath.exists(rawSource) && dependencyReady;
}
@ -211,9 +209,13 @@ Entity {
remove(index)
}
onCurrentSourceChanged: updateModelAndCache()
onCurrentSourceChanged: updateModelAndCache(false)
onFinalSourceChanged: {
// update media visibility
// (useful if media was explicitly unloaded or hidden but loaded back from cache)
model.visible = model.requested;
var cachedObject = cache.pop(rawSource);
cached = cachedObject !== undefined;
if(cached) {