- 新增场景属性 `sna_render_resolution` 用于选择渲染分辨率(1024x1024 或 2048x2048) - 修改 `Comfy_OT_Mvgen_B6229` 操作符,在执行后自动渲染深度图和法线图 - 新增 `_render_depth` 和 `_render_normal` 函数,从 `Materials.blend` 资产文件加载专用材质和节点组进行渲染 - 在 UI 面板中添加分辨率选择下拉菜单并更新按钮文本 - 在 `unregister` 函数中安全清理新增的场景属性
46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
bl_info = {
|
|
"name" : "ComfyProjector",
|
|
"author" : "Blender Procedural",
|
|
"description" : "Projector for ComfyUI",
|
|
"blender" : (5, 0, 0),
|
|
"version" : (1, 0, 0),
|
|
"location" : "",
|
|
"warning" : "",
|
|
"doc_url": "",
|
|
"tracker_url": "",
|
|
"category" : "3D View"
|
|
}
|
|
|
|
import bpy # noqa: E402
|
|
from .utils import classes # noqa: E402
|
|
|
|
|
|
def register():
|
|
for cls in classes:
|
|
bpy.utils.register_class(cls)
|
|
bpy.types.Scene.sna_activeobject = bpy.props.PointerProperty(type=bpy.types.Object)
|
|
bpy.types.Scene.sna_bakecam = bpy.props.PointerProperty(type=bpy.types.Object)
|
|
bpy.types.Scene.sna_activeobject_name = bpy.props.StringProperty()
|
|
bpy.types.Scene.sna_render_resolution = bpy.props.EnumProperty(
|
|
name="Render Resolution",
|
|
description="Resolution for depth and normal map renders",
|
|
items=[
|
|
('1024', '1024 x 1024', ''),
|
|
('2048', '2048 x 2048', ''),
|
|
],
|
|
default='1024',
|
|
)
|
|
|
|
|
|
def unregister():
|
|
if hasattr(bpy.types.Scene, "sna_render_resolution"):
|
|
del bpy.types.Scene.sna_render_resolution
|
|
if hasattr(bpy.types.Scene, "sna_activeobject_name"):
|
|
del bpy.types.Scene.sna_activeobject_name
|
|
if hasattr(bpy.types.Scene, "sna_bakecam"):
|
|
del bpy.types.Scene.sna_bakecam
|
|
if hasattr(bpy.types.Scene, "sna_activeobject"):
|
|
del bpy.types.Scene.sna_activeobject
|
|
for cls in reversed(classes):
|
|
bpy.utils.unregister_class(cls)
|