Comments (10)
@MichaelBelousov Thank your for reporting the bug and provide the demo project. This issue is fixed now :)
from ecmascript.
from ecmascript.
Here is a demo project I tested.
Everything works as expected
import { signal, gdclass, property } from "./decorators";
console.LOG_OBJECT_TO_JSON = true;
@gdclass
class MyNode extends godot.Control {
@signal
test_func: string;
js_method_test() {}
@property({ default: "Hello Godot Property" })
string_prop: string;
}
@gdclass
class MyMyNode extends MyNode {
@signal
test_func2: string;
};
export default class Control extends godot.Control {
_ready() {
var n = new MyMyNode();
console.log('--------------');
console.log(n.has_signal('test_func'));
console.log(n.has_signal('test_func2'));
console.log(n.string_prop === 'Hello Godot Property');
console.log(n.has_method('js_method_test'));
console.log('--------------');
n.connect('test_func', this.callback1, ['AAA', 'BBB']);
n.connect('test_func', this.callback2, ['CCC', 'DDD']);
n.emit_signal('test_func', {a: 'a'}, 2);
n.emit_signal('test_func', {b: 'b'}, 4);
console.log('--------------');
n.free();
}
callback1(a, b, c, d) {
console.log("callback1", a, b, c, d);
}
callback2(a, b, c, d) {
console.log("callback2", a, b, c, d);
}
}
Output content
--------------
true
true
true
true
--------------
callback1 {"a":"a"} 2 AAA BBB
callback2 {"a":"a"} 2 CCC DDD
callback1 {"b":"b"} 4 AAA BBB
callback2 {"b":"b"} 4 CCC DDD
--------------
from ecmascript.
I'll try making a reproduction tomorrow, I couldn't do it minimally either so maybe it's something else. But I do have some strange behavior going on...
from ecmascript.
Alright I did it tonight instead :). This is a weird one. Check out this reproduction code:
A.jsx
import B from "./B.jsx";
export default class A extends godot.Node2D {
static my_signal = "my_signal";
_ready() {
this.add_child(new B());
this.add_child(new B());
this.emit_signal(A.my_signal, {a: new godot.Vector2(5, 5)});
}
}
godot.register_signal(A, A.my_signal);
B.jsx
import A from "./A.jsx";
export default class B extends godot.Node2D {
_ready() {
this.material = new godot.ShaderMaterial();
this.$("..").connect(A.my_signal, obj => {
this.material.set_shader_param('color', new godot.Color(1,1,0,0.5));
godot.print(obj);
});
}
}
Basic scene for running script A:
[gd_scene load_steps=2 format=2]
[ext_resource path="res://A.jsx" type="Script" id=1]
[node name="Root" type="Node2D"]
script = ExtResource( 1 )
Output:
{a:(5, 5)}
Null
So on the second call it receives null
. I haven't yet tested for a less specific reproduction, but I know that setting the shader parameter will do it, and I don't even have to attach the shader. I can look for the problem in the implementation tomorrow if you don't figure it out by then :)
from ecmascript.
@MichaelBelousov Your code contains cycle import whic should not work
from ecmascript.
It does work though. Anyway, you can remove the cycle like this, and the bug remains:
//import A from "./A.jsx";
export default class B extends godot.Node2D {
_ready() {
this.material = new godot.ShaderMaterial();
this.$("..").connect("my_signal", (obj) => {
this.material.set_shader_param("color", new godot.Color(1, 1, 0, 0.5));
godot.print(obj);
});
}
}
//# sourceMappingURL=TestB.jsx.map
from ecmascript.
from ecmascript.
Here's my minimal demo:
ecmascript-multisignal-mvr.zip
It produces:
Godot Engine v3.2.3.beta.custom_build.9e4e83738 - https://godotengine.org
OpenGL ES 3.0 Renderer: Quadro P2000/PCIe/SSE2
{a:(5, 5)}
Null
on my system. If you can't reproduce, maybe I should try rebasing on a different version of godot and see if that fixes it? Also I have one other module in my local engine source.
from ecmascript.
Thank you! awesome work!
from ecmascript.
Related Issues (20)
- CommonJS Module Support HOT 4
- Steps needs to run wasm HOT 1
- [Suggestion] Documentation and getting started tutorial HOT 8
- dev is ok , when i build get error below HOT 1
- Refactor repo branches to enable good publish process HOT 9
- Close issues that refer to Godot Engine 3 but don't exist in Godot Engine 4 HOT 1
- [4.1-v0.0.17] Signal arguments makes it crash HOT 4
- Get started page 404 HOT 2
- Configuring esbuild for bundling classes issue
- Missing template / examples for pre-release HOT 2
- Can I add this to an existing godot install? HOT 1
- .d.ts file has errors HOT 6
- Condition "!is_inside_tree()" is true. HOT 2
- Master build does not build with Godot HOT 2
- Unicode parsing error: Invalid unicode codepoint (fffd), cannot represent as ASCII/Latin-1 HOT 1
- Global pollution HOT 2
- Creating an object in js lost all built-in function links
- [BUMP] GodotJS addon: CSS integration
- 4.2+ support
- Is it dead? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ecmascript.