[Plugin] Exporting a texture from a material

[Plugin] Exporting a texture from a material

Postby Al Hart » Tue Nov 20, 2007 11:45 am

It's interesting how you can forget things.

I needed a ruby script to extract a texture file from a SketchUp texture. So I started searching around and found this thread.

http://www.sketchucation.com/forums/scf ... 115&t=1087

But SURPRISE! :) It turns to to be a script that I wrote and sent to Didier for distribution. (rps_texturewrite.rb)

I was looking for a script to extract a single texture, so I modified rps_texturewrite.rb to extract the texture from a selected face (or other entity),
and ask you where you want to save it.

When you load it (or put it in the plugins folder), it adds two commands to the plugins menu:

Export Textures - this saves all the raster images for textures in your model to a folder called 'texture_test' in your temporary folder.

Export Selected Texture - This exports the first texture it finds in the current selection and asks you where to put it.

(I put this here instead of the ruby forum because people may want to extract textures from materials without getting involved in ruby scripts)

[EDIT Aug 30, 2012 - replaced rps_texturewrite.rb with a version which works better]
0
Last edited by Al Hart on Thu Aug 30, 2012 3:13 pm, edited 1 time in total.
Al Hart
IRender nXt from Render Plus
User avatar
Al Hart 
PluginStore Author
PluginStore Author
 

Re: Exporting a texture from a material

Postby kwistenbiebel » Mon Feb 11, 2008 10:28 am

Hi Al,

I try to use the 'export textures' but I don't know where to find the temporary folder...
Is it situated under C\Windows somewhere?
0

kwistenbiebel 
 

Re: Exporting a texture from a material

Postby kwistenbiebel » Tue Feb 12, 2008 3:27 am

Nevermind..... ;)
I used a workaround by exporting my scene to Kerkythea (Indigo works as well).
The export automatically saves a folder with all textures in the same folder as the export output file.

Also for users of Podium: a texture folder is in the >plugins>podium map containing all textures.
0

kwistenbiebel 
 

Re: Exporting a texture from a material

Postby Didier Bur » Wed Feb 13, 2008 1:01 pm

Hi,
A little bit off topic, but I've just coded a very fast texture writer. Instead of interating through all the entities of the model, dig in groups/components, etc, etc, it iterates through materials and assign each material which has a texture to a virtual face. 10 times faster, especially on huge models as you may think.
It's here:
http://www.sketchucation.com/forums/scf/viewtopic.php?f=153&t=6386
0
Last edited by Didier Bur on Wed Feb 13, 2008 1:06 pm, edited 1 time in total.
Didier Bur
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur 
 

Re: Exporting a texture from a material

Postby remus » Wed Feb 13, 2008 1:03 pm

when you say 'here:' do you mean in your archive, or did you forget the link?
0

remus 
 

Re: Exporting a texture from a material

Postby Alan Fraser » Wed Feb 13, 2008 1:09 pm

Unless I'm missing something here, why can't you simply r-click the material swatch in the In Model library, choose Export Texture Image and save it to your Desktop?
0
FormFonts
Were you required to walk 500 miles? Were you advised to walk 500 more?
You could be entitled to compensation. Call the Pro Claimers now!
User avatar
Alan Fraser 
Top SketchUcator
 

Re: Exporting a texture from a material

Postby troyhome » Tue Jul 29, 2008 5:19 pm

I'm on a Mac using SU6 and the only way i can export textures is using the Export Selected Texture; all other texture exporters do not work for me. And one-at-a-time texture export is not fun. On the PC i can right click the texture in the texture window and save as, but no such luck on the mac. Any suggestions besides exporting as a 3d format and manually relinking?
0
IOviz.com
SU Pro 2017 PC
Thea: latest
vray4SU latest
User avatar
troyhome 
 

Re: Exporting a texture from a material

Postby Al Hart » Wed Jul 30, 2008 12:04 am

Did you try the texture_writer ruby script in this thread?

I would expect it to work on the mac.

- Also, have you tried reading the texture from the .skm file. You can open the file with WinZip and see the texture stored in the file.
0
Al Hart
IRender nXt from Render Plus
User avatar
Al Hart 
PluginStore Author
PluginStore Author
 

Re: Exporting a texture from a material

Postby troyhome » Wed Jul 30, 2008 2:47 pm

I tried the file in this thread- maybe it's not playing nice with some of the other ruby's i've got.
I'll try looking at the .skm which i assume is somewhere on my computer :)
Thanks!
0
IOviz.com
SU Pro 2017 PC
Thea: latest
vray4SU latest
User avatar
troyhome 
 

Re: Exporting a texture from a material

Postby Al Hart » Wed Jul 30, 2008 2:59 pm

Here is a carpet.skm file - located in the SketchUp Materials folder.

carpet-skm.png
0
Al Hart
IRender nXt from Render Plus
User avatar
Al Hart 
PluginStore Author
PluginStore Author
 

Re: Exporting a texture from a material

Postby troyhome » Wed Jul 30, 2008 3:06 pm

Thank you, Al- this will help tremendously!
One thing i should note about the script is that when i do run it to export all materials, it appears as though something happens- as though there might be a window hiding that shows a save location or somethings- but then there is nothing. All i mean is- i wonder if the materials are saving to some hidden location?
Oh well- i like the .skm approach- thanks again!
0
IOviz.com
SU Pro 2017 PC
Thea: latest
vray4SU latest
User avatar
troyhome 
 

Re: Exporting a texture from a material

Postby Chris Fullmer » Wed Jul 30, 2008 7:48 pm

Whats the matter with exportingas a 3ds file to get all the images out? I saw you said you didn't want to do that, but I didn't catch why? What do you mean by manually relinking?

Chris
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: Exporting a texture from a material

Postby troyhome » Wed Jul 30, 2008 10:58 pm

Hi Chris,
I just mean having to export the file on which i'm working just so i get the maps... manually relinking? I don't know what i was thinking about when i typed that... I've been linking maps to Maxwell materials for the last couple days- i imagine that made it into my post somehow- how embarrassing.
0
IOviz.com
SU Pro 2017 PC
Thea: latest
vray4SU latest
User avatar
troyhome 
 

Re: [Plugin] Exporting a texture from a material

Postby Artz_ab » Sun Oct 10, 2010 5:15 pm

thank you, i will try it
0

Artz_ab 
 

Re: [Plugin] Exporting a texture from a material

Postby Ineshtine » Tue Jun 12, 2012 3:54 am

I'm a year an a half off on this topic, but if anyone cares, I have written a plugin to export all of the textures from your models. It's very fast and not coded in Ruby. It's freeware and you can get it from http://Raylectron.com

Please let me know how it works for you?
0
What? you haven't tried Raylectron yet?
User avatar
Ineshtine 
 

Re: [Plugin] Exporting a texture from a material

Postby eidam655 » Thu Aug 30, 2012 10:41 am

hi, the raylecton exporter looks good, however, i would like to retain the plugin's functionality inside sketchup.

so far the mass-export does not work because of this:

Code: Select all
Error: #<ArgumentError: wrong number of arguments (2 for 3)>
C:/PROGRA~1/Google/Google SketchUp 8/Plugins/rps_texturewrite.rb:25:in `export_texture'
C:/PROGRA~1/Google/Google SketchUp 8/Plugins/rps_texturewrite.rb:25:in `exportTextures'
C:/PROGRA~1/Google/Google SketchUp 8/Plugins/rps_texturewrite.rb:24:in `each'
C:/PROGRA~1/Google/Google SketchUp 8/Plugins/rps_texturewrite.rb:24:in `exportTextures'
C:/PROGRA~1/Google/Google SketchUp 8/Plugins/rps_texturewrite.rb:216


i would love to fix this, but i'm not familiar with Ruby, let alone Ruby inside Sketchup. if anyone could have a look at this issue, i'd be very very glad...
0
I'm using SketchUp 2015, V-Ray 2.
User avatar
eidam655 
 

Re: [Plugin] Exporting a texture from a material

Postby TIG » Thu Aug 30, 2012 10:44 am

OR there's Didier's "Very Fast Texture Writer" viewtopic.php?t=6386
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Exporting a texture from a material

Postby Ineshtine » Thu Aug 30, 2012 12:59 pm

rps_texturewrite.rb is not part of Raylectron, it's from Renderplus, so you may want to contact them.

The Raylectron texture exporter is very fast, and, you can select the format you want to save the images as, and where to save them, and, it's easier to use, with a nice GUI.
0
What? you haven't tried Raylectron yet?
User avatar
Ineshtine 
 

Re: [Plugin] Exporting a texture from a material

Postby Al Hart » Thu Aug 30, 2012 3:14 pm

I got the same errors when trying to use rps_texturewrite.rb.

I fixed it and uploaded a new version into the first post in this thread.
0
Al Hart
IRender nXt from Render Plus
User avatar
Al Hart 
PluginStore Author
PluginStore Author
 

Re: Exporting a texture from a material

Postby Al Hart » Thu Aug 30, 2012 3:20 pm

troyhome wrote:Thank you, Al- this will help tremendously!
One thing i should note about the script is that when i do run it to export all materials, it appears as though something happens- as though there might be a window hiding that shows a save location or somethings- but then there is nothing. All i mean is- i wonder if the materials are saving to some hidden location?
Oh well- i like the .skm approach- thanks again!


In the newest version, I added a display of the file names of all textures saved, which will appear in the Ruby Console. That should help:

e.g.

Writing: c:\tmp/texture_test/F0.jpg
0
Al Hart
IRender nXt from Render Plus
User avatar
Al Hart 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Exporting a texture from a material

Postby eidam655 » Thu Aug 30, 2012 5:17 pm

thanks for the fix, but in the meantime i also found the plugin TIG linked, so it's settled...

i might download the new version of this plugin, just to see the difference in source code; might come handy :)
0
I'm using SketchUp 2015, V-Ray 2.
User avatar
eidam655 
 

Re: [Plugin] Exporting a texture from a material

Postby dramachik27 » Sat Jul 20, 2013 2:11 am

Hello, I am new to sketchup and I am trying to use the program to create 3D models for a game. The issue I am having is when I export the model into Torque. We see all the colors I have applied but as for textures, they are all gone. Is there a way to change this outcome? :)
~G
0
User avatar
dramachik27 
 

Re: [Plugin] Exporting a texture from a material

Postby thomthom » Sat Jul 20, 2013 10:39 am

What format are you exporting to?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Exporting a texture from a material

Postby deaneau » Thu Jul 02, 2015 11:57 am

hi Al Hart, i would love if you change your plugin by reading the color name and than naming the textures. this would be cool

thank you
0
MADE, BORN AND LIVING IN BERLIN
Big Thank You to all Programmers
Some German words are so long that they have a perspective. M.Twain
User avatar
deaneau 
 

Re: [Plugin] Exporting a texture from a material

Postby Al Hart » Mon Jul 20, 2015 5:36 pm

Would you like to rename color only materials in SketchUp (not materials with textures) so the name matches the color (eg. RGB 255,0,0 becomes red), for common colors and the hex color for non-standard colors (e.g. RGB 100,200,100 becomes #64c864)

One "problem" we found recently is that people don't call RGB 0,255,0 green - but rather call it lime- and call 0,128,0 green

as in this chart:

0
Al Hart
IRender nXt from Render Plus
User avatar
Al Hart 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Exporting a texture from a material

Postby Al Hart » Mon Jul 20, 2015 5:39 pm

or did you mean that you wanted to rename the material itself to match the texture name included in the material?
0
Al Hart
IRender nXt from Render Plus
User avatar
Al Hart 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Exporting a texture from a material

Postby Al Hart » Mon Jul 20, 2015 5:42 pm

or did you want to automatically rename the textures stored in the material to match the name of the material itself.

This gets tricky because the SketchUp material can have names like: a'b/c, while a'b/c would not be a legal name for the texture itself.
0
Al Hart
IRender nXt from Render Plus
User avatar
Al Hart 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Exporting a texture from a material

Postby deaneau » Tue Oct 13, 2015 10:02 pm

Al sorry for my very late answer.

1. about Lime RGB 0 255 0

in the RAL Colorchart you have not a color with this Name and RGB value.

look here

http://www.ralcolor.com

standard colors Like RAL, HKS, PANTONE etc. is based on the subtractive color scheme (body colors) when you have "RGB" (normally additive color scheme) and add al three together you have black as result.

additive color scheme https://de.wikipedia.org/wiki/Additive_Farbmischung

result is white (light colors)

the RGB Value is only an orientation and the name of the color is an orientation ,too. some peoples can memorize names better than digits or numbers and vice versa.

2. i would have this:

at (1) this name as image name, too in field (2)

actually the plugin doesn´t work with the last sketchup make, or i doing anithing wrong.

Snap_2015.10.13_22h50m47s_001_Materials.png


i have attache the skp file.. the object was created with eneroth extract material.

the color itself was created with a CSV-import-plugin.

sorry again for the late answer.

best regards Dean
0
MADE, BORN AND LIVING IN BERLIN
Big Thank You to all Programmers
Some German words are so long that they have a perspective. M.Twain
User avatar
deaneau 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Plugins

Who is online

Users browsing this forum: thinga, zul6041 and 23 guests

Visit our sponsors: