View Full Version : Simple Script to export obj
umblefugly 07-26-2007, 01:06 AM from a selected object or selected objects?
Ive been fussing thru this and Im giving up....any tips?
Please dont direct me to Plugincafe...ive been there. Thanks in advance...no BS comments to my post please.
|
|
JoelOtron
07-26-2007, 01:11 AM
Have you tried riptide?
http://skinprops.com/riptide.php
umblefugly
07-26-2007, 01:40 AM
Thx joel, I was a beta tester for this plug, http://skinprops.com/fr_rtdocs.htm#kudos and its awesome mind you, I use it everyday for daz3d products. What Im looking for is a seperate script, im trying to develop a connection to Headus UVLayout and Cinema4D...so far Invoking UVLayout from c4d in plugin mode is solved, exporting the active object to UVLayout and updating the UVs in c4d (making c4d watch the output from UVL) is the issue...wish I could do it alone as this would be such a time saver for me and my wife. Thanks for the offer tho.
Kuroyume0161
07-26-2007, 02:47 AM
Well, you could call Riptide but I doubt you can automate the clicking process on the dialog. This is where having Riptide as an import/export plugin would avoid that situation. Then it would just be a matter of monitoring the obj file saved from UVLayout in some way (comparing the file date to that when it was created by Cinema 4D or last updated by UVLayout).
Does UVLayout have a means of automating the process - once it is executed, can it be pointed to the object file? Some applications allow command line syntax to open with a particular file, ala "C:\Program Files\UVLayout\UVLayout.exe <filepath>"
ETA: App execute should be callable from COFFEE (definitely C++) with GeExecuteProgram(). You just want the new UVs from the UVL-saved obj file, correct? As long as the object retains the number of points/polygons and point/polygon order from UVL, then it is easy to apply UVs either programmitically or even cheating. Cheating means importing the obj into C4D and replacing the UVW tag on the original with the import.
Robert
umblefugly
07-26-2007, 05:19 AM
Basically this is what im looking at Robert:
UVLayout v1.14, and above, can be run as a plugin to any application that knows how to talk to it. Its still the same GUI and hotkeys as the stand-alone UVLayout, but file IO is handled through special interface plugins, saving the user from having to load and save files by hand just to move meshes in and out of UVLayout.
The interface specification is described below, which should allow you to write a UVLayout interface plugin for your own favourite application.
How to run UVLayout in "Plugin" mode:
uvlayout -plugin <name>.obj
This starts up UVLayout with a slightly modified GUI. The Load and Save buttons are replaced with a Send button, which the user would click on when they want to send a modified mesh back to the calling application.
How to send objects to UVLayout:
write them to <name>.obj
The <name> field above can be anything, though we recommend you try and make it unique; including the process id of the calling application is one way to do this. UVLayout will watch out for this file, so when you want to send a selected object to UVLayout, simply get your interface plugin to save it to the <name>.obj file listed on the uvlayout command line.
Actually a safer way to do this is to write the selected object to a temporary file, then rename that file to <name>.obj. This means that UVLayout won't open and read the file when its only half written, a possibility if you write directly to the export file.
How to receive objects back from UVlayout:
read them from <name>.out
When the UVLayout "Send" button is clicked, it saves the modifed mesh into <name>.out. If your interface plugin can automatically watch for this file, then it would import that and could either update the selected object with the new UVs, or complete replace it with the object from the file. If you can't set up a "watch" function, then assigning a button or hotkey to load <name>.out would work too.
How to kill UVLayout from your application:
write "exit" into <name>.cmd
If you want to kill UVlayout from the calling application, just write "exit" into <name>.cmd.
Rich-Art
07-26-2007, 09:02 AM
Should be great if you get this working.
I'm using UVlayout from the beginning it came out and very often it is a real great app.
Peace,
Rich_Art. :thumbsup:
Kuroyume0161
07-26-2007, 06:26 PM
Sounds to me then that you can have UVLayout run in its plugin form from C4D but with the extra command line argument there, you might need to run a .bat instead. You'll have to try GeExecuteProgram("<path>uvlayout -plugin", "<name>.obj") and see if this will work as expected.
As for checking periodically to see if the <name>.obj has been modified, you can use a Timer for that. With COFFEE, the timer is only available from a dialog but opening a small non-modal one would suffice. You could even put a 'Done' button on the dialog and use that to create the <name>.cmd and write "exit" to close UVLayout. Not sure how this would work for multiple sessions though.
Robert
Gene Williams
07-26-2007, 07:45 PM
I'm really interested in this as I use UV Layout, unfortunately I am no coder...clueless.
I use UV Layout within XSI and it works really well. If you need any testing I can assist
there and good luck.
Gene
umblefugly
07-26-2007, 08:38 PM
Thanks for the tips Robert, thats basically what I have the plugin doing right now is loading a .bat file to load uvlayout in plugin mode like so:
@Echo Off
CALL "C:\Program Files\headus UVLayout\uvlayout.exe" -plugin C:/Temp/Untitled.obj
If I export obj b4 hand the plugin will even load the obj into uvlayout.
What id like it to do is:
Get the selected object in c4d and export it as obj then load it into UVLayout all in 1 go.
Then once the UVs are layed and I click Send it updates the object in C4Ds UVs.
Thats basically it.
CGTalk Moderation
07-26-2007, 08:38 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.