/usr/share/k3d/scripts/MeshSourceScript/blobby.py is in k3d-data 0.8.0.3-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #python
import k3d
k3d.check_node_environment(context, "MeshSourceScript")
blobby = k3d.blobby.create(context.output)
Cs = blobby.parameter_attributes().create("Cs", "k3d::color")
# Add four ellipsoids to the blobby ...
ellipsoids = [k3d.point3(-1, 0, 1), k3d.point3(1, 0, 1), k3d.point3(1, 0, -1), k3d.point3(-1, 0, -1)]
blobby.first_primitives().append(len(blobby.primitives()))
blobby.primitive_counts().append(len(ellipsoids) + 1)
blobby.first_operators().append(len(blobby.operators()))
blobby.operator_counts().append(1)
blobby.materials().append(k3d.node.lookup_one(context.document, "Material"))
for center in ellipsoids:
blobby.primitives().append(k3d.blobby.primitive_type.ELLIPSOID)
blobby.primitive_first_floats().append(len(blobby.floats()))
blobby.primitive_float_counts().append(16)
for i in (k3d.translate3(center[0], center[1], center[2]) * k3d.scale3(1)).column_major_values():
blobby.floats().append(i)
# Add a segment to the blobby ...
blobby.primitives().append(k3d.blobby.primitive_type.SEGMENT)
blobby.primitive_first_floats().append(len(blobby.floats()))
blobby.primitive_float_counts().append(23)
blobby.floats().append(-1)
blobby.floats().append(0)
blobby.floats().append(0)
blobby.floats().append(1)
blobby.floats().append(0)
blobby.floats().append(0)
blobby.floats().append(1)
for i in k3d.identity3().column_major_values():
blobby.floats().append(i)
# Assign colors to each ellipsoid and segment ...
Cs.assign([k3d.color(1, 0, 0), k3d.color(0, 1, 0), k3d.color(0, 0, 1), k3d.color(1, 1, 0), k3d.color(1, 1, 1)])
# Add the ellipsoids and segment together to produce a surface ...
blobby.operators().append(k3d.blobby.operator_type.ADD)
blobby.operator_first_operands().append(len(blobby.operands()))
blobby.operator_operand_counts().append(6)
blobby.operands().assign([5, 0, 1, 2, 3, 4])
|