Skip to content

Instantly share code, notes, and snippets.

@tamask
tamask / log.py
Created August 8, 2018 00:44
Route system output (stdout/stderr) of Blender to the app console (put in scripts/startup)
import os
import sys
import bpy
output = None
input = None
info = None
error = None
write = None
@kohya-ss
kohya-ss / forward_of_sdxl_original_unet.py
Created November 14, 2023 03:39
SDXLで高解像度での構図の破綻を軽減する
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]}"
import bpy
from bpy.types import Panel, EnumProperty, WindowManager
import bpy.utils.previews
import os
# UI
class PreviewsExamplePanel(bpy.types.Panel):
bl_label = "Previews Example Panel"
bl_idname = "OBJECT_PT_previews"
@zeffii
zeffii / ufkoot.py
Last active February 12, 2024 02:00 — forked from anonymous/ufkoot.py
'''
installation
- from a fresh Blender start
- drop ufkoot.py into your scripts/addons(_contrib) folder
- in User Preferences / addons / Testing (or community..) / Development
- tick 'Info To Text'
- press Save User Settings
- close the User Preferences Panel
- press Ctrl + U , (this will store this preference in the startup.blend)
@p2or
p2or / blender-frame-hold.py
Last active February 8, 2024 14:42
FrameHold #Blender
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@Stella2211
Stella2211 / DeepFloyd_IF_VRAM12GB.py
Last active January 17, 2024 03:59
DeepFloyd IF for around 12GB of VRAM
# huggingface login
from huggingface_hub import login
login()
# load textencorder in 8bit quantized
from transformers import T5EncoderModel
from diffusers import DiffusionPipeline
import datetime
@Norod
Norod / text-to-video-modelscope.py
Created April 16, 2023 08:08
Running ModelScope text2video locally with torch 2 gpu memory optimizations and control over parameters
# Ran it with the following packages installed:
# accelerate 0.18.0
# diffusers 0.16.0.dev0
# torch 2.0.0+cu118
# torchvision 0.15.0+cu118
# transformers 4.28.1
# xformers 0.0.18
import torch
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
@p2or
p2or / blender-custom-toggle-shortcut.py
Last active May 22, 2023 16:11
Custom Shortcut Toggle #Blender #BSE
# for http://blender.stackexchange.com/questions/58486/add-toggle-hotkey-to-custom-checkbox
bl_info = {
"name": "Add-on Template",
"description": "",
"author": "poor",
"version": (0, 0, 2),
"blender": (2, 70, 0),
"location": "3D View > Tools",
"warning": "", # used for warning icon and text in addons panel
@p2or
p2or / customPropertiesSearch.py
Last active May 21, 2023 18:21
UI - PropSearch #Blender
# for http://blender.stackexchange.com/questions/44886/search-enum-list
bl_info = {
"name": "Search Popup",
"version": (0, 0, 1),
"blender": (2, 75, 0),
"category": "Test"
}
import bpy
@p2or
p2or / blender-list-files-of-loaded-image-sequence.py
Created February 17, 2017 14:29
List Files of loaded Image Sequence #Blender #BSE
# for http://blender.stackexchange.com/q/73858/3710
import bpy
import os
def image_sequence_resolve(operator, context):
filepath = context.space_data.clip.filepath
filepath_full = bpy.path.abspath(filepath)