- Implemented `DownloadModel` and `DownloadRequiredModels` operators for downloading models. - Created `ClearModels` operator to clear model resources. - Added `ConvertToSurface` operator for converting image empties into textured surfaces. - Introduced `GenerateDa3Surface` and `GenerateMoge2Surface` operators for generating surfaces using DA3 and MoGe-2 models respectively. - Developed utility functions for handling image mesh data, assigning attributes, and managing geometry nodes. - Established runtime configuration and post-installation model downloading in `runtime.py`.
58 lines
1.8 KiB
Python
58 lines
1.8 KiB
Python
import bpy
|
|
|
|
from .runtime import DEFAULT_STORAGE_ROOT, runtime
|
|
from .properties import device_enum_items
|
|
|
|
|
|
class SnapFormPreferences(bpy.types.AddonPreferences):
|
|
bl_idname = __package__
|
|
|
|
storage_root: bpy.props.StringProperty(
|
|
name="Storage Root",
|
|
description=(
|
|
"Shared user-writable storage for the environment, models and jobs; "
|
|
"all Blender versions can use the same directory"
|
|
),
|
|
subtype="DIR_PATH",
|
|
default=str(DEFAULT_STORAGE_ROOT),
|
|
)
|
|
device: bpy.props.EnumProperty(
|
|
name="Device",
|
|
description=(
|
|
"Inference device used by production tasks; only devices supported "
|
|
"on this machine are listed"
|
|
),
|
|
items=device_enum_items,
|
|
default=0,
|
|
)
|
|
|
|
def draw(self, _context):
|
|
layout = self.layout
|
|
layout.prop(self, "storage_root")
|
|
layout.prop(self, "device")
|
|
layout.separator()
|
|
layout.label(text=f"Environment: {runtime.environment_directory()}")
|
|
if runtime.environment_ready():
|
|
layout.label(text="Environment is installed", icon="CHECKMARK")
|
|
else:
|
|
install_row = layout.row()
|
|
install_row.enabled = runtime.active_job is None
|
|
install_row.operator(
|
|
"snapform.install_environment",
|
|
text="Install Environment",
|
|
icon="IMPORT",
|
|
)
|
|
mirror_row = layout.row()
|
|
mirror_row.enabled = runtime.active_job is None
|
|
mirror_row.operator(
|
|
"snapform.install_environment_mirror",
|
|
text="Install Environment (Mirror)",
|
|
icon="IMPORT",
|
|
)
|
|
layout.separator()
|
|
layout.operator(
|
|
"snapform.open_server_log",
|
|
text="Open Server Log",
|
|
icon="TEXT",
|
|
)
|