Created
May 13, 2022 05:20
-
-
Save CGArtPython/1a7d1ea812558f6e38819c609fe4a7e1 to your computer and use it in GitHub Desktop.
working with the Map Range Node in Blender's Geometry Nodes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
import mathutils | |
def add_map_range(node_tree): | |
map_range = node_tree.nodes.new(type="ShaderNodeMapRange") | |
# Attributes | |
map_range.interpolation_type = "LINEAR" | |
map_range.clamp = True | |
map_range.location = mathutils.Vector((0, 0)) | |
map_range.name = "Map Range" | |
map_range.label = "<your label for Map Range>" | |
# Input Socket | |
map_range.inputs["Value"].default_value = 1.0 | |
map_range.inputs["From Min"].default_value = 1.0 | |
map_range.inputs["From Max"].default_value = 60.0 | |
map_range.inputs["To Min"].default_value = 0.0 | |
map_range.inputs["To Max"].default_value = -1.0 | |
map_range.inputs["Steps"].default_value = 4.0 | |
return map_range | |
# add cube | |
bpy.ops.mesh.primitive_cube_add() | |
# add geo nodes | |
bpy.ops.object.modifier_add(type="NODES") | |
node_tree = bpy.context.active_object.modifiers['GeometryNodes'].node_group | |
add_map_range(node_tree) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment