Skip to content

Commit

Permalink
Fix "Can't import from other partitions" issue
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelTallet committed Mar 31, 2023
1 parent 4b331b8 commit 04eded8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion source/universal_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Universal Importer plugin namespace.
module UniversalImporter

VERSION = '1.2.0'
VERSION = '1.2.1'

# Load translation if it's available for current locale.
TRANSLATE = LanguageHandler.new('uir.translation')
Expand Down
21 changes: 18 additions & 3 deletions source/universal_importer/assimp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ def self.convert_model(working_dir, in_filename, out_filename, log_filename)
out_filename = '"' + out_filename + '"'; log_filename = '"' + log_filename + '"';

# We change current directory to workaround Assimp issue with non-ASCII chars in paths.
command = "cd #{working_dir} && #{exe} export #{in_filename} #{out_filename} -tri"
if Sketchup.platform == :platform_win
command = "cd /d #{working_dir} && #{exe} export #{in_filename} #{out_filename} -tri"
else
command = "cd #{working_dir} && #{exe} export #{in_filename} #{out_filename} -tri"
end

status = system(command)

if status != true
Expand Down Expand Up @@ -123,7 +128,12 @@ def self.extract_textures(working_dir, in_filename, log_filename)
working_dir = '"' + working_dir + '"'; in_filename = '"' + in_filename + '"';
log_filename = '"' + log_filename + '"'

command = "cd #{working_dir} && #{exe} extract #{in_filename}"
if Sketchup.platform == :platform_win
command = "cd /d #{working_dir} && #{exe} extract #{in_filename}"
else
command = "cd #{working_dir} && #{exe} extract #{in_filename}"
end

status = system(command)

if status != true
Expand Down Expand Up @@ -164,7 +174,12 @@ def self.get_texture_refs(working_dir, in_filename, log_filename)

texture_refs = []

command = "cd #{working_dir} && #{exe} info #{in_filename} > #{log_filename}"
if Sketchup.platform == :platform_win
command = "cd /d #{working_dir} && #{exe} info #{in_filename} > #{log_filename}"
else
command = "cd #{working_dir} && #{exe} info #{in_filename} > #{log_filename}"
end

status = system(command)

if status != true
Expand Down
9 changes: 8 additions & 1 deletion source/universal_importer/meshlab.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,17 @@ def self.apply_script(working_dir, in_filename, out_filename, mlx_filename, log_
raise ArgumentError, 'Log Filename must be a String' unless log_filename.is_a?(String)

# We change current directory to workaround MeshLab issue with non-ASCII chars in paths.
command = 'cd "' + working_dir + '" && ' +
if Sketchup.platform == :platform_win
command = 'cd /d "' + working_dir + '" && ' +
'"' + exe + '" -i "' + in_filename +
'" -o "' + out_filename + '" -m wt' +
' -s "' + mlx_filename + '"'
else
command = 'cd "' + working_dir + '" && ' +
'"' + exe + '" -i "' + in_filename +
'" -o "' + out_filename + '" -m wt' +
' -s "' + mlx_filename + '"'
end

status = system(command)

Expand Down

0 comments on commit 04eded8

Please sign in to comment.