Skip to content
Merged

0.9.1 #151

Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 3 additions & 4 deletions demo/addons/gd_cubism/cs/gd_cubism_effect_custom_cs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2023 MizunagiKB <mizukb@live.jp>
using System;
using Godot;
using Godot.NativeInterop;

Expand All @@ -24,7 +23,7 @@ public GDCubismEffectCustomCS(Node o) : base(o) { }
// -------------------------------------------------------------- Method(s)
// -------------------------------------------------------------- Signal(s)

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

private static void CubismEpilogueTrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret)
{
Expand Down Expand Up @@ -57,7 +56,7 @@ public unsafe event CubismInitEventHandler CubismInit
remove => this.InternalObject.Disconnect(CubismInitName, Callable.CreateWithUnsafeTrampoline(value, &CubismInitrampoline));
}

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

private static void CubismPrologueTrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret)
{
Expand All @@ -74,7 +73,7 @@ public unsafe event CubsimPrologueEventHandler CubismPrologue
remove => this.InternalObject.Disconnect(CubismPrologueName, Callable.CreateWithUnsafeTrampoline(value, &CubismPrologueTrampoline));
}

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

private static void CubismProcessTrampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret)
{
Expand Down
2 changes: 1 addition & 1 deletion demo/addons/gd_cubism/cs/gd_cubism_user_model_cs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public float SpeedScale
/// Please specify a value of 0.0 or more for delta.
/// </summary>
/// <param name="delta">The time to progress the animation.</param>
public void Advance(float delta)
public void Advance(double delta)
{
this.InternalObject.Call("advance", delta);
}
Expand Down
2 changes: 1 addition & 1 deletion demo/addons/gd_cubism/example/demo_effect_custom_02.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public override void _Process(double delta)
recalc_model_position(this.cubism_model);
}

private void _on_cubism_process(Node2D model, float delta)
private void _on_cubism_process(Node2D model, double delta)
{
const int ARRAY_VERTEX = (int)ArrayMesh.ArrayType.Vertex;

Expand Down
2 changes: 1 addition & 1 deletion demo/addons/gd_cubism/example/demo_effect_custom_03.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private void _on_cubism_term(Node2D _model)
this.history_position = 0;
}

private void _on_cubism_process(Node2D _model, float delta)
private void _on_cubism_process(Node2D _model, double delta)
{
if (this.lipsync_ready == false) return;

Expand Down
6 changes: 3 additions & 3 deletions src/gd_cubism_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ void GDCubismEffect::_cubism_term(InternalCubismUserModel* model) {
}


void GDCubismEffect::_cubism_prologue(InternalCubismUserModel* model, const float delta) {}
void GDCubismEffect::_cubism_process(InternalCubismUserModel* model, const float delta) {}
void GDCubismEffect::_cubism_epilogue(InternalCubismUserModel* model, const float delta) {}
void GDCubismEffect::_cubism_prologue(InternalCubismUserModel* model, const double delta) {}
void GDCubismEffect::_cubism_process(InternalCubismUserModel* model, const double delta) {}
void GDCubismEffect::_cubism_epilogue(InternalCubismUserModel* model, const double delta) {}


void GDCubismEffect::_enter_tree() {
Expand Down
6 changes: 3 additions & 3 deletions src/gd_cubism_effect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class GDCubismEffect : public Node {

virtual void _cubism_init(InternalCubismUserModel* model);
virtual void _cubism_term(InternalCubismUserModel* model);
virtual void _cubism_prologue(InternalCubismUserModel* model, const float delta);
virtual void _cubism_process(InternalCubismUserModel* model, const float delta);
virtual void _cubism_epilogue(InternalCubismUserModel* model, const float delta);
virtual void _cubism_prologue(InternalCubismUserModel* model, const double delta);
virtual void _cubism_process(InternalCubismUserModel* model, const double delta);
virtual void _cubism_epilogue(InternalCubismUserModel* model, const double delta);

void _enter_tree() override;
void _exit_tree() override;
Expand Down
2 changes: 1 addition & 1 deletion src/gd_cubism_effect_breath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class GDCubismEffectBreath : public GDCubismEffect {
this->_initialized = false;
}

virtual void _cubism_process(InternalCubismUserModel* model, const float delta) override {
virtual void _cubism_process(InternalCubismUserModel* model, const double delta) override {
if(this->_initialized == false) return;
if(this->_active == false) return;
if(this->_breath == nullptr) return;
Expand Down
6 changes: 3 additions & 3 deletions src/gd_cubism_effect_custom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ class GDCubismEffectCustom : public GDCubismEffect {
this->_initialized = false;
}

virtual void _cubism_prologue(InternalCubismUserModel* model, const float delta) override {
virtual void _cubism_prologue(InternalCubismUserModel* model, const double delta) override {
if(this->_initialized == false) return;
if(this->_active == false) return;
this->emit_signal("cubism_prologue", model->_owner_viewport, delta);
}

virtual void _cubism_process(InternalCubismUserModel* model, const float delta) override {
virtual void _cubism_process(InternalCubismUserModel* model, const double delta) override {
if(this->_initialized == false) return;
if(this->_active == false) return;
this->emit_signal("cubism_process", model->_owner_viewport, delta);
}

virtual void _cubism_epilogue(InternalCubismUserModel* model, const float delta) override {
virtual void _cubism_epilogue(InternalCubismUserModel* model, const double delta) override {
if(this->_initialized == false) return;
if(this->_active == false) return;
this->emit_signal("cubism_epilogue", model->_owner_viewport, delta);
Expand Down
2 changes: 1 addition & 1 deletion src/gd_cubism_effect_eye_blink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class GDCubismEffectEyeBlink : public GDCubismEffect {
this->_initialized = false;
}

virtual void _cubism_process(InternalCubismUserModel* model, const float delta) override {
virtual void _cubism_process(InternalCubismUserModel* model, const double delta) override {
if(this->_initialized == false) return;
if(this->_active == false) return;
if(this->_eye_blink == nullptr) return;
Expand Down
2 changes: 1 addition & 1 deletion src/gd_cubism_effect_hit_area.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class GDCubismEffectHitArea : public GDCubismEffect {
this->_initialized = false;
}

virtual void _cubism_process(InternalCubismUserModel* model, const float delta) override {
virtual void _cubism_process(InternalCubismUserModel* model, const double delta) override {
if(this->_initialized == false) return;
if(this->_active == false) return;

Expand Down
2 changes: 1 addition & 1 deletion src/gd_cubism_effect_target_point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class GDCubismEffectTargetPoint : public GDCubismEffect {
this->_initialized = false;
}

virtual void _cubism_process(InternalCubismUserModel* model, const float delta) override {
virtual void _cubism_process(InternalCubismUserModel* model, const double delta) override {
if(this->_initialized == false) return;
if(this->_active == false) return;
if(this->_target_point == nullptr) return;
Expand Down
4 changes: 2 additions & 2 deletions src/gd_cubism_user_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ void GDCubismUserModel::on_motion_finished(Csm::ACubismMotion* motion) {
}


void GDCubismUserModel::_update(const float delta) {
void GDCubismUserModel::_update(const double delta) {

this->internal_model->pro_update(delta * this->speed_scale);

Expand Down Expand Up @@ -493,7 +493,7 @@ void GDCubismUserModel::_update(const float delta) {
}


void GDCubismUserModel::advance(const float delta) {
void GDCubismUserModel::advance(const double delta) {
ERR_FAIL_COND(this->is_initialized() == false);
if(this->playback_process_mode != MANUAL) return;

Expand Down
4 changes: 2 additions & 2 deletions src/gd_cubism_user_model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ class GDCubismUserModel : public Node2D {
// for Signal
static void on_motion_finished(Csm::ACubismMotion* motion);

void _update(const float delta);
void _update(const double delta);

void advance(const float delta);
void advance(const double delta);

bool check_cubism_effect_dirty() const;
void cubism_effect_dirty_reset();
Expand Down
16 changes: 14 additions & 2 deletions src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,13 @@ void GDCubismPlugin::_input(const Ref<InputEvent> &p_event) {
InputEventMouseButton* p_evt_mouse_button = Object::cast_to<InputEventMouseButton>(p_event.ptr());

if (p_evt_mouse_button != nullptr) {
Vector2 mouse_pos = get_editor_interface()->get_editor_viewport_2d()->get_mouse_position();
const SubViewport *editor_viewport = this->get_editor_interface()->get_editor_viewport_2d();
const Rect2 viewport_rect(Point2(0.0, 0.0), editor_viewport->get_size());

// Check in Viewport2D
if (viewport_rect.has_point(p_evt_mouse_button->get_position()) == false) return;

Vector2 mouse_pos = editor_viewport->get_mouse_position();

if (p_evt_mouse_button->get_button_index() == MOUSE_BUTTON_LEFT) {
if (p_evt_mouse_button->is_pressed() == true) {
Expand Down Expand Up @@ -182,7 +188,13 @@ bool GDCubismPlugin::_forward_canvas_gui_input(const Ref<InputEvent> &p_event) {
InputEventMouseButton *p_evt_mouse_button = Object::cast_to<InputEventMouseButton>(p_event.ptr());

if (p_evt_mouse_button != nullptr) {
Vector2 mouse_pos = this->get_editor_interface()->get_editor_viewport_2d()->get_mouse_position();
const SubViewport *editor_viewport = this->get_editor_interface()->get_editor_viewport_2d();
const Rect2 viewport_rect(Point2(0.0, 0.0), editor_viewport->get_size());

// Check in Viewport2D
if (viewport_rect.has_point(p_evt_mouse_button->get_position()) == false) return false;

Vector2 mouse_pos = editor_viewport->get_mouse_position();

if (p_evt_mouse_button->get_button_index() == MOUSE_BUTTON_LEFT) {
if (p_evt_mouse_button->is_pressed() == true) {
Expand Down
8 changes: 4 additions & 4 deletions src/private/internal_cubism_user_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void InternalCubismUserModel::model_load_resource()
}


void InternalCubismUserModel::pro_update(const float delta) {
void InternalCubismUserModel::pro_update(const double delta) {
if(this->IsInitialized() == false) return;
if(this->_model_setting == nullptr) return;
if(this->_model == nullptr) return;
Expand All @@ -193,7 +193,7 @@ void InternalCubismUserModel::pro_update(const float delta) {
}


void InternalCubismUserModel::efx_update(const float delta) {
void InternalCubismUserModel::efx_update(const double delta) {
if(this->IsInitialized() == false) return;
if(this->_model_setting == nullptr) return;
if(this->_model == nullptr) return;
Expand All @@ -208,7 +208,7 @@ void InternalCubismUserModel::efx_update(const float delta) {
}


void InternalCubismUserModel::epi_update(const float delta) {
void InternalCubismUserModel::epi_update(const double delta) {
if(this->IsInitialized() == false) return;
if(this->_model_setting == nullptr) return;
if(this->_model == nullptr) return;
Expand Down Expand Up @@ -479,7 +479,7 @@ void InternalCubismUserModel::effect_term() {
}


void InternalCubismUserModel::effect_batch(const float delta, const EFFECT_CALL efx_call) {
void InternalCubismUserModel::effect_batch(const double delta, const EFFECT_CALL efx_call) {
for(
Csm::csmVector<GDCubismEffect*>::iterator i = this->_owner_viewport->_list_cubism_effect.Begin();
i != this->_owner_viewport->_list_cubism_effect.End();
Expand Down
8 changes: 4 additions & 4 deletions src/private/internal_cubism_user_model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ class InternalCubismUserModel : public Csm::CubismUserModel {
public:
bool model_load(const String &model_pathname);
void model_load_resource();
void pro_update(const float delta);
void efx_update(const float delta);
void epi_update(const float delta);
void pro_update(const double delta);
void efx_update(const double delta);
void epi_update(const double delta);
void update_node();
void clear();

Expand All @@ -88,7 +88,7 @@ class InternalCubismUserModel : public Csm::CubismUserModel {

void effect_init();
void effect_term();
void effect_batch(const float delta, const EFFECT_CALL efx_call);
void effect_batch(const double delta, const EFFECT_CALL efx_call);
};


Expand Down