Skip to content

Instantly share code, notes, and snippets.

Avatar
🐧

Michael Gates MichaelGatesDev

🐧
View GitHub Profile
@MichaelGatesDev
MichaelGatesDev / file.cpp
Last active Jan 24, 2022
Example of creating a local version of OnPossess for Unreal Engine 4
View file.cpp
// 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 Jan 23, 2022
Example of using RetrigerrableDelay in UE4
View gist:326da2b3e5fd76bf9977ad480d12caa3
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 Aug 10, 2021
Remap & Remove Duplicate Materials + Textures in Blender
View remove_dupes.py
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 Jun 13, 2021
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.
View export_each_action_with_rig_as_fbx.py
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 Jun 13, 2021
Convert all files in the current directory to MP3 via FFMPEG
View convert.bat
for %%f in (*.flac) do ffmpeg -i "%%f" -acodec libmp3lame -ab 312k "%%~nf.mp3"
@MichaelGatesDev
MichaelGatesDev / script.bat
Created Dec 29, 2016
Converts *.m4a to *.mp3 in the current folder (FFMPEG)
View script.bat
for %%f in (*.*) do ffmpeg -i "%%f" -acodec libmp3lame -ab 312k "%%f.mp3"