removed texture renaming (too errorprone)

This commit is contained in:
Leon van Kammen 2025-11-28 20:10:23 +01:00
parent 916f82448b
commit 919a9461aa
4 changed files with 18 additions and 17 deletions

View file

@ -52,14 +52,8 @@ begin
# Iterate through the images array
gltf['images'].each_with_index do |img, i|
name = img['name']
next unless name && !name.empty?
new_filename = "#{dir}/#{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)
if File.exist?(old_filename) && !File.exist?(new_filename)

View file

@ -35,7 +35,7 @@ begin
end
XRForge.log("✅ compiling textures", logfile)
gltf_path = ".xrforge/#{filenameWithoutExt}.gltf"
gltf_path = ".xrforge/#{filenameWithoutExt}.gltf"
# Read and parse the GLTF JSON
gltf = JSON.parse(File.read(gltf_path))
@ -48,16 +48,14 @@ begin
# Iterate through the images array
gltf['images'].each_with_index do |img, i|
name = img['name']
next unless name && !name.empty?
new_filename = "#{dir}/#{name}.png"
new_filename = ""
new_filename = "#{dir}/#{filenameWithoutExt}_img#{i}.png"
# move file to modeldirectory (but dont overwrite if user overwrite it)
XRForge.log("🤔 checking #{new_filename}",logfile)
if File.exist?(new_filename)
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
end
end

View file

@ -71,7 +71,7 @@ begin
if data['description'] && data['description'].match(JMLHeuristic)
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
jmlMatch = data['description'].match(JMLHeuristic)
jml = jmlMatch[0]
@ -84,7 +84,7 @@ begin
<assetobject id="experience" src="#{federate_drive_host}/#{model_file.gsub("#","%23")}"/>
</Assets>
<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>
</FireBoxRoom>
<!-- archive.org hints -->
@ -117,6 +117,13 @@ begin
<janus-viewer>
#{jml}
</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 -->
<a href="#{federate_drive_host}/#{model_file.gsub("#","%23")}"></a>
</body>

View file

@ -82,7 +82,7 @@
<% end %>
<% if ENV['FEDERATE_DRIVE_HOST'].present? %>
<% if @model.tags.where(name: "janusxr" ).any? %>
<% if @model.tags.where(name: "xrfragments" ).any? %>
<tr>
<td>
<img src="/assets/janusxr.svg" style="width: 16px; transform: translate(0px,-2px);">
@ -123,7 +123,7 @@
<% end %>
<% if @model.tags.where(name: "mml" ).any? %>
<% if @model.tags.where(name: "xrfragments" ).any? %>
<tr>
<td>
<i class="bi bi-eye-fill" role="img"></i>
@ -187,6 +187,7 @@
</div>
</td>
</tr>
<!--
<tr>
<td>
<i class="bi bi-filetype-json" role="img"></i>
@ -205,6 +206,7 @@
</div>
</td>
</tr>
-->
<% end %>
<% if @model.collection %>