Lod picker

This commit is contained in:
Aaron Kimbre
2022-02-11 17:37:43 -06:00
parent 8646c40943
commit 869bbdf7e6
4 changed files with 67 additions and 36 deletions

View File

@@ -467,16 +467,16 @@
constructor(designID, database){
this.designID = designID
this.Parts = []
this.studsFields2D = []
let GeometryLocation = `${designID}.g`
let lod = {{ lod }}
let GeometryLocation = `lod${lod}/${designID}.g`
let PrimitiveLocation = `${designID}.xml`
let GeometryCount = 0
while (GeometryLocation in database.filelist) {
this.Parts[GeometryCount] = new GeometryReader(database.filelist[GeometryLocation].read())
GeometryCount = GeometryCount + 1
GeometryLocation = `${designID}.g${GeometryCount}`
GeometryLocation = `lod${lod}/${designID}.g${GeometryCount}`
}
let primitive = new Primitive(database.filelist[PrimitiveLocation].read())
this.Partname = primitive.Designname
@@ -1019,7 +1019,7 @@
return self.filelist[filename];
}
parse(dburl) {
parse(dburl, folder="") {
let self = this;
let xhr = new XMLHttpRequest();
xhr.open('GET', dburl, false);
@@ -1038,10 +1038,16 @@
let obj = data[i];
if (obj.type == 'directory'){
// parse subdirs
self.parse(dburl + obj.name + '/')
self.parse(dburl + obj.name + '/', obj.name)
}
else if (obj.type == 'file'){
self.filelist[obj.name] = new DBURLFile(dburl + obj.name, obj.name)
if (folder.includes("lod")){
self.filelist[`${folder}/${obj.name}`] = new DBURLFile(dburl + obj.name, obj.name)
} else {
self.filelist[obj.name] = new DBURLFile(dburl + obj.name, obj.name)
}
}
else {
console.log('Strange object parsed: ' + obj.type)
@@ -1063,7 +1069,7 @@
let lxfml_file_list = [
{% for model in content %}
{% if model.lot == 14 %}
"{{url_for('properties.get_model', id=model.id, file_format='lxfml')}}"{{ ", " if not loop.last else "" }}
"{{url_for('properties.get_model', id=model.id, file_format='lxfml', lod=lod)}}"{{ ", " if not loop.last else "" }}
{% endif %}
{% endfor %}
]

View File

@@ -84,8 +84,16 @@
<div class="row">
<div class="col text-center">
<a role="button" class="btn btn-primary btn-block"
href='{{ url_for('properties.view_models', id=property.id) }}'>
Render Property
href='{{ url_for('properties.view_models', id=property.id, lod=0) }}'>
Render: High
</a>
<a role="button" class="btn btn-primary btn-block"
href='{{ url_for('properties.view_models', id=property.id, lod=1) }}'>
Render: Medium
</a>
<a role="button" class="btn btn-primary btn-block"
href='{{ url_for('properties.view_models', id=property.id, lod=2) }}'>
Render: Low
</a>
</div>
</div>

View File

@@ -44,21 +44,12 @@
<div class="row">
<div class="col text-center">
<a role="button" class="btn btn-primary btn-block"
href='{{ url_for('properties.get_model', id=item.id, file_format="lxfml") }}'>
href='{{ url_for('properties.get_model', id=item.id, file_format="lxfml", lod=0) }}'>
View Model XML
</a>
</div>
</div>
<br/>
<div class="row">
<div class="col text-center">
<a role="button" class="btn btn-primary btn-block"
href='{{ url_for('properties.view_model', id=item.id) }}'>
Render Model
</a>
</div>
</div>
<br/>
<div class="row">
<div class="col text-center">
<a role="button" class="btn btn-primary btn-block"
@@ -67,5 +58,27 @@
</a>
</div>
</div>
<br/>
<h5 class="text-center"> Render </h5>
<div class="row">
<div class="col text-center">
<a role="button" class="btn btn-primary"
href='{{ url_for('properties.view_model', id=item.id, lod=0) }}'>
0
</a>
</div>
<div class="col text-center">
<a role="button" class="btn btn-primary"
href='{{ url_for('properties.view_model', id=item.id, lod=1) }}'>
1
</a>
</div>
<div class="col text-center">
<a role="button" class="btn btn-primary"
href='{{ url_for('properties.view_model', id=item.id, lod=2) }}'>
2
</a>
</div>
</div>
</div>
</div>