Debian Codegraph @

tests/data/demo-models-copy/proto_sfnode_default.x3dv

raw
1 #X3D V3.2 utf8
2 PROFILE Interchange
3
4 # This tests PROTOtypes with SFNode fields with non-NULL default values,
5 # combined with non-unique names similar to tricky_def_use.x3dv.
6 #
7 # Reading + saving this file *must* write back AppearanceYellowByDefault
8 # and AppearanceBlueByDefault usage without any fields, in other words
9 # it must remember that AppearanceYellowByDefault and AppearanceBlueByDefault
10 # use default prototype values for "mat" field.
11 #
12 # Otherwise, there's no way to specify "USE XXXMat" (since XXXMat
13 # name is overridden). And duplicating Material node contents is not
14 # good (for potential events, routes etc.)
15
16 # ----------------------------------------------------------------------------
17 # Define XXXMat as yellow, and define AppearanceYellowByDefault prototype
18
19 Transform {
20 children [
21 Transform {
22 translation 0 2 0
23 children [
24 DEF XXXTouch TouchSensor { }
25 Shape { geometry Text { string "yellow" } }
26 ]
27 }
28
29 Shape {
30 geometry Sphere { }
31 appearance Appearance { material DEF XXXMat Material { diffuseColor 1 1 0 } }
32 }
33 ]
34 }
35
36 PROTO AppearanceYellowByDefault [
37 inputOutput SFNode mat USE XXXMat
38 ] {
39 Appearance { material IS mat }
40 }
41
42 # ----------------------------------------------------------------------------
43 # Define XXXMat as blue, and define AppearanceBlueByDefault prototype
44
45 Transform {
46 translation 4 0 0
47 children [
48 Transform {
49 translation 0 2 0
50 children [
51 DEF XXXTouch TouchSensor { }
52 Shape { geometry Text { string "blue" } }
53 ]
54 }
55
56 Shape {
57 geometry Sphere { }
58 appearance Appearance { material DEF XXXMat Material { diffuseColor 0 0 1 } }
59 }
60 ]
61 }
62
63
64 PROTO AppearanceBlueByDefault [
65 inputOutput SFNode mat USE XXXMat
66 ] {
67 Appearance { material IS mat }
68 }
69
70 # ----------------------------------------------------------------------------
71 # Use AppearanceYellowByDefault prototype
72
73 Transform {
74 translation 8 0 0
75 children [
76 Transform {
77 translation 0 2 0
78 children [
79 DEF XXXTouch TouchSensor { }
80 Shape { geometry Text { string "yellow" } }
81 ]
82 }
83
84 Shape {
85 geometry Sphere { }
86 appearance AppearanceYellowByDefault { }
87 }
88 ]
89 }
90
91 # ----------------------------------------------------------------------------
92 # Use AppearanceBlueByDefault prototype
93
94 Transform {
95 translation 12 0 0
96 children [
97 Transform {
98 translation 0 2 0
99 children [
100 DEF XXXTouch TouchSensor { }
101 Shape { geometry Text { string "blue" } }
102 ]
103 }
104
105 Shape {
106 geometry Sphere { }
107 appearance AppearanceBlueByDefault { }
108 }
109 ]
110 }