[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [x3d-public] Creating proto instances



Paulo Estrela wrote:

Hi,

Anyone knows how can I create proto instances based on a extern proto? How can I get a proto declaration from a file and then add a instance in another world?

Thanks

Paulo Estrela


You create proto instances based on extern proto instances in the same manner as regular instances since ExternProtoDeclaration extends ProtoDeclaration, except that the declaration manipulation methods are named xExternProtoDeclaration instead of xProtoDeclaration.

To get a proto declaration from a file and add an instance in another world, something like
X3DScene sceneContainingDecl;
X3DScene mainScene;
X3DProtoDeclaration theProto;
theProto=sceneContainingDecl.getProtoDeclaration(...);
sceneContainingDecl.removeProtoDeclaration(theProto);
mainScene.updateProtoDeclaration(theProto,newProtoName);
X3DNode yourInstance=theProto.createInstance();
should work.


--Brad Vender

-------------------------------------------------------------------------
for list subscription/unsubscription,
go to http://www.web3d.org/cgi-bin/public_list_signup/lwgate/listsavail.html