entities emit start events

master
Theunis J. Botha 2021-09-22 13:56:43 +02:00
parent ecc7b71380
commit aaf4ef4a4c
26 changed files with 399 additions and 928 deletions

591
dist/r3.js vendored
View File

@ -1,6 +1,6 @@
class R3 {
static version = '2.0.869';
static compileDate = '2021 Sep 22 - 13:06:11 pm';
static version = '2.0.877';
static compileDate = '2021 Sep 22 - 13:55:35 pm';
}
class Runtime {
@ -2281,39 +2281,40 @@ Event.DISPOSE_OBJECT = 0x7;
Event.DOM_COMPONENT_INITIALIZED = 0x8;
Event.ENTITY_CREATED = 0x9;
Event.ENTITY_INITIALIZED = 0xa;
Event.GET_API_URL = 0xb;
Event.GET_RUNTIME = 0xc;
Event.GET_WINDOW_SIZE = 0xd;
Event.GRAPHICS_COMPONENT_INITIALIZED = 0xe;
Event.IMAGE_COMPONENT_INITIALIZED = 0xf;
Event.IMAGE_INSTANCE_CREATED = 0x10;
Event.INPUT_COMPONENT_INITIALIZED = 0x11;
Event.INSTANCE_CREATED = 0x12;
Event.INSTANCE_DISPOSED = 0x13;
Event.KEYBOARD_DOWN = 0x14;
Event.KEYBOARD_UP = 0x15;
Event.MOUSE_DOWN = 0x16;
Event.MOUSE_MOVE = 0x17;
Event.MOUSE_UP = 0x18;
Event.MOUSE_WHEEL = 0x19;
Event.OBJECT_CREATED = 0x1a;
Event.OBJECT_INITIALIZED = 0x1b;
Event.PAUSE = 0x1c;
Event.PROJECT_INITIALIZED = 0x1d;
Event.RESTART = 0x1e;
Event.SLIDER_ENTITY_INITIALIZED = 0x1f;
Event.START = 0x20;
Event.TOUCH_CANCEL = 0x21;
Event.TOUCH_END = 0x22;
Event.TOUCH_MOVE = 0x23;
Event.TOUCH_START = 0x24;
Event.UPDATE_FROM_INSTANCE_AFTER = 0x25;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0x26;
Event.UPDATE_INSTANCE_AFTER = 0x27;
Event.UPDATE_INSTANCE_BEFORE = 0x28;
Event.UPDATE_INSTANCE_PROPERTY = 0x29;
Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2a;
Event.MAX_EVENTS = 0x2b;
Event.ENTITY_STARTED = 0xb;
Event.GET_API_URL = 0xc;
Event.GET_RUNTIME = 0xd;
Event.GET_WINDOW_SIZE = 0xe;
Event.GRAPHICS_COMPONENT_INITIALIZED = 0xf;
Event.IMAGE_COMPONENT_INITIALIZED = 0x10;
Event.IMAGE_INSTANCE_CREATED = 0x11;
Event.INPUT_COMPONENT_INITIALIZED = 0x12;
Event.INSTANCE_CREATED = 0x13;
Event.INSTANCE_DISPOSED = 0x14;
Event.KEYBOARD_DOWN = 0x15;
Event.KEYBOARD_UP = 0x16;
Event.MOUSE_DOWN = 0x17;
Event.MOUSE_MOVE = 0x18;
Event.MOUSE_UP = 0x19;
Event.MOUSE_WHEEL = 0x1a;
Event.OBJECT_CREATED = 0x1b;
Event.OBJECT_INITIALIZED = 0x1c;
Event.PAUSE = 0x1d;
Event.PROJECT_INITIALIZED = 0x1e;
Event.RESTART = 0x1f;
Event.SLIDER_ENTITY_INITIALIZED = 0x20;
Event.START = 0x21;
Event.TOUCH_CANCEL = 0x22;
Event.TOUCH_END = 0x23;
Event.TOUCH_MOVE = 0x24;
Event.TOUCH_START = 0x25;
Event.UPDATE_FROM_INSTANCE_AFTER = 0x26;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0x27;
Event.UPDATE_INSTANCE_AFTER = 0x28;
Event.UPDATE_INSTANCE_BEFORE = 0x29;
Event.UPDATE_INSTANCE_PROPERTY = 0x2a;
Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2b;
Event.MAX_EVENTS = 0x2c;
Event.GetEventName = function(eventId) {
@ -2328,38 +2329,39 @@ Event.GetEventName = function(eventId) {
case 0x8 : return 'dom_component_initialized';
case 0x9 : return 'entity_created';
case 0xa : return 'entity_initialized';
case 0xb : return 'get_api_url';
case 0xc : return 'get_runtime';
case 0xd : return 'get_window_size';
case 0xe : return 'graphics_component_initialized';
case 0xf : return 'image_component_initialized';
case 0x10 : return 'image_instance_created';
case 0x11 : return 'input_component_initialized';
case 0x12 : return 'instance_created';
case 0x13 : return 'instance_disposed';
case 0x14 : return 'keyboard_down';
case 0x15 : return 'keyboard_up';
case 0x16 : return 'mouse_down';
case 0x17 : return 'mouse_move';
case 0x18 : return 'mouse_up';
case 0x19 : return 'mouse_wheel';
case 0x1a : return 'object_created';
case 0x1b : return 'object_initialized';
case 0x1c : return 'pause';
case 0x1d : return 'project_initialized';
case 0x1e : return 'restart';
case 0x1f : return 'slider_entity_initialized';
case 0x20 : return 'start';
case 0x21 : return 'touch_cancel';
case 0x22 : return 'touch_end';
case 0x23 : return 'touch_move';
case 0x24 : return 'touch_start';
case 0x25 : return 'update_from_instance_after';
case 0x26 : return 'update_from_instance_before';
case 0x27 : return 'update_instance_after';
case 0x28 : return 'update_instance_before';
case 0x29 : return 'update_instance_property';
case 0x2a : return 'update_property_from_instance';
case 0xb : return 'entity_started';
case 0xc : return 'get_api_url';
case 0xd : return 'get_runtime';
case 0xe : return 'get_window_size';
case 0xf : return 'graphics_component_initialized';
case 0x10 : return 'image_component_initialized';
case 0x11 : return 'image_instance_created';
case 0x12 : return 'input_component_initialized';
case 0x13 : return 'instance_created';
case 0x14 : return 'instance_disposed';
case 0x15 : return 'keyboard_down';
case 0x16 : return 'keyboard_up';
case 0x17 : return 'mouse_down';
case 0x18 : return 'mouse_move';
case 0x19 : return 'mouse_up';
case 0x1a : return 'mouse_wheel';
case 0x1b : return 'object_created';
case 0x1c : return 'object_initialized';
case 0x1d : return 'pause';
case 0x1e : return 'project_initialized';
case 0x1f : return 'restart';
case 0x20 : return 'slider_entity_initialized';
case 0x21 : return 'start';
case 0x22 : return 'touch_cancel';
case 0x23 : return 'touch_end';
case 0x24 : return 'touch_move';
case 0x25 : return 'touch_start';
case 0x26 : return 'update_from_instance_after';
case 0x27 : return 'update_from_instance_before';
case 0x28 : return 'update_instance_after';
case 0x29 : return 'update_instance_before';
case 0x2a : return 'update_instance_property';
case 0x2b : return 'update_property_from_instance';
default :
throw new Error('Event type not defined : ' + eventId);
}
@ -2554,22 +2556,28 @@ class Entity extends R3Object {
constructor(options) {
super(options);
if (typeof options === 'undefined') {
options = {};
}
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.callDepth === 'undefined') {
options.callDepth = 0;
} else {
options.callDepth++;
}
super(options);
this.emit(Event.ENTITY_CREATED, this);
options.maxDepth = options.callDepth;
Object.assign(this, options);
this.emit(Event.ENTITY_CREATED, this);
if (options.callDepth === 0) {
this.initialize();
} else {
@ -2589,11 +2597,7 @@ class Entity extends R3Object {
Event.Emit(Event.ENTITY_INITIALIZED, this);
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
this.createInstance();
}
throw new Error('You should not try to instantiate this base class - extend it rather...');
} else {
this.initializeDepth++;
}
@ -2715,6 +2719,10 @@ class EntitySlider extends Entity {
options = {};
}
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
@ -2725,8 +2733,20 @@ class EntitySlider extends Entity {
options.callDepth++;
}
super(options);
options.maxDepth = options.callDepth;
/**
* initialized - A boolean which indicates whether or not this entity has initialized
*/
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
/**
* parent - The parent R3.Object of this component
*/
@ -2753,6 +2773,8 @@ class EntitySlider extends Entity {
options.subscriptions = {};
}
super(options);
/**
* canvas - The Canvas Component to which this entity binds its custom code components
*/
@ -2830,6 +2852,13 @@ class EntitySlider extends Entity {
this.started = true;
if (this instanceof R3.Entity) {
this.emit(
Event.ENTITY_STARTED,
this
);
}
console.log('Started transient system: EntitySlider');
}
@ -3022,11 +3051,7 @@ class Component extends R3Object {
Event.Emit(Event.COMPONENT_INITIALIZED, this);
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
this.createInstance();
}
throw new Error('You should not try to instantiate this base class - extend it rather...');
} else {
this.initializeDepth++;
}
@ -3258,12 +3283,6 @@ class ComponentDOM extends Component {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -3306,6 +3325,10 @@ class ComponentDOM extends Component {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -3336,21 +3359,6 @@ class ComponentDOM extends Component {
}
}
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
}
@ -3379,21 +3387,6 @@ class ComponentDOM extends Component {
}
}
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
}
@ -3553,12 +3546,6 @@ class ComponentCanvas extends ComponentDOM {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -3617,6 +3604,10 @@ class ComponentCanvas extends ComponentDOM {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -3675,21 +3666,6 @@ class ComponentCanvas extends ComponentDOM {
}
}
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
}
@ -3746,21 +3722,6 @@ class ComponentCanvas extends ComponentDOM {
}
}
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
}
@ -3898,12 +3859,6 @@ class ComponentGraphics extends Component {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -3939,6 +3894,10 @@ class ComponentGraphics extends Component {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -3954,21 +3913,6 @@ class ComponentGraphics extends Component {
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
}
@ -3982,21 +3926,6 @@ class ComponentGraphics extends Component {
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
}
@ -4168,12 +4097,6 @@ class ComponentImage extends ComponentGraphics {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -4300,6 +4223,10 @@ class ComponentImage extends ComponentGraphics {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -4428,21 +4355,6 @@ class ComponentImage extends ComponentGraphics {
}
}
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
}
@ -4569,21 +4481,6 @@ class ComponentImage extends ComponentGraphics {
}
}
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
}
@ -4739,12 +4636,6 @@ class ComponentMaterial extends ComponentGraphics {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -4778,6 +4669,10 @@ class ComponentMaterial extends ComponentGraphics {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -4793,21 +4688,6 @@ class ComponentMaterial extends ComponentGraphics {
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
}
@ -4821,21 +4701,6 @@ class ComponentMaterial extends ComponentGraphics {
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
}
@ -4991,12 +4856,6 @@ class ComponentMesh extends ComponentGraphics {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -5030,6 +4889,10 @@ class ComponentMesh extends ComponentGraphics {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -5045,21 +4908,6 @@ class ComponentMesh extends ComponentGraphics {
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
}
@ -5073,21 +4921,6 @@ class ComponentMesh extends ComponentGraphics {
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
}
@ -5243,12 +5076,6 @@ class ComponentTexture extends ComponentGraphics {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -5282,6 +5109,10 @@ class ComponentTexture extends ComponentGraphics {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -5297,21 +5128,6 @@ class ComponentTexture extends ComponentGraphics {
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
}
@ -5325,21 +5141,6 @@ class ComponentTexture extends ComponentGraphics {
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
}
@ -5477,12 +5278,6 @@ class ComponentInput extends Component {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -5518,6 +5313,10 @@ class ComponentInput extends Component {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -5533,21 +5332,6 @@ class ComponentInput extends Component {
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
}
@ -5561,21 +5345,6 @@ class ComponentInput extends Component {
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
}
@ -5731,12 +5500,6 @@ class ComponentTouch extends ComponentInput {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -5770,6 +5533,10 @@ class ComponentTouch extends ComponentInput {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -5785,21 +5552,6 @@ class ComponentTouch extends ComponentInput {
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
}
@ -5813,21 +5565,6 @@ class ComponentTouch extends ComponentInput {
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
}
@ -5965,12 +5702,6 @@ class ComponentCode extends Component {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -6004,6 +5735,10 @@ class ComponentCode extends Component {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -6019,21 +5754,6 @@ class ComponentCode extends Component {
this.emit(Event.UPDATE_INSTANCE_BEFORE, this);
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
}
@ -6047,21 +5767,6 @@ class ComponentCode extends Component {
this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this);
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
}
@ -6177,6 +5882,10 @@ class Project extends R3Object {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}

View File

@ -1,6 +1,6 @@
{
"name": "r3",
"version" : "2.0.869",
"version" : "2.0.877",
"description": "",
"private": true,
"dependencies": {

114
r3.php
View File

@ -939,6 +939,70 @@ function getMethodDetails($item)
}
function getMethodTemplate($token, &$updated, $methodTokenName)
{
global $baseExtends;
$staticNormal = '';
if ($token === 'CUSTOM_STATIC_METHODS' || $token === 'TEMPLATE_STATIC_METHODS') {
$staticNormal = 'static_';
}
$templateFound = false;
/**
* Do before function
*/
$potentialTemplate = strtolower('src/templates/' . $staticNormal . $baseExtends . '_' . $methodTokenName . '.template');
if (file_exists($potentialTemplate)) {
$templateFound = true;
}
if (!$templateFound) {
$potentialTemplate = strtolower('src/templates/' . $staticNormal . $methodTokenName . '.template');
}
if (file_exists($potentialTemplate)) {
$templateFound = true;
}
if ($templateFound) {
$functionTemplate = file_get_contents($potentialTemplate);
$updated = preg_replace('/^\s*\bFUNCTION_TEMPLATE\b/m', $functionTemplate, $updated);
} else {
$updated = preg_replace('/^.*?\bFUNCTION_TEMPLATE\b.*\n/m', '', $updated);
}
$templateFound = false;
/**
* Do after function
*/
$potentialTemplate = strtolower('src/templates/' . $staticNormal . $baseExtends . '_' . $methodTokenName . '_after.template');
if (file_exists($potentialTemplate)) {
$templateFound = true;
}
if (!$templateFound) {
$potentialTemplate = strtolower('src/templates/' . $staticNormal . $methodTokenName . '_after.template');
}
if (file_exists($potentialTemplate)) {
$templateFound = true;
}
if ($templateFound) {
$functionTemplate = file_get_contents($potentialTemplate);
$updated = preg_replace('/^\s*\bFUNCTION_TEMPLATE_AFTER\b/m', $functionTemplate, $updated);
} else {
$updated = preg_replace('/^.*?\bFUNCTION_TEMPLATE_AFTER\b.*\n/m', '', $updated);
}
}
/**
* @param $template
* @param $tokens
@ -988,55 +1052,7 @@ function doMethodUpdate($template, $tokens, $token)
$updated = $template;
if ($token === 'CUSTOM_METHODS' || $token === 'TEMPLATE_METHODS') {
$potentialTemplate = strtolower('src/templates/' . $methodTokenName . '.template');
} else if ($token === 'CUSTOM_STATIC_METHODS' || $token === 'TEMPLATE_STATIC_METHODS') {
$potentialTemplate = strtolower('src/templates/static_' . $methodTokenName . '.template');
}
if (file_exists($potentialTemplate)) {
$functionTemplate = file_get_contents($potentialTemplate);
$updated = preg_replace('/^\s*\bFUNCTION_TEMPLATE\b/m', $functionTemplate, $updated);
} else {
if ($token === 'CUSTOM_METHODS' || $token === 'TEMPLATE_METHODS') {
$potentialTemplate = strtolower('src/templates/' . $baseExtends . '_' . $methodTokenName . '.template');
} else if ($token === 'CUSTOM_STATIC_METHODS' || $token === 'TEMPLATE_STATIC_METHODS') {
$potentialTemplate = strtolower('src/templates/static_' . $baseExtends . '_' . $methodTokenName . '.template');
}
if (file_exists($potentialTemplate)) {
$functionTemplate = file_get_contents($potentialTemplate);
$updated = preg_replace('/^\s*\bFUNCTION_TEMPLATE\b/m', $functionTemplate, $updated);
} else {
$updated = preg_replace('/^.*?\bFUNCTION_TEMPLATE\b.*\n/m', '', $updated);
}
}
if ($token === 'CUSTOM_METHODS' || $token === 'TEMPLATE_METHODS') {
$potentialTemplate = strtolower('src/templates/' . $methodTokenName . '_after.template');
} else if ($token === 'CUSTOM_STATIC_METHODS' || $token === 'TEMPLATE_STATIC_METHODS') {
$potentialTemplate = strtolower('src/templates/static_' . $methodTokenName . '_after.template');
}
if (file_exists($potentialTemplate)) {
$functionTemplate = file_get_contents($potentialTemplate);
$updated = preg_replace('/^\s*\bFUNCTION_TEMPLATE_AFTER\b/m', $functionTemplate, $updated);
} else {
if ($token === 'CUSTOM_METHODS' || $token === 'TEMPLATE_METHODS') {
$potentialTemplate = strtolower('src/templates/' . $baseExtends . '_' . $methodTokenName . '_after.template');
} else if ($token === 'CUSTOM_STATIC_METHODS' || $token === 'TEMPLATE_STATIC_METHODS') {
$potentialTemplate = strtolower('src/templates/static_' . $baseExtends . '_' . $methodTokenName . '_after.template');
}
if (file_exists($potentialTemplate)) {
$functionTemplate = file_get_contents($potentialTemplate);
$updated = preg_replace('/^\s*\bFUNCTION_TEMPLATE_AFTER\b/m', $functionTemplate, $updated);
} else {
$updated = preg_replace('/^.*?\bFUNCTION_TEMPLATE_AFTER\b.*\n/m', '', $updated);
}
}
getMethodTemplate($token, $updated, $methodTokenName);
$updated = str_replace('METHOD_ARGS', $args, $updated);
$updated = str_replace('METHOD_NAME_UPPERCASE', $methodTokenName, $updated);

View File

@ -106,7 +106,6 @@ const Component = require('./r3-component.js');
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
@ -185,12 +184,6 @@ class ComponentCode extends Component {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -245,6 +238,10 @@ class ComponentCode extends Component {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -266,20 +263,6 @@ class ComponentCode extends Component {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -307,20 +290,6 @@ class ComponentCode extends Component {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);

View File

@ -128,7 +128,6 @@ const ComponentDOM = require('.././r3-component-d-o-m.js');
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
@ -212,12 +211,6 @@ class ComponentCanvas extends ComponentDOM {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -296,6 +289,10 @@ class ComponentCanvas extends ComponentDOM {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -359,20 +356,6 @@ class ComponentCanvas extends ComponentDOM {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -442,20 +425,6 @@ class ComponentCanvas extends ComponentDOM {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);

View File

@ -107,7 +107,6 @@ const Component = require('.././r3-component.js');
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
@ -187,12 +186,6 @@ class ComponentDOM extends Component {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -254,6 +247,10 @@ class ComponentDOM extends Component {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -289,20 +286,6 @@ class ComponentDOM extends Component {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -344,20 +327,6 @@ class ComponentDOM extends Component {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);

View File

@ -106,7 +106,6 @@ const Component = require('.././r3-component.js');
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
@ -185,12 +184,6 @@ class ComponentGraphics extends Component {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -246,6 +239,10 @@ class ComponentGraphics extends Component {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -267,20 +264,6 @@ class ComponentGraphics extends Component {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -308,20 +291,6 @@ class ComponentGraphics extends Component {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);

View File

@ -140,7 +140,6 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
@ -234,12 +233,6 @@ class ComponentImage extends ComponentGraphics {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -387,6 +380,10 @@ class ComponentImage extends ComponentGraphics {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -520,20 +517,6 @@ class ComponentImage extends ComponentGraphics {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -673,20 +656,6 @@ class ComponentImage extends ComponentGraphics {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);

View File

@ -106,7 +106,6 @@ const Component = require('.././r3-component.js');
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
@ -185,12 +184,6 @@ class ComponentInput extends Component {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -246,6 +239,10 @@ class ComponentInput extends Component {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -267,20 +264,6 @@ class ComponentInput extends Component {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -308,20 +291,6 @@ class ComponentInput extends Component {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);

View File

@ -124,7 +124,6 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
@ -203,12 +202,6 @@ class ComponentMaterial extends ComponentGraphics {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -263,6 +256,10 @@ class ComponentMaterial extends ComponentGraphics {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -284,20 +281,6 @@ class ComponentMaterial extends ComponentGraphics {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -325,20 +308,6 @@ class ComponentMaterial extends ComponentGraphics {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);

View File

@ -124,7 +124,6 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
@ -203,12 +202,6 @@ class ComponentMesh extends ComponentGraphics {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -263,6 +256,10 @@ class ComponentMesh extends ComponentGraphics {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -284,20 +281,6 @@ class ComponentMesh extends ComponentGraphics {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -325,20 +308,6 @@ class ComponentMesh extends ComponentGraphics {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);

View File

@ -124,7 +124,6 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
@ -203,12 +202,6 @@ class ComponentTexture extends ComponentGraphics {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -263,6 +256,10 @@ class ComponentTexture extends ComponentGraphics {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -284,20 +281,6 @@ class ComponentTexture extends ComponentGraphics {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -325,20 +308,6 @@ class ComponentTexture extends ComponentGraphics {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);

View File

@ -124,7 +124,6 @@ const ComponentInput = require('.././r3-component-input.js');
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
@ -203,12 +202,6 @@ class ComponentTouch extends ComponentInput {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
@ -263,6 +256,10 @@ class ComponentTouch extends ComponentInput {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}
@ -284,20 +281,6 @@ class ComponentTouch extends ComponentInput {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -325,20 +308,6 @@ class ComponentTouch extends ComponentInput {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);

View File

@ -180,11 +180,7 @@ class Component extends R3Object {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
this.createInstance();
}
throw new Error('You should not try to instantiate this base class - extend it rather...');
} else {
this.initializeDepth++;
}

View File

@ -107,6 +107,8 @@ const Entity = require('.././r3-entity.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this entity has initialized
initializeDepth=0 - The amount of times this component passed through initialize() functions
parent=null - The parent R3.Object of this component
components=[] - A list of components that this entity is composed of
started=false - Indicates whether or not this entity is active (subscribing to events) or not
@ -157,6 +159,10 @@ class EntitySlider extends Entity {
options = {};
}
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
@ -167,9 +173,21 @@ class EntitySlider extends Entity {
options.callDepth++;
}
super(options);
options.maxDepth = options.callDepth;
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* initialized - A boolean which indicates whether or not this entity has initialized
*/
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
/**
* parent - The parent R3.Object of this component
*/
@ -197,6 +215,8 @@ class EntitySlider extends Entity {
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
/**
* canvas - The Canvas Component to which this entity binds its custom code components
@ -301,6 +321,13 @@ class EntitySlider extends Entity {
this.started = true;
if (this instanceof R3.Entity) {
this.emit(
Event.ENTITY_STARTED,
this
);
}
console.log('Started transient system: EntitySlider');
//GENERATED_START_METHOD_END

View File

@ -117,19 +117,23 @@ class Entity extends R3Object {
//GENERATED_CONSTRUCTOR_START
constructor(options) {
super(options);
if (typeof options === 'undefined') {
options = {};
}
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.callDepth === 'undefined') {
options.callDepth = 0;
} else {
options.callDepth++;
}
super(options);
this.emit(Event.ENTITY_CREATED, this);
options.maxDepth = options.callDepth;
//GENERATED_TEMPLATE_OPTIONS_INIT_START
//GENERATED_TEMPLATE_OPTIONS_INIT_END
@ -142,6 +146,8 @@ class Entity extends R3Object {
Object.assign(this, options);
this.emit(Event.ENTITY_CREATED, this);
//CUSTOM_BEFORE_INIT_START
//CUSTOM_BEFORE_INIT_END
@ -174,11 +180,7 @@ class Entity extends R3Object {
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
if (this instanceof R3.Component) {
this.createInstance();
}
throw new Error('You should not try to instantiate this base class - extend it rather...');
} else {
this.initializeDepth++;
}

View File

@ -355,39 +355,40 @@ Event.DISPOSE_OBJECT = 0x7;
Event.DOM_COMPONENT_INITIALIZED = 0x8;
Event.ENTITY_CREATED = 0x9;
Event.ENTITY_INITIALIZED = 0xa;
Event.GET_API_URL = 0xb;
Event.GET_RUNTIME = 0xc;
Event.GET_WINDOW_SIZE = 0xd;
Event.GRAPHICS_COMPONENT_INITIALIZED = 0xe;
Event.IMAGE_COMPONENT_INITIALIZED = 0xf;
Event.IMAGE_INSTANCE_CREATED = 0x10;
Event.INPUT_COMPONENT_INITIALIZED = 0x11;
Event.INSTANCE_CREATED = 0x12;
Event.INSTANCE_DISPOSED = 0x13;
Event.KEYBOARD_DOWN = 0x14;
Event.KEYBOARD_UP = 0x15;
Event.MOUSE_DOWN = 0x16;
Event.MOUSE_MOVE = 0x17;
Event.MOUSE_UP = 0x18;
Event.MOUSE_WHEEL = 0x19;
Event.OBJECT_CREATED = 0x1a;
Event.OBJECT_INITIALIZED = 0x1b;
Event.PAUSE = 0x1c;
Event.PROJECT_INITIALIZED = 0x1d;
Event.RESTART = 0x1e;
Event.SLIDER_ENTITY_INITIALIZED = 0x1f;
Event.START = 0x20;
Event.TOUCH_CANCEL = 0x21;
Event.TOUCH_END = 0x22;
Event.TOUCH_MOVE = 0x23;
Event.TOUCH_START = 0x24;
Event.UPDATE_FROM_INSTANCE_AFTER = 0x25;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0x26;
Event.UPDATE_INSTANCE_AFTER = 0x27;
Event.UPDATE_INSTANCE_BEFORE = 0x28;
Event.UPDATE_INSTANCE_PROPERTY = 0x29;
Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2a;
Event.MAX_EVENTS = 0x2b;
Event.ENTITY_STARTED = 0xb;
Event.GET_API_URL = 0xc;
Event.GET_RUNTIME = 0xd;
Event.GET_WINDOW_SIZE = 0xe;
Event.GRAPHICS_COMPONENT_INITIALIZED = 0xf;
Event.IMAGE_COMPONENT_INITIALIZED = 0x10;
Event.IMAGE_INSTANCE_CREATED = 0x11;
Event.INPUT_COMPONENT_INITIALIZED = 0x12;
Event.INSTANCE_CREATED = 0x13;
Event.INSTANCE_DISPOSED = 0x14;
Event.KEYBOARD_DOWN = 0x15;
Event.KEYBOARD_UP = 0x16;
Event.MOUSE_DOWN = 0x17;
Event.MOUSE_MOVE = 0x18;
Event.MOUSE_UP = 0x19;
Event.MOUSE_WHEEL = 0x1a;
Event.OBJECT_CREATED = 0x1b;
Event.OBJECT_INITIALIZED = 0x1c;
Event.PAUSE = 0x1d;
Event.PROJECT_INITIALIZED = 0x1e;
Event.RESTART = 0x1f;
Event.SLIDER_ENTITY_INITIALIZED = 0x20;
Event.START = 0x21;
Event.TOUCH_CANCEL = 0x22;
Event.TOUCH_END = 0x23;
Event.TOUCH_MOVE = 0x24;
Event.TOUCH_START = 0x25;
Event.UPDATE_FROM_INSTANCE_AFTER = 0x26;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0x27;
Event.UPDATE_INSTANCE_AFTER = 0x28;
Event.UPDATE_INSTANCE_BEFORE = 0x29;
Event.UPDATE_INSTANCE_PROPERTY = 0x2a;
Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2b;
Event.MAX_EVENTS = 0x2c;
Event.GetEventName = function(eventId) {
@ -402,38 +403,39 @@ Event.GetEventName = function(eventId) {
case 0x8 : return 'dom_component_initialized';
case 0x9 : return 'entity_created';
case 0xa : return 'entity_initialized';
case 0xb : return 'get_api_url';
case 0xc : return 'get_runtime';
case 0xd : return 'get_window_size';
case 0xe : return 'graphics_component_initialized';
case 0xf : return 'image_component_initialized';
case 0x10 : return 'image_instance_created';
case 0x11 : return 'input_component_initialized';
case 0x12 : return 'instance_created';
case 0x13 : return 'instance_disposed';
case 0x14 : return 'keyboard_down';
case 0x15 : return 'keyboard_up';
case 0x16 : return 'mouse_down';
case 0x17 : return 'mouse_move';
case 0x18 : return 'mouse_up';
case 0x19 : return 'mouse_wheel';
case 0x1a : return 'object_created';
case 0x1b : return 'object_initialized';
case 0x1c : return 'pause';
case 0x1d : return 'project_initialized';
case 0x1e : return 'restart';
case 0x1f : return 'slider_entity_initialized';
case 0x20 : return 'start';
case 0x21 : return 'touch_cancel';
case 0x22 : return 'touch_end';
case 0x23 : return 'touch_move';
case 0x24 : return 'touch_start';
case 0x25 : return 'update_from_instance_after';
case 0x26 : return 'update_from_instance_before';
case 0x27 : return 'update_instance_after';
case 0x28 : return 'update_instance_before';
case 0x29 : return 'update_instance_property';
case 0x2a : return 'update_property_from_instance';
case 0xb : return 'entity_started';
case 0xc : return 'get_api_url';
case 0xd : return 'get_runtime';
case 0xe : return 'get_window_size';
case 0xf : return 'graphics_component_initialized';
case 0x10 : return 'image_component_initialized';
case 0x11 : return 'image_instance_created';
case 0x12 : return 'input_component_initialized';
case 0x13 : return 'instance_created';
case 0x14 : return 'instance_disposed';
case 0x15 : return 'keyboard_down';
case 0x16 : return 'keyboard_up';
case 0x17 : return 'mouse_down';
case 0x18 : return 'mouse_move';
case 0x19 : return 'mouse_up';
case 0x1a : return 'mouse_wheel';
case 0x1b : return 'object_created';
case 0x1c : return 'object_initialized';
case 0x1d : return 'pause';
case 0x1e : return 'project_initialized';
case 0x1f : return 'restart';
case 0x20 : return 'slider_entity_initialized';
case 0x21 : return 'start';
case 0x22 : return 'touch_cancel';
case 0x23 : return 'touch_end';
case 0x24 : return 'touch_move';
case 0x25 : return 'touch_start';
case 0x26 : return 'update_from_instance_after';
case 0x27 : return 'update_from_instance_before';
case 0x28 : return 'update_instance_after';
case 0x29 : return 'update_instance_before';
case 0x2a : return 'update_instance_property';
case 0x2b : return 'update_property_from_instance';
default :
throw new Error('Event type not defined : ' + eventId);
}

View File

@ -166,6 +166,10 @@ class Project extends R3Object {
this.createInstance();
}
if (this instanceof R3.Entity) {
this.start();
}
} else {
this.initializeDepth++;
}

View File

@ -1,6 +1,6 @@
class R3 {
static version = '2.0.869';
static compileDate = '2021 Sep 22 - 13:06:11 pm';
static version = '2.0.877';
static compileDate = '2021 Sep 22 - 13:55:35 pm';
}
//GENERATED_IMPORTS_START

View File

@ -0,0 +1,5 @@
if (this.initializeDepth === this.maxDepth) {
throw new Error('You should not try to instantiate this base class - extend it rather...');
} else {
this.initializeDepth++;
}

View File

@ -11,7 +11,6 @@ const EXTEND_CLASS = require('INCLUDE_PATH/EXTEND_CLASS_FILE_NAME');
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END

View File

@ -1,18 +1,22 @@
constructor(options) {
super(options);
if (typeof options === 'undefined') {
options = {};
}
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.callDepth === 'undefined') {
options.callDepth = 0;
} else {
options.callDepth++;
}
super(options);
this.emit(Event.ENTITY_CREATED, this);
options.maxDepth = options.callDepth;
//GENERATED_TEMPLATE_OPTIONS_INIT_START
//GENERATED_TEMPLATE_OPTIONS_INIT_END
@ -25,6 +29,8 @@
Object.assign(this, options);
this.emit(Event.ENTITY_CREATED, this);
//CUSTOM_BEFORE_INIT_START
//CUSTOM_BEFORE_INIT_END

View File

@ -9,6 +9,8 @@ const EXTEND_CLASS = require('INCLUDE_PATH/EXTEND_CLASS_FILE_NAME');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
initialized=false - A boolean which indicates whether or not this entity has initialized
initializeDepth=0 - The amount of times this component passed through initialize() functions
parent=null - The parent R3.Object of this component
components=[] - A list of components that this entity is composed of
started=false - Indicates whether or not this entity is active (subscribing to events) or not

View File

@ -4,6 +4,10 @@
options = {};
}
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
@ -14,11 +18,13 @@
options.callDepth++;
}
super(options);
options.maxDepth = options.callDepth;
//GENERATED_TEMPLATE_OPTIONS_INIT_START
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END

View File

@ -7,4 +7,11 @@
this.started = true;
if (this instanceof R3.Entity) {
this.emit(
Event.ENTITY_STARTED,
this
);
}
console.log('Started transient system: CLASS_NAME');

View File

@ -1 +1 @@
2.0.869
2.0.877