zturtleman / mm3d

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

Blank object names policy? (Model filters mainly) #158

Open m-7761 opened 3 years ago

m-7761 commented 3 years ago

I'm trying to standardize the APIs that take names. Some allow empty names, some don't. I've made the ones that set names to uniformly not allow them. The filters use the creation APIs instead, which allow this in case the model files have blank names.

I'm trying to set the blank name to a dummy name. I'm not sure if this will break filters vis-a-vis if they try to search for the objects by their file names after creating them, or in terms of "round tripping" files (i.e. importing/exporting to same file name.)

I'm not sure if the dummy name should be verbose (e.g. "name ungiven") but I've set it to be "_" in the meantime. The reason I'm concerned about this is my drop-down lists interpret blank items as menu separators and I don't want to have to do processing on every getXName call.

It seems like from a UI perspective throwing out blank strings is a source of headaches that should be avoided. Note, the OBJ loader seems to use a blank string for the first group it creates. After this it starts appending 2, 3, 4, etc. to the end of group names. I've changed to append 1 to the first group if its name is blank. I don't know if that's best practice for this loader. I don't know why OBJ files exported from Blender have blank group names in the first place.