SKM tools
-
I have been experimenting with some tools that add extensions to the 'Material' class and a new class 'SKM'.
I now have a beta version [1.1] that's being tested by others - I haven't managed to break these new tools yet!
However, it needs more testing - especially on MACs - as it should run seamlessly 'cross-platform'...Any 'developers' interested in getting a beta version to test should PM me with details of their setup.
I'll then PM a zipped set asap...The tools include:
Material.save_texture(folder)
saves the material's texture file into the specified folder.
Material.save_thumbnail(path)
if 'path' is a file-name then the material's thumbnail png file [64x64pxs] is made as that 'folder/file.png' [it must be a .png file - if specified otherwise it will revert to be a .png anyway!].
if 'path' is a folder then the material's thumbnail png file [64x64pxs] is made in the 'folder', and named 'doc_thumbnail.rb'.Material.export_skm(folder)
the material is exported as a SKM file in the 'folder', it is named after the material [with some characters >> '_'], e.g. material 'Brick 1' makes 'Brick_1.skm' in the folder. It includes all of the material's values and attributes [if any].
SKM.export(material, folder)
this is similar to 'Material.export(folder)'; it exports the specified 'material' as a SKM file into the 'folder', using all of the material's values [including all values and attributes (if any)].
SKM.import(skmpath)
the SKM file is imported into the model as a new material, using all of the SKM's values, including any attributes.
SKM.save_texture(skmpath, folder)
the texture [if any] in the specified SKM file is saved to the folder [else returns 'nil'].
SKM.save_thumbnail(skmpath, path)
if path is a file-name then the SKM's thumbnail png [64x64pxs] is saved as that file.
if the path is a folder then the SKM's thumbnail png [64x64pxs] is made in the folder,; it's named 'doc_thumbnail.rb'.I see these tools as extending the API to allow 'viewing' of SKMs and the making thumbnails of materials or SKMs etc.
Most of these new tools make use of some new techniques I have recently developed, using cross-platform small Java .jar executable 'applets', run from within Ruby, that process files in various ways: e.g. zipping and unzipping files [needed for manipulating SKM files] and making thumbnails from either images-files or RGB values. I also see this technique as being potentially useful in developing cross-platform data manipulation tools that are either impossible or unwieldy within Ruby itself... One example is a set of new 'File'-like methods that don't fall over when confronted with non-standard characters - like accented letters in file-paths... That's on the list... Other 'jar' ideas welcome...
EDIT: New tool now added...
Loaded by SKMtools.rb in the ../Plugins/ folder.
Adds a new method to to the Material class:
material-save_bumpmap(folder, boolean)
It makes the 'folder/texture.jpg' [or .png etc] and also a 'texturebumpmap'.
Returns the 'folder/texturebumpmap.png' [always .png] if successful or 'nil'.
The 2nd argument 'boolean' is optional - it defaults to 'false' if not set.
e.g.face.material.save_bumpmap("C:\\Temp\\")
C:\Temp\Brick99_BMP.png
If you give it the second argument as 'true' it 'inverts' the Bumpmap,
e.g.invert=true; face.material.save_bumpmap("C:\\Temp\\", invert)
C:\Temp\Brick99_BMPI.png [with 'inverted' Bump colors]
Choose to 'invert' if you want to swap light and dark values...
If the specified 'folder' does not exist there is an error message. -
I will be pleased to test it to generate skm files with bumpmap for podium.
-
Wow, pretty advanced stuff. Perhaps you can post a notice in the proper place in the api. Can you link from there?
-
There's an updated 'extra'
Material.save_bumpmap(folder, inverted)
tool added.
http://forums.sketchucation.com/viewtopic.php?p=291646#p291646
It's been sent to 'beta-testers' - are there any others interested in trying it out 'cross-platform'?
Advertisement