PDA

View Full Version : point and poly info inlayout



fortress
11-21-2003, 12:01 PM
hello all is there a way to get infomation about each point and polygon in layout

i am working on a custom exporter and need this info to output in my file

i have read the docs and there doesnt seem to be a real clear answer to this question

it looks like the only way to get that info is in modler but i need to export animation data as well

any suggestions

faulknermano
11-22-2003, 03:11 AM
Originally posted by fortress
hello all is there a way to get infomation about each point and polygon in layout

i am working on a custom exporter and need this info to output in my file

i have read the docs and there doesnt seem to be a real clear answer to this question

it looks like the only way to get that info is in modler but i need to export animation data as well

any suggestions

point and polygon info can be accessed using the Mesh Object Agent. you need to cycle through all the meshes in your scene. quite easy:



m = Mesh();
while(m)
{
...
m = m.next();
// process mesh
}


look at the points and polygons object agent in the docs to find out more about the specific type of point / poly info you can access.

fortress
11-24-2003, 11:16 AM
thank you for the reply
i have gotten the mesh object setup and can get the data mebers in it

i just wasnt sure on how to setup the point and poly objects
when i tried setting them up the same as the mesh objects i get errors

just wanted to double check to make sure it can be done

now i know it is just me :)
hehe

hrgiger
11-24-2003, 10:41 PM
Well, there is a tool plug-in (not sure if it's a script) called xTool that will let you animate individual points in Layout so it can be done.

fortress
11-25-2003, 01:53 AM
hmm ill have to look into that

maybe i am just confussed about how it is done
according to the docs you have to put your script into mesh edit mode but then they say that you can only enter mesh edit mode in modeler

unless i have to set the script up as a different type or something not sure

what i need to get is all the points locations and uv data as well as all the poly locations and weightmap data

i am trying to make a custom model and animation exporter

faulknermano
11-25-2003, 05:52 AM
Originally posted by fortress
hmm ill have to look into that

maybe i am just confussed about how it is done
according to the docs you have to put your script into mesh edit mode but then they say that you can only enter mesh edit mode in modeler

unless i have to set the script up as a different type or something not sure

what i need to get is all the points locations and uv data as well as all the poly locations and weightmap data

i am trying to make a custom model and animation exporter

dont have much time to sift through this code i did for BoneLatticeGN but this is how i go through points. btw: in this code i go through a mesh's points and look for their endomorphs.



for(i=1;i<=pointList.size();i++)
{
if(i > selected.pointCount(1))
break;
j = pointList[i];
vmap = VMap(VMWEIGHT);
mmap = VMap(VMMORPH);

sp = selected.points[j];
vec[i] = selected.position(sp);

names[i] = nil;
values[i] = nil;

while(vmap && vmap.type == VMWEIGHT)
{
if(vmap.isMapped(sp))
{
names[i] = vmap.name;
values[i] = vmap.getValue(sp,1);
break;
}
vmap = vmap.next();
}
j = 1;
while(mmap && mmap.type == VMMORPH)
{
if(mmap.isMapped(sp))
{
mmap.getValue(sp);
evtemp = <this[1],this[2],this[3]>;
endoVal[i,j] = evtemp;
}
mmap = mmap.next();
j++;
}
}

btw: the array pointList[] contains integers corresponding to the element it is on.

pointList[1] = 1;
pointList[2] = 2;
pointList[3] = 3;

etc...

Matt
11-25-2003, 06:17 AM
I really wish you'd comment your code so dummos like me can learn from the master! ;)

Not so much the syntax, that's easy to read but what the code is doing and why!

:)

fortress
11-25-2003, 02:11 PM
thank you very much that will help a lot
as far as the script running in layout

did you right it as a generic script or a displacment or something else

i think that might be where i am having problem so far i have only tried a generic script

fortress
11-25-2003, 02:15 PM
ohh wait

BoneLatticeGN GN = generic script nm
:)

fortress
11-25-2003, 02:25 PM
nice website btw

fortress
11-25-2003, 05:26 PM
had a question for you faulknermano
as far as accessing the pointlist array is that setup automaticlly or did you create the array

and if it is an automatic data you can get to
is it an object like a mesh object or a data meber of something

fortress
11-26-2003, 06:20 PM
ok maybe im just stupid or something

but i cant find anywhere in the ref docs anything about the pointList[] array

there is a point[] array but cant access that in layout only in modeler

accroding to the docs and i have tried a few things and cant seem to get and info on points or polys in layout other then teh total count

faulknermano
11-27-2003, 06:28 AM
Originally posted by fortress
ok maybe im just stupid or something

but i cant find anywhere in the ref docs anything about the pointList[] array

there is a point[] array but cant access that in layout only in modeler

accroding to the docs and i have tried a few things and cant seem to get and info on points or polys in layout other then teh total count


sorry for keeping you wait: the pointList is created manually, using a loop.

actually, i use the pointList[] array because of the innerworkings of the original script. the idea is the feed an index number to the points array _data member_.

if you could try to post your working code snippet i might be able to spot what's going on.

faulknermano
11-27-2003, 06:33 AM
Originally posted by Matt
I really wish you'd comment your code so dummos like me can learn from the master! ;)

Not so much the syntax, that's easy to read but what the code is doing and why!

:)

i was in deep meditation when i was writing it. :) writing comments sometimes just slows down the thought processes. of course, it's just as hard on me as it is to you on what it all means after a few months. :)

fortress
11-27-2003, 10:53 PM
oki figured out that the pointList array was made by you
but as far as geting to the Points array data member how is that done in layout

i thought you could only get to that from modler scipt inbwteen the editBegin and editEnd calls

faulknermano
11-28-2003, 07:08 AM
Originally posted by fortress
oki figured out that the pointList array was made by you
but as far as geting to the Points array data member how is that done in layout

i thought you could only get to that from modler scipt inbwteen the editBegin and editEnd calls

they are different. the points array in MODELER is a 'virtual' array that is automatically created by lscript upon the call to editbegin(). but what we are looking at when we are in layout is the _datamember array_ of the Mesh Object Agent. look up the reference docs Mesh Object Agent and you will see that a similar points array is available. this is what you should be concentrating on. it is from here, as well, that you can access certain info concerning the points you are referencing, such as point location.

faulknermano
11-28-2003, 07:31 AM
okay sorry... wrong info on the documentation. in fact, i just remembered that this little 'inaccuracy' got me stumped as well. here is what i know:

1.) use Scene().firstSelect() or Scene().getSelect() to get the Object Agent of your item. what i am not sure of it whether or not a direct Mesh Object Agent reference (e.g. Mesh()) to your mesh item is valid for accessing the points[] array.

2.) whatever the case may be, the existence of a points[] array indeed NOT DOCUMENTED CORRECTLY or at the least NOT LOGICALLY ARRANGED in such a way that it will communicate the reader that a points array method or datamember can be accessed through the Mesh Object Agent. since the only item type with points in a scene are mesh items a points[] array method should have been listed as one of the methods in the Mesh Object Agent section. however, it is only listed in the Points and Polygons Object Agents.

3.) it would seem that the points[] array in the Polygons Object Agent is the same thing. i had thought that the mesh object agent was the same as polygons (since the mesh contained polygons). so... instead of specifying a particular polygon, i used the mesh object agent:



myMeshObjectAgent = Scene().firstSelect(); // assume that a mesh is selected in layout
a = myMeshObjectAgent.points[1]; // gets the first point at index 1



to make a long story short: the reference docs are inaccurate, or lacking. taking your pick.

fortress
11-28-2003, 01:48 PM
ok thank you very much for taking the time to clear that up or at least make some sense of it :)

i thought i was just going nuts there for a bit
i try the suggestion you have made

and see what i can some up with

fortress
11-28-2003, 01:52 PM
well that little code snippet did the job thank you again
that makes alot more sense now

:)

fortress
11-28-2003, 01:59 PM
ok after playing around with a few things you can get to the points array data from a mesh() object

but it does help to use the getselcted function when dealing with multi objects

now do build a list ofall points and there pos :)

fortress
11-29-2003, 12:35 AM
faulknermano i just wanted to say thank again for you help
i have made some real progress on my script because of it

Thank You

faulknermano
11-29-2003, 08:31 AM
you're welcome. have fun. hehehe. :D

fortress
11-30-2003, 04:24 AM
had another quick qestion for you faulknermano
part of the script i am creating needs to output bone rotation data for every frame.

my question was is this going to be possable in a genric script or will i have to create a displacement script or animation script to do this.

or possably a combo of several scripts

what i need to output is a list of all bones in the order of root to last child (easy enough) and there pos. and rot.

is it safe to assume that i can just call the getposition and get rotation functions on the bones per frame in a genric script
or will i have to do something like create a master class to read in or digest all the bone info and then pass it to my exporter

br1
11-30-2003, 04:25 AM
use particle on a mesh object and you have the pos of all points

br1

faulknermano
11-30-2003, 08:00 PM
Originally posted by fortress
had another quick qestion for you faulknermano
part of the script i am creating needs to output bone rotation data for every frame.

my question was is this going to be possable in a genric script or will i have to create a displacement script or animation script to do this.

or possably a combo of several scripts

what i need to output is a list of all bones in the order of root to last child (easy enough) and there pos. and rot.

is it safe to assume that i can just call the getposition and get rotation functions on the bones per frame in a genric script
or will i have to do something like create a master class to read in or digest all the bone info and then pass it to my exporter

it is possible from any script archi.




for(i=1;i<=60;i++) // frame 1 to 60
{
a = myBone.getPosition(i / Scene().fps);
doStuff(a);
}

fortress
11-30-2003, 10:19 PM
okcool thats what i thought but i just wanted to double check
thanks again for all the help

fortress
01-11-2004, 10:28 PM
ok may be a dumb question but im redoing alot of my code and
i wanted to know if there is a fast way to find the surface for a given polygon in a layout genric script with out having to get the uvmap and testing for every point on it

faulknermano
01-12-2004, 03:30 AM
use the surface data member of the polygon object agent.

for more info look at chapter 15 of the lscript reference page 137.

fortress
01-12-2004, 04:25 AM
i think i tried that and i got an unresolved member error or something like that

one of things im worried about as far as testing on a per point level is points can be part of many polys but what happens if those polys all have different surface names

faulknermano
01-13-2004, 05:47 AM
Originally posted by fortress
i think i tried that and i got an unresolved member error or something like that

one of things im worried about as far as testing on a per point level is points can be part of many polys but what happens if those polys all have different surface names

thinknig about it: how do you intend to specify a particular poly in layout? the unresolved member error is about what kind of object agent that you are calling surface from. i think it has to be a polygon object agent derived from a mesh object agent. I THINK. not sure.

fortress
01-13-2004, 04:09 PM
ok thats what i tried i had a mesh object agent then called

mypoly = mesh.polygon[x]
mysurface = mypoly.surface;

no go that way

also try calling the surface as a method as well thinking it would return the first surface for that poly

as of right now i have my export outputing all the data no i ended up just going down to the point level to query for the surface's using isMapped on the uvmap of each surface it is the long way but it works for now

i am having issues with my bone data comming out mangeled but i think that has to do with the engine im importing to

also found a work around for getting the point normals in layout
have to run normalbaker on a model first in modeler then save and jsut search for the custom vmap type it makes