Skip to content

Instantly share code, notes, and snippets.

@nickdarnell
nickdarnell / .json
Created March 12, 2017 17:50
Example Comparison Metadata
{
"name": "Lit",
"context": "CornellBox",
"id": "1367BFE5497BA28C35AAFBBCB6C661C0",
"commit": "3251525",
"width": 1920,
"height": 1080,
"rhi": "D3D11",
"platform": "Windows",
"featureLevel": "SM5",
@nickdarnell
nickdarnell / CreateWidgetWithPostModifyLambda.h
Created January 3, 2016 03:04
Shows how to construct UUserWidget and modify it before it's fully initialized.
template< class T >
T* CreateWidget(UGameInstance* OwningGame, UClass* UserWidgetClass, TFunctionRef<void(T*)> PostNewModify)
{
UUserWidget* NewWidget = NewObject<UUserWidget>(OwningGame, UserWidgetClass);
if ( ULocalPlayer* Player = OwningGame->GetFirstGamePlayer() )
{
NewWidget->SetPlayerContext(FLocalPlayerContext(Player));
}
void SolutionOpened()
{
string slnFile = mdte.Solution.FullName;
string solutionDirectory = Path.GetDirectoryName(slnFile);
string pathfileName = Path.GetFileNameWithoutExtension(slnFile) + ".autoexp";
string patchFile = Path.Combine(solutionDirectory, pathfileName);
if(File.Exists(patchFile))
{
string autoExpPatch = File.ReadAllText(patchFile);
// Must hold a reference to the solution events object or the events wont
// fire, garbage collection related
msolutionEvents = mdte.Events.SolutionEvents;
msolutionEvents.Opened += SolutionOpened;
msolutionEvents.AfterClosing += SolutionAfterClosing;
// Most of the events you'll find useful are catagoried under
// DTE.Events...
// --- Microsoft.VisualStudio.VSConstants.UICONTEXT_NoSolution
[ProvideAutoLoad("ADFC4E64-0397-11D1-9F4E-00A0C911004F")]
public sealed class AutoExpPatchPackage : Package
{
//...
}
[AutoExpand]   TestStruct =x=<x,g>, y=<y,g>, z=<z,g>
public sealed class MyPackage : Package
{
private DTE mdte;
protected override void Initialize()
{
// Your package is also a service container IServiceContainer
serviceContainer = this as IServiceContainer;
// The DTE object contains most of the goodies you'll want to play with
mdte = serviceContainer.GetService(typeof(SDTE))as DTE;
SolidColorBrush current = SystemColors.HighlightBrush;
FieldInfo colorCacheField = typeof(SystemColors).GetField("_colorCache",
BindingFlags.Static | BindingFlags.NonPublic);
Color[] _colorCache = (Color[])colorCacheField.GetValue(typeof(SystemColors));
_colorCache[14] = Color.FromArgb(0xFF, 0xFF, 0x00, 0x00);
<local:Overlay>
<ListBox />
<local:Overlay.OverlayContent>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center">Loading!</TextBlock>
</local:Overlay.OverlayContent>
</local:Overlay>
<Style TargetType="{x:Type local:Overlay}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ContentControl}">
<AdornerDecorator x:Name="PART_OverlayAdorner">
<ContentPresenter/>
</AdornerDecorator>
</ControlTemplate>
</Setter.Value>
</Setter>