Skip to content
Snippets Groups Projects
Select Git revision
  • 57-sphinx-documentation
  • devel default
  • 107-compilation-error-when-building-maestro-core-on-m1-apple-processors
  • 108-implement-cpu-id-query-for-apple-m1-hardware
  • 58-scripting-interface-to-maestro-core
  • 101-need-ci-test-using-installed-maestro
  • 105-memory-leak-in-pm-message-envelope-handling
  • 104-permit-disabling-memory-pool
  • 103-liberl-installation-issue-on-devel
  • 94-maestro-rdma-transport-ignores-max_msg_size-2
  • main protected
  • 102-possible-race-in-check_pm_redundant_interlock-test
  • 97-check-if-shm-provider-can-be-enabled-after-libfabric-1-14-is-in-our-tree-2
  • 100-include-maestro-attributes-h-cannot-include-mamba-header-from-deps-path
  • 97-check-if-shm-provider-can-be-enabled-after-libfabric-1-14-is-in-our-tree
  • 17-job-failed-282354-needs-update-of-mio-interface-and-build-rules
  • 96-test-libfabric-update-to-1-13-or-1-14
  • feature/stop-telemetry-after-all-left
  • 94-maestro-rdma-transport-ignores-max_msg_size
  • 93-improve-performance-of-mstro_attribute_val_cmp_str
  • v0.3_rc1
  • maestro_d65
  • d65_experiments_20211113
  • v0.2
  • v0.2_rc1
  • d3.3
  • d3.3-review
  • d5.5
  • d5.5-review
  • v0.1
  • d3.2
  • d3.2-draft
  • v0.0
33 results

ecmwf.yaml

Blame
  • spray_movie_temporal_camera_1.py 6.41 KiB
    import bpy
    
    from mathutils import Vector
    
    bpy.ops.object.delete(use_global=False)
    
    bpy.data.objects['Lamp'].select = True
    bpy.ops.object.delete(use_global=False)
    bpy.context.scene.render.engine = 'CYCLES'
    
    mat = bpy.data.materials.new('BWG')
    mat.use_nodes = True
    
    nodes = {
    'Texture Coordinate': ['ShaderNodeTexCoord', (-220.0, 510.0)],
    'Image Texture': ['ShaderNodeTexImage', (-20.0, 510.0)],
    'Emission': ['ShaderNodeEmission', (190.0, 450.0)],
    'Material Output': ['ShaderNodeOutputMaterial', (400.0, 450.0)]
    }
    
    for k, v in nodes.items():
        location = Vector(v[1])
        if not k in mat.node_tree.nodes:
            cur_node = mat.node_tree.nodes.new(v[0])
            cur_node.location = location
        else:
            mat.node_tree.nodes[k].location = location
    
    link00 = ['Texture Coordinate','Generated','Image Texture','Vector']
    link01 = ['Image Texture','Color','Emission','Color']
    link02 = ['Emission','Emission','Material Output','Surface']
    
    links = [link00, link01, link02]
    for link in links:
        from_node = mat.node_tree.nodes[link[0]]
        output_socket = from_node.outputs[link[1]]
        to_node = mat.node_tree.nodes[link[2]]
        input_socket = to_node.inputs[link[3]]
        mat.node_tree.links.new(output_socket, input_socket)
    
    mat.node_tree.nodes["Emission"].inputs['Strength'].default_value = 3.0
    
    img = bpy.data.images.load('back.png')
    mat.node_tree.nodes['Image Texture'].image = img
    
    bpy.ops.mesh.primitive_plane_add(radius=1, view_align=False, enter_editmode=False, location=(0, 0, 0), rotation=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
    plane = bpy.data.objects['Plane']
    bpy.ops.object.shade_smooth()
    plane.location[0] = 1
    plane.location[1] = 4
    plane.location[2] = 0
    plane.rotation_euler[0] = 1.5708
    plane.rotation_euler[1] = 0
    plane.rotation_euler[2] = 0
    
    plane.scale[0] = 7
    plane.scale[1] = 5
    plane.scale[2] = 1
    
    plane.data.materials.append(mat)
    plane.select = False
    
    camera = bpy.data.objects['Camera']
    camera.select = True
    camera.location[0] = 4.0
    camera.location[1] = -5.4
    camera.location[2] = 1.0
    camera.rotation_euler[0] = 1.39626
    camera.rotation_euler[1] = 0.0
    camera.rotation_euler[2] = 0.258553
    camera.select = False
    
    bpy.ops.object.lamp_add(type='SUN', view_align=False, location=(0, 0, 0), rotation=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
    sun = bpy.data.objects['Sun']
    sun.location[0] = 0
    sun.location[1] = -5
    sun.location[2] = 4
    sun.rotation_euler[0] = 0.911987
    sun.rotation_euler[1] = -0.259932
    sun.rotation_euler[2] = 0
    sun.select = False
    
    mat = bpy.data.materials.new('Injector')
    mat.use_nodes = True
    
    nodes = {
    'Diffuse BSDF': ['ShaderNodeBsdfDiffuse', (-220.0, 510.0)],
    'Material Output': ['ShaderNodeOutputMaterial', (-20.0, 510.0)],
    }
    
    for k, v in nodes.items():
        location = Vector(v[1])
        if not k in mat.node_tree.nodes:
            cur_node = mat.node_tree.nodes.new(v[0])
            cur_node.location = location
        else:
            mat.node_tree.nodes[k].location = location
    
    from_node = mat.node_tree.nodes['Diffuse BSDF']
    output_socket = from_node.outputs['BSDF']
    to_node = mat.node_tree.nodes['Material Output']
    input_socket = to_node.inputs['Surface']
    mat.node_tree.links.new(output_socket, input_socket)
    
    mat.node_tree.nodes["Diffuse BSDF"].inputs['Color'].default_value = (0.024,0,0.8,1)
    
    mat = bpy.data.materials.new('Fluid')
    mat.use_nodes = True
    
    nodes = {
    'Glass BSDF': ['ShaderNodeBsdfGlass', (-220.0, 510.0)],
    'Material Output': ['ShaderNodeOutputMaterial', (-20.0, 510.0)],
    }
    
    for k, v in nodes.items():
        location = Vector(v[1])
        if not k in mat.node_tree.nodes:
            cur_node = mat.node_tree.nodes.new(v[0])
            cur_node.location = location
        else:
            mat.node_tree.nodes[k].location = location
    
    from_node = mat.node_tree.nodes['Glass BSDF']
    output_socket = from_node.outputs['BSDF']
    to_node = mat.node_tree.nodes['Material Output']
    input_socket = to_node.inputs['Surface']
    mat.node_tree.links.new(output_socket, input_socket)
    
    mat.node_tree.nodes["Glass BSDF"].inputs['Color'].default_value = (1,1,1,1)
    mat.node_tree.nodes["Glass BSDF"].inputs['IOR'].default_value = 1.333
    
    bpy.context.scene.render.resolution_percentage = 100
    
    path = bpy.data.curves.new('NurbsPath', 'CURVE')
    pathOb = bpy.data.objects.new('NurbsPath', path)
    pathOb.location = (0,0,0)
    bpy.context.scene.objects.link(pathOb)
    
    # Set path data
    path.dimensions = '3D'
    path.use_path = True
    path.use_path_follow = True
    path.path_duration = 100
    
    # Animate path
    path.eval_time = 0
    path.keyframe_insert(data_path="eval_time", frame=0)
    path.eval_time = 100
    path.keyframe_insert(data_path="eval_time", frame=100)    
    
    # Add a spline to path
    spline = path.splines.new('NURBS')
    spline.use_cyclic_u = False
    spline.use_endpoint_u = False
    
    # Add points to spline
    pointTable = [(4.0,-5.4, 1.0,100),(4.0,-5.4, 1.0,100),(2.9,-3.4, 0.9,10),(2.7,-2.4, 0.9,10),(2.7,-1.4, 1.0,100),(2.7,-1.4, 1.0,100)]
    nPoints = len(pointTable)
    spline.points.add(nPoints-1)
    for n in range(nPoints):
        spline.points[n].co = pointTable[n]
    
    bpy.data.objects["NurbsPath"].hide = True
    camera = bpy.data.objects['Camera']
    camera.select = True
    camera.location[0] = 0.0
    camera.location[1] = 0.0
    camera.location[2] = 0.0
    camera.rotation_euler[2] = -0.1
    
    # Add follow path constraint to monkey
    cns = camera.constraints.new('FOLLOW_PATH')
    cns.target = pathOb
    cns.use_curve_follow = True
    cns.use_curve_radius = True
    cns.use_fixed_location = False
    cns.forward_axis = 'FORWARD_Y'
    cns.up_axis = 'UP_Z'
    
    for i in range(900,1391):
        fnin = ("F_We3000_%4.4d.stl" % i)
        spname = ("F_We3000_%4.4d.stl" % i)
        obname = ("F We3000 %4.4d" % i)
        spdir = ("")
        fnout = ("pics_camera/F_We3000_%4.4d.png" % i)
        j=i
        if (j-671 < 81):
            bpy.context.scene.frame_current = j-671
        else:
            bpy.context.scene.frame_current = 80
        bpy.ops.import_mesh.stl(filepath=fnin, filter_glob="*.stl", files=[{"name":spname, "name":spname}], directory=spdir)
        spray = bpy.data.objects[obname]
        bpy.ops.object.shade_smooth()
        spray.scale[0] = 0.6
        spray.scale[1] = 0.6
        spray.scale[2] = 0.6
        spray.rotation_euler[0] = 1.5708
        spray.location[0] = 2.7
        spray.location[1] = -0.0
        spray.location[2] = 0.1
        spray.data.materials.append(mat)
        spray.select = False
        bpy.context.scene.render.filepath = fnout
        bpy.ops.render.render(write_still = True)
        spray.select = True
        bpy.ops.object.delete(use_global=False)