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 tkinter as tk | |
import tkinter.messagebox | |
import inspect | |
import sys | |
import os | |
from blender_asset_tracer import blendfile | |
import inspect | |
import pathlib | |
from dataclasses import dataclass, field |
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 os | |
#os.system('cls') | |
class Position_Material_Override: | |
def __init__(self, objects): | |
self.objects = objects | |
def __enter__(self): |
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 unreal # type: ignore | |
import os | |
import json | |
import datetime | |
def get_desktop(): | |
try: | |
import winreg | |
with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders") as key: | |
return winreg.QueryValueEx(key, "Desktop")[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 | |
import re | |
re_name = re.compile('plane(\.\d{3})?', flags = re.IGNORECASE) | |
planes = [] | |
for object in bpy.data.objects: | |
if object.data and object.data.__class__.__name__ == 'Mesh': | |
if re_name.match(object.name) or len(object.data.vertices) == 4: | |
planes.append(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
""" Generate panda3d.bullet.BulletConvexHullShape via the Blender's Geometry Nodes Convex Hull node. """ | |
from __future__ import annotations | |
import os | |
import sys | |
import tempfile | |
import typing | |
import random |
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
# test blender socket custom properties | |
def get_script(func, *args, **kwargs): | |
import textwrap | |
import inspect | |
import json | |
return '\n'.join([ | |
textwrap.dedent(inspect.getsource(func)), | |
"import json", | |
f"{func.__name__}(*json.loads(r'{json.dumps(args)}'), **json.loads(r'{json.dumps(kwargs)}'))" |
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
# test blender property default retrieval | |
def ensure_site_packages(packages: list, directory: str): | |
""" | |
`packages`: list of tuples (<import name>, <pip name>) | |
`directory`: a folder for site packages, will be created if does not exist and added to `sys.path` | |
""" | |
if not packages: | |
return |
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 importlib | |
import importlib.util | |
import os | |
import sys | |
import typing | |
import bpy | |
ROOT_DIR = os.path.dirname(os.path.realpath(__file__)) |
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 bmesh | |
from blend_converter import bl_utils | |
BASE_LENGTH = 2 | |
MAX_LENGTH = 1.5 * BASE_LENGTH | |
TRAVERSE_SELECT = False | |
bl_utils.select(bpy.data.objects['level']) | |
bpy.ops.object.duplicate(linked=False) |