Skip to content

Commit cc577a5

Browse files
authored
Update to version 0.3 (#4)
- Switch to using explorer command verbs for adding to the context menu. - Fix issue with packing to a glb from a special folder (e.g., Downloads) where it would open the destination folder in a new explorer window. - Add a Windows Application Packaging Project to enable submission to the Windows Store. - Add icons to context menu items.
1 parent 69e00a3 commit cc577a5

File tree

71 files changed

+1585
-847
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1585
-847
lines changed

.gitignore

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
.vs
2-
bin
3-
obj
4-
*.user
5-
/Source/packages
6-
/Source/Setup/Debug
7-
/Source/Setup/Release
1+
.vs
2+
Build
3+
*.aps
4+
*.user

Figures/Pack1.png

73.2 KB
Loading

Figures/Pack2.png

4.79 KB
Loading

Figures/Unpack1.png

60.1 KB
Loading

Figures/Unpack2.png

25.6 KB
Loading

Figures/Unpack3.png

250 Bytes
Loading

README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22
Microsoft Windows shell extensions that pack .gltf to .glb and unpack .glb to .gltf
33

44
# Installing
5-
1. Download the latest installer `glTF-Shell-Extensions.msi` from [Releases](https://github.com/bghgary/glTF-Shell-Extensions/releases).
6-
2. Unblock the installer file to avoid security warnings.
7-
3. Double-click the installer file.
5+
This tool is distributed through the Windows Store. Install the latest version [here](https://www.microsoft.com/store/apps/9NPGVJ9N57MV).
86

97
# Usage
108
## Packing `.gltf` to `.glb`
119

12-
Right-click on a `.gltf` file and select `Pack to Binary glTF...`.
10+
Right-click on a `.gltf` file and select `Pack to Binary glTF`.
1311

1412
![](/Figures/Pack1.png)
1513

@@ -19,7 +17,7 @@ Select a name for the new `.glb` file.
1917

2018
## Unpacking `.glb` to `.gltf`
2119

22-
Right-click on a `.glb` file and select `Unpack to glTF...`.
20+
Right-click on a `.glb` file and select `Unpack to glTF`.
2321

2422
![](/Figures/Unpack1.png)
2523

Source/Assets/App.png

15.9 KB
Loading

Source/Assets/Logo.ico

1.32 KB
Binary file not shown.

Source/Directory.Build.props

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project>
2+
<PropertyGroup>
3+
<BuildDir>$([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory)..))Build\$(MSBuildProjectName)\</BuildDir>
4+
5+
<BaseIntermediateOutputPath>$(BuildDir)obj\</BaseIntermediateOutputPath>
6+
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\$(Platform)\</IntermediateOutputPath>
7+
<OutputPath>$(BuildDir)bin\$(Configuration)\$(Platform)\</OutputPath>
8+
9+
<IntDir>$(IntermediateOutputPath)</IntDir>
10+
<OutDir>$(OutputPath)</OutDir>
11+
12+
<PlatformSpecificBundleArtifactsListDir>$(BuildDir)BundleArtifacts\</PlatformSpecificBundleArtifactsListDir>
13+
</PropertyGroup>
14+
</Project>

Source/ExplorerCommand/ClassFactory.h

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#pragma once
2+
3+
#include <Windows.h>
4+
#include <new>
5+
6+
template <typename T>
7+
class ClassFactory : public IClassFactory
8+
{
9+
public:
10+
static HRESULT CreateInstance(REFIID riid, void** ppv)
11+
{
12+
*ppv = nullptr;
13+
14+
ClassFactory* pClassFactory = new(std::nothrow) ClassFactory();
15+
if (pClassFactory == nullptr)
16+
{
17+
return E_OUTOFMEMORY;
18+
}
19+
20+
HRESULT hr = pClassFactory->QueryInterface(riid, ppv);
21+
pClassFactory->Release();
22+
return hr;
23+
}
24+
25+
ClassFactory()
26+
{
27+
DllAddRef();
28+
}
29+
30+
// IUnknown
31+
32+
IFACEMETHODIMP QueryInterface(REFIID riid, void** ppv)
33+
{
34+
IUnknown* punk = nullptr;
35+
36+
if (riid == __uuidof(IUnknown) || riid == __uuidof(IClassFactory))
37+
{
38+
punk = static_cast<IClassFactory*>(this);
39+
}
40+
41+
*ppv = punk;
42+
43+
if (punk == nullptr)
44+
{
45+
return E_NOINTERFACE;
46+
}
47+
48+
punk->AddRef();
49+
return S_OK;
50+
}
51+
52+
IFACEMETHODIMP_(ULONG) AddRef()
53+
{
54+
return InterlockedIncrement(&m_ref);
55+
}
56+
57+
IFACEMETHODIMP_(ULONG) Release()
58+
{
59+
LONG cRef = InterlockedDecrement(&m_ref);
60+
if (cRef == 0)
61+
{
62+
delete this;
63+
}
64+
return cRef;
65+
}
66+
67+
// IClassFactory
68+
69+
IFACEMETHODIMP CreateInstance(IUnknown* punkOuter, REFIID riid, void** ppv)
70+
{
71+
if (punkOuter != nullptr)
72+
{
73+
return CLASS_E_NOAGGREGATION;
74+
}
75+
76+
return T::CreateInstance(riid, ppv);
77+
}
78+
79+
IFACEMETHODIMP LockServer(BOOL fLock)
80+
{
81+
if (fLock)
82+
{
83+
DllAddRef();
84+
}
85+
else
86+
{
87+
DllRelease();
88+
}
89+
90+
return S_OK;
91+
}
92+
93+
private:
94+
~ClassFactory()
95+
{
96+
DllRelease();
97+
}
98+
99+
LONG m_ref{1};
100+
};

Source/ExplorerCommand/Dll.cpp

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#include "Dll.h"
2+
#include "ClassFactory.h"
3+
#include "ExplorerCommand.h"
4+
5+
namespace
6+
{
7+
long g_refModule = 0;
8+
}
9+
10+
void DllAddRef()
11+
{
12+
InterlockedIncrement(&g_refModule);
13+
}
14+
15+
void DllRelease()
16+
{
17+
InterlockedDecrement(&g_refModule);
18+
}
19+
20+
STDAPI_(BOOL) DllMain(HINSTANCE hInstance, DWORD dwReason, void*)
21+
{
22+
if (dwReason == DLL_PROCESS_ATTACH)
23+
{
24+
DisableThreadLibraryCalls(hInstance);
25+
}
26+
27+
return TRUE;
28+
}
29+
30+
STDAPI DllCanUnloadNow()
31+
{
32+
// Only allow the DLL to be unloaded after all outstanding references have been released
33+
return (g_refModule == 0) ? S_OK : S_FALSE;
34+
}
35+
36+
STDAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **ppv)
37+
{
38+
if (clsid == __uuidof(ExplorerCommand))
39+
{
40+
return ClassFactory<ExplorerCommand>::CreateInstance(riid, ppv);
41+
}
42+
43+
return CLASS_E_CLASSNOTAVAILABLE;
44+
}

Source/ExplorerCommand/Dll.def

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
EXPORTS
2+
DllCanUnloadNow PRIVATE
3+
DllGetClassObject PRIVATE

Source/ExplorerCommand/Dll.h

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#pragma once
2+
3+
#include <Windows.h>
4+
5+
void DllAddRef();
6+
void DllRelease();

0 commit comments

Comments
 (0)