RUIC 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +201 -0
  4. data/bin/ruic +52 -0
  5. data/gui/MetaData.xml +387 -0
  6. data/gui/TODO +2 -0
  7. data/gui/appattributesmodel.rb +51 -0
  8. data/gui/appelementsmodel.rb +126 -0
  9. data/gui/launch.rb +20 -0
  10. data/gui/makefile +14 -0
  11. data/gui/resources.qrc +37 -0
  12. data/gui/resources/images/Objects-Behavior-Normal.png +0 -0
  13. data/gui/resources/images/Objects-Camera-Normal.png +0 -0
  14. data/gui/resources/images/Objects-Component-Normal.png +0 -0
  15. data/gui/resources/images/Objects-Effect-Normal.png +0 -0
  16. data/gui/resources/images/Objects-Group-Normal.png +0 -0
  17. data/gui/resources/images/Objects-Image-Normal.png +0 -0
  18. data/gui/resources/images/Objects-Layer-Normal.png +0 -0
  19. data/gui/resources/images/Objects-Light-Normal.png +0 -0
  20. data/gui/resources/images/Objects-Material-Normal.png +0 -0
  21. data/gui/resources/images/Objects-Model-Normal.png +0 -0
  22. data/gui/resources/images/Objects-Music-Normal.png +0 -0
  23. data/gui/resources/images/Objects-Property-Normal.png +0 -0
  24. data/gui/resources/images/Objects-References-Normal.png +0 -0
  25. data/gui/resources/images/Objects-Scene-Normal.png +0 -0
  26. data/gui/resources/images/Objects-Sound-Normal.png +0 -0
  27. data/gui/resources/images/Objects-Text-Normal.png +0 -0
  28. data/gui/resources/images/Objects-Unknown-Normal.png +0 -0
  29. data/gui/resources/images/Objects-Video-Normal.png +0 -0
  30. data/gui/resources/images/SCXML.ico +0 -0
  31. data/gui/resources/images/TSCXML.ico +0 -0
  32. data/gui/resources/images/UIA.ico +0 -0
  33. data/gui/resources/images/clipboard.png +0 -0
  34. data/gui/resources/images/console_arrow.png +0 -0
  35. data/gui/resources/images/cross.png +0 -0
  36. data/gui/resources/images/currentline.png +0 -0
  37. data/gui/resources/images/disk-black.png +0 -0
  38. data/gui/resources/images/disks-black.png +0 -0
  39. data/gui/resources/images/document--plus.png +0 -0
  40. data/gui/resources/images/document-copy.png +0 -0
  41. data/gui/resources/images/executable-actions-delete-active.png +0 -0
  42. data/gui/resources/images/executable-actions-delete-idle.png +0 -0
  43. data/gui/resources/images/executable-actions-enter-badge.png +0 -0
  44. data/gui/resources/images/executable-actions-exit-badge.png +0 -0
  45. data/gui/resources/images/folder-horizontal--plus.png +0 -0
  46. data/gui/resources/images/folder-horizontal-open.png +0 -0
  47. data/gui/resources/images/gear.png +0 -0
  48. data/gui/resources/images/invalid_breakpoint.png +0 -0
  49. data/gui/resources/images/scissors-blue.png +0 -0
  50. data/gui/resources/images/slide-16-active.png +0 -0
  51. data/gui/resources/images/slide-16-master.png +0 -0
  52. data/gui/resources/images/slide-16-normal.png +0 -0
  53. data/gui/resources/images/slide-32-active.png +0 -0
  54. data/gui/resources/images/slide-32-master.png +0 -0
  55. data/gui/resources/images/slide-32-normal.png +0 -0
  56. data/gui/resources/images/studio_architect32.ico +0 -0
  57. data/gui/resources/images/studio_architect32.png +0 -0
  58. data/gui/resources/images/textfile_icon.png +0 -0
  59. data/gui/resources/style/checkbox.png +0 -0
  60. data/gui/resources/style/dark.qss +459 -0
  61. data/gui/resources/style/down_arrow.png +0 -0
  62. data/gui/resources/style/handle.png +0 -0
  63. data/gui/window.rb +90 -0
  64. data/gui/window.ui +753 -0
  65. data/lib/ruic.rb +59 -0
  66. data/lib/ruic/application.rb +129 -0
  67. data/lib/ruic/asset_classes.rb +448 -0
  68. data/lib/ruic/behaviors.rb +31 -0
  69. data/lib/ruic/interfaces.rb +36 -0
  70. data/lib/ruic/presentation.rb +354 -0
  71. data/lib/ruic/statemachine.rb +111 -0
  72. data/lib/ruic/version.rb +3 -0
  73. data/ruic.gemspec +23 -0
  74. data/test/MetaData.xml +387 -0
  75. data/test/customclasses.ruic +21 -0
  76. data/test/filtering.ruic +39 -0
  77. data/test/nonmaster.ruic +21 -0
  78. data/test/projects/CustomClasses/Brush Strokes.effect +38 -0
  79. data/test/projects/CustomClasses/CustomClasses.uia +6 -0
  80. data/test/projects/CustomClasses/CustomClasses.uip +34 -0
  81. data/test/projects/CustomClasses/copper.material +194 -0
  82. data/test/projects/CustomClasses/maps/UV-Checker.png +0 -0
  83. data/test/projects/CustomClasses/maps/effects/brushnoise.dds +0 -0
  84. data/test/projects/CustomClasses/maps/materials/spherical_checker.png +0 -0
  85. data/test/projects/ReferencedMaterials/ReferencedMaterials.uia +6 -0
  86. data/test/projects/ReferencedMaterials/ReferencedMaterials.uip +39 -0
  87. data/test/properties.ruic +81 -0
  88. data/test/referencematerials.ruic +53 -0
  89. data/test/usage.ruic +20 -0
  90. metadata +166 -0
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruic
2
+ metadata 'MetaData.xml' # optional; also may be set via -m flag
3
+ uia 'projects/CustomClasses/CustomClasses.uia' # required before other commands
4
+ show app.errors if app.errors?
5
+
6
+ main = app.main_presentation
7
+
8
+ assert main.scene.master?
9
+ assert (main/"Scene.Layer").master?
10
+ assert (main/"Scene.Layer.Camera").master?
11
+
12
+ rect = main/"Scene.Layer.Rectangle"
13
+ assert !rect.master?
14
+ assert rect['scale'].values.length == 1
15
+ assert rect['scale'].value.x == 5
16
+ assert rect['scale',1].x == 5
17
+ assert rect['scale',0].nil?
18
+
19
+ assert rect['position'].values.length == 1
20
+ assert rect['position',1].x == 0
21
+ assert rect['position',0].nil?
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <Effect>
3
+ <MetaData>
4
+ <!--Simulates an artistic painting of the image-->
5
+ <Property name="NoiseSamp" formalName="Noise" filter="linear" clamp="repeat" type="Texture" default=".\maps\effects\brushnoise.dds" description="Texture to be used for the brush texture"/>
6
+ <Property name="brushAngle" formalName="Brush Angle" default="45" description="Amount to rotate the noise texture."/>
7
+ <Property name="brushLen" formalName="Stroke Length" min="0" max="3" default="1" description="How far to offset the image/'brush'."/>
8
+ <Property name="brushSize" formalName="Stroke Size" min="10" max="200" default="100" description="Scale the brush. (Smaller values yield larger sizes.)"/>
9
+ </MetaData>
10
+ <Shaders>
11
+ <Shader>
12
+ <FragmentShader>
13
+ void frag (void)
14
+ {
15
+ if ( flagNoiseSamp != 0 ) {
16
+ float alpha = radians(brushAngle);
17
+ float cosAlpha = cos(alpha);
18
+ float sinAlpha = sin(alpha);
19
+ mat2 rotMat = mat2(cosAlpha, sinAlpha, -sinAlpha, cosAlpha);
20
+
21
+ vec2 uv0 = TexCoord / brushSize * 1000.0;
22
+ uv0 = (uv0.yx * rotMat).yx;
23
+
24
+ vec2 uv1 = texture2D_NoiseSamp(fract(uv0)).xy - 0.5;
25
+ uv1*= vec2(1.0, 0.01);
26
+ uv1*= rotMat;
27
+ vec2 uv2 = TexCoord + uv1 * 0.1 * brushLen;
28
+
29
+ vec2 halfPixelSize = 0.5 / Texture0Info.xy;
30
+ colorOutput(texture2D_0(clamp(uv2, halfPixelSize, 1.0-halfPixelSize)));
31
+ }
32
+ else
33
+ colorOutput(texture2D_0(TexCoord));
34
+ }
35
+ </FragmentShader>
36
+ </Shader>
37
+ </Shaders>
38
+ </Effect>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <application xmlns="http://nvidia.com/uicomposer">
3
+ <assets initial="CustomClasses">
4
+ <presentation id="CustomClasses" src="CustomClasses.uip"/>
5
+ </assets>
6
+ </application>
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <UIP version="3" >
3
+ <Project >
4
+ <ProjectSettings author="" company="" presentationWidth="800" presentationHeight="480" maintainAspect="False" />
5
+ <Classes >
6
+ <Effect id="Brush Strokes" name="Brush Strokes" sourcepath=".\Brush Strokes.effect" />
7
+ <CustomMaterial id="copper" name="copper" sourcepath=".\copper.material" />
8
+ </Classes>
9
+ <Graph >
10
+ <Scene id="Scene" >
11
+ <Layer id="Layer" >
12
+ <Camera id="Camera" />
13
+ <Light id="Light" />
14
+ <Effect id="Brush Strokes_001" class="#Brush Strokes" />
15
+ <Model id="Rectangle" >
16
+ <CustomMaterial id="Material" class="#copper" />
17
+ </Model>
18
+ </Layer>
19
+ </Scene>
20
+ </Graph>
21
+ <Logic >
22
+ <State name="Master Slide" component="#Scene" >
23
+ <Add ref="#Layer" />
24
+ <Add ref="#Camera" />
25
+ <Add ref="#Light" />
26
+ <State id="Scene-Slide1" name="Slide1" >
27
+ <Add ref="#Brush Strokes_001" name="Brush Strokes" />
28
+ <Add ref="#Rectangle" name="Rectangle" rotation="-4.94025 -10.2291 -12.3676" scale="5 5 5" sourcepath="#Rectangle" />
29
+ <Add ref="#Material" name="Material" roughness="0.0869565" uEnvironmentMappingEnabled="True" />
30
+ </State>
31
+ </State>
32
+ </Logic>
33
+ </Project>
34
+ </UIP>
@@ -0,0 +1,194 @@
1
+ <Material name="copper" version="1.0">
2
+ <MetaData >
3
+ <Property formalName="Environment Map" name="uEnvironmentTexture" type="Texture" filter="linear" minfilter="linearMipmapLinear" clamp="repeat" usage="environment" default=".\maps\materials\spherical_checker.png"/>
4
+ <Property formalName="Enable Environment" name="uEnvironmentMappingEnabled" type="Boolean" default="True"/>
5
+ <Property name="roughness" type="Float" min="0.000000" max="1.000000" default="0.000000" description="Roughness of the material. A value of 0 makes it completely specular, 1 is completely diffuse"/>
6
+ <Property name="metal_color" type="Color" default="0.805 0.395 0.305" description="Color of the material"/>
7
+ </MetaData>
8
+ <Shaders type="GLSL" version="330">
9
+ <Shader>
10
+ <Shared> </Shared>
11
+ <VertexShader>
12
+ // add structure defines
13
+ #define UIC_ENABLE_UV0 1
14
+ #define UIC_ENABLE_WORLD_POSITION 1
15
+ #define UIC_ENABLE_TEXTAN 1
16
+ #define UIC_ENABLE_BINORMAL 0
17
+
18
+ #include "vertexFragmentBase.glsllib"
19
+
20
+ // add temporary declarations
21
+ void main(void)
22
+ {
23
+
24
+ gl_Position = vertexMain();
25
+ }
26
+ </VertexShader>
27
+ <FragmentShader>
28
+
29
+ // add enum defines
30
+ #define scatter_reflect 0
31
+ #define scatter_transmit 1
32
+ #define scatter_reflect_transmit 2
33
+
34
+ #define UIC_ENABLE_UV0 1
35
+ #define UIC_ENABLE_WORLD_POSITION 1
36
+ #define UIC_ENABLE_TEXTAN 1
37
+ #define UIC_ENABLE_BINORMAL 0
38
+
39
+ #include "vertexFragmentBase.glsllib"
40
+
41
+ // set shader output
42
+ out vec4 fragColor;
43
+
44
+ // add structure defines
45
+ struct layer_result
46
+ {
47
+ vec4 base;
48
+ vec4 layer;
49
+ mat3 tanFrame;
50
+ };
51
+
52
+
53
+ // temporary declarations
54
+ layer_result layers[1];
55
+
56
+ #include "SSAOCustomMaterial.glsllib"
57
+ #include "sampleLight.glsllib"
58
+ #include "sampleProbe.glsllib"
59
+ #include "sampleArea.glsllib"
60
+ #include "square.glsllib"
61
+ #include "calculateRoughness.glsllib"
62
+ #include "evalEnvironmentMap.glsllib"
63
+ #include "luminance.glsllib"
64
+ #include "physGlossyBSDF.glsllib"
65
+ #include "simpleGlossyBSDF.glsllib"
66
+ #include "fresnelLayer.glsllib"
67
+
68
+ bool evalTwoSided()
69
+ {
70
+ return( false );
71
+ }
72
+
73
+ vec3 computeFrontMaterialEmissive()
74
+ {
75
+ return( vec3( 0, 0, 0 ) );
76
+ }
77
+
78
+
79
+
80
+ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor )
81
+ {
82
+ #if UIC_ENABLE_CG_LIGHTING
83
+ layers[0].base += vec4( 0.0f, 0.0f, 0.0f, 1.0f );
84
+ layers[0].layer += kggxGlossyBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
85
+
86
+ #endif
87
+ }
88
+
89
+ void computeFrontAreaColor( in mat3 lightFrame, vec3 lightPos, in float width, in float height, in vec4 lightDiffuse, in vec4 lightSpecular )
90
+ {
91
+ #if UIC_ENABLE_CG_LIGHTING
92
+ layers[0].base += vec4( 0.0f, 0.0f, 0.0f, 1.0f );
93
+ layers[0].layer += lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightFrame, lightPos, width, height, viewDir, roughness, roughness );
94
+
95
+ #endif
96
+ }
97
+
98
+ void computeFrontLayerEnvironment( in vec3 normal, float aoFactor )
99
+ {
100
+ #if !UIC_ENABLE_LIGHT_PROBE
101
+ layers[0].base += vec4( 0.0f, 0.0f, 0.0f, 1.0f );
102
+ layers[0].layer += simpleGlossyBSDFEnvironment( layers[0].tanFrame, roughness, roughness, scatter_reflect );
103
+
104
+ #else
105
+ layers[0].base += vec4( 0.0f, 0.0f, 0.0f, 1.0f );
106
+ layers[0].layer += sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
107
+
108
+ #endif
109
+ }
110
+
111
+ vec3 computeBackMaterialEmissive()
112
+ {
113
+ return( vec3(0, 0, 0) );
114
+ }
115
+
116
+
117
+
118
+ void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor )
119
+ {
120
+ #if UIC_ENABLE_CG_LIGHTING
121
+ layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 );
122
+ layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 );
123
+ #endif
124
+ }
125
+
126
+ void computeBackAreaColor( in mat3 lightFrame, vec3 lightPos, in float width, in float height, in vec4 lightDiffuse, in vec4 lightSpecular )
127
+ {
128
+ #if UIC_ENABLE_CG_LIGHTING
129
+ layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 );
130
+ layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 );
131
+ #endif
132
+ }
133
+
134
+ void computeBackLayerEnvironment( in vec3 normal, float aoFactor )
135
+ {
136
+ #if !UIC_ENABLE_LIGHT_PROBE
137
+ layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 );
138
+ layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 );
139
+ #else
140
+ layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 );
141
+ layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 );
142
+ #endif
143
+ }
144
+
145
+ float computeIOR()
146
+ {
147
+ return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
148
+ }
149
+
150
+ float evalCutout()
151
+ {
152
+ return( 1.000000 );
153
+ }
154
+
155
+ vec3 computeNormal()
156
+ {
157
+ return( normal );
158
+ }
159
+
160
+ void computeTemporaries()
161
+ {
162
+ }
163
+
164
+ vec4 computeLayerWeights( in float alpha )
165
+ {
166
+ vec4 color;
167
+ color = fresnelLayer( normal, vec3( 25.65, 25.65, 25.65 ), 1.000000, vec4( metal_color, 1.0).rgb, layers[0].layer, layers[0].base, alpha );
168
+ return color;
169
+ }
170
+
171
+
172
+ void main(void)
173
+ {
174
+ initializeBaseFragmentVariables();
175
+ computeTemporaries();
176
+ normal = normalize( computeNormal() );
177
+
178
+ // clear layers
179
+ layers[0].base = vec4(0.0, 0.0, 0.0, 1.0);
180
+ layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0);
181
+ layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) );
182
+
183
+ float alpha = clamp( evalCutout(), 0.0, 1.0 );
184
+ #include "customMaterialFragBodyAO.glsllib"
185
+ fragColor = rgba;
186
+ }
187
+ </FragmentShader>
188
+ </Shader>
189
+ </Shaders>
190
+ <Passes >
191
+ <Pass >
192
+ </Pass>
193
+ </Passes>
194
+ </Material>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <application xmlns="http://nvidia.com/uicomposer">
3
+ <assets initial="main">
4
+ <presentation id="main" src="ReferencedMaterials.uip"/>
5
+ </assets>
6
+ </application>
@@ -0,0 +1,39 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <UIP version="3" >
3
+ <Project >
4
+ <ProjectSettings author="" company="" presentationWidth="800" presentationHeight="480" maintainAspect="False" />
5
+ <Graph >
6
+ <Scene id="Scene" >
7
+ <Layer id="Layer" >
8
+ <Camera id="Camera" />
9
+ <Light id="Light" />
10
+ <Model id="Sphere" >
11
+ <Material id="Material" />
12
+ </Model>
13
+ <Model id="Sphere2" >
14
+ <Material id="Material_001" />
15
+ </Model>
16
+ <Model id="Cube" >
17
+ <Material id="Material_002" />
18
+ </Model>
19
+ </Layer>
20
+ </Scene>
21
+ </Graph>
22
+ <Logic >
23
+ <State name="Master Slide" component="#Scene" >
24
+ <Add ref="#Layer" />
25
+ <Add ref="#Camera" />
26
+ <Add ref="#Light" />
27
+ <Add ref="#Sphere" name="Sphere" position="-150 60 0" sourcepath="#Sphere" />
28
+ <Add ref="#Material" diffuse="0 0.752941 0" />
29
+ <Add ref="#Cube" name="Cube" position="150 0 0" rotation="-30 60 -20" sourcepath="#Cube" />
30
+ <Add ref="#Material_002" name="Material" diffuse="0.5 0 0" />
31
+ <State id="Scene-Slide1" name="Slide1" />
32
+ <State id="Scene-Slide2" name="Slide2" initialplaystate="Play" playmode="Stop at end" playthroughto="Previous" >
33
+ <Add ref="#Sphere2" name="Sphere2" position="-150 -60 0" sourcepath="#Sphere" />
34
+ <Add ref="#Material_001" diffuse="0 1 1" />
35
+ </State>
36
+ </State>
37
+ </Logic>
38
+ </Project>
39
+ </UIP>
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env ruic
2
+ metadata 'MetaData.xml' # optional; also may be set via -m flag
3
+ uia 'projects/BMW_Cluster/BMW_Cluster.uia' # required before other commands
4
+
5
+ show "Uh oh!", app.errors if app.errors?
6
+
7
+ assert app.filename == 'BMW_Cluster.uia'
8
+ assert app.assets.length==10, "There should be 10 assets"
9
+ assert app.behaviors.length==3
10
+ assert app.presentations.length==6
11
+
12
+ assert app['#logic']
13
+ assert app['#logic'].datamodel=='{output=output}'
14
+ assert app['#logic']==app['states/logic.scxml']
15
+ assert app['#logic']==app['./states/logic.scxml']
16
+ assert app['#logic']==app['../BMW_Cluster/states/logic.scxml']
17
+
18
+ main = app['#main'] # Look up a presentation by asset id
19
+ assert main == app.main_presentation # …or ask for the main rendered presentation
20
+ assert main.filename == 'BMW_Cluster.uip' # You can also ask for the full path via .file
21
+ assert main == app['BMW_Cluster.uip'] # Look up a presentation by asset id
22
+
23
+ assert !app['beejonkers'] # If an asset id doesn't exist, you'll get nil
24
+
25
+ scene = app/'main:Scene'
26
+ assert scene
27
+ assert scene==main.scene
28
+ assert scene.type == 'Scene'
29
+ assert scene.name == 'Scene'
30
+ assert scene['name'].value == 'Scene'
31
+
32
+ # Find an element based on path, prefixed with asset id
33
+ sm = app/'main:Scene.ClassicContent.ClassicContent.SimpleMedia'
34
+ assert sm.name == 'SimpleMedia'
35
+ assert sm.type == 'Model'
36
+ assert sm.path == 'main:Scene.ClassicContent.ClassicContent.SimpleMedia'
37
+
38
+ assert sm==main/'Scene.ClassicContent.ClassicContent.SimpleMedia'
39
+
40
+ assert sm.component == (main/'Scene.ClassicContent.ClassicContent')
41
+ assert sm.component.slides.length==2
42
+ assert sm.component.slides[0].name == 'Master Slide'
43
+ assert sm.component.slides[0].index == 0
44
+ assert sm.component.slides[2].name == 'CarStatus'
45
+ assert sm.component.slides[2].index == 2
46
+ assert sm.component.slides['CarStatus'].name == 'CarStatus'
47
+ assert sm.component.slides['CarStatus'] == sm.component.slides[2]
48
+
49
+ assert sm['endtime',0]==250
50
+ assert sm['endtime',1]==500
51
+ assert sm['endtime','SimpleMedia']==500
52
+ assert sm['endtime','CarStatus' ]==250
53
+ assert sm['endtime',99].nil?
54
+
55
+ assert sm['position'].linked?
56
+ assert !sm['endtime'].linked?
57
+ assert sm['endtime'].values == [250,500,250]
58
+ assert sm['endtime'].value == 250
59
+
60
+ assert sm['endtime',1]==500
61
+ assert sm['endtime','SimpleMedia']==500
62
+ assert sm['endtime','CarStatus' ]==250
63
+
64
+ sm['endtime','CarStatus'] = 750
65
+ assert sm['endtime','SimpleMedia']==500
66
+ assert sm['endtime','CarStatus' ]==750
67
+
68
+ sm['endtime'] = 100
69
+ assert sm['endtime',0]==100
70
+ assert sm['endtime',1]==100
71
+ assert sm['endtime',2]==100
72
+
73
+ assert sm['position',0].x==0
74
+ assert sm['scale',0].y == 2.88
75
+
76
+ sm['position',0].x=42
77
+ assert sm['position',0].x==42
78
+
79
+ sm['position',0].y=17
80
+ assert sm['position',0].y==17
81
+ assert sm['position',0].x==42
@@ -0,0 +1,53 @@
1
+ require 'fileutils'
2
+ FileUtils.copy_entry('projects/ReferencedMaterials','projects/_RefMat',false,false,true)
3
+
4
+ metadata 'MetaData.xml'
5
+
6
+ uia 'projects/_RefMat/ReferencedMaterials.uia'
7
+ show app.errors if app.errors?
8
+
9
+ layer = app/'main:Scene.Layer'
10
+ cubemat = layer/"Cube"/"Material"
11
+
12
+ # Ensure that the diffuse attribute is linked and present on multiple slides
13
+ assert cubemat['diffuse'].linked?
14
+ assert cubemat.has_slide?(0)
15
+ assert cubemat.has_slide?(1)
16
+ assert cubemat.has_slide?(2)
17
+ assert cubemat['diffuse',1].r == 0.5
18
+ assert cubemat['diffuse',2].r == 0.5
19
+
20
+ # When we do not unlink, values remain shared
21
+ cubemat['diffuse',1].r = 1
22
+ cubemat['diffuse',2].r = 0.2
23
+ assert cubemat['diffuse',1].r == cubemat['diffuse',2].r
24
+
25
+ # Ensure that we can unlink an attribute and vary the values per slide
26
+ cubemat['diffuse'].unlink
27
+ assert !cubemat['diffuse'].linked?
28
+ cubemat['diffuse',1].r = 1
29
+ cubemat['diffuse',2].r = 0.2
30
+ assert cubemat['diffuse',1].r == 1
31
+ assert cubemat['diffuse',2].r == 0.2
32
+
33
+ # We can swap a material with a referenced material
34
+ model = cubemat.parent
35
+ assert model
36
+ ref = cubemat.replace_with_referenced_material
37
+ assert cubemat.parent.nil? # The old material is removed from the graph
38
+ assert ref.parent==model # The new material is where the old was
39
+ assert ref['id'] == cubemat['id'] # The new material has the same id and name
40
+ assert ref.name == 'Material'
41
+ assert ref['referencedmaterial',0].object.nil? # New referenced materials start out with no reference
42
+ assert ref['referencedmaterial',0].type == :absolute # New references default to absolute
43
+
44
+ ref['referencedmaterial'].unlink
45
+ %w[Sphere Sphere2].each.with_index do |name,s|
46
+ # You can set a reference directly to an object, or alternatively
47
+ # ref['referencedmaterial',1].object = layer/name/"Material"
48
+ ref['referencedmaterial',s+1] = layer/name/"Material"
49
+ ref['referencedmaterial',s+1].type = :path
50
+ end
51
+
52
+
53
+ app.save_all!