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 math | |
def delete_object_if_exists(name): | |
if name in bpy.data.objects: | |
bpy.data.objects.remove(bpy.data.objects[name], do_unlink=True) | |
def get_or_create_empty(name): |
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 open_image(path): | |
from PIL import Image | |
import numpy as np | |
img = Image.open(path) | |
return np.asarray(img) | |
# Using PIL and IPython | |
def show_img(img): |
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 gen_buckets( | |
min_dim: int = 256, | |
base_res: tuple[int, int] = (512, 512), | |
max_size: tuple[int, int] = (768, 512), | |
dim_limit: int = 1024, | |
divisible=64, | |
): | |
""" | |
Adapted from: | |
https://github.com/NovelAI/novelai-aspect-ratio-bucketing/blob/main/bucketmanager.py |
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 datetime | |
import substance_painter.resource as res | |
import substance_painter.ui | |
from PySide2 import QtWidgets | |
def now(): | |
return datetime.datetime.now().timestamp() |
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 typing import Any, NamedTuple | |
import bpy | |
class ModifierSpec(NamedTuple): | |
name: str | |
type: str | |
properties: dict[str, Any] |
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
model: | |
base_learning_rate: 5.0e-03 | |
target: ldm.models.diffusion.ddpm.LatentDiffusion | |
params: | |
linear_start: 0.00085 | |
linear_end: 0.0120 | |
num_timesteps_cond: 1 | |
log_every_t: 200 | |
timesteps: 1000 | |
first_stage_key: image |
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
{ | |
"samples_save": true, | |
"samples_format": "png", | |
"samples_filename_pattern": "", | |
"save_images_add_number": true, | |
"grid_save": true, | |
"grid_format": "png", | |
"grid_extended_filename": false, | |
"grid_only_if_multiple": true, | |
"grid_prevent_empty_spots": false, |
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
# This script solves the issue in this stackoverflow question: | |
# https://superuser.com/questions/1092246/how-to-prevent-windows-10-from-automatically-adding-keyboard-layouts-i-e-us-ke | |
# This method adds the en-US layout then removes it, ensuring that the layout is always removed from the taskbar | |
# I don't have a high enough reputation so I can't post this there, so here is the script: | |
# define the language to be removed | |
$LanguageToRemove = "en-US" | |
# get the current language list | |
$LangList = Get-WinUserLanguageList |
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
var timeObserver; | |
/** seek playback to the given second */ | |
function seek_to(time) { | |
mp.set_property_number("time-pos", time); | |
} | |
function get_json_path() { | |
var video_path = mp.get_property("path"); | |
return video_path.replace(/\.[^.]+$/, ".json"); |