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 | |
| from math import pi, sin, cos | |
| def ellipse(gp_frame, center, radius_x, radius_z, num_points): | |
| gp_stroke = gp_frame.strokes.new() | |
| gp_stroke.line_width = 30 | |
| gp_stroke.use_cyclic = True | |
| gp_stroke.points.add(count=num_points) | |
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 | |
| def line(gp_frame, start_pos, end_pos, num_pts): | |
| gp_stroke = gp_frame.strokes.new() | |
| gp_stroke.line_width = 30 | |
| gp_stroke.points.add(count=num_pts) | |
| start_x = start_pos[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
| ########################################### | |
| # SNIPPETS: GETTING AND SELECTING OBJECTS # | |
| # [email protected] # | |
| ########################################### | |
| # Get a list of objects in the scene | |
| objects = bpy.data.objects | |
| for object in objects: | |
| print(object.name) |
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 | |
| from mathutils import Vector | |
| def duplicate(obj, data=True, actions=True, collection=None): | |
| obj_copy = obj.copy() | |
| if data: | |
| obj_copy.data = obj_copy.data.copy() | |
| if actions and obj_copy.animation_data.action: | |
| obj_copy.animation_data.action = obj_copy.animation_data.action.copy() |
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 | |
| IMAGE = None | |
| TEXTURE_PATH = 'D:\\images\\textures\\hatch_1.jpg' | |
| for i in bpy.data.images: | |
| if i.filepath == TEXTURE_PATH: | |
| IMAGE = i | |
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 | |
| IMAGE = None | |
| TEXTURE_PATH = 'D:\\images\\textures\\hatch_1.jpg' | |
| for i in bpy.data.images: | |
| if i.filepath == TEXTURE_PATH: | |
| IMAGE = i | |
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 | |
| from mathutils import Color | |
| palette_name = bpy.context.tool_settings.gpencil_paint.palette.name | |
| def create_palette_materials(gp, palette_name): | |
| palette = bpy.data.palettes.get(palette_name) | |
| if palette: | |
| i = 0 | |
| while i < len(palette.colors): |
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 | |
| from mathutils import Vector | |
| min_dist = 10.0 | |
| max_dist = 120.0 | |
| fog_color = (1.0, 0.9, 0.7, 1.0) | |
| fog_mult = 1.0 | |
| final_fog = (fog_color[0]*fog_mult, fog_color[1]*fog_mult, fog_color[2]*fog_mult) | |
| falloff = 3.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
| import bpy | |
| sel_obj = None | |
| sel_objs = bpy.context.selected_objects | |
| if sel_objs: | |
| sel_obj = sel_objs[0] | |
| if sel_obj and sel_obj.type=='GPENCIL': | |
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 | |
| from math import tau, pi, sin, cos, ceil | |
| import random | |
| import time | |
| t = time.perf_counter() | |
| num_points = 48 | |
| center = (0.0, 0.0, 0.0) |
NewerOlder