removed texture renaming (too errorprone)
This commit is contained in:
parent
916f82448b
commit
919a9461aa
4 changed files with 18 additions and 17 deletions
|
|
@ -52,14 +52,8 @@ begin
|
||||||
|
|
||||||
# Iterate through the images array
|
# Iterate through the images array
|
||||||
gltf['images'].each_with_index do |img, i|
|
gltf['images'].each_with_index do |img, i|
|
||||||
name = img['name']
|
new_filename = "#{dir}/#{filenameWithoutExt}_img#{i}.png"
|
||||||
next unless name && !name.empty?
|
|
||||||
|
|
||||||
old_filename = "#{dir}/.xrforge/#{filenameWithoutExt}_img#{i}.png"
|
old_filename = "#{dir}/.xrforge/#{filenameWithoutExt}_img#{i}.png"
|
||||||
new_filename = "#{dir}/#{name}.png"
|
|
||||||
|
|
||||||
puts old_filename
|
|
||||||
puts new_filename
|
|
||||||
|
|
||||||
# move file to modeldirectory (but dont overwrite if user overwrite it)
|
# move file to modeldirectory (but dont overwrite if user overwrite it)
|
||||||
if File.exist?(old_filename) && !File.exist?(new_filename)
|
if File.exist?(old_filename) && !File.exist?(new_filename)
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ begin
|
||||||
end
|
end
|
||||||
|
|
||||||
XRForge.log("✅ compiling textures", logfile)
|
XRForge.log("✅ compiling textures", logfile)
|
||||||
gltf_path = ".xrforge/#{filenameWithoutExt}.gltf"
|
gltf_path = ".xrforge/#{filenameWithoutExt}.gltf"
|
||||||
|
|
||||||
# Read and parse the GLTF JSON
|
# Read and parse the GLTF JSON
|
||||||
gltf = JSON.parse(File.read(gltf_path))
|
gltf = JSON.parse(File.read(gltf_path))
|
||||||
|
|
@ -48,16 +48,14 @@ begin
|
||||||
|
|
||||||
# Iterate through the images array
|
# Iterate through the images array
|
||||||
gltf['images'].each_with_index do |img, i|
|
gltf['images'].each_with_index do |img, i|
|
||||||
name = img['name']
|
new_filename = ""
|
||||||
next unless name && !name.empty?
|
new_filename = "#{dir}/#{filenameWithoutExt}_img#{i}.png"
|
||||||
|
|
||||||
new_filename = "#{dir}/#{name}.png"
|
|
||||||
|
|
||||||
# move file to modeldirectory (but dont overwrite if user overwrite it)
|
# move file to modeldirectory (but dont overwrite if user overwrite it)
|
||||||
XRForge.log("🤔 checking #{new_filename}",logfile)
|
XRForge.log("🤔 checking #{new_filename}",logfile)
|
||||||
if File.exist?(new_filename)
|
if File.exist?(new_filename)
|
||||||
XRForge.log("✅ importing #{new_filename} -> #{resource['path']}",logfile)
|
XRForge.log("✅ importing #{new_filename} -> #{resource['path']}",logfile)
|
||||||
img['uri'] = "#{name}.png"
|
img['uri'] = new_filename # NOTE: editing uri will cause assimp to drop image['name'] when exporting :/
|
||||||
update = true
|
update = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ begin
|
||||||
|
|
||||||
if data['description'] && data['description'].match(JMLHeuristic)
|
if data['description'] && data['description'].match(JMLHeuristic)
|
||||||
if data['description'].match(/autogenerate=['"]false['"]/)
|
if data['description'].match(/autogenerate=['"]false['"]/)
|
||||||
XRForge.log("✅ autogenerate='false' found in JML..keeping this JML")
|
XRForge.log("✅ autogenerate='false' found in JML..keeping this JML",logfile)
|
||||||
autogenerate = false
|
autogenerate = false
|
||||||
jmlMatch = data['description'].match(JMLHeuristic)
|
jmlMatch = data['description'].match(JMLHeuristic)
|
||||||
jml = jmlMatch[0]
|
jml = jmlMatch[0]
|
||||||
|
|
@ -84,7 +84,7 @@ begin
|
||||||
<assetobject id="experience" src="#{federate_drive_host}/#{model_file.gsub("#","%23")}"/>
|
<assetobject id="experience" src="#{federate_drive_host}/#{model_file.gsub("#","%23")}"/>
|
||||||
</Assets>
|
</Assets>
|
||||||
<Room autogenerate="true" #{ data['keywords'].include?('singleuser') ? "private='true'" : ""}>
|
<Room autogenerate="true" #{ data['keywords'].include?('singleuser') ? "private='true'" : ""}>
|
||||||
<object pos="0 0 0" collision_id="experience" id="experience" />
|
<object pos="0 0 5" rotation="-180 0 180" lighting="false" collision_id="experience" id="experience" />
|
||||||
</Room>
|
</Room>
|
||||||
</FireBoxRoom>
|
</FireBoxRoom>
|
||||||
<!-- archive.org hints -->
|
<!-- archive.org hints -->
|
||||||
|
|
@ -117,6 +117,13 @@ begin
|
||||||
<janus-viewer>
|
<janus-viewer>
|
||||||
#{jml}
|
#{jml}
|
||||||
</janus-viewer>
|
</janus-viewer>
|
||||||
|
|
||||||
|
<!-- map query args as attributes -->
|
||||||
|
<script>
|
||||||
|
args = new URLSearchParams(document.location.search)
|
||||||
|
for( const [k,v] of args.entries()) document.querySelector("Room").setAttribute(k,v)
|
||||||
|
</script>
|
||||||
|
|
||||||
<!-- archive.org hints -->
|
<!-- archive.org hints -->
|
||||||
<a href="#{federate_drive_host}/#{model_file.gsub("#","%23")}"></a>
|
<a href="#{federate_drive_host}/#{model_file.gsub("#","%23")}"></a>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if ENV['FEDERATE_DRIVE_HOST'].present? %>
|
<% if ENV['FEDERATE_DRIVE_HOST'].present? %>
|
||||||
|
|
||||||
<% if @model.tags.where(name: "janusxr" ).any? %>
|
<% if @model.tags.where(name: "xrfragments" ).any? %>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<img src="/assets/janusxr.svg" style="width: 16px; transform: translate(0px,-2px);">
|
<img src="/assets/janusxr.svg" style="width: 16px; transform: translate(0px,-2px);">
|
||||||
|
|
@ -123,7 +123,7 @@
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @model.tags.where(name: "mml" ).any? %>
|
<% if @model.tags.where(name: "xrfragments" ).any? %>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<i class="bi bi-eye-fill" role="img"></i>
|
<i class="bi bi-eye-fill" role="img"></i>
|
||||||
|
|
@ -187,6 +187,7 @@
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<!--
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<i class="bi bi-filetype-json" role="img"></i>
|
<i class="bi bi-filetype-json" role="img"></i>
|
||||||
|
|
@ -205,6 +206,7 @@
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
-->
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @model.collection %>
|
<% if @model.collection %>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue