PDA

View Full Version : convert null to polys?



ironlips
03-12-2003, 09:53 AM
I'm just trying to find a way of converting nulls in layout, into a grouped object that i can edit in modeller. Nulls are reference created by tracking software (boujou) which seems to create nulls and not an object, so its a bit of a pain trying to model objects based on these reference points. Any ideas what I should do?

Mylenium
03-12-2003, 01:01 PM
You may replace nulls with any object you like using the proper commands in Layout (which can be as small as a single point). All you need to do then is use the "Save transformed object" command to "freeze" the position. However, there is no good and easy way to do it for a lot of points - even though faulknermano has written some scripts to help with this, it is still a tedious and mostly manual task. Also I'm not quite sure but I think in v2 of Boujou you may create dummy objects that will also be exported to real geometry.

Mylenium

Epita
03-12-2003, 01:51 PM
you could replace all the nuls with partigons.. but i dont think that would help you (ohh well)

Epita

faulknermano
03-12-2003, 11:38 PM
Originally posted by ironlips
I'm just trying to find a way of converting nulls in layout, into a grouped object that i can edit in modeller. Nulls are reference created by tracking software (boujou) which seems to create nulls and not an object, so its a bit of a pain trying to model objects based on these reference points. Any ideas what I should do?





// begin script GENERIC
// to be run first in layout
@warnings
generic
{
defpath = string(getdir(MOTIONSDIR),"\\Output.txt");
s = Scene().getSelect();
if(!s)
error("Select at least one item.");
reqbegin("Output Position Text");
c0 = ctlfilename("Output",defpath,100,0);
c1 = ctlcheckbox("Use World Position?",1);
return if(!reqpost());
defpath = getvalue(c0);
usewpos = getvalue(c1);
reqend();

(d,p,f,e) = split(defpath);

path = string(d,p);

wfile = File(defpath,"w+");
if(!wfile)
error("Error opening file.");

for(i=1;i<=s.size();i++)
{
if(usewpos)
pos = s[i].getWorldPosition(Scene().currenttime);
if(!usewpos)
pos = s[i].getPosition(Scene().currenttime);
str = string(pos);
wfile.writeln(str);
}

}
// end script




// begin script MODELER
// to be run after an output.txt has been created.
@warnings
main
{
defpath = string(getdir("Content"),"\\Motions\\Output.txt");
reqbegin("Output Motion Text");
c0 = ctlfilename("Output",defpath,100,1);
return if(!reqpost());
defpath = getvalue(c0);
reqend();
f = File(defpath,"r+");
if(!f)
error("Unable to open file.");

selmode(USER);
editbegin();
while(!f.eof())
{
line = f.read();
v = vector(line);
addpoint(v);
}
f.close();
editend();
}
// end script

ironlips
03-13-2003, 01:47 AM
Sorry to be a pain, I'm a virgin when it comes to code.
I saved this portion of code as text file:

@warnings
generic
{
defpath = string(getdir(MOTIONSDIR),"\\Output.txt");
s = Scene().getSelect();
if(!s)
error("Select at least one item.");
reqbegin("Output Position Text");
c0 = ctlfilename("Output",defpath,100,0);
c1 = ctlcheckbox("Use World Position?",1);
return if(!reqpost());
defpath = getvalue(c0);
usewpos = getvalue(c1);
reqend();

(d,p,f,e) = split(defpath);

path = string(d,p);

wfile = File(defpath,"w+");
if(!wfile)
error("Error opening file.");

for(i=1;i<=s.size();i++)
{
if(usewpos)
pos = s[i].getWorldPosition(Scene().currenttime);
if(!usewpos)
pos = s[i].getPosition(Scene().currenttime);
str = string(pos);
wfile.writeln(str);
}

}
// end script



In layout I tried to open the text file in LScript, and I get an error: Line 1, found '{' parse error
Am I doing the right thing or have I got it completely wrong?
I was wondering if this works , where does it save the Output.txt?

Thanks for your replies so far

faulknermano
03-13-2003, 06:48 AM
one of us got it the other way around :)


the "generic" script is meant to save the text file. it gets the locations of the nulls and outputs them into a text file. the text file location is what you specify on the Output field.

the "main" script (e.g. modeler script) was written to read the text file and create the points based on the info there.


so again here is how it works (hoping that this is what you asked for)..

1.) save the Layout code into a text file called "ExportPositionTextGN.ls".

2.) save the Modeler code into a text file called "ImportPositionText.ls".

3.) go to Layout and add these two lscript as PLUGINS.

4.) put them in their corresponding menus or hotkeys or however you please.

5.) select your items in layout, as many as you want.

6.) run ExportPositionTextGN.ls. input in the Output field any filename you wish. that would be the target file.

7.) hit OK. a file will be created at the location you had specified.

8.) go to modeler. Run "ImportPositionText.ls".

9.) the script will need to process the file. click on the carat at the right hand side of the filename field so you can browse your directory. select the target file you had exported earlier in layout.

10.) hit OK. this should create points based on the positions of the selected items you had in layout.

ironlips
03-14-2003, 05:29 AM
Hi faulknermano
many thanks for your help. It works perfectly, makes my life much easier now.
Cheers

ironlips
:)

mosconariz
08-24-2011, 08:15 PM
Wow, this Lscript was my salvation with a tracked scene... thanks!

johntheblind
08-26-2011, 05:18 AM
hello,

and mixed with this ?

http://www.newtek.com/forums/showthread.php?t=99873

:D

Cageman
08-26-2011, 05:52 AM
I've used ef ItemToOBJ many times when I need nulls moved into modeler as points.

http://people.dsv.su.se/~dan-dulb/evenflow3d/lwpluginsandscripts.php

:)