Jump to content

Separate multiple meshes within single .obj file


Recommended Posts

Hey all,
Trying to separate out multiple meshes within a single .obj file, but not coming up with any results.
They all have their own named groups, but using the "name from group" node I'm not seeing all the groups correctly named.
I'm seeing that the groups that only contain a single pieces of mesh are being put under the "mesh" group. So when I look at the mesh attribute created from the "name from group" node I'm seeing almost half of my meshes incorrectly in it.

Ideally I'd like to use a split node within a for each loop to separate each mesh out by group, but I haven't found a way to accomplish that yet. The end goal is to make an HDA that takes in a single .obj file that contains multiple meshes and separate each out so that I can apply the correct texture maps to them and then bake them.

Edit: Attached an image of the split node workflow I've done to get them separated.

split_madness.jpg

Edited by THEONLYraider
Image
Link to comment
Share on other sites

As there don't seem to be many objects you can use the group name or path directly to assign the materials.
From what I understand it seems that the group names in the obj file are not correct. Maybe similar names for different groups. If this is the case it may be easier to correct the obj file directly.
The group or path names are lines of the form
o objectname (for path)
or
g objectname (for groups)
I don't know if this is useful but without seeing the file it is difficult to be more precise

import separated obj.hipnc

Three Object (groupes).obj

Three Object (path).obj

Link to comment
Share on other sites

The number of objects within a single file will vary, so it could be 5 or 100's. 

Doing some more research I found that there might be a python solution that could create nodes from the groups within the file.


@f1480187 can hopefully supply a little more info based on the post supplied. I'll still need to delete some groups due to a suffix of "_lod#". 

If the python code works for creating the nodes based on the groups, would there be a way to delete the groups if they have the "_lod#" suffix?
That's something hopefully someone have help out with in the meantime. 

Thanks for the examples!

 

Edit:

image.thumb.png.3d1422245b957159afab36fa88c4cb44.png

Some of the naming issues I'm trying to work around. Each new color is an individual object. In this case I'd like to eliminate each "_2" group.

Here's how it looks within the geo spreadsheet for the primitive groups
image.thumb.png.ac70e53525eb6dfbdf6ddc6836e4e005.png

As you can see the values range from 1 - 0 for each group. Since the "name to group" node doesn't correctly copy over the name as an attribute maybe I can use these 1-0 values to fill in the attribute value through vex?

Edited by THEONLYraider
Link to comment
Share on other sites

13 hours ago, Fenolis said:

The Group and Group Delete nodes accepts syntax like *_2 and lod*, where the asterisk's position indicates if the given string is prefix, suffix, or somewhere in the middle of the group name (asterisk on both ends)

Thanks for this! This helps filtering out the geo a lot! 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...