princeton-vl / infinigen

Infinite Photorealistic Worlds using Procedural Generation
https://infinigen.org
BSD 3-Clause "New" or "Revised" License
5.16k stars 432 forks source link

[REQUEST]KeyError: 'bpy_prop_collection[key]: key "Subdivision" not found' #122

Open lilili-lilili opened 11 months ago

lilili-lilili commented 11 months ago

Optional services are not configured during Infinigen configuration, When implementing the basic example in the second step you provided, an error will occur when performing the following steps $BLENDER -noaudio --background --python generate.py -- --seed 0 --task coarse -g desert.gin simple.gin --output_folder outputs/helloworld/coarse

There are three errors: [times] [INFO] | [Create terrain] failed with <class 'KeyError'> [times] [INFO] | [MAIN TOTAL] failed with <class 'KeyError'> KeyError: 'bpy_prop_collection[key]: key "Subdivision" not found'

run as follows: (base) u@u-Lenovo-Legion-R7000-2020:~/infinigen/worldgen$ $BLENDER -noaudio --background --python generate.py -- --seed 0 --task coarse -g desert.gin simple.gin --output_folder outputs/helloworld/coarse Blender 3.3.1 (hash b292cfe5a936 built 2022-10-05 00:14:35) Read prefs: /home/u/.config/blender/3.3/config/userpref.blend [21:46:00.061] [root] [INFO] | Converted args.seed='0' to scene_seed=0, parsed as hexadecimal [21:46:00.061] [root] [WARNING] | Randomly selected scene_type='coral_reef'. IF THIS IS NOT INTENDED THEN YOU ARE MISSING SCENE CONFIGS [21:46:00.085] [root] [INFO] | infinigen version 1.0.2 [21:46:00.085] [root] [INFO] | CUDA_VISIBLE_DEVICES=None [21:46:00.085] [times] [INFO] | [MAIN TOTAL] [21:46:00.085] [root] [INFO] | Processing frames 1 through 1 inclusive [21:46:00.091] [times] [INFO] | [Create terrain] [21:46:00.091] [root] [INFO] | Terrain using only on the fly on_the_fly_asset_folder=PosixPath('/home/u/infinigen/worldgen/outputs/helloworld/coarse/assets') [21:46:01.570] [times] [INFO] | [Create terrain] failed with <class 'KeyError'> [21:46:01.570] [times] [INFO] | [MAIN TOTAL] failed with <class 'KeyError'> 错误: Python: Traceback (most recent call last): File "/home/u/infinigen/worldgen/generate.py", line 410, in main() File "/home/u/infinigen/worldgen/generate.py", line 400, in main infinigen.main( File "/home/u/infinigen/worldgen/core.py", line 433, in main execute_tasks( File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1605, in gin_wrapper utils.augment_exception_message_and_reraise(e, err_str) File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise raise proxy.with_traceback(exception.traceback) from None File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1582, in gin_wrapper return fn(*new_args, new_kwargs) File "/home/u/infinigen/worldgen/core.py", line 274, in execute_tasks terrain = Terrain(scene_seed, surface.registry, task=task, on_the_fly_asset_folder=output_folder/"assets") File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1605, in gin_wrapper utils.augment_exception_message_and_reraise(e, err_str) File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise raise proxy.with_traceback(exception.traceback) from None File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1582, in gin_wrapper return fn(*new_args, *new_kwargs) File "/home/u/infinigen/worldgen/terrain/core.py", line 82, in init self.elements, scene_infos = scene(seed, Path(on_the_fly_asset_folder), asset_path, device) File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1605, in gin_wrapper utils.augment_exception_message_and_reraise(e, err_str) File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise raise proxy.with_traceback(exception.traceback) from None File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1582, in gin_wrapper return fn(new_args, new_kwargs) File "/home/u/infinigen/worldgen/terrain/scene.py", line 43, in scene caves = Caves(on_the_fly_asset_folder / Assets.Caves, reused_asset_folder / Assets.Caves) File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1605, in gin_wrapper utils.augment_exception_message_and_reraise(e, err_str) File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise raise proxy.with_traceback(exception.traceback) from None File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1582, in gin_wrapper return fn(*new_args, new_kwargs) File "/home/u/infinigen/worldgen/terrain/elements/caves.py", line 44, in init n_instances, N, float_data = self.load_assets() File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1605, in gin_wrapper utils.augment_exception_message_and_reraise(e, err_str) File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise raise proxy.with_traceback(exception.traceback) from None File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1582, in gin_wrapper return fn(*new_args, *new_kwargs) File "/home/u/infinigen/worldgen/terrain/elements/caves.py", line 66, in load_assets caves_asset(self.on_the_fly_asset_folder / f"{i}") File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1605, in gin_wrapper utils.augment_exception_message_and_reraise(e, err_str) File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise raise proxy.with_traceback(exception.traceback) from None File "/home/u/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1582, in gin_wrapper return fn(new_args, new_kwargs) File "/home/u/infinigen/worldgen/terrain/assets/caves/core.py", line 188, in caves_asset add_cave(rescale=1, cave_z=0) File "/home/u/infinigen/worldgen/terrain/assets/caves/core.py", line 170, in add_cave cave.add_subdivision("firstsub", 2) File "/home/u/infinigen/worldgen/terrain/assets/caves/core.py", line 108, in add_subdivision bpy.context.object.modifiers["Subdivision"].name = name KeyError: 'bpy_prop_collection[key]: key "Subdivision" not found' In call to configurable 'caves_asset' (<function caves_asset at 0x7f9443752ef0>) In call to configurable 'load_assets' (<function Caves.load_assets at 0x7f94437530a0>) In call to configurable 'Caves' (<class 'terrain.elements.caves.Caves'>) In call to configurable 'scene' (<function scene at 0x7f94acdbff40>) In call to configurable 'Terrain' (<class 'terrain.core.Terrain'>) In call to configurable 'execute_tasks' (<function execute_tasks at 0x7f943e659990>)

Blender quit

araistrick commented 10 months ago

Hello, could you elaborate what you mean by 'optional services'? Also, please re-attempt this command using 1.0.3, as it seems there has been some kind of error here such that the system didnt think a scenetype config was loaded.

xiaolin-mt commented 10 months ago

I ran into the same issue and found this is caused by the system language used by the install Blender. You can launch Blender and change the language from Chinese to English to solution this issue.

araistrick commented 10 months ago

Interestin, sorry for the issue folks. Did blender use Chinese by default or did it stop working after manually switching the language? Short term I can add a check so that the error message is at least more understandable. Long term we may be able abstract the code so that it works either way, although I will have to check there exists a good mechanism for this via the blender API.

xiaolin-mt commented 10 months ago

Yes, Blender uses Chinese by default. I don't know why this is happening, given the system language of the OS is also English. No error occurred after I switched from Chinese to English, and I successfully built the HelloWorld demo. I assume there may be an option with Blender when building to configure the default language of Blender.