@deepblend/dsh-blender-provider-local 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1397,6 +1397,7 @@ export default class LocalBlenderRuntime extends Service {
1397
1397
  cyclesSmokeTest: raw.cyclesSmokeTest ?? null,
1398
1398
  textBlockApi: raw.textBlockApi === true,
1399
1399
  frameApi: raw.frameApi === true,
1400
+ sceneFeatures: Array.isArray(raw.sceneFeatures) ? raw.sceneFeatures.filter(feature => typeof feature === 'string') : [],
1400
1401
  hostPlatform: typeof raw.hostPlatform === 'string' ? raw.hostPlatform : null,
1401
1402
  warnings: collectWarnings(raw),
1402
1403
  probedAt: now,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepblend/dsh-blender-provider-local",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "description": "Local Blender Provider: the BlenderRuntime Service over ctx.subprocess (batch execution).",
6
6
  "main": "lib/index.js",
@@ -11,7 +11,7 @@
11
11
  "./package.json": "./package.json"
12
12
  },
13
13
  "dependencies": {
14
- "@deepblend/dsh-blender-contracts": "0.4.0"
14
+ "@deepblend/dsh-blender-contracts": "0.5.0"
15
15
  },
16
16
  "license": "MIT",
17
17
  "repository": {
@@ -35,6 +35,7 @@ import addon_utils
35
35
  from deepblend_util import error_text as _error_text
36
36
  from deepblend_util import eprint as _eprint
37
37
  from deepblend_util import as_text as _as_text
38
+ from deepblend_features import SCENE_FEATURES
38
39
 
39
40
  # --------------------------------------------------------------------------------------
40
41
  # Constants
@@ -630,6 +631,7 @@ def collect_capabilities():
630
631
  # --- lightweight APIs -----------------------------------------------------------
631
632
  "textBlockApi": text_block_api,
632
633
  "frameApi": frame_api,
634
+ "sceneFeatures": list(SCENE_FEATURES),
633
635
  }
634
636
 
635
637
  return capabilities, warnings
@@ -0,0 +1,2 @@
1
+ """Scene vocabulary implemented by this runtime's compiler, not a Blender hardware claim."""
2
+ SCENE_FEATURES = ("geometry.primitive.dimensions",)
@@ -346,6 +346,13 @@ def create_generator(name, spec):
346
346
  produce the same topology from the same specification.
347
347
  """
348
348
  shape = spec.get("shape")
349
+ dimensions = spec.get("dimensions")
350
+ if "dimensions" in spec and (
351
+ shape not in ("cube", "rounded_box") or "size" in spec or
352
+ not isinstance(dimensions, list) or len(dimensions) != 3 or
353
+ any(isinstance(value, bool) or not isinstance(value, (int, float)) or
354
+ not math.isfinite(value) or value <= 0 for value in dimensions)):
355
+ raise ActionError("BLENDER_SCRIPT_ERROR", "box dimensions require three finite positive lengths and no scalar size")
349
356
  size = float(spec.get("size", 2.0))
350
357
  radius = float(spec.get("radius", 1.0))
351
358
  depth = float(spec.get("depth", 2.0))
@@ -388,6 +395,13 @@ def create_generator(name, spec):
388
395
  obj = bpy.context.active_object
389
396
  if obj is None:
390
397
  raise ActionError("BLENDER_SCRIPT_ERROR", 'primitive for shape "%s" produced no object' % (shape,))
398
+ if "dimensions" in spec:
399
+ # Bake each local axis into vertices before beveling. Object scale stays
400
+ # the author's transform rather than carrying the shape's dimensions.
401
+ for vertex in obj.data.vertices:
402
+ for axis, length in enumerate(dimensions):
403
+ vertex.co[axis] *= float(length) / size
404
+ obj.data.update()
391
405
  # Bevel is a generator property, not a rounded_box-only option. Silently
392
406
  # ignoring it on cylinders removes the edge highlights product shots need.
393
407
  if spec.get("bevel"):