Hello!
I'm currently trying to make a rather complex script-plugin that would allow the user to extrude PNG images with 1 button click. The theoretical steps should be:
1. Locate the container's image texture and export it to the local disk. < SOLVED 1
2. Execute a local script on the exported image with system.StartApplication() that does the following steps:
>>> Extracts only the alpha channel of the image and saves it as a new black-and-white image
>>> Traces the new image using Inkscape's autotrace / brightness cutoff to convert it to a vector path
>>> Save the vector as a plain SVG, then convert it to Adobe Illustrator version 5 format (I actually found a program that can do this - it's called UniConvertor 1.1.5)
3. Back in Viz, create a new "Polygon" geometry plugin for the container and import the new .AI file as its path. <PROBLEM 2
4. Add an extrude plugin and set it up.
5. Hope the texture matches perfectly ontop of the new geometry, or else do some math to align them.
Here's what I'm having trouble with:
PROBLEM 1: Exporting an image to local disk: I don't know if that is possible. I found a class called "ImportTask" in the viz engine documentation, but nothing about exporting.
PROBLEM 2: The Polygon plugin doesn't seem to be able to import .AI files automatically through script. If I had its source code and could see which functions it runs to perform that import that would help. Otherwise my only option would be to use the "POLYGONSTORAGE" field, which for the life of me I can't figure out how it works - if anyone has any ideas about it let me know.
If you have any insights into any of the 3 problems, let me know. Any help at all is appreciated!
I'm currently trying to make a rather complex script-plugin that would allow the user to extrude PNG images with 1 button click. The theoretical steps should be:
1. Locate the container's image texture and export it to the local disk. < SOLVED 1
2. Execute a local script on the exported image with system.StartApplication() that does the following steps:
>>> Extracts only the alpha channel of the image and saves it as a new black-and-white image
>>> Traces the new image using Inkscape's autotrace / brightness cutoff to convert it to a vector path
>>> Save the vector as a plain SVG, then convert it to Adobe Illustrator version 5 format (I actually found a program that can do this - it's called UniConvertor 1.1.5)
3. Back in Viz, create a new "Polygon" geometry plugin for the container and import the new .AI file as its path. <PROBLEM 2
4. Add an extrude plugin and set it up.
5. Hope the texture matches perfectly ontop of the new geometry, or else do some math to align them.
Here's what I'm having trouble with:
PROBLEM 2: The Polygon plugin doesn't seem to be able to import .AI files automatically through script. If I had its source code and could see which functions it runs to perform that import that would help. Otherwise my only option would be to use the "POLYGONSTORAGE" field, which for the life of me I can't figure out how it works - if anyone has any ideas about it let me know.
If you have any insights into any of the 3 problems, let me know. Any help at all is appreciated!
Last edited: