Notifications
Clear all

[Closed] Tricky problem, saving data in poly and mesh objects

I need to save info in the vertex/edge/flag of both poly objects and mesh objects so that I can easily retrieve it later. So far I don’t have a good way to do this.
To make it even worse I need to convert the poly object back and forth to a mesh.

Any help with this would greatly improve Polyspeed

Some ideas I have:

  • polygon. Save it in the vertex flags. This works ok, but if I convert it to a mesh I loose the data.
  • Materials. Perhaps by creating multi sub materails and assign it to the object, this should coolide with the users materials though so not so good.
  • Vertex colors. This is probably the best way. seem to work with both mesh and poly and there can be many layers. Problem is this. How do I select say all vertices that have a certain vertex color? This is the core problem. I need a fast way to select them, and looping through all the vertices is doomed with MaxScript (if the object is large).

Does anyone know of a good way to quickly select all the verts with a certain vertex color in both mesh and poly?
Perhaps it could be done in a completely different way. Say select a whole layer at once of vertex colors.

/Andreas

16 Replies

I’ve looked some more and found perhaps one more possible way.

Wouldn’t it be possible to use the Channel info and Select by channel modifier to select faces, based on say their color, or their layer at least?
What do you think about this?

/Andreas

I don’t know much about channel info so hard to say. Volume select modifier can be set to select vertices by their color but this is mostly for grey scale colors (black absolute, white none, grey soft select…or something like that). Maybe you could do something with named selection sets? You can store lots of various data with the channel info so that may be your best bet.

1 Reply
(@f97ao)
Joined: 11 months ago

Posts: 0

hi there.
the names selection sets do not survive topology changes, so if the user say does tesselate, then everything is destroyed. this is what i try to avoid, so it’s not a good solution for this problem. Hmm, i need a good and fast way to retrieve the channel data if i use them. Hmm, have anyone used the channel data or vertex colors to store alot of info like this. It has to be pretty fast too to retrieve the data.

/Andreas

Well, I’m too newbie to reply to this question, but I have perharps an idea.
It is possible to create a dummy object where you stock infos of others objects on the scenes ? Like a global variable but you keep it on the scene when saving file…

Just an idea. I know, it’s a dirty way…

It’s an interesting idea, and could to some extent work perhaps. The problem is I need to save the info in every vertex or face so even if i make a copy i still have to save it there.

Smoothing groups could also used to some extent i think. I’m a little careful with doing what you say, a copy, since the idea is that polyspeed will work with very large objects, perhaps 500k objects. So making copies of these may be dangerous.

I will think if there is some way I could use your idea Externe, thanks for answering

/Andreas

hmm… what kind of data do you need to store?
i once also had to store a lot of additional information inside an object, i used the get/setAppData function for this, it’s pretty fast and you can store as much as you want inside an object, probably you could set up your own vertex-channels with this.
Just don’t know how save this will be, because the data can be overwritten by any other plugin/script…

1 Reply
(@f97ao)
Joined: 11 months ago

Posts: 0

Aha, I haven’t checked that function. Is is possible to save the data connected to the vertices? What I need to do is bake the the information into the vertices.

What I want to do is save selections that can handle when max renumbers the vertices if we for example do a tesselation.

I want to have layers in PolySpeed, the nose the fingers etc I want to save so you can switch between them at will. But since I attach/detach max renumbers the vertices all the time.

The flags work almost exactly like I want to, except they can only save 256 values and also only work for editable_poly not mesh.

So what I need is 2 functions:

  • Save_integer_into_vertex. example: SaveVertData #(1)
  • Get_All_Vertices_with_number. GetAllVertices 20 (will return all vertices with number 20 saved into them)

Do I make sense?

/Andreas

Well since you answered all my PM questions, I guess I should clue you in to my “ingenious idea”

What I was thinking of was using vertex flags while the object is an epoly for the speed and ease of lookup, but also setting vdata values. The magic part would be a lookup that associates the flags with the vdata values, and re-assigns the flags whenever the object is converted back to epoly. Since vdata values survive conversion to mesh and, like flags, survive topology changes, the method works. Unfortunately, the reality is that the reassignment takes a lot of time for a dense object, which i imagine is contrary to your design goals. Feel free to experiment with the idea, though. If it works, I’ll only charge you a minimal consultation fee:deal:

RH

(just kidding about the fee, of course)

Well since you answered all my PM questions, I guess I should clue you in to my “ingenious idea”

What I was thinking of was using vertex flags while the object is an epoly for the speed and ease of lookup, but also setting vdata values. The magic part would be a lookup that associates the flags with the vdata values, and re-assigns the flags whenever the object is converted back to epoly. Since vdata values survive conversion to mesh and, like flags, survive topology changes, the method works. Unfortunately, the reality is that the reassignment takes a lot of time for a dense object, which i imagine is contrary to your design goals. Feel free to experiment with the idea, though. If it works, I’ll only charge you a minimal consultation fee:deal:

Hi there LFShade, thanks for the magic trick

I don’t think it will work super for this case. Hmmm. The problem is that the object is mesh when I do the big lookups. See what I want to do is have a 400k object. Then i select layer 1, this layer 1 gets selected is detached and then converted to polygon object.

Hmm, hmmm, I guess at worst I could save the info in multi sub materials, but that would risk messing up the users materials. pff not so easy one this problem.

/Andreas

These should solve most of my problems.

polyOp.getVertsByColor
[b]meshOp.getVertsByColor

Hmm, does anyone know if it’s possible to convert vert selections to edge/face selections in a more sensible answer than what it does now?

For example if I have 2 verts directly next to each other and I convert them to edges. I want just 1 edge, but max selects 4 edges for every vertex.

Thing is I want to store face selections in the vertex colors, but it won’t work if the convertion isn’t better than this. Hmm, perhaps just shrinking the selection will work.
Any ideas?

/Andreas
[/b]

Hi f97ao, maybe something like this could work for getting the edge between 2 verts:

 
twoverts = polyop.GetVertselection $.baseobject as array
um = polyop.GetEdgesusingVert $.baseobject twoverts[1]
em = polyop.GetEdgesusingVert $.baseobject twoverts[2]
edgearr = #() 
for i in um as array do
(
if um[i] == em[i] then append edgearr i
)
polyop.SetEdgeselection $.baseobject edgearr
redrawviews()

CML

Page 1 / 2