Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# `Hydra.utils.apply`

Module responsible for applying heightmaps, previews and modifiers.

## Module Contents

Hydra.utils.apply.minimizeNode(node)

  Hides unused inputs and minimizes the specified node.

  Parameters:

    node – Node to minimize.

Hydra.utils.apply.setupVectorNode(nodes, node: bpy.types.ShaderNode) → bpy.types.ShaderNode

  Creates a Z Normal node and connects it to the specified node.

  Parameters:

    - nodes – Node graph.

    - node (`bpy.types.ShaderNode`) – Node to connect to.

  Returns:

    Created node.

  Return type:

    `bpy.types.ShaderNode`

Hydra.utils.apply.setupImageNode(nodes, name: str, imageSrc: str) → tuple[bpy.types.ShaderNode, bpy.types.ShaderNode]

  Creates an Image Texture node and connects it to generated coordinates.

  Parameters:

    - nodes – Node graph.

    - name (`str`) – Image node title.

    - imageSrc (`str`) – Image source name.

  Returns:

    Created nodes.

  Return type:

    `tuple[bpy.types.ShaderNode, bpy.types.ShaderNode]`

Hydra.utils.apply.staggerNodes(baseNode: bpy.types.ShaderNode, *args, forwards: bool = False)

  Spaces and shifts specified nodes around.

  Parameters:

    - baseNode (`bpy.types.ShaderNode`) – Rightmost node.

    - args (`bpy.types.ShaderNode`) – Node arguments to be shifted.

    - forwards (`bool`) – Shift direction. True shifts baseNode forward.

Hydra.utils.apply.makeBSDF(nodes) → bpy.types.ShaderNode

  Creates a Principled BSDF node.

  Parameters:

    nodes – Node graph.

  Returns:

    Created node.

  Return type:

    `bpy.types.ShaderNode`

Hydra.utils.apply.getOrMakeOutputNode(nodes)

  Finds or creates an Output node.

  Parameters:

    nodes – Node graph.

  Returns:

    Created node.

  Return type:

    `bpy.types.ShaderNode`

Hydra.utils.apply.H_NAME_BUMP = 'Hydra Bump'

  Bump map node name.

Hydra.utils.apply.addBump(obj: bpy.types.Object, src: moderngl.Texture)

  Adds a Bump map for the given texture in the specified object’s material. Creates a material if needed, otherwise selects the first material slot.

  Parameters:

    - obj (`bpy.types.Object`) – Object to add to.

    - src (`moderngl.Texture`) – Source texture to add.

Hydra.utils.apply.H_NAME_DISP = 'Hydra Displacement'

  Displacement map node name.

Hydra.utils.apply.addDisplacement(obj: bpy.types.Object, src: moderngl.Texture)

  Adds a Displacement map for the given texture in the specified object’s material. Creates a material if needed, otherwise selects the first material slot.

  Parameters:

    - obj (`bpy.types.Object`) – Object to add to.

    - src (`moderngl.Texture`) – Source texture to add.

Hydra.utils.apply.addModifier(obj: bpy.types.Object, src: moderngl.Texture)

  Adds a Displace modifier to the specified object.

  Parameters:

    - obj (`bpy.types.Object`) – Object to add to.

    - src (`moderngl.Texture`) – Source texture to add.

Hydra.utils.apply.P_MOD_NAME = 'HYD_Preview_Modifier'

  Preview modifier name.

Hydra.utils.apply.P_GUIDE_NAME = 'HYD_Preview_Guide'

  Preview guide Empty object name.

Hydra.utils.apply.P_IMG_NAME = 'HYD_Preview_Image'

  Preview temporary image name.

Hydra.utils.apply.P_VIEW_NAME = 'HYD_Image_Preview'

  Image preview name.

Hydra.utils.apply.showGenModifier(obj: bpy.types.Object, visible: bool)

  Internal. Shows or hides the first modifier created by Hydra belonging to the specified object.

  Parameters:

    - obj (`bpy.types.Object`) – Object to add to.

    - visible (`bool`) – Modifier visibility.

Hydra.utils.apply.addImagePreview(src: moderngl.Texture) → bpy.types.Image

  Writes the specified texture as a temporary image.

  Parameters:

    src (`moderngl.Texture`) – Source texture to add.

  Returns:

    Created image.

  Return type:

    `bpy.types.Image`

Hydra.utils.apply.removeImagePreview()

  Removes the temporary preview Image.

Hydra.utils.apply.addPreview(obj: bpy.types.Object, src: moderngl.Texture)

  Previews the specified texture as a modifier on the specified object.

  Parameters:

    - obj (`bpy.types.Object`) – Object to add to.

    - src (`moderngl.Texture`) – Source texture to add.

Hydra.utils.apply.removePreview()

  Removes the preview modifier from the last previewed object.

Hydra.utils.apply.configureLandscape(obj: bpy.types.Object, src: moderngl.Texture)

  Shapes the specified grid object using the input heightmap texture.

  Parameters:

    - obj (`bpy.types.Object`) – Object to shape.

    - src (`moderngl.Texture`) – Heightmap texture.