Jump to content

Recommended Posts

https://steamcommunity.com/sharedfiles/filedetails/?id=2898572674

Current template doesn't contains all layers!

Full layer list:

Spoiler

ARM_upper
BEARD
FX
FX halo
FX_fishing
FX_liquid
FX_splash
FX_webber_wipe
FX_wipe
HAIR
HAIR_HAT
LANTERN_OVERLAY
STRING
SWAP_BODY
SWAP_BODY_TALL
SWAP_FACE
SWAP_OBJECT
Smear new
arm_lower
arm_lower_cuff
arm_upper
arm_upper_skin
back_water
balloon_red
beard
bell01
board
boat_part
boat_wheel_round
boat_wheel_stick
body
book_closed
book_cook
book_open
brick
card
cbell
cheeks
dark_burst01
dark_center
dark_nightmare_fuel01
dark_spew
dark_squigle
dark_tendril_black
dark_tendril_white
drip_fx
eel_body
eel_eye
eel_fin
eel_head
eel_tail
emotefx
eyes
face
face_monkeyparts
fan01
fish01
fish_body
fish_eye
fish_fin
fish_head
fish_mouth
fish_tail
fishingline
flower
foot
fx_bubb
fx_droplet
fx_hit
fx_large
fx_leap_phase
fx_lunge_streak
fx_spit
fx_splat
fx_star_part
fx_wisp
giftbox
glow_2
hair
hair_hat
hairfront
hairpigtails
hand
hand_idle_wormwood
hand_wickerbottom
headbase
headbase_hat
headbase_transform
hit_2
horn01
hound_whistle01
lantern_overlay
leg
legs
machine_rope_comp
merm_hand
meter
meter_color2
page_flip
pan_flute01
pig_arm
pig_ear
pig_head
pig_leg
pig_torso
platform
prop_carolbook
prop_mug
prop_poop
prop_rope
ray
razor01
ripple_shadow
rope_joints
scale
scale_loop
scale_wrist
shadow_ball
shadow_hands
shoal_body
shoal_fin
shoal_head
skirt
slackrope
smol_bod
smol_fin
smol_fin_back
smol_head
smol_tail
snap_fx
snow
spider_repellent
spiralfx
splash
splash_pull
splode
sprk_1
sprks
stab_fx
superjump_groundcrack
superjump_groundlift
superjump_rubble1
superjump_rubble2
superjump_rubble3
superjump_smokering
superjump_spear_fx
superjump_speedline
swap_bedroll
swap_boat_hook
swap_boat_net
swap_body
swap_body_tall
swap_book_fx_over
swap_book_fx_under
swap_face
swap_frozen
swap_goo
swap_goosplat
swap_hat
swap_item
swap_item2
swap_object
swap_object_bernie
swap_pocket_scale_arrow
swap_pocket_scale_body
swap_shock_fx
tail
tear_fx
torso
torso_pelvis
torso_transform
warly_inhale_fx
watchprop_idle
water
water_ripple_front
water_shadow
wendy_idle_flower
wheel
wheelshine
whipline
wood_splinter
wooden_circles
woodenarm
wrap_paper
wrap_string
ww_head
ww_limb
ww_meathand
ww_shadow
ww_torso

Full animation list:

Spoiler

player_acting
player_actions
player_actions_axe
player_actions_blowdart
player_actions_boomerang
player_actions_bugnet
player_actions_cannon
player_actions_cowbell
player_actions_eat
player_actions_feast_eat
player_actions_fishing
player_actions_fishing_ocean
player_actions_item
player_actions_pickaxe
player_actions_pocket_scale
player_actions_reading
player_actions_reversedeath
player_actions_shovel
player_actions_slingshot
player_actions_uniqueitem
player_actions_unsaddle
player_actions_useitem
player_actions_whip
player_amulet_resurrect
player_amulet_resurrect_werebeaver
player_amulet_resurrect_weregoose
player_attack_leap
player_attack_prop
player_attacks
player_basic
player_boat
player_boat_channel
player_boat_hook
player_boat_jump
player_boat_jumpheavy
player_boat_plank
player_boat_sink
player_book_attack
player_bow
player_bush_hat
player_cave_enter
player_channel
player_cointoss
player_construct
player_emote_extra
player_emotes
player_emotes_dance0
player_emotes_dance2
player_emotes_sit
player_emotesxl
player_encumbered
player_encumbered_fast
player_encumbered_jump
player_frozen
player_groggy
player_hatdance
player_hideseek
player_hit_darkness
player_hit_spike
player_idles
player_idles_groggy
player_idles_lunacy
player_idles_shiver
player_idles_walter
player_idles_wanda
player_idles_warly
player_idles_wathgrithr
player_idles_waxwell
player_idles_webber
player_idles_wendy
player_idles_wes
player_idles_willow
player_idles_winona
player_idles_wolfgang_skinny
player_idles_wonkey
player_idles_woodie
player_idles_wormwood
player_idles_wortox
player_idles_wurt
player_idles_wx
player_jump
player_knockedout
player_knockedout_wickerbottom
player_lunge
player_mighty_gym
player_mime
player_mime2
player_monkey_change
player_monkey_run
player_multithrust
player_oar
player_one_man_band
player_pocketwatch_portal
player_receive_gift
player_revive_from_corpse
player_sandstorm
player_shock
player_skin_change
player_slurtle_armor
player_spider_repellent
player_spooked
player_staff
player_strum
player_superjump
player_teleport
player_tiptoe
player_tornado
player_townportal
player_transform_merm
player_wardrobe
player_wendy_commune
player_wolfgang
player_wolfgang_dumbbell
player_woodie
player_wormwood
player_wormwood_fertilizer
player_wrap_bundle
wurt_peruse

 

Edited by Rickzzs
  • Thanks 3
  • Big Ups 3

 

 

template.zip: original images

template.centered.7z: image cropped to make the pivot centered. Recommended if you are creating a mod character based on this template.

template.zip template_centered.zip

Edited by Rickzzs

New: ghost animation template. However, the ghost_HatCustom layer used by Maxwell is broken.

This template only takes into account non-DLC character ghosts. DLC contents are not extracted and thus omitted. But this really doesn't matter.

full layers:

ghost_hairpigtails
ghost_eyes
ghost_HatCustom
GHOST_HAT
ghost_ears
ghost_ears_lower
ghost_tail
ghost_FX
ghost_body
ghost_FX_HatCustom

Snipaste_2023-03-31_12-27-54.png.b6fd5ef25b6f72186066c3b6dbeaa412.png

player_ghost.zip

Edited by Rickzzs
  • Thanks 1

python 3 scripts that helps.

1.Make images transparent or not. Require ImageMagick.

Hide these layers > python transparent.py swap_hat swap_body headbase_hat

Show this layer > python transparent.py -r swap_hat

'''
图片透明
'''
import os
import shutil
import subprocess
import sys


def make_transparent(dir_path):
    if not os.path.exists(dir_path):
        print('Directory does not exist: ' + dir_path)
        return
    # create backup directory
    backup_dir = dir_path + '-old'
    if not os.path.exists(backup_dir):
        os.makedirs(backup_dir)

    # find all png files recursively
    png_files = []
    for root, dirs, files in os.walk(dir_path):
        for file in files:
            if file.endswith('.png'):
                png_files.append(os.path.join(root, file))

    # make each png file transparent and backup the original
    for png_file in png_files:
        basename = os.path.basename(png_file)
        backup_path = os.path.join(backup_dir, basename)
        shutil.copy2(png_file, backup_path)
        subprocess.call(['magick convert -alpha set -channel A -evaluate set 0% ', png_file, png_file])


def revert_dir(path):
    # get directory paths from command line arguments
    # find all backup files
    backup_dir = path + '-old'
    if not os.path.exists(backup_dir):
        print('Backup directory does not exist: ' + backup_dir)
        return
    backup_files = []
    for root, dirs, files in os.walk(backup_dir):
        for file in files:
            backup_files.append(os.path.join(root, file))

    # restore each backup file
    for backup_file in backup_files:
        basename = os.path.basename(backup_file)
        original_path = os.path.join(dir_path, basename)
        shutil.copy2(backup_file, original_path)

    # delete backup directory
    shutil.rmtree(backup_dir)


if __name__ == '__main__':
    if len(sys.argv) < 2:
        print('Usage: transparent.py [-r] dir1 dir2 ...')
        sys.exit(1)
    revert = sys.argv[1] == '-r'
    if revert:
        dir_paths = sys.argv[2:]
        for dir_path in dir_paths:
            revert_dir(dir_path)
    else:
        # get directory paths from command line arguments
        dir_paths = sys.argv[1:]
        for dir_path in dir_paths:
            make_transparent(dir_path)

2. Mark red pivot. require python lib Pillow.

Mark each image from a scml file with the image's pivot with a radius 4 red point > python mark.py player_acting.scml 4

"""
添加红点
"""
from PIL import Image
import numpy as np
import xml.etree.ElementTree as ET
import os
import sys


def mark(filename, radius=1):
    # Parse the .scml file
    tree = ET.parse(filename)
    root = tree.getroot()

    # Iterate through each file element
    for folder in root.iter("folder"):
        folder_name = folder.get("name")

        for file in folder.iter("file"):
            file_name = file.get("name") or ""
            file_path = os.path.join(os.path.dirname(filename), file_name).replace(
                "/", "\\"
            )
            # Read the image file

            # Open the image file using Pillow
            try:
                img_pil = Image.open(file_path, formats=["PNG"])
                if img_pil.mode != "RGBA":
                    img_pil = img_pil.convert("RGBA")

            # Convert the image to a numpy array
            except IOError:
                print("Error: cannot read image file: " + file_path)
                continue

            img = np.array(img_pil)
            # Get pivot_x and pivot_y
            pivot_x = int(float(file.get("pivot_x") or 0) * img.shape[1])
            pivot_y = int(float(file.get("pivot_y") or 0) * img.shape[0])

            # Add a red pixel at the pivot point
            for i in range(-radius, radius):
                for j in range(-radius, radius):
                    if i**2 + j**2 <= radius**2:
                        try:
                            img[pivot_y + j, pivot_x + i] = np.array([255, 0, 0, 255])
                        except IndexError:
                            pass

            # Save the modified image
            img_pil = Image.fromarray(img, mode="RGBA")
            img_pil.save(file_path)


if __name__ == "__main__":
    if len(sys.argv) < 2:
        print(
            "Usage: python mark.py [filename] [radius=1]\n Mark the pivot points of the Spriter project file (.scml)"
        )
        sys.exit(1)
    filename = sys.argv[1]
    radius = len(sys.argv) > 2 and int(sys.argv[2]) or 1
    mark(filename, radius)
Edited by Rickzzs

3. Crop Image

After you've done with Photoshop and other tools. Crop images to save space.

Crop a not totally transparent image and display which pivot it ends up > python crop.py hands/hands-0.png 0.1 0.9

And then you need to edit the pivot_x and pivot_y according to the result.

from PIL import Image
import sys


def crop(filename, x, y, nosave=False):
    # open image
    img = Image.open(filename)
    # 获取图片的 alpha 通道
    alpha = img.split()[-1]

    # 获取 alpha 通道中不透明的部分
    bbox = alpha.getbbox()

    # 裁剪图片
    img_cropped = img.crop(bbox)
    w, h = img.size
    w_, h_ = img_cropped.size
    wx = x * w
    hy = y * h
    bw = bbox[0]
    bh = bbox[1]
    x_final = (wx - bw) / w_
    y_final = (hy - bh) / h_
    y_final = 1 - y_final
    # 打印最终的红点坐标
    print(f"({x:.4f},{1-y:.4f})-> ({x_final:.4f}, {y_final:.4f})")
    # save image
    if not nosave:
        img_cropped.save(filename)


if __name__ == "__main__":
    if len(sys.argv) < 4:
        print(
            "Usage: python crop.py [filename] [pivot_x] [pivot_y] [nosave]\n Crop the image and calculate the new pivot point coordinates.\nnosave: do not crop image."
        )
        exit(1)
    im = sys.argv[1]
    px = float(sys.argv[2])
    x = px
    py = float(sys.argv[3])
    y = 1 - py
    nosave = len(sys.argv) > 4 and sys.argv[4][0] == "n"
    crop(im, x, y, nosave)

 

Edited by Rickzzs

Leave a comment here when 20231023.

What's Outdated:

1. After the Wonkey update, there are some new images of hands and feet and possibly tail. However, this template doesn't contain them. If you want your character to monkey-run, you need to build your own template.

2. The swap_face_eye_glow didn't survive the beta test. So it remains useless. Just ignore it.

3. Sitting update adds face-40 ( face-32/33 will have duration 8/7 now) and face-41 that is used by anim player_sit.zip, which includes an animation of sitting talking.

Note for artists:

1. It is advised to download template_centered.zip because if you use this template, you can enlarge/shrink the canvas from the center point of canvas, and you don't need to keep the ratio, that means you can freely adjust the canvas.

2. Every time you change the shape of an image, save a new scml file.

3. You may want to look at emotes_xxx.scml and player_idles.scml to best understand where each image is being used.

4. You can pick any of a scml file to compile. But remember to delete anim.bin in the archive afterwards. Actually the animation itself doesn't matter, so I will compile something like a two-framed very simple animation (a screenshot attached below).

All the folders necessary for a proper character build are listed here. Delete transparent folders and useless folders when you compile. Remind that if you delete a folder, you need to save a new scml file then, or the compilation will fail due to missing images.

Spoiler

swap_face

beard

face

hairfront

headbase_hat

headbase

skirt

torso

torso_pelvis

foot

leg

hair_hat

hair

hand

arm_upper

arm_upper_skin

arm_lower_cuff

arm_lower

hairpigtails

tail

cheeks

arm_upper

beard

Example of a very simple scml to compile

5. You may want to run my script 'cropscml.py' (provided here https://github.com/ZzzzzzzSkyward/DSTmodutils/blob/master/pyscripts/cropscml.py) if your images are too empty.

6. https://github.com/ZzzzzzzSkyward/DSTmodutils/blob/master/pyscripts/cli.py can be used for compilation. Simply run

python dstmodutils/pyscripts/cli.py xxx.scml -crop

Replace ' dstmodutils/pyscripts/cli.py' and 'xxx.scml' with the actual path of your files.

Edited by Rickzzs

Another tool is out now.

This one is dedicated to changing texture. So it is a good tool for making characters.

Tutorial:

  1. Have Windows 10 or higher version of system to run the exe inside animtool.zip. Otherwise you can download python script https://github.com/ZzzzzzzSkyward/DSTmodutils/tree/master/pyscripts
  2. Select a character you'd like to start with. For example wilson. Go to C:\Steam\steamapps\common\Don't Starve Together\data\anim\dynamic\, use the tool (either dsanimtool.exe or cli.py) to convert wilson.dyn to wilson.zip. Go to C:\Steam\steamapps\common\Don't Starve Together\data\databundles\anim_dynamic.zip, you can find another wilson.zip there. Extract atlas-0.tex and build.bin to a folder. Convert this folder into images and build.json.
  3. Download player_data.7z, extract to the same folder. Open index.html, load player_anim.json and your build. The build.json convert by the tool can be edited.
  4. Follow the instruction here how to change image size and pivot. If you want to load more than one build, you need to gather all image folders together, or specify in each build.json "Path":"where this build's image are located relative to the base folder/", for example, if you have a folder "wilson",
{"Path":"wilson/","Atlas":["atlas-0.tex"],"Symbol":{.................

5. When you are done. Use the tool to compile your folder with parameters of build.json and image folder. Like

dsanimtool.exe your_folder/character_name.json your_folder/

or

python pyscripts/cli.py character_name.json your_images/

Do not forget to change the json file name to your character name.

 

player_data.7z dsanimtool.zip

Edited by Rickzzs
  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...