Skip to content

Instantly share code, notes, and snippets.

View johnfredcee's full-sized avatar
🚀
On an intergalactic cruise

John Connors johnfredcee

🚀
On an intergalactic cruise
View GitHub Profile
@johnfredcee
johnfredcee / unreal_polygroups.py
Created August 25, 2024 14:19
Using Geometry Scripting Polygroups with Unreal in Python
polygroup_ids = unreal.GeometryScriptIndexList()
print(polygroup_ids.convert_index_list_to_array())
polygroup_ids_out = unreal.GeometryScript_PolyGroups.get_all_triangle_polygroup_i_ds(dmesh, group_layer, polygroup_ids)
polygroup_ids = polygroup_ids_out[1]
print(polygroup_ids.convert_index_list_to_array())
@johnfredcee
johnfredcee / GenerateSplineComponent.cpp
Created November 12, 2023 10:32
Creating and populating a spline component at runtime in C++ in Unreal
/**
* Generate a spline we will later use to extrue a road from a set of points
*/
void ARoadNetwork::GenerateRoadSplines(const TArray<FVector>& InPoints)
{
// SplineBeingEdited is an Editor Only property we use to see our new component
// in the details panel as it won't show up otherwise
#if WITH_EDITORONLY_DATA
if (SplineBeingEdited == nullptr)
{
@johnfredcee
johnfredcee / PolylineEditorWidget.cpp
Last active October 26, 2023 10:39
UMG Polyline Editor WIdget Body
// Copyright (C) John Connors 2023
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
@johnfredcee
johnfredcee / PolylineEditorWidget.h
Last active October 26, 2023 10:35
UMG Polyline Editor Widget Header
// Copyright (C) John Connors 2023
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
@johnfredcee
johnfredcee / SPolylineEditor.cpp
Last active October 26, 2023 10:30
Slate Polyline Editor Control
// Copyright (C) John Connors 2023
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
@johnfredcee
johnfredcee / SPolylineEditor.h
Last active October 26, 2023 10:31
Slate Polyline Editor Control
// Copyright (C) John Connors 2023
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
$scope = "Process"
$pathElements = @([Environment]::GetEnvironmentVariable("PATH", $scope) -split ";")
$pathElements += "D:\Dev\msys64\mingw64\bin"
$pathElements += "D:\Dev\msys64\usr\bin"
$newPath = $pathElements -join ";"
[Environment]::SetEnvironmentVariable("PATH", $newPath, $scope)
[System.Diagnostics.Process]::Start("D:\Apps\emacs\bin\runemacs.exe", "--debug-init");
@johnfredcee
johnfredcee / Nez.DotnetCore.csproj
Created September 2, 2020 15:45
Project file to build Nez with dotnetcore3.1
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>Nez</AssemblyName>
<RootNamespace>Nez</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineConstants>TRACE;DEBUG</DefineConstants>
@johnfredcee
johnfredcee / dotnet.csproj
Last active September 2, 2020 15:43
Monogame App csproj using local dlls for dotnet core3.1
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PublishReadyToRun>false</PublishReadyToRun>
<TieredCompilation>false</TieredCompilation>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
@johnfredcee
johnfredcee / vec.cpp
Last active September 23, 2019 16:00
C++17 generic vector class
#include <cstddef>
#include <array>
#include <tuple>
template <typename T, std::size_t N>
struct Vec
{
std::array<T, N> m;