mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-14 00:31:58 +02:00
[ui][Viewer3D] MediaCache: add debug mode
add 'debug' mode to ease debugging of 3D Media cache
This commit is contained in:
parent
6a297d5bff
commit
971d4d7f0e
1 changed files with 31 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import QtQuick 2.9
|
||||||
import Qt3D.Core 2.1
|
import Qt3D.Core 2.1
|
||||||
import Qt3D.Render 2.1
|
import Qt3D.Render 2.1
|
||||||
|
|
||||||
|
@ -6,8 +7,35 @@ import Utils 1.0
|
||||||
Entity {
|
Entity {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
/// Enable debug mode (show cache entity with a scale applied)
|
||||||
|
property bool debug: false
|
||||||
|
|
||||||
enabled: false // disabled entity
|
enabled: false // disabled entity
|
||||||
|
|
||||||
|
components: [
|
||||||
|
Transform {
|
||||||
|
id: transform
|
||||||
|
scale: 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
StateGroup {
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
when: root.debug
|
||||||
|
name: "debug"
|
||||||
|
PropertyChanges {
|
||||||
|
target: root
|
||||||
|
enabled: true
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: transform
|
||||||
|
scale: 0.2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
property int cacheSize: 2
|
property int cacheSize: 2
|
||||||
property var mediaCache: {[]}
|
property var mediaCache: {[]}
|
||||||
|
|
||||||
|
@ -27,7 +55,7 @@ Entity {
|
||||||
return false;
|
return false;
|
||||||
if(contains(source))
|
if(contains(source))
|
||||||
return true;
|
return true;
|
||||||
// console.debug("[cache] add: " + source)
|
if(debug) { console.log("[cache] add: " + source); }
|
||||||
mediaCache[source] = object;
|
mediaCache[source] = object;
|
||||||
object.parent = root;
|
object.parent = root;
|
||||||
// remove oldest entry in cache
|
// remove oldest entry in cache
|
||||||
|
@ -43,10 +71,11 @@ Entity {
|
||||||
|
|
||||||
var obj = mediaCache[source];
|
var obj = mediaCache[source];
|
||||||
delete mediaCache[source];
|
delete mediaCache[source];
|
||||||
// console.debug("[cache] pop: " + source)
|
if(debug) { console.log("[cache] pop: " + source); }
|
||||||
// delete cached obj if file does not exist on disk anymore
|
// delete cached obj if file does not exist on disk anymore
|
||||||
if(!Filepath.exists(source))
|
if(!Filepath.exists(source))
|
||||||
{
|
{
|
||||||
|
if(debug){ console.log("[cache] destroy: " + source); }
|
||||||
obj.destroy();
|
obj.destroy();
|
||||||
obj = undefined;
|
obj = undefined;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue