Skip to content

Commit

Permalink
Add TGA & TIF support.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelTallet committed Jan 29, 2020
1 parent 62db329 commit 14e475c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
8 changes: 4 additions & 4 deletions source/universal_importer.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Universal Importer extension for SketchUp 2017 or newer.
# Copyright: © 2019 Samuel Tallet <samuel.tallet arobase gmail.com>
# Universal Importer (UIR) extension for SketchUp 2017 or newer.
# Copyright: © 2020 Samuel Tallet <samuel.tallet arobase gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -26,7 +26,7 @@
# Universal Importer plugin namespace.
module UniversalImporter

VERSION = '1.1.4'.freeze
VERSION = '1.1.5'.freeze

# Load translation if it's available for current locale.
TRANSLATE = LanguageHandler.new('uir.strings')
Expand All @@ -44,7 +44,7 @@ module UniversalImporter

extension.version = VERSION
extension.creator = 'Samuel Tallet'
extension.copyright = 2019 #{extension.creator}"
extension.copyright = 2020 #{extension.creator}"

features = [
TRANSLATE['Import 3D models in SketchUp. 50+ formats are supported.'],
Expand Down
20 changes: 17 additions & 3 deletions source/universal_importer/importer.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Universal Importer extension for SketchUp 2017 or newer.
# Copyright: © 2019 Samuel Tallet <samuel.tallet arobase gmail.com>
# Universal Importer (UIR) extension for SketchUp 2017 or newer.
# Copyright: © 2020 Samuel Tallet <samuel.tallet arobase gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -347,6 +347,20 @@ def fix_e_tex_in_obj_export
'import_img' + texture_index.to_s + '.bmp'
)

elsif File.exist?(texture_image_base_path + '.tga')

obj_mtl_export.gsub!(
'*' + texture_index.to_s,
'import_img' + texture_index.to_s + '.tga'
)

elsif File.exist?(texture_image_base_path + '.tif')

obj_mtl_export.gsub!(
'*' + texture_index.to_s,
'import_img' + texture_index.to_s + '.tif'
)

end

end
Expand Down Expand Up @@ -377,7 +391,7 @@ def fix_m_tex_in_obj_export
texture_path = UI.openpanel(

TRANSLATE['Select a Texture for Material:'] + ' ' + material_name,
nil, TRANSLATE['Images'] + '|*.jpg;*.png;*.bmp;||'
nil, TRANSLATE['Images'] + '|*.jpg;*.png;*.bmp;*.tga;*.tif;||'

)

Expand Down

0 comments on commit 14e475c

Please sign in to comment.