Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

asset-pipeline-patterns

БесплатноБез исполняемых скриптовНе проверен

Asset pipeline patterns: Godot per-directory import overrides, a Unity AssetPostprocessor for texture standards, MaxRects atlas layout, Godot LOD…

HermeticOrmusот HermeticOrmus★ 83 звезды на GitHub

Об этом скилле

Asset Pipeline Patterns

Godot Import Override by Directory

# res://assets/textures/ui/.gdignore does NOT affect imports.
# Instead, use import override files per directory.
# Place in res://assets/textures/ui/.import_defaults (Godot 4 pattern):

# Or use a _meta.godot file approach, or set each .import file.
# Practical approach: GDScript editor tool to batch-set import settings.
# Editor tool: batch set texture compression for a directory
@tool
extends EditorScript

const TARGET_DIR := "res://assets/textures/environment/"
const COMPRESS_MODE := 3  # VRAM compressed (BC7/ASTC based on platform)

func _run() -> void:
    var dir := DirAccess.open(TARGET_DIR)
    if not dir:
        push_error("Cannot open directory: %s" % TARGET_DIR)
        return

    dir.list_dir_begin()
    var file_name := dir.get_next()
    while file_name != "":
        if file_name.ends_with(".png") or file_name.ends_with(".jpg"):
            _set_texture_compression(TARGET_DIR + file_name)
        file_name = dir.get_next()

    EditorInterface.get_resource_filesystem().scan()
    print("Batch import settings applied.")

func _set_texture_compression(path: String) -> void:
    var import_path := path + ".import"
    var config := ConfigFile.new()
    config.load(import_path)
    config.set_value("params", "compress/mode", COMPRESS_MODE)
    config.set_value("params", "mipmaps/generate", true)
    config.save(import_path)

Unity AssetPostprocessor for Texture Standards

// Enforces texture import settings based on directory convention
// Place in Editor/ folder
using UnityEditor;
using UnityEngine;

public class TextureImportEnforcer : AssetPostprocessor
{
    void OnPreprocessTexture()
    {
        var importer = assetImporter as TextureImporter;
        if (importer == null) return;

        string path = assetPath.ToLower();

        if (path.Contains("/ui/"))
        {
            importer.textureType = TextureImporterType.Sprite;
            importer.mipmapEnabled = false;
            SetPlatformSettings(importer, "Standalone", TextureImporterFormat.BC7);
            SetPlatformSettings(importer, "Android", TextureImporterFormat.ASTC_6x6);
            SetPlatformSettings(importer, "iPhone", TextureImporterFormat.ASTC_6x6);
        }
        else if (path.Contains("/environment/"))
        {
            importer.textureType = TextureImporterType.Default;
            importer.mipmapEnabled = true;
            importer.streamingMipmaps = true;  // Only load needed mip levels
            SetPlatformSettings(importer, "Standalone", TextureImporterFormat.BC7);
            SetPlatformSettings(importer, "Android", TextureImporterFormat.ASTC_4x4);
            SetPlatformSettings(importer, "iPhone", TextureImporterFormat.ASTC_4x4);
        }
        else if (path.Contains("/normalmap/") || path.Contains("_normal"))
        {
            importer.textureType = TextureImporterType.NormalMap;
            SetPlatformSettings(importer, "Standalone", TextureImporterFormat.BC5);
        }
    }

    static void SetPlatformSettings(TextureImporter importer, string platform, TextureImporterFormat format)
    {
        var settings = new TextureImporterPlatformSettings
        {
            name = platform,
            overridden = true,
            format = format,
            maxTextureSize = 2048,
            compressionQuality = (int)TextureCompressionQuality.Best
        };
        importer.SetPlatformTextureSettings(settings);
    }
}

Texture Atlas Layout (MaxRects)

# Simple shelf packer for runtime atlas generation
class_name ShelfPacker
var width: int
var height: int
var _shelves: Array[Dictionary] = []  # [{y, height, x_cursor}]

func _init(atlas_width: int, atlas_height: int) -> void:
    width = atlas_width
    height = atlas_height

# Returns Rect2i placement or Rect2i(-1,-1,0,0) if no space
func pack(item_width: int, item_height: int) -> Rect2i:
    # Try to fit on existing shelf
    for shelf in _shelves:
        if shelf.x_cursor + item_width <= width and item_height <= shelf.height:
            var rect := Rect2i(shelf.x_cursor, shelf.y, item_width, item_height)
            shelf.x_cursor += item_width
            return rect

    # Start a new shelf
    var shelf_y: int = 0
    if not _shelves.is_empty():
        var last := _shelves.back()
        shelf_y = last.y + last.height

    if shelf_y + item_height > height:
        return Rect2i(-1, -1, 0, 0)  # Atlas full

    var new_shelf := { "y": shelf_y, "height": item_height, "x_cursor": item_width }
    _shelves.append(new_shelf)
    return Rect2i(0, shelf_y, item_width, item_height)

LOD Configuration (Godot)

# Configure LOD visibility ranges on MeshInstance3D nodes
@tool
class_name LODConfigurator extends EditorScript

# LOD ranges in meters from camera
const LOD_RANGES := [
    0.0,    # LOD0: full quality
    10.0,   # LOD1: starts at 10m
    25.0,   # LOD2: starts at 25m
    60.0,   # LOD3
Полный SKILL.md на GitHub

Установить asset-pipeline-patterns в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл asset-pipeline-patterns?

Asset pipeline patterns: Godot per-directory import overrides, a Unity AssetPostprocessor for texture standards, MaxRects atlas layout, Godot LOD configuration, audio import settings, and a CI asset validation script. Use when setting up or auditing how a game imports and compresses its assets.

Как установить скилл asset-pipeline-patterns?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл asset-pipeline-patterns запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить asset-pipeline-patterns с