Skip to content
Merged

0.9 #148

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@ endif::env-github,env-vscode[]

[NOTE]
====
この GDExtension は Godot Engine 4.3 以上で使用可能です。(4.1, 4.2 で使用したい場合は link:https://github.com/MizunagiKB/gd_cubism/tree/0.7-godot4.1[7.0-godot41] を使用してください)
この GDExtension は Godot Engine 4.3 以上で使用可能です。(4.1, 4.2 で使用したい場合は link:https://github.com/MizunagiKB/gd_cubism/releases/tag/v0.8.2-godot4.1[v0.8.2-godot4.1] を使用してください)
====

[IMPORTANT]
====
0.9から描画方法が直接描画に変わり、 Godot Engine の処理負荷と GPU メモリの消費を大幅に抑える事に成功しました。

一方でいくつか変更が生じています。最も大きな変更点は _GDCubismUserModel_ が _SubViewport_ ではなくなった点です。

以前と同じ様に扱いたい場合は、 _SubViewport_ の下に _GDCubismUserModel_ を配置してご利用ください。(この変更に関するデモとして demo_fade.tscn が追加されています)
====

GDCubism 内部ではLive2D社が公開している link:https://github.com/Live2D/CubismNativeFramework[Cubism Native Framework] を併用しています。
Expand Down
11 changes: 10 additions & 1 deletion README.en.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@ This software (GDCubism) is an **unofficial** GDExtension that makes the link:ht

[NOTE]
====
This GDExtension is available for use with Godot Engine 4.3 and above. (If you wish to use it with versions 4.1 or 4.2, please use link:https://github.com/MizunagiKB/gd_cubism/tree/0.7-godot4.1[7.0-godot41])
This GDExtension is available for use with Godot Engine 4.3 and above. (If you wish to use it with versions 4.1 or 4.2, please use link:https://github.com/MizunagiKB/gd_cubism/releases/tag/v0.8.2-godot4.1[v0.8.2-godot4.1])
====

[IMPORTANT]
====
Starting from version 0.9, the rendering method has been switched to direct rendering, significantly reducing the processing load on the Godot Engine and GPU memory consumption.

However, this change has introduced several modifications. The most notable change is that _GDCubismUserModel_ is no longer a _SubViewport_.

If you wish to handle it in the same manner as before, place the _GDCubismUserModel_ under a _SubViewport_. (As a demonstration of this change, the demo file `demo_fade.tscn` has been added.)
====

Internally, GDCubism uses the link:https://github.com/Live2D/CubismNativeFramework[Cubism Native Framework] published by Live2D Inc.
Expand Down
109 changes: 109 additions & 0 deletions demo/addons/gd_cubism/cs/gd_cubism_effect_custom_cs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp>
using System;
using Godot;
using Godot.NativeInterop;


#pragma warning disable CA1050


public partial class GDCubismEffectCustomCS : GDCubismEffectCS
{
private static readonly StringName NativeName = "GDCubismEffectCustom";

public GDCubismEffectCustomCS(Node o) : base(o) { }

public static readonly StringName CubismEpilogueName = "cubism_epilogue";
public static readonly StringName CubismInitName = "cubism_init";
public static readonly StringName CubismProcessName = "cubism_process";
public static readonly StringName CubismPrologueName = "cubism_prologue";
public static readonly StringName CubismTermName = "cubism_term";

// ------------------------------------------------------------ Property(s)
// -------------------------------------------------------------- Method(s)
// -------------------------------------------------------------- Signal(s)

public delegate void CubismEpilogueEventHandler(Node2D value, float delta);

private static void CubismEpilogueTrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret)
{
((CubismEpilogueEventHandler)delegateObj)(
VariantUtils.ConvertToGodotObject(args[0]) as Node2D,
VariantUtils.ConvertToFloat32(args[1])
);
ret = default;
}

public unsafe event CubismEpilogueEventHandler CubismEpilogue
{
add => this.InternalObject.Connect(CubismEpilogueName, Callable.CreateWithUnsafeTrampoline(value, &CubismEpilogueTrampoline));
remove => this.InternalObject.Disconnect(CubismEpilogueName, Callable.CreateWithUnsafeTrampoline(value, &CubismEpilogueTrampoline));
}

public delegate void CubismInitEventHandler(Node2D value);

private static void CubismInitrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret)
{
((CubismInitEventHandler)delegateObj)(
VariantUtils.ConvertToGodotObject(args[0]) as Node2D
);
ret = default;
}

public unsafe event CubismInitEventHandler CubismInit
{
add => this.InternalObject.Connect(CubismInitName, Callable.CreateWithUnsafeTrampoline(value, &CubismInitrampoline));
remove => this.InternalObject.Disconnect(CubismInitName, Callable.CreateWithUnsafeTrampoline(value, &CubismInitrampoline));
}

public delegate void CubsimPrologueEventHandler(Node2D value, float delta);

private static void CubismPrologueTrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret)
{
((CubsimPrologueEventHandler)delegateObj)(
VariantUtils.ConvertToGodotObject(args[0]) as Node2D,
VariantUtils.ConvertToFloat32(args[1])
);
ret = default;
}

public unsafe event CubsimPrologueEventHandler CubismPrologue
{
add => this.InternalObject.Connect(CubismPrologueName, Callable.CreateWithUnsafeTrampoline(value, &CubismPrologueTrampoline));
remove => this.InternalObject.Disconnect(CubismPrologueName, Callable.CreateWithUnsafeTrampoline(value, &CubismPrologueTrampoline));
}

public delegate void CubismProcessEventHandler(Node2D value, float delta);

private static void CubismProcessTrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret)
{
((CubismProcessEventHandler)delegateObj)(
VariantUtils.ConvertToGodotObject(args[0]) as Node2D,
VariantUtils.ConvertToFloat32(args[1])
);
ret = default;
}

public unsafe event CubismProcessEventHandler CubismProcess
{
add => this.InternalObject.Connect(CubismProcessName, Callable.CreateWithUnsafeTrampoline(value, &CubismProcessTrampoline));
remove => this.InternalObject.Disconnect(CubismProcessName, Callable.CreateWithUnsafeTrampoline(value, &CubismProcessTrampoline));
}

public delegate void CubismTermEventHandler(Node2D value);

private static void CubismTermrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret)
{
((CubismTermEventHandler)delegateObj)(
VariantUtils.ConvertToGodotObject(args[0]) as Node2D
);
ret = default;
}

public unsafe event CubismTermEventHandler CubismTerm
{
add => this.InternalObject.Connect(CubismTermName, Callable.CreateWithUnsafeTrampoline(value, &CubismTermrampoline));
remove => this.InternalObject.Disconnect(CubismTermName, Callable.CreateWithUnsafeTrampoline(value, &CubismTermrampoline));
}
}
55 changes: 0 additions & 55 deletions demo/addons/gd_cubism/example/custom_efx_01.cs

This file was deleted.

130 changes: 0 additions & 130 deletions demo/addons/gd_cubism/example/custom_efx_02.cs

This file was deleted.

39 changes: 0 additions & 39 deletions demo/addons/gd_cubism/example/custom_efx_02.gd

This file was deleted.

Loading