zturtleman / mm3d

Maverick Model 3D is a 3D model editor and animator for games.
https://clover.moe/mm3d
GNU General Public License v2.0
115 stars 23 forks source link

objfilter.cc has awful way of naming groups, maybe other "filters" do to? #82

Open m-7761 opened 5 years ago

m-7761 commented 5 years ago
            int count = m_mgList.size();
            std::string name = m_groupName.c_str();
            if(count>0) //???
            {
                char temp[32];
                snprintf(temp,32,"%d",count+1);
                name += temp;
            }
            MaterialGroupT mg;
            m_curGroup = m_model->addGroup(name.c_str());
            m_model->setGroupTextureId(m_curGroup,m_curMaterial);

How this breaks down is the first group is typically unnamed, and so is blank in the menu, which is a problem in itself. Something like "<default>" is better.

After that, 2 is put on the end of the group name, with no separator, so it corrupts the author's names, and generally looks bizarre.

It should probably be doing a lookup in the existing groups, and if it happens to have a collision append "(2)" on the end, then "(3)" and so on. But a collision would indicate that the groups are probably logically the same group, I don't know.

P.S. I wouldn't normally give a damn, but OBJ is probably one of the most used import/export formats.

zturtleman commented 5 years ago

Code seems odd. I cannot reproduce this issue. No group name or blank group name results in faces being added to "No group" not being assigned to a group in mm3d. Please provide a model that runs into this issue.

zturtleman commented 5 years ago

Never mind I found it.

object_name
material_name
face
material_name
face