This file contains 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
$coverageFilePath = "coverage.xml" | |
$matchPackagePattern = "nViewAddon" | |
$ignoreClassPatternList = @("__init__", "panel") | |
$ignoreClassPattern = $ignoreClassPatternList -join "|" | |
if (-not (Test-Path $coverageFilePath)) { | |
Write-Error "Cannot find coverage report: $coverageFilePath" | |
return | |
} |
This file contains 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
def test_variables_declared_deleted(): | |
import re | |
declaration_re = r"\s*(\w+\.?)+\s+=\s+[\w\d\.]+Property\(" | |
deletion_re = r"\s*del\s+(\w+\.?)+" | |
init_file = open(path_to_addon_init, 'r') | |
deletion_vars = [] | |
declaration_vars = [] | |
while True: | |
line = init_file.readline() |
This file contains 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 bmesh | |
# source: https://blender.stackexchange.com/questions/177559/select-vertices-within-a-given-object/241467#241467 | |
# must create an object with many interior points (apply a array modifer on a cube 3 times) | |
# create another object (here named "Sphere") to be the hull | |
# go into edit mode for the first object | |
def is_inside(p, max_dist, obj): | |
result, point, normal, face = obj.closest_point_on_mesh(p, distance=max_dist) # you weren't using max_dist in yours, is that intentional? |
This file contains 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 collections | |
import json | |
def select_current_selset(self, context): | |
"""Selection""" | |
if len(context.scene.sj_sel_set_items) is 0: | |
return None |
This file contains 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
from mathutils.geometry import normal | |
from mathutils import Vector | |
from bpy import context | |
def camera_as_planes(scene, obj): | |
""" | |
Return planes in world-space which represent the camera view bounds. | |
""" | |
camera = obj.data |
This file contains 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
def coll_iter(curr_coll): | |
""" | |
Iterate through hierarchy of collections | |
:param curr_coll: current collection | |
:return: generator of collections | |
""" | |
yield curr_coll | |
for child in curr_coll.children: | |
yield from coll_iter(child) |
This file contains 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 blf | |
import bpy | |
def wrap_text(text: str, context): | |
return_text = [] | |
row_text = '' | |
width = context.region.width | |
system = context.preferences.system | |
ui_scale = system.ui_scale |
This file contains 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 numpy as np | |
from mathutils import Vector | |
import bpy | |
def occlusion_test(scene, depsgraph, camera, resolution_x, resolution_y): | |
# get vectors which define view frustum of camera | |
top_right, _, bottom_left, top_left = camera.data.view_frame(scene=scene) | |
camera_quaternion = camera.matrix_world.to_quaternion() |
This file contains 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 bmesh | |
from mathutils import Vector | |
obj = bpy.context.active_object | |
me = obj.data | |
# cannot access color attributes within bmesh, | |
# so we will create a dict of indices to access the linked edges in object mode | |
bpy.ops.object.mode_set(mode='EDIT') |
This file contains 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 | |
# prereq: go into your object's edit mode | |
context = bpy.context | |
mesh = context.edit_object.data | |
verts = [v.co for v in mesh.vertices] | |
edges = [[v for v in e.vertices] for e in mesh.edges] |
OlderNewer