Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer, web workflow engine and protocol, tooling, docs and task records. Large generated evidence, user-testing archives, build snapshots and imported test assets remain untracked. Co-Authored-By: Claude Code <noreply@anthropic.com>
36 lines
1.4 KiB
Python
36 lines
1.4 KiB
Python
"""Bounded Mesh RNA settings for the original Blender voxel remesh operator."""
|
|
|
|
import math
|
|
|
|
|
|
def remesh_property_specs(bpy):
|
|
prop = bpy.types.Mesh.bl_rna.properties["remesh_voxel_size"]
|
|
return [{
|
|
"id": "voxel_size",
|
|
"name": "voxel_size",
|
|
"type": "number",
|
|
"label": prop.name,
|
|
"description": prop.description,
|
|
"defaultValue": prop.default,
|
|
"min": max(float(prop.hard_min), 0.0001),
|
|
"max": min(float(prop.hard_max), 10.0),
|
|
"required": False,
|
|
}]
|
|
|
|
|
|
def prepare_voxel_remesh(bpy, properties):
|
|
properties = dict(properties)
|
|
owner = bpy.context.active_object
|
|
if owner is None or owner.type != "MESH" or owner.library or owner.data.library:
|
|
raise RuntimeError("SERVER_OPERATOR_CONTEXT_BLOCKED: remesh requires an editable active mesh")
|
|
if owner.data.shape_keys is not None:
|
|
raise RuntimeError("SERVER_OPERATOR_CONTEXT_BLOCKED: remesh does not support shape keys")
|
|
voxel_size = properties.pop("voxel_size", owner.data.remesh_voxel_size)
|
|
bounds = remesh_property_specs(bpy)[0]
|
|
if (isinstance(voxel_size, bool) or not isinstance(voxel_size, (int, float))
|
|
or not math.isfinite(voxel_size)
|
|
or not bounds["min"] <= voxel_size <= bounds["max"]):
|
|
raise ValueError("SERVER_OPERATOR_PROPERTY_TYPE: voxel_size is outside the supported range")
|
|
owner.data.remesh_voxel_size = voxel_size
|
|
return properties
|