animate1978 / MB-Lab

MB-Lab is a character creation tool for Blender 4.0 and above, based off ManuelBastioniLAB
Other
1.76k stars 308 forks source link

Use annotations for prop definitions #334

Closed Upliner closed 3 years ago

Upliner commented 3 years ago

I use debug logger and it gives me a lots of warnings like specified below on startup which is very annoying.

Warning: class MBAST_OT_button_save_body_as_is contains a property which should be an annotation!
/home/upliner/.config/blender/2.91/scripts/addons/MB-Lab/__init__.py:6765
    assign as a type annotation: MBAST_OT_button_save_body_as_is.filter_glob
Warning: class MBAST_OT_button_load_base_body contains a property which should be an annotation!
/home/upliner/.config/blender/2.91/scripts/addons/MB-Lab/__init__.py:6765
    assign as a type annotation: MBAST_OT_button_load_base_body.filter_glob
Upliner commented 3 years ago

Hmm it's strange that flakes doesn't like these annotations. They work fine in Blender.

animate1978 commented 3 years ago

Yes it is strange indeed, wondering why myself

Upliner commented 3 years ago

As I understood annotations are usually used as a type hints and flake8 tries to parse them like that and fails. Flake developers claim it isn't a bug. So I currently don't know how to make both Blender and flake8 happy. I can try to find another linter...

Upliner commented 3 years ago

I tried to use pylint instead, it has no problems with annotations and it discovered some other errors:

pylint -E .
************* Module MB-Lab
__init__.py:2517:15: E1305: Too many arguments for format string (too-many-format-args)
__init__.py:4852:0: E0102: function already defined line 4723 (function-redefined)
__init__.py:5531:8: E1123: Unexpected keyword argument 'new_names' in function call (unexpected-keyword-arg)
__init__.py:5549:8: E1123: Unexpected keyword argument 'new_names' in function call (unexpected-keyword-arg)
__init__.py:5564:8: E1123: Unexpected keyword argument 'new_names' in function call (unexpected-keyword-arg)
__init__.py:6211:16: E1101: Module 'MB-Lab.jointscreator' has no 'hide_central_point' member (no-member)
__init__.py:6240:16: E1101: Module 'MB-Lab.jointscreator' has no 'hide_central_point' member (no-member)
__init__.py:6269:16: E1101: Module 'MB-Lab.jointscreator' has no 'hide_central_point' member (no-member)
__init__.py:6298:12: E1101: Module 'MB-Lab.jointscreator' has no 'hide_central_point' member (no-member)
__init__.py:6327:12: E1101: Module 'MB-Lab.jointscreator' has no 'hide_central_point' member (no-member)
__init__.py:6355:12: E1101: Module 'MB-Lab.jointscreator' has no 'hide_central_point' member (no-member)
__init__.py:6383:12: E1101: Module 'MB-Lab.jointscreator' has no 'hide_central_point' member (no-member)
__init__.py:6411:12: E1101: Module 'MB-Lab.jointscreator' has no 'hide_central_point' member (no-member)
__init__.py:6561:8: E1101: Module 'MB-Lab.vgroupscreator' has no 'create_muscles_template_file' member; maybe 'create_muscle_template_file'? (no-member)
animate1978 commented 3 years ago

Noted about the above errors. I will look into them asap

I will now merge this code into 'dev'...