PDA

View Full Version : Multiple .lwo sequence into one layered .lwo?



JoePoe
05-22-2013, 05:02 PM
Working with an object sequence here. How do I get multiple .lwo files (in sequence) into one layered .lwo?

In short I have a whole lot of separate items where I just need to turn on SubDs.
If I can get then all on layers I can make them all active at once hit tab ONCE and save them out as separate items again.
(maybe there is another way to do a batch process like this..... I'm all ears).

I found a script called LoadObjectsIntoEmpties which sounds perfect in its description in the database (http://www.lwplugindb.com/plugin/load-objects-into-empties/).... I just can't seem to make it work.

Hopefully this is just a matter of someone hitting me over the head with the obvious stick. :)

Mr Rid
05-22-2013, 05:41 PM
Perhaps the Point Oven MDD compiler at bottom of their 'downloads' page will help. I have not used, but it is suppose to combine an object sequence into an MDD, thereby one mesh you can subD.

JoePoe
05-22-2013, 05:56 PM
Thanks for the reply Mr. Rid.

Not sure what you mean by "at bottom of page". What page? (sorry if I'm not seeing something right in front of me).

I should mention that, at least up until this point, the end objective was to use Object Sequencer in layout.
Load the first object>run sequencer resulting in one object per frame. (it's a liquid sequence).

Am I to understand that if I combine into an MDD, then that will contain the motion info and I won't have to use sequencer anymore?

JoePoe
05-22-2013, 06:28 PM
Mr. Rid - After a little digging I found that you mentioned an MDD compiler from Point Oven on another thread. Is this what you were referring to?

If so..... I'm on a Mac.
Hopefully you meant another compiler somewhere else. :goodluck:

nickdigital
05-22-2013, 07:03 PM
I found a script called LoadObjectsIntoEmpties which sounds perfect in its description in the database (http://www.lwplugindb.com/plugin/load-objects-into-empties/).... I just can't seem to make it work.


This worked for me. I have a folder with:
box0001.lwo
box0002.lwo
box0003.lwo

I ran the script and pointed to box0001.lwo. It's odd that it prompts you thinking you're going to save over that object but if you hit ok it imports all the objects into empty layers and you then have an unnamed object.

You could then use this to save all the layers as individual objects. There's a mac version of this plugin too.
http://www.lwplugindb.com/plugin/layer-to-object-saver/

Mr Rid
05-22-2013, 07:13 PM
Thanks for the reply Mr. Rid.

Not sure what you mean by "at bottom of page". What page? (sorry if I'm not seeing something right in front of me).

I should mention that, at least up until this point, the end objective was to use Object Sequencer in layout.
Load the first object>run sequencer resulting in one object per frame. (it's a liquid sequence).

Am I to understand that if I combine into an MDD, then that will contain the motion info and I won't have to use sequencer anymore?

Sorry I forgot to put a link to the Point Oven downloads page. But yes, the MDD would replace the need for a sequence, and should also allow motion blur to work. With an object sequence there is no actual motion to blur. RealFlow exports meshes with a morph that simulates between-frame motion, but it also exports bins that will blur and dont require meshes. I dont know how Blender fluid meshes work with moblur, but I think it should.

JoePoe
05-22-2013, 07:45 PM
@ NickDigital
Thanks for checking it out. Yes I get the scary prompt, but I said okay.....
When I run the script I get an error .... "Line 39, illegal arithmetic operation on data type". Woking with lwo's (converted from obj's), in order. :stumped:

@ Mr. Rid
He He...I am working with Blender output, and yes, there is a separate vector info file with each obj. I'm just trying to keep it simple for now. I'll tackle motion blur next. :thumbsup:
If I can find a MAC mdd compiler, seems like as easier route..... 8~

nickdigital
05-22-2013, 08:50 PM
Can you post two files from your sequence? I could dissect the lscript to try to debug it.

JoePoe
05-22-2013, 09:00 PM
That would be awesome!!

Not much happening in these, but they are the first two.

nickdigital
05-22-2013, 09:09 PM
What happens if you rename them to be fluid0001?

Remove the underscore.

(it'll be awhile before I'm in front of a computer so I'm trying to help by throwing out what looks obvious to me)

JoePoe
05-22-2013, 09:22 PM
Ha, just coming back from trying that very thing. No luck.

The .lwo's open up fine one at a time. And even batches at a time (as separate objects).

--
And I want to absolutely make sure I using the script right:
1) I open Modeler...have an un-named & un-saved object with nothing in any layer.
2) Run script, select first object in sequence.

nickdigital
05-22-2013, 10:02 PM
I'll futz with this tomorrow.

iain_r
05-23-2013, 03:37 AM
Hi, I've run the script with your two example files and it loaded them into layers no problem whithout renaming the files to remove the underscore. I've even run the script using the debugger to see what was happening, this was on a PC using 9.6. I can only think that the two last lines of the loop to reconstruct the next file name are not updating the objFile variable with the correct values.

nickdigital
05-23-2013, 04:22 AM
Maybe this is a Mac problem then?

Sensei
05-23-2013, 05:51 AM
Is it not job for Object Collapse tool with mode set to directory and multi-layer?

iain_r
05-23-2013, 09:45 AM
Hi, quick script to load objects with a single layer into separate layers of a new object. Created a couple of copies of the files JoePoe posted and they each load into their own layer.


@warnings
@version 2.8
@script modeler

main
{
curObj = Mesh(0);
curName = curObj.name;
current = lyrfg();
objFile = getfile("Load objects into Layers","*.lwo",getdir("Objects"));
base = split(objFile);
loc = base[1] + base[2];
files = matchfiles(loc, "*.lwo");

foreach(f, files){
load(loc + f);
copy();
close();
setobject(curName);
emptyLyr = lyrempty();
lyrsetfg(emptyLyr[1]);
paste();
}
}

JoePoe
05-23-2013, 10:11 AM
Thankyou EVERYONE!!
As usual the effort and desire to help here astounds me!! :bowdown:

While the stubbornness in me still wants to do battle with the LoadObjsIntoEmpties ls.........

Sensei is correct!

Modeler>View tab>Object Collapse to multi-layer. :thumbsup::thumbsup:

Thanks again.
Now... onto incorporating motion blur :hey:

JoePoe
05-23-2013, 10:38 AM
Iain_r

Thank you. (I posted without seeing there was a page two to the thread.)

I ran the script (same procedure as LoadObjsIntoEmpties yes?)...
I get the same error message as before except this time on line 12.
(It could be me..... I'm on an ancient MAC ppc,... but ls scripts usually don't give me a problem :stumped:).
It would be interesting to see another MAC user give it a go.

In the mean time...Object Collapse seems to do the trick.
I appreciate the effort, but please don't hurt yourself over this.... unless you want to :D

iain_r
05-23-2013, 11:24 AM
Hi,

A very cut down version,not taking it any further. I think your problem is with how the MAC interprets the line

base = split(objFile);

The split command should create an array which contains the drive letter, directory, file and extension. Not using a MAC I don't know how it splits up the filename and this leads to the problem when trying to join the pieces together again. At least you got what you needed. As an aside to your other problem with loading sequences of lwo files in layout with object replace, I can load lwo files as a sequence, again could be a MAC issue.

Regards

Iain

JoePoe
05-23-2013, 12:09 PM
Hi,

A very cut down version,not taking it any further. I think your problem is with how the MAC interprets the line

base = split(objFile);

The split command should create an array which contains the drive letter, directory, file and extension. Not using a MAC I don't know how it splits up the filename and this leads to the problem when trying to join the pieces together again. At least you got what you needed. As an aside to your other problem with loading sequences of lwo files in layout with object replace, I can load lwo files as a sequence, again could be a MAC issue.

Regards

Iain

Okay, maybe I'll investigate the split phrase as it applies specifically to MACs.

AND

Thanks for reminding me about the other thread.
I'm okay there too. That, in the end, did boil down to a simple sequence naming convention snafu. :)

nickdigital
05-23-2013, 12:29 PM
@warnings
@version 2.8
@script modeler

main
{
curObj = Mesh(0);
curFileName = curObj.filename;
base = split(curFileName);
info (curFileName + "<br>index1 is " + base[1] + " index2 is " + base[2] + " index3 is " + base[3] + " index4 is " + base[4]);
}

JoePoe,

You could try running this on a saved model file. Per iain_r's post, this will split up the filepath into individual parts. As someone who doesn't work on a Mac I'd be curious to see where this breaks. My guess is that index1 (base[1]) doesn't exist.

If you run it and you get an error, post what the error says here.

JoePoe
05-23-2013, 12:50 PM
well.... i don't get an Error window, I get an "Information" window.

says:
/Users/Me/Desktop/NickD test folder/NickD_ball.lwo

index1 is index2 is /Users/Me/Desktop/NickD test folder index3 is NickD_ball index4 is .lwo



I then press OK and, as far as I can tell, nothing else happens.
(btw fyi only one object in folder..... NickD_ball.lwo)

nickdigital
05-23-2013, 01:01 PM
Thanks, it's what I figured. Mac's don't have a concept of a drive letter like PCs. So base[1] is empty...that's why the other script errors out. The user would have to do an OS check and build the path accordingly.

JoePoe
05-23-2013, 01:19 PM
...The user would have to do an OS check and build the path accordingly.

So, .... anything I can do/change in the script?

nickdigital
05-23-2013, 01:31 PM
It probably needs to be something like this:


@warnings
@version 2.8
@script modeler

main
{
curObj = Mesh(0);
curName = curObj.name;
current = lyrfg();
objFile = getfile("Load objects into Layers","*.lwo",getdir("Objects"));
base = split(objFile);
OS = platform();

if (OS == WIN32 || OS == WIN64)
{
loc = base[1] + base[2]; // windows OS
}

else
{
loc = base[2]; // mac OS
}

files = matchfiles(loc, "*.lwo");

foreach(f, files){
load(loc + f);
copy();
close();
setobject(curName);
emptyLyr = lyrempty();
lyrsetfg(emptyLyr[1]);
paste();
}
}

JoePoe
05-23-2013, 02:17 PM
Hmmmm.... sorry to report.

No error message this time, but nothing got loaded.

Nick, I'll repeat what I said to Iain_r...
I appreciate the effort, but please don't hurt yourself over this.... unless you want to :D

nickdigital
05-23-2013, 02:23 PM
Hm, it works for me but I'm on a PC...so kinda coding/testing blindly for the Mac.

Since Sensei pointed you to a built in tool (Object Collapser) that works, I say just go with that.

JoePoe
05-23-2013, 02:33 PM
Yes, agreed!! I have a solution, I shouldn't get greedy.
Now... GET TO WORK on that "Make Whatever I Model Beautiful" script!!! :ohmy:

But, seriously - thanks again.

Sensei
05-23-2013, 11:36 PM
Does not Lscript have function asking for directory?
You're asking for file, then completely ignoring picked up file and want just directory path.
Why not ask for directory, and not have to bother with file requester?