Skip to content

Instantly share code, notes, and snippets.

View MichaelGatesDev's full-sized avatar
🐧

Michael Gates MichaelGatesDev

🐧
View GitHub Profile
@MichaelGatesDev
MichaelGatesDev / file.cpp
Last active January 24, 2022 12:37
Example of creating a local version of OnPossess for Unreal Engine 4
// in game instance header file
virtual void Init() override;
UFUNCTION()
void DispatchPawnControllerChange(APawn* InPawn, AController* InController);
// in game instance cpp file
void UVGameInstanceBase::Init()
{
Super::Init();
@MichaelGatesDev
MichaelGatesDev / gist:326da2b3e5fd76bf9977ad480d12caa3
Created January 23, 2022 02:03
Example of using RetrigerrableDelay in UE4
FLatentActionInfo Info;
Info.Linkage = 0;
Info.CallbackTarget = this;
Info.ExecutionFunction = "MyFunction"; // this function must be marked with UFUNCTION() or it will not be called!
Info.UUID = GetUniqueID();
UKismetSystemLibrary::RetriggerableDelay(GetWorld(), 0.2f, Info);
@MichaelGatesDev
MichaelGatesDev / remove_dupes.py
Created August 10, 2021 01:55
Remap & Remove Duplicate Materials + Textures in Blender
import bpy
# credit to https://blender.stackexchange.com/questions/75790/how-to-merge-around-300-duplicate-materials/229803#229803
# remove duplicate materials
def remove_duped_materials():
mats = bpy.data.materials
for mat in mats:
(original, _, ext) = mat.name.rpartition(".")
@MichaelGatesDev
MichaelGatesDev / export_each_action_with_rig_as_fbx.py
Created June 13, 2021 21:05
This will take each action that exists on the armature and export it with the armature with the file named as the action name. For use with Blender 2.91.
import bpy
import os
filepath = bpy.data.filepath
directory = os.path.dirname(filepath)
all_action_names = [a.name for a in bpy.data.actions]
def remove_all_actions_except(ignored):
@MichaelGatesDev
MichaelGatesDev / convert.bat
Last active June 13, 2021 21:07
Convert all files in the current directory to MP3 via FFMPEG
for %%f in (*.flac) do ffmpeg -i "%%f" -acodec libmp3lame -ab 312k "%%~nf.mp3"
@MichaelGatesDev
MichaelGatesDev / script.bat
Created December 29, 2016 13:23
Converts *.m4a to *.mp3 in the current folder (FFMPEG)
for %%f in (*.*) do ffmpeg -i "%%f" -acodec libmp3lame -ab 312k "%%f.mp3"