Open emadurandal opened 2 months ago
Hi, thank you for the bug report
I'm sorry for answering a bit late (life is a bit busy in the arctic).
In terms of what you're seeking, due to context issues in Blender, calling bpy.ops.tlm.build_lightmaps() doesn't quite work, but it should be possible to invoke the building process in another way by calling the following:
import thelightmapper
thelightmapper.utility.build.prepare_build(0, True)
It is more or less the same command that the button calls but without being an operator call
Let me know if it doesn't work
Cheers, Naxela
Thanks for the answer. The way works. Baked textures were output but some error occurs.
>>> thelightmapper.utility.build.prepare_build(0, True)
Logger started Init
Building lightmaps
(3, 6, 13)
No previous material for Cube
No previous material for 平面
No Previous material array for: Cube
No Previous material array for: 平面
Preparing: UV initiation for object: Cube
Preparing: UV initiation for object: 平面
PREPARE: ATLAS
PREPARE: OBJECTS
Preprocessing material for: Cube
Managing layer for Obj: Cube
Preprocessing material for: 平面
Managing layer for Obj: 平面
Config mesh catch omitted: REMEMBER TO SET IT BACK NAXELA
Beginning build
Baking 0/1 (0.0%) : Cube
Elapsed time: 0.03s | ETA remaining: 0.03s
Baking combined: Direct + Indirect
情報: 内部画像にベイクマップを保存しました。外部ファイルに保存、またはパックしてください
Baking 1/1 (100.0%) : 平面
Elapsed time: 0.16s | ETA remaining: 0.0s
Baking combined: Direct + Indirect
情報: 内部画像にベイクマップを保存しました。外部ファイルに保存、またはパックしてください
Managing build
CPU Encoding
CHECKING FOR REPART
Node2: C:\Users\ema_d\Downloads\thelightmapper_ex\Lightmaps\Cube_baked.hdr => C:\Users\ema_d\Downloads\thelightmapper_ex\Lightmaps\Cube_baked.png
CHECKING FOR REPART
Node2: C:\Users\ema_d\Downloads\thelightmapper_ex\Lightmaps\平面_baked.hdr => C:\Users\ema_d\Downloads\thelightmapper_ex\Lightmaps\平面_baked.png
Lightmap building finished
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
File "C:\Users\ema_d\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\thelightmapper\addon\utility\build.py", line 118, in prepare_build
begin_build()
File "C:\Users\ema_d\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\thelightmapper\addon\utility\build.py", line 708, in begin_build
manage_build()
File "C:\Users\ema_d\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\thelightmapper\addon\utility\build.py", line 1100, in manage_build
setGui(0)
File "C:\Users\ema_d\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\thelightmapper\addon\utility\build.py", line 1312, in setGui
driver["TLM_UI"].remove_handle()
File "C:\Users\ema_d\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\thelightmapper\addon\utility\gui\Viewport.py", line 77, in remove_handle
bpy.types.SpaceView3D.draw_handler_remove(self.handle2, 'WINDOW')
ValueError: callback_remove(handler): NULL handler given, invalid or already removed
But it worked anyway, so it is good. You may close this Issue. Thank you.
I would like to bake lightmaps by python.
so I run the following command in python console of blender.
but the following error is out on terminal console of blender
like this
but bpy.ops.tlm.clean_lightmaps() and bpy.ops.tlm.explore_lightmaps() works properly.
Could you check the error and fix it for
bpy.ops.tlm.build_lightmaps()
to work properly?My Environment
Windows 11 Blender 3.6.13 TheLightmapper version: 0.6.3