update templates working
parent
09b5000aca
commit
8778fa522c
26
.r3_history
26
.r3_history
|
@ -3,29 +3,3 @@ r3 create AnotherClass extends R3Object
|
||||||
r3 create OneMore extends R3Object
|
r3 create OneMore extends R3Object
|
||||||
r3 create AgainMore extends R3Object
|
r3 create AgainMore extends R3Object
|
||||||
r3 create AgainMoreAgain extends R3Object
|
r3 create AgainMoreAgain extends R3Object
|
||||||
r3 update-templates
|
|
||||||
r3 update-templates
|
|
||||||
r3 create AnotherClass extends R3Object
|
|
||||||
r3 create VectorApplierAgain extends Event
|
|
||||||
r3 update-templates
|
|
||||||
r3 update-templates
|
|
||||||
r3 update-options
|
|
||||||
r3 create AnotherClass extends R3Object
|
|
||||||
r3 create AnotherClass extends R3Object
|
|
||||||
r3 create VectorApplierAgain extends Event
|
|
||||||
r3 create VectorApplierAgain extends Event
|
|
||||||
r3 update-templates
|
|
||||||
r3 create AnotherClass extends R3Object
|
|
||||||
r3 create AnotherClass extends R3Object
|
|
||||||
r3 create VectorApplierAgain extends Event
|
|
||||||
r3 create VectorApplierAgain extends Event
|
|
||||||
r3 update-templates
|
|
||||||
r3 update-templates
|
|
||||||
r3 update-templates
|
|
||||||
r3 update-templates
|
|
||||||
r3 update-templates
|
|
||||||
r3 create AnotherClass extends R3Object
|
|
||||||
r3 create AnotherClass extends R3Object
|
|
||||||
r3 create VectorApplierAgain extends Event
|
|
||||||
r3 create VectorApplierAgain extends Event
|
|
||||||
r3 update-templates
|
|
||||||
|
|
|
@ -4,28 +4,24 @@ const Utils = require('r3-utils');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OPTIONS_START
|
OPTIONS_START
|
||||||
x=0
|
x=1
|
||||||
y=1
|
y=2
|
||||||
z=2
|
z=3
|
||||||
register=true
|
register=true
|
||||||
OPTIONS_END
|
OPTIONS_END
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
INSTANCE_OPTIONS_MAPPING_START
|
INSTANCE_OPTIONS_MAPPING_START
|
||||||
|
x=side.x
|
||||||
|
y=side.y
|
||||||
|
z=side.z
|
||||||
INSTANCE_OPTIONS_MAPPING_END
|
INSTANCE_OPTIONS_MAPPING_END
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LINKED_OBJECTS_START
|
LINKED_OBJECTS_START
|
||||||
LINKED_OBJECTS_END
|
LINKED_OBJECTS_END
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||||
|
register
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -48,26 +44,24 @@ class AnotherClass extends R3Object {
|
||||||
|
|
||||||
//OPTIONS_INIT_START
|
//OPTIONS_INIT_START
|
||||||
if (Utils.UndefinedOrNull(options.x)) {
|
if (Utils.UndefinedOrNull(options.x)) {
|
||||||
options.x = 0;
|
options.x = 1;
|
||||||
}
|
}
|
||||||
if (Utils.UndefinedOrNull(options.y)) {
|
if (Utils.UndefinedOrNull(options.y)) {
|
||||||
options.y = 1;
|
options.y = 2;
|
||||||
}
|
}
|
||||||
if (Utils.UndefinedOrNull(options.z)) {
|
if (Utils.UndefinedOrNull(options.z)) {
|
||||||
options.z = 2;
|
options.z = 3;
|
||||||
}
|
}
|
||||||
if (Utils.UndefinedOrNull(options.register)) {
|
if (Utils.UndefinedOrNull(options.register)) {
|
||||||
options.register = true;
|
options.register = true;
|
||||||
}
|
}
|
||||||
//OPTIONS_INIT_END
|
//OPTIONS_INIT_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_OPTIONS_INIT_START
|
//CUSTOM_OPTIONS_INIT_START
|
||||||
//CUSTOM_OPTIONS_INIT_END
|
//CUSTOM_OPTIONS_INIT_END
|
||||||
|
|
||||||
Object.assign(this, options);
|
Object.assign(this, options);
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_BEFORE_INIT_START
|
//CUSTOM_BEFORE_INIT_START
|
||||||
//CUSTOM_BEFORE_INIT_END
|
//CUSTOM_BEFORE_INIT_END
|
||||||
|
|
||||||
|
@ -86,10 +80,9 @@ class AnotherClass extends R3Object {
|
||||||
this.graphics.createInstance(
|
this.graphics.createInstance(
|
||||||
{
|
{
|
||||||
//CREATE_INSTANCE_OPTIONS_START
|
//CREATE_INSTANCE_OPTIONS_START
|
||||||
'x': this.x,
|
'side.x': this.x,
|
||||||
'y': this.y,
|
'side.y': this.y,
|
||||||
'z': this.z,
|
'side.z': this.z
|
||||||
'register': this.register
|
|
||||||
//CREATE_INSTANCE_OPTIONS_END
|
//CREATE_INSTANCE_OPTIONS_END
|
||||||
},
|
},
|
||||||
this
|
this
|
||||||
|
@ -97,7 +90,6 @@ class AnotherClass extends R3Object {
|
||||||
}
|
}
|
||||||
//CREATE_INSTANCE_BEFORE_END
|
//CREATE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_CREATE_INSTANCE_START
|
//CUSTOM_CREATE_INSTANCE_START
|
||||||
//CUSTOM_CREATE_INSTANCE_END
|
//CUSTOM_CREATE_INSTANCE_END
|
||||||
|
|
||||||
|
@ -117,24 +109,19 @@ class AnotherClass extends R3Object {
|
||||||
|
|
||||||
//UPDATE_INSTANCE_OPTIONS_START
|
//UPDATE_INSTANCE_OPTIONS_START
|
||||||
if (property === 'x') {
|
if (property === 'x') {
|
||||||
this.instance.x = this.x;
|
this.instance.side.x = this.x;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (property === 'y') {
|
if (property === 'y') {
|
||||||
this.instance.y = this.y;
|
this.instance.side.y = this.y;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (property === 'z') {
|
if (property === 'z') {
|
||||||
this.instance.z = this.z;
|
this.instance.side.z = this.z;
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (property === 'register') {
|
|
||||||
this.instance.register = this.register;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//UPDATE_INSTANCE_OPTIONS_END
|
//UPDATE_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_UPDATE_INSTANCE_START
|
//CUSTOM_UPDATE_INSTANCE_START
|
||||||
//CUSTOM_UPDATE_INSTANCE_END
|
//CUSTOM_UPDATE_INSTANCE_END
|
||||||
|
|
||||||
|
@ -154,24 +141,19 @@ class AnotherClass extends R3Object {
|
||||||
|
|
||||||
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
||||||
if (property === 'x') {
|
if (property === 'x') {
|
||||||
this.x = this.instance.x;
|
this.x = this.instance.side.x;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (property === 'y') {
|
if (property === 'y') {
|
||||||
this.y = this.instance.y;
|
this.y = this.instance.side.y;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (property === 'z') {
|
if (property === 'z') {
|
||||||
this.z = this.instance.z;
|
this.z = this.instance.side.z;
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (property === 'register') {
|
|
||||||
this.register = this.instance.register;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
||||||
//CUSTOM_UPDATE_FROM_INSTANCE_END
|
//CUSTOM_UPDATE_FROM_INSTANCE_END
|
||||||
|
|
||||||
|
@ -189,7 +171,6 @@ class AnotherClass extends R3Object {
|
||||||
this.emit(Event.DISPOSE_OBJECT, this);
|
this.emit(Event.DISPOSE_OBJECT, this);
|
||||||
//DISPOSE_BEFORE_END
|
//DISPOSE_BEFORE_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_START
|
//CUSTOM_DISPOSE_START
|
||||||
//CUSTOM_DISPOSE_END
|
//CUSTOM_DISPOSE_END
|
||||||
|
|
||||||
|
@ -208,7 +189,6 @@ class AnotherClass extends R3Object {
|
||||||
this.emit(Event.DISPOSE_INSTANCE, this);
|
this.emit(Event.DISPOSE_INSTANCE, this);
|
||||||
//DISPOSE_INSTANCE_BEFORE_END
|
//DISPOSE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_INSTANCE_START
|
//CUSTOM_DISPOSE_INSTANCE_START
|
||||||
//CUSTOM_DISPOSE_INSTANCE_END
|
//CUSTOM_DISPOSE_INSTANCE_END
|
||||||
|
|
||||||
|
@ -219,7 +199,6 @@ class AnotherClass extends R3Object {
|
||||||
}
|
}
|
||||||
//DISPOSE_INSTANCE_TEMPLATE_END
|
//DISPOSE_INSTANCE_TEMPLATE_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_IMPLEMENTATION_START
|
//CUSTOM_IMPLEMENTATION_START
|
||||||
//CUSTOM_IMPLEMENTATION_END
|
//CUSTOM_IMPLEMENTATION_END
|
||||||
|
|
||||||
|
|
|
@ -4,21 +4,20 @@ const Utils = require('r3-utils');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OPTIONS_START
|
OPTIONS_START
|
||||||
|
a=2.0
|
||||||
|
b=3.0
|
||||||
|
something='hello'
|
||||||
OPTIONS_END
|
OPTIONS_END
|
||||||
|
|
||||||
|
|
||||||
INSTANCE_OPTIONS_MAPPING_START
|
INSTANCE_OPTIONS_MAPPING_START
|
||||||
INSTANCE_OPTIONS_MAPPING_END
|
INSTANCE_OPTIONS_MAPPING_END
|
||||||
|
|
||||||
|
|
||||||
LINKED_OBJECTS_START
|
LINKED_OBJECTS_START
|
||||||
LINKED_OBJECTS_END
|
LINKED_OBJECTS_END
|
||||||
|
|
||||||
|
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||||
|
b
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -40,15 +39,22 @@ class VectorApplierAgain extends Event {
|
||||||
this.emit(Event.OBJECT_CREATED, this);
|
this.emit(Event.OBJECT_CREATED, this);
|
||||||
|
|
||||||
//OPTIONS_INIT_START
|
//OPTIONS_INIT_START
|
||||||
|
if (Utils.UndefinedOrNull(options.a)) {
|
||||||
|
options.a = 2.0;
|
||||||
|
}
|
||||||
|
if (Utils.UndefinedOrNull(options.b)) {
|
||||||
|
options.b = 3.0;
|
||||||
|
}
|
||||||
|
if (Utils.UndefinedOrNull(options.something)) {
|
||||||
|
options.something = 'hello';
|
||||||
|
}
|
||||||
//OPTIONS_INIT_END
|
//OPTIONS_INIT_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_OPTIONS_INIT_START
|
//CUSTOM_OPTIONS_INIT_START
|
||||||
//CUSTOM_OPTIONS_INIT_END
|
//CUSTOM_OPTIONS_INIT_END
|
||||||
|
|
||||||
Object.assign(this, options);
|
Object.assign(this, options);
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_BEFORE_INIT_START
|
//CUSTOM_BEFORE_INIT_START
|
||||||
//CUSTOM_BEFORE_INIT_END
|
//CUSTOM_BEFORE_INIT_END
|
||||||
|
|
||||||
|
@ -67,7 +73,8 @@ class VectorApplierAgain extends Event {
|
||||||
this.graphics.createInstance(
|
this.graphics.createInstance(
|
||||||
{
|
{
|
||||||
//CREATE_INSTANCE_OPTIONS_START
|
//CREATE_INSTANCE_OPTIONS_START
|
||||||
|
'a': this.a,
|
||||||
|
'something': this.something
|
||||||
//CREATE_INSTANCE_OPTIONS_END
|
//CREATE_INSTANCE_OPTIONS_END
|
||||||
},
|
},
|
||||||
this
|
this
|
||||||
|
@ -75,7 +82,6 @@ class VectorApplierAgain extends Event {
|
||||||
}
|
}
|
||||||
//CREATE_INSTANCE_BEFORE_END
|
//CREATE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_CREATE_INSTANCE_START
|
//CUSTOM_CREATE_INSTANCE_START
|
||||||
//CUSTOM_CREATE_INSTANCE_END
|
//CUSTOM_CREATE_INSTANCE_END
|
||||||
|
|
||||||
|
@ -94,9 +100,16 @@ class VectorApplierAgain extends Event {
|
||||||
//UPDATE_INSTANCE_BEFORE_END
|
//UPDATE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//UPDATE_INSTANCE_OPTIONS_START
|
//UPDATE_INSTANCE_OPTIONS_START
|
||||||
|
if (property === 'a') {
|
||||||
|
this.instance.a = this.a;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (property === 'something') {
|
||||||
|
this.instance.something = this.something;
|
||||||
|
return;
|
||||||
|
}
|
||||||
//UPDATE_INSTANCE_OPTIONS_END
|
//UPDATE_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_UPDATE_INSTANCE_START
|
//CUSTOM_UPDATE_INSTANCE_START
|
||||||
//CUSTOM_UPDATE_INSTANCE_END
|
//CUSTOM_UPDATE_INSTANCE_END
|
||||||
|
|
||||||
|
@ -115,9 +128,16 @@ class VectorApplierAgain extends Event {
|
||||||
//UPDATE_FROM_INSTANCE_BEFORE_END
|
//UPDATE_FROM_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
||||||
|
if (property === 'a') {
|
||||||
|
this.a = this.instance.a;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (property === 'something') {
|
||||||
|
this.something = this.instance.something;
|
||||||
|
return;
|
||||||
|
}
|
||||||
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
||||||
//CUSTOM_UPDATE_FROM_INSTANCE_END
|
//CUSTOM_UPDATE_FROM_INSTANCE_END
|
||||||
|
|
||||||
|
@ -135,7 +155,6 @@ class VectorApplierAgain extends Event {
|
||||||
this.emit(Event.DISPOSE_OBJECT, this);
|
this.emit(Event.DISPOSE_OBJECT, this);
|
||||||
//DISPOSE_BEFORE_END
|
//DISPOSE_BEFORE_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_START
|
//CUSTOM_DISPOSE_START
|
||||||
//CUSTOM_DISPOSE_END
|
//CUSTOM_DISPOSE_END
|
||||||
|
|
||||||
|
@ -154,7 +173,6 @@ class VectorApplierAgain extends Event {
|
||||||
this.emit(Event.DISPOSE_INSTANCE, this);
|
this.emit(Event.DISPOSE_INSTANCE, this);
|
||||||
//DISPOSE_INSTANCE_BEFORE_END
|
//DISPOSE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_INSTANCE_START
|
//CUSTOM_DISPOSE_INSTANCE_START
|
||||||
//CUSTOM_DISPOSE_INSTANCE_END
|
//CUSTOM_DISPOSE_INSTANCE_END
|
||||||
|
|
||||||
|
@ -165,7 +183,6 @@ class VectorApplierAgain extends Event {
|
||||||
}
|
}
|
||||||
//DISPOSE_INSTANCE_TEMPLATE_END
|
//DISPOSE_INSTANCE_TEMPLATE_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_IMPLEMENTATION_START
|
//CUSTOM_IMPLEMENTATION_START
|
||||||
//CUSTOM_IMPLEMENTATION_END
|
//CUSTOM_IMPLEMENTATION_END
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ class R3 {
|
||||||
}
|
}
|
||||||
|
|
||||||
static version() {
|
static version() {
|
||||||
return 'Sat Jun 19 2021 14:40:43 GMT+0000 (Coordinated Universal Time)';
|
return 'Sun Jun 20 2021 06:12:04 GMT+0000 (Coordinated Universal Time)';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1772,7 +1772,7 @@ var R3 = /*#__PURE__*/function () {
|
||||||
_createClass(R3, null, [{
|
_createClass(R3, null, [{
|
||||||
key: "version",
|
key: "version",
|
||||||
value: function version() {
|
value: function version() {
|
||||||
return 'Sat Jun 19 2021 14:40:43 GMT+0000 (Coordinated Universal Time)';
|
return 'Sun Jun 20 2021 06:12:04 GMT+0000 (Coordinated Universal Time)';
|
||||||
}
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
|
@ -4,28 +4,24 @@ const Utils = require('r3-utils');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OPTIONS_START
|
OPTIONS_START
|
||||||
x=0
|
x=1
|
||||||
y=1
|
y=2
|
||||||
z=2
|
z=3
|
||||||
register=true
|
register=true
|
||||||
OPTIONS_END
|
OPTIONS_END
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
INSTANCE_OPTIONS_MAPPING_START
|
INSTANCE_OPTIONS_MAPPING_START
|
||||||
|
x=side.x
|
||||||
|
y=side.y
|
||||||
|
z=side.z
|
||||||
INSTANCE_OPTIONS_MAPPING_END
|
INSTANCE_OPTIONS_MAPPING_END
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LINKED_OBJECTS_START
|
LINKED_OBJECTS_START
|
||||||
LINKED_OBJECTS_END
|
LINKED_OBJECTS_END
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||||
|
register
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -48,26 +44,24 @@ class AnotherClass extends R3Object {
|
||||||
|
|
||||||
//OPTIONS_INIT_START
|
//OPTIONS_INIT_START
|
||||||
if (Utils.UndefinedOrNull(options.x)) {
|
if (Utils.UndefinedOrNull(options.x)) {
|
||||||
options.x = 0;
|
options.x = 1;
|
||||||
}
|
}
|
||||||
if (Utils.UndefinedOrNull(options.y)) {
|
if (Utils.UndefinedOrNull(options.y)) {
|
||||||
options.y = 1;
|
options.y = 2;
|
||||||
}
|
}
|
||||||
if (Utils.UndefinedOrNull(options.z)) {
|
if (Utils.UndefinedOrNull(options.z)) {
|
||||||
options.z = 2;
|
options.z = 3;
|
||||||
}
|
}
|
||||||
if (Utils.UndefinedOrNull(options.register)) {
|
if (Utils.UndefinedOrNull(options.register)) {
|
||||||
options.register = true;
|
options.register = true;
|
||||||
}
|
}
|
||||||
//OPTIONS_INIT_END
|
//OPTIONS_INIT_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_OPTIONS_INIT_START
|
//CUSTOM_OPTIONS_INIT_START
|
||||||
//CUSTOM_OPTIONS_INIT_END
|
//CUSTOM_OPTIONS_INIT_END
|
||||||
|
|
||||||
Object.assign(this, options);
|
Object.assign(this, options);
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_BEFORE_INIT_START
|
//CUSTOM_BEFORE_INIT_START
|
||||||
//CUSTOM_BEFORE_INIT_END
|
//CUSTOM_BEFORE_INIT_END
|
||||||
|
|
||||||
|
@ -86,10 +80,9 @@ class AnotherClass extends R3Object {
|
||||||
this.graphics.createInstance(
|
this.graphics.createInstance(
|
||||||
{
|
{
|
||||||
//CREATE_INSTANCE_OPTIONS_START
|
//CREATE_INSTANCE_OPTIONS_START
|
||||||
'x': this.x,
|
'side.x': this.x,
|
||||||
'y': this.y,
|
'side.y': this.y,
|
||||||
'z': this.z,
|
'side.z': this.z
|
||||||
'register': this.register
|
|
||||||
//CREATE_INSTANCE_OPTIONS_END
|
//CREATE_INSTANCE_OPTIONS_END
|
||||||
},
|
},
|
||||||
this
|
this
|
||||||
|
@ -97,7 +90,6 @@ class AnotherClass extends R3Object {
|
||||||
}
|
}
|
||||||
//CREATE_INSTANCE_BEFORE_END
|
//CREATE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_CREATE_INSTANCE_START
|
//CUSTOM_CREATE_INSTANCE_START
|
||||||
//CUSTOM_CREATE_INSTANCE_END
|
//CUSTOM_CREATE_INSTANCE_END
|
||||||
|
|
||||||
|
@ -117,24 +109,19 @@ class AnotherClass extends R3Object {
|
||||||
|
|
||||||
//UPDATE_INSTANCE_OPTIONS_START
|
//UPDATE_INSTANCE_OPTIONS_START
|
||||||
if (property === 'x') {
|
if (property === 'x') {
|
||||||
this.instance.x = this.x;
|
this.instance.side.x = this.x;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (property === 'y') {
|
if (property === 'y') {
|
||||||
this.instance.y = this.y;
|
this.instance.side.y = this.y;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (property === 'z') {
|
if (property === 'z') {
|
||||||
this.instance.z = this.z;
|
this.instance.side.z = this.z;
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (property === 'register') {
|
|
||||||
this.instance.register = this.register;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//UPDATE_INSTANCE_OPTIONS_END
|
//UPDATE_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_UPDATE_INSTANCE_START
|
//CUSTOM_UPDATE_INSTANCE_START
|
||||||
//CUSTOM_UPDATE_INSTANCE_END
|
//CUSTOM_UPDATE_INSTANCE_END
|
||||||
|
|
||||||
|
@ -154,24 +141,19 @@ class AnotherClass extends R3Object {
|
||||||
|
|
||||||
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
||||||
if (property === 'x') {
|
if (property === 'x') {
|
||||||
this.x = this.instance.x;
|
this.x = this.instance.side.x;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (property === 'y') {
|
if (property === 'y') {
|
||||||
this.y = this.instance.y;
|
this.y = this.instance.side.y;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (property === 'z') {
|
if (property === 'z') {
|
||||||
this.z = this.instance.z;
|
this.z = this.instance.side.z;
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (property === 'register') {
|
|
||||||
this.register = this.instance.register;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
||||||
//CUSTOM_UPDATE_FROM_INSTANCE_END
|
//CUSTOM_UPDATE_FROM_INSTANCE_END
|
||||||
|
|
||||||
|
@ -189,7 +171,6 @@ class AnotherClass extends R3Object {
|
||||||
this.emit(Event.DISPOSE_OBJECT, this);
|
this.emit(Event.DISPOSE_OBJECT, this);
|
||||||
//DISPOSE_BEFORE_END
|
//DISPOSE_BEFORE_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_START
|
//CUSTOM_DISPOSE_START
|
||||||
//CUSTOM_DISPOSE_END
|
//CUSTOM_DISPOSE_END
|
||||||
|
|
||||||
|
@ -208,7 +189,6 @@ class AnotherClass extends R3Object {
|
||||||
this.emit(Event.DISPOSE_INSTANCE, this);
|
this.emit(Event.DISPOSE_INSTANCE, this);
|
||||||
//DISPOSE_INSTANCE_BEFORE_END
|
//DISPOSE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_INSTANCE_START
|
//CUSTOM_DISPOSE_INSTANCE_START
|
||||||
//CUSTOM_DISPOSE_INSTANCE_END
|
//CUSTOM_DISPOSE_INSTANCE_END
|
||||||
|
|
||||||
|
@ -219,7 +199,6 @@ class AnotherClass extends R3Object {
|
||||||
}
|
}
|
||||||
//DISPOSE_INSTANCE_TEMPLATE_END
|
//DISPOSE_INSTANCE_TEMPLATE_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_IMPLEMENTATION_START
|
//CUSTOM_IMPLEMENTATION_START
|
||||||
//CUSTOM_IMPLEMENTATION_END
|
//CUSTOM_IMPLEMENTATION_END
|
||||||
|
|
||||||
|
|
|
@ -4,21 +4,20 @@ const Utils = require('r3-utils');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OPTIONS_START
|
OPTIONS_START
|
||||||
|
a=2.0
|
||||||
|
b=3.0
|
||||||
|
something='hello'
|
||||||
OPTIONS_END
|
OPTIONS_END
|
||||||
|
|
||||||
|
|
||||||
INSTANCE_OPTIONS_MAPPING_START
|
INSTANCE_OPTIONS_MAPPING_START
|
||||||
INSTANCE_OPTIONS_MAPPING_END
|
INSTANCE_OPTIONS_MAPPING_END
|
||||||
|
|
||||||
|
|
||||||
LINKED_OBJECTS_START
|
LINKED_OBJECTS_START
|
||||||
LINKED_OBJECTS_END
|
LINKED_OBJECTS_END
|
||||||
|
|
||||||
|
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
EXCLUDED_FROM_INSTANCE_OPTIONS_START
|
||||||
|
b
|
||||||
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
EXCLUDED_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -40,15 +39,22 @@ class VectorApplierAgain extends Event {
|
||||||
this.emit(Event.OBJECT_CREATED, this);
|
this.emit(Event.OBJECT_CREATED, this);
|
||||||
|
|
||||||
//OPTIONS_INIT_START
|
//OPTIONS_INIT_START
|
||||||
|
if (Utils.UndefinedOrNull(options.a)) {
|
||||||
|
options.a = 2.0;
|
||||||
|
}
|
||||||
|
if (Utils.UndefinedOrNull(options.b)) {
|
||||||
|
options.b = 3.0;
|
||||||
|
}
|
||||||
|
if (Utils.UndefinedOrNull(options.something)) {
|
||||||
|
options.something = 'hello';
|
||||||
|
}
|
||||||
//OPTIONS_INIT_END
|
//OPTIONS_INIT_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_OPTIONS_INIT_START
|
//CUSTOM_OPTIONS_INIT_START
|
||||||
//CUSTOM_OPTIONS_INIT_END
|
//CUSTOM_OPTIONS_INIT_END
|
||||||
|
|
||||||
Object.assign(this, options);
|
Object.assign(this, options);
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_BEFORE_INIT_START
|
//CUSTOM_BEFORE_INIT_START
|
||||||
//CUSTOM_BEFORE_INIT_END
|
//CUSTOM_BEFORE_INIT_END
|
||||||
|
|
||||||
|
@ -67,7 +73,8 @@ class VectorApplierAgain extends Event {
|
||||||
this.graphics.createInstance(
|
this.graphics.createInstance(
|
||||||
{
|
{
|
||||||
//CREATE_INSTANCE_OPTIONS_START
|
//CREATE_INSTANCE_OPTIONS_START
|
||||||
|
'a': this.a,
|
||||||
|
'something': this.something
|
||||||
//CREATE_INSTANCE_OPTIONS_END
|
//CREATE_INSTANCE_OPTIONS_END
|
||||||
},
|
},
|
||||||
this
|
this
|
||||||
|
@ -75,7 +82,6 @@ class VectorApplierAgain extends Event {
|
||||||
}
|
}
|
||||||
//CREATE_INSTANCE_BEFORE_END
|
//CREATE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_CREATE_INSTANCE_START
|
//CUSTOM_CREATE_INSTANCE_START
|
||||||
//CUSTOM_CREATE_INSTANCE_END
|
//CUSTOM_CREATE_INSTANCE_END
|
||||||
|
|
||||||
|
@ -94,9 +100,16 @@ class VectorApplierAgain extends Event {
|
||||||
//UPDATE_INSTANCE_BEFORE_END
|
//UPDATE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//UPDATE_INSTANCE_OPTIONS_START
|
//UPDATE_INSTANCE_OPTIONS_START
|
||||||
|
if (property === 'a') {
|
||||||
|
this.instance.a = this.a;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (property === 'something') {
|
||||||
|
this.instance.something = this.something;
|
||||||
|
return;
|
||||||
|
}
|
||||||
//UPDATE_INSTANCE_OPTIONS_END
|
//UPDATE_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_UPDATE_INSTANCE_START
|
//CUSTOM_UPDATE_INSTANCE_START
|
||||||
//CUSTOM_UPDATE_INSTANCE_END
|
//CUSTOM_UPDATE_INSTANCE_END
|
||||||
|
|
||||||
|
@ -115,9 +128,16 @@ class VectorApplierAgain extends Event {
|
||||||
//UPDATE_FROM_INSTANCE_BEFORE_END
|
//UPDATE_FROM_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
//UPDATE_FROM_INSTANCE_OPTIONS_START
|
||||||
|
if (property === 'a') {
|
||||||
|
this.a = this.instance.a;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (property === 'something') {
|
||||||
|
this.something = this.instance.something;
|
||||||
|
return;
|
||||||
|
}
|
||||||
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
//UPDATE_FROM_INSTANCE_OPTIONS_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
//CUSTOM_UPDATE_FROM_INSTANCE_START
|
||||||
//CUSTOM_UPDATE_FROM_INSTANCE_END
|
//CUSTOM_UPDATE_FROM_INSTANCE_END
|
||||||
|
|
||||||
|
@ -135,7 +155,6 @@ class VectorApplierAgain extends Event {
|
||||||
this.emit(Event.DISPOSE_OBJECT, this);
|
this.emit(Event.DISPOSE_OBJECT, this);
|
||||||
//DISPOSE_BEFORE_END
|
//DISPOSE_BEFORE_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_START
|
//CUSTOM_DISPOSE_START
|
||||||
//CUSTOM_DISPOSE_END
|
//CUSTOM_DISPOSE_END
|
||||||
|
|
||||||
|
@ -154,7 +173,6 @@ class VectorApplierAgain extends Event {
|
||||||
this.emit(Event.DISPOSE_INSTANCE, this);
|
this.emit(Event.DISPOSE_INSTANCE, this);
|
||||||
//DISPOSE_INSTANCE_BEFORE_END
|
//DISPOSE_INSTANCE_BEFORE_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_DISPOSE_INSTANCE_START
|
//CUSTOM_DISPOSE_INSTANCE_START
|
||||||
//CUSTOM_DISPOSE_INSTANCE_END
|
//CUSTOM_DISPOSE_INSTANCE_END
|
||||||
|
|
||||||
|
@ -165,7 +183,6 @@ class VectorApplierAgain extends Event {
|
||||||
}
|
}
|
||||||
//DISPOSE_INSTANCE_TEMPLATE_END
|
//DISPOSE_INSTANCE_TEMPLATE_END
|
||||||
|
|
||||||
|
|
||||||
//CUSTOM_IMPLEMENTATION_START
|
//CUSTOM_IMPLEMENTATION_START
|
||||||
//CUSTOM_IMPLEMENTATION_END
|
//CUSTOM_IMPLEMENTATION_END
|
||||||
|
|
||||||
|
|
|
@ -10,47 +10,35 @@ else {
|
||||||
echo "argc and argv disabled\n";
|
echo "argc and argv disabled\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$save = [
|
$tokens = [
|
||||||
'options' => '/^\s*\bOPTIONS_START\b.*\bOPTIONS_END\b/sm',
|
'OPTIONS_START' => 'OPTIONS_END',
|
||||||
'instance_mappings' => '/^\s*\bINSTANCE_OPTIONS_MAPPING_START\b.*\bINSTANCE_OPTIONS_MAPPING_END\b/sm',
|
'INSTANCE_OPTIONS_MAPPING_START' => 'INSTANCE_OPTIONS_MAPPING_END',
|
||||||
'linked_objects' => '/^\s*\bLINKED_OBJECTS_START\b.*\bLINKED_OBJECTS_END\b/sm',
|
'LINKED_OBJECTS_START' => 'LINKED_OBJECTS_END',
|
||||||
'excluded_options' => '/^\s*\bEXCLUDED_FROM_INSTANCE_OPTIONS_START\b.*\bEXCLUDED_FROM_INSTANCE_OPTIONS_END\b/sm',
|
'EXCLUDED_FROM_INSTANCE_OPTIONS_START' => 'EXCLUDED_FROM_INSTANCE_OPTIONS_END',
|
||||||
'custom_options' => '/^\s*\/\/\bCUSTOM_OPTIONS_INIT_START\b.*\/\/\bCUSTOM_OPTIONS_INIT_END\b/sm',
|
'CUSTOM_OPTIONS_INIT_START' => 'CUSTOM_OPTIONS_INIT_END',
|
||||||
'custom_before_init' => '/^\s*\/\/\bCUSTOM_BEFORE_INIT_START\b.*\/\/\bCUSTOM_BEFORE_INIT_END\b/sm',
|
'CUSTOM_BEFORE_INIT_START' => 'CUSTOM_BEFORE_INIT_END',
|
||||||
'custom_create_instance' => '/^\s*\/\/\bCUSTOM_CREATE_INSTANCE_START\b.*\/\/\bCUSTOM_CREATE_INSTANCE_END\b/sm',
|
'CUSTOM_CREATE_INSTANCE_START' => 'CUSTOM_CREATE_INSTANCE_END',
|
||||||
'custom_update_instance' => '/^\s*\/\/\bCUSTOM_UPDATE_INSTANCE_START\b.*\/\/\bCUSTOM_UPDATE_INSTANCE_END\b/sm',
|
'CUSTOM_UPDATE_INSTANCE_START' => 'CUSTOM_UPDATE_INSTANCE_END',
|
||||||
'custom_update_from_instance' => '/^\s*\/\/\bCUSTOM_UPDATE_FROM_INSTANCE_START\b.*\/\/\bCUSTOM_UPDATE_FROM_INSTANCE_END\b/sm',
|
'CUSTOM_UPDATE_FROM_INSTANCE_START' => 'CUSTOM_UPDATE_FROM_INSTANCE_END',
|
||||||
'custom_dispose' => '/^\s*\/\/\bCUSTOM_DISPOSE_START\b.*\/\/\bCUSTOM_DISPOSE_END\b/sm',
|
'CUSTOM_DISPOSE_START' => 'CUSTOM_DISPOSE_END',
|
||||||
'custom_dispose_instance' => '/^\s*\/\/\bCUSTOM_DISPOSE_INSTANCE_START\b.*\/\/\bCUSTOM_DISPOSE_INSTANCE_END\b/sm',
|
'CUSTOM_DISPOSE_INSTANCE_START' => 'CUSTOM_DISPOSE_INSTANCE_END',
|
||||||
'custom_implementation' => '/^\s*\/\/\bCUSTOM_IMPLEMENTATION_START\b.*\/\/\bCUSTOM_IMPLEMENTATION_END\b/sm'
|
'CUSTOM_IMPLEMENTATION_START' => 'CUSTOM_IMPLEMENTATION_END'
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($argv[2] == 'all') {
|
$files = [$argv[2]];
|
||||||
|
|
||||||
$files = scandir('src/r3', SCANDIR_SORT_DESCENDING);
|
function getIndex($needle, $haystack) {
|
||||||
|
|
||||||
$newFiles = [];
|
$index = 0;
|
||||||
|
|
||||||
for ($i = 0; $i < sizeof($files); $i++) {
|
foreach ($haystack as $value) {
|
||||||
if (preg_match('/\.js$/', $files[$i])) {
|
if (preg_match('/\b' . $needle . '\b/', $value)) {
|
||||||
array_push($newFiles, 'src/r3/' . $files[$i]);
|
return $index;
|
||||||
}
|
}
|
||||||
|
$index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$files = $newFiles;
|
return false;
|
||||||
|
|
||||||
} else {
|
|
||||||
$files = [$argv[2]];
|
|
||||||
}
|
|
||||||
|
|
||||||
function getContents($contents, $regex) {
|
|
||||||
$matches = [];
|
|
||||||
preg_match($regex, $contents, $matches);
|
|
||||||
if (sizeof($matches) > 0) {
|
|
||||||
return $matches[0];
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
|
@ -59,39 +47,119 @@ foreach ($files as $file) {
|
||||||
|
|
||||||
echo "saving file " . $file . "\n";
|
echo "saving file " . $file . "\n";
|
||||||
|
|
||||||
$contents = file_get_contents($file);
|
|
||||||
|
|
||||||
$saved = [];
|
$saved = [];
|
||||||
|
$startSaving = false;
|
||||||
|
|
||||||
foreach ($save as $key => $regex) {
|
$fn = fopen($file, "r");
|
||||||
|
|
||||||
|
while (!feof($fn)) {
|
||||||
|
|
||||||
|
$line = fgets($fn);
|
||||||
|
|
||||||
|
foreach ($tokens as $startToken => $endToken) {
|
||||||
|
|
||||||
|
if (preg_match('/\b' . $startToken . '\b/', $line)) {
|
||||||
|
$startSaving = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($startSaving) {
|
||||||
|
array_push($saved, $line);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($tokens as $startToken => $endToken) {
|
||||||
|
|
||||||
|
if (preg_match('/\b' . $endToken . '\b/', $line)) {
|
||||||
|
$startSaving = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$value = getContents($contents, $regex);
|
|
||||||
if ($value) {
|
|
||||||
array_push($saved, "\n");
|
|
||||||
array_push($saved, $value);
|
|
||||||
array_push($saved, "\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose($fn);
|
||||||
|
|
||||||
file_put_contents($file . '.saved', $saved);
|
file_put_contents($file . '.saved', $saved);
|
||||||
echo "saved file " . $file . ".saved\n";
|
echo "saved file " . $file . ".saved\n";
|
||||||
|
|
||||||
} else if ($argv[1] == 'restore') {
|
} else if ($argv[1] == 'restore') {
|
||||||
|
|
||||||
echo "restoring file " . $file . "\n";
|
$saveFile = $file . '.saved';
|
||||||
|
|
||||||
$saved = file_get_contents($file . '.saved');
|
echo "restoring file " . $saveFile . "\n";
|
||||||
$new = file_get_contents($file);
|
|
||||||
|
|
||||||
foreach ($save as $key => $regex) {
|
$sh = fopen($saveFile, "r");
|
||||||
$value = getContents($saved, $regex);
|
|
||||||
echo "restoring " . $key . " in " . $file;
|
$saved = [];
|
||||||
if ($value && preg_match($regex, $new)) {
|
|
||||||
$new = preg_replace($regex, $value, $new);
|
while (!feof($sh)) {
|
||||||
|
|
||||||
|
$line = fgets($sh);
|
||||||
|
|
||||||
|
array_push($saved, $line);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($sh);
|
||||||
|
|
||||||
|
$fh = fopen($file, "r");
|
||||||
|
|
||||||
|
$merged = [];
|
||||||
|
|
||||||
|
$restoreTokenPair = [];
|
||||||
|
|
||||||
|
$startRestoring = false;
|
||||||
|
|
||||||
|
while (!feof($fh)) {
|
||||||
|
|
||||||
|
$line = fgets($fh);
|
||||||
|
|
||||||
|
foreach ($tokens as $startToken => $endToken) {
|
||||||
|
if (preg_match('/\b' . $startToken . '\b/', $line)) {
|
||||||
|
$startRestoring = true;
|
||||||
|
$restoreTokenPair = [$startToken, $endToken];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($tokens as $startToken => $endToken) {
|
||||||
|
if (preg_match('/\b' . $endToken . '\b/', $line)) {
|
||||||
|
$startRestoring = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($startRestoring) {
|
||||||
|
|
||||||
|
$startToken = $restoreTokenPair[0];
|
||||||
|
$endToken = $restoreTokenPair[1];
|
||||||
|
|
||||||
|
$startIndex = getIndex($startToken, $saved);
|
||||||
|
$endIndex = getIndex($endToken, $saved);
|
||||||
|
|
||||||
|
if ($startIndex === false || $endIndex === false) {
|
||||||
|
echo "Could not find data to be restored : startIndex = " . $startIndex . ", endIndex = " . $endIndex;
|
||||||
|
echo "Restore token pair = ";
|
||||||
|
print_r($restoreTokenPair);
|
||||||
|
array_push($merged, $line);
|
||||||
|
} else {
|
||||||
|
$restored = array_splice($saved, $startIndex, $endIndex - $startIndex);
|
||||||
|
$merged = array_merge($merged, $restored);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
array_push($merged, $line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file_put_contents($file, $new);
|
fclose($fh);
|
||||||
|
|
||||||
|
file_put_contents($file, $merged);
|
||||||
|
|
||||||
|
echo "Restored file " . $file;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue