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
""" | |
The code for this art project: | |
https://www.artstation.com/artwork/48wX6L | |
Tested using: Blender 2.93 | |
Author: Viktor Stepanov | |
License info: https://choosealicense.com/licenses/mit/ |
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)) |
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
# give Python access to Blender's functionality | |
import bpy | |
# extend Python's math functionality | |
import math | |
# extend Python's print functionality | |
import pprint | |
# initialize paramaters |
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
# give Python access to Blender's functionality | |
import bpy | |
# extend Python's math functionality | |
import math | |
import pprint | |
def get_circle_verts(vert_count, radius): |
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
# give Python access to Blender's functionality | |
import bpy | |
# extend Python functionality to generate random numbers | |
import random | |
# add a cube into the scene | |
bpy.ops.mesh.primitive_cube_add(size=2) | |
obj = bpy.context.active_object |
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
# give Python access to Blender's functionality | |
import bpy | |
# create parameters | |
cube_count = 10 | |
location_offset = 3 | |
frame_count = 300 | |
# set the end frame | |
bpy.context.scene.frame_end = frame_count |
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
# give Python access to Blender's functionality | |
import bpy | |
def set_end_frame(frame_count): | |
"""set the end frame""" | |
bpy.context.scene.frame_end = frame_count | |
def set_fps(fps): |
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
# give Python access to Blender's mesh manipulation functionality | |
import bmesh | |
# give Python access to Blender's functionality | |
import bpy | |
# add cube | |
bpy.ops.mesh.primitive_cube_add() | |
obj = bpy.context.active_object |
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
# give Python access to Blender's mesh manipulation functionality | |
import bmesh | |
# give Python access to Blender's functionality | |
import bpy | |
# add cube | |
bpy.ops.mesh.primitive_cube_add() | |
obj = bpy.context.active_object |
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
# give Python access to Blender's functionality | |
import bpy | |
# extend Python's math functionality | |
import math | |
def hex_color_to_rgba(hex_color): | |
# remove the leading '#' symbol | |
hex_color = hex_color[1:] |