File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
dev/core/src/Particles/Node/Blocks
tools/nodeParticleEditor/src/graphSystem/properties Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { NodeParticleBlockConnectionPointTypes } from "../Enums/nodeParticleBloc
5
5
import { NodeParticleBlock } from "../nodeParticleBlock" ;
6
6
import type { NodeParticleConnectionPoint } from "../nodeParticleBlockConnectionPoint" ;
7
7
import type { NodeParticleBuildState } from "../nodeParticleBuildState" ;
8
+ import { Observable } from "core/Misc/observable" ;
8
9
9
10
/**
10
11
* Defines a block used to debug values going through it
@@ -65,6 +66,11 @@ export class ParticleDebugBlock extends NodeParticleBlock {
65
66
return this . _outputs [ 0 ] ;
66
67
}
67
68
69
+ /**
70
+ * Observable raised when data is collected
71
+ */
72
+ public onDataCollectedObservable = new Observable < ParticleDebugBlock > ( undefined , true ) ;
73
+
68
74
public override _build ( state : NodeParticleBuildState ) {
69
75
if ( ! this . input . isConnected ) {
70
76
this . output . _storedFunction = null ;
@@ -100,6 +106,8 @@ export class ParticleDebugBlock extends NodeParticleBlock {
100
106
break ;
101
107
}
102
108
109
+ this . onDataCollectedObservable . notifyObservers ( this ) ;
110
+
103
111
return input ;
104
112
} ;
105
113
@@ -123,6 +131,11 @@ export class ParticleDebugBlock extends NodeParticleBlock {
123
131
124
132
this . stackSize = serializationObject . stackSize ;
125
133
}
134
+
135
+ public override dispose ( ) : void {
136
+ this . onDataCollectedObservable . clear ( ) ;
137
+ super . dispose ( ) ;
138
+ }
126
139
}
127
140
128
141
RegisterClass ( "BABYLON.ParticleDebugBlock" , ParticleDebugBlock ) ;
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import type { ParticleDebugBlock } from "core/Particles/Node/Blocks/particleDebu
9
9
10
10
export class DebugPropertyTabComponent extends React . Component < IPropertyComponentProps > {
11
11
private _onUpdateRequiredObserver : Nullable < Observer < any > > ;
12
+ private _dataCollectedObserver : Nullable < Observer < ParticleDebugBlock > > ;
12
13
13
14
constructor ( props : IPropertyComponentProps ) {
14
15
super ( props ) ;
@@ -21,12 +22,23 @@ export class DebugPropertyTabComponent extends React.Component<IPropertyComponen
21
22
}
22
23
23
24
override componentWillUnmount ( ) {
24
- this . props . stateManager . onUpdateRequiredObservable . remove ( this . _onUpdateRequiredObserver ) ;
25
+ this . _onUpdateRequiredObserver ?. remove ( ) ;
26
+ this . _onUpdateRequiredObserver = null ;
27
+ this . _dataCollectedObserver ?. remove ( ) ;
28
+ this . _dataCollectedObserver = null ;
25
29
}
26
30
27
31
override render ( ) {
28
32
const debugBlock = this . props . nodeData . data as ParticleDebugBlock ;
29
33
34
+ if ( this . _dataCollectedObserver ) {
35
+ this . _dataCollectedObserver . remove ( ) ;
36
+ }
37
+
38
+ this . _dataCollectedObserver = debugBlock . onDataCollectedObservable . add ( ( data ) => {
39
+ this . forceUpdate ( ) ;
40
+ } ) ;
41
+
30
42
return (
31
43
< div >
32
44
< GeneralPropertyTabComponent stateManager = { this . props . stateManager } nodeData = { this . props . nodeData } />
You can’t perform that action at this time.
0 commit comments