makehumancommunity / makehuman

This is the main repository for the MakeHuman application as such.
http://www.makehumancommunity.org
Other
1.18k stars 244 forks source link

Makehuman does not like targets with spaces in file name #153

Closed reece146 closed 3 years ago

reece146 commented 3 years ago

I've noticed that 1.2.0 (cd0811cb) does not seem to like targets with spaces in the file names.

If you have a target like 'a eyelid smoothen3.target' and start Makehuman the target appears properly in

Modelling -> Custom

and you can apply the target to your model. The resultant MHM file will have a line like:

modifier custom/a eyelid smoothen3 0.500000

When reloading the MHM file the logs complain about not being able to load the target.

[2021-02-11 16:14:09,963] log.py->warning():104 -- WARNING -- Unknown modifier specified in MHM file: custom/a

I tried wrapping the target in single and double quotes (in the MHM) but it didn't work

modifier custom/'a eyelid smoothen3' 0.500000 modifier 'custom/a eyelid smoothen3' 0.500000

Exiting Makehuman, moving the target to a file name without spaces and restarting Makehuman seems to be a workaround.

mv 'a eyelid smoothen3.target' a_eyelid_smoothen3.target

This means that the existing MHM files need to be editing to reflect this as well which is a bit of a pain.

I didn't see this bug posted so...

Aranuvir commented 3 years ago

MakeHuman internally uses whitespaces as delimiter of data fields, by using Python's string split() function. I.e. a line like "my_modifier 0.5" will be split into something like modifier.name = "my_modifier", modifier.strength = 0.5. I don't think it's necessary to explain what happens if there are more whitespaces than necessary in a line. BTW, Bash doesn't like whitespaces that much, either. To me it is best practice to avoid whitespaces (and non-ASCII characters) on filenames. Technically it should be possible to implement other field delimiters, but probably not worth the effort, therefore closing. If anyone feels like rewriting the parsers (and implement converters for backward compatibility) the issue can be reopened.

reece146 commented 3 years ago

FWIW, this is a regression. v1.1 handled these targets without issue.

Also, the existing library of targets for MH is littered with various targets with spaces in the filenames. I don't know if there is a way for these "upstream" target creators to be notified that their targets are now broken and should be updated with filenames that don't have spaces in them.