Example #1
0
def run_mesh_modifier_benchmark(meshModifierNodeName,
                                benchmarkMesh,
                                numberOfRuns=1,
                                properties={},
                                appendToFile=False,
                                firstInFile=False):
    document = k3d.new_document()

    profiler = k3d.plugin.create("PipelineProfiler", document)

    benchmarkMesh.set_document(document)

    inputNode = benchmarkMesh.get_mesh()

    selection = k3d.select_all()

    benchmarkNode = k3d.plugin.create(meshModifierNodeName, document)
    for (p, val) in properties.items():
        benchmarkNode.get_property(p).set_value(val)
    benchmarkNode.mesh_selection = selection

    profilingResults = k3dProfilingProcessor()
    for n in range(numberOfRuns):
        k3d.property.connect(document, inputNode.get_property("output_mesh"),
                             benchmarkNode.get_property("input_mesh"))
        benchmarkNode.output_mesh
        profilingResults.add_profiler_results_for_node(meshModifierNodeName,
                                                       profiler.records)

    description = '%d' % (benchmarkMesh.get_size_metric())
    profilingResults.output_and_save(meshModifierNodeName, description,
                                     appendToFile, firstInFile)
Example #2
0
def run_mesh_modifier_benchmark(meshModifierNodeName, benchmarkMesh, numberOfRuns = 1, properties = {}, appendToFile = False, firstInFile=False):
    document = k3d.new_document()
        
    profiler = k3d.plugin.create("PipelineProfiler", document)
    
    benchmarkMesh.set_document(document)
    
    inputNode = benchmarkMesh.get_mesh()
    
    selection = k3d.select_all()
    

    benchmarkNode = k3d.plugin.create(meshModifierNodeName, document)
    for (p, val) in properties.items():
        benchmarkNode.get_property(p).set_value(val)
    benchmarkNode.mesh_selection = selection
        
    profilingResults = k3dProfilingProcessor()
    for n in range(numberOfRuns):
        k3d.property.connect(document, inputNode.get_property("output_mesh"), benchmarkNode.get_property("input_mesh"))
        benchmarkNode.output_mesh
        profilingResults.add_profiler_results_for_node(meshModifierNodeName, profiler.records)
    
    description = '%d' % (benchmarkMesh.get_size_metric())
    profilingResults.output_and_save(meshModifierNodeName, description, appendToFile, firstInFile)
#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 = 1
modifier.div = 2
modifier.triangulate = True
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)

testing.require_valid_mesh(document, modifier.get_property("output_mesh"))
testing.require_similar_mesh(document, modifier.get_property("output_mesh"), "mesh.modifier.PGPRemesh", 1)

#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test2("PolyTorus", "TriangulateFaces", "PGPRemesh")
setup.modifier1.mesh_selection = k3d.select_all()
setup.modifier2.use_smooth = False
setup.modifier2.steps = 0
setup.modifier2.omega = 5
setup.modifier2.div = 17
setup.modifier2.triangulate = True

testing.require_valid_mesh(setup.document, setup.modifier2.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier2.get_property("output_mesh"), "mesh.modifier.PGPRemesh.high", 1)

Example #5
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test2("PolyTorus", "TriangulateFaces",
                                          "PGPRemesh")
setup.modifier1.mesh_selection = k3d.select_all()
setup.modifier2.use_smooth = False
setup.modifier2.steps = 0
setup.modifier2.omega = 5
setup.modifier2.div = 17
setup.modifier2.triangulate = True

testing.require_valid_mesh(setup.document,
                           setup.modifier2.get_property("output_mesh"))
testing.require_similar_mesh(setup.document,
                             setup.modifier2.get_property("output_mesh"),
                             "mesh.modifier.PGPRemesh.high", 1)
Example #6
0
#python

import k3d
import testing

document = k3d.new_document()

source = document.new_node("PolyTorus")

triangles = document.new_node("TriangulateFaces")
triangles.mesh_selection = k3d.select_all()
document.set_dependency(triangles.get_property("input_mesh"), source.get_property("output_mesh"))

modifier = document.new_node("PGPRemesh")
modifier.use_smooth = False
modifier.steps = 0
modifier.omega = 1
modifier.div = 2
modifier.triangulate = True
document.set_dependency(modifier.get_property("input_mesh"), triangles.get_property("output_mesh"))

#print "source output: " + repr(source.output_mesh)
#print "triangles output: " + repr(triangles.output_mesh)
#print "modifier output: " + repr(modifier.output_mesh)

testing.mesh_comparison_to_reference(document, modifier.get_property("output_mesh"), "mesh.modifier.PGPRemesh", 1)