UPDATE: Just found a bug in 2010 where the edges selected in max weren't the edges being cut by Roadkill. I've updated the script on the site so if you were having weird edge selection issues under max 2010 that should fix it.
Hi Guys,
Ages back I wrote a script to bridge the gap between max and roadkill. I've updated it since then and improved the work flow and thought I'd make it available as I noticed people were still using it.
Homepage:
https://sites.google.com/site/copypastepixel/roadkill-maxscript
Feed back would be great so if you have any problems or suggestions let me know
Cheers,
copypastepixel
Replies
Will test the script later, looks interesting
Yeah that's a bit of a weird one. RK needs it's OBJ's to be exported and imported a certain way. I didn't want the user to have to manually configure the OBJ exporter every time they use RK so I need access to those settings.
The settings are held in a nice INI file in 2010 but in 2009 there's no way of altering the obj exporter/importer settings via script. My workaround was to setup the OBJ plugin once, read in the state of it's setting files and then overwrite them as needed.
It works but it is a massive hack....
-copypastepixel
I am right digging through your code and simplify it for my needs which is just splitting along selected UV edges and just unwrap associated shells.
Your hacks are a very valuable input and I hope I get things working the way I want it. I will post more and the finished script once done.
Anyway I just wanted to thank you for the great script - its a good source to learn from and build upon.
Hope it helps I spent ages on the edge selection stuff. Most of it trying to use the unwrap mod's pelt seam selection to mark up the edges. Had no luck though as I never found a way to convert from the pelt seam selection to a mesh edge selection.
Look forward to seeing your script. Will you keep the process entirely in max or use roadkill to unwrap?
http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/maxscript-function-uvgetselectedgeomedges-broken-/page-last/
But here is a snippet that will select all open Edges from your UV editor:
To test it, make sure you have a poly object (no mesh) and add a UVWunwrap modifier, and finally open the UV editor in Max for that poly. After that simply execute the script and it should select all open Edges.
At first I tested it using a Mesh as a base object but it would select triangle edges within quads or nGon faces which is wrong but I think its more because of the nature of the Mesh object which is just way more limited.
So my goal from here on is:
At some point I want to add a filter that only reads back changed UV shells that are associated with your selections (edges or faces in the UV editor). That way one could just flatten a selected shell without affecting all other shells one could have layouted already before.
I want to remain in Max and just use roadkill as a under the hood tool to unwrap very specific parts that are marked in the 3dsmax unwrap editor.
Reasons for that are:
- I don't like the navigation of Roadkill
- don't like to switch applications all the time
- like to keep it all in one place
Should I succeed I want to integrate into TexTools:http://www.renderhjs.net/textools/
So that I have ABF and LSCM at my fingertips in Max without the need of installing plugins for max.
The problem orginates from: I tested the URL's by executing them in the Run command panel in Windows and they are all valid but for some reason it returns 1 and I guess it means that there is some error with the parameters and or Roadkill URL.
My script so far is:
Just change the URL of the RoadKill exe @ the 2nd line: Then select a Poly Object and add a UVunwrap modifier (no need to open the UV editor) and execute the script.
The root function that triggers everything is at the bottom, the rest is somewhat the same as your script except it writes a edge selection file from the UVunwrap modifier.
Oh and I removed the popup warning, so there is just a trace warning if the URL couldn't be found.
That all sounds possible. The only issue you may come across using my code is that it's all designed to work with edit mesh, not edit poly. Although it uses an edit poly mod to make edge selections, once that's done the export and import of data is all based around edit mesh triangulation. From memory I had some trouble getting an edit poly workflow working.
It was while back now but I recall being unable to get an edit poly edge selection to match up with the .OBJ mesh that roadkill imported. I'm positive it's achievable though, I just left the problem alone after I got it all working with edit meshes.
Being able to selectively unwrap shell sections from the unwrap interface is a really neat idea though, it would be great if you can make it happen!
Just took a quick look and it looks like the export object and edge list paths aren't right.
OBJFilePath = GetDir #export + "roadkillOBJ.obj"
evaluates to
"C: \Documents and Settings\User\My Documents\3dsMax\exportroadkillOBJ.obj"
it should be
OBJFilePath = GetDir #export + "\\roadkillOBJ.obj"
which evaluates to
"C: \Documents and Settings\User\My Documents\3dsMax\export\roadkillOBJ.obj"
With that fixed the rest works fine
its the board here that deletes the double backslash in the code tags. Its in my code - but in the end it seemed to be something related to my URL, so I just copied it directly to my c:\ drive without any spaces in the url or filename - and it works.
But I am getting still some odd results:
I assume this is perhaps because the edge list is not working the way I hoped?, I will do some other tests later with some more primitive shapes to analyze whats going on.
Also your non-flipping setting in the OBJ exporter turns out to be wrong with my 3dsMax 2010 so I enabled it and it imports back at the original position.
My script so far, without beeing crippled by this board:
http://renderhjs.net/bbs/polycount/roadKill/fn_39__unwrap_with_roadkill_003.ms
I also tried a few simple characters and they worked fine as well so I'm not sure what's going on there. Also, my meshes weren't coming back triangulated either.
It's possible there's an obj setting that's not being set correctly on your PC, something I overlooked when overwriting the settings. Maybe have a hunt around the OBJ plugin settings and see if that helps?
Anyways, the script is updated so see if you have any more luck there
I am extremely pleased, will try to find a way this weekend to implement it to TexTools with a easy hook in way to add roadkill.
I noticed though that your newest version has the ini switch of: which should be a 1 for true, because otherwise it wont work
I will update a trimmed down and optimized version of my script sometime this weekend so it works with any object selected. Which means that
- it will automatically add a new UVunwrap modifier if needed
- collect all the open edges + selected UV edges if any as the seam array
- export using your technique, have it be unwrapped by RoadKill, wait and import it back
- copy the UV channel of that imported poly (yes I got poly objects working, no forced triangles) and paste it to the original selected object using the paste UV modifier.
There is still some flickering and some DOS prompt pop up going on (command line of RoadKill) but in the end I think this will be a super awesome script to just unwrap the way it takes hours otherwise with the crappy pelt stuff in max.thanks again for your help and input, much appreciated
Its the conversion from editable poly to editable mesh i think. the channel tools dont work at all between the 2
If the mesh is 100% tris this isnt an issue. Quads and Ngons seem to make shit of the face indexes.
I'll be damned... you're right about that INI UV setting. I didn't realise roadkill was able to work with/around existing UV's...
EDIT: Wait, no, just checked again and RK doesn't pay attention to the incoming UV's so not exporting UV's shouldn't be an issue
that way I can also just swap UVs with the imported roadkill one all in one modifier.
how are you importing the obj file as an editable poly?
:poly142:
Edit: decided to look at my code again, had a hissy fit and wrote my own export code
and a function to rip the UVs from obj files and inject them into editable poly objects.
If this is of interest i can post the files.
thanks again for giving these tools for us to use. Textools has really sped up my workflow.
-z