Skip to content

Commit 6c8a593

Browse files
committed
[feat] getting package release ready
1 parent f56bffd commit 6c8a593

29 files changed

+3478
-359
lines changed

.gitignore

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# This .gitignore file should be placed at the root of your Unity project directory
2+
#
3+
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
4+
#
5+
/[Ll]ibrary/
6+
/[Tt]emp/
7+
/[Oo]bj/
8+
/[Bb]uild/
9+
/[Bb]uilds/
10+
/[Ll]ogs/
11+
/[Mm]emoryCaptures/
12+
13+
# Asset meta data should only be ignored when the corresponding asset is also ignored
14+
!/[Aa]ssets/**/*.meta
15+
16+
# Uncomment this line if you wish to ignore the asset store tools plugin
17+
# /[Aa]ssets/AssetStoreTools*
18+
19+
# Autogenerated Jetbrains Rider plugin
20+
[Aa]ssets/Plugins/Editor/JetBrains*
21+
22+
# Visual Studio cache directory
23+
.vs/
24+
25+
# Gradle cache directory
26+
.gradle/
27+
28+
# Autogenerated VS/MD/Consulo solution and project files
29+
ExportedObj/
30+
.consulo/
31+
*.csproj
32+
*.unityproj
33+
*.sln
34+
*.suo
35+
*.tmp
36+
*.user
37+
*.userprefs
38+
*.pidb
39+
*.booproj
40+
*.svd
41+
*.pdb
42+
*.mdb
43+
*.opendb
44+
*.VC.db
45+
46+
# Unity3D generated meta files
47+
*.pidb.meta
48+
*.pdb.meta
49+
*.mdb.meta
50+
51+
# Unity3D generated file on crash reports
52+
sysinfo.txt
53+
54+
# Builds
55+
*.apk
56+
57+
# Crashlytics generated file
58+
crashlytics-build.properties
59+
60+
.idea/
61+
62+
# Samples meta files
63+
**/Samples~.meta
64+
**/Samples.meta

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [0.1.0] - 21 February 2025
8+
- Initial Release

CHANGELOG.md.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/OllamaSupportWindow.cs

Lines changed: 101 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,131 @@
11
using UnityEditor;
22
using UnityEngine;
33
using System.Linq;
4-
using System.Diagnostics;
5-
using Debug = UnityEngine.Debug;
6-
using System.Text.RegularExpressions;
4+
using Debug = UnityEngine.Debug;
75

8-
public class OllamaSupportWindow : EditorWindow
6+
namespace Neocortex
97
{
10-
private OllamaSupport ollama;
11-
private Texture2D logo;
12-
13-
private int selectedModelIndex;
14-
15-
private bool isDownloading;
16-
17-
[MenuItem("Tools/Neocortex/Ollama Support")]
18-
public static void ShowWindow()
8+
public class OllamaSupportWindow : EditorWindow
199
{
20-
var window = GetWindow<OllamaSupportWindow>(false, "Neocortex Ollama Support", true);
21-
window.minSize = new Vector2(512, 352);
22-
window.maxSize = new Vector2(512, 352);
23-
}
10+
private OllamaSupport ollama;
11+
private Texture2D logo;
2412

25-
private void OnEnable()
26-
{
27-
ollama = new OllamaSupport();
28-
logo = Resources.Load<Texture2D>("Visuals/ollama_x_neocortex");
29-
ollama.CheckOllamaInstallation();
30-
ollama.CheckInstalledModels();
31-
ollama.SetPlatformDependedStrings();
32-
}
13+
private int selectedModelIndex;
3314

34-
private async void OnGUI()
35-
{
36-
if (logo)
15+
private bool isDownloading;
16+
17+
[MenuItem("Tools/Neocortex/Ollama Support")]
18+
public static void ShowWindow()
3719
{
38-
float x = (position.width - 512) / 2;
39-
GUILayout.BeginHorizontal();
40-
GUILayout.Space(x);
41-
GUILayout.Label(logo, GUILayout.Width(512), GUILayout.Height(132));
42-
GUILayout.Space(x);
43-
GUILayout.EndHorizontal();
20+
var window = GetWindow<OllamaSupportWindow>(false, "Neocortex Ollama Support", true);
21+
window.minSize = new Vector2(512, 352);
22+
window.maxSize = new Vector2(512, 352);
4423
}
45-
else
24+
25+
private void OnEnable()
4626
{
47-
EditorGUILayout.LabelField("Logo not found", EditorStyles.boldLabel, GUILayout.ExpandWidth(true));
27+
ollama = new OllamaSupport();
28+
logo = Resources.Load<Texture2D>("Visuals/ollama_x_neocortex");
29+
ollama.CheckOllamaInstallation();
30+
ollama.CheckInstalledModels();
31+
ollama.SetPlatformDependedStrings();
4832
}
4933

50-
EditorGUILayout.BeginVertical("Box");
51-
52-
EditorGUILayout.HelpBox("This window provides support for Ollama.\nClick the button below to download the necessary tools.", MessageType.Info);
53-
54-
string buttonMessage = ollama.IsOllamaInstalled ? "Ollama is Already Installed" : $"Download Ollama for {ollama.PlatformName}";
55-
56-
GUI.enabled = !ollama.IsOllamaInstalled;
57-
if (GUILayout.Button(buttonMessage, GUILayout.Height(30)))
34+
private async void OnGUI()
5835
{
59-
Application.OpenURL(ollama.DownloadUrl);
60-
}
61-
GUI.enabled = true;
36+
if (logo)
37+
{
38+
float x = (position.width - 512) / 2;
39+
GUILayout.BeginHorizontal();
40+
GUILayout.Space(x);
41+
GUILayout.Label(logo, GUILayout.Width(512), GUILayout.Height(132));
42+
GUILayout.Space(x);
43+
GUILayout.EndHorizontal();
44+
}
45+
else
46+
{
47+
EditorGUILayout.LabelField("Logo not found", EditorStyles.boldLabel, GUILayout.ExpandWidth(true));
48+
}
6249

63-
GUILayout.Space(10);
50+
EditorGUILayout.BeginVertical("Box");
6451

65-
EditorGUILayout.HelpBox(
66-
"At least 8 GB RAM is needed for 7B models, 16 GB for 13B models, and 32 GB for 33B models." +
67-
$"\nCurrent Device: VRAM: {SystemInfo.graphicsMemorySize / 1024f:F1} GB, RAM: {SystemInfo.systemMemorySize / 1024f:F1} GB",
68-
MessageType.Warning);
52+
EditorGUILayout.HelpBox(
53+
"This window provides support for Ollama.\nClick the button below to download the necessary tools.",
54+
MessageType.Info);
6955

70-
selectedModelIndex = EditorGUILayout.Popup("Select Model:", selectedModelIndex, ollama.Models.Select(m => m.DisplayName).ToArray());
56+
string buttonMessage = ollama.IsOllamaInstalled
57+
? "Ollama is Already Installed"
58+
: $"Download Ollama for {ollama.PlatformName}";
7159

72-
bool isSelectedModelDownloaded = ollama.Models[selectedModelIndex].isDownloaded;
73-
GUI.enabled = !isSelectedModelDownloaded;
74-
if (GUILayout.Button("Download Model", GUILayout.Height(30)))
75-
{
76-
if (isDownloading)
60+
GUI.enabled = !ollama.IsOllamaInstalled;
61+
if (GUILayout.Button(buttonMessage, GUILayout.Height(30)))
7762
{
78-
Debug.LogWarning("A download is already in progress.");
63+
Application.OpenURL(ollama.DownloadUrl);
7964
}
80-
else
65+
66+
GUI.enabled = true;
67+
68+
GUILayout.Space(10);
69+
70+
EditorGUILayout.HelpBox(
71+
"At least 8 GB RAM is needed for 7B models, 16 GB for 13B models, and 32 GB for 33B models." +
72+
$"\nCurrent Device: VRAM: {SystemInfo.graphicsMemorySize / 1024f:F1} GB, RAM: {SystemInfo.systemMemorySize / 1024f:F1} GB",
73+
MessageType.Warning);
74+
75+
GUI.enabled = ollama.IsOllamaInstalled;
76+
selectedModelIndex = EditorGUILayout.Popup("Select Model:", selectedModelIndex,
77+
ollama.Models.Select(m => m.DisplayName).ToArray());
78+
GUI.enabled = true;
79+
80+
bool isSelectedModelDownloaded = ollama.Models[selectedModelIndex].isDownloaded;
81+
GUI.enabled = !isSelectedModelDownloaded && ollama.IsOllamaInstalled;
82+
if (GUILayout.Button("Download Model", GUILayout.Height(30)))
8183
{
82-
EditorApplication.update += UpdateProgressBar;
83-
isDownloading = true;
84-
ollama.DownloadModel(selectedModelIndex, () =>
84+
if (isDownloading)
8585
{
86-
isDownloading = false;
87-
ollama.CheckInstalledModels();
88-
});
86+
Debug.LogWarning("A download is already in progress.");
87+
}
88+
else
89+
{
90+
EditorApplication.update += UpdateProgressBar;
91+
isDownloading = true;
92+
ollama.DownloadModel(selectedModelIndex, () =>
93+
{
94+
isDownloading = false;
95+
ollama.CheckInstalledModels();
96+
});
97+
}
8998
}
90-
}
91-
GUI.enabled = true;
92-
93-
GUI.enabled = isSelectedModelDownloaded;
94-
if (GUILayout.Button("Delete Model", GUILayout.Height(30)))
95-
{
96-
ollama.DeleteModel(selectedModelIndex);
97-
ollama.CheckInstalledModels();
98-
}
99-
GUI.enabled = true;
10099

101-
EditorGUILayout.EndVertical();
102-
}
103-
104-
private void UpdateProgressBar()
105-
{
106-
if (isDownloading)
107-
{
108-
if (EditorUtility.DisplayCancelableProgressBar("Downloading Model", ollama.ProgressText, ollama.ProgressValue))
100+
GUI.enabled = true;
101+
102+
GUI.enabled = isSelectedModelDownloaded && ollama.IsOllamaInstalled;
103+
if (GUILayout.Button("Delete Model", GUILayout.Height(30)))
109104
{
110-
isDownloading = false;
111-
ollama.CancelRequest();
105+
ollama.DeleteModel(selectedModelIndex);
106+
ollama.CheckInstalledModels();
112107
}
108+
109+
GUI.enabled = true;
110+
111+
EditorGUILayout.EndVertical();
113112
}
114-
else
113+
114+
private void UpdateProgressBar()
115115
{
116-
EditorUtility.ClearProgressBar();
116+
if (isDownloading)
117+
{
118+
if (EditorUtility.DisplayCancelableProgressBar("Downloading Model", ollama.ProgressText,
119+
ollama.ProgressValue))
120+
{
121+
isDownloading = false;
122+
ollama.CancelRequest();
123+
}
124+
}
125+
else
126+
{
127+
EditorUtility.ClearProgressBar();
128+
}
117129
}
118130
}
119-
}
131+
}

LICENSE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
=====================
3+
4+
Copyright © 2025 Neocortex
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

LICENSE.md.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Neocortex Unity SDK Ollama Support
2+
The Neocortex Unity SDK is a Unity package that allows you to easily integrate Neocortex into your Unity project.
3+
The SDK provides a set of APIs that allow you to interact with the projects created on the Neocortex web platform.
4+
5+
Register and create a Neocortex account here: https://neocortex.link/register
6+
You can find more about the Unity SDK integration here in our documentatons: https://neocortex.link/docs/integrations/unity/quick-start
7+
8+
## Requirements
9+
- Neocortex Unity SDK [Download Here](https://neocortex.link/register)
10+
- Unity 2021.3 or above [Download Here](https://unity3d.com/get-unity/download)
11+
- Git version control system [Download Here](https://git-scm.com/download)
12+
13+
## How to Use
14+
- Open the editor window via `Tools > Neocortex > Ollama Support`
15+
- Download and install Ollama
16+
- Select the model you want to Use
17+
- Import the sample scene and try it!
18+
19+
## Sample Projects
20+
You can find sample projects that demonstrate how to use the Neocortex Unity SDK Ollama Support in the Package Manager window under the `Samples` section of the Neocortex Ollama Support package.

README.md.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/Data.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/Data/ModelInfo.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace Neocortex.Data
2+
{
3+
public class ModelInfo
4+
{
5+
public string model;
6+
public string parameters;
7+
public string size;
8+
public string name;
9+
public bool isDownloaded;
10+
11+
public string DisplayName => $"{model} {parameters} ({size}) {(isDownloaded ? " [Downloaded]" : "")}";
12+
}
13+
}

0 commit comments

Comments
 (0)