Skip to content

Instantly share code, notes, and snippets.

@ztffn
ztffn / BlendBatcher.py
Created February 26, 2024 10:38
Python script to batch clean up Blender files
# This script automates the processing of FBX files using Blender's Python API. It is designed to import an FBX file,
# remove a specific camera object, reset and apply all rotations and scales to the mesh objects, rename the mesh objects
# for clarity, and then export the modified scene back to an FBX file. The script is intended for use in batch processing
# or integration into a larger automated workflow, where FBX files need to be cleaned up or standardized before further use.
import bpy
import sys
import os
# Function to process the FBX file
@ztffn
ztffn / ImgToPng.py
Created February 26, 2024 05:59
Tiny Python script that resizes the images in all subfolders to a target size and converts it to PNG format.
# This script is used for resizing and converting images in a specified directory. It traverses through the directory,
# and for each image file it finds (with extensions .png, .jpg, .jpeg, .bmp, .gif, .tiff, .tif), it resizes the image
# to a target size (default is 1024x1024) and converts it to PNG format.
from PIL import Image
import os
def resize_and_convert_images(root_dir, target_size=(1024, 1024)):
for root, dirs, files in os.walk(root_dir):
@ztffn
ztffn / wipefiles.py
Created February 26, 2024 05:55
tiny python script script will go through all subdirs and delete files that matches a specified type
import os
# Put this in a folder. Point Terminal cd to that folder
# Run Terminal prompt: python3 metawipe.py
# the script will go through all subdirs and delete files of ".wipethis"
# By using this script, you acknowledge and agree that you are doing so at your own risk.
# It is highly recommended to back up your data before running this script.
@ztffn
ztffn / NewTransformInspector.cs
Created May 24, 2021 12:52
Adds tiny icons to the Unity Editor Transform Inspector for quick and easy resetting position and scale
using UnityEngine;
using UnityEditor;
[CanEditMultipleObjects]
[CustomEditor(typeof(Transform), true)]
public class NewTransformInspector : Editor
{
/// <summary>
/// Draw the inspector widget.
/// </summary>