Source Filmmaker

Source Filmmaker

866 ratings
Directional Scale Controls (Stretching)
23
11
3
14
3
4
7
7
3
3
4
2
2
2
2
   
Award
Favorite
Favorited
Unfavorite
Script
Tags: SFM
File Size
Posted
Updated
17.904 KB
5 Mar, 2023 @ 2:10pm
7 Mar, 2023 @ 4:57pm
4 Change Notes ( view )

Subscribe to download
Directional Scale Controls (Stretching)

Description
This script adds xyz scale controls for selected dag.

Credits:
- Me
- Unknown Soldier aka @0TheSpy

Github: https://github.com/kumfc/sfm-tools/tree/master/directional-scale-controls


Important
- You should run this script from embedded python interpreter!
- Not compatible with Source 2 Filmmaker.
- Works with all models.

Installation
Just subscribe to this item!
Additionally, if you're familiar with Python - invoke Directional Scale Patch's main() from sfm_init.py so it will be executed automatically on startup.

Usage
To create controls, execute Directional Scale Controls from "DAG Utilities Menu" in dag (bone) submenu.

To display the scale changes, you should execute Directional Scale Patch script from Scripts menu (navbar) every time you restart SFM.

Known issues
Problem: Applying this script on multiple ancestor dags may cause FPS drops when posing their childs. E.g. applying it to spine3, spine4 and neck will cause some lags when posing the head. This happens because SFM has retarded expression handling in slider controls. However, it doesn't affect completed animation and happens only when you directly change pos/rot from the interface. Dags without such ancestors or from any other "Animation Set" in the session won't cause the FPS drops. Not really problematic until you want to rescale every bone in the model with poor CPU aboard.

Solution: This script has an unused function create_attr_slider_simple which creates slider without the use of an expression. Just swap function names with original create_attr_slider. This slider type, however, is limited to [0, 1] range and not remapable. To bypass this limit use Facial Flex Unlocker (which unlocks not only flexes but all sliders in general) or Graph Editor mode — not UI-friendly, but lag-free.



Problem: In order to minimize the effect from previous issue, I simplified the expression and by that sacrificed "Remap Slider Range" functionality.

Solution: Actually, with the use of master-scale you can stretch the dag up to 64 times in every direction, but if you want more, or, for some reason, negative values — use Facial Flex Unlocker or simply Graph Editor mode.



Problem: Directions on different bones even of single model are oriented differently. X may be Y or Z can be X in relation to the world.

Solution: Presented X Y Z is actually local bone orientation. That's not a bug.



Problem: Jigglebones (if there's any) of attached models (e.g. hats) will slightly distort after Undo (CTRL+Z) on scale controls.

Solution: Just hide-unhide the distorted model to normalize it.



Problem: Under some conditions RGB position/orientation controls (as well as skeleton) can be stretched and hardly usable. It started to happen after we added support for locked bones and attached cosmetics. Why? Because these 3D-controls are the very same kind of attached objects as hats.

Solution: We're still searching for a way to separate that effect. It seems unreasonable for us to revert the update, so you can change it manually if you want. Just comment these two lines (add # at the beginning):
line 325: mwrite(i_patch_skip_read_parent_override, patch_skip_read) line 371: mwrite(i_patch_rescale_2, patch_rescale_jump_2)

This will prevent the attached/locked elements from rescaling. If you still want them, don't comment these lines, but instead adapt to use Graph Editor mode or "yellow circle" controls.


This is a beta release. If you faced any bugs or issues not listed above - report it to the project's GitHub.

If you faced a crash, provide the screencast recording and essential steps to reproduce. If it affects specific models - write the model name and it's source. Double check that it happens ONLY when patch is applied and not a general SFM issue.

Includes:
sfm\dag\exact\count1\Directional_Scale_Controls.py
sfm\mainmenu\umfc\Directional_Scale_Patch.py
Popular Discussions View All (3)
10
5 Dec, 2023 @ 11:11pm
Beginner's Guide
CommanderCTC
3
14 Jun, 2023 @ 9:52pm
It disappears when you rotate :/
JIIINGJING
2
24 Nov, 2023 @ 2:00pm
Crashes on execution
Sabi.The.Afton(STA)
263 Comments
Doc_ock_rokc 11 Sep @ 5:12pm 
Hey! Great job figuring this out . I was attempting this at one point but lost all my progress when my old hdd exploded... its good to see sfm scripting is alive and well.
catnipped drugged cat 13 Jul @ 5:34pm 
hey man i know this is a dumb question but can you make a mod to add animation via import sequence i hope you know what i mean plz make this happen it would save so meany hours
Dr.M 10 Jun @ 5:01pm 
OK, I'VE JUST FOUND OUT HOW TO DO THIS:

Right click on your model.

Scroll down to where the individual bones are located.

Right click on the bone you want to edit.

From there, there will be a menu with the DAG utilities option.

Click that, and THAT'S where you find the directional scales controls.

hope this helps!
Victor the Dragon 14 Jan @ 2:32pm 
i try this too and nothing change...
👾 🅼 🅰❎👾 25 Dec, 2023 @ 9:40am 
Try using DAG utilities menu on specific bone and then add directional scale controls :robodance: You're welcome :x3:
Winkmyster 19 Dec, 2023 @ 6:01pm 
I get the rootTransform_scale
but no x y or z scales :/
Garth Hughes 11 Dec, 2023 @ 12:01am 
Bro, the fact that this exists is a godsend for more cartoonist animators like I'm looking to be. Now I can truly implement squash and stretch the way it should be. :steamthumbsup:
butterballs88 21 Nov, 2023 @ 3:07pm 
I think you do need Python for multiple scripts at startup (I don't use Python with SFM so can't help now--one day I might though--in the far future). I am not certain, however. If you find a way to use sfm_startup_script for multiple scripts, please let us know!
binarypenCH 21 Nov, 2023 @ 1:03pm 
is there a way to also run another script after directional_scale_patch.py using the -sfm_startup_script method or do i have to learn how to invoke the main() function of another python file from a python file?
butterballs88 21 Nov, 2023 @ 8:28am 
Another way to run the patch script at startup is by adding (with the quotes):

-sfm_startup_script "C:\Program Files (x86)\Steam\steamapps\common\SourceFilmmaker\game\workshop\scripts\sfm\mainmenu\umfc\directional_scale_patch.py"

to the launch options. You may need to change the directory in the command above if the script or SFM files are located elsewhere.
To access launch options , find SFM in your library on Steam, then click the gear icon at the far right, then click "Properties", then scoll all the down and paste the command above in the textbox.