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 os | |
| directory_in_str = os.path.dirname(os.path.realpath(__file__)) | |
| windows_line_ending = b'\r\n' | |
| linux_line_ending = b'\n' | |
| all_files = [] | |
| for root, dirs, files in os.walk(directory_in_str): | |
| for name in files: |
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 | |
| cube_key = "cubes" | |
| ico_key = "spheres" | |
| cone_key = "cones" | |
| # create a dict of mesh lists | |
| mesh_objects = { | |
| cube_key: list(), |
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 | |
| def create_plane_with_color(color, location): | |
| # add a plane | |
| bpy.ops.mesh.primitive_plane_add() |
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 ico spheres into the scene | |
| object_count = 10 | |
| for _ in range(object_count): | |
| x = random.uniform(-5, 5) |
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 warnings | |
| bpy_context_key_types = dict([ | |
| ("active_base", bpy.types.ObjectBase), | |
| ("active_bone", bpy.types.EditBone), | |
| ("active_gpencil_brush", bpy.types.GPencilBrush), | |
| ("active_gpencil_frame", [bpy.types.GPencilLayer]), | |
| ("active_gpencil_layer", [bpy.types.GPencilLayer]), | |
| ("active_gpencil_palette", [bpy.types.GPencilPalette]), |
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
| # Simple script to output the lookAt parameters and field of view for the active camera. | |
| # This converts the output to a y-up system, common in OpenGL. | |
| import bpy | |
| from mathutils import Vector | |
| from math import degrees | |
| # get the active camera | |
| cam = bpy.context.scene.camera |
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
| # vertex_color_from_z_height.py | |
| import bpy | |
| import random | |
| from mathutils import Color, Vector | |
| def remap(current, lower_old, upper_old, lower_new, upper_new): | |
| ''' | |
| Remaps one range of values to another range of values, types must be float | |
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 | |
| gpencil_data = bpy.data.grease_pencils.new("GPencil") | |
| gpencil = bpy.data.objects.new(gpencil_data.name, gpencil_data) | |
| bpy.context.collection.objects.link(gpencil) | |
| gp_layer = gpencil_data.layers.new("lines") | |
| gp_frame = gp_layer.frames.new(bpy.context.scene.frame_current) |
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
| // Dynamic Box - Created by Animoplex: www.animoplex.com | |
| // Apply this to the Size property of a shape layer to resize the box based on the source. | |
| // Full Tutorial: https://www.youtube.com/watch?v=BOPfs49VfLE&t=803s | |
| pad = 80; // pixel padding around box | |
| src = thisComp.layer("Label"); | |
| box = src.sourceRectAtTime(time - src.inPoint); | |
| [box.width + pad, box.height + pad] |
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
| // Clamp Values - Created by Animoplex: www.animoplex.com | |
| // Limits a slider or keyframable value with a minimum and maximum value clamp. | |
| // VARIATION A: Slider (1 Value) | |
| minVal = 0; | |
| maxVal = 100; | |
| clamp(effect("Global Tab Size")("Slider"), minVal, maxVal) |