Skip to content

Art-Net・DMX関連を実装とチュートリアルの削除 - #3

Merged
otoyuzu705 merged 20 commits into
devfrom
feat/art-net
Mar 13, 2026
Merged

Art-Net・DMX関連を実装とチュートリアルの削除#3
otoyuzu705 merged 20 commits into
devfrom
feat/art-net

Conversation

@otoyuzu705

@otoyuzu705 otoyuzu705 commented Mar 11, 2026

Copy link
Copy Markdown
Owner

Art-Net受信用コンポーネント
Assets/Core/Network/ArtNetReceiver.cs

DMXチャンネルの管理用クラス
Assets/Core/Network/DmxBuffer.cs

DMXチャンネルの値をグリッド形式で視覚化するエディターツール
Assets/Editor/Windows/DmxMonitorWindow.cs

Unity標準のTutorialInfoを削除

@otoyuzu705 otoyuzu705 changed the title Art-Net/関連を実装 Art-Net・DMX関連を実装 Mar 11, 2026
@otoyuzu705 otoyuzu705 changed the title Art-Net・DMX関連を実装 Art-Net・DMX関連を実装とチュートリアルの削除 Mar 11, 2026
@otoyuzu705
otoyuzu705 requested a review from Copilot March 11, 2026 23:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes Unity HDRP template/tutorial “Readme” assets and introduces an Art-Net DMX receive pipeline with an Editor DMX monitoring window, plus small scene/settings updates to support it.

Changes:

  • Removed Assets/TutorialInfo/* readme/editor/layout assets from the Unity template.
  • Added Core.Network.ArtNetReceiver + DmxBuffer and placed an ArtNetReceiver GameObject into OutdoorsScene.
  • Added an EditorWindow (DmxMonitorWindow) to visualize DMX values during Play Mode; adjusted sky/fog profile parameters.

Reviewed changes

Copilot reviewed 20 out of 23 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
LightVisualizer/Assets/TutorialInfo/Scripts/Readme.cs.meta Removes template readme script meta.
LightVisualizer/Assets/TutorialInfo/Scripts/Readme.cs Removes template Readme ScriptableObject type.
LightVisualizer/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.cs.meta Removes template custom editor meta.
LightVisualizer/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.cs Removes template readme inspector/auto-layout editor script.
LightVisualizer/Assets/TutorialInfo/Layout.wlt.meta Removes template layout meta.
LightVisualizer/Assets/TutorialInfo/Layout.wlt Removes template editor layout.
LightVisualizer/Assets/TutorialInfo/Icons/Help_Icon.png.meta Removes template icon meta.
LightVisualizer/Assets/TutorialInfo/Icons/HDRP.png.meta Removes template icon meta.
LightVisualizer/Assets/Settings/SkyandFogSettingsProfile.asset Updates HDRP sky/fog profile parameters.
LightVisualizer/Assets/OutdoorsScene.unity Adds an ArtNetReceiver GameObject to the scene.
LightVisualizer/Assets/Editor/Windows/DmxMonitorWindow.cs.meta Adds meta for the DMX monitor editor window script.
LightVisualizer/Assets/Editor/Windows/DmxMonitorWindow.cs Adds an EditorWindow to display DMX channels in Play Mode.
LightVisualizer/Assets/Editor/Windows.meta Folder meta update for Assets/Editor/Windows.
LightVisualizer/Assets/Editor.meta Folder meta update for Assets/Editor.
LightVisualizer/Assets/Core/Network/DmxBuffer.cs.meta Adds meta for the DMX buffer script.
LightVisualizer/Assets/Core/Network/DmxBuffer.cs Adds buffer/storage for multi-universe DMX data with locking.
LightVisualizer/Assets/Core/Network/ArtNetReceiver.cs.meta Adds meta for the Art-Net receiver script.
LightVisualizer/Assets/Core/Network/ArtNetReceiver.cs Adds UDP Art-Net receive thread and DMX packet parsing.
LightVisualizer/Assets/Core/Network.meta Folder meta update for Assets/Core/Network.
LightVisualizer/Assets/Core.meta Folder meta update for Assets/Core.
LightVisualizer/.idea/.idea.LightVisualizer/.idea/copilot.data.migration.ask2agent.xml Adds IDE state/config related to Copilot migration.
Files not reviewed (1)
  • LightVisualizer/.idea/.idea.LightVisualizer/.idea/copilot.data.migration.ask2agent.xml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread LightVisualizer/Assets/Core/Network/DmxBuffer.cs Outdated
Comment on lines +101 to +124
private void ProcessPacket(byte[] data)
{
if (data == null) return;

// ヘッダーの検証
for (int i = 0; i < 8; i++)
{
if (data[i] != _artNetHeader[i]) return;
}

// OpCodeの検証
ushort opCode = BitConverter.ToUInt16(data, 8);
if (opCode != 0x5000) return; // ArtDMXパケットのみ処理

// ユニバースの計算
int universe = data[14] | (data[15] << 8);

int length = (data[16] << 8) | data[17];
if (length > 512) return;

// DMXデータの更新
byte[] dmxData = new byte[length];
Buffer.BlockCopy(data, 18, dmxData, 0, length);

Copilot AI Mar 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ProcessPacket reads fixed offsets (0..17) and copies from offset 18 without first validating data.Length. A short/invalid UDP packet will cause IndexOutOfRangeException or ArgumentException during BlockCopy. Add minimum-length checks (and ensure data.Length >= 18 + length) before accessing these indices.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Comment thread LightVisualizer/Assets/Core/Network/ArtNetReceiver.cs Outdated
Comment on lines +94 to +104
{
int index = startIndex + row * columns + col;
byte value = index < dmxData.Length ? dmxData[index] : (byte)0;

GUIStyle cellStyle = new GUIStyle(GUI.skin.box)
{
fixedWidth = 30,
fixedHeight = 30,
alignment = TextAnchor.MiddleCenter,
};
cellStyle.normal.textColor = Color.white;

Copilot AI Mar 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DrawDmxGrid allocates a new GUIStyle for every cell on every repaint (512 allocations per universe per frame), which will create avoidable GC churn in the Editor. Cache/reuse a single cell style (or a small set of styles) instead of constructing it inside the inner loop.

Copilot uses AI. Check for mistakes.
Comment on lines +57 to +63
// DMXデータを取得
byte[] dmxData = receiver.DmxBuffer.GetDmxDataSnapshot();

// 選択されたユニバースの開始インデックス
int startIndex = _selectedUniverse * DmxBuffer.ChannelsPerUniverse;

DrawDmxGrid(dmxData, startIndex);

Copilot AI Mar 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetDmxDataSnapshot() allocates a full copy of the DMX buffer each OnGUI call; combined with Repaint() every frame this can generate steady GC pressure. Consider returning a reused buffer, a per-universe snapshot, or exposing a read-only view with locking so the window can render without allocating every frame.

Copilot uses AI. Check for mistakes.
Comment on lines +76 to +92
// ヘッダー行の描画
EditorGUILayout.BeginHorizontal();
for (int col = 0; col < columns; col++)
{
GUILayout.Label($"Column {col + 1}", EditorStyles.centeredGreyMiniLabel, GUILayout.Width(30));
}
EditorGUILayout.EndHorizontal();

// DMXチャンネルの描画
for (int row = 0; row < rows; row++)
{
EditorGUILayout.BeginHorizontal();

// 行の先頭チャンネル番号
int startChannel = row * columns + 1;
GUILayout.Label($"{startChannel:000}", EditorStyles.boldLabel, GUILayout.Width(40));

Copilot AI Mar 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The header row draws 32 column labels, but each data row also renders an extra leading channel-number label, causing the grid to be visually misaligned. Add an empty/header cell (matching the 40px width) or otherwise account for the row-label column so columns line up.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Comment on lines +24 to +28
private void Awake()
{
this.DmxBuffer = new DmxBuffer();
}

Copilot AI Mar 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR removes the Readme ScriptableObject script and HDRP tutorial icon assets, but Assets/Readme.asset still references the deleted script GUID (fcf7219...) and icon GUID (d19680...). This will produce a missing-script asset on import. Either delete Assets/Readme.asset or update it to a remaining script/icon.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Comment on lines +1 to +6
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Ask2AgentMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project> No newline at end of file

Copilot AI Mar 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copilot.data.migration.ask2agent.xml looks like a local JetBrains/Rider state file rather than project source. Consider adding it to the appropriate .idea/.gitignore (or repo root .gitignore) and removing it from version control to avoid churn across developers.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

otoyuzu705 and others added 3 commits March 12, 2026 08:49
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Copilot AI commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

@otoyuzu705 I've opened a new pull request, #4, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 3 commits March 13, 2026 02:53
…angeException

Co-authored-by: otoyuzu705 <107416827+otoyuzu705@users.noreply.github.com>
Guard ProcessPacket against short/malformed UDP packets

Copilot AI commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

@otoyuzu705 I've opened a new pull request, #5, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits March 13, 2026 03:16
…add to .gitignore

Co-authored-by: otoyuzu705 <107416827+otoyuzu705@users.noreply.github.com>

Copilot AI commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

@otoyuzu705 I've opened a new pull request, #6, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits March 13, 2026 03:19
Co-authored-by: otoyuzu705 <107416827+otoyuzu705@users.noreply.github.com>

Copilot AI commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

@otoyuzu705 I've opened a new pull request, #7, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: otoyuzu705 <107416827+otoyuzu705@users.noreply.github.com>
Remove JetBrains Rider local state file from version control
Delete Readme.asset with dangling GUID references
Fix DMX monitor grid header misalignment
@otoyuzu705
otoyuzu705 merged commit f521990 into dev Mar 13, 2026
@otoyuzu705
otoyuzu705 deleted the feat/art-net branch March 13, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants