Webots Reference Manual

previous page go up next page

Thanks

1. Introduction

2. Node Chart

3. Nodes and API Functions

4. Prototypes

5. Physics Plugin

6. Fast2D Plugin

7. MTN Functions

8. Webots World Files

     

4.5 Prototype Scoping Rules

Prototype names must be unique: defining a prototype with the same name as another prototype or a built-in node type is an error. A .proto file can contain only one prototype definition. A prototype can be defined in terms of other prototypes. However, a prototype may not be instantiated inside its own definition (i.e., recursive prototypes are illegal). An IS statement refers to a field in the interface of the same prototype, in the same file.

A .proto file establishes a DEF/USE name scope separate from the rest of the scene tree and separate from any other prototype definition. Nodes given a name by a DEF construct inside the prototype may not be referenced in a USE construct outside of the prototype's scope. Nodes given a name by a DEF construct outside the prototype scope may not be referenced in a USE construct inside the prototype scope.

previous page go up next page
^ page top ^

  E-mail to webmaster Last updated: Copyright © 2008 Cyberbotics Ltd.