xdatbus.utils_bpy
Attributes
Functions
|
Realize instances of the given object. This function requires bpy. |
|
Remove nodes with given names from the object's node tree. |
|
Get a node from a template blend file. |
|
Add a custom node and connect it to the specified input of the target node. |
|
Set the color of the given object. This function requires bpy and molecularnodes. |
|
Clear the scene of all objects. This function requires bpy. |
|
Render an image. This function requires bpy. |
Apply modifiers to the given object. This function requires bpy. |
|
|
This function generates a YAML file for the elements in the PDB file, with a common bond_radius. |
|
This function loads a YAML file and returns element data and bond radius. |
Module Contents
- xdatbus.utils_bpy.BPY_AVAILABLE = True
- xdatbus.utils_bpy.PDB_AVAILABLE = True
- xdatbus.utils_bpy.MN_AVAILABLE = True
- xdatbus.utils_bpy.YAML_AVAILABLE = True
- xdatbus.utils_bpy.realize_instances(obj, bond_radius)
Realize instances of the given object. This function requires bpy.
- objbpy.types.Object
The object to realize instances of
- bond_radiusfloat
The radius of the bonds
- xdatbus.utils_bpy.remove_nodes(obj, node_names)
Remove nodes with given names from the object’s node tree.
- objbpy.types.Object
The object from which to remove nodes.
- node_nameslist of str
The names of the nodes to remove.
- xdatbus.utils_bpy.get_template_node(node_name, nodes)
Get a node from a template blend file.
- node_namestr
The name of the node to get.
- nodesbpy.types.NodeTree.nodes
The nodes from the node tree to add the node to.
- nodebpy.types.Node
The node from the template blend file.
- xdatbus.utils_bpy.set_color4element(obj, atomic_number, color, atomic_scale, bonded, bonded_count=0)
Add a custom node and connect it to the specified input of the target node.
- objbpy.types.Object
The object with the Geometry Nodes modifier whose node tree we’re editing.
- atomic_numberint
The atomic number of the element to set the color of.
- colortuple
The color to set the node to.
- atomic_scalefloat
The size of the atoms.
- bondedbool
Whether the atoms are bonded.
- bonded_countint
The number of elements forming a bond.
- xdatbus.utils_bpy.apply_yaml(obj, yaml_path)
Set the color of the given object. This function requires bpy and molecularnodes.
Parameters
- objbpy.types.Object
The object to set the color of
- yaml_pathstr
The path to the YAML file to use
- xdatbus.utils_bpy.clear_scene(mesh=True, lights=True, geometry_nodes=True)
Clear the scene of all objects. This function requires bpy.
- meshbool
Clear mesh objects
- lightsbool
Clear light objects
- geometry_nodesbool
Clear geometry node groups
- xdatbus.utils_bpy.render_image(engine='eevee', x=1000, y=500, output_path='render.png')
Render an image. This function requires bpy.
- enginestr
The render engine to use. Either ‘eevee’ or ‘cycles’
- xint
The x resolution of the image
- yint
The y resolution of the image
- output_pathstr
The path to save the image to
- xdatbus.utils_bpy.apply_modifiers_to_mesh(obj)
Apply modifiers to the given object. This function requires bpy.
- objbpy.types.Object
The object to apply modifiers to