Remove obsolete implementation and simplify project structure

This commit is contained in:
2026-08-21 09:46:50 +08:00
parent b5a2f9690c
commit af5603045c
100 changed files with 365 additions and 365 deletions

View File

@@ -3,9 +3,9 @@ import bpy
from .runtime import runtime
from .operators import CLASSES as OPERATOR_CLASSES
from .operators.balloon import BalloonTool
from .preferences import SnapFormPreferences
from .properties import SnapFormSettings
from .menu import SnapFormImageMenu, draw_image_context_menu
from .preferences import AnyImagePreferences
from .properties import AnyImageSettings
from .menu import AnyImageImageMenu, draw_image_context_menu
from .panel import (
Ben2RemovalDebugPanel,
Da3OutputDebugPanel,
@@ -17,10 +17,10 @@ from .panel import (
CLASSES = (
SnapFormPreferences,
SnapFormSettings,
AnyImagePreferences,
AnyImageSettings,
*OPERATOR_CLASSES,
SnapFormImageMenu,
AnyImageImageMenu,
ServerPanel,
ModelsPanel,
DebugPanel,
@@ -37,8 +37,8 @@ def register():
BalloonTool,
separator=False,
)
bpy.types.Scene.snapform_settings = bpy.props.PointerProperty(
type=SnapFormSettings,
bpy.types.Scene.anyimage_settings = bpy.props.PointerProperty(
type=AnyImageSettings,
)
bpy.types.VIEW3D_MT_object_context_menu.append(draw_image_context_menu)
bpy.types.OUTLINER_MT_object.append(draw_image_context_menu)
@@ -50,7 +50,7 @@ def unregister():
bpy.utils.unregister_tool(BalloonTool)
bpy.types.VIEW3D_MT_object_context_menu.remove(draw_image_context_menu)
bpy.types.OUTLINER_MT_object.remove(draw_image_context_menu)
if hasattr(bpy.types.Scene, "snapform_settings"):
del bpy.types.Scene.snapform_settings
if hasattr(bpy.types.Scene, "anyimage_settings"):
del bpy.types.Scene.anyimage_settings
for class_type in reversed(CLASSES):
bpy.utils.unregister_class(class_type)

View File

@@ -1,8 +1,8 @@
schema_version = "1.0.0"
id = "snapform"
id = "anyimage"
version = "0.12.15"
name = "SnapForm"
name = "AnyImage"
tagline = "Build spatial structures from images, fast"
maintainer = "OmooLab"
type = "add-on"

View File

@@ -3,9 +3,9 @@ import bpy
from .operators.image import is_image_empty
class SnapFormImageMenu(bpy.types.Menu):
bl_idname = "SNAPFORM_MT_image_context"
bl_label = "SnapForm"
class AnyImageImageMenu(bpy.types.Menu):
bl_idname = "ANYIMAGE_MT_image_context"
bl_label = "AnyImage"
def draw(self, _context):
from .runtime import runtime
@@ -14,7 +14,7 @@ class SnapFormImageMenu(bpy.types.Menu):
layout = self.layout
layout.operator_context = "INVOKE_DEFAULT"
layout.operator(
"snapform.activate_balloon_tool",
"anyimage.activate_balloon_tool",
text="Balloon Lasso Tool",
icon="MOD_SKIN",
)
@@ -22,19 +22,19 @@ class SnapFormImageMenu(bpy.types.Menu):
environment_ready = runtime.environment_ready()
if not environment_ready:
layout.operator(
"snapform.install_environment",
"anyimage.install_environment",
text="Install Environment",
icon="IMPORT",
)
layout.operator(
"snapform.install_environment_mirror",
"anyimage.install_environment_mirror",
text="Install Environment (Mirror)",
icon="IMPORT",
)
models_ready = required_models_ready()
if environment_ready and not models_ready:
layout.operator(
"snapform.download_required_models",
"anyimage.download_required_models",
text="Download Required Models",
icon="IMPORT",
)
@@ -44,14 +44,14 @@ class SnapFormImageMenu(bpy.types.Menu):
depth_plane_row = layout.row()
depth_plane_row.enabled = features_ready
depth_plane_row.operator(
"snapform.convert_to_depth_plane",
"anyimage.convert_to_depth_plane",
text="Convert to Depth Plane",
icon="MOD_DISPLACE",
)
surface_row = layout.row()
surface_row.enabled = features_ready
surface_row.operator(
"snapform.convert_to_surface",
"anyimage.convert_to_surface",
text="Convert to Surface",
icon="MESH_GRID",
)
@@ -59,7 +59,7 @@ class SnapFormImageMenu(bpy.types.Menu):
background_row = layout.row()
background_row.enabled = features_ready
background_row.operator(
"snapform.remove_image_background",
"anyimage.remove_image_background",
text="Remove Background",
icon="IMAGE_ALPHA",
)
@@ -70,7 +70,7 @@ def draw_image_context_menu(self, context):
return
self.layout.separator()
self.layout.menu(
SnapFormImageMenu.bl_idname,
text="SnapForm",
AnyImageImageMenu.bl_idname,
text="AnyImage",
icon="PLUGIN",
)

View File

@@ -23,7 +23,7 @@ from .image import (
class RemoveImageBackground(bpy.types.Operator):
bl_idname = "snapform.remove_image_background"
bl_idname = "anyimage.remove_image_background"
bl_label = "Remove Background"
bl_description = "Remove the background from this Image Empty with BEN2"
bl_options = {"REGISTER"}
@@ -44,7 +44,7 @@ class RemoveImageBackground(bpy.types.Operator):
source_object = context.object
total_frames = video_total_frames(source_object.data)
if total_frames > 1:
context.scene.snapform_settings.video_frames = (
context.scene.anyimage_settings.video_frames = (
default_extract_frames(source_object)
)
try:
@@ -56,7 +56,7 @@ class RemoveImageBackground(bpy.types.Operator):
self.report({"ERROR"}, str(error))
return {"CANCELLED"}
result = bpy.ops.snapform.process_image_background(
result = bpy.ops.anyimage.process_image_background(
input_path=str(source_path),
source_object_name=source_object.name,
delete_input=delete_input,
@@ -83,7 +83,7 @@ def apply_background_response(result, source_object_name):
class ProcessImageBackground(JobOperatorBase, bpy.types.Operator):
bl_idname = "snapform.process_image_background"
bl_idname = "anyimage.process_image_background"
bl_label = "Process Image Background"
job_type = "remove-background"
starting_message = "Starting Image Empty background removal"
@@ -95,7 +95,7 @@ class ProcessImageBackground(JobOperatorBase, bpy.types.Operator):
def request(self, context):
require_environment()
require_model(BEN2_MODEL_KEY)
settings = context.scene.snapform_settings
settings = context.scene.anyimage_settings
return {
"input": str(background_input_path(self.input_path)),
"model": BEN2_MODEL_KEY,

View File

@@ -8,7 +8,7 @@ import bpy
BALLOON_DEPTH_ATTRIBUTE = "o_balloon_depth"
BALLOON_SHAPE_NODE_GROUP_NAME = "O Balloon Shape"
BALLOON_SHAPE_NODE_GROUP_VERSION = 16
BALLOON_SHAPE_VERSION_PROPERTY = "snapform_balloon_shape_version"
BALLOON_SHAPE_VERSION_PROPERTY = "anyimage_balloon_shape_version"
def load_balloon_depth_data(path):
@@ -216,8 +216,8 @@ def create_balloon_base_plane(context, balloon, vertices, local_plane):
controller.empty_display_size = max(float(extent.max()) * 0.15, 0.01)
controller.show_in_front = True
controller.hide_render = True
controller["snapform_source_type"] = "BALLOON_BASE_PLANE"
controller["snapform_base_plane"] = (slope_y, slope_z, offset)
controller["anyimage_source_type"] = "BALLOON_BASE_PLANE"
controller["anyimage_base_plane"] = (slope_y, slope_z, offset)
return controller

View File

@@ -49,9 +49,9 @@ from ..surface import assign_vertex_uv
MIN_PATH_DISTANCE = 2.0
BALLOON_MATERIAL_PROPERTY = "snapform_balloon_material"
BALLOON_SOURCE_IMAGE_PROPERTY = "snapform_source_image"
BALLOON_NORMAL_IMAGE_PROPERTY = "snapform_balloon_normal_image"
BALLOON_MATERIAL_PROPERTY = "anyimage_balloon_material"
BALLOON_SOURCE_IMAGE_PROPERTY = "anyimage_source_image"
BALLOON_NORMAL_IMAGE_PROPERTY = "anyimage_balloon_normal_image"
def simplify_screen_path(path):
@@ -395,11 +395,11 @@ def extract_balloon_object(
balloon = bpy.data.objects.new(balloon_name, mesh)
context.collection.objects.link(balloon)
balloon.matrix_world = orient_balloon_world_matrix(matrix_world)
balloon["snapform_source_type"] = "BALLOON"
balloon["snapform_balloon_algorithm"] = algorithm
balloon["snapform_source_object"] = source_name
balloon["snapform_inflation"] = inflation
balloon["snapform_resolution"] = point_spacing
balloon["anyimage_source_type"] = "BALLOON"
balloon["anyimage_balloon_algorithm"] = algorithm
balloon["anyimage_source_object"] = source_name
balloon["anyimage_inflation"] = inflation
balloon["anyimage_resolution"] = point_spacing
balloon.data.materials.append(material)
if depth_data is not None:
base_plane = create_balloon_base_plane(
@@ -410,8 +410,8 @@ def extract_balloon_object(
)
add_balloon_shape_modifier(balloon, thickness, base_plane)
if depth_data is not None:
balloon["snapform_balloon_depth_analysis"] = True
balloon["snapform_reference_depth"] = depth_data["reference_depth"]
balloon["anyimage_balloon_depth_analysis"] = True
balloon["anyimage_reference_depth"] = depth_data["reference_depth"]
except Exception:
if base_plane is not None:
bpy.data.objects.remove(base_plane, do_unlink=True)
@@ -473,7 +473,7 @@ def drawing_in_region(area_pointer, region_pointer):
class ExtractBalloon(bpy.types.Operator):
bl_idname = "snapform.extract_balloon"
bl_idname = "anyimage.extract_balloon"
bl_label = "Extract Balloon"
bl_description = "Build one closed Balloon mesh from a saved lasso region"
bl_options = {"REGISTER", "UNDO"}
@@ -536,7 +536,7 @@ class ExtractBalloon(bpy.types.Operator):
def invoke(self, context, event):
source_object = context.active_object
settings = context.scene.snapform_settings
settings = context.scene.anyimage_settings
self.mode = settings.balloon_mode
self.thickness = settings.balloon_thickness
self.resolution = settings.balloon_resolution
@@ -622,7 +622,7 @@ class ExtractBalloon(bpy.types.Operator):
source_object.data,
context.scene,
)
result = bpy.ops.snapform.analyze_balloon(
result = bpy.ops.anyimage.analyze_balloon(
input_path=str(source_path),
delete_input=delete_input,
source_object_name=self.source_object_name,
@@ -657,7 +657,7 @@ class ExtractBalloon(bpy.types.Operator):
select_result=False,
reuse_material=self.reuse_material,
)
balloon["snapform_resolution_m"] = self.resolution
balloon["anyimage_resolution_m"] = self.resolution
except (json.JSONDecodeError, RuntimeError, TypeError, ValueError) as error:
self.report({"ERROR"}, str(error))
return {"CANCELLED"}
@@ -665,7 +665,7 @@ class ExtractBalloon(bpy.types.Operator):
class AnalyzeBalloon(JobOperatorBase, bpy.types.Operator):
bl_idname = "snapform.analyze_balloon"
bl_idname = "anyimage.analyze_balloon"
bl_label = "Analyze Balloon"
job_type = "analyze-balloon"
starting_message = "Starting Balloon AI analysis"
@@ -744,11 +744,11 @@ class AnalyzeBalloon(JobOperatorBase, bpy.types.Operator):
depth_data=depth_data,
normal_path=(result.file("normal") if self.depth_analysis else None),
)
balloon["snapform_resolution_m"] = self.resolution
balloon["anyimage_resolution_m"] = self.resolution
if self.contour_analysis:
balloon["snapform_balloon_contour_analysis"] = True
balloon["anyimage_balloon_contour_analysis"] = True
if self.depth_analysis:
balloon["snapform_balloon_depth_model"] = self.depth_model
balloon["anyimage_balloon_depth_model"] = self.depth_model
push_undo("Extract Balloon")
return "AI-analyzed Balloon is ready"
@@ -757,7 +757,7 @@ class AnalyzeBalloon(JobOperatorBase, bpy.types.Operator):
class ActivateBalloonTool(bpy.types.Operator):
bl_idname = "snapform.activate_balloon_tool"
bl_idname = "anyimage.activate_balloon_tool"
bl_label = "Balloon Lasso Tool"
bl_description = "Activate the Balloon Lasso tool in the 3D Viewport"
bl_options = {"INTERNAL"}
@@ -780,7 +780,7 @@ class ActivateBalloonTool(bpy.types.Operator):
class BalloonTool(bpy.types.WorkSpaceTool):
bl_space_type = "VIEW_3D"
bl_context_mode = "OBJECT"
bl_idname = "snapform.balloon_lasso"
bl_idname = "anyimage.balloon_lasso"
bl_label = "Balloon Lasso"
bl_description = (
"Draw an Image Empty region and extract one independently undoable "
@@ -802,11 +802,11 @@ class BalloonTool(bpy.types.WorkSpaceTool):
"properties": [
(
"data_path_primary",
"scene.snapform_settings.balloon_thickness",
"scene.anyimage_settings.balloon_thickness",
),
(
"zoom_path",
"scene.snapform_settings.balloon_thickness_radial_zoom",
"scene.anyimage_settings.balloon_thickness_radial_zoom",
),
]
},
@@ -818,11 +818,11 @@ class BalloonTool(bpy.types.WorkSpaceTool):
"properties": [
(
"data_path_primary",
"scene.snapform_settings.balloon_resolution",
"scene.anyimage_settings.balloon_resolution",
),
(
"zoom_path",
"scene.snapform_settings.balloon_resolution_radial_zoom",
"scene.anyimage_settings.balloon_resolution_radial_zoom",
),
]
},
@@ -830,7 +830,7 @@ class BalloonTool(bpy.types.WorkSpaceTool):
)
def draw_settings(context, layout, tool):
settings = context.scene.snapform_settings
settings = context.scene.anyimage_settings
layout.prop(settings, "balloon_mode", text="")
layout.prop(settings, "balloon_thickness")
layout.prop(settings, "balloon_resolution", text="Resolution (m)")

View File

@@ -46,7 +46,7 @@ def production_device():
def require_environment():
if not runtime.environment_ready():
raise RuntimeError("Install the SnapForm Environment first")
raise RuntimeError("Install the AnyImage Environment first")
def require_model(model_key):

View File

@@ -14,14 +14,14 @@ from .common import (
class DebugDa3(JobOperatorBase, bpy.types.Operator):
bl_idname = "snapform.debug_da3"
bl_idname = "anyimage.debug_da3"
bl_label = "Debug DA3"
job_type = "debug-da3"
starting_message = "Starting DA3 API inference"
def request(self, context):
require_environment()
settings = context.scene.snapform_settings
settings = context.scene.anyimage_settings
model = settings.model
require_model(model)
return {
@@ -43,14 +43,14 @@ class DebugDa3(JobOperatorBase, bpy.types.Operator):
class DebugMoge2(JobOperatorBase, bpy.types.Operator):
bl_idname = "snapform.debug_moge2"
bl_idname = "anyimage.debug_moge2"
bl_label = "Debug MoGe-2"
job_type = "debug-moge2"
starting_message = "Starting MoGe-2 inference"
def request(self, context):
require_environment()
settings = context.scene.snapform_settings
settings = context.scene.anyimage_settings
require_model(settings.moge_model)
return {
**moge2_parameters(
@@ -69,14 +69,14 @@ class DebugMoge2(JobOperatorBase, bpy.types.Operator):
class DebugBen2(JobOperatorBase, bpy.types.Operator):
bl_idname = "snapform.debug_ben2"
bl_idname = "anyimage.debug_ben2"
bl_label = "Debug BEN2"
job_type = "debug-ben2"
starting_message = "Starting BEN2 background removal"
def request(self, context):
require_environment()
settings = context.scene.snapform_settings
settings = context.scene.anyimage_settings
require_model(BEN2_MODEL_KEY)
return {
"input": str(background_input_path(settings.background_input_path)),

View File

@@ -326,7 +326,7 @@ def build_image_depth_plane(
use_cyclic=source_use_cyclic,
animate_frame=is_animated_image(source_object.data),
)
plane_object["snapform_frame_count"] = frame_count
plane_object["anyimage_frame_count"] = frame_count
return finish_depth_plane(
context,
source_object,
@@ -431,11 +431,11 @@ def build_depth_plane(
use_cyclic=source_use_cyclic,
animate_frame=is_animated_image(source_object.data),
)
plane_object["snapform_reference_depth"] = reference_depth
plane_object["snapform_camera_plane_width"] = bounds[1] - bounds[0]
plane_object["snapform_camera_plane_height"] = bounds[3] - bounds[2]
plane_object["snapform_depth_scale"] = depth_scale
plane_object["snapform_frame_count"] = frame_count
plane_object["anyimage_reference_depth"] = reference_depth
plane_object["anyimage_camera_plane_width"] = bounds[1] - bounds[0]
plane_object["anyimage_camera_plane_height"] = bounds[3] - bounds[2]
plane_object["anyimage_depth_scale"] = depth_scale
plane_object["anyimage_frame_count"] = frame_count
return finish_depth_plane(
context,
@@ -536,9 +536,9 @@ def build_moge2_depth_plane(
use_cyclic=source_use_cyclic,
animate_frame=is_animated_image(source_object.data),
)
plane_object["snapform_reference_depth"] = reference_depth
plane_object["snapform_depth_scale"] = depth_scale
plane_object["snapform_frame_count"] = len(depth)
plane_object["anyimage_reference_depth"] = reference_depth
plane_object["anyimage_depth_scale"] = depth_scale
plane_object["anyimage_frame_count"] = len(depth)
return finish_depth_plane(
context,
source_object,

View File

@@ -36,7 +36,7 @@ def image_depth_model_items(owner, context):
class ConvertToDepthPlane(bpy.types.Operator):
bl_idname = "snapform.convert_to_depth_plane"
bl_idname = "anyimage.convert_to_depth_plane"
bl_label = "Convert to Depth Plane"
bl_description = "Convert an image to a displaced depth plane"
bl_options = {"REGISTER"}
@@ -101,7 +101,7 @@ class ConvertToDepthPlane(bpy.types.Operator):
def execute(self, context):
source_object = context.object
if video_total_frames(source_object.data) > 1:
context.scene.snapform_settings.video_frames = (
context.scene.anyimage_settings.video_frames = (
default_extract_frames(source_object)
)
if self.model == "ORIGINAL":
@@ -114,9 +114,9 @@ class ConvertToDepthPlane(bpy.types.Operator):
self.report({"ERROR"}, str(error))
return {"CANCELLED"}
run_original = (
bpy.ops.snapform.generate_original_background
bpy.ops.anyimage.generate_original_background
if self.remove_background
else bpy.ops.snapform.extract_original_frames
else bpy.ops.anyimage.extract_original_frames
)
result = run_original(
input_path=str(source_path),
@@ -140,7 +140,7 @@ class ConvertToDepthPlane(bpy.types.Operator):
except RuntimeError as error:
self.report({"ERROR"}, str(error))
return {"CANCELLED"}
result = bpy.ops.snapform.generate_moge2_depth(
result = bpy.ops.anyimage.generate_moge2_depth(
input_path=str(source_path),
source_object_name=source_object.name,
resolution_level=self.resolution_level,
@@ -174,7 +174,7 @@ class ConvertToDepthPlane(bpy.types.Operator):
self.report({"ERROR"}, str(error))
return {"CANCELLED"}
result = bpy.ops.snapform.generate_da3_depth(
result = bpy.ops.anyimage.generate_da3_depth(
input_path=str(source_path),
source_object_name=source_object.name,
depth_data_name=depth_data_name(source_object),
@@ -306,7 +306,7 @@ def build_original_depth_response(
push_undo("Convert to Depth Plane")
class GenerateDa3Depth(JobOperatorBase, bpy.types.Operator):
bl_idname = "snapform.generate_da3_depth"
bl_idname = "anyimage.generate_da3_depth"
bl_label = "Generate DA3 Depth"
job_type = "generate-depth"
starting_message = "Starting depth estimation"
@@ -326,7 +326,7 @@ class GenerateDa3Depth(JobOperatorBase, bpy.types.Operator):
require_model(self.model)
if self.remove_background:
require_model(BEN2_MODEL_KEY)
settings = context.scene.snapform_settings
settings = context.scene.anyimage_settings
return {
**da3_parameters(
settings,
@@ -358,7 +358,7 @@ class GenerateDa3Depth(JobOperatorBase, bpy.types.Operator):
class GenerateMoge2Depth(JobOperatorBase, bpy.types.Operator):
bl_idname = "snapform.generate_moge2_depth"
bl_idname = "anyimage.generate_moge2_depth"
bl_label = "Generate MoGe-2 Depth"
job_type = "generate-depth"
starting_message = "Starting MoGe-2 inference"
@@ -377,7 +377,7 @@ class GenerateMoge2Depth(JobOperatorBase, bpy.types.Operator):
require_model(self.model)
if self.remove_background:
require_model(BEN2_MODEL_KEY)
settings = context.scene.snapform_settings
settings = context.scene.anyimage_settings
return {
**moge2_parameters(
settings,
@@ -407,7 +407,7 @@ class GenerateMoge2Depth(JobOperatorBase, bpy.types.Operator):
class GenerateOriginalBackground(JobOperatorBase, bpy.types.Operator):
bl_idname = "snapform.generate_original_background"
bl_idname = "anyimage.generate_original_background"
bl_label = "Generate Original Background"
job_type = "remove-background"
starting_message = "Starting background removal"
@@ -421,7 +421,7 @@ class GenerateOriginalBackground(JobOperatorBase, bpy.types.Operator):
def request(self, context):
require_environment()
require_model(BEN2_MODEL_KEY)
settings = context.scene.snapform_settings
settings = context.scene.anyimage_settings
return {
"input": str(background_input_path(self.input_path)),
"model": BEN2_MODEL_KEY,
@@ -446,7 +446,7 @@ class GenerateOriginalBackground(JobOperatorBase, bpy.types.Operator):
class ExtractOriginalFrames(JobOperatorBase, bpy.types.Operator):
bl_idname = "snapform.extract_original_frames"
bl_idname = "anyimage.extract_original_frames"
bl_label = "Extract Original Frames"
job_type = "extract-frames"
starting_message = "Extracting source frames"
@@ -459,7 +459,7 @@ class ExtractOriginalFrames(JobOperatorBase, bpy.types.Operator):
def request(self, context):
require_environment()
settings = context.scene.snapform_settings
settings = context.scene.anyimage_settings
return {
"input": str(input_path(self.input_path)),
"video_frames": settings.video_frames,

View File

@@ -205,7 +205,7 @@ def draw_process_resolution(layout, owner, image):
def save_packed_image(image, scene):
output_path = Path(tempfile.mkdtemp(prefix="snapform-input-")) / "input.png"
output_path = Path(tempfile.mkdtemp(prefix="anyimage-input-")) / "input.png"
image_settings = scene.render.image_settings
original_file_format = image_settings.file_format
try:
@@ -261,7 +261,7 @@ def prepare_image_input(image, scene):
return source_path, False
sequence_frames = collect_sequence_frames(image)
if sequence_frames:
temporary_directory = Path(tempfile.mkdtemp(prefix="snapform-input-"))
temporary_directory = Path(tempfile.mkdtemp(prefix="anyimage-input-"))
try:
for index, frame_path in enumerate(sequence_frames):
suffix = frame_path.suffix.lower() or ".jpg"

View File

@@ -10,7 +10,7 @@ ORIGINAL_DISPLACEMENT_MIDLEVEL = 0.0
BUMP_BASE_DISTANCE = 0.001
DEPTH_PLANE_NODE_GROUP_NAME = "O DA3 Depth Plane"
MOGE_DEPTH_PLANE_NODE_GROUP_NAME = "O MoGe2 Depth Plane"
NODE_ASSET_NAME = "O_SnapForm.blend"
NODE_ASSET_NAME = "O_AnyImage.blend"
MATERIAL_DISPLACEMENT_ATTRIBUTE = "o_material_displacement"
BACKGROUND_DEPTH_ATTRIBUTE = "o_background_depth"
DEPTH_SCALE_ATTRIBUTE = "o_depth_scale"

View File

@@ -6,7 +6,7 @@ from .common import HIDDEN, require_environment
class DownloadModel(JobOperatorBase, bpy.types.Operator):
bl_idname = "snapform.download_model"
bl_idname = "anyimage.download_model"
bl_label = "Download Model"
job_type = "download-model"
@@ -23,7 +23,7 @@ class DownloadModel(JobOperatorBase, bpy.types.Operator):
class DownloadRequiredModels(JobOperatorBase, bpy.types.Operator):
bl_idname = "snapform.download_required_models"
bl_idname = "anyimage.download_required_models"
bl_label = "Download Required Models"
job_type = "download-required-models"
starting_message = "Starting required model downloads"
@@ -36,7 +36,7 @@ class DownloadRequiredModels(JobOperatorBase, bpy.types.Operator):
class ClearModels(bpy.types.Operator):
bl_idname = "snapform.clear_models"
bl_idname = "anyimage.clear_models"
bl_label = "Clear Models"
def execute(self, _context):

View File

@@ -50,7 +50,7 @@ OPTIONAL_FACE_ATTRIBUTES = {
}
NODE_GROUP_NAME = "O DA3 Surface"
MOGE_NODE_GROUP_NAME = "O MoGe2 Surface"
NODE_ASSET_NAME = "O_SnapForm.blend"
NODE_ASSET_NAME = "O_AnyImage.blend"
def image_surface_model_items(owner, context):
@@ -212,7 +212,7 @@ def assign_mesh_attribute(mesh, name, data_type, domain, values):
attribute.data.foreach_set("value", array.reshape(-1))
def assign_snapform_attributes(mesh, attributes, moge2=False):
def assign_anyimage_attributes(mesh, attributes, moge2=False):
for name, (data_type, key) in POINT_ATTRIBUTES.items():
assign_mesh_attribute(
mesh,
@@ -446,7 +446,7 @@ def build_image_mesh(
mesh = bpy.data.meshes.new(source_name)
mesh.from_pydata(vertices.tolist(), [], faces.tolist())
assign_vertex_uv(mesh, uv)
assign_snapform_attributes(mesh, attributes, moge2=moge2)
assign_anyimage_attributes(mesh, attributes, moge2=moge2)
mesh.update()
for polygon in mesh.polygons:
polygon.use_smooth = True
@@ -476,8 +476,8 @@ def build_image_mesh(
scene=context.scene,
)
mesh.materials.append(material)
mesh_object["snapform_reference_depth"] = reference_depth
mesh_object["snapform_source_type"] = "IMAGE_MESH"
mesh_object["anyimage_reference_depth"] = reference_depth
mesh_object["anyimage_source_type"] = "IMAGE_MESH"
add_geometry_nodes_processing(
mesh_object,
vertices,
@@ -505,7 +505,7 @@ def build_image_mesh(
class ConvertToSurface(bpy.types.Operator):
bl_idname = "snapform.convert_to_surface"
bl_idname = "anyimage.convert_to_surface"
bl_label = "Convert to Surface"
bl_description = "Convert an Image Empty into a perspective textured surface"
bl_options = {"REGISTER"}
@@ -604,12 +604,12 @@ class ConvertToSurface(bpy.types.Operator):
"remove_background": self.remove_background,
}
if self.model.startswith("MOGE2_"):
result = bpy.ops.snapform.generate_moge2_surface(
result = bpy.ops.anyimage.generate_moge2_surface(
**common,
resolution_level=self.resolution_level,
)
else:
result = bpy.ops.snapform.generate_da3_surface(
result = bpy.ops.anyimage.generate_da3_surface(
**common,
process_res=process_res,
)
@@ -662,7 +662,7 @@ def build_surface_response(
class GenerateDa3Surface(JobOperatorBase, bpy.types.Operator):
bl_idname = "snapform.generate_da3_surface"
bl_idname = "anyimage.generate_da3_surface"
bl_label = "Generate DA3 Surface"
job_type = "generate-surface"
starting_message = "Starting perspective surface generation"
@@ -682,7 +682,7 @@ class GenerateDa3Surface(JobOperatorBase, bpy.types.Operator):
require_model(self.model)
if self.remove_background:
require_model(BEN2_MODEL_KEY)
settings = context.scene.snapform_settings
settings = context.scene.anyimage_settings
return {
**da3_parameters(
settings,
@@ -713,7 +713,7 @@ class GenerateDa3Surface(JobOperatorBase, bpy.types.Operator):
class GenerateMoge2Surface(JobOperatorBase, bpy.types.Operator):
bl_idname = "snapform.generate_moge2_surface"
bl_idname = "anyimage.generate_moge2_surface"
bl_label = "Generate MoGe-2 Surface"
job_type = "generate-surface"
starting_message = "Starting MoGe-2 inference"
@@ -733,7 +733,7 @@ class GenerateMoge2Surface(JobOperatorBase, bpy.types.Operator):
require_model(self.model)
if self.remove_background:
require_model(BEN2_MODEL_KEY)
settings = context.scene.snapform_settings
settings = context.scene.anyimage_settings
return {
**moge2_parameters(
settings,

View File

@@ -5,10 +5,10 @@ from .properties import BEN2_MODEL_KEY, model_catalog, model_ready
class ServerPanel(bpy.types.Panel):
bl_label = "Job Server"
bl_idname = "SNAPFORM_PT_server"
bl_idname = "ANYIMAGE_PT_server"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "SnapForm"
bl_category = "AnyImage"
bl_order = 0
def draw(self, _context):
@@ -22,14 +22,14 @@ class ServerPanel(bpy.types.Panel):
install_row = layout.row()
install_row.enabled = not running
install_row.operator(
"snapform.install_environment",
"anyimage.install_environment",
text="Install Environment",
icon="IMPORT",
)
mirror_row = layout.row()
mirror_row.enabled = not running
mirror_row.operator(
"snapform.install_environment_mirror",
"anyimage.install_environment_mirror",
text="Install Environment (Mirror)",
icon="IMPORT",
)
@@ -58,18 +58,18 @@ class ServerPanel(bpy.types.Panel):
if state == "READY":
controls = row.row(align=True)
controls.operator(
"snapform.restart_server",
"anyimage.restart_server",
text="",
icon="FILE_REFRESH",
)
controls.operator(
"snapform.stop_server",
"anyimage.stop_server",
text="",
icon="PAUSE",
)
elif state == "STOPPED":
row.operator(
"snapform.start_server",
"anyimage.start_server",
text="Start",
icon="PLAY",
)
@@ -80,7 +80,7 @@ class ServerPanel(bpy.types.Panel):
)
if state == "ERROR":
row.operator(
"snapform.start_server",
"anyimage.start_server",
text="Start",
icon="PLAY",
)
@@ -103,7 +103,7 @@ class ServerPanel(bpy.types.Panel):
clear = cached_row.row(align=True)
clear.enabled = state == "READY"
clear.operator(
"snapform.clear_models",
"anyimage.clear_models",
text="",
icon="TRASH",
)
@@ -111,10 +111,10 @@ class ServerPanel(bpy.types.Panel):
class ModelsPanel(bpy.types.Panel):
bl_label = "Models"
bl_idname = "SNAPFORM_PT_models"
bl_idname = "ANYIMAGE_PT_models"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "SnapForm"
bl_category = "AnyImage"
bl_options = {"DEFAULT_CLOSED"}
bl_order = 1
@@ -150,7 +150,7 @@ class ModelsPanel(bpy.types.Panel):
download_row = row.row(align=True)
download_row.enabled = runtime.environment_ready() and not running
operator = download_row.operator(
"snapform.download_model",
"anyimage.download_model",
text="Download",
icon="IMPORT",
)
@@ -159,16 +159,16 @@ class ModelsPanel(bpy.types.Panel):
class DebugPanel(bpy.types.Panel):
bl_label = "Debug"
bl_idname = "SNAPFORM_PT_debug"
bl_idname = "ANYIMAGE_PT_debug"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "SnapForm"
bl_category = "AnyImage"
bl_options = {"DEFAULT_CLOSED"}
bl_order = 2
def draw(self, context):
layout = self.layout
settings = context.scene.snapform_settings
settings = context.scene.anyimage_settings
layout.prop(settings, "device")
@@ -198,17 +198,17 @@ def draw_da3_input_settings(layout, settings, model_property):
class Da3OutputDebugPanel(bpy.types.Panel):
bl_label = "DA3"
bl_idname = "SNAPFORM_PT_debug_da3_output"
bl_idname = "ANYIMAGE_PT_debug_da3_output"
bl_parent_id = DebugPanel.bl_idname
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "SnapForm"
bl_category = "AnyImage"
bl_options = {"DEFAULT_CLOSED"}
bl_order = 1
def draw(self, context):
layout = self.layout
settings = context.scene.snapform_settings
settings = context.scene.anyimage_settings
draw_da3_input_settings(layout, settings, "model")
export_row = layout.row()
@@ -217,7 +217,7 @@ class Da3OutputDebugPanel(bpy.types.Panel):
and model_ready(settings.model)
)
export_row.operator(
"snapform.debug_da3",
"anyimage.debug_da3",
text="Run DA3 API",
icon="EXPORT",
)
@@ -225,17 +225,17 @@ class Da3OutputDebugPanel(bpy.types.Panel):
class Moge2ApiDebugPanel(bpy.types.Panel):
bl_label = "MoGe-2"
bl_idname = "SNAPFORM_PT_debug_moge2_api"
bl_idname = "ANYIMAGE_PT_debug_moge2_api"
bl_parent_id = DebugPanel.bl_idname
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "SnapForm"
bl_category = "AnyImage"
bl_options = {"DEFAULT_CLOSED"}
bl_order = 0
def draw(self, context):
layout = self.layout
settings = context.scene.snapform_settings
settings = context.scene.anyimage_settings
layout.prop(settings, "input_path")
layout.prop(settings, "moge_model")
layout.prop(settings, "moge_resolution_level")
@@ -245,7 +245,7 @@ class Moge2ApiDebugPanel(bpy.types.Panel):
and model_ready(settings.moge_model)
)
run_row.operator(
"snapform.debug_moge2",
"anyimage.debug_moge2",
text="Run MoGe-2 API",
icon="EXPORT",
)
@@ -253,17 +253,17 @@ class Moge2ApiDebugPanel(bpy.types.Panel):
class Ben2RemovalDebugPanel(bpy.types.Panel):
bl_label = "BEN2"
bl_idname = "SNAPFORM_PT_debug_ben2_removal"
bl_idname = "ANYIMAGE_PT_debug_ben2_removal"
bl_parent_id = DebugPanel.bl_idname
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "SnapForm"
bl_category = "AnyImage"
bl_options = {"DEFAULT_CLOSED"}
bl_order = 2
def draw(self, context):
layout = self.layout
settings = context.scene.snapform_settings
settings = context.scene.anyimage_settings
layout.prop(settings, "background_input_path")
background_row = layout.row()
@@ -272,7 +272,7 @@ class Ben2RemovalDebugPanel(bpy.types.Panel):
and model_ready(BEN2_MODEL_KEY)
)
background_row.operator(
"snapform.debug_ben2",
"anyimage.debug_ben2",
text="Remove Background",
icon="IMAGE_ALPHA",
)

View File

@@ -4,7 +4,7 @@ from .runtime import DEFAULT_STORAGE_ROOT, runtime
from .properties import device_enum_items
class SnapFormPreferences(bpy.types.AddonPreferences):
class AnyImagePreferences(bpy.types.AddonPreferences):
bl_idname = __package__
storage_root: bpy.props.StringProperty(
@@ -38,20 +38,20 @@ class SnapFormPreferences(bpy.types.AddonPreferences):
install_row = layout.row()
install_row.enabled = runtime.active_job is None
install_row.operator(
"snapform.install_environment",
"anyimage.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",
"anyimage.install_environment_mirror",
text="Install Environment (Mirror)",
icon="IMPORT",
)
layout.separator()
layout.operator(
"snapform.open_server_log",
"anyimage.open_server_log",
text="Open Server Log",
icon="TEXT",
)

View File

@@ -269,7 +269,7 @@ def balloon_radial_zoom_property(scale):
)
class SnapFormSettings(bpy.types.PropertyGroup):
class AnyImageSettings(bpy.types.PropertyGroup):
balloon_mode: balloon_mode_property()
balloon_thickness: balloon_thickness_property()
balloon_resolution: balloon_resolution_property()

View File

@@ -5,7 +5,7 @@ import bpy
from blendjob import JobRuntime
DEFAULT_STORAGE_ROOT = Path.home() / ".snapform"
DEFAULT_STORAGE_ROOT = Path.home() / ".anyimage"
def configured_storage_root():
@@ -53,7 +53,7 @@ runtime = JobRuntime(
storage_root=configured_storage_root,
environment=ENVIRONMENT,
post_install=post_install,
namespace="snapform",
namespace="anyimage",
)
JobOperatorBase = runtime.JobOperatorBase

View File

@@ -1,4 +1,4 @@
"""SnapForm Job Server without Blender dependencies."""
"""AnyImage Job Server without Blender dependencies."""
from blendjob import JobServer
@@ -13,7 +13,7 @@ from .jobs.frames import run as _extract_frames
from .model_manager import ModelManager, ModelSessionCache
server = JobServer("SnapForm Job Server")
server = JobServer("AnyImage Job Server")
@server.resource("model_manager")

View File

@@ -101,7 +101,7 @@ def prepare_input(
import av
temporary_directory = Path(
tempfile.mkdtemp(prefix="snapform-video-", dir=temporary_root)
tempfile.mkdtemp(prefix="anyimage-video-", dir=temporary_root)
)
try:
images = extract_video_frames(

View File

@@ -116,7 +116,7 @@ def create_download_progress_class(
description = str(kwargs.get("desc", ""))
# huggingface_hub 1.x 的字节进度条描述是 "Downloading (incomplete total...)",
# 用前缀匹配而非精确匹配,否则真实下载进度会被忽略。
self.snapform_reports_progress = (
self.anyimage_reports_progress = (
description.startswith("Downloading")
or description.startswith("Fetching ")
)
@@ -124,13 +124,13 @@ def create_download_progress_class(
def update(self, amount=1):
result = super().update(amount)
if self.snapform_reports_progress:
if self.anyimage_reports_progress:
reporter.report(self.n, self.total, self._download_rate())
return result
def refresh(self, *args, **kwargs):
result = super().refresh(*args, **kwargs)
if self.snapform_reports_progress:
if self.anyimage_reports_progress:
reporter.report(self.n, self.total, self._download_rate())
return result
@@ -295,7 +295,7 @@ def _download_file_from_url(
cancel_check=None,
):
"""Download and verify one model file atomically from a direct URL."""
request = Request(url, headers={"User-Agent": "SnapForm"})
request = Request(url, headers={"User-Agent": "AnyImage"})
opener = _download_opener.open if request.type == "https" else urlopen
last_error = None
for _attempt in range(retries):

View File

@@ -53,7 +53,7 @@ def infer(
if provider_label(model) == "DirectML":
raise RuntimeError(
"DA3 inference failed on DirectML. Switch the device to "
"CPU in SnapForm Preferences and retry. "
"CPU in AnyImage Preferences and retry. "
f"Original error: {error}"
) from error
raise