[Plugin] TextureSwapper v1.1 20111112

[Plugin] TextureSwapper v1.1 20111112

Postby TIG » Sat Nov 12, 2011 4:33 pm

(c) TIG 2011
All Rights Reserved.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES,INCLUDING,WITHOUT LIMITATION,THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
###
Script:
TextureSwapper.rb
###
Swaps Textures between two standard folders.
###
Usage:
Type in the Ruby Console...
TextureSwapper.out
OR use CADfather's toolbar 'TextureSwapper' item... still use Console to
see what's happened...
All of the model's materials' textures image-files are exported into a
folder with the model called 'ModelName_TexturesOUT', it's made if it
doesn't exist. It returns a message in the Console, including an array
of the exported textures' image-files' names.
You can then copy that folder as 'ModelName_TexturesIN' and edit the
texture image-files as desired - e.g. reducing their resolution or other
adjustments to them... Remove or do not alter textures that are to be
left alone...
Next type in the Ruby Console...
TextureSwapper.in
OR use CADfather's toolbar 'TextureSwapper' item... still use Console to
see what's happened...
All of the model's materials' textures are updated using the image-files
found in 'ModelName_TexturesIN'. It returns a message in the Console,
including an array of the imported textures' image-files' names.
The replacement textures use the previous texture size, so for example
if you half the resolution of an image that is then imported it will
still appears the same size in the model, because the original w/h are
preserved.
The 'TextureSwapper.in' action is one step undoable - useful if you find
that you don't like the results !
###
Donations: by PayPal.com to info @ revitrev.org
###
Version:
1.0 20111112 First issue.
1.1 20111112 Toolbar version created by CADfather, TIG tweaked.
###This is v1.1 with the Toolbar
TextureSwapper1-1.zip

You can still use the original v1.0 version without the Toolbar, if you want to...
TextureSwapper.rb
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TextureSwapper v1.0 20111112

Postby CadFather » Sat Nov 12, 2011 5:07 pm

incredible... and it took you less than me doing the icons.. :roll:

here's the file with the toolbar if you want to integrate it - (then i can delete the attachment)

respect.gif

(i really think we should have this icon in the list)

.
0
User avatar
CadFather 
PluginStore Author
PluginStore Author
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby TIG » Sat Nov 12, 2011 5:42 pm

Here's v1.1 viewtopic.php?p=365582#p365582
It now includes a 'TextureSwapper' Toolbar with snazzy icons [by CADfather, with TIG tweaks].
So you can now run the two tools from the Ruby Console OR from the new Toolbar...

I've left v1.0 on the page in case you want a toolbar-free version ;)
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby McGyver » Sat Nov 12, 2011 5:53 pm

Forgive me for asking a stupid question...

Its the purpose/function of this plugin to: Export all the textures(and JUST the textures) of a model to a separate folder, allowing you to then swap out those textures for other other, either higher rez or different color etc... and then import them back into the model "swapping" them for the originals... thus creating an alternate texture version of the original model... in effect doing a mass "re-paint" ?
0
User avatar
McGyver 
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby CadFather » Sat Nov 12, 2011 5:56 pm

you mean, "forgive me for giving you the right answer". :thumb:


EDIT: darn it... can't even get the toolbar right, that TIG has to tweak it... :roll:
0
User avatar
CadFather 
PluginStore Author
PluginStore Author
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby TIG » Sat Nov 12, 2011 6:04 pm

Yes. :o

It came out of CADfather's idea in another recent thread.

You export all of your model's texture image-files into a 'ModelName_TexturesOUT' folder using the first tool.

You then copy that folder with its files intact, as 'ModelName_TexturesIN'... and then edit the images as you will with Photoshop/Gimp/etc, perhaps making them higher/lower resolutions, more/less grainy/sharp/noisy, or with adjusted colors etc etc.

The second tool then imports all of those images from that 'IN' folder... and swaps them for each of the model's materials' textures as appropriate. The original image size is always kept, so changing an image's resolution will not change the size of the textured material that uses it, when it's viewed in the model - although it might actually look [slightly] different depending on what you've done to that image while editing it...
:ugeek:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby McGyver » Sun Nov 13, 2011 4:22 pm

Thank you both for the reply and for this wonderful plugin! One last question if I may... I suppose the altered textures would have to retain their original names for this to work... Correct?
0
User avatar
McGyver 
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby TIG » Sun Nov 13, 2011 6:08 pm

Yes, the names must be the same - but if you rename a completely different image-file in the IN folder with the original name it'll replace OK on 'IN'. The only caveat is that the 'aspect-ratio' of the image's w/h should be equivalent - unless of course you want distorted results...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby McGyver » Sun Nov 13, 2011 11:29 pm

Thank you! This should come in hand with some older models that I wanted to retexture! Thanks again TIG and CadFather for this plugin!
0
User avatar
McGyver 
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby samyell77 » Tue Nov 29, 2011 5:09 pm

Hi TIG,
Love this plugin - fantastic! Ive had a play with it on a couple of files and mostly have had perfect results. However there is a file that Ive run this on where not all of the textures are exported? After Ive run the plugin it says its exported 51 textures but there are only 33 in the folder? Do you have any idea why this would happen?
Thanks
Sam
0
SU Pro 2016
Dell Precision M4800
PC Windows 10
Intel Core i7-4900MQ @ 2.80ghz
Nvidia Quadro K2100M
16gb RAM

samyell77 
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby TIG » Tue Nov 29, 2011 5:33 pm

If some of your Materials use the exact same name for their texture-file you will get fewer .jpg/.png files exported than Materials processed.
For example, you might have 3 'glass-brick' materials that all happen to use 'glass_brick123.png', so there will be more materials processed than texture files made.
It should affect the result as when each Material's texture file is added back the same file can get reused by several materials.
It's quite possible that the one texture-file is used in several Materials - for example you might have the texture set to use different sizes in different Materials, or apply a 'color' over it or even have different transparency settings...
However, if the 3 glass-brick materials are exactly the same in all respects, then tools lie=ke MaterialConsolidator will reduce the Materials list back to have used just one - so if so then use that before using this tool...
The worst result is if you have three materials using a texture with the same name that's actually completely different! But that's housekeeping and commonsense. So never use non-specific texture names like 'texture1.png' as somewhere along the line they'll be another material using a texture with that name that's not remotely similar :roll:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby samyell77 » Wed Nov 30, 2011 11:28 am

Hi TIG,
Thanks for coming back. Totally understand about not using the same names and that materials that use the same map wont export different maps. Ive opened several of the materials whose maps don't export using the plugin. If I go to open them in photoshop through the material palet it opens the temp folder and the files have the following names:

C/\Users\CHRIS~1.GWY\AppData\Local\Temp\txjv9jiw.jpg
C/\Users\chris.gwyther\Desktop\Breakthrough book cover.jpg
S/\Level 3\Design Team\Design Reference\3D\Models\Furniture\Espresso Machine LaCimbali\1B Model Library\Library Built by Ryan\Equipment\lcd-display-screen.jpg

Not sure why it has that name but its appears to be the address that the original material is stored or first used? We work on a network and work on both Mac and PC (which seems to add some issues). Could the file name be too long to save? Ive tried saving it to my (mac) desktop but still no joy. Do you think this is resolvable or is this just another PC / Mac issue.
Any ideas? Thanks again.

Sam
0
SU Pro 2016
Dell Precision M4800
PC Windows 10
Intel Core i7-4900MQ @ 2.80ghz
Nvidia Quadro K2100M
16gb RAM

samyell77 
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby samyell77 » Wed Nov 30, 2011 11:44 am

Just tried re-saving a couple of files on the mac from photoshop and get an error message telling me that the file name isn't valid so I know why they wont save now using TextureSwapper but do you know if there's any way around this in terms of how the materials are created? Im guessing the answer is probably no, as Im sure its something thats written into SU. It seems that any materials that have been created on mac dont have this massive long name, but the PC ones do. Hope you can help . . .
0
SU Pro 2016
Dell Precision M4800
PC Windows 10
Intel Core i7-4900MQ @ 2.80ghz
Nvidia Quadro K2100M
16gb RAM

samyell77 
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby TIG » Wed Nov 30, 2011 8:46 pm

If you edit a texture it gets saved to a temp folder, depending on your OS...
However, if you export textures using this tool the file name is kept and the file goes into the common folder ?? :?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby schnydix » Sun Nov 09, 2014 10:54 pm

rrrr.jpg
qqq.jpg
hello Tig
First off all thank you for all the great tools
i try to make my textures smaller with the software Jpgmini and texture swapper
but my snapshots have after this all the same texture ?
Texture names are unik the model is 90 mb
The jpegmini software works well but the import see only the first snapshot ?

Thanks for helb

See below wath swapper make with my Map :?
0

schnydix 
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby TIG » Mon Nov 10, 2014 11:42 am

@schnydix

I am not exactly clear what your problem is...

Have you tried Fixing issues under Model Info > Statistics ?
Have you tried Purging under the same option?

Do the various materials have 'simple names' ?
Are these names 'related' etc...
What is the connection between the failing ones ?
etc
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby schnydix » Tue Nov 11, 2014 12:47 am

Hello Tig
Fast service here
You see the 1 picture with a lot of grass the 2 picture shows only one forest texture over all
The material are google earth snapshots they are groups
the names are Google Earth Snapshot#66
some materials have a hidden line between

Thanks for help
0

schnydix 
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby TIG » Tue Nov 11, 2014 12:02 pm

Were some of the 'gray' roofs etc in the original, using the default-material ?
Which is now taking a textured material ?

I am still unclear about what you are swapping with what...

Does giving these default-material faces a real color help ?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby schnydix » Tue Nov 11, 2014 4:42 pm

Hello Tig
I try to have the same textures like in picture 1
I use the Swapper only to make the picture folder smaller
The Software Jpegmini compress the 90 MB to an 29 Mb i save 70 Mb in the model.
The Material size and resolution are the same like bevor.
I Think the proplem is the name i have to rename all.
I Will report you the result in some days Thanks for all at the moment
esense3d
0

schnydix 
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby Flatchoum » Mon Aug 26, 2019 9:33 am

Hi,
Is there a chance This Plugin doesn´t work any more in sketchup 2018?
I can´t start it any more. Thank you for your help, Best,
0
User avatar
Flatchoum 
Premium Member
Premium Member
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby juju » Mon Aug 26, 2019 5:42 pm

There have been changes to the Ruby version used by SketchUp since the last release of this extension, so I'd say there is more than a fair chance that it won't function as expected.
0
Save the Earth, it's the only planet with chocolate.
User avatar
juju 
Premium Member
Premium Member
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby TIG » Mon Aug 26, 2019 6:12 pm

Works fine for me in v2018/v2019, but remember it is 8 years old is somewhat clunky !
Install from the PluginStore's RBZ...
https://sketchucation.com/pluginstore?p ... ureSwapper

It's not 'signed', so your Extension Loading Policy needs to be set to 'Unrestricted'.

Its Toolbar might need to be activated to be able to click-to-run...

Here's a synopsis of how it works...

Your model contains textured materials.

You run the 'OUT' option.
Everything is written to your a subfolder in your default user's folder - that is typically your 'Documents' folder.
A subfolder is made named thus "/ModelName_TexturesOUT".
The 'OUT'put.
If now contains all of those materials' textures' image-files, saved using their files extension - e.g. "Bricks.jpg".

If you want to reuse modified versions of these textures in your model, copy them into a subfolder in the same parent folder, named say "/ModelName_TexturesIN" subfolder.
You can now edit any of those image-files, retaining their names.
Alternatively overwrite an image-file using another image, keeping the exact same name [note it is case-sensitive].

Now you can use the 'IN' option.
All image-files in the "/ModelName_TexturesIN" subfolder are analyzed.
If your model 'ModelName' contains a material using any of the textures named in that folder [note it is case-sensitive and the image-file must be the same 'type' - e.g. .JPG or .PNG], then that material's texture is replaced by the current equivalent in the "/ModelName_TexturesIN" subfolder.

So reasons for it to fail are the IN file isn't made.
There are mismatches in the image-file names between the OUT / IN subfolders.
The IN images' file-types don't match the textures' names in the materials' definitions.
Also note the exact destination of these folders; the default folder is set up in our preferences, but some plugins might interfere with that.
So to check what it is, use this in the Ruby Consul:
Dir.pwd + <enter>
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] TextureSwapper v1.1 20111112

Postby Flatchoum » Tue Sep 24, 2019 10:20 am

HI, today I was able to reinstall the textureswapper, I don´t know why I succedded, but now it works.
Sorry, this is not very helpfull to learn about the issue I encountered.Best,
0
User avatar
Flatchoum 
Premium Member
Premium Member
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Plugins

Who is online

Users browsing this forum: AmahCWB and 30 guests

Visit our sponsors: