Skip to content

Commit 342763c

Browse files
committed
Now attach scripts etc. to instanced meshes (prefabs)
1 parent b45ecb4 commit 342763c

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

babylonjs-editor.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,7 @@ declare module 'babylonjs-editor/editor/gui/tree' {
858858
name: string;
859859
wholerow: boolean;
860860
keyboard: boolean;
861+
multipleSelection: boolean;
861862
element: JSTree;
862863
onClick: <T>(id: string, data: T) => void;
863864
onDblClick: <T>(id: string, data: T) => void;

src/extensions/behavior/code.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
Scene, Node, DirectionalLight, HemisphericLight,
33
Tools as BabylonTools, IParticleSystem, Vector4,
44
Vector3, Vector2, Color4, Color3, Tools, GroundMesh,
5-
AbstractMesh
5+
AbstractMesh, InstancedMesh
66
} from 'babylonjs';
77

88
import Tokenizer, { TokenType } from '../tools/tokenizer';
@@ -386,7 +386,7 @@ export default class CodeExtension extends Extension<BehaviorMetadata> implement
386386
if (obj instanceof HemisphericLight)
387387
return 'hemlight';
388388

389-
if (obj instanceof GroundMesh)
389+
if (obj instanceof GroundMesh || obj instanceof InstancedMesh)
390390
return 'mesh';
391391

392392
let ctrName = (obj && obj.constructor) ? (<any>obj.constructor).name : '';

src/tools/behavior/code.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
Node,
2+
Node, GroundMesh, InstancedMesh,
33
DirectionalLight, HemisphericLight,
44
Scene,
55
Tools as BabylonTools,
@@ -339,6 +339,8 @@ export default class BehaviorCodeEditor extends EditorPlugin {
339339
ctor = "dirlight";
340340
else if (this.node instanceof HemisphericLight)
341341
ctor = "hemlight";
342+
else if (this.node instanceof GroundMesh || this.node instanceof InstancedMesh)
343+
ctor = 'mesh';
342344
}
343345

344346
// Add script

0 commit comments

Comments
 (0)