File tree Expand file tree Collapse file tree 4 files changed +60
-0
lines changed Expand file tree Collapse file tree 4 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ var CUSTOM_CLASSES = [
41
41
'geometries/PlainGeometry.js' ,
42
42
'geometries/PlainBufferGeometry.js' ,
43
43
'objects/CloneArray.js' ,
44
+ 'objects/Blackbox.js' ,
44
45
] ;
45
46
46
47
Original file line number Diff line number Diff line change @@ -354,6 +354,10 @@ module.exports = {
354
354
} ,
355
355
propsDefinedByThree : [ 'type' ]
356
356
} ,
357
+ Blackbox : {
358
+ superClass : 'Object3D' ,
359
+ relativePath : './objects/Blackbox'
360
+ } ,
357
361
Raycaster : {
358
362
relativePath : './core/Raycaster' ,
359
363
properties : {
Original file line number Diff line number Diff line change
1
+ var _ = require ( 'underscore' ) ;
2
+ var BlackboxAutogen = require ( './Blackbox.autogen' ) . BlackboxModel ;
3
+
4
+ /**
5
+ * This object is intended as an extension point. It differs from
6
+ * a normal Object3D in that it does not sync back child objects to
7
+ * the models. This allows extensions to build sub-scene graphs that
8
+ * might not be possible/feasible/desirable to sync.
9
+ *
10
+ * To implement an extended object based on this:
11
+ * - Extend this model
12
+ * - Override defaults/serializers as normal for a widget. Remember
13
+ * to call the super methods!
14
+ * - Override initialize method. Call super, and then put any
15
+ * extension code that relies on the THREE object inside
16
+ * a "then" to `initPromise:
17
+ *
18
+ * this.initPromise.then(() => {
19
+ * // Do your stuff here
20
+ * });
21
+ * - If you do not want a basic Object3D as the "root" of your black
22
+ * box, you need to override constructThreeObject[Async].
23
+ */
24
+ var BlackboxModel = BlackboxAutogen . extend ( {
25
+
26
+ defaults : function ( ) {
27
+ var superdef = BlackboxAutogen . prototype . defaults . call ( this ) ;
28
+ delete superdef [ 'children' ] ;
29
+ return superdef ;
30
+ } ,
31
+
32
+
33
+ createPropertiesArrays : function ( ) {
34
+
35
+ BlackboxAutogen . prototype . createPropertiesArrays . call ( this ) ;
36
+ delete this . three_array_properties [ 'children' ] ;
37
+ delete this . property_converters [ 'children' ] ;
38
+
39
+ }
40
+
41
+ } ) ;
Original file line number Diff line number Diff line change
1
+ from .Blackbox_autogen import Blackbox as BaseBlackbox
2
+
3
+
4
+ class Blackbox (BaseBlackbox ):
5
+ """A widget with unsynced children.
6
+
7
+ This widget allows extension authors to expose scene control
8
+ of a given three object, without attempting to sync its
9
+ children. This makes it possible for a library to give
10
+ access to an outer object, without exposing the full object
11
+ three, and can be useful in avoiding possibly heavy sync
12
+ operations.
13
+ """
14
+ children = None
You can’t perform that action at this time.
0 commit comments