Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#python
import k3d
import testing
doc = k3d.new_document()
axes = k3d.plugin.create("Axes", doc)
axes.xyplane = False
material = k3d.plugin.create("RenderManMaterial", doc)
torus = k3d.plugin.create("Torus", doc)
torus.material = material
mesh_instance = k3d.plugin.create("MeshInstance", doc)
mesh_instance.gl_painter = k3d.plugin.create("OpenGLTorusPainter", doc)
k3d.property.connect(doc, torus.get_property("output_mesh"), mesh_instance.get_property("input_mesh"))
camera = testing.create_camera(doc)
render_engine = testing.create_opengl_engine(doc)
camera_to_bitmap = k3d.plugin.create("GLXCameraToBitmap", doc)
camera_to_bitmap.camera = camera
#python
import k3d
import testing
document = k3d.new_document()
source = k3d.plugin.create("PolyTorus", document)
triangles = k3d.plugin.create("TriangulateFaces", document)
triangles.mesh_selection = k3d.select_all()
k3d.property.connect(document, source.get_property("output_mesh"), triangles.get_property("input_mesh"))
modifier = k3d.plugin.create("PGPRemesh", document)
modifier.use_smooth = False
modifier.steps = 0
modifier.omega = 6
modifier.div = 6
modifier.triangulate = False
k3d.property.connect(document, triangles.get_property("output_mesh"), modifier.get_property("input_mesh"))
#print "source output: " + repr(source.output_mesh)
#print "triangles output: " + repr(triangles.output_mesh)
#print "modifier output: " + repr(modifier.output_mesh)
#python
import testing
import k3d
document = k3d.new_document()
curve1 = k3d.plugin.create("NurbsCurve", document)
curve2 = k3d.plugin.create("NurbsCurve", document)
transform = k3d.plugin.create("TranslatePoints", document)
merge_mesh = k3d.plugin.create("MergeMesh", document)
modifier = k3d.plugin.create("NurbsConnectCurves", document)
merge_mesh.create_property("k3d::mesh*", "input_mesh1", "Input Mesh 1", "")
merge_mesh.create_property("k3d::mesh*", "input_mesh2", "Input Mesh 2", "")
transform_selection = k3d.geometry.selection.create(0)
k3d.geometry.point_selection.create(transform_selection, 1)
transform.mesh_selection = transform_selection
transform.y = 3
selection = k3d.geometry.selection.create(0)
point_selection = k3d.geometry.point_selection.create(selection)
k3d.geometry.point_selection.append(point_selection, 0, 8, 0)
k3d.geometry.point_selection.append(point_selection, 0, 1, 1)
k3d.geometry.point_selection.append(point_selection, 4, 5, 1)
#python
import k3d
import testing
document = k3d.new_document()
instance = k3d.plugin.create("MeshInstance", document)
transform = k3d.plugin.create("FrozenMatrix", document)
transform.matrix = k3d.translate3(1, 0, 0)
document.set_dependency(instance.get_property("input_matrix"), transform.get_property("output_matrix"))
position = k3d.world_position(instance)
reference = k3d.point3(1, 0, 0)
if position != reference:
raise Exception("Position differs from expected value, expected: " + str(reference) + ", result: " + str(position))
#python
import k3d
import testing
document = k3d.new_document()
selection = k3d.geometry.selection.create(1)
circle = k3d.plugin.create("NurbsCircle", document)
split1 = k3d.plugin.create("NurbsSplitCurve", document)
split2 = k3d.plugin.create("NurbsSplitCurve", document)
merge = k3d.plugin.create("NurbsMergeConnectedCurves", document)
split1.mesh_selection = selection
split2.mesh_selection = selection
merge.mesh_selection = selection
k3d.property.connect(document, circle.get_property("output_mesh"), split1.get_property("input_mesh"))
k3d.property.connect(document, split1.get_property("output_mesh"), split2.get_property("input_mesh"))
k3d.property.connect(document, split2.get_property("output_mesh"), merge.get_property("input_mesh"))
testing.require_valid_mesh(document, merge.get_property("output_mesh"))
testing.require_similar_mesh(document, merge.get_property("output_mesh"), "mesh.modifier.NurbsMergeConnectedCurves", 1, ["Darwin-i386"])
axes = k3d.plugin.create("Axes", doc)
axes.xyplane = False
material = k3d.plugin.create("RenderManMaterial", doc)
torus = k3d.plugin.create("Torus", doc)
torus.material = material
mesh_instance = k3d.plugin.create("MeshInstance", doc)
mesh_instance.gl_painter = k3d.plugin.create("OpenGLTorusPainter", doc)
k3d.property.connect(doc, torus.get_property("output_mesh"), mesh_instance.get_property("input_mesh"))
camera = testing.create_camera(doc)
render_engine = testing.create_opengl_engine(doc)
camera_to_bitmap = k3d.plugin.create("VirtualCameraToBitmap", doc)
camera_to_bitmap.camera = camera
camera_to_bitmap.render_engine = render_engine
testing.require_similar_bitmap(doc, camera_to_bitmap.get_property("output_bitmap"), "offscreen.VirtualCameraToBitmap", 0.009)
#python
import testing
import k3d
document = k3d.new_document()
curve1 = k3d.plugin.create("NurbsCurve", document)
curve2 = k3d.plugin.create("NurbsCurve", document)
curve3 = k3d.plugin.create("NurbsCurve", document)
transform1 = k3d.plugin.create("TranslatePoints", document)
transform2 = k3d.plugin.create("TranslatePoints", document)
merge_mesh = k3d.plugin.create("MergeMesh", document)
modifier = k3d.plugin.create("NurbsSkinnedSurface", document)
merge_mesh.create_property("k3d::mesh*", "input_mesh1", "Input Mesh 1", "")
merge_mesh.create_property("k3d::mesh*", "input_mesh2", "Input Mesh 2", "")
merge_mesh.create_property("k3d::mesh*", "input_mesh3", "Input Mesh 3", "")
transform1.mesh_selection = k3d.geometry.selection.create(1)
transform1.y = 3
transform2.mesh_selection = k3d.geometry.selection.create(1)
transform2.z = 3
modifier.mesh_selection = k3d.geometry.selection.create(1)
#python
import k3d
import testing
document = k3d.new_document()
source1 = k3d.plugin.create("BlobbyEllipsoid", document)
source1.color = k3d.color(1, 0, 0)
source2 = k3d.plugin.create("BlobbySegment", document)
source2.color = k3d.color(1, 1, 0)
modifier = k3d.plugin.create("BlobbyAdd", document)
modifier.create_property("k3d::mesh*", "input_mesh1", "Input Mesh 1", "")
modifier.create_property("k3d::mesh*", "input_mesh2", "Input Mesh 2", "")
k3d.property.connect(document, source1.get_property("output_mesh"), modifier.get_property("input_mesh1"))
k3d.property.connect(document, source2.get_property("output_mesh"), modifier.get_property("input_mesh2"))
testing.require_valid_mesh(document, modifier.get_property("output_mesh"))
testing.require_similar_mesh(document, modifier.get_property("output_mesh"), "mesh.modifier.BlobbyAdd", 5)
#python
import k3d
import testing
document = k3d.new_document()
small_cylinder = k3d.plugin.create("PolyCylinder", document)
small_cylinder.radius = 2.0
small_cylinder.zmax = 7.5
small_cylinder.zmin = -7.5
small_cylinder.u_segments = 8
big_cylinder = k3d.plugin.create("PolyCylinder", document)
big_cylinder.u_segments = 8
torus = k3d.plugin.create("PolyTorus", document)
torus.u_segments = 8
torus.v_segments = 4
first_boolean = k3d.plugin.create("CGALBoolean", document)
first_boolean.type = "difference"
first_boolean.create_property("k3d::mesh*", "input_1", "Input 1", "")
first_boolean.create_property("k3d::mesh*", "input_2", "Input 2", "")
second_boolean = k3d.plugin.create("CGALBoolean", document)
second_boolean.type = "reverse_difference"
second_boolean.create_property("k3d::mesh*", "input_1", "Input 1", "")
second_boolean.create_property("k3d::mesh*", "input_2", "Input 2", "")
k3d.property.connect(document, big_cylinder.get_property("output_mesh"), first_boolean.get_property("input_1"))
k3d.property.connect(document, small_cylinder.get_property("output_mesh"), first_boolean.get_property("input_2"))
k3d.property.connect(document, torus.get_property("output_mesh"), second_boolean.get_property("input_1"))
k3d.property.connect(document, first_boolean.get_property("output_mesh"), second_boolean.get_property("input_2"))
categories["All"].append(plugin)
if plugin.quality() == "stable":
categories["Stable"].append(plugin)
elif plugin.quality() == "experimental":
categories["Experimental"].append(plugin)
elif plugin.quality() == "deprecated":
categories["Deprecated"].append(plugin)
for category in plugin.categories():
if category not in categories:
categories[category] = []
categories[category].append(plugin)
# Create the main article for each plugin ...
for plugin in sorted(k3d.plugin.factory.lookup(), plugin_sort):
if plugin.metadata().has_key("k3d:disable-documentation"):
continue
print """Creating main article for """ + plugin.name() + """ ..."""
article = file("@CMAKE_CURRENT_BINARY_DIR@/wikitext/articles/" + plugin.name(), "w")
article.write("{{" + plugin.name() + "}}\n")
# Create an article listing every plugin category ...
print """Creating plugin categories article ..."""
article = file("@CMAKE_CURRENT_BINARY_DIR@/wikitext/categories/Plugin Categories", "w")
article.write("""\n""")
article.write("""\n""")
article.write("""\n""")
for category in sorted(categories.keys()):<table cellspacing="0" cellpadding="5" border="1"><tbody><tr><th>Plugin Categories</th></tr></tbody></table>