diff --git a/package-lock.json b/package-lock.json index b832f4fd..cf929b70 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-babylonjs", - "version": "2.0.3", + "version": "2.0.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/CreatedInstance.ts b/src/CreatedInstance.ts index 1b94bad8..dcb3f1d7 100644 --- a/src/CreatedInstance.ts +++ b/src/CreatedInstance.ts @@ -17,6 +17,7 @@ export interface InstanceMetadataParameter { customType?: boolean // not used by code-gen isCamera?: boolean isEffectLayer?: boolean; + isBehavior?: boolean; } /** diff --git a/src/ReactBabylonJSHostConfig.ts b/src/ReactBabylonJSHostConfig.ts index 64268437..639d068f 100644 --- a/src/ReactBabylonJSHostConfig.ts +++ b/src/ReactBabylonJSHostConfig.ts @@ -396,6 +396,10 @@ const ReactBabylonJSHostConfig: HostConfig< lifecycleListener = new CUSTOM_COMPONENTS.CameraLifecycleListener(scene, props, canvas as HTMLCanvasElement) } else if (metadata.isNode) { lifecycleListener = new CUSTOM_COMPONENTS.NodeLifecycleListener(); + } else if (metadata.isEffectLayer) { + lifecycleListener = new CUSTOM_COMPONENTS.EffectLayerLifecycleListener(); + } else if (metadata.isBehavior) { + lifecycleListener = new CUSTOM_COMPONENTS.BehaviorLifecycleListener(); } // here we dynamically assign listeners for specific types. diff --git a/src/customComponents/BehaviorsLifecycleListener.ts b/src/customComponents/BehaviorsLifecycleListener.ts new file mode 100644 index 00000000..83a035b8 --- /dev/null +++ b/src/customComponents/BehaviorsLifecycleListener.ts @@ -0,0 +1,21 @@ +import { CreatedInstance } from "../CreatedInstance" +import { LifecycleListener } from "../LifecycleListener" +import { Node } from '@babylonjs/core/node' +import {Behavior, PointerDragBehavior} from "@babylonjs/core"; + +type behaviors = Behavior; + +export default class BehaviorLifecycleListener implements LifecycleListener { + onParented(parent: CreatedInstance, child: CreatedInstance) { + if (parent.metadata.isNode && child.metadata.isBehavior) { + // TODO: consider add option for setParent(), which parents and maintains mesh pos/rot in world space + // child.hostInstance.setParent(parent.hostInstance) + parent.hostInstance.addBehavior(child.hostInstance) + } + } + onChildAdded(parent: CreatedInstance, child: CreatedInstance) {/* empty */} + onMount(instance: CreatedInstance) {/* empty */} + onUnmount(): void {/* empty */} +} + + diff --git a/src/customComponents/EffectLayerLifecycleListener.ts b/src/customComponents/EffectLayerLifecycleListener.ts new file mode 100644 index 00000000..a5cca0e5 --- /dev/null +++ b/src/customComponents/EffectLayerLifecycleListener.ts @@ -0,0 +1,11 @@ +import { CreatedInstance } from "../CreatedInstance" +import { LifecycleListener } from "../LifecycleListener" +import { Mesh } from '@babylonjs/core/Meshes' +import {EffectLayer} from "@babylonjs/core"; + +export default class EffectLayerLifecycleListener implements LifecycleListener { + onParented(parent: CreatedInstance, child: CreatedInstance) {/* empty */} + onChildAdded(parent: CreatedInstance, child: CreatedInstance) {/* empty */} + onMount(instance: CreatedInstance) {/* empty */} + onUnmount(): void {/* empty */} +} diff --git a/src/customComponents/index.ts b/src/customComponents/index.ts index df95348b..7a2c9705 100644 --- a/src/customComponents/index.ts +++ b/src/customComponents/index.ts @@ -15,3 +15,5 @@ export {default as TargetPropsHandler} from "./TargetPropsHandler" export {default as TexturesLifecycleListener} from "./TexturesLifecycleListener" export {default as VRExperienceHelperLifecycleListener} from "./VRExperienceHelperLifecycleListener" export {default as NodeLifecycleListener} from "./NodeLifecycleListener"; +export {default as EffectLayerLifecycleListener} from "./EffectLayerLifecycleListener"; +export {default as BehaviorLifecycleListener} from "./BehaviorsLifecycleListener"; diff --git a/src/generatedCode.ts b/src/generatedCode.ts index 0c21271a..1ca7511c 100644 --- a/src/generatedCode.ts +++ b/src/generatedCode.ts @@ -1,6 +1,6 @@ import { PropsHandler, PropertyUpdate, HasPropsHandlers } from "./PropsHandler"; import { CreatedInstanceMetadata } from "./CreatedInstance"; -import { FiberNodeProps, FiberTransformNodeProps, FiberAbstractMeshProps, FiberMeshProps, FiberCameraProps, FiberTargetCameraProps, FiberFreeCameraProps, FiberTouchCameraProps, FiberUniversalCameraProps, FiberGamepadCameraProps, FiberAnaglyphGamepadCameraProps, FiberStereoscopicGamepadCameraProps, FiberAnaglyphUniversalCameraProps, FiberStereoscopicUniversalCameraProps, FiberDeviceOrientationCameraProps, FiberVRDeviceOrientationFreeCameraProps, FiberVRDeviceOrientationGamepadCameraProps, FiberAnaglyphFreeCameraProps, FiberStereoscopicFreeCameraProps, FiberVirtualJoysticksCameraProps, FiberWebVRFreeCameraProps, FiberWebXRCameraProps, FiberArcRotateCameraProps, FiberAnaglyphArcRotateCameraProps, FiberStereoscopicArcRotateCameraProps, FiberVRDeviceOrientationArcRotateCameraProps, FiberFlyCameraProps, FiberFollowCameraProps, FiberArcFollowCameraProps, FiberMaterialProps, FiberShaderMaterialProps, FiberMultiMaterialProps, FiberPushMaterialProps, FiberStandardMaterialProps, FiberBackgroundMaterialProps, FiberPBRBaseMaterialProps, FiberPBRBaseSimpleMaterialProps, FiberPBRMetallicRoughnessMaterialProps, FiberPBRSpecularGlossinessMaterialProps, FiberPBRMaterialProps, FiberNodeMaterialProps, FiberFluentMaterialProps, FiberLightProps, FiberShadowLightProps, FiberDirectionalLightProps, FiberPointLightProps, FiberSpotLightProps, FiberHemisphericLightProps, FiberControlProps, FiberContainerProps, FiberRectangleProps, FiberButtonProps, FiberSelectionPanelProps, FiberScrollViewerProps, FiberStackPanelProps, FiberVirtualKeyboardProps, FiberEllipseProps, FiberGridProps, Fiber_ScrollViewerWindowProps, FiberTextBlockProps, FiberImageProps, FiberCheckboxProps, FiberColorPickerProps, FiberInputTextProps, FiberInputPasswordProps, FiberLineProps, FiberMultiLineProps, FiberRadioButtonProps, FiberBaseSliderProps, FiberScrollBarProps, FiberImageScrollBarProps, FiberSliderProps, FiberImageBasedSliderProps, FiberDisplayGridProps, FiberControl3DProps, FiberContainer3DProps, FiberVolumeBasedPanelProps, FiberCylinderPanelProps, FiberPlanePanelProps, FiberScatterPanelProps, FiberSpherePanelProps, FiberStackPanel3DProps, FiberAbstractButton3DProps, FiberButton3DProps, FiberHolographicButtonProps, FiberMeshButton3DProps, FiberEffectLayerProps, FiberGlowLayerProps, FiberHighlightLayerProps, FiberBaseTextureProps, FiberCubeTextureProps, FiberRawCubeTextureProps, FiberTextureProps, FiberRawTextureProps, FiberProceduralTextureProps, FiberCustomProceduralTextureProps, FiberNoiseProceduralTextureProps, FiberRenderTargetTextureProps, FiberMirrorTextureProps, FiberMultiRenderTargetProps, FiberRefractionTextureProps, FiberMultiviewRenderTargetProps, FiberVideoTextureProps, FiberDynamicTextureProps, FiberAdvancedDynamicTextureProps, FiberRawTexture3DProps, FiberRawTexture2DArrayProps, FiberColorGradingTextureProps, FiberEquiRectangularCubeTextureProps, FiberHDRCubeTextureProps, FiberHtmlElementTextureProps, FiberGUI3DManagerProps, FiberShadowGeneratorProps, FiberEnvironmentHelperProps, FiberPhysicsImpostorProps, FiberVRExperienceHelperProps, FiberDynamicTerrainProps, FiberSceneProps } from "./generatedProps"; +import { FiberNodeProps, FiberTransformNodeProps, FiberAbstractMeshProps, FiberMeshProps, FiberCameraProps, FiberTargetCameraProps, FiberFreeCameraProps, FiberTouchCameraProps, FiberUniversalCameraProps, FiberGamepadCameraProps, FiberAnaglyphGamepadCameraProps, FiberStereoscopicGamepadCameraProps, FiberAnaglyphUniversalCameraProps, FiberStereoscopicUniversalCameraProps, FiberDeviceOrientationCameraProps, FiberVRDeviceOrientationFreeCameraProps, FiberVRDeviceOrientationGamepadCameraProps, FiberAnaglyphFreeCameraProps, FiberStereoscopicFreeCameraProps, FiberVirtualJoysticksCameraProps, FiberWebVRFreeCameraProps, FiberWebXRCameraProps, FiberArcRotateCameraProps, FiberAnaglyphArcRotateCameraProps, FiberStereoscopicArcRotateCameraProps, FiberVRDeviceOrientationArcRotateCameraProps, FiberFlyCameraProps, FiberFollowCameraProps, FiberArcFollowCameraProps, FiberMaterialProps, FiberShaderMaterialProps, FiberMultiMaterialProps, FiberPushMaterialProps, FiberStandardMaterialProps, FiberBackgroundMaterialProps, FiberPBRBaseMaterialProps, FiberPBRBaseSimpleMaterialProps, FiberPBRMetallicRoughnessMaterialProps, FiberPBRSpecularGlossinessMaterialProps, FiberPBRMaterialProps, FiberNodeMaterialProps, FiberFluentMaterialProps, FiberLightProps, FiberShadowLightProps, FiberDirectionalLightProps, FiberPointLightProps, FiberSpotLightProps, FiberHemisphericLightProps, FiberControlProps, FiberContainerProps, FiberRectangleProps, FiberButtonProps, FiberSelectionPanelProps, FiberScrollViewerProps, FiberStackPanelProps, FiberVirtualKeyboardProps, FiberEllipseProps, FiberGridProps, Fiber_ScrollViewerWindowProps, FiberTextBlockProps, FiberImageProps, FiberCheckboxProps, FiberColorPickerProps, FiberInputTextProps, FiberInputPasswordProps, FiberLineProps, FiberMultiLineProps, FiberRadioButtonProps, FiberBaseSliderProps, FiberScrollBarProps, FiberImageScrollBarProps, FiberSliderProps, FiberImageBasedSliderProps, FiberDisplayGridProps, FiberControl3DProps, FiberContainer3DProps, FiberVolumeBasedPanelProps, FiberCylinderPanelProps, FiberPlanePanelProps, FiberScatterPanelProps, FiberSpherePanelProps, FiberStackPanel3DProps, FiberAbstractButton3DProps, FiberButton3DProps, FiberHolographicButtonProps, FiberMeshButton3DProps, FiberEffectLayerProps, FiberGlowLayerProps, FiberHighlightLayerProps, FiberBaseTextureProps, FiberCubeTextureProps, FiberRawCubeTextureProps, FiberTextureProps, FiberRawTextureProps, FiberProceduralTextureProps, FiberCustomProceduralTextureProps, FiberNoiseProceduralTextureProps, FiberRenderTargetTextureProps, FiberMirrorTextureProps, FiberMultiRenderTargetProps, FiberRefractionTextureProps, FiberMultiviewRenderTargetProps, FiberVideoTextureProps, FiberDynamicTextureProps, FiberAdvancedDynamicTextureProps, FiberRawTexture3DProps, FiberRawTexture2DArrayProps, FiberColorGradingTextureProps, FiberEquiRectangularCubeTextureProps, FiberHDRCubeTextureProps, FiberHtmlElementTextureProps, FiberGUI3DManagerProps, FiberShadowGeneratorProps, FiberEnvironmentHelperProps, FiberPhysicsImpostorProps, FiberVRExperienceHelperProps, FiberDynamicTerrainProps, FiberAutoRotationBehaviorProps, FiberBouncingBehaviorProps, FiberFramingBehaviorProps, FiberAttachToBoxBehaviorProps, FiberFadeInOutBehaviorProps, FiberMultiPointerScaleBehaviorProps, FiberPointerDragBehaviorProps, FiberSixDofDragBehaviorProps, FiberSceneProps } from "./generatedProps"; import { DynamicTerrain as ExtensionsDynamicTerrain } from "./extensions/DynamicTerrain"; import { AbstractScene as BabylonjsCoreAbstractScene } from "@babylonjs/core/abstractScene"; import { Node as BabylonjsCoreNode } from "@babylonjs/core/node"; @@ -30,6 +30,14 @@ import { TonemappingOperator as BabylonjsCoreTonemappingOperator } from "@babylo import { WebXRState as BabylonjsCoreWebXRState } from "@babylonjs/core/XR/webXRTypes"; import { AdvancedDynamicTexture as BabylonjsGuiAdvancedDynamicTexture, IFocusableControl as BabylonjsGuiIFocusableControl } from "@babylonjs/gui/2D/advancedDynamicTexture"; import { GUI3DManager as BabylonjsGuiGUI3DManager } from "@babylonjs/gui/3D/gui3DManager"; +import { AutoRotationBehavior as BabylonjsCoreAutoRotationBehavior } from "@babylonjs/core/Behaviors/Cameras/autoRotationBehavior"; +import { BouncingBehavior as BabylonjsCoreBouncingBehavior } from "@babylonjs/core/Behaviors/Cameras/bouncingBehavior"; +import { FramingBehavior as BabylonjsCoreFramingBehavior } from "@babylonjs/core/Behaviors/Cameras/framingBehavior"; +import { AttachToBoxBehavior as BabylonjsCoreAttachToBoxBehavior } from "@babylonjs/core/Behaviors/Meshes/attachToBoxBehavior"; +import { FadeInOutBehavior as BabylonjsCoreFadeInOutBehavior } from "@babylonjs/core/Behaviors/Meshes/fadeInOutBehavior"; +import { MultiPointerScaleBehavior as BabylonjsCoreMultiPointerScaleBehavior } from "@babylonjs/core/Behaviors/Meshes/multiPointerScaleBehavior"; +import { PointerDragBehavior as BabylonjsCorePointerDragBehavior } from "@babylonjs/core/Behaviors/Meshes/pointerDragBehavior"; +import { SixDofDragBehavior as BabylonjsCoreSixDofDragBehavior } from "@babylonjs/core/Behaviors/Meshes/sixDofDragBehavior"; import { VRExperienceHelper as BabylonjsCoreVRExperienceHelper, OnAfterEnteringVRObservableEvent as BabylonjsCoreOnAfterEnteringVRObservableEvent, VRExperienceHelperOptions as BabylonjsCoreVRExperienceHelperOptions } from "@babylonjs/core/Cameras/VR/vrExperienceHelper"; import { PoseEnabledControllerType as BabylonjsCorePoseEnabledControllerType } from "@babylonjs/core/Gamepads/Controllers/poseEnabledController"; import { ShadowGenerator as BabylonjsCoreShadowGenerator, ICustomShaderOptions as BabylonjsCoreICustomShaderOptions } from "@babylonjs/core/Lights/Shadows/shadowGenerator"; @@ -49,6 +57,7 @@ import { AnimatedInputBlockTypes as BabylonjsCoreAnimatedInputBlockTypes } from import { AnimationPropertiesOverride as BabylonjsCoreAnimationPropertiesOverride } from "@babylonjs/core/Animations/animationPropertiesOverride"; import { Animation as BabylonjsCoreAnimation } from "@babylonjs/core/Animations/animation"; import { Observable as BabylonjsCoreObservable } from "@babylonjs/core/Misc/observable"; +import { Behavior as BabylonjsCoreBehavior } from "@babylonjs/core/Behaviors/behavior"; import { TransformNode as BabylonjsCoreTransformNode } from "@babylonjs/core/Meshes/transformNode"; import { Vector3 as BabylonjsCoreVector3, Quaternion as BabylonjsCoreQuaternion, Matrix as BabylonjsCoreMatrix, Vector2 as BabylonjsCoreVector2, Vector4 as BabylonjsCoreVector4 } from "@babylonjs/core/Maths/math.vector"; import { DeepImmutableObject as BabylonjsCoreDeepImmutableObject, IndicesArray as BabylonjsCoreIndicesArray, FloatArray as BabylonjsCoreFloatArray } from "@babylonjs/core/types"; @@ -130,7 +139,7 @@ import { SelectionPanel as BabylonjsGuiSelectionPanel, SelectorGroup as Babylonj import { ScrollViewer as BabylonjsGuiScrollViewer } from "@babylonjs/gui/2D/controls/scrollViewers/scrollViewer"; import { Image as BabylonjsGuiImage } from "@babylonjs/gui/2D/controls/image"; import { StackPanel as BabylonjsGuiStackPanel } from "@babylonjs/gui/2D/controls/stackPanel"; -import { VirtualKeyboard as BabylonjsGuiVirtualKeyboard } from "@babylonjs/gui/2D/controls/virtualKeyboard"; +import { VirtualKeyboard as BabylonjsGuiVirtualKeyboard, KeyPropertySet as BabylonjsGuiKeyPropertySet } from "@babylonjs/gui/2D/controls/virtualKeyboard"; import { Ellipse as BabylonjsGuiEllipse } from "@babylonjs/gui/2D/controls/ellipse"; import { Grid as BabylonjsGuiGrid } from "@babylonjs/gui/2D/controls/grid"; import { _ScrollViewerWindow as BabylonjsGui_ScrollViewerWindow } from "@babylonjs/gui/2D/controls/scrollViewers/scrollViewerWindow"; @@ -140,6 +149,7 @@ import { InputText as BabylonjsGuiInputText } from "@babylonjs/gui/2D/controls/i import { InputPassword as BabylonjsGuiInputPassword } from "@babylonjs/gui/2D/controls/inputPassword"; import { Line as BabylonjsGuiLine } from "@babylonjs/gui/2D/controls/line"; import { MultiLine as BabylonjsGuiMultiLine } from "@babylonjs/gui/2D/controls/multiLine"; +import { MultiLinePoint as BabylonjsGuiMultiLinePoint } from "@babylonjs/gui/2D/multiLinePoint"; import { RadioButton as BabylonjsGuiRadioButton } from "@babylonjs/gui/2D/controls/radioButton"; import { BaseSlider as BabylonjsGuiBaseSlider } from "@babylonjs/gui/2D/controls/sliders/baseSlider"; import { ScrollBar as BabylonjsGuiScrollBar } from "@babylonjs/gui/2D/controls/sliders/scrollBar"; @@ -169,6 +179,7 @@ import { ProceduralTexture as BabylonjsCoreProceduralTexture } from "@babylonjs/ import { CustomProceduralTexture as BabylonjsCoreCustomProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/customProceduralTexture"; import { NoiseProceduralTexture as BabylonjsCoreNoiseProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/noiseProceduralTexture"; import { Engine as BabylonjsCoreEngine } from "@babylonjs/core/Engines/engine"; +import { PostProcess as BabylonjsCorePostProcess } from "@babylonjs/core/PostProcesses/postProcess"; import { MirrorTexture as BabylonjsCoreMirrorTexture } from "@babylonjs/core/Materials/Textures/mirrorTexture"; import { MultiRenderTarget as BabylonjsCoreMultiRenderTarget, IMultiRenderTargetOptions as BabylonjsCoreIMultiRenderTargetOptions } from "@babylonjs/core/Materials/Textures/multiRenderTarget"; import { RefractionTexture as BabylonjsCoreRefractionTexture } from "@babylonjs/core/Materials/Textures/refractionTexture"; @@ -182,6 +193,7 @@ import { ColorGradingTexture as BabylonjsCoreColorGradingTexture } from "@babylo import { EquiRectangularCubeTexture as BabylonjsCoreEquiRectangularCubeTexture } from "@babylonjs/core/Materials/Textures/equiRectangularCubeTexture"; import { HDRCubeTexture as BabylonjsCoreHDRCubeTexture } from "@babylonjs/core/Materials/Textures/hdrCubeTexture"; import { HtmlElementTexture as BabylonjsCoreHtmlElementTexture, IHtmlElementTextureOptions as BabylonjsCoreIHtmlElementTextureOptions } from "@babylonjs/core/Materials/Textures/htmlElementTexture"; +import { PhysicsJoint as BabylonjsCorePhysicsJoint } from "@babylonjs/core/Physics/physicsJoint"; import { PickingInfo as BabylonjsCorePickingInfo } from "@babylonjs/core/Collisions/pickingInfo"; import { WebXRDefaultExperience as BabylonjsCoreWebXRDefaultExperience } from "@babylonjs/core/XR/webXRDefaultExperience"; import { SolidParticleSystem as BabylonjsCoreSolidParticleSystem } from "@babylonjs/core/Particles/solidParticleSystem"; @@ -192,8 +204,9 @@ import { RenderingGroupInfo as BabylonjsCoreRenderingGroupInfo } from "@babylonj import { Geometry as BabylonjsCoreGeometry } from "@babylonjs/core/Meshes/geometry"; import { KeyboardInfo as BabylonjsCoreKeyboardInfo, KeyboardInfoPre as BabylonjsCoreKeyboardInfoPre } from "@babylonjs/core/Events/keyboardEvents"; import { PointerEventTypes as BabylonjsCorePointerEventTypes, PointerInfo as BabylonjsCorePointerInfo, PointerInfoPre as BabylonjsCorePointerInfoPre } from "@babylonjs/core/Events/pointerEvents"; -import { PostProcess as BabylonjsCorePostProcess } from "@babylonjs/core/PostProcesses/postProcess"; import { PostProcessManager as BabylonjsCorePostProcessManager } from "@babylonjs/core/PostProcesses/postProcessManager"; +import { AnimationGroup as BabylonjsCoreAnimationGroup } from "@babylonjs/core/Animations/animationGroup"; +import { IParticleSystem as BabylonjsCoreIParticleSystem } from "@babylonjs/core/Particles/IParticleSystem"; import { IPhysicsEnginePlugin as BabylonjsCoreIPhysicsEnginePlugin } from "@babylonjs/core/Physics/IPhysicsEngine"; export class FiberNodePropsHandler implements PropsHandler { @@ -270,6 +283,14 @@ export class FiberNodePropsHandler implements PropsHandler, attachImmediately?: boolean) => BabylonjsCoreNode': + if (oldProps.addBehavior !== newProps.addBehavior) { + updates.push({ + propertyName: 'addBehavior', + value: newProps.addBehavior, + type: '(behavior?: BabylonjsCoreBehavior, attachImmediately?: boolean) => BabylonjsCoreNode' + }); + } // BabylonjsCoreNode.setEnabled of type '(value?: boolean) => void': if (oldProps.setEnabled !== newProps.setEnabled) { updates.push({ @@ -412,6 +433,14 @@ export class FiberTransformNodePropsHandler implements PropsHandler BabylonjsCoreTransformNode': + if (oldProps.addRotation !== newProps.addRotation) { + updates.push({ + propertyName: 'addRotation', + value: newProps.addRotation, + type: '(x?: number, y?: number, z?: number) => BabylonjsCoreTransformNode' + }); + } // BabylonjsCoreTransformNode.setAbsolutePosition of type '(absolutePosition?: BabylonjsCoreVector3) => BabylonjsCoreTransformNode': if (oldProps.setAbsolutePosition !== newProps.setAbsolutePosition) { updates.push({ @@ -883,6 +912,14 @@ export class FiberAbstractMeshPropsHandler implements PropsHandler BabylonjsCoreAbstractMesh': + if (oldProps.addChild !== newProps.addChild) { + updates.push({ + propertyName: 'addChild', + value: newProps.addChild, + type: '(mesh?: BabylonjsCoreAbstractMesh) => BabylonjsCoreAbstractMesh' + }); + } // BabylonjsCoreAbstractMesh.setBoundingInfo of type '(boundingInfo?: BabylonjsCoreBoundingInfo) => BabylonjsCoreAbstractMesh': if (oldProps.setBoundingInfo !== newProps.setBoundingInfo) { updates.push({ @@ -1030,6 +1067,22 @@ export class FiberMeshPropsHandler implements PropsHandler void': + if (oldProps.addInstance !== newProps.addInstance) { + updates.push({ + propertyName: 'addInstance', + value: newProps.addInstance, + type: '(instance?: BabylonjsCoreInstancedMesh) => void' + }); + } + // BabylonjsCoreMesh.addLODLevel of type '(distance?: number, mesh?: BabylonjsCoreMesh) => BabylonjsCoreMesh': + if (oldProps.addLODLevel !== newProps.addLODLevel) { + updates.push({ + propertyName: 'addLODLevel', + value: newProps.addLODLevel, + type: '(distance?: number, mesh?: BabylonjsCoreMesh) => BabylonjsCoreMesh' + }); + } // BabylonjsCoreMesh.setIndices of type '(indices?: BabylonjsCoreIndicesArray, totalVertices?: number, updatable?: boolean) => BabylonjsCoreAbstractMesh': if (oldProps.setIndices !== newProps.setIndices) { updates.push({ @@ -9102,6 +9155,14 @@ export class FiberNodeMaterialPropsHandler implements PropsHandler this': + if (oldProps.addOutputNode !== newProps.addOutputNode) { + updates.push({ + propertyName: 'addOutputNode', + value: newProps.addOutputNode, + type: '(node?: BabylonjsCoreNodeMaterialBlock) => this' + }); + } return updates.length === 0 ? null : updates; } } @@ -10600,6 +10661,14 @@ export class FiberContainerPropsHandler implements PropsHandler BabylonjsGuiContainer': + if (oldProps.addControl !== newProps.addControl) { + updates.push({ + propertyName: 'addControl', + value: newProps.addControl, + type: '(control?: BabylonjsGuiControl) => BabylonjsGuiContainer' + }); + } return updates.length === 0 ? null : updates; } } @@ -10859,6 +10928,38 @@ export class FiberSelectionPanelPropsHandler implements PropsHandler void': + if (oldProps.addGroup !== newProps.addGroup) { + updates.push({ + propertyName: 'addGroup', + value: newProps.addGroup, + type: '(group?: BabylonjsGuiSelectorGroup) => void' + }); + } + // BabylonjsGuiSelectionPanel.addToGroupCheckbox of type '(groupNb?: number, label?: string, func?: () => void, checked?: boolean) => void': + if (oldProps.addToGroupCheckbox !== newProps.addToGroupCheckbox) { + updates.push({ + propertyName: 'addToGroupCheckbox', + value: newProps.addToGroupCheckbox, + type: '(groupNb?: number, label?: string, func?: () => void, checked?: boolean) => void' + }); + } + // BabylonjsGuiSelectionPanel.addToGroupRadio of type '(groupNb?: number, label?: string, func?: () => void, checked?: boolean) => void': + if (oldProps.addToGroupRadio !== newProps.addToGroupRadio) { + updates.push({ + propertyName: 'addToGroupRadio', + value: newProps.addToGroupRadio, + type: '(groupNb?: number, label?: string, func?: () => void, checked?: boolean) => void' + }); + } + // BabylonjsGuiSelectionPanel.addToGroupSlider of type '(groupNb?: number, label?: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number) => void': + if (oldProps.addToGroupSlider !== newProps.addToGroupSlider) { + updates.push({ + propertyName: 'addToGroupSlider', + value: newProps.addToGroupSlider, + type: '(groupNb?: number, label?: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number) => void' + }); + } // BabylonjsGuiSelectionPanel.setHeaderName of type '(label?: string, groupNb?: number) => void': if (oldProps.setHeaderName !== newProps.setHeaderName) { updates.push({ @@ -11033,6 +11134,14 @@ export class FiberScrollViewerPropsHandler implements PropsHandler BabylonjsGuiContainer': + if (oldProps.addControl !== newProps.addControl) { + updates.push({ + propertyName: 'addControl', + value: newProps.addControl, + type: '(control?: BabylonjsGuiControl) => BabylonjsGuiContainer' + }); + } // BabylonjsGuiScrollViewer.setBucketSizes of type '(width?: number, height?: number) => void': if (oldProps.setBucketSizes !== newProps.setBucketSizes) { updates.push({ @@ -11283,6 +11392,14 @@ export class FiberVirtualKeyboardPropsHandler implements PropsHandler void': + if (oldProps.addKeysRow !== newProps.addKeysRow) { + updates.push({ + propertyName: 'addKeysRow', + value: newProps.addKeysRow, + type: '(keys?: string[], propertySets?: BabylonjsGuiKeyPropertySet[]) => void' + }); + } return updates.length === 0 ? null : updates; } } @@ -11402,6 +11519,30 @@ export class FiberGridPropsHandler implements PropsHandler BabylonjsGuiGrid': + if (oldProps.addColumnDefinition !== newProps.addColumnDefinition) { + updates.push({ + propertyName: 'addColumnDefinition', + value: newProps.addColumnDefinition, + type: '(width?: number, isPixel?: boolean) => BabylonjsGuiGrid' + }); + } + // BabylonjsGuiGrid.addControl of type '(control?: BabylonjsGuiControl, row?: number, column?: number) => BabylonjsGuiGrid': + if (oldProps.addControl !== newProps.addControl) { + updates.push({ + propertyName: 'addControl', + value: newProps.addControl, + type: '(control?: BabylonjsGuiControl, row?: number, column?: number) => BabylonjsGuiGrid' + }); + } + // BabylonjsGuiGrid.addRowDefinition of type '(height?: number, isPixel?: boolean) => BabylonjsGuiGrid': + if (oldProps.addRowDefinition !== newProps.addRowDefinition) { + updates.push({ + propertyName: 'addRowDefinition', + value: newProps.addRowDefinition, + type: '(height?: number, isPixel?: boolean) => BabylonjsGuiGrid' + }); + } // BabylonjsGuiGrid.setColumnDefinition of type '(index?: number, width?: number, isPixel?: boolean) => BabylonjsGuiGrid': if (oldProps.setColumnDefinition !== newProps.setColumnDefinition) { updates.push({ @@ -12601,6 +12742,14 @@ export class FiberMultiLinePropsHandler implements PropsHandler BabylonjsGuiMultiLinePoint[]': + if (oldProps.add !== newProps.add) { + updates.push({ + propertyName: 'add', + value: newProps.add, + type: '(items?: (BabylonjsCoreAbstractMesh | BabylonjsGuiControl | { x: string | number; y: string | number; })[]) => BabylonjsGuiMultiLinePoint[]' + }); + } return updates.length === 0 ? null : updates; } } @@ -13439,6 +13588,14 @@ export class FiberControl3DPropsHandler implements PropsHandler) => BabylonjsGuiControl3D': + if (oldProps.addBehavior !== newProps.addBehavior) { + updates.push({ + propertyName: 'addBehavior', + value: newProps.addBehavior, + type: '(behavior?: BabylonjsCoreBehavior) => BabylonjsGuiControl3D' + }); + } return updates.length === 0 ? null : updates; } } @@ -13495,6 +13652,14 @@ export class FiberContainer3DPropsHandler implements PropsHandler BabylonjsGuiContainer3D': + if (oldProps.addControl !== newProps.addControl) { + updates.push({ + propertyName: 'addControl', + value: newProps.addControl, + type: '(control?: BabylonjsGuiControl3D) => BabylonjsGuiContainer3D' + }); + } return updates.length === 0 ? null : updates; } } @@ -14321,6 +14486,22 @@ export class FiberGlowLayerPropsHandler implements PropsHandler void': + if (oldProps.addExcludedMesh !== newProps.addExcludedMesh) { + updates.push({ + propertyName: 'addExcludedMesh', + value: newProps.addExcludedMesh, + type: '(mesh?: BabylonjsCoreMesh) => void' + }); + } + // BabylonjsCoreGlowLayer.addIncludedOnlyMesh of type '(mesh?: BabylonjsCoreMesh) => void': + if (oldProps.addIncludedOnlyMesh !== newProps.addIncludedOnlyMesh) { + updates.push({ + propertyName: 'addIncludedOnlyMesh', + value: newProps.addIncludedOnlyMesh, + type: '(mesh?: BabylonjsCoreMesh) => void' + }); + } return updates.length === 0 ? null : updates; } } @@ -14440,6 +14621,22 @@ export class FiberHighlightLayerPropsHandler implements PropsHandler void': + if (oldProps.addExcludedMesh !== newProps.addExcludedMesh) { + updates.push({ + propertyName: 'addExcludedMesh', + value: newProps.addExcludedMesh, + type: '(mesh?: BabylonjsCoreMesh) => void' + }); + } + // BabylonjsCoreHighlightLayer.addMesh of type '(mesh?: BabylonjsCoreMesh, color?: BabylonjsCoreColor3, glowEmissiveOnly?: boolean) => void': + if (oldProps.addMesh !== newProps.addMesh) { + updates.push({ + propertyName: 'addMesh', + value: newProps.addMesh, + type: '(mesh?: BabylonjsCoreMesh, color?: BabylonjsCoreColor3, glowEmissiveOnly?: boolean) => void' + }); + } return updates.length === 0 ? null : updates; } } @@ -15880,6 +16077,14 @@ export class FiberRenderTargetTexturePropsHandler implements PropsHandler void': + if (oldProps.addPostProcess !== newProps.addPostProcess) { + updates.push({ + propertyName: 'addPostProcess', + value: newProps.addPostProcess, + type: '(postProcess?: BabylonjsCorePostProcess) => void' + }); + } // BabylonjsCoreRenderTargetTexture.setRenderingAutoClearDepthStencil of type '(renderingGroupId?: number, autoClearDepthStencil?: boolean) => void': if (oldProps.setRenderingAutoClearDepthStencil !== newProps.setRenderingAutoClearDepthStencil) { updates.push({ @@ -16674,6 +16879,14 @@ export class FiberAdvancedDynamicTexturePropsHandler implements PropsHandler BabylonjsGuiAdvancedDynamicTexture': + if (oldProps.addControl !== newProps.addControl) { + updates.push({ + propertyName: 'addControl', + value: newProps.addControl, + type: '(control?: BabylonjsGuiControl) => BabylonjsGuiAdvancedDynamicTexture' + }); + } return updates.length === 0 ? null : updates; } } @@ -17473,6 +17686,14 @@ export class FiberGUI3DManagerPropsHandler implements PropsHandler' }); } + // BabylonjsGuiGUI3DManager.addControl of type '(control?: BabylonjsGuiControl3D) => BabylonjsGuiGUI3DManager': + if (oldProps.addControl !== newProps.addControl) { + updates.push({ + propertyName: 'addControl', + value: newProps.addControl, + type: '(control?: BabylonjsGuiControl3D) => BabylonjsGuiGUI3DManager' + }); + } return updates.length === 0 ? null : updates; } } @@ -17722,6 +17943,14 @@ export class FiberShadowGeneratorPropsHandler implements PropsHandler BabylonjsCoreShadowGenerator': + if (oldProps.addShadowCaster !== newProps.addShadowCaster) { + updates.push({ + propertyName: 'addShadowCaster', + value: newProps.addShadowCaster, + type: '(mesh?: BabylonjsCoreAbstractMesh, includeDescendants?: boolean) => BabylonjsCoreShadowGenerator' + }); + } // BabylonjsCoreShadowGenerator.setDarkness of type '(darkness?: number) => BabylonjsCoreShadowGenerator': if (oldProps.setDarkness !== newProps.setDarkness) { updates.push({ @@ -17978,6 +18207,30 @@ export class FiberPhysicsImpostorPropsHandler implements PropsHandler BabylonjsCorePhysicsImpostor': + if (oldProps.addAnchor !== newProps.addAnchor) { + updates.push({ + propertyName: 'addAnchor', + value: newProps.addAnchor, + type: '(otherImpostor?: BabylonjsCorePhysicsImpostor, width?: number, height?: number, influence?: number, noCollisionBetweenLinkedBodies?: boolean) => BabylonjsCorePhysicsImpostor' + }); + } + // BabylonjsCorePhysicsImpostor.addHook of type '(otherImpostor?: BabylonjsCorePhysicsImpostor, length?: number, influence?: number, noCollisionBetweenLinkedBodies?: boolean) => BabylonjsCorePhysicsImpostor': + if (oldProps.addHook !== newProps.addHook) { + updates.push({ + propertyName: 'addHook', + value: newProps.addHook, + type: '(otherImpostor?: BabylonjsCorePhysicsImpostor, length?: number, influence?: number, noCollisionBetweenLinkedBodies?: boolean) => BabylonjsCorePhysicsImpostor' + }); + } + // BabylonjsCorePhysicsImpostor.addJoint of type '(otherImpostor?: BabylonjsCorePhysicsImpostor, joint?: BabylonjsCorePhysicsJoint) => BabylonjsCorePhysicsImpostor': + if (oldProps.addJoint !== newProps.addJoint) { + updates.push({ + propertyName: 'addJoint', + value: newProps.addJoint, + type: '(otherImpostor?: BabylonjsCorePhysicsImpostor, joint?: BabylonjsCorePhysicsJoint) => BabylonjsCorePhysicsImpostor' + }); + } // BabylonjsCorePhysicsImpostor.setAngularVelocity of type '(velocity?: BabylonjsCoreVector3) => void': if (oldProps.setAngularVelocity !== newProps.setAngularVelocity) { updates.push({ @@ -18284,6 +18537,14 @@ export class FiberVRExperienceHelperPropsHandler implements PropsHandler void': + if (oldProps.addFloorMesh !== newProps.addFloorMesh) { + updates.push({ + propertyName: 'addFloorMesh', + value: newProps.addFloorMesh, + type: '(floorMesh?: BabylonjsCoreMesh) => void' + }); + } // BabylonjsCoreVRExperienceHelper.setGazeColor of type '(color?: BabylonjsCoreColor3, pickedColor?: BabylonjsCoreColor3) => void': if (oldProps.setGazeColor !== newProps.setGazeColor) { updates.push({ @@ -18626,145 +18887,853 @@ export class FiberDynamicTerrain implements HasPropsHandlers { - getPropertyUpdates(hostInstance: BabylonjsCoreScene, oldProps: FiberSceneProps, newProps: FiberSceneProps, scene: BabylonjsCoreScene): PropertyUpdate[] | null { +export class FiberAutoRotationBehaviorPropsHandler implements PropsHandler { + getPropertyUpdates(hostInstance: BabylonjsCoreAutoRotationBehavior, oldProps: FiberAutoRotationBehaviorProps, newProps: FiberAutoRotationBehaviorProps, scene: BabylonjsCoreScene): PropertyUpdate[] | null { // generated code let updates: PropertyUpdate[] = []; - // TODO: type: 'BabylonjsCoreAbstractActionManager' property (not coded) BabylonjsCoreScene.actionManager. - // TODO: type: 'BabylonjsCoreCamera' property (not coded) BabylonjsCoreScene.activeCamera. - // TODO: type: 'BabylonjsCoreCamera[]' property (not coded) BabylonjsCoreScene.activeCameras. - // TODO: type: '() => void' property (not coded) BabylonjsCoreScene.afterCameraRender. - // TODO: type: '() => void' property (not coded) BabylonjsCoreScene.afterRender. - // BabylonjsCoreScene.ambientColor (BabylonjsCoreColor3 uses object equals to find diffs): - if (newProps.ambientColor && (!oldProps.ambientColor || !oldProps.ambientColor.equals(newProps.ambientColor))) { + // BabylonjsCoreAutoRotationBehavior.idleRotationSpeed (number): + if (oldProps.idleRotationSpeed !== newProps.idleRotationSpeed) { updates.push({ - propertyName: 'ambientColor', - value: newProps.ambientColor, - type: 'BabylonjsCoreColor3' + propertyName: 'idleRotationSpeed', + value: newProps.idleRotationSpeed, + type: 'number' }); } - // TODO: type: 'BabylonjsCoreAnimationPropertiesOverride' property (not coded) BabylonjsCoreScene.animationPropertiesOverride. - // BabylonjsCoreScene.animationsEnabled (boolean): - if (oldProps.animationsEnabled !== newProps.animationsEnabled) { + // BabylonjsCoreAutoRotationBehavior.idleRotationSpinupTime (number): + if (oldProps.idleRotationSpinupTime !== newProps.idleRotationSpinupTime) { updates.push({ - propertyName: 'animationsEnabled', - value: newProps.animationsEnabled, - type: 'boolean' + propertyName: 'idleRotationSpinupTime', + value: newProps.idleRotationSpinupTime, + type: 'number' }); } - // BabylonjsCoreScene.animationTimeScale (number): - if (oldProps.animationTimeScale !== newProps.animationTimeScale) { + // BabylonjsCoreAutoRotationBehavior.idleRotationWaitTime (number): + if (oldProps.idleRotationWaitTime !== newProps.idleRotationWaitTime) { updates.push({ - propertyName: 'animationTimeScale', - value: newProps.animationTimeScale, + propertyName: 'idleRotationWaitTime', + value: newProps.idleRotationWaitTime, type: 'number' }); } - // BabylonjsCoreScene.autoClear (boolean): - if (oldProps.autoClear !== newProps.autoClear) { + // BabylonjsCoreAutoRotationBehavior.zoomStopsAnimation (boolean): + if (oldProps.zoomStopsAnimation !== newProps.zoomStopsAnimation) { updates.push({ - propertyName: 'autoClear', - value: newProps.autoClear, + propertyName: 'zoomStopsAnimation', + value: newProps.zoomStopsAnimation, type: 'boolean' }); } - // BabylonjsCoreScene.autoClearDepthAndStencil (boolean): - if (oldProps.autoClearDepthAndStencil !== newProps.autoClearDepthAndStencil) { + return updates.length === 0 ? null : updates; + } +} + +/** + * The autoRotation behavior (AutoRotationBehavior) is designed to create a smooth rotation of an ArcRotateCamera when there is no user interaction. + * + * This code has been generated + */ +export class FiberAutoRotationBehavior implements HasPropsHandlers { + private propsHandlers: PropsHandler[]; + + constructor() { + this.propsHandlers = [ + new FiberAutoRotationBehaviorPropsHandler() + ]; + } + + getPropsHandlers(): PropsHandler[] { + return this.propsHandlers; + } + + addPropsHandler(propHandler: PropsHandler): void { + this.propsHandlers.push(propHandler); + } + + public static readonly CreateInfo = { + "creationType": "Constructor", + "libraryLocation": "AutoRotationBehavior", + "namespace": "@babylonjs/core/Behaviors/Cameras/autoRotationBehavior", + "parameters": [] + }; + public static readonly Metadata: CreatedInstanceMetadata = { + "isBehavior": true, + "className": "FiberAutoRotationBehavior" + }; +} + +export class FiberBouncingBehaviorPropsHandler implements PropsHandler { + getPropertyUpdates(hostInstance: BabylonjsCoreBouncingBehavior, oldProps: FiberBouncingBehaviorProps, newProps: FiberBouncingBehaviorProps, scene: BabylonjsCoreScene): PropertyUpdate[] | null { + // generated code + let updates: PropertyUpdate[] = []; + // BabylonjsCoreBouncingBehavior.autoTransitionRange (boolean): + if (oldProps.autoTransitionRange !== newProps.autoTransitionRange) { updates.push({ - propertyName: 'autoClearDepthAndStencil', - value: newProps.autoClearDepthAndStencil, + propertyName: 'autoTransitionRange', + value: newProps.autoTransitionRange, type: 'boolean' }); } - // TODO: type: '() => void' property (not coded) BabylonjsCoreScene.beforeCameraRender. - // TODO: type: '() => void' property (not coded) BabylonjsCoreScene.beforeRender. - // BabylonjsCoreScene.blockfreeActiveMeshesAndRenderingGroups (boolean): - if (oldProps.blockfreeActiveMeshesAndRenderingGroups !== newProps.blockfreeActiveMeshesAndRenderingGroups) { + // BabylonjsCoreBouncingBehavior.lowerRadiusTransitionRange (number): + if (oldProps.lowerRadiusTransitionRange !== newProps.lowerRadiusTransitionRange) { updates.push({ - propertyName: 'blockfreeActiveMeshesAndRenderingGroups', - value: newProps.blockfreeActiveMeshesAndRenderingGroups, - type: 'boolean' + propertyName: 'lowerRadiusTransitionRange', + value: newProps.lowerRadiusTransitionRange, + type: 'number' }); } - // BabylonjsCoreScene.blockMaterialDirtyMechanism (boolean): - if (oldProps.blockMaterialDirtyMechanism !== newProps.blockMaterialDirtyMechanism) { + // BabylonjsCoreBouncingBehavior.transitionDuration (number): + if (oldProps.transitionDuration !== newProps.transitionDuration) { updates.push({ - propertyName: 'blockMaterialDirtyMechanism', - value: newProps.blockMaterialDirtyMechanism, - type: 'boolean' + propertyName: 'transitionDuration', + value: newProps.transitionDuration, + type: 'number' }); } - // TODO: type: 'BabylonjsCoreCamera' property (not coded) BabylonjsCoreScene.cameraToUseForPointers. - // BabylonjsCoreScene.clearColor of BabylonjsCoreColor4. Color4.equals() not available in BabylonJS < 4: - if (newProps.clearColor && (!oldProps.clearColor || oldProps.clearColor.r !== newProps.clearColor.r || oldProps.clearColor.g !== newProps.clearColor.g || oldProps.clearColor.b !== newProps.clearColor.b || oldProps.clearColor.a !== newProps.clearColor.a)) { + // BabylonjsCoreBouncingBehavior.upperRadiusTransitionRange (number): + if (oldProps.upperRadiusTransitionRange !== newProps.upperRadiusTransitionRange) { updates.push({ - propertyName: 'clearColor', - value: newProps.clearColor, - type: 'BabylonjsCoreColor4' + propertyName: 'upperRadiusTransitionRange', + value: newProps.upperRadiusTransitionRange, + type: 'number' }); } - // TODO: type: 'BabylonjsCorePlane' property (not coded) BabylonjsCoreScene.clipPlane. - // TODO: type: 'BabylonjsCorePlane' property (not coded) BabylonjsCoreScene.clipPlane2. - // TODO: type: 'BabylonjsCorePlane' property (not coded) BabylonjsCoreScene.clipPlane3. - // TODO: type: 'BabylonjsCorePlane' property (not coded) BabylonjsCoreScene.clipPlane4. - // TODO: type: 'BabylonjsCorePlane' property (not coded) BabylonjsCoreScene.clipPlane5. - // TODO: type: 'BabylonjsCorePlane' property (not coded) BabylonjsCoreScene.clipPlane6. - // BabylonjsCoreScene.collisionsEnabled (boolean): - if (oldProps.collisionsEnabled !== newProps.collisionsEnabled) { + return updates.length === 0 ? null : updates; + } +} + +/** + * Add a bouncing effect to an ArcRotateCamera when reaching a specified minimum and maximum radius + * + * This code has been generated + */ +export class FiberBouncingBehavior implements HasPropsHandlers { + private propsHandlers: PropsHandler[]; + + constructor() { + this.propsHandlers = [ + new FiberBouncingBehaviorPropsHandler() + ]; + } + + getPropsHandlers(): PropsHandler[] { + return this.propsHandlers; + } + + addPropsHandler(propHandler: PropsHandler): void { + this.propsHandlers.push(propHandler); + } + + public static readonly CreateInfo = { + "creationType": "Constructor", + "libraryLocation": "BouncingBehavior", + "namespace": "@babylonjs/core/Behaviors/Cameras/bouncingBehavior", + "parameters": [] + }; + public static readonly Metadata: CreatedInstanceMetadata = { + "isBehavior": true, + "className": "FiberBouncingBehavior" + }; +} + +export class FiberFramingBehaviorPropsHandler implements PropsHandler { + getPropertyUpdates(hostInstance: BabylonjsCoreFramingBehavior, oldProps: FiberFramingBehaviorProps, newProps: FiberFramingBehaviorProps, scene: BabylonjsCoreScene): PropertyUpdate[] | null { + // generated code + let updates: PropertyUpdate[] = []; + // BabylonjsCoreFramingBehavior.autoCorrectCameraLimitsAndSensibility (boolean): + if (oldProps.autoCorrectCameraLimitsAndSensibility !== newProps.autoCorrectCameraLimitsAndSensibility) { updates.push({ - propertyName: 'collisionsEnabled', - value: newProps.collisionsEnabled, + propertyName: 'autoCorrectCameraLimitsAndSensibility', + value: newProps.autoCorrectCameraLimitsAndSensibility, type: 'boolean' }); } - // BabylonjsCoreScene.constantlyUpdateMeshUnderPointer (boolean): - if (oldProps.constantlyUpdateMeshUnderPointer !== newProps.constantlyUpdateMeshUnderPointer) { + // BabylonjsCoreFramingBehavior.defaultElevation (number): + if (oldProps.defaultElevation !== newProps.defaultElevation) { updates.push({ - propertyName: 'constantlyUpdateMeshUnderPointer', - value: newProps.constantlyUpdateMeshUnderPointer, - type: 'boolean' + propertyName: 'defaultElevation', + value: newProps.defaultElevation, + type: 'number' }); } - // TODO: type: '(mesh: BabylonjsCoreAbstractMesh, camera: BabylonjsCoreCamera) => BabylonjsCoreAbstractMesh' property (not coded) BabylonjsCoreScene.customLODSelector. - // TODO: type: 'BabylonjsCoreRenderTargetTexture[]' property (not coded) BabylonjsCoreScene.customRenderTargets. - // BabylonjsCoreScene.defaultCursor (string): - if (oldProps.defaultCursor !== newProps.defaultCursor) { + // BabylonjsCoreFramingBehavior.elevationReturnTime (number): + if (oldProps.elevationReturnTime !== newProps.elevationReturnTime) { updates.push({ - propertyName: 'defaultCursor', - value: newProps.defaultCursor, - type: 'string' + propertyName: 'elevationReturnTime', + value: newProps.elevationReturnTime, + type: 'number' }); } - // TODO: type: 'BabylonjsCoreMaterial' property (not coded) BabylonjsCoreScene.defaultMaterial. - // TODO: type: 'RegExp[]' property (not coded) BabylonjsCoreScene.disableOfflineSupportExceptionRules. - // BabylonjsCoreScene.dispatchAllSubMeshesOfActiveMeshes (boolean): - if (oldProps.dispatchAllSubMeshesOfActiveMeshes !== newProps.dispatchAllSubMeshesOfActiveMeshes) { + // BabylonjsCoreFramingBehavior.elevationReturnWaitTime (number): + if (oldProps.elevationReturnWaitTime !== newProps.elevationReturnWaitTime) { updates.push({ - propertyName: 'dispatchAllSubMeshesOfActiveMeshes', - value: newProps.dispatchAllSubMeshesOfActiveMeshes, - type: 'boolean' + propertyName: 'elevationReturnWaitTime', + value: newProps.elevationReturnWaitTime, + type: 'number' }); } - // BabylonjsCoreScene.doNotHandleCursors (boolean): - if (oldProps.doNotHandleCursors !== newProps.doNotHandleCursors) { + // BabylonjsCoreFramingBehavior.framingTime (number): + if (oldProps.framingTime !== newProps.framingTime) { updates.push({ - propertyName: 'doNotHandleCursors', - value: newProps.doNotHandleCursors, - type: 'boolean' + propertyName: 'framingTime', + value: newProps.framingTime, + type: 'number' }); } - // BabylonjsCoreScene.DoubleClickDelay (number): - if (oldProps.DoubleClickDelay !== newProps.DoubleClickDelay) { + // BabylonjsCoreFramingBehavior.mode (number): + if (oldProps.mode !== newProps.mode) { updates.push({ - propertyName: 'DoubleClickDelay', - value: newProps.DoubleClickDelay, + propertyName: 'mode', + value: newProps.mode, type: 'number' }); } - // BabylonjsCoreScene.DragMovementThreshold (number): - if (oldProps.DragMovementThreshold !== newProps.DragMovementThreshold) { + // BabylonjsCoreFramingBehavior.positionScale (number): + if (oldProps.positionScale !== newProps.positionScale) { updates.push({ - propertyName: 'DragMovementThreshold', + propertyName: 'positionScale', + value: newProps.positionScale, + type: 'number' + }); + } + // BabylonjsCoreFramingBehavior.radiusScale (number): + if (oldProps.radiusScale !== newProps.radiusScale) { + updates.push({ + propertyName: 'radiusScale', + value: newProps.radiusScale, + type: 'number' + }); + } + // BabylonjsCoreFramingBehavior.zoomStopsAnimation (boolean): + if (oldProps.zoomStopsAnimation !== newProps.zoomStopsAnimation) { + updates.push({ + propertyName: 'zoomStopsAnimation', + value: newProps.zoomStopsAnimation, + type: 'boolean' + }); + } + return updates.length === 0 ? null : updates; + } +} + +/** + * The framing behavior (FramingBehavior) is designed to automatically position an ArcRotateCamera when its target is set to a mesh. It is also useful if you want to prevent the camera to go under a virtual horizontal plane. + * + * This code has been generated + */ +export class FiberFramingBehavior implements HasPropsHandlers { + private propsHandlers: PropsHandler[]; + + constructor() { + this.propsHandlers = [ + new FiberFramingBehaviorPropsHandler() + ]; + } + + getPropsHandlers(): PropsHandler[] { + return this.propsHandlers; + } + + addPropsHandler(propHandler: PropsHandler): void { + this.propsHandlers.push(propHandler); + } + + public static readonly CreateInfo = { + "creationType": "Constructor", + "libraryLocation": "FramingBehavior", + "namespace": "@babylonjs/core/Behaviors/Cameras/framingBehavior", + "parameters": [] + }; + public static readonly Metadata: CreatedInstanceMetadata = { + "isBehavior": true, + "className": "FiberFramingBehavior" + }; +} + +export class FiberAttachToBoxBehaviorPropsHandler implements PropsHandler { + getPropertyUpdates(hostInstance: BabylonjsCoreAttachToBoxBehavior, oldProps: FiberAttachToBoxBehaviorProps, newProps: FiberAttachToBoxBehaviorProps, scene: BabylonjsCoreScene): PropertyUpdate[] | null { + // generated code + let updates: PropertyUpdate[] = []; + // BabylonjsCoreAttachToBoxBehavior.distanceAwayFromBottomOfFace (number): + if (oldProps.distanceAwayFromBottomOfFace !== newProps.distanceAwayFromBottomOfFace) { + updates.push({ + propertyName: 'distanceAwayFromBottomOfFace', + value: newProps.distanceAwayFromBottomOfFace, + type: 'number' + }); + } + // BabylonjsCoreAttachToBoxBehavior.distanceAwayFromFace (number): + if (oldProps.distanceAwayFromFace !== newProps.distanceAwayFromFace) { + updates.push({ + propertyName: 'distanceAwayFromFace', + value: newProps.distanceAwayFromFace, + type: 'number' + }); + } + // BabylonjsCoreAttachToBoxBehavior.name (string): + if (oldProps.name !== newProps.name) { + updates.push({ + propertyName: 'name', + value: newProps.name, + type: 'string' + }); + } + // TODO: type: 'any' property (not coded) BabylonjsCoreAttachToBoxBehavior.ui. + return updates.length === 0 ? null : updates; + } +} + +/** + * A behavior that when attached to a mesh will will place a specified node on the meshes face pointing towards the camera + * + * This code has been generated + */ +export class FiberAttachToBoxBehavior implements HasPropsHandlers { + private propsHandlers: PropsHandler[]; + + constructor() { + this.propsHandlers = [ + new FiberAttachToBoxBehaviorPropsHandler() + ]; + } + + getPropsHandlers(): PropsHandler[] { + return this.propsHandlers; + } + + addPropsHandler(propHandler: PropsHandler): void { + this.propsHandlers.push(propHandler); + } + + public static readonly CreateInfo = { + "creationType": "Constructor", + "libraryLocation": "AttachToBoxBehavior", + "namespace": "@babylonjs/core/Behaviors/Meshes/attachToBoxBehavior", + "parameters": [ + { + "name": "ui", + "type": "BabylonjsCoreTransformNode", + "optional": false + } + ] + }; + public static readonly Metadata: CreatedInstanceMetadata = { + "isBehavior": true, + "className": "FiberAttachToBoxBehavior" + }; +} + +export class FiberFadeInOutBehaviorPropsHandler implements PropsHandler { + getPropertyUpdates(hostInstance: BabylonjsCoreFadeInOutBehavior, oldProps: FiberFadeInOutBehaviorProps, newProps: FiberFadeInOutBehaviorProps, scene: BabylonjsCoreScene): PropertyUpdate[] | null { + // generated code + let updates: PropertyUpdate[] = []; + // BabylonjsCoreFadeInOutBehavior.delay (number): + if (oldProps.delay !== newProps.delay) { + updates.push({ + propertyName: 'delay', + value: newProps.delay, + type: 'number' + }); + } + // BabylonjsCoreFadeInOutBehavior.fadeInTime (number): + if (oldProps.fadeInTime !== newProps.fadeInTime) { + updates.push({ + propertyName: 'fadeInTime', + value: newProps.fadeInTime, + type: 'number' + }); + } + return updates.length === 0 ? null : updates; + } +} + +/** + * A behavior that when attached to a mesh will allow the mesh to fade in and out + * + * This code has been generated + */ +export class FiberFadeInOutBehavior implements HasPropsHandlers { + private propsHandlers: PropsHandler[]; + + constructor() { + this.propsHandlers = [ + new FiberFadeInOutBehaviorPropsHandler() + ]; + } + + getPropsHandlers(): PropsHandler[] { + return this.propsHandlers; + } + + addPropsHandler(propHandler: PropsHandler): void { + this.propsHandlers.push(propHandler); + } + + public static readonly CreateInfo = { + "creationType": "Constructor", + "libraryLocation": "FadeInOutBehavior", + "namespace": "@babylonjs/core/Behaviors/Meshes/fadeInOutBehavior", + "parameters": [] + }; + public static readonly Metadata: CreatedInstanceMetadata = { + "isBehavior": true, + "className": "FiberFadeInOutBehavior" + }; +} + +export class FiberMultiPointerScaleBehaviorPropsHandler implements PropsHandler { + getPropertyUpdates(hostInstance: BabylonjsCoreMultiPointerScaleBehavior, oldProps: FiberMultiPointerScaleBehaviorProps, newProps: FiberMultiPointerScaleBehaviorProps, scene: BabylonjsCoreScene): PropertyUpdate[] | null { + // generated code + let updates: PropertyUpdate[] = []; + return updates.length === 0 ? null : updates; + } +} + +/** + * A behavior that when attached to a mesh will allow the mesh to be scaled + * + * This code has been generated + */ +export class FiberMultiPointerScaleBehavior implements HasPropsHandlers { + private propsHandlers: PropsHandler[]; + + constructor() { + this.propsHandlers = [ + new FiberMultiPointerScaleBehaviorPropsHandler() + ]; + } + + getPropsHandlers(): PropsHandler[] { + return this.propsHandlers; + } + + addPropsHandler(propHandler: PropsHandler): void { + this.propsHandlers.push(propHandler); + } + + public static readonly CreateInfo = { + "creationType": "Constructor", + "libraryLocation": "MultiPointerScaleBehavior", + "namespace": "@babylonjs/core/Behaviors/Meshes/multiPointerScaleBehavior", + "parameters": [] + }; + public static readonly Metadata: CreatedInstanceMetadata = { + "isBehavior": true, + "className": "FiberMultiPointerScaleBehavior" + }; +} + +export class FiberPointerDragBehaviorPropsHandler implements PropsHandler { + getPropertyUpdates(hostInstance: BabylonjsCorePointerDragBehavior, oldProps: FiberPointerDragBehaviorProps, newProps: FiberPointerDragBehaviorProps, scene: BabylonjsCoreScene): PropertyUpdate[] | null { + // generated code + let updates: PropertyUpdate[] = []; + // TODO: type: 'BabylonjsCoreAbstractMesh' property (not coded) BabylonjsCorePointerDragBehavior.attachedNode. + // BabylonjsCorePointerDragBehavior.currentDraggingPointerID (number): + if (oldProps.currentDraggingPointerID !== newProps.currentDraggingPointerID) { + updates.push({ + propertyName: 'currentDraggingPointerID', + value: newProps.currentDraggingPointerID, + type: 'number' + }); + } + // BabylonjsCorePointerDragBehavior.detachCameraControls (boolean): + if (oldProps.detachCameraControls !== newProps.detachCameraControls) { + updates.push({ + propertyName: 'detachCameraControls', + value: newProps.detachCameraControls, + type: 'boolean' + }); + } + // BabylonjsCorePointerDragBehavior.dragDeltaRatio (number): + if (oldProps.dragDeltaRatio !== newProps.dragDeltaRatio) { + updates.push({ + propertyName: 'dragDeltaRatio', + value: newProps.dragDeltaRatio, + type: 'number' + }); + } + // BabylonjsCorePointerDragBehavior.dragging (boolean): + if (oldProps.dragging !== newProps.dragging) { + updates.push({ + propertyName: 'dragging', + value: newProps.dragging, + type: 'boolean' + }); + } + // BabylonjsCorePointerDragBehavior.enabled (boolean): + if (oldProps.enabled !== newProps.enabled) { + updates.push({ + propertyName: 'enabled', + value: newProps.enabled, + type: 'boolean' + }); + } + // BabylonjsCorePointerDragBehavior.lastDragPosition (BabylonjsCoreVector3 uses object equals to find diffs): + if (newProps.lastDragPosition && (!oldProps.lastDragPosition || !oldProps.lastDragPosition.equals(newProps.lastDragPosition))) { + updates.push({ + propertyName: 'lastDragPosition', + value: newProps.lastDragPosition, + type: 'BabylonjsCoreVector3' + }); + } + // BabylonjsCorePointerDragBehavior.maxDragAngle (number): + if (oldProps.maxDragAngle !== newProps.maxDragAngle) { + updates.push({ + propertyName: 'maxDragAngle', + value: newProps.maxDragAngle, + type: 'number' + }); + } + // BabylonjsCorePointerDragBehavior.moveAttached (boolean): + if (oldProps.moveAttached !== newProps.moveAttached) { + updates.push({ + propertyName: 'moveAttached', + value: newProps.moveAttached, + type: 'boolean' + }); + } + // xxx-ns-xxx.BabylonjsCorePointerDragBehavior.onDragEndObservable of type 'BabylonjsCoreObservable<{ dragPlanePoint: BabylonjsCoreVector3; pointerId: number; }>/fn': + if (oldProps.onDragEndObservable === undefined && oldProps.onDragEndObservable !== newProps.onDragEndObservable) { + updates.push({ + propertyName: 'onDragEndObservable', + value: newProps.onDragEndObservable, + type: 'BabylonjsCoreObservable<{ dragPlanePoint: BabylonjsCoreVector3; pointerId: number; }>' + }); + } + // xxx-ns-xxx.BabylonjsCorePointerDragBehavior.onDragObservable of type 'BabylonjsCoreObservable<{ delta: BabylonjsCoreVector3; dragPlanePoint: BabylonjsCoreVector3; dragPlaneNormal: BabylonjsCoreVector3; dragDistance: number; pointerId: number; }>/fn': + if (oldProps.onDragObservable === undefined && oldProps.onDragObservable !== newProps.onDragObservable) { + updates.push({ + propertyName: 'onDragObservable', + value: newProps.onDragObservable, + type: 'BabylonjsCoreObservable<{ delta: BabylonjsCoreVector3; dragPlanePoint: BabylonjsCoreVector3; dragPlaneNormal: BabylonjsCoreVector3; dragDistance: number; pointerId: number; }>' + }); + } + // xxx-ns-xxx.BabylonjsCorePointerDragBehavior.onDragStartObservable of type 'BabylonjsCoreObservable<{ dragPlanePoint: BabylonjsCoreVector3; pointerId: number; }>/fn': + if (oldProps.onDragStartObservable === undefined && oldProps.onDragStartObservable !== newProps.onDragStartObservable) { + updates.push({ + propertyName: 'onDragStartObservable', + value: newProps.onDragStartObservable, + type: 'BabylonjsCoreObservable<{ dragPlanePoint: BabylonjsCoreVector3; pointerId: number; }>' + }); + } + // TODO: type: '{ dragAxis?: BabylonjsCoreVector3; dragPlaneNormal?: BabylonjsCoreVector3; }' property (not coded) BabylonjsCorePointerDragBehavior.options. + // BabylonjsCorePointerDragBehavior.startAndReleaseDragOnPointerEvents (boolean): + if (oldProps.startAndReleaseDragOnPointerEvents !== newProps.startAndReleaseDragOnPointerEvents) { + updates.push({ + propertyName: 'startAndReleaseDragOnPointerEvents', + value: newProps.startAndReleaseDragOnPointerEvents, + type: 'boolean' + }); + } + // BabylonjsCorePointerDragBehavior.updateDragPlane (boolean): + if (oldProps.updateDragPlane !== newProps.updateDragPlane) { + updates.push({ + propertyName: 'updateDragPlane', + value: newProps.updateDragPlane, + type: 'boolean' + }); + } + // BabylonjsCorePointerDragBehavior.useObjectOrientationForDragging (boolean): + if (oldProps.useObjectOrientationForDragging !== newProps.useObjectOrientationForDragging) { + updates.push({ + propertyName: 'useObjectOrientationForDragging', + value: newProps.useObjectOrientationForDragging, + type: 'boolean' + }); + } + // TODO: type: '(targetPosition: BabylonjsCoreVector3) => boolean' property (not coded) BabylonjsCorePointerDragBehavior.validateDrag. + return updates.length === 0 ? null : updates; + } +} + +/** + * A behavior that when attached to a mesh will allow the mesh to be dragged around the screen based on pointer events + * + * This code has been generated + */ +export class FiberPointerDragBehavior implements HasPropsHandlers { + private propsHandlers: PropsHandler[]; + + constructor() { + this.propsHandlers = [ + new FiberPointerDragBehaviorPropsHandler() + ]; + } + + getPropsHandlers(): PropsHandler[] { + return this.propsHandlers; + } + + addPropsHandler(propHandler: PropsHandler): void { + this.propsHandlers.push(propHandler); + } + + public static readonly CreateInfo = { + "creationType": "Constructor", + "libraryLocation": "PointerDragBehavior", + "namespace": "@babylonjs/core/Behaviors/Meshes/pointerDragBehavior", + "parameters": [ + { + "name": "options", + "type": [ + { + "name": "dragAxis", + "type": "BabylonjsCoreVector3", + "optional": true + }, + { + "name": "dragPlaneNormal", + "type": "BabylonjsCoreVector3", + "optional": true + } + ], + "optional": true + } + ] + }; + public static readonly Metadata: CreatedInstanceMetadata = { + "isBehavior": true, + "className": "FiberPointerDragBehavior" + }; +} + +export class FiberSixDofDragBehaviorPropsHandler implements PropsHandler { + getPropertyUpdates(hostInstance: BabylonjsCoreSixDofDragBehavior, oldProps: FiberSixDofDragBehaviorProps, newProps: FiberSixDofDragBehaviorProps, scene: BabylonjsCoreScene): PropertyUpdate[] | null { + // generated code + let updates: PropertyUpdate[] = []; + // BabylonjsCoreSixDofDragBehavior.currentDraggingPointerID (number): + if (oldProps.currentDraggingPointerID !== newProps.currentDraggingPointerID) { + updates.push({ + propertyName: 'currentDraggingPointerID', + value: newProps.currentDraggingPointerID, + type: 'number' + }); + } + // BabylonjsCoreSixDofDragBehavior.detachCameraControls (boolean): + if (oldProps.detachCameraControls !== newProps.detachCameraControls) { + updates.push({ + propertyName: 'detachCameraControls', + value: newProps.detachCameraControls, + type: 'boolean' + }); + } + // BabylonjsCoreSixDofDragBehavior.dragDeltaRatio (number): + if (oldProps.dragDeltaRatio !== newProps.dragDeltaRatio) { + updates.push({ + propertyName: 'dragDeltaRatio', + value: newProps.dragDeltaRatio, + type: 'number' + }); + } + // BabylonjsCoreSixDofDragBehavior.dragging (boolean): + if (oldProps.dragging !== newProps.dragging) { + updates.push({ + propertyName: 'dragging', + value: newProps.dragging, + type: 'boolean' + }); + } + // xxx-ns-xxx.BabylonjsCoreSixDofDragBehavior.onDragEndObservable of type 'BabylonjsCoreObservable<{}>/fn': + if (oldProps.onDragEndObservable === undefined && oldProps.onDragEndObservable !== newProps.onDragEndObservable) { + updates.push({ + propertyName: 'onDragEndObservable', + value: newProps.onDragEndObservable, + type: 'BabylonjsCoreObservable<{}>' + }); + } + // xxx-ns-xxx.BabylonjsCoreSixDofDragBehavior.onDragStartObservable of type 'BabylonjsCoreObservable<{}>/fn': + if (oldProps.onDragStartObservable === undefined && oldProps.onDragStartObservable !== newProps.onDragStartObservable) { + updates.push({ + propertyName: 'onDragStartObservable', + value: newProps.onDragStartObservable, + type: 'BabylonjsCoreObservable<{}>' + }); + } + // BabylonjsCoreSixDofDragBehavior.rotateDraggedObject (boolean): + if (oldProps.rotateDraggedObject !== newProps.rotateDraggedObject) { + updates.push({ + propertyName: 'rotateDraggedObject', + value: newProps.rotateDraggedObject, + type: 'boolean' + }); + } + // TODO: type: 'any' property (not coded) BabylonjsCoreSixDofDragBehavior.zDragFactor. + return updates.length === 0 ? null : updates; + } +} + +/** + * A behavior that when attached to a mesh will allow the mesh to be dragged around based on directions and origin of the pointer's ray + * + * This code has been generated + */ +export class FiberSixDofDragBehavior implements HasPropsHandlers { + private propsHandlers: PropsHandler[]; + + constructor() { + this.propsHandlers = [ + new FiberSixDofDragBehaviorPropsHandler() + ]; + } + + getPropsHandlers(): PropsHandler[] { + return this.propsHandlers; + } + + addPropsHandler(propHandler: PropsHandler): void { + this.propsHandlers.push(propHandler); + } + + public static readonly CreateInfo = { + "creationType": "Constructor", + "libraryLocation": "SixDofDragBehavior", + "namespace": "@babylonjs/core/Behaviors/Meshes/sixDofDragBehavior", + "parameters": [] + }; + public static readonly Metadata: CreatedInstanceMetadata = { + "isBehavior": true, + "className": "FiberSixDofDragBehavior" + }; +} + +export class FiberScenePropsHandler implements PropsHandler { + getPropertyUpdates(hostInstance: BabylonjsCoreScene, oldProps: FiberSceneProps, newProps: FiberSceneProps, scene: BabylonjsCoreScene): PropertyUpdate[] | null { + // generated code + let updates: PropertyUpdate[] = []; + // TODO: type: 'BabylonjsCoreAbstractActionManager' property (not coded) BabylonjsCoreScene.actionManager. + // TODO: type: 'BabylonjsCoreCamera' property (not coded) BabylonjsCoreScene.activeCamera. + // TODO: type: 'BabylonjsCoreCamera[]' property (not coded) BabylonjsCoreScene.activeCameras. + // TODO: type: '() => void' property (not coded) BabylonjsCoreScene.afterCameraRender. + // TODO: type: '() => void' property (not coded) BabylonjsCoreScene.afterRender. + // BabylonjsCoreScene.ambientColor (BabylonjsCoreColor3 uses object equals to find diffs): + if (newProps.ambientColor && (!oldProps.ambientColor || !oldProps.ambientColor.equals(newProps.ambientColor))) { + updates.push({ + propertyName: 'ambientColor', + value: newProps.ambientColor, + type: 'BabylonjsCoreColor3' + }); + } + // TODO: type: 'BabylonjsCoreAnimationPropertiesOverride' property (not coded) BabylonjsCoreScene.animationPropertiesOverride. + // BabylonjsCoreScene.animationsEnabled (boolean): + if (oldProps.animationsEnabled !== newProps.animationsEnabled) { + updates.push({ + propertyName: 'animationsEnabled', + value: newProps.animationsEnabled, + type: 'boolean' + }); + } + // BabylonjsCoreScene.animationTimeScale (number): + if (oldProps.animationTimeScale !== newProps.animationTimeScale) { + updates.push({ + propertyName: 'animationTimeScale', + value: newProps.animationTimeScale, + type: 'number' + }); + } + // BabylonjsCoreScene.autoClear (boolean): + if (oldProps.autoClear !== newProps.autoClear) { + updates.push({ + propertyName: 'autoClear', + value: newProps.autoClear, + type: 'boolean' + }); + } + // BabylonjsCoreScene.autoClearDepthAndStencil (boolean): + if (oldProps.autoClearDepthAndStencil !== newProps.autoClearDepthAndStencil) { + updates.push({ + propertyName: 'autoClearDepthAndStencil', + value: newProps.autoClearDepthAndStencil, + type: 'boolean' + }); + } + // TODO: type: '() => void' property (not coded) BabylonjsCoreScene.beforeCameraRender. + // TODO: type: '() => void' property (not coded) BabylonjsCoreScene.beforeRender. + // BabylonjsCoreScene.blockfreeActiveMeshesAndRenderingGroups (boolean): + if (oldProps.blockfreeActiveMeshesAndRenderingGroups !== newProps.blockfreeActiveMeshesAndRenderingGroups) { + updates.push({ + propertyName: 'blockfreeActiveMeshesAndRenderingGroups', + value: newProps.blockfreeActiveMeshesAndRenderingGroups, + type: 'boolean' + }); + } + // BabylonjsCoreScene.blockMaterialDirtyMechanism (boolean): + if (oldProps.blockMaterialDirtyMechanism !== newProps.blockMaterialDirtyMechanism) { + updates.push({ + propertyName: 'blockMaterialDirtyMechanism', + value: newProps.blockMaterialDirtyMechanism, + type: 'boolean' + }); + } + // TODO: type: 'BabylonjsCoreCamera' property (not coded) BabylonjsCoreScene.cameraToUseForPointers. + // BabylonjsCoreScene.clearColor of BabylonjsCoreColor4. Color4.equals() not available in BabylonJS < 4: + if (newProps.clearColor && (!oldProps.clearColor || oldProps.clearColor.r !== newProps.clearColor.r || oldProps.clearColor.g !== newProps.clearColor.g || oldProps.clearColor.b !== newProps.clearColor.b || oldProps.clearColor.a !== newProps.clearColor.a)) { + updates.push({ + propertyName: 'clearColor', + value: newProps.clearColor, + type: 'BabylonjsCoreColor4' + }); + } + // TODO: type: 'BabylonjsCorePlane' property (not coded) BabylonjsCoreScene.clipPlane. + // TODO: type: 'BabylonjsCorePlane' property (not coded) BabylonjsCoreScene.clipPlane2. + // TODO: type: 'BabylonjsCorePlane' property (not coded) BabylonjsCoreScene.clipPlane3. + // TODO: type: 'BabylonjsCorePlane' property (not coded) BabylonjsCoreScene.clipPlane4. + // TODO: type: 'BabylonjsCorePlane' property (not coded) BabylonjsCoreScene.clipPlane5. + // TODO: type: 'BabylonjsCorePlane' property (not coded) BabylonjsCoreScene.clipPlane6. + // BabylonjsCoreScene.collisionsEnabled (boolean): + if (oldProps.collisionsEnabled !== newProps.collisionsEnabled) { + updates.push({ + propertyName: 'collisionsEnabled', + value: newProps.collisionsEnabled, + type: 'boolean' + }); + } + // BabylonjsCoreScene.constantlyUpdateMeshUnderPointer (boolean): + if (oldProps.constantlyUpdateMeshUnderPointer !== newProps.constantlyUpdateMeshUnderPointer) { + updates.push({ + propertyName: 'constantlyUpdateMeshUnderPointer', + value: newProps.constantlyUpdateMeshUnderPointer, + type: 'boolean' + }); + } + // TODO: type: '(mesh: BabylonjsCoreAbstractMesh, camera: BabylonjsCoreCamera) => BabylonjsCoreAbstractMesh' property (not coded) BabylonjsCoreScene.customLODSelector. + // TODO: type: 'BabylonjsCoreRenderTargetTexture[]' property (not coded) BabylonjsCoreScene.customRenderTargets. + // BabylonjsCoreScene.defaultCursor (string): + if (oldProps.defaultCursor !== newProps.defaultCursor) { + updates.push({ + propertyName: 'defaultCursor', + value: newProps.defaultCursor, + type: 'string' + }); + } + // TODO: type: 'BabylonjsCoreMaterial' property (not coded) BabylonjsCoreScene.defaultMaterial. + // TODO: type: 'RegExp[]' property (not coded) BabylonjsCoreScene.disableOfflineSupportExceptionRules. + // BabylonjsCoreScene.dispatchAllSubMeshesOfActiveMeshes (boolean): + if (oldProps.dispatchAllSubMeshesOfActiveMeshes !== newProps.dispatchAllSubMeshesOfActiveMeshes) { + updates.push({ + propertyName: 'dispatchAllSubMeshesOfActiveMeshes', + value: newProps.dispatchAllSubMeshesOfActiveMeshes, + type: 'boolean' + }); + } + // BabylonjsCoreScene.doNotHandleCursors (boolean): + if (oldProps.doNotHandleCursors !== newProps.doNotHandleCursors) { + updates.push({ + propertyName: 'doNotHandleCursors', + value: newProps.doNotHandleCursors, + type: 'boolean' + }); + } + // BabylonjsCoreScene.DoubleClickDelay (number): + if (oldProps.DoubleClickDelay !== newProps.DoubleClickDelay) { + updates.push({ + propertyName: 'DoubleClickDelay', + value: newProps.DoubleClickDelay, + type: 'number' + }); + } + // BabylonjsCoreScene.DragMovementThreshold (number): + if (oldProps.DragMovementThreshold !== newProps.DragMovementThreshold) { + updates.push({ + propertyName: 'DragMovementThreshold', value: newProps.DragMovementThreshold, type: 'number' }); @@ -19466,6 +20435,126 @@ export class FiberScenePropsHandler implements PropsHandler void': + if (oldProps.addActionManager !== newProps.addActionManager) { + updates.push({ + propertyName: 'addActionManager', + value: newProps.addActionManager, + type: '(newActionManager?: BabylonjsCoreAbstractActionManager) => void' + }); + } + // BabylonjsCoreScene.addAnimation of type '(newAnimation?: BabylonjsCoreAnimation) => void': + if (oldProps.addAnimation !== newProps.addAnimation) { + updates.push({ + propertyName: 'addAnimation', + value: newProps.addAnimation, + type: '(newAnimation?: BabylonjsCoreAnimation) => void' + }); + } + // BabylonjsCoreScene.addAnimationGroup of type '(newAnimationGroup?: BabylonjsCoreAnimationGroup) => void': + if (oldProps.addAnimationGroup !== newProps.addAnimationGroup) { + updates.push({ + propertyName: 'addAnimationGroup', + value: newProps.addAnimationGroup, + type: '(newAnimationGroup?: BabylonjsCoreAnimationGroup) => void' + }); + } + // BabylonjsCoreScene.addCamera of type '(newCamera?: BabylonjsCoreCamera) => void': + if (oldProps.addCamera !== newProps.addCamera) { + updates.push({ + propertyName: 'addCamera', + value: newProps.addCamera, + type: '(newCamera?: BabylonjsCoreCamera) => void' + }); + } + // BabylonjsCoreScene.addExternalData of type '(key?: string, data?: T) => boolean': + if (oldProps.addExternalData !== newProps.addExternalData) { + updates.push({ + propertyName: 'addExternalData', + value: newProps.addExternalData, + type: '(key?: string, data?: T) => boolean' + }); + } + // BabylonjsCoreScene.addGeometry of type '(newGeometry?: BabylonjsCoreGeometry) => void': + if (oldProps.addGeometry !== newProps.addGeometry) { + updates.push({ + propertyName: 'addGeometry', + value: newProps.addGeometry, + type: '(newGeometry?: BabylonjsCoreGeometry) => void' + }); + } + // BabylonjsCoreScene.addLight of type '(newLight?: BabylonjsCoreLight) => void': + if (oldProps.addLight !== newProps.addLight) { + updates.push({ + propertyName: 'addLight', + value: newProps.addLight, + type: '(newLight?: BabylonjsCoreLight) => void' + }); + } + // BabylonjsCoreScene.addMaterial of type '(newMaterial?: BabylonjsCoreMaterial) => void': + if (oldProps.addMaterial !== newProps.addMaterial) { + updates.push({ + propertyName: 'addMaterial', + value: newProps.addMaterial, + type: '(newMaterial?: BabylonjsCoreMaterial) => void' + }); + } + // BabylonjsCoreScene.addMesh of type '(newMesh?: BabylonjsCoreAbstractMesh, recursive?: boolean) => void': + if (oldProps.addMesh !== newProps.addMesh) { + updates.push({ + propertyName: 'addMesh', + value: newProps.addMesh, + type: '(newMesh?: BabylonjsCoreAbstractMesh, recursive?: boolean) => void' + }); + } + // BabylonjsCoreScene.addMorphTargetManager of type '(newMorphTargetManager?: BabylonjsCoreMorphTargetManager) => void': + if (oldProps.addMorphTargetManager !== newProps.addMorphTargetManager) { + updates.push({ + propertyName: 'addMorphTargetManager', + value: newProps.addMorphTargetManager, + type: '(newMorphTargetManager?: BabylonjsCoreMorphTargetManager) => void' + }); + } + // BabylonjsCoreScene.addMultiMaterial of type '(newMultiMaterial?: BabylonjsCoreMultiMaterial) => void': + if (oldProps.addMultiMaterial !== newProps.addMultiMaterial) { + updates.push({ + propertyName: 'addMultiMaterial', + value: newProps.addMultiMaterial, + type: '(newMultiMaterial?: BabylonjsCoreMultiMaterial) => void' + }); + } + // BabylonjsCoreScene.addParticleSystem of type '(newParticleSystem?: BabylonjsCoreIParticleSystem) => void': + if (oldProps.addParticleSystem !== newProps.addParticleSystem) { + updates.push({ + propertyName: 'addParticleSystem', + value: newProps.addParticleSystem, + type: '(newParticleSystem?: BabylonjsCoreIParticleSystem) => void' + }); + } + // BabylonjsCoreScene.addSkeleton of type '(newSkeleton?: BabylonjsCoreSkeleton) => void': + if (oldProps.addSkeleton !== newProps.addSkeleton) { + updates.push({ + propertyName: 'addSkeleton', + value: newProps.addSkeleton, + type: '(newSkeleton?: BabylonjsCoreSkeleton) => void' + }); + } + // BabylonjsCoreScene.addTexture of type '(newTexture?: BabylonjsCoreBaseTexture) => void': + if (oldProps.addTexture !== newProps.addTexture) { + updates.push({ + propertyName: 'addTexture', + value: newProps.addTexture, + type: '(newTexture?: BabylonjsCoreBaseTexture) => void' + }); + } + // BabylonjsCoreScene.addTransformNode of type '(newTransformNode?: BabylonjsCoreTransformNode) => void': + if (oldProps.addTransformNode !== newProps.addTransformNode) { + updates.push({ + propertyName: 'addTransformNode', + value: newProps.addTransformNode, + type: '(newTransformNode?: BabylonjsCoreTransformNode) => void' + }); + } // BabylonjsCoreScene.setActiveCameraByID of type '(id?: string) => BabylonjsCoreCamera': if (oldProps.setActiveCameraByID !== newProps.setActiveCameraByID) { updates.push({ @@ -19526,7 +20615,7 @@ export class FiberScenePropsHandler implements PropsHandler = { @@ -350,12 +363,21 @@ declare global { physicsImpostor: FiberPhysicsImpostorProps & FiberPhysicsImpostorPropsCtor & BabylonNode; vrExperienceHelper: FiberVRExperienceHelperProps & FiberVRExperienceHelperPropsCtor & BabylonNode; dynamicTerrain: FiberDynamicTerrainProps & FiberDynamicTerrainPropsCtor & BabylonNode; + autoRotationBehavior: FiberAutoRotationBehaviorProps & FiberAutoRotationBehaviorPropsCtor & BabylonNode; + bouncingBehavior: FiberBouncingBehaviorProps & FiberBouncingBehaviorPropsCtor & BabylonNode; + framingBehavior: FiberFramingBehaviorProps & FiberFramingBehaviorPropsCtor & BabylonNode; + attachToBoxBehavior: FiberAttachToBoxBehaviorProps & FiberAttachToBoxBehaviorPropsCtor & BabylonNode; + fadeInOutBehavior: FiberFadeInOutBehaviorProps & FiberFadeInOutBehaviorPropsCtor & BabylonNode; + multiPointerScaleBehavior: FiberMultiPointerScaleBehaviorProps & FiberMultiPointerScaleBehaviorPropsCtor & BabylonNode; + pointerDragBehavior: FiberPointerDragBehaviorProps & FiberPointerDragBehaviorPropsCtor & BabylonNode; + sixDofDragBehavior: FiberSixDofDragBehaviorProps & FiberSixDofDragBehaviorPropsCtor & BabylonNode; model: ModelProps & BabylonNode; } } } export type FiberNodeProps = { + addBehavior?: any; animationPropertiesOverride?: BabylonjsCoreAnimationPropertiesOverride; animations?: BabylonjsCoreAnimation[]; doNotSerialize?: boolean; @@ -376,6 +398,7 @@ export type FiberNodePropsCtor = { name: string; }; export type FiberTransformNodeProps = { + addRotation?: any; billboardMode?: number; ignoreNonUniformScaling?: boolean; infiniteDistance?: boolean; @@ -401,6 +424,7 @@ export type FiberTransformNodePropsCtor = { }; export type FiberAbstractMeshProps = { actionManager?: BabylonjsCoreAbstractActionManager; + addChild?: any; alphaIndex?: number; alwaysSelectAsActiveMesh?: boolean; applyFog?: boolean; @@ -456,6 +480,8 @@ export type FiberAbstractMeshPropsCtor = { name: string; }; export type FiberMeshProps = { + addInstance?: any; + addLODLevel?: any; delayLoadingFile?: string; delayLoadState?: number; instances?: BabylonjsCoreInstancedMesh[]; @@ -1437,6 +1463,7 @@ export type FiberPBRMaterialPropsCtor = { name: string; }; export type FiberNodeMaterialProps = { + addOutputNode?: any; attachedBlocks?: BabylonjsCoreNodeMaterialBlock[]; BJSNODEMATERIALEDITOR?: any; editorData?: any; @@ -1620,6 +1647,7 @@ export type FiberControlPropsCtor = { export type FiberContainerProps = { adaptHeightToChildren?: boolean; adaptWidthToChildren?: boolean; + addControl?: any; background?: string; logLayoutCycleErrors?: boolean; maxLayoutCycle?: number; @@ -1648,6 +1676,10 @@ export type FiberButtonPropsCtor = { name?: string; }; export type FiberSelectionPanelProps = { + addGroup?: any; + addToGroupCheckbox?: any; + addToGroupRadio?: any; + addToGroupSlider?: any; barColor?: string; barHeight?: string; buttonBackground?: string; @@ -1664,6 +1696,7 @@ export type FiberSelectionPanelPropsCtor = { groups?: BabylonjsGuiSelectorGroup[]; }; export type FiberScrollViewerProps = { + addControl?: any; barBackground?: string; barColor?: string; barImage?: BabylonjsGuiImage; @@ -1700,6 +1733,7 @@ export type FiberStackPanelPropsCtor = { name?: string; }; export type FiberVirtualKeyboardProps = { + addKeysRow?: any; defaultButtonBackground?: string; defaultButtonColor?: string; defaultButtonHeight?: string; @@ -1722,6 +1756,9 @@ export type FiberEllipsePropsCtor = { name?: string; }; export type FiberGridProps = { + addColumnDefinition?: any; + addControl?: any; + addRowDefinition?: any; name?: string; setColumnDefinition?: any; setRowDefinition?: any; @@ -1857,6 +1894,7 @@ export type FiberLinePropsCtor = { name?: string; }; export type FiberMultiLineProps = { + add?: any; dash?: number[]; horizontalAlignment?: number; lineWidth?: number; @@ -1952,6 +1990,7 @@ export type FiberDisplayGridPropsCtor = { name?: string; }; export type FiberControl3DProps = { + addBehavior?: any; isVisible?: boolean; name?: string; onPointerClickObservable?: any; @@ -1972,6 +2011,7 @@ export type FiberControl3DPropsCtor = { name?: string; }; export type FiberContainer3DProps = { + addControl?: any; blockLayout?: boolean; } & FiberControl3DProps; export type FiberContainer3DPropsCtor = { @@ -2049,6 +2089,8 @@ export type FiberEffectLayerPropsCtor = { name: string; }; export type FiberGlowLayerProps = { + addExcludedMesh?: any; + addIncludedOnlyMesh?: any; blurKernelSize?: number; customEmissiveColorSelector?: (mesh: BabylonjsCoreMesh, subMesh: BabylonjsCoreSubMesh, material: BabylonjsCoreMaterial, result: BabylonjsCoreColor4) => void; customEmissiveTextureSelector?: (mesh: BabylonjsCoreMesh, subMesh: BabylonjsCoreSubMesh, material: BabylonjsCoreMaterial) => BabylonjsCoreTexture; @@ -2059,6 +2101,8 @@ export type FiberGlowLayerPropsCtor = { options?: Partial; }; export type FiberHighlightLayerProps = { + addExcludedMesh?: any; + addMesh?: any; blurHorizontalSize?: number; blurVerticalSize?: number; innerGlow?: boolean; @@ -2227,6 +2271,7 @@ export type FiberNoiseProceduralTexturePropsCtor = { }; export type FiberRenderTargetTextureProps = { activeCamera?: BabylonjsCoreCamera; + addPostProcess?: any; boundingBoxPosition?: BabylonjsCoreVector3; boundingBoxSize?: BabylonjsCoreVector3; clearColor?: BabylonjsCoreColor4; @@ -2331,6 +2376,7 @@ export type FiberDynamicTexturePropsCtor = { format?: number; }; export type FiberAdvancedDynamicTextureProps = { + addControl?: any; background?: string; clipboardData?: string; focusedControl?: BabylonjsGuiIFocusableControl; @@ -2451,10 +2497,12 @@ export type FiberHtmlElementTexturePropsCtor = { options: BabylonjsCoreIHtmlElementTextureOptions; }; export type FiberGUI3DManagerProps = { + addControl?: any; onPickedPointChangedObservable?: any; } & CustomProps; export type FiberGUI3DManagerPropsCtor = {}; export type FiberShadowGeneratorProps = { + addShadowCaster?: any; bias?: number; blurBoxOffset?: number; blurKernel?: number; @@ -2497,6 +2545,9 @@ export type FiberEnvironmentHelperPropsCtor = { options: Partial; }; export type FiberPhysicsImpostorProps = { + addAnchor?: any; + addHook?: any; + addJoint?: any; afterStep?: () => void; beforeStep?: () => void; friction?: number; @@ -2528,6 +2579,7 @@ export type FiberPhysicsImpostorPropsCtor = { _options?: BabylonjsCorePhysicsImpostorParameters; }; export type FiberVRExperienceHelperProps = { + addFloorMesh?: any; beforeRender?: any; completeVRInit?: any; displayGaze?: boolean; @@ -2611,10 +2663,101 @@ export type FiberDynamicTerrainPropsCtor = { SPuvData?: number[][] | Float32Array[]; intializedCallback?: any; }; +export type FiberAutoRotationBehaviorProps = { + idleRotationSpeed?: number; + idleRotationSpinupTime?: number; + idleRotationWaitTime?: number; + zoomStopsAnimation?: boolean; +} & CustomProps; +export type FiberAutoRotationBehaviorPropsCtor = {}; +export type FiberBouncingBehaviorProps = { + autoTransitionRange?: boolean; + lowerRadiusTransitionRange?: number; + transitionDuration?: number; + upperRadiusTransitionRange?: number; +} & CustomProps; +export type FiberBouncingBehaviorPropsCtor = {}; +export type FiberFramingBehaviorProps = { + autoCorrectCameraLimitsAndSensibility?: boolean; + defaultElevation?: number; + elevationReturnTime?: number; + elevationReturnWaitTime?: number; + framingTime?: number; + mode?: number; + positionScale?: number; + radiusScale?: number; + zoomStopsAnimation?: boolean; +} & CustomProps; +export type FiberFramingBehaviorPropsCtor = {}; +export type FiberAttachToBoxBehaviorProps = { + distanceAwayFromBottomOfFace?: number; + distanceAwayFromFace?: number; + name?: string; + ui?: any; +} & CustomProps; +export type FiberAttachToBoxBehaviorPropsCtor = { + ui: BabylonjsCoreTransformNode; +}; +export type FiberFadeInOutBehaviorProps = { + delay?: number; + fadeInTime?: number; +} & CustomProps; +export type FiberFadeInOutBehaviorPropsCtor = {}; +export type FiberMultiPointerScaleBehaviorProps = {} & CustomProps; +export type FiberMultiPointerScaleBehaviorPropsCtor = {}; +export type FiberPointerDragBehaviorProps = { + attachedNode?: BabylonjsCoreAbstractMesh; + currentDraggingPointerID?: number; + detachCameraControls?: boolean; + dragDeltaRatio?: number; + dragging?: boolean; + enabled?: boolean; + lastDragPosition?: BabylonjsCoreVector3; + maxDragAngle?: number; + moveAttached?: boolean; + onDragEndObservable?: any; + onDragObservable?: any; + onDragStartObservable?: any; + options?: { dragAxis?: BabylonjsCoreVector3; dragPlaneNormal?: BabylonjsCoreVector3; }; + startAndReleaseDragOnPointerEvents?: boolean; + updateDragPlane?: boolean; + useObjectOrientationForDragging?: boolean; + validateDrag?: (targetPosition: BabylonjsCoreVector3) => boolean; +} & CustomProps; +export type FiberPointerDragBehaviorPropsCtor = { + dragAxis?: BabylonjsCoreVector3; + dragPlaneNormal?: BabylonjsCoreVector3; +}; +export type FiberSixDofDragBehaviorProps = { + currentDraggingPointerID?: number; + detachCameraControls?: boolean; + dragDeltaRatio?: number; + dragging?: boolean; + onDragEndObservable?: any; + onDragStartObservable?: any; + rotateDraggedObject?: boolean; + zDragFactor?: any; +} & CustomProps; +export type FiberSixDofDragBehaviorPropsCtor = {}; export type FiberSceneProps = { actionManager?: BabylonjsCoreAbstractActionManager; activeCamera?: BabylonjsCoreCamera; activeCameras?: BabylonjsCoreCamera[]; + addActionManager?: any; + addAnimation?: any; + addAnimationGroup?: any; + addCamera?: any; + addExternalData?: any; + addGeometry?: any; + addLight?: any; + addMaterial?: any; + addMesh?: any; + addMorphTargetManager?: any; + addMultiMaterial?: any; + addParticleSystem?: any; + addSkeleton?: any; + addTexture?: any; + addTransformNode?: any; afterCameraRender?: () => void; afterRender?: () => void; ambientColor?: BabylonjsCoreColor3; diff --git a/stories/babylonjs/8-behaviors/pointerDragBehavior.stories.js b/stories/babylonjs/8-behaviors/pointerDragBehavior.stories.js new file mode 100644 index 00000000..8676f59b --- /dev/null +++ b/stories/babylonjs/8-behaviors/pointerDragBehavior.stories.js @@ -0,0 +1,43 @@ +import React from 'react' +import {storiesOf} from '@storybook/react' +import {Engine, Scene} from '../../../dist/react-babylonjs.es5' +import {Vector3} from '@babylonjs/core/Maths/math' +import '../../style.css' + +/** + * official demo: + * https://www.babylonjs-playground.com/#YEZPVT + * + * TODO: camera autoAttaching? + */ + +function WithPointerDragBehavior() { + return ( + <> + + console.log('dragStart')} + onDragObservable={_ => console.log('drag')} + onDragEndObservable={_ => console.log('dragEnd')}/> + + + + ) +} + +export default storiesOf('Behaviors', module) + .add('Pointer drag behavior', () => ( +
+ + + + + + + +
+ ) + ) diff --git a/tools/generate-code.ts b/tools/generate-code.ts index 5f17c183..a6a28b54 100644 --- a/tools/generate-code.ts +++ b/tools/generate-code.ts @@ -1,6 +1,6 @@ /** * To debug code generation use the launch config in VS Code - "Generate Code (debug)" - */ + */ import { Project, ts, @@ -138,6 +138,14 @@ classesOfInterest.set("PhysicsImpostor", undefined); classesOfInterest.set("VRExperienceHelper", undefined); classesOfInterest.set("DynamicTerrain", undefined); classesOfInterest.set("EffectLayer", undefined); +classesOfInterest.set("Behavior", undefined); + +/** + * In babylon.js, Behavior is a interface, not a class. + * Each specific behavior is a separated class. + * Add it to classesOfInterest if className includes keyword. + */ +const classesOfKeywordInterest = ['Behavior']; type ModuleDeclaration = { moduleSpecifier: string, @@ -300,9 +308,21 @@ const createTypeFromText = (typeText: string, targetFiles: SourceFile[], customP return typeText; } +/** + * If has interest file, add it's class info to classesOfInterest. + * @param classDeclaration + * @param sourceFiles + */ const addSourceClass = (classDeclaration: ClassDeclaration, sourceFiles: SourceFile[]) => { const className = classDeclaration.getName() - if (className !== undefined && classesOfInterest.has(className)) { + + if (className === undefined) { + return; + } + + const findByKeyword = classesOfKeywordInterest.some(keyword => className.includes(keyword)); + + if (classesOfInterest.has(className) || findByKeyword) { const moduleDeclaration = getModuleDeclarationFromClassDeclaration(classDeclaration); addNamedImportToFile(moduleDeclaration, sourceFiles, true); @@ -592,11 +612,16 @@ const addCreateInfoFromFactoryMethod = (method: MethodDeclaration, factoryClass: writeTypeAlias(generatedPropsSourceFile, `${targetClass.getName()}PropsCtor`, typeProperties); } +/** + * get some methods from babylonjs class + * @param classDeclaration + */ const getInstanceSetMethods = (classDeclaration: ClassDeclaration): MethodDeclaration[] => { let instanceSetMethods: MethodDeclaration[] = [] classDeclaration.getInstanceMethods().forEach((methodDeclaration: MethodDeclaration) => { const methodName = methodDeclaration.getName(); - if (methodName.startsWith("set")) { + // TODO: add ? + if (methodName.startsWith("set") || methodName.startsWith('add')) { instanceSetMethods.push(methodDeclaration) } }) @@ -604,6 +629,10 @@ const getInstanceSetMethods = (classDeclaration: ClassDeclaration): MethodDeclar return instanceSetMethods; } +/** + * get props from babylonjs class + * @param classDeclaration + */ const getInstanceProperties = (classDeclaration: ClassDeclaration): (PropertyDeclaration | SetAccessorDeclaration)[] => { let result: (PropertyDeclaration | SetAccessorDeclaration)[] = []; @@ -763,7 +792,7 @@ const writePropertyAsUpdateFunction = (propsProperties: OptionalKind(); + // write Fiber***Props propertiesToAdd.sort((a, b) => a.getName().localeCompare(b.getName())).forEach((property: (PropertyDeclaration | SetAccessorDeclaration)) => { writePropertyAsUpdateFunction(typeProperties, writer, property, addedMeshProperties, babylonClassDeclaration.importAlias, [generatedCodeSourceFile, generatedPropsSourceFile]); }) @@ -978,6 +1008,14 @@ const writeTypeAlias = (file: SourceFile, name: string, typeProperties: Optional }) } +/** + * create Fiber***CtorProps interface from babylonjs class constructor's parameters + * @param sourceClass + * @param targetClass + * @param moduleDeclaration + * @param generatedCodeSourceFile + * @param generatedPropsSourceFile + */ const addCreateInfoFromConstructor = (sourceClass: ClassDeclaration, targetClass: ClassDeclaration, moduleDeclaration: ModuleDeclaration, generatedCodeSourceFile: SourceFile, generatedPropsSourceFile: SourceFile): void => { // this will allow us to do reflection to create the BabylonJS object from application props. const ctorArgsProperty = targetClass.addProperty({ @@ -1053,6 +1091,14 @@ const addCreateInfoFromConstructor = (sourceClass: ClassDeclaration, targetClass writeTypeAlias(generatedPropsSourceFile, `${ClassNamesPrefix}${className}PropsCtor`, typeProperties); } +/** + * create Metadata|ReactHostElement|ConstructorProps from babylonjs class. + * @param generatedCodeSourceFile + * @param generatedPropsSourceFile + * @param classNamespaceTuple + * @param metadata + * @param extra + */ const createClassesDerivedFrom = (generatedCodeSourceFile: SourceFile, generatedPropsSourceFile: SourceFile, classNamespaceTuple: ClassNameSpaceTuple, metadata?: InstanceMetadataParameter, extra?: (newClassDeclaration: ClassDeclaration, originalClassDeclaration: ClassDeclaration) => void): void => { let classDeclaration: ClassDeclaration | undefined = classNamespaceTuple.classDeclaration; @@ -1086,7 +1132,7 @@ const createClassesDerivedFrom = (generatedCodeSourceFile: SourceFile, generated const newClassDeclaration = createClassDeclaration(classDeclaration, baseClassDeclarationForCreate, generatedCodeSourceFile, generatedPropsSourceFile, extra); addCreateInfoFromConstructor(classDeclaration, newClassDeclaration, classNamespaceTuple.moduleDeclaration, generatedCodeSourceFile, generatedPropsSourceFile); - const metadataClone = metadata === undefined ? {} : { ...metadata }; + const metadataClone = metadata === undefined ? {} : { ...metadata }; if (inheritsFromNode) { metadataClone.isNode = true; } @@ -1370,6 +1416,13 @@ const generateCode = async () => { createSingleClass("VRExperienceHelper", generatedCodeSourceFile, generatedPropsSourceFile) createSingleClass("DynamicTerrain", generatedCodeSourceFile, generatedPropsSourceFile, undefined, { acceptsMaterials: true }) + classesOfInterest.forEach((_,className) => { + if (className.includes('Behavior')) { + createSingleClass(className as string, generatedCodeSourceFile, + generatedPropsSourceFile, undefined, {isBehavior: true}) + } + }) + if (classesOfInterest.get("Scene")) { // Scene we only want to generate the handlers. Constructor is very simple - just an Engine const sceneTuple: ClassNameSpaceTuple = classesOfInterest.get("Scene")! @@ -1478,4 +1531,3 @@ result.then(() => { }).catch(reason => { console.error('failed:', reason); }) - \ No newline at end of file