OliverJPost / HumGen3D

Main code of the Human Generator 3D add-on for Blender
GNU General Public License v3.0
79 stars 14 forks source link

Issue #45 is unsolved #46

Open rbregier opened 1 year ago

rbregier commented 1 year ago

Describe the bug Hi, thanks for the new release. Issue #45 does not seem completely solved. While the following script generates a human model, it produces plenty of context warnings as well:

To Reproduce

import bpy
from HumGen3D.batch_generator.generator import BatchHumanGenerator

context = bpy.context

generator = BatchHumanGenerator(add_clothing=True, add_hair=True, add_expression=True)
generator.expression_type = "most_varied"
generator.texture_resolution='high'
generator.hair_quality='high'

# Generate a random human in random pose
human = generator.generate_human(context=context)
human.pose.set_random(context=context)

Output:

Blender 3.3.3 (hash 8d94aeb604fa built 2023-01-17 09:10:16)
Read prefs: /home/rbregier/.config/blender/3.3/config/userpref.blend
Error: Vertex not in group
Error: Vertex not in group
Error: Vertex not in group
[ plenty of such error messages....]
Error: Vertex not in group
Error: Vertex not in group
Error: Vertex not in group
Error: Shapekey KEKey.002 has an invalid 'from' pointer ((nil)), it will be deleted
ERROR (bke.lib_id_delete): source/blender/blenkernel/intern/lib_id_delete.c:350 id_delete: Deleting KEKey.002 which still has 1 users (including 0 'extra' shallow users)

Info: Total files 1 | Changed 1 | Failed 0
Info: Copied pose to buffer
addon_updater_demo addon: Verbose is enabled
addon_updater_demo addon: Read in JSON settings from file
HG_INFO:     Activating HumGen, version (4, 0, 11)
HG_INFO:     <FrameSummary file /home/rbregier/.config/blender/3.3/scripts/addons/HumGen3D/common/decorators.py, line 33 in wrapper>
HG_WARNING:     Argument 'context' for function 'get_preset_options' substituted with bpy.context.  It's highly recommended to pass your own context!
HG_INFO:     <FrameSummary file /home/rbregier/.config/blender/3.3/scripts/addons/HumGen3D/common/decorators.py, line 33 in wrapper>
HG_WARNING:     Argument 'context' for function 'from_preset' substituted with bpy.context.  It's highly recommended to pass your own context!
HG_INFO:     <FrameSummary file /home/rbregier/.config/blender/3.3/scripts/addons/HumGen3D/human/human.py, line 225 in from_preset>
HG_WARNING:     Argument 'context' for function 'set_from_dict' substituted with bpy.context.  It's highly recommended to pass your own context!
HG_INFO:     <FrameSummary file /home/rbregier/.config/blender/3.3/scripts/addons/HumGen3D/human/human.py, line 225 in from_preset>
HG_WARNING:     Argument 'context' for function 'set_from_dict' substituted with bpy.context.  It's highly recommended to pass your own context!
HG_INFO:     <FrameSummary file /home/rbregier/.config/blender/3.3/scripts/addons/HumGen3D/human/human.py, line 225 in from_preset>
HG_WARNING:     Argument 'context' for function 'set_from_dict' substituted with bpy.context.  It's highly recommended to pass your own context!
HG_INFO:     <FrameSummary file /home/rbregier/.config/blender/3.3/scripts/addons/HumGen3D/batch_generator/generator.py, line 73 in generate_human>
HG_WARNING:     Argument 'context' for function 'randomize' substituted with bpy.context.  It's highly recommended to pass your own context!
HG_INFO:     <FrameSummary file /home/rbregier/.config/blender/3.3/scripts/addons/HumGen3D/batch_generator/generator.py, line 74 in generate_human>
HG_WARNING:     Argument 'context' for function 'randomize' substituted with bpy.context.  It's highly recommended to pass your own context!
HG_INFO:     <FrameSummary file /home/rbregier/.config/blender/3.3/scripts/addons/HumGen3D/batch_generator/generator.py, line 100 in generate_human>
HG_WARNING:     Argument 'context' for function 'set' substituted with bpy.context.  It's highly recommended to pass your own context!
HG_INFO:     <FrameSummary file /home/rbregier/.config/blender/3.3/scripts/addons/HumGen3D/batch_generator/generator.py, line 135 in _set_clothing>
HG_WARNING:     Argument 'context' for function 'set' substituted with bpy.context.  It's highly recommended to pass your own context!
HG_INFO:     <FrameSummary file /home/rbregier/.config/blender/3.3/scripts/addons/HumGen3D/batch_generator/generator.py, line 139 in _set_clothing>
HG_WARNING:     Argument 'context' for function 'randomize_colors' substituted with bpy.context.  It's highly recommended to pass your own context!
HG_INFO:     <FrameSummary file /home/rbregier/.config/blender/3.3/scripts/addons/HumGen3D/batch_generator/generator.py, line 139 in _set_clothing>
HG_WARNING:     Argument 'context' for function 'randomize_colors' substituted with bpy.context.  It's highly recommended to pass your own context!
HG_INFO:     <FrameSummary file /home/rbregier/.config/blender/3.3/scripts/addons/HumGen3D/batch_generator/generator.py, line 143 in _set_clothing>
HG_WARNING:     Argument 'context' for function 'randomize_colors' substituted with bpy.context.  It's highly recommended to pass your own context!
Info: Copied pose to buffer

Blender quit

Desktop (please complete the following information):

OliverJPost commented 1 year ago

Yes, we ourselves are still violating the context decorator in certain parts of the add-on. We've added a check for this in our testing toolchain so the final release of V4 should not include any of these warnings.

OliverJPost commented 1 year ago

In this case the warnings are caused by function calls inside the batch generator that do not pass context, so the issue is in our code base and not in your script