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 forward(self, x, timesteps=None, context=None, y=None, **kwargs): | |
# broadcast timesteps to batch dimension | |
timesteps = timesteps.expand(x.shape[0]) | |
hs = [] | |
t_emb = get_timestep_embedding(timesteps, self.model_channels) # , repeat_only=False) | |
t_emb = t_emb.to(x.dtype) | |
emb = self.time_embed(t_emb) | |
assert x.shape[0] == y.shape[0], f"batch size mismatch: {x.shape[0]} != {y.shape[0]}" |
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
addon_prefs = bpy.context.preferences.addons[__package__].preferences |
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 cv2 | |
import numpy as np | |
def find_image_in_video(video_path, image_path): | |
# Load the video clip | |
cap = cv2.VideoCapture(video_path) | |
# Load the image template | |
template = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE) |
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 cv2 | |
import numpy as np | |
def detect_clapperboard(frame, clapperboard_template): | |
# Convert the frame to grayscale | |
gray_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) | |
# Use template matching to find the clapperboard | |
result = cv2.matchTemplate(gray_frame, clapperboard_template, cv2.TM_CCOEFF_NORMED) |
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 sys | |
import subprocess | |
import os | |
import bpy | |
import pkgutil | |
# Get the path to the Python interpreter used by Blender | |
python_path = sys.executable | |
# Determine the script directory |
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 | |
def join(vse, current_strip, next_strip): | |
# Calculate the duration of the next strip | |
duration = next_strip.frame_final_end - next_strip.frame_final_start | |
# Remove the next strip from the VSE | |
vse.sequences.remove(next_strip) |
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 librosa | |
import numpy as np | |
from scipy import signal | |
def normalize_audio(audio): | |
max_amplitude = np.max(np.abs(audio)) | |
if max_amplitude > 0: | |
audio /= max_amplitude | |
return audio |
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
bl_info = { | |
"name": "LoRA Browser", | |
"blender": (2, 80, 0), | |
"category": "Object", | |
} | |
import bpy | |
import os | |
# Custom property to store the list of files |
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 shutil | |
import os | |
from bpy.types import Operator | |
class CopyStripsOperator(Operator): | |
bl_idname = "sequencer.copy_strips" | |
bl_label = "Copy Strips to Folder" | |
def execute(self, context): |
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
keyconfig_version = (3, 5, 10) | |
keyconfig_data = \ | |
[("3D View", | |
{"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, | |
{"items": | |
[("view3d.cursor3d", {"type": 'RIGHTMOUSE', "value": 'PRESS', "shift": True}, None), | |
("transform.translate", | |
{"type": 'RIGHTMOUSE', "value": 'CLICK_DRAG', "shift": True}, | |
{"properties": | |
[("cursor_transform", True), |
NewerOlder