diff --git a/Content/JavaScript/puerts/uelazyload.js b/Content/JavaScript/puerts/uelazyload.js
index b627857..6d7c2da 100644
--- a/Content/JavaScript/puerts/uelazyload.js
+++ b/Content/JavaScript/puerts/uelazyload.js
@@ -13,20 +13,25 @@ var global = global || (function () { return this; }());
let loadCPPType = global.puerts.loadCPPType;
- let cache = Object.create(null);
-
- let UE = new Proxy(cache, {
- get : function(classWrapers, name)
+ function rawSet(obj, key, val) {
+ Object.defineProperty(obj, key, {
+ value: val,
+ writable: true,
+ configurable: true,
+ enumerable: false,
+ });
+ }
+
+ let UE = Object.create(null);
+ let UE_proxy = new Proxy(UE, {
+ get : function(UE, name)
{
- let value = classWrapers[name];
- if (value === undefined)
- {
- value = loadUEType(name);
- classWrapers[name] = value;
- }
- return value;
+ let cls = loadUEType(name);
+ rawSet(UE, name, cls);
+ return cls;
}
});
+ Object.setPrototypeOf(UE, UE_proxy);
const TNAMESPACE = 0;
const TENUM = 1
@@ -34,61 +39,62 @@ var global = global || (function () { return this; }());
const TSTRUCT = 3
function createNamespaceOrClass(path, parentDir, nodeType) {
- return new Proxy({__path: path, __parent:parentDir, __type:nodeType}, {
+ let result = {__path: path, __parent:parentDir, __type:nodeType};
+ let result_proxy = new Proxy(result, {
get: function(node, name) {
- if (!(name in node)) {
- if (name === '__parent' || name === '__path') return undefined;
+ if (name === '__parent' || name === '__path') return undefined;
+
+ if (node.__type == TENUM) { // auto load
+ const res = createNamespaceOrClass(name, node, TNAMESPACE);
+ rawSet(node, name, res);
+ blueprint_load(res);
+ return node[name];
+ } else {
+ let newNodeType = node.__type;
- if (node.__type == TENUM) { // auto load
- node[name] = createNamespaceOrClass(name, node, TNAMESPACE);
- blueprint_load(node[name]);
- } else {
- let newNodeType = node.__type;
-
- if (newNodeType === TNAMESPACE) {
- let path = `/${name}.${name}`
- let c = node;
- while (c && c.__path) {
- path = `/${c.__path}${path}`
- c = c.__parent;
- }
- const obj = UE.Object.Load(path, true);
- if (obj) {
- const typeName = obj.GetClass().GetName();
- if (typeName === 'UserDefinedEnum') {
- newNodeType = TENUM;
- } else if (typeName === 'UserDefinedStruct') {
- newNodeType = TSTRUCT;
- } else {
- newNodeType = TBLUEPRINT;
- }
+ if (newNodeType === TNAMESPACE) {
+ let path = `/${name}.${name}`
+ let c = node;
+ while (c && c.__path) {
+ path = `/${c.__path}${path}`
+ c = c.__parent;
+ }
+ const obj = UE.Object.Load(path, true);
+ if (obj) {
+ const typeName = obj.GetClass().GetName();
+ if (typeName === 'UserDefinedEnum') {
+ newNodeType = TENUM;
+ } else if (typeName === 'UserDefinedStruct') {
+ newNodeType = TSTRUCT;
+ } else {
+ newNodeType = TBLUEPRINT;
}
}
-
- node[name] = createNamespaceOrClass(name, node, newNodeType);
}
+ const res = createNamespaceOrClass(name, node, newNodeType);
+ rawSet(node, name, res);
+ return res;
}
- return node[name];
}
});
+ Object.setPrototypeOf(result, result_proxy);
+ return result;
}
- cache["Game"] = createNamespaceOrClass("Game", undefined, TNAMESPACE);
+ rawSet(UE, "Game", createNamespaceOrClass("Game", undefined, TNAMESPACE));
puerts.registerBuildinModule('ue', UE);
global.UE = UE;
- let CPP = new Proxy(cache, {
- get: function(classWrapers, name) {
- let value = classWrapers[name];
- if (value === undefined)
- {
- value = loadCPPType(name);
- classWrapers[name] = value;
- }
- return value;
+ let CPP = Object.create(null);
+ let CPP_proxy = new Proxy(CPP, {
+ get: function(CPP, name) {
+ let cls = loadCPPType(name);
+ rawSet(CPP, name, cls);
+ return cls;
}
});
+ Object.setPrototypeOf(CPP, CPP_proxy);
puerts.registerBuildinModule('cpp', CPP);
global.CPP = CPP;
@@ -105,10 +111,10 @@ var global = global || (function () { return this; }());
x[0] = val;
}
- cache.NewObject = global.__tgjsNewObject;
+ rawSet(UE, 'NewObject', global.__tgjsNewObject);
global.__tgjsNewObject = undefined;
- cache.NewStruct = global.__tgjsNewStruct;
+ rawSet(UE, 'NewStruct', global.__tgjsNewStruct);
global.__tgjsNewStruct = undefined;
puerts.$ref = ref;
@@ -117,7 +123,7 @@ var global = global || (function () { return this; }());
puerts.merge = global.__tgjsMergeObject;
global.__tgjsMergeObject = undefined;
- cache.FNameLiteral = global.__tgjsFNameToArrayBuffer;
+ rawSet(UE, 'FNameLiteral', global.__tgjsFNameToArrayBuffer);
global.__tgjsFNameToArrayBuffer = undefined;
let rawmakeclass = global.__tgjsMakeUClass
@@ -333,24 +339,24 @@ var global = global || (function () { return this; }());
return ret;
}
- cache.BuiltinBool = 0;
- cache.BuiltinByte = 1;
- cache.BuiltinInt = 2;
- cache.BuiltinFloat = 3;
- cache.BuiltinDouble = 4;
- cache.BuiltinInt64 = 5;
- cache.BuiltinString = 6;
- cache.BuiltinText = 7;
- cache.BuiltinName = 8;
+ rawSet(UE, 'BuiltinBool', 0);
+ rawSet(UE, 'BuiltinByte', 1);
+ rawSet(UE, 'BuiltinInt', 2);
+ rawSet(UE, 'BuiltinFloat', 3);
+ rawSet(UE, 'BuiltinDouble', 4);
+ rawSet(UE, 'BuiltinInt64', 5);
+ rawSet(UE, 'BuiltinString', 6);
+ rawSet(UE, 'BuiltinText', 7);
+ rawSet(UE, 'BuiltinName', 8);
// call once to inject iterators to constructor
- NewArray(cache.BuiltinInt);
- NewSet(cache.BuiltinInt);
- NewMap(cache.BuiltinInt, cache.BuiltinInt);
+ NewArray(UE.BuiltinInt);
+ NewSet(UE.BuiltinInt);
+ NewMap(UE.BuiltinInt, UE.BuiltinInt);
- cache.NewArray = NewArray;
- cache.NewSet = NewSet;
- cache.NewMap = NewMap;
+ rawSet(UE, 'NewArray', NewArray);
+ rawSet(UE, 'NewSet', NewSet);
+ rawSet(UE, 'NewMap', NewMap);
const FunctionFlags = {
FUNC_None : 0x00000000,
@@ -567,17 +573,17 @@ var global = global || (function () { return this; }());
return () => {};
}
- cache.rpc = {
+ rawSet(UE, 'rpc', {
"FunctionFlags" : FunctionFlags,
"PropertyFlags" : PropertyFlags,
"ELifetimeCondition" : ELifetimeCondition,
"flags" : dummyDecorator,
"condition" : dummyDecorator
- }
+ });
const MetaDataInst = '';
- cache.uclass = {
+ rawSet(UE, 'uclass', {
// the class specifier
"ClassGroup": MetaDataInst,
"Within": MetaDataInst,
@@ -645,9 +651,9 @@ var global = global || (function () { return this; }());
"UsesHierarchy": MetaDataInst,
// decorator to add class metadata
"umeta": dummyDecorator
- }
+ });
- cache.ufunction = {
+ rawSet(UE, 'ufunction', {
// the function specifier
"BlueprintImplementableEvent": MetaDataInst,
"BlueprintNativeEvent": MetaDataInst,
@@ -725,9 +731,9 @@ var global = global || (function () { return this; }());
"ArrayParam": MetaDataInst,
// decorator to add function metadata
"umeta": dummyDecorator
- }
+ });
- cache.uproperty = {
+ rawSet(UE, 'uproperty', {
// the specifiers
"Const": MetaDataInst,
"Config": MetaDataInst,
@@ -839,10 +845,9 @@ var global = global || (function () { return this; }());
// decorator
"umeta": dummyDecorator,
"attach": dummyDecorator
- }
+ });
- cache.uparam =
- {
+ rawSet(UE, 'uparam', {
// the specifiers
"Const": MetaDataInst,
"Ref": MetaDataInst,
@@ -918,23 +923,23 @@ var global = global || (function () { return this; }());
"BitmaskEnum": MetaDataInst,
// decorator
"umeta": dummyDecorator,
- }
+ });
- cache.edit_on_instance = dummyDecorator;
-
- cache.no_blueprint = dummyDecorator;
-
- cache.set_flags = dummyDecorator;
-
- cache.clear_flags = dummyDecorator;
-
- cache.FunctionFlags = FunctionFlags;
+ rawSet(UE, 'edit_on_instance', dummyDecorator);
- cache.ClassFlags = ClassFlags;
+ rawSet(UE, 'no_blueprint', dummyDecorator);
- cache.PropertyFlags = PropertyFlags;
+ rawSet(UE, 'set_flags', dummyDecorator);
- cache.FunctionExportFlags = FunctionExportFlags;
+ rawSet(UE, 'clear_flags', dummyDecorator);
+
+ rawSet(UE, 'FunctionFlags', FunctionFlags);
+
+ rawSet(UE, 'ClassFlags', ClassFlags);
+
+ rawSet(UE, 'PropertyFlags', PropertyFlags);
+
+ rawSet(UE, 'FunctionExportFlags', FunctionExportFlags);
puerts.toManualReleaseDelegate = (x) => x;
puerts.toDelegate = (o,k) => [o, k];
diff --git a/Content/JavaScript/puerts/websocketpp.js b/Content/JavaScript/puerts/websocketpp.js
index d14c9f8..de2020f 100644
--- a/Content/JavaScript/puerts/websocketpp.js
+++ b/Content/JavaScript/puerts/websocketpp.js
@@ -50,8 +50,6 @@ var global = global || (function () { return this; }());
const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
- const poll_ws_objects = [];
-
class WebSocket extends EventTarget {
constructor(url, protocols) {
super();
@@ -72,9 +70,7 @@ var global = global || (function () { return this; }());
this._addPendingEvent({type:'close', code:code, reason: reason});
},
() => {
- this._addPendingEvent({type:'error'});
- this._cleanup();
- this._addPendingEvent({type:'close', code:1006, reason: ""});
+ this._fail();
});
this._readyState = WebSocket.CONNECTING;
@@ -92,9 +88,21 @@ var global = global || (function () { return this; }());
send(data) {
if (this._readyState !== WebSocket.OPEN) {
- throw new Error(`WebSocket is not open: readyState ${this._readyState} (${readyStates[this._readyState]})`);
+ //throw new Error(`WebSocket is not open: readyState ${this._readyState} (${readyStates[this._readyState]})`);
+ this.dispatchEvent({type:'error'}); //dispatchEvent immediately
+ return;
}
- this._raw.send(data);
+ try {
+ this._raw.send(data);
+ } catch {
+ this._fail();
+ }
+ }
+
+ _fail() {
+ this._addPendingEvent({type:'error'});
+ this._cleanup();
+ this._addPendingEvent({type:'close', code:1006, reason: ""});
}
_cleanup() {
@@ -111,10 +119,11 @@ var global = global || (function () { return this; }());
}
const ev = this._pendingEvents.shift();
if (ev) this.dispatchEvent(ev);
- if (this._pendingEvents.length === 0 && this._readyState == WebSocket.CLOSING) {
+ if ((this._pendingEvents.length === 0 && this._readyState == WebSocket.CLOSING) || (ev && ev.type === 'close')) {
this._raw = undefined;
clearInterval(this._tid);
this._readyState = WebSocket.CLOSED;
+ this._pendingEvents = [];
}
}
diff --git a/Plugins/Puerts/Content/JavaScript/puerts/uelazyload.js b/Plugins/Puerts/Content/JavaScript/puerts/uelazyload.js
index b627857..6d7c2da 100644
--- a/Plugins/Puerts/Content/JavaScript/puerts/uelazyload.js
+++ b/Plugins/Puerts/Content/JavaScript/puerts/uelazyload.js
@@ -13,20 +13,25 @@ var global = global || (function () { return this; }());
let loadCPPType = global.puerts.loadCPPType;
- let cache = Object.create(null);
-
- let UE = new Proxy(cache, {
- get : function(classWrapers, name)
+ function rawSet(obj, key, val) {
+ Object.defineProperty(obj, key, {
+ value: val,
+ writable: true,
+ configurable: true,
+ enumerable: false,
+ });
+ }
+
+ let UE = Object.create(null);
+ let UE_proxy = new Proxy(UE, {
+ get : function(UE, name)
{
- let value = classWrapers[name];
- if (value === undefined)
- {
- value = loadUEType(name);
- classWrapers[name] = value;
- }
- return value;
+ let cls = loadUEType(name);
+ rawSet(UE, name, cls);
+ return cls;
}
});
+ Object.setPrototypeOf(UE, UE_proxy);
const TNAMESPACE = 0;
const TENUM = 1
@@ -34,61 +39,62 @@ var global = global || (function () { return this; }());
const TSTRUCT = 3
function createNamespaceOrClass(path, parentDir, nodeType) {
- return new Proxy({__path: path, __parent:parentDir, __type:nodeType}, {
+ let result = {__path: path, __parent:parentDir, __type:nodeType};
+ let result_proxy = new Proxy(result, {
get: function(node, name) {
- if (!(name in node)) {
- if (name === '__parent' || name === '__path') return undefined;
+ if (name === '__parent' || name === '__path') return undefined;
+
+ if (node.__type == TENUM) { // auto load
+ const res = createNamespaceOrClass(name, node, TNAMESPACE);
+ rawSet(node, name, res);
+ blueprint_load(res);
+ return node[name];
+ } else {
+ let newNodeType = node.__type;
- if (node.__type == TENUM) { // auto load
- node[name] = createNamespaceOrClass(name, node, TNAMESPACE);
- blueprint_load(node[name]);
- } else {
- let newNodeType = node.__type;
-
- if (newNodeType === TNAMESPACE) {
- let path = `/${name}.${name}`
- let c = node;
- while (c && c.__path) {
- path = `/${c.__path}${path}`
- c = c.__parent;
- }
- const obj = UE.Object.Load(path, true);
- if (obj) {
- const typeName = obj.GetClass().GetName();
- if (typeName === 'UserDefinedEnum') {
- newNodeType = TENUM;
- } else if (typeName === 'UserDefinedStruct') {
- newNodeType = TSTRUCT;
- } else {
- newNodeType = TBLUEPRINT;
- }
+ if (newNodeType === TNAMESPACE) {
+ let path = `/${name}.${name}`
+ let c = node;
+ while (c && c.__path) {
+ path = `/${c.__path}${path}`
+ c = c.__parent;
+ }
+ const obj = UE.Object.Load(path, true);
+ if (obj) {
+ const typeName = obj.GetClass().GetName();
+ if (typeName === 'UserDefinedEnum') {
+ newNodeType = TENUM;
+ } else if (typeName === 'UserDefinedStruct') {
+ newNodeType = TSTRUCT;
+ } else {
+ newNodeType = TBLUEPRINT;
}
}
-
- node[name] = createNamespaceOrClass(name, node, newNodeType);
}
+ const res = createNamespaceOrClass(name, node, newNodeType);
+ rawSet(node, name, res);
+ return res;
}
- return node[name];
}
});
+ Object.setPrototypeOf(result, result_proxy);
+ return result;
}
- cache["Game"] = createNamespaceOrClass("Game", undefined, TNAMESPACE);
+ rawSet(UE, "Game", createNamespaceOrClass("Game", undefined, TNAMESPACE));
puerts.registerBuildinModule('ue', UE);
global.UE = UE;
- let CPP = new Proxy(cache, {
- get: function(classWrapers, name) {
- let value = classWrapers[name];
- if (value === undefined)
- {
- value = loadCPPType(name);
- classWrapers[name] = value;
- }
- return value;
+ let CPP = Object.create(null);
+ let CPP_proxy = new Proxy(CPP, {
+ get: function(CPP, name) {
+ let cls = loadCPPType(name);
+ rawSet(CPP, name, cls);
+ return cls;
}
});
+ Object.setPrototypeOf(CPP, CPP_proxy);
puerts.registerBuildinModule('cpp', CPP);
global.CPP = CPP;
@@ -105,10 +111,10 @@ var global = global || (function () { return this; }());
x[0] = val;
}
- cache.NewObject = global.__tgjsNewObject;
+ rawSet(UE, 'NewObject', global.__tgjsNewObject);
global.__tgjsNewObject = undefined;
- cache.NewStruct = global.__tgjsNewStruct;
+ rawSet(UE, 'NewStruct', global.__tgjsNewStruct);
global.__tgjsNewStruct = undefined;
puerts.$ref = ref;
@@ -117,7 +123,7 @@ var global = global || (function () { return this; }());
puerts.merge = global.__tgjsMergeObject;
global.__tgjsMergeObject = undefined;
- cache.FNameLiteral = global.__tgjsFNameToArrayBuffer;
+ rawSet(UE, 'FNameLiteral', global.__tgjsFNameToArrayBuffer);
global.__tgjsFNameToArrayBuffer = undefined;
let rawmakeclass = global.__tgjsMakeUClass
@@ -333,24 +339,24 @@ var global = global || (function () { return this; }());
return ret;
}
- cache.BuiltinBool = 0;
- cache.BuiltinByte = 1;
- cache.BuiltinInt = 2;
- cache.BuiltinFloat = 3;
- cache.BuiltinDouble = 4;
- cache.BuiltinInt64 = 5;
- cache.BuiltinString = 6;
- cache.BuiltinText = 7;
- cache.BuiltinName = 8;
+ rawSet(UE, 'BuiltinBool', 0);
+ rawSet(UE, 'BuiltinByte', 1);
+ rawSet(UE, 'BuiltinInt', 2);
+ rawSet(UE, 'BuiltinFloat', 3);
+ rawSet(UE, 'BuiltinDouble', 4);
+ rawSet(UE, 'BuiltinInt64', 5);
+ rawSet(UE, 'BuiltinString', 6);
+ rawSet(UE, 'BuiltinText', 7);
+ rawSet(UE, 'BuiltinName', 8);
// call once to inject iterators to constructor
- NewArray(cache.BuiltinInt);
- NewSet(cache.BuiltinInt);
- NewMap(cache.BuiltinInt, cache.BuiltinInt);
+ NewArray(UE.BuiltinInt);
+ NewSet(UE.BuiltinInt);
+ NewMap(UE.BuiltinInt, UE.BuiltinInt);
- cache.NewArray = NewArray;
- cache.NewSet = NewSet;
- cache.NewMap = NewMap;
+ rawSet(UE, 'NewArray', NewArray);
+ rawSet(UE, 'NewSet', NewSet);
+ rawSet(UE, 'NewMap', NewMap);
const FunctionFlags = {
FUNC_None : 0x00000000,
@@ -567,17 +573,17 @@ var global = global || (function () { return this; }());
return () => {};
}
- cache.rpc = {
+ rawSet(UE, 'rpc', {
"FunctionFlags" : FunctionFlags,
"PropertyFlags" : PropertyFlags,
"ELifetimeCondition" : ELifetimeCondition,
"flags" : dummyDecorator,
"condition" : dummyDecorator
- }
+ });
const MetaDataInst = '';
- cache.uclass = {
+ rawSet(UE, 'uclass', {
// the class specifier
"ClassGroup": MetaDataInst,
"Within": MetaDataInst,
@@ -645,9 +651,9 @@ var global = global || (function () { return this; }());
"UsesHierarchy": MetaDataInst,
// decorator to add class metadata
"umeta": dummyDecorator
- }
+ });
- cache.ufunction = {
+ rawSet(UE, 'ufunction', {
// the function specifier
"BlueprintImplementableEvent": MetaDataInst,
"BlueprintNativeEvent": MetaDataInst,
@@ -725,9 +731,9 @@ var global = global || (function () { return this; }());
"ArrayParam": MetaDataInst,
// decorator to add function metadata
"umeta": dummyDecorator
- }
+ });
- cache.uproperty = {
+ rawSet(UE, 'uproperty', {
// the specifiers
"Const": MetaDataInst,
"Config": MetaDataInst,
@@ -839,10 +845,9 @@ var global = global || (function () { return this; }());
// decorator
"umeta": dummyDecorator,
"attach": dummyDecorator
- }
+ });
- cache.uparam =
- {
+ rawSet(UE, 'uparam', {
// the specifiers
"Const": MetaDataInst,
"Ref": MetaDataInst,
@@ -918,23 +923,23 @@ var global = global || (function () { return this; }());
"BitmaskEnum": MetaDataInst,
// decorator
"umeta": dummyDecorator,
- }
+ });
- cache.edit_on_instance = dummyDecorator;
-
- cache.no_blueprint = dummyDecorator;
-
- cache.set_flags = dummyDecorator;
-
- cache.clear_flags = dummyDecorator;
-
- cache.FunctionFlags = FunctionFlags;
+ rawSet(UE, 'edit_on_instance', dummyDecorator);
- cache.ClassFlags = ClassFlags;
+ rawSet(UE, 'no_blueprint', dummyDecorator);
- cache.PropertyFlags = PropertyFlags;
+ rawSet(UE, 'set_flags', dummyDecorator);
- cache.FunctionExportFlags = FunctionExportFlags;
+ rawSet(UE, 'clear_flags', dummyDecorator);
+
+ rawSet(UE, 'FunctionFlags', FunctionFlags);
+
+ rawSet(UE, 'ClassFlags', ClassFlags);
+
+ rawSet(UE, 'PropertyFlags', PropertyFlags);
+
+ rawSet(UE, 'FunctionExportFlags', FunctionExportFlags);
puerts.toManualReleaseDelegate = (x) => x;
puerts.toDelegate = (o,k) => [o, k];
diff --git a/Plugins/Puerts/Content/JavaScript/puerts/websocketpp.js b/Plugins/Puerts/Content/JavaScript/puerts/websocketpp.js
index d14c9f8..de2020f 100644
--- a/Plugins/Puerts/Content/JavaScript/puerts/websocketpp.js
+++ b/Plugins/Puerts/Content/JavaScript/puerts/websocketpp.js
@@ -50,8 +50,6 @@ var global = global || (function () { return this; }());
const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
- const poll_ws_objects = [];
-
class WebSocket extends EventTarget {
constructor(url, protocols) {
super();
@@ -72,9 +70,7 @@ var global = global || (function () { return this; }());
this._addPendingEvent({type:'close', code:code, reason: reason});
},
() => {
- this._addPendingEvent({type:'error'});
- this._cleanup();
- this._addPendingEvent({type:'close', code:1006, reason: ""});
+ this._fail();
});
this._readyState = WebSocket.CONNECTING;
@@ -92,9 +88,21 @@ var global = global || (function () { return this; }());
send(data) {
if (this._readyState !== WebSocket.OPEN) {
- throw new Error(`WebSocket is not open: readyState ${this._readyState} (${readyStates[this._readyState]})`);
+ //throw new Error(`WebSocket is not open: readyState ${this._readyState} (${readyStates[this._readyState]})`);
+ this.dispatchEvent({type:'error'}); //dispatchEvent immediately
+ return;
}
- this._raw.send(data);
+ try {
+ this._raw.send(data);
+ } catch {
+ this._fail();
+ }
+ }
+
+ _fail() {
+ this._addPendingEvent({type:'error'});
+ this._cleanup();
+ this._addPendingEvent({type:'close', code:1006, reason: ""});
}
_cleanup() {
@@ -111,10 +119,11 @@ var global = global || (function () { return this; }());
}
const ev = this._pendingEvents.shift();
if (ev) this.dispatchEvent(ev);
- if (this._pendingEvents.length === 0 && this._readyState == WebSocket.CLOSING) {
+ if ((this._pendingEvents.length === 0 && this._readyState == WebSocket.CLOSING) || (ev && ev.type === 'close')) {
this._raw = undefined;
clearInterval(this._tid);
this._readyState = WebSocket.CLOSED;
+ this._pendingEvents = [];
}
}
diff --git a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/CSharpParamDefaultValueMetas.cs b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/CSharpParamDefaultValueMetas.cs
index b96a283..9bf27e2 100644
--- a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/CSharpParamDefaultValueMetas.cs
+++ b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/CSharpParamDefaultValueMetas.cs
@@ -30,7 +30,7 @@ namespace CSharpParamDefaultValueMetas
paramDefaultValueMetas.Generate();
- bool bHasGameRuntime = (from package in factory.Session.Packages where package.Module.ModuleType == UHTModuleType.GameRuntime select package).Any();
+ bool bHasGameRuntime = (from module in factory.Session.Modules where module.Module.ModuleType == UHTModuleType.GameRuntime select module).Any();
paramDefaultValueMetas.OutputIfNeeded(bHasGameRuntime);
}
@@ -61,9 +61,9 @@ namespace CSharpParamDefaultValueMetas
{
GeneratedContentBuilder.Append("// Generated By C# UbtPlugin\r\n");
- var packages = (from package in Factory.Session.Packages
- where (package.Module.ModuleType == UHTModuleType.EngineRuntime || package.Module.ModuleType == UHTModuleType.GameRuntime)
- select package);
+ var packages = (from module in Factory.Session.Modules
+ where (module.Module.ModuleType == UHTModuleType.EngineRuntime || module.Module.ModuleType == UHTModuleType.GameRuntime)
+ select module.ScriptPackage);
var classes = packages
.SelectMany(TraverseTree)
diff --git a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/CSharpParamDefaultValueMetas.ubtplugin.csproj b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/CSharpParamDefaultValueMetas.ubtplugin.csproj
index 4e4ee50..a4369ac 100644
--- a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/CSharpParamDefaultValueMetas.ubtplugin.csproj
+++ b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/CSharpParamDefaultValueMetas.ubtplugin.csproj
@@ -3,7 +3,11 @@
- net6.0
+
+
+ 5.5
+ net8.0
+
Development
Library
false
diff --git a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/CSharpParamDefaultValueMetas.ubtplugin.csproj.nuget.dgspec.json b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/CSharpParamDefaultValueMetas.ubtplugin.csproj.nuget.dgspec.json
index 9346e61..b5669fc 100644
--- a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/CSharpParamDefaultValueMetas.ubtplugin.csproj.nuget.dgspec.json
+++ b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/CSharpParamDefaultValueMetas.ubtplugin.csproj.nuget.dgspec.json
@@ -22,15 +22,15 @@
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
- "net6.0"
+ "net8.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
- "net6.0": {
- "targetAlias": "net6.0",
+ "net8.0": {
+ "targetAlias": "net8.0",
"projectReferences": {}
}
},
@@ -43,12 +43,13 @@
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
- "auditMode": "direct"
- }
+ "auditMode": "all"
+ },
+ "SdkAnalysisLevel": "9.0.100"
},
"frameworks": {
- "net6.0": {
- "targetAlias": "net6.0",
+ "net8.0": {
+ "targetAlias": "net8.0",
"dependencies": {
"Microsoft.CSharp": {
"target": "Package",
@@ -66,26 +67,12 @@
],
"assetTargetFallback": true,
"warn": true,
- "downloadDependencies": [
- {
- "name": "Microsoft.AspNetCore.App.Ref",
- "version": "[6.0.30, 6.0.30]"
- },
- {
- "name": "Microsoft.NETCore.App.Ref",
- "version": "[6.0.30, 6.0.30]"
- },
- {
- "name": "Microsoft.WindowsDesktop.App.Ref",
- "version": "[6.0.30, 6.0.30]"
- }
- ],
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
- "runtimeIdentifierGraphPath": "D:\\MiceCola\\UE_5.5\\Engine\\Binaries\\ThirdParty\\DotNet\\8.0.300\\win-x64\\sdk\\8.0.300\\RuntimeIdentifierGraph.json"
+ "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.100/PortableRuntimeIdentifierGraph.json"
}
}
}
diff --git a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/CSharpParamDefaultValueMetas.ubtplugin.csproj.nuget.g.props b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/CSharpParamDefaultValueMetas.ubtplugin.csproj.nuget.g.props
index 186e672..8f2887a 100644
--- a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/CSharpParamDefaultValueMetas.ubtplugin.csproj.nuget.g.props
+++ b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/CSharpParamDefaultValueMetas.ubtplugin.csproj.nuget.g.props
@@ -7,7 +7,7 @@
$(UserProfile)\.nuget\packages\
C:\Users\张青\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages
PackageReference
- 6.10.0
+ 6.12.1
diff --git a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Debug/CSharpParamDefaultValueMetas.ubtplugin.GeneratedMSBuildEditorConfig.editorconfig b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Debug/CSharpParamDefaultValueMetas.ubtplugin.GeneratedMSBuildEditorConfig.editorconfig
new file mode 100644
index 0000000..1b452d5
--- /dev/null
+++ b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Debug/CSharpParamDefaultValueMetas.ubtplugin.GeneratedMSBuildEditorConfig.editorconfig
@@ -0,0 +1,15 @@
+is_global = true
+build_property.TargetFramework = net8.0
+build_property.TargetPlatformMinVersion =
+build_property.UsingMicrosoftNETSdkWeb =
+build_property.ProjectTypeGuids =
+build_property.InvariantGlobalization =
+build_property.PlatformNeutralAssembly =
+build_property.EnforceExtendedAnalyzerRules =
+build_property._SupportedPlatformList = Linux,macOS,Windows
+build_property.RootNamespace = CSharpParamDefaultValueMetas
+build_property.ProjectDir = D:\MiceCola\MingSimulator\Plugins\Puerts\Source\CSharpParamDefaultValueMetas\
+build_property.EnableComHosting =
+build_property.EnableGeneratedComInterfaceComImportInterop =
+build_property.EffectiveAnalysisLevelStyle = 8.0
+build_property.EnableCodeStyleSeverity =
diff --git a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Debug/CSharpParamDefaultValueMetas.ubtplugin.assets.cache b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Debug/CSharpParamDefaultValueMetas.ubtplugin.assets.cache
new file mode 100644
index 0000000..bbf5c57
Binary files /dev/null and b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Debug/CSharpParamDefaultValueMetas.ubtplugin.assets.cache differ
diff --git a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpPa.E71C88CE.Up2Date b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpPa.E71C88CE.Up2Date
new file mode 100644
index 0000000..e69de29
diff --git a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.pdb b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.pdb
new file mode 100644
index 0000000..49507bf
Binary files /dev/null and b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.pdb differ
diff --git a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.ubtplugin.GeneratedMSBuildEditorConfig.editorconfig b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.ubtplugin.GeneratedMSBuildEditorConfig.editorconfig
index 7b0d4fd..1b452d5 100644
--- a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.ubtplugin.GeneratedMSBuildEditorConfig.editorconfig
+++ b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.ubtplugin.GeneratedMSBuildEditorConfig.editorconfig
@@ -1,5 +1,5 @@
is_global = true
-build_property.TargetFramework = net6.0
+build_property.TargetFramework = net8.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
@@ -11,5 +11,5 @@ build_property.RootNamespace = CSharpParamDefaultValueMetas
build_property.ProjectDir = D:\MiceCola\MingSimulator\Plugins\Puerts\Source\CSharpParamDefaultValueMetas\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
-build_property.EffectiveAnalysisLevelStyle = 6.0
+build_property.EffectiveAnalysisLevelStyle = 8.0
build_property.EnableCodeStyleSeverity =
diff --git a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.ubtplugin.assets.cache b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.ubtplugin.assets.cache
index b21c22d..e0e223f 100644
Binary files a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.ubtplugin.assets.cache and b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.ubtplugin.assets.cache differ
diff --git a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.ubtplugin.csproj.CoreCompileInputs.cache b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.ubtplugin.csproj.CoreCompileInputs.cache
index a71c54d..bb543bd 100644
--- a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.ubtplugin.csproj.CoreCompileInputs.cache
+++ b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.ubtplugin.csproj.CoreCompileInputs.cache
@@ -1 +1 @@
-acfc2ce6c21e11e243f1beb848c668c5ad8317be9df7ed1ce1347befd4c57e75
+4dcf04fded4988fa5c24bba74a82a404ae8fd73afb5cfea2a423776f830011f6
diff --git a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.ubtplugin.csproj.FileListAbsolute.txt b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.ubtplugin.csproj.FileListAbsolute.txt
index a7b7224..f436664 100644
--- a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.ubtplugin.csproj.FileListAbsolute.txt
+++ b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/Development/CSharpParamDefaultValueMetas.ubtplugin.csproj.FileListAbsolute.txt
@@ -1,3 +1,11 @@
+D:\MiceCola\MingSimulator\Binaries\DotNET\UnrealBuildTool\Plugins\CSharpParamDefaultValueMetas\CSharpParamDefaultValueMetas.deps.json
+D:\MiceCola\MingSimulator\Binaries\DotNET\UnrealBuildTool\Plugins\CSharpParamDefaultValueMetas\CSharpParamDefaultValueMetas.dll
+D:\MiceCola\MingSimulator\Binaries\DotNET\UnrealBuildTool\Plugins\CSharpParamDefaultValueMetas\ref\CSharpParamDefaultValueMetas.dll
+D:\MiceCola\MingSimulator\Binaries\DotNET\UnrealBuildTool\Plugins\CSharpParamDefaultValueMetas\CSharpParamDefaultValueMetas.pdb
D:\MiceCola\MingSimulator\Plugins\Puerts\Source\CSharpParamDefaultValueMetas\obj\Development\CSharpParamDefaultValueMetas.ubtplugin.csproj.AssemblyReference.cache
D:\MiceCola\MingSimulator\Plugins\Puerts\Source\CSharpParamDefaultValueMetas\obj\Development\CSharpParamDefaultValueMetas.ubtplugin.GeneratedMSBuildEditorConfig.editorconfig
D:\MiceCola\MingSimulator\Plugins\Puerts\Source\CSharpParamDefaultValueMetas\obj\Development\CSharpParamDefaultValueMetas.ubtplugin.csproj.CoreCompileInputs.cache
+D:\MiceCola\MingSimulator\Plugins\Puerts\Source\CSharpParamDefaultValueMetas\obj\Development\CSharpPa.E71C88CE.Up2Date
+D:\MiceCola\MingSimulator\Plugins\Puerts\Source\CSharpParamDefaultValueMetas\obj\Development\CSharpParamDefaultValueMetas.dll
+D:\MiceCola\MingSimulator\Plugins\Puerts\Source\CSharpParamDefaultValueMetas\obj\Development\refint\CSharpParamDefaultValueMetas.dll
+D:\MiceCola\MingSimulator\Plugins\Puerts\Source\CSharpParamDefaultValueMetas\obj\Development\CSharpParamDefaultValueMetas.pdb
diff --git a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/project.assets.json b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/project.assets.json
index c56b0dc..5d8248e 100644
--- a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/project.assets.json
+++ b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/project.assets.json
@@ -1,7 +1,7 @@
{
"version": 3,
"targets": {
- "net6.0": {
+ "net8.0": {
"Microsoft.CSharp/4.7.0": {
"type": "package",
"compile": {
@@ -85,7 +85,7 @@
}
},
"projectFileDependencyGroups": {
- "net6.0": [
+ "net8.0": [
"Microsoft.CSharp >= 4.7.0"
]
},
@@ -111,15 +111,15 @@
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
- "net6.0"
+ "net8.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
- "net6.0": {
- "targetAlias": "net6.0",
+ "net8.0": {
+ "targetAlias": "net8.0",
"projectReferences": {}
}
},
@@ -132,12 +132,13 @@
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
- "auditMode": "direct"
- }
+ "auditMode": "all"
+ },
+ "SdkAnalysisLevel": "9.0.100"
},
"frameworks": {
- "net6.0": {
- "targetAlias": "net6.0",
+ "net8.0": {
+ "targetAlias": "net8.0",
"dependencies": {
"Microsoft.CSharp": {
"target": "Package",
@@ -155,26 +156,12 @@
],
"assetTargetFallback": true,
"warn": true,
- "downloadDependencies": [
- {
- "name": "Microsoft.AspNetCore.App.Ref",
- "version": "[6.0.30, 6.0.30]"
- },
- {
- "name": "Microsoft.NETCore.App.Ref",
- "version": "[6.0.30, 6.0.30]"
- },
- {
- "name": "Microsoft.WindowsDesktop.App.Ref",
- "version": "[6.0.30, 6.0.30]"
- }
- ],
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
- "runtimeIdentifierGraphPath": "D:\\MiceCola\\UE_5.5\\Engine\\Binaries\\ThirdParty\\DotNet\\8.0.300\\win-x64\\sdk\\8.0.300\\RuntimeIdentifierGraph.json"
+ "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.100/PortableRuntimeIdentifierGraph.json"
}
}
}
diff --git a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/project.nuget.cache b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/project.nuget.cache
index f4f9d66..aef4d0b 100644
--- a/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/project.nuget.cache
+++ b/Plugins/Puerts/Source/CSharpParamDefaultValueMetas/obj/project.nuget.cache
@@ -1,13 +1,10 @@
{
"version": 2,
- "dgSpecHash": "+l+ToRTRVP0=",
+ "dgSpecHash": "EOUSIvcgfIU=",
"success": true,
"projectFilePath": "D:\\MiceCola\\MingSimulator\\Plugins\\Puerts\\Source\\CSharpParamDefaultValueMetas\\CSharpParamDefaultValueMetas.ubtplugin.csproj",
"expectedPackageFiles": [
- "C:\\Users\\张青\\.nuget\\packages\\microsoft.csharp\\4.7.0\\microsoft.csharp.4.7.0.nupkg.sha512",
- "C:\\Users\\张青\\.nuget\\packages\\microsoft.netcore.app.ref\\6.0.30\\microsoft.netcore.app.ref.6.0.30.nupkg.sha512",
- "C:\\Users\\张青\\.nuget\\packages\\microsoft.windowsdesktop.app.ref\\6.0.30\\microsoft.windowsdesktop.app.ref.6.0.30.nupkg.sha512",
- "C:\\Users\\张青\\.nuget\\packages\\microsoft.aspnetcore.app.ref\\6.0.30\\microsoft.aspnetcore.app.ref.6.0.30.nupkg.sha512"
+ "C:\\Users\\张青\\.nuget\\packages\\microsoft.csharp\\4.7.0\\microsoft.csharp.4.7.0.nupkg.sha512"
],
"logs": []
}
\ No newline at end of file
diff --git a/Plugins/Puerts/Source/DeclarationGenerator/Private/DeclarationGenerator.cpp b/Plugins/Puerts/Source/DeclarationGenerator/Private/DeclarationGenerator.cpp
index 21431e1..d075672 100644
--- a/Plugins/Puerts/Source/DeclarationGenerator/Private/DeclarationGenerator.cpp
+++ b/Plugins/Puerts/Source/DeclarationGenerator/Private/DeclarationGenerator.cpp
@@ -28,11 +28,12 @@
#include "Widgets/Notifications/SNotificationList.h"
// #include "Misc/MessageDialog.h"
#include "Framework/MultiBox/MultiBoxBuilder.h"
-#include "Engine/UserDefinedStruct.h"
+#include "StructUtils/UserDefinedStruct.h"
#include "Engine/UserDefinedEnum.h"
#include "Engine/Blueprint.h"
#include "CodeGenerator.h"
#include "JSClassRegister.h"
+#include "UECompatible.h"
#include "Engine/CollisionProfile.h"
#if (ENGINE_MAJOR_VERSION >= 5)
#include "ToolMenus.h"
@@ -1089,7 +1090,10 @@ void FTypeScriptDeclarationGenerator::GatherExtensions(UStruct* Struct, FStringB
while (PropertyInfo && PropertyInfo->Name && PropertyInfo->Type)
{
if (Struct->FindPropertyByName(UTF8_TO_TCHAR(PropertyInfo->Name)))
+ {
+ ++PropertyInfo;
continue;
+ }
Buff << " " << PropertyInfo->Name << ": " << GetNamePrefix(PropertyInfo->Type) << PropertyInfo->Type->Name()
<< ";\n";
++PropertyInfo;
@@ -1366,7 +1370,6 @@ void FTypeScriptDeclarationGenerator::GenEnum(UEnum* Enum)
void FTypeScriptDeclarationGenerator::GenStruct(UStruct* Struct)
{
-#include "ExcludeStructs.h"
FStringBuffer StringBuffer{"", ""};
const FString SafeStructName =
Struct->IsNative() ? SafeName(Struct->GetName()) : PUERTS_NAMESPACE::FilenameToTypeScriptVariableName(Struct->GetName());
@@ -1396,6 +1399,31 @@ void FTypeScriptDeclarationGenerator::GenStruct(UStruct* Struct)
auto GenConstrutor = [&]()
{
+ auto ClassDefinition = PUERTS_NAMESPACE::FindClassByType(Struct);
+ if (ClassDefinition && ClassDefinition->ConstructorInfos)
+ {
+ PUERTS_NAMESPACE::NamedFunctionInfo* ConstructorInfo = ClassDefinition->ConstructorInfos;
+ while (ConstructorInfo && ConstructorInfo->Name && ConstructorInfo->Type)
+ {
+ FStringBuffer Tmp;
+ Tmp << "constructor(";
+ GenArgumentsForFunctionInfo(ConstructorInfo->Type, Tmp);
+ Tmp << ")";
+ StringBuffer << " " << Tmp.Buffer << ";\n";
+ for (unsigned int i = 0; i < ConstructorInfo->Type->ArgumentCount(); i++)
+ {
+ auto argInfo = ConstructorInfo->Type->Argument(i);
+ if (argInfo->IsUEType())
+ {
+ UScriptStruct* UsedStruct = PUERTS_NAMESPACE::FindAnyType(UTF8_TO_TCHAR(argInfo->Name()));
+ if (UsedStruct)
+ Gen(UsedStruct);
+ }
+ }
+ ++ConstructorInfo;
+ }
+ return;
+ }
FStringBuffer TmpBuff;
TmpBuff << "constructor(";
bool First = true;
diff --git a/Plugins/Puerts/Source/DeclarationGenerator/Private/ExcludeStructs.h b/Plugins/Puerts/Source/DeclarationGenerator/Private/ExcludeStructs.h
deleted file mode 100644
index cfd4115..0000000
--- a/Plugins/Puerts/Source/DeclarationGenerator/Private/ExcludeStructs.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// gen by puerts gen tools
-auto SName = Struct -> GetName();
-if (SName == "IntVector" || SName == "Color" || SName == "Quat" || SName == "Vector2D" || SName == "Vector4" ||
- SName == "Transform" || SName == "LinearColor" || SName == "Box2D" || SName == "Vector" || SName == "IntPoint" ||
- SName == "Rotator" || SName == "Guid")
-{
- return;
-}
\ No newline at end of file
diff --git a/Plugins/Puerts/Source/JsEnv/JsEnv.Build.cs b/Plugins/Puerts/Source/JsEnv/JsEnv.Build.cs
index d599f85..6138535 100644
--- a/Plugins/Puerts/Source/JsEnv/JsEnv.Build.cs
+++ b/Plugins/Puerts/Source/JsEnv/JsEnv.Build.cs
@@ -170,6 +170,12 @@ public class JsEnv : ModuleRules
string coreJSPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "Content"));
string destDirName = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "..", "..", "Content"));
DirectoryCopy(coreJSPath, destDirName, true);
+
+ // 每次build时拷贝一些手写的.d.ts到Typing目录以同步更新
+ string srcDtsDirName = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "Typing"));
+ string dstDtsDirName = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "..", "..", "Typing"));
+ DirectoryCopy(srcDtsDirName, dstDtsDirName, true);
+
}
void OldThirdParty(ReadOnlyTargetRules Target)
@@ -618,10 +624,14 @@ public class JsEnv : ModuleRules
PublicDefinitions.Add("WITH_QJS_NAMESPACE_SUFFIX=1");
PublicDefinitions.Add("QJSV8NAMESPACE=v8_qjs");
}
+
+ string ThirdPartyPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "ThirdParty"));
+ string HeaderPath = Path.GetFullPath(Path.Combine(ThirdPartyPath, "Include"));
+ PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "websocketpp") });
+ PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "asio") });
+ PublicIncludePaths.AddRange(new string[] { Path.Combine(ThirdPartyPath, "quickjs", "Inc") });
- PublicIncludePaths.AddRange(new string[] { Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "quickjs", "Inc") });
-
- string LibraryPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "quickjs", "Lib"));
+ string LibraryPath = Path.GetFullPath(Path.Combine(ThirdPartyPath, "quickjs", "Lib"));
if (Target.Platform == UnrealTargetPlatform.Win64)
{
string V8LibraryPath = Path.Combine(LibraryPath, "Win64MD");
diff --git a/Plugins/Puerts/Source/JsEnv/Private/ContainerMeta.cpp b/Plugins/Puerts/Source/JsEnv/Private/ContainerMeta.cpp
index 1d02348..21db027 100644
--- a/Plugins/Puerts/Source/JsEnv/Private/ContainerMeta.cpp
+++ b/Plugins/Puerts/Source/JsEnv/Private/ContainerMeta.cpp
@@ -228,7 +228,12 @@ PropertyMacro* FContainerMeta::GetObjectProperty(UField* Field)
if (Enum->GetCppForm() == UEnum::ECppForm::EnumClass)
{
FEnumProperty* EnumProp =
+#if ENGINE_MAJOR_VERSION > 4 && ENGINE_MINOR_VERSION > 4 // 5.5+
+ new FEnumProperty(PropertyMetaRoot, NAME_None, RF_Transient);
+ EnumProp->SetEnum(Enum);
+#else
new FEnumProperty(PropertyMetaRoot, NAME_None, RF_Transient, 0, CPF_HasGetValueTypeHash, Enum);
+#endif
FNumericProperty* UnderlyingProp = new FByteProperty(EnumProp, TEXT("UnderlyingType"), RF_Transient);
EnumProp->AddCppProperty(UnderlyingProp);
EnumProp->ElementSize = UnderlyingProp->ElementSize;
diff --git a/Plugins/Puerts/Source/JsEnv/Private/CppObjectMapper.cpp b/Plugins/Puerts/Source/JsEnv/Private/CppObjectMapper.cpp
index a805312..6939171 100644
--- a/Plugins/Puerts/Source/JsEnv/Private/CppObjectMapper.cpp
+++ b/Plugins/Puerts/Source/JsEnv/Private/CppObjectMapper.cpp
@@ -11,11 +11,6 @@
namespace PUERTS_NAMESPACE
{
-template
-inline void __USE(T&&)
-{
-}
-
static void ThrowException(v8::Isolate* Isolate, const char* Message)
{
auto ExceptionStr = v8::String::NewFromUtf8(Isolate, Message, v8::NewStringType::kNormal).ToLocalChecked();
diff --git a/Plugins/Puerts/Source/JsEnv/Private/Ext/UEExtension.cpp b/Plugins/Puerts/Source/JsEnv/Private/Ext/UEExtension.cpp
index 59c1777..629b113 100644
--- a/Plugins/Puerts/Source/JsEnv/Private/Ext/UEExtension.cpp
+++ b/Plugins/Puerts/Source/JsEnv/Private/Ext/UEExtension.cpp
@@ -81,7 +81,12 @@ static void FText_Format(const v8::FunctionCallbackInfo& Info)
}
#endif
-struct AutoRegisterForUE
+#if ENGINE_MAJOR_VERSION > 4
+UsingUClass(AActor);
+UsingUStruct(FHitResult)
+#endif
+
+ struct AutoRegisterForUE
{
AutoRegisterForUE()
{
@@ -130,6 +135,10 @@ struct AutoRegisterForUE
.Function("Format", FText_Format, &FormatSignature)
.Register();
#endif
+
+#if ENGINE_MAJOR_VERSION > 4
+ PUERTS_NAMESPACE::DefineClass().Method("GetActor", MakeFunction(&FHitResult::GetActor)).Register();
+#endif
}
};
diff --git a/Plugins/Puerts/Source/JsEnv/Private/Gen/FBox2D_Wrap.cpp b/Plugins/Puerts/Source/JsEnv/Private/Gen/FBox2D_Wrap.cpp
index 1841b26..309278b 100644
--- a/Plugins/Puerts/Source/JsEnv/Private/Gen/FBox2D_Wrap.cpp
+++ b/Plugins/Puerts/Source/JsEnv/Private/Gen/FBox2D_Wrap.cpp
@@ -8,746 +8,44 @@
// gen by puerts gen tools
-#include "GenHeaders.h"
#include "CoreMinimal.h"
-#include "DataTransfer.h"
-#include "JSClassRegister.h"
-
-// unsupported method : operator+= FBox2D &(const FVector2D &) __attribute__((thiscall))
-
-// unsupported method : operator+= FBox2D &(const FBox2D &) __attribute__((thiscall))
-
-static void* _FBox2DNew_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- FBox2D* Obj = new FBox2D();
-
- // UE_LOG(LogTemp, Warning, TEXT("_FBox2DNew_:%p"), Obj);
- return Obj;
- }
- }
- if (Info.Length() == 1)
- {
- if (Info[0]->IsNumber())
- {
- EForceInit Arg0 = EForceInit(Info[0]->ToInt32(Context).ToLocalChecked()->Value());
- FBox2D* Obj = new FBox2D(Arg0);
-
- // UE_LOG(LogTemp, Warning, TEXT("_FBox2DNew_:%p"), Obj);
- return Obj;
- }
- }
- if (Info.Length() == 2)
- {
- if (Info[0]->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(Isolate, Info[0]->ToObject(Context).ToLocalChecked()) &&
- Info[1]->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(Isolate, Info[1]->ToObject(Context).ToLocalChecked()))
- {
- const FVector2D* Arg0 =
- PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info[0]->ToObject(Context).ToLocalChecked());
- const FVector2D* Arg1 =
- PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info[1]->ToObject(Context).ToLocalChecked());
- FBox2D* Obj = new FBox2D(*Arg0, *Arg1);
-
- // UE_LOG(LogTemp, Warning, TEXT("_FBox2DNew_:%p"), Obj);
- return Obj;
- }
- }
- if (Info.Length() == 2)
- {
- if (Info[0]->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(Isolate, Info[0]->ToObject(Context).ToLocalChecked()) &&
- Info[1]->IsNumber())
- {
- const FVector2D* Arg0 =
- PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info[0]->ToObject(Context).ToLocalChecked());
- const int32 Arg1 = Info[1]->ToInteger(Context).ToLocalChecked()->Value();
- FBox2D* Obj = new FBox2D(Arg0, Arg1);
-
- // UE_LOG(LogTemp, Warning, TEXT("_FBox2DNew_:%p"), Obj);
- return Obj;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
- return nullptr;
-}
-
-static void _FBox2DDelete_(void* Ptr, void* ClassData, void* EnvData)
-{
- FBox2D* Self = static_cast(Ptr);
- // UE_LOG(LogTemp, Warning, TEXT("_FBox2DDelete_:%p"), Self);
- delete Self;
-}
-static void FBox2DM_op_Equality(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(Isolate, Info[0]->ToObject(Context).ToLocalChecked()))
- {
- const FBox2D* Arg0 =
- PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info[0]->ToObject(Context).ToLocalChecked());
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_op_Equality] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->operator==(*Arg0);
- auto V8Result = v8::Boolean::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FBox2DM_op_Inequality(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(Isolate, Info[0]->ToObject(Context).ToLocalChecked()))
- {
- const FBox2D* Arg0 =
- PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info[0]->ToObject(Context).ToLocalChecked());
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_op_Inequality] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->operator!=(*Arg0);
- auto V8Result = v8::Boolean::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FBox2DM_op_Addition(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(Isolate, Info[0]->ToObject(Context).ToLocalChecked()))
- {
- const FVector2D* Arg0 =
- PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info[0]->ToObject(Context).ToLocalChecked());
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_op_Addition] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->operator+(*Arg0);
- void* Ptr = new FBox2D(MethodResult);
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, Ptr, false);
-
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- if (Info.Length() == 1)
- {
- if (Info[0]->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(Isolate, Info[0]->ToObject(Context).ToLocalChecked()))
- {
- const FBox2D* Arg0 =
- PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info[0]->ToObject(Context).ToLocalChecked());
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_op_Addition] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->operator+(*Arg0);
- void* Ptr = new FBox2D(MethodResult);
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, Ptr, false);
-
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FBox2DM_set_Item(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsNumber())
- {
- int32 Arg0 = Info[0]->ToInteger(Context).ToLocalChecked()->Value();
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_set_Item] Attempt to access a NULL self pointer");
- return;
- }
- Self->operator[](Arg0);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FBox2DM_ComputeSquaredDistanceToPoint(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(Isolate, Info[0]->ToObject(Context).ToLocalChecked()))
- {
- const FVector2D* Arg0 =
- PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info[0]->ToObject(Context).ToLocalChecked());
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_ComputeSquaredDistanceToPoint] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->ComputeSquaredDistanceToPoint(*Arg0);
- auto V8Result = v8::Number::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FBox2DM_ExpandBy(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsNumber())
- {
- const float Arg0 = Info[0]->ToNumber(Context).ToLocalChecked()->Value();
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_ExpandBy] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->ExpandBy(Arg0);
- void* Ptr = new FBox2D(MethodResult);
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, Ptr, false);
-
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FBox2DM_GetArea(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_GetArea] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->GetArea();
- auto V8Result = v8::Number::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FBox2DM_GetCenter(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_GetCenter] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->GetCenter();
- void* Ptr = new FVector2D(MethodResult);
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, Ptr, false);
-
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FBox2DM_GetCenterAndExtents(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 2)
- {
- if (Info[0]->IsObject() && PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[0])->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(
- Isolate, PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[0])->ToObject(Context).ToLocalChecked()) &&
- Info[1]->IsObject() && PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[1])->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(
- Isolate, PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[1])->ToObject(Context).ToLocalChecked()))
- {
- FVector2D* Arg0 = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(
- PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[0])->ToObject(Context).ToLocalChecked());
- FVector2D* Arg1 = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(
- PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[1])->ToObject(Context).ToLocalChecked());
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_GetCenterAndExtents] Attempt to access a NULL self pointer");
- return;
- }
- Self->GetCenterAndExtents(*Arg0, *Arg1);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FBox2DM_GetClosestPointTo(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(Isolate, Info[0]->ToObject(Context).ToLocalChecked()))
- {
- const FVector2D* Arg0 =
- PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info[0]->ToObject(Context).ToLocalChecked());
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_GetClosestPointTo] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->GetClosestPointTo(*Arg0);
- void* Ptr = new FVector2D(MethodResult);
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, Ptr, false);
-
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FBox2DM_GetExtent(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_GetExtent] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->GetExtent();
- void* Ptr = new FVector2D(MethodResult);
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, Ptr, false);
-
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FBox2DM_GetSize(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_GetSize] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->GetSize();
- void* Ptr = new FVector2D(MethodResult);
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, Ptr, false);
-
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FBox2DM_Init(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FBox2D::M_Init] Attempt to access a NULL self pointer");
- return;
- }
- Self->Init();
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FBox2DM_Intersect(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(Isolate, Info[0]->ToObject(Context).ToLocalChecked()))
- {
- const FBox2D* Arg0 =
- PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info[0]->ToObject(Context).ToLocalChecked());
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_Intersect] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->Intersect(*Arg0);
- auto V8Result = v8::Boolean::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FBox2DM_IsInside(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(Isolate, Info[0]->ToObject(Context).ToLocalChecked()))
- {
- const FVector2D* Arg0 =
- PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info[0]->ToObject(Context).ToLocalChecked());
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_IsInside] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->IsInside(*Arg0);
- auto V8Result = v8::Boolean::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- if (Info.Length() == 1)
- {
- if (Info[0]->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(Isolate, Info[0]->ToObject(Context).ToLocalChecked()))
- {
- const FBox2D* Arg0 =
- PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info[0]->ToObject(Context).ToLocalChecked());
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_IsInside] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->IsInside(*Arg0);
- auto V8Result = v8::Boolean::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FBox2DM_ShiftBy(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(Isolate, Info[0]->ToObject(Context).ToLocalChecked()))
- {
- const FVector2D* Arg0 =
- PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info[0]->ToObject(Context).ToLocalChecked());
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_ShiftBy] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->ShiftBy(*Arg0);
- void* Ptr = new FBox2D(MethodResult);
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, Ptr, false);
-
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FBox2DM_ToString(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FBox2D::M_ToString] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->ToString();
- auto V8Result =
- v8::String::NewFromUtf8(Isolate, TCHAR_TO_UTF8(*MethodResult), v8::NewStringType::kNormal).ToLocalChecked();
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void _FBox2DMinGet_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
-
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
-
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FBox2D::Min] Attempt to access a NULL self pointer");
- return;
- }
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, &(Self->Min), true);
-
- PUERTS_NAMESPACE::DataTransfer::LinkOuter(Context, Info.Holder(), V8Result);
- Info.GetReturnValue().Set(V8Result);
-}
-static void _FBox2DMinSet_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
-
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FBox2D::Min] Attempt to access a NULL self pointer");
- return;
- }
- auto Value = Info[0];
-
- Self->Min = *PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Value->ToObject(Context).ToLocalChecked());
-}
-static void _FBox2DMaxGet_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
-
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
-
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FBox2D::Max] Attempt to access a NULL self pointer");
- return;
- }
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, &(Self->Max), true);
-
- PUERTS_NAMESPACE::DataTransfer::LinkOuter(Context, Info.Holder(), V8Result);
- Info.GetReturnValue().Set(V8Result);
-}
-static void _FBox2DMaxSet_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
-
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FBox2D::Max] Attempt to access a NULL self pointer");
- return;
- }
- auto Value = Info[0];
-
- Self->Max = *PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Value->ToObject(Context).ToLocalChecked());
-}
-static void _FBox2DbIsValidGet_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
-
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
-
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FBox2D::bIsValid] Attempt to access a NULL self pointer");
- return;
- }
-
- auto V8Result = v8::Boolean::New(Isolate, Self->bIsValid);
- PUERTS_NAMESPACE::DataTransfer::LinkOuter(Context, Info.Holder(), V8Result);
- Info.GetReturnValue().Set(V8Result);
-}
-static void _FBox2DbIsValidSet_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
-
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FBox2D::bIsValid] Attempt to access a NULL self pointer");
- return;
- }
- auto Value = Info[0];
-
- Self->bIsValid = Value->ToBoolean(Isolate)->Value();
-}
+#include "UsingTypeDecl.hpp"
struct AutoRegisterForFBox2D
{
AutoRegisterForFBox2D()
{
- PUERTS_NAMESPACE::JSClassDefinition Def = JSClassEmptyDefinition;
-
- static PUERTS_NAMESPACE::JSPropertyInfo Properties[] = {{"Min", _FBox2DMinGet_, _FBox2DMinSet_},
- {"Max", _FBox2DMaxGet_, _FBox2DMaxSet_}, {"bIsValid", _FBox2DbIsValidGet_, _FBox2DbIsValidSet_}, {0, 0, 0}};
-
- static PUERTS_NAMESPACE::JSFunctionInfo Methods[] = {{"op_Equality", FBox2DM_op_Equality},
- {"op_Inequality", FBox2DM_op_Inequality}, {"op_Addition", FBox2DM_op_Addition}, {"set_Item", FBox2DM_set_Item},
- {"ComputeSquaredDistanceToPoint", FBox2DM_ComputeSquaredDistanceToPoint}, {"ExpandBy", FBox2DM_ExpandBy},
- {"GetArea", FBox2DM_GetArea}, {"GetCenter", FBox2DM_GetCenter}, {"GetCenterAndExtents", FBox2DM_GetCenterAndExtents},
- {"GetClosestPointTo", FBox2DM_GetClosestPointTo}, {"GetExtent", FBox2DM_GetExtent}, {"GetSize", FBox2DM_GetSize},
- {"Init", FBox2DM_Init}, {"Intersect", FBox2DM_Intersect}, {"IsInside", FBox2DM_IsInside}, {"ShiftBy", FBox2DM_ShiftBy},
- {"ToString", FBox2DM_ToString}, {0, 0}};
-
- static PUERTS_NAMESPACE::JSFunctionInfo Functions[] = {{0, 0}};
-
- Def.UETypeName = "Box2D";
-
- Def.SetInitialize(_FBox2DNew_);
- Def.Finalize = _FBox2DDelete_;
- Def.Properties = Properties;
- Def.Methods = Methods;
- Def.Functions = Functions;
-
- PUERTS_NAMESPACE::RegisterJSClass(Def);
+ puerts::DefineClass()
+ .Constructor(CombineConstructors(MakeConstructor(FBox2D), MakeConstructor(FBox2D, EForceInit),
+ MakeConstructor(FBox2D, const FVector2D&, const FVector2D&), MakeConstructor(FBox2D, const FVector2D*, const int32),
+ MakeConstructor(FBox2D, const TArray&)))
+ .Property("Min", MakeProperty(&FBox2D::Min))
+ .Property("Max", MakeProperty(&FBox2D::Max))
+ .Property("bIsValid", MakeProperty(&FBox2D::bIsValid))
+ .Method("op_Equality", MakeFunction(&FBox2D::operator==))
+ .Method("op_Inequality", MakeFunction(&FBox2D::operator!=))
+ .Method("op_Addition", CombineOverloads(MakeOverload(FBox2D(FBox2D::*)(const FVector2D&) const, &FBox2D::operator+),
+ MakeOverload(FBox2D(FBox2D::*)(const FBox2D&) const, &FBox2D::operator+)))
+ .Method("set_Item", SelectFunction(FVector2D & (FBox2D::*) (int32), &FBox2D::operator[]))
+ .Method("ComputeSquaredDistanceToPoint", MakeFunction(&FBox2D::ComputeSquaredDistanceToPoint))
+#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION > 2
+ .Method("ExpandBy", SelectFunction(FBox2D(FBox2D::*)(const double W) const, &FBox2D::ExpandBy))
+#else
+ .Method("ExpandBy", SelectFunction(FBox2D(FBox2D::*)(const float W) const, &FBox2D::ExpandBy))
+#endif
+ .Method("GetArea", MakeFunction(&FBox2D::GetArea))
+ .Method("GetCenter", MakeFunction(&FBox2D::GetCenter))
+ .Method("GetCenterAndExtents", MakeFunction(&FBox2D::GetCenterAndExtents))
+ .Method("GetClosestPointTo", MakeFunction(&FBox2D::GetClosestPointTo))
+ .Method("GetExtent", MakeFunction(&FBox2D::GetExtent))
+ .Method("GetSize", MakeFunction(&FBox2D::GetSize))
+ .Method("Init", MakeFunction(&FBox2D::Init))
+ .Method("Intersect", MakeFunction(&FBox2D::Intersect))
+ .Method("IsInside", CombineOverloads(MakeOverload(bool (FBox2D::*)(const FVector2D&) const, &FBox2D::IsInside),
+ MakeOverload(bool (FBox2D::*)(const FBox2D&) const, &FBox2D::IsInside)))
+ .Method("ShiftBy", MakeFunction(&FBox2D::ShiftBy))
+ .Method("ToString", MakeFunction(&FBox2D::ToString))
+ .Register();
}
};
diff --git a/Plugins/Puerts/Source/JsEnv/Private/Gen/FColor_Wrap.cpp b/Plugins/Puerts/Source/JsEnv/Private/Gen/FColor_Wrap.cpp
index a6ee988..509073b 100644
--- a/Plugins/Puerts/Source/JsEnv/Private/Gen/FColor_Wrap.cpp
+++ b/Plugins/Puerts/Source/JsEnv/Private/Gen/FColor_Wrap.cpp
@@ -8,552 +8,49 @@
// gen by puerts gen tools
-#include "GenHeaders.h"
#include "CoreMinimal.h"
-#include "DataTransfer.h"
-#include "JSClassRegister.h"
-
-// unsupported method : operator+= void (const FColor &) __attribute__((thiscall))
-
-static void* _FColorNew_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- FColor* Obj = new FColor();
-
- // UE_LOG(LogTemp, Warning, TEXT("_FColorNew_:%p"), Obj);
- return Obj;
- }
- }
- if (Info.Length() == 1)
- {
- if (Info[0]->IsNumber())
- {
- EForceInit Arg0 = EForceInit(Info[0]->ToInt32(Context).ToLocalChecked()->Value());
- FColor* Obj = new FColor(Arg0);
-
- // UE_LOG(LogTemp, Warning, TEXT("_FColorNew_:%p"), Obj);
- return Obj;
- }
- }
- if (Info.Length() == 4)
- {
- if (Info[0]->IsNumber() && Info[1]->IsNumber() && Info[2]->IsNumber() && Info[3]->IsNumber())
- {
- uint8 Arg0 = Info[0]->ToInteger(Context).ToLocalChecked()->Value();
- uint8 Arg1 = Info[1]->ToInteger(Context).ToLocalChecked()->Value();
- uint8 Arg2 = Info[2]->ToInteger(Context).ToLocalChecked()->Value();
- uint8 Arg3 = Info[3]->ToInteger(Context).ToLocalChecked()->Value();
- FColor* Obj = new FColor(Arg0, Arg1, Arg2, Arg3);
-
- // UE_LOG(LogTemp, Warning, TEXT("_FColorNew_:%p"), Obj);
- return Obj;
- }
- }
- if (Info.Length() == 1)
- {
- if (Info[0]->IsNumber())
- {
- uint32 Arg0 = Info[0]->ToInteger(Context).ToLocalChecked()->Value();
- FColor* Obj = new FColor(Arg0);
-
- // UE_LOG(LogTemp, Warning, TEXT("_FColorNew_:%p"), Obj);
- return Obj;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
- return nullptr;
-}
-
-static void _FColorDelete_(void* Ptr, void* ClassData, void* EnvData)
-{
- FColor* Self = static_cast(Ptr);
- // UE_LOG(LogTemp, Warning, TEXT("_FColorDelete_:%p"), Self);
- delete Self;
-}
-static void FColorM_DWColor(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FColor::M_DWColor] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->DWColor();
- auto V8Result = v8::Integer::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FColor::M_DWColor] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->DWColor();
- auto V8Result = v8::Integer::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FColorM_op_Equality(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(Isolate, Info[0]->ToObject(Context).ToLocalChecked()))
- {
- const FColor* Arg0 =
- PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info[0]->ToObject(Context).ToLocalChecked());
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FColor::M_op_Equality] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->operator==(*Arg0);
- auto V8Result = v8::Boolean::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FColorM_op_Inequality(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(Isolate, Info[0]->ToObject(Context).ToLocalChecked()))
- {
- const FColor* Arg0 =
- PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info[0]->ToObject(Context).ToLocalChecked());
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FColor::M_op_Inequality] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->operator!=(*Arg0);
- auto V8Result = v8::Boolean::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FColorM_FromRGBE(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FColor::M_FromRGBE] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->FromRGBE();
- void* Ptr = new FLinearColor(MethodResult);
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, Ptr, false);
-
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FColorS_FromHex(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsString())
- {
- const FString Arg0 = UTF8_TO_TCHAR(*(v8::String::Utf8Value(Isolate, Info[0])));
- auto MethodResult = FColor::FromHex(Arg0);
- void* Ptr = new FColor(MethodResult);
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, Ptr, false);
-
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FColorS_MakeRandomColor(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto MethodResult = FColor::MakeRandomColor();
- void* Ptr = new FColor(MethodResult);
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, Ptr, false);
-
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FColorS_MakeRedToGreenColorFromScalar(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsNumber())
- {
- float Arg0 = Info[0]->ToNumber(Context).ToLocalChecked()->Value();
- auto MethodResult = FColor::MakeRedToGreenColorFromScalar(Arg0);
- void* Ptr = new FColor(MethodResult);
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, Ptr, false);
-
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FColorS_MakeFromColorTemperature(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsNumber())
- {
- float Arg0 = Info[0]->ToNumber(Context).ToLocalChecked()->Value();
- auto MethodResult = FColor::MakeFromColorTemperature(Arg0);
- void* Ptr = new FColor(MethodResult);
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, Ptr, false);
-
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FColorM_WithAlpha(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsNumber())
- {
- uint8 Arg0 = Info[0]->ToInteger(Context).ToLocalChecked()->Value();
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FColor::M_WithAlpha] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->WithAlpha(Arg0);
- void* Ptr = new FColor(MethodResult);
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, Ptr, false);
-
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FColorM_ReinterpretAsLinear(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FColor::M_ReinterpretAsLinear] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->ReinterpretAsLinear();
- void* Ptr = new FLinearColor(MethodResult);
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, Ptr, false);
-
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FColorM_ToHex(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FColor::M_ToHex] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->ToHex();
- auto V8Result =
- v8::String::NewFromUtf8(Isolate, TCHAR_TO_UTF8(*MethodResult), v8::NewStringType::kNormal).ToLocalChecked();
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FColorM_ToString(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FColor::M_ToString] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->ToString();
- auto V8Result =
- v8::String::NewFromUtf8(Isolate, TCHAR_TO_UTF8(*MethodResult), v8::NewStringType::kNormal).ToLocalChecked();
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FColorM_InitFromString(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsString())
- {
- const FString Arg0 = UTF8_TO_TCHAR(*(v8::String::Utf8Value(Isolate, Info[0])));
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FColor::M_InitFromString] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->InitFromString(Arg0);
- auto V8Result = v8::Boolean::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FColorM_ToPackedARGB(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FColor::M_ToPackedARGB] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->ToPackedARGB();
- auto V8Result = v8::Integer::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FColorM_ToPackedABGR(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FColor::M_ToPackedABGR] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->ToPackedABGR();
- auto V8Result = v8::Integer::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FColorM_ToPackedRGBA(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FColor::M_ToPackedRGBA] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->ToPackedRGBA();
- auto V8Result = v8::Integer::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FColorM_ToPackedBGRA(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FColor::M_ToPackedBGRA] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->ToPackedBGRA();
- auto V8Result = v8::Integer::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
+#include "UsingTypeDecl.hpp"
struct AutoRegisterForFColor
{
AutoRegisterForFColor()
{
- PUERTS_NAMESPACE::JSClassDefinition Def = JSClassEmptyDefinition;
-
- static PUERTS_NAMESPACE::JSPropertyInfo Properties[] = {{0, 0, 0}};
-
- static PUERTS_NAMESPACE::JSFunctionInfo Methods[] = {{"DWColor", FColorM_DWColor}, {"op_Equality", FColorM_op_Equality},
- {"op_Inequality", FColorM_op_Inequality}, {"FromRGBE", FColorM_FromRGBE}, {"WithAlpha", FColorM_WithAlpha},
- {"ReinterpretAsLinear", FColorM_ReinterpretAsLinear}, {"ToHex", FColorM_ToHex}, {"ToString", FColorM_ToString},
- {"InitFromString", FColorM_InitFromString}, {"ToPackedARGB", FColorM_ToPackedARGB},
- {"ToPackedABGR", FColorM_ToPackedABGR}, {"ToPackedRGBA", FColorM_ToPackedRGBA}, {"ToPackedBGRA", FColorM_ToPackedBGRA},
- {0, 0}};
-
- static PUERTS_NAMESPACE::JSFunctionInfo Functions[] = {{"FromHex", FColorS_FromHex},
- {"MakeRandomColor", FColorS_MakeRandomColor}, {"MakeRedToGreenColorFromScalar", FColorS_MakeRedToGreenColorFromScalar},
- {"MakeFromColorTemperature", FColorS_MakeFromColorTemperature}, {0, 0}};
-
- Def.UETypeName = "Color";
-
- Def.SetInitialize(_FColorNew_);
- Def.Finalize = _FColorDelete_;
- Def.Properties = Properties;
- Def.Methods = Methods;
- Def.Functions = Functions;
-
- PUERTS_NAMESPACE::RegisterJSClass(Def);
+ puerts::DefineClass()
+ .Constructor(CombineConstructors(MakeConstructor(FColor), MakeConstructor(FColor, EForceInit),
+ MakeConstructor(FColor, uint8, uint8, uint8, uint8), MakeConstructor(FColor, uint32)))
+ .Method("DWColor", CombineOverloads(MakeOverload(uint32 & (FColor::*) (), &FColor::DWColor),
+ MakeOverload(const uint32& (FColor::*) () const, &FColor::DWColor)))
+ .Method("op_Equality", MakeFunction(&FColor::operator==))
+ .Method("op_Inequality", MakeFunction(&FColor::operator!=))
+ .Method("FromRGBE", MakeFunction(&FColor::FromRGBE))
+ .Function("FromHex", MakeFunction(&FColor::FromHex))
+ .Function("MakeRandomColor", MakeFunction(&FColor::MakeRandomColor))
+ .Function("MakeRedToGreenColorFromScalar", MakeFunction(&FColor::MakeRedToGreenColorFromScalar))
+ .Function("MakeFromColorTemperature", MakeFunction(&FColor::MakeFromColorTemperature))
+ .Method("WithAlpha", MakeFunction(&FColor::WithAlpha))
+ .Method("ReinterpretAsLinear", MakeFunction(&FColor::ReinterpretAsLinear))
+ .Method("ToHex", MakeFunction(&FColor::ToHex))
+ .Method("ToString", MakeFunction(&FColor::ToString))
+ .Method("InitFromString", MakeFunction(&FColor::InitFromString))
+ .Method("ToPackedARGB", MakeFunction(&FColor::ToPackedARGB))
+ .Method("ToPackedABGR", MakeFunction(&FColor::ToPackedABGR))
+ .Method("ToPackedRGBA", MakeFunction(&FColor::ToPackedRGBA))
+ .Method("ToPackedBGRA", MakeFunction(&FColor::ToPackedBGRA))
+ .Variable("White", MakeReadonlyVariable(&FColor::White))
+ .Variable("Black", MakeReadonlyVariable(&FColor::Black))
+ .Variable("Transparent", MakeReadonlyVariable(&FColor::Transparent))
+ .Variable("Red", MakeReadonlyVariable(&FColor::Red))
+ .Variable("Green", MakeReadonlyVariable(&FColor::Green))
+ .Variable("Blue", MakeReadonlyVariable(&FColor::Blue))
+ .Variable("Yellow", MakeReadonlyVariable(&FColor::Yellow))
+ .Variable("Cyan", MakeReadonlyVariable(&FColor::Cyan))
+ .Variable("Magenta", MakeReadonlyVariable(&FColor::Magenta))
+ .Variable("Orange", MakeReadonlyVariable(&FColor::Orange))
+ .Variable("Purple", MakeReadonlyVariable(&FColor::Purple))
+ .Variable("Turquoise", MakeReadonlyVariable(&FColor::Turquoise))
+ .Variable("Silver", MakeReadonlyVariable(&FColor::Silver))
+ .Variable("Emerald", MakeReadonlyVariable(&FColor::Emerald))
+ .Register();
}
};
diff --git a/Plugins/Puerts/Source/JsEnv/Private/Gen/FGuid_Wrap.cpp b/Plugins/Puerts/Source/JsEnv/Private/Gen/FGuid_Wrap.cpp
index bd075c7..c6d7c66 100644
--- a/Plugins/Puerts/Source/JsEnv/Private/Gen/FGuid_Wrap.cpp
+++ b/Plugins/Puerts/Source/JsEnv/Private/Gen/FGuid_Wrap.cpp
@@ -8,416 +8,33 @@
// gen by puerts gen tools
-#include "GenHeaders.h"
#include "CoreMinimal.h"
-#include "DataTransfer.h"
-#include "JSClassRegister.h"
-
-static void* _FGuidNew_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- FGuid* Obj = new FGuid();
-
- // UE_LOG(LogTemp, Warning, TEXT("_FGuidNew_:%p"), Obj);
- return Obj;
- }
- }
- if (Info.Length() == 4)
- {
- if (Info[0]->IsNumber() && Info[1]->IsNumber() && Info[2]->IsNumber() && Info[3]->IsNumber())
- {
- uint32 Arg0 = Info[0]->ToInteger(Context).ToLocalChecked()->Value();
- uint32 Arg1 = Info[1]->ToInteger(Context).ToLocalChecked()->Value();
- uint32 Arg2 = Info[2]->ToInteger(Context).ToLocalChecked()->Value();
- uint32 Arg3 = Info[3]->ToInteger(Context).ToLocalChecked()->Value();
- FGuid* Obj = new FGuid(Arg0, Arg1, Arg2, Arg3);
-
- // UE_LOG(LogTemp, Warning, TEXT("_FGuidNew_:%p"), Obj);
- return Obj;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
- return nullptr;
-}
-
-static void _FGuidDelete_(void* Ptr, void* ClassData, void* EnvData)
-{
- FGuid* Self = static_cast(Ptr);
- // UE_LOG(LogTemp, Warning, TEXT("_FGuidDelete_:%p"), Self);
- delete Self;
-}
-static void FGuidM_set_Item(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsNumber())
- {
- int32 Arg0 = Info[0]->ToInteger(Context).ToLocalChecked()->Value();
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FGuid::M_set_Item] Attempt to access a NULL self pointer");
- return;
- }
- Self->operator[](Arg0);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FGuidM_get_Item(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 1)
- {
- if (Info[0]->IsNumber())
- {
- int32 Arg0 = Info[0]->ToInteger(Context).ToLocalChecked()->Value();
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FGuid::M_get_Item] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->operator[](Arg0);
- auto V8Result = v8::Integer::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FGuidM_Invalidate(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FGuid::M_Invalidate] Attempt to access a NULL self pointer");
- return;
- }
- Self->Invalidate();
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FGuidM_IsValid(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::M_IsValid] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->IsValid();
- auto V8Result = v8::Boolean::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FGuidM_ToString(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FGuid::M_ToString] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->ToString();
- auto V8Result =
- v8::String::NewFromUtf8(Isolate, TCHAR_TO_UTF8(*MethodResult), v8::NewStringType::kNormal).ToLocalChecked();
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- if (Info.Length() == 1)
- {
- if (Info[0]->IsNumber())
- {
- EGuidFormats Arg0 = EGuidFormats(Info[0]->ToInt32(Context).ToLocalChecked()->Value());
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(
- Isolate, "[FGuid::M_ToString] Attempt to access a NULL self pointer");
- return;
- }
- auto MethodResult = Self->ToString(Arg0);
- auto V8Result =
- v8::String::NewFromUtf8(Isolate, TCHAR_TO_UTF8(*MethodResult), v8::NewStringType::kNormal).ToLocalChecked();
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FGuidS_NewGuid(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 0)
- {
- if (true)
- {
- auto MethodResult = FGuid::NewGuid();
- void* Ptr = new FGuid(MethodResult);
-
- auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct(Isolate, Context, Ptr, false);
-
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FGuidS_Parse(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 2)
- {
- if (Info[0]->IsString() && Info[1]->IsObject() && PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[1])->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(
- Isolate, PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[1])->ToObject(Context).ToLocalChecked()))
- {
- const FString Arg0 = UTF8_TO_TCHAR(*(v8::String::Utf8Value(Isolate, Info[0])));
- FGuid* Arg1 = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(
- PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[1])->ToObject(Context).ToLocalChecked());
- auto MethodResult = FGuid::Parse(Arg0, *Arg1);
- auto V8Result = v8::Boolean::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void FGuidS_ParseExact(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
- if (Info.Length() == 3)
- {
- if (Info[0]->IsString() && Info[1]->IsNumber() && Info[2]->IsObject() &&
- PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[2])->IsObject() &&
-
- PUERTS_NAMESPACE::DataTransfer::IsInstanceOf(
- Isolate, PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[2])->ToObject(Context).ToLocalChecked()))
- {
- const FString Arg0 = UTF8_TO_TCHAR(*(v8::String::Utf8Value(Isolate, Info[0])));
- EGuidFormats Arg1 = EGuidFormats(Info[1]->ToInt32(Context).ToLocalChecked()->Value());
- FGuid* Arg2 = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(
- PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[2])->ToObject(Context).ToLocalChecked());
- auto MethodResult = FGuid::ParseExact(Arg0, Arg1, *Arg2);
- auto V8Result = v8::Boolean::New(Isolate, MethodResult);
- Info.GetReturnValue().Set(V8Result);
-
- return;
- }
- }
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
-}
-
-static void _FGuidAGet_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
-
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
-
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::A] Attempt to access a NULL self pointer");
- return;
- }
-
- auto V8Result = v8::Integer::New(Isolate, Self->A);
- PUERTS_NAMESPACE::DataTransfer::LinkOuter(Context, Info.Holder(), V8Result);
- Info.GetReturnValue().Set(V8Result);
-}
-static void _FGuidASet_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
-
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::A] Attempt to access a NULL self pointer");
- return;
- }
- auto Value = Info[0];
-
- Self->A = Value->ToInteger(Context).ToLocalChecked()->Value();
-}
-static void _FGuidBGet_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
-
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
-
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::B] Attempt to access a NULL self pointer");
- return;
- }
-
- auto V8Result = v8::Integer::New(Isolate, Self->B);
- PUERTS_NAMESPACE::DataTransfer::LinkOuter(Context, Info.Holder(), V8Result);
- Info.GetReturnValue().Set(V8Result);
-}
-static void _FGuidBSet_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
-
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::B] Attempt to access a NULL self pointer");
- return;
- }
- auto Value = Info[0];
-
- Self->B = Value->ToInteger(Context).ToLocalChecked()->Value();
-}
-static void _FGuidCGet_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
-
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
-
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::C] Attempt to access a NULL self pointer");
- return;
- }
-
- auto V8Result = v8::Integer::New(Isolate, Self->C);
- PUERTS_NAMESPACE::DataTransfer::LinkOuter(Context, Info.Holder(), V8Result);
- Info.GetReturnValue().Set(V8Result);
-}
-static void _FGuidCSet_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
-
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::C] Attempt to access a NULL self pointer");
- return;
- }
- auto Value = Info[0];
-
- Self->C = Value->ToInteger(Context).ToLocalChecked()->Value();
-}
-static void _FGuidDGet_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
-
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
-
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::D] Attempt to access a NULL self pointer");
- return;
- }
-
- auto V8Result = v8::Integer::New(Isolate, Self->D);
- PUERTS_NAMESPACE::DataTransfer::LinkOuter(Context, Info.Holder(), V8Result);
- Info.GetReturnValue().Set(V8Result);
-}
-static void _FGuidDSet_(const v8::FunctionCallbackInfo& Info)
-{
- v8::Isolate* Isolate = Info.GetIsolate();
- v8::Local Context = Isolate->GetCurrentContext();
-
- auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast(Info.Holder());
- if (!Self)
- {
- PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::D] Attempt to access a NULL self pointer");
- return;
- }
- auto Value = Info[0];
-
- Self->D = Value->ToInteger(Context).ToLocalChecked()->Value();
-}
+#include "UsingTypeDecl.hpp"
struct AutoRegisterForFGuid
{
AutoRegisterForFGuid()
{
- PUERTS_NAMESPACE::JSClassDefinition Def = JSClassEmptyDefinition;
-
- static PUERTS_NAMESPACE::JSPropertyInfo Properties[] = {{"A", _FGuidAGet_, _FGuidASet_}, {"B", _FGuidBGet_, _FGuidBSet_},
- {"C", _FGuidCGet_, _FGuidCSet_}, {"D", _FGuidDGet_, _FGuidDSet_}, {0, 0, 0}};
-
- static PUERTS_NAMESPACE::JSFunctionInfo Methods[] = {{"set_Item", FGuidM_set_Item}, {"get_Item", FGuidM_get_Item},
- {"Invalidate", FGuidM_Invalidate}, {"IsValid", FGuidM_IsValid}, {"ToString", FGuidM_ToString}, {0, 0}};
-
- static PUERTS_NAMESPACE::JSFunctionInfo Functions[] = {
- {"NewGuid", FGuidS_NewGuid}, {"Parse", FGuidS_Parse}, {"ParseExact", FGuidS_ParseExact}, {0, 0}};
-
- Def.UETypeName = "Guid";
-
- Def.SetInitialize(_FGuidNew_);
- Def.Finalize = _FGuidDelete_;
- Def.Properties = Properties;
- Def.Methods = Methods;
- Def.Functions = Functions;
-
- PUERTS_NAMESPACE::RegisterJSClass(Def);
+ puerts::DefineClass()
+ .Constructor(CombineConstructors(MakeConstructor(FGuid), MakeConstructor(FGuid, uint32, uint32, uint32, uint32)))
+ .Property("A", MakeProperty(&FGuid::A))
+ .Property("B", MakeProperty(&FGuid::B))
+ .Property("C", MakeProperty(&FGuid::C))
+ .Property("D", MakeProperty(&FGuid::D))
+ .Method("set_Item", SelectFunction(uint32 & (FGuid::*) (int32), &FGuid::operator[]))
+ .Method("get_Item", SelectFunction(const uint32& (FGuid::*) (int32) const, &FGuid::operator[]))
+ .Method("Invalidate", MakeFunction(&FGuid::Invalidate))
+ .Method("IsValid", MakeFunction(&FGuid::IsValid))
+#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION > 2
+ .Method("ToString", MakeFunction(&FGuid::ToString, EGuidFormats::Digits))
+#else
+ .Method("ToString", CombineOverloads(MakeOverload(FString(FGuid::*)() const, &FGuid::ToString),
+ MakeOverload(FString(FGuid::*)(EGuidFormats Format) const, &FGuid::ToString)))
+#endif
+ .Function("NewGuid", MakeFunction(&FGuid::NewGuid))
+ .Function("Parse", MakeFunction(&FGuid::Parse))
+ .Function("ParseExact", MakeFunction(&FGuid::ParseExact))
+ .Register();
}
};
diff --git a/Plugins/Puerts/Source/JsEnv/Private/Gen/FIntPoint_Wrap.cpp b/Plugins/Puerts/Source/JsEnv/Private/Gen/FIntPoint_Wrap.cpp
index 719f2a1..33d757c 100644
--- a/Plugins/Puerts/Source/JsEnv/Private/Gen/FIntPoint_Wrap.cpp
+++ b/Plugins/Puerts/Source/JsEnv/Private/Gen/FIntPoint_Wrap.cpp
@@ -8,717 +8,44 @@
// gen by puerts gen tools
-#include "GenHeaders.h"
#include "CoreMinimal.h"
-#include "DataTransfer.h"
-#include "JSClassRegister.h"
-
-// unsupported method : operator() const int32 &(int32) __attribute__((thiscall)) const
-
-// unsupported method : operator() int32 &(int32) __attribute__((thiscall))
-
-// unsupported method : operator*= FIntPoint &(int32) __attribute__((thiscall))
-
-//