RUIC 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,8 +14,8 @@ assert effect['starttime',1] == 0
14
14
  assert effect['NoiseSamp'].value == 'maps/effects/brushnoise.dds'
15
15
 
16
16
  material = main/"Scene.Layer.Rectangle.Material"
17
- assert material.properties.length == 11 # 6 shared asset, 1 MaterialBase, 4 from material
17
+ assert material.properties.length == 12 # 6 shared asset, 2 MaterialBase, 4 from material
18
18
  assert material.name == "Material"
19
19
  assert material['uEnvironmentMappingEnabled']
20
20
  assert !material['ATTRIBUTE-DOES-NOT-EXIST']
21
- assert material['uEnvironmentTexture',1] == 'maps/materials/spherical_checker.png'
21
+ assert material['uEnvironmentTexture',1] == 'maps/materials/spherical_checker.png'
@@ -1,35 +1,44 @@
1
- metadata 'MetaData.xml'
2
-
3
- uia 'projects/SimpleScene/SimpleScene.uia'
4
- show app.errors if app.errors?
5
-
6
- main = app.main_presentation
7
-
8
- assert main.find( _type:'Model' ).length==4
9
- assert main.find( _type:'Model', _slide:0 ).length==3
10
- assert main.find( _type:'Model', _slide:1 ).length==4
11
- assert main.find( _type:'Model', _slide:1, _master:false ).length==1
12
- assert main.find( _type:'Model', position:[-150,60,0] ).length==2
13
- assert main.find( _type:'Model', position:[-150,60,0] ).length==2
14
- assert main.find( _type:'Model', position:[nil,60,nil] ).length==4
15
- assert main.find( _type:'Model', sourcepath:'#Cube' ).length==1
16
- assert main.find( _under:main/"Scene.Layer.Sphere1" ).length==1
17
- assert main.find( name:'Material' ).length==4
18
- assert main.find( name:/^Sphere/ ).length==2
19
-
20
- # Return values are in Scene graph order
21
- assert main.find.first == main/"Scene"
22
- assert main.find.last == main/"Scene.Layer.NonMaster.Material"
23
-
24
- # Any asset can be used as the 'root'
25
- sphere = main/"Scene.Layer.Sphere1"
26
- assert sphere.find.length==1
27
-
28
- # Supplying a block will iterate, including the index
29
- expected = main.find _type:'Model'
30
- found = 0
31
- main.find _type:'Model' do |mod,i|
32
- found += 1
33
- assert mod == expected[i]
34
- end
35
- assert found==4
1
+ metadata 'MetaData.xml'
2
+
3
+ uia 'projects/SimpleScene/SimpleScene.uia'
4
+ show app.errors if app.errors?
5
+
6
+ main = app.main_presentation
7
+
8
+ assert main.find( _type:'Model' ).length==4
9
+ assert main.find( _type:'Model', _slide:0 ).length==3
10
+ assert main.find( _type:'Model', _slide:1 ).length==4
11
+ assert main.find( _type:'Model', _slide:1, _master:false ).length==1
12
+ assert main.find( _type:'Model', position:[-150,60,0] ).length==2
13
+ assert main.find( _type:'Model', position:[-150,60,0] ).length==2
14
+ assert main.find( _type:'Model', position:[nil,60,nil] ).length==4
15
+ assert main.find( _type:'Model', sourcepath:'#Cube' ).length==1
16
+ assert main.find( _under:main/"Scene.Layer.Sphere1" ).length==1
17
+ assert main.find( name:'Material' ).length==4
18
+ assert main.find( name:/^Sphere/ ).length==2
19
+
20
+ # Return values are in Scene graph order
21
+ assert main.find.first == main/"Scene"
22
+ assert main.find.last == main/"Scene.Layer.NonMaster.Material"
23
+
24
+ # Any asset can be used as the 'root'
25
+ sphere = main/"Scene.Layer.Sphere1"
26
+ assert sphere.find.length==1
27
+
28
+ # Supplying a block will iterate, including the index
29
+ expected = main.find _type:'Model'
30
+ found = 0
31
+ main.find _type:'Model' do |mod,i|
32
+ found += 1
33
+ assert mod == expected[i]
34
+ end
35
+ assert found==4
36
+
37
+ #
38
+ ['NOPE',false,/NOPE/,-1,[-1],nil].each do |v|
39
+ assert main.find(__type:v).length==0
40
+ assert main.find(NOPE:v).length==0
41
+ assert main.find('NOPE'=>v).length==0
42
+ end
43
+
44
+ show "All #{File.basename(__FILE__)} assertions successful."
@@ -0,0 +1,9 @@
1
+ metadata 'MetaData-simple.xml'
2
+ uia 'projects/CustomClasses/CustomClasses.uia' # required before other commands
3
+ show app.errors if app.errors?
4
+
5
+ future = app["#future"]
6
+
7
+ assert xyzzy=future.find(_type:'XYZZY').first
8
+ assert xyzzy.type == 'XYZZY'
9
+ assert xyzzy['eyeball',0]==true # Unknown assets inherit from Asset
File without changes
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruic
2
+ metadata 'MetaData.xml' # optional; also may be set via -m flag
3
+ uia 'projects/Paths/Paths.uia' # required before other commands
4
+
5
+ show "Uh oh!", app.errors if app.errors?
6
+
7
+ main = app.main
8
+ paths = main.find _type:'Path'
9
+ assert paths.length == 5
10
+ assert paths.first == main/"Scene.Layer.Path1"
11
+ assert paths.first['width'].value == 17
12
+
13
+ assert main.find(_type:'PathAnchorPoint').length == 25
14
+
15
+ assert paths.first.anchors
16
+ assert paths.first.anchors.first == paths.first.find(_type:'PathAnchorPoint').first
17
+
18
+
19
+ show "All assertions successful"
@@ -2,5 +2,6 @@
2
2
  <application xmlns="http://nvidia.com/uicomposer">
3
3
  <assets initial="CustomClasses">
4
4
  <presentation id="CustomClasses" src="CustomClasses.uip"/>
5
+ <presentation id="future" src="FutureAsset.uip"/>
5
6
  </assets>
6
7
  </application>
@@ -0,0 +1,17 @@
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
+ <XYZZY id="future"/>
8
+ </Scene>
9
+ </Graph>
10
+ <Logic >
11
+ <State name="Master Slide" component="#Scene" >
12
+ <Add ref="#future" />
13
+ <State id="Scene-Slide1" name="Slide1" />
14
+ </State>
15
+ </Logic>
16
+ </Project>
17
+ </UIP>
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <application xmlns="http://nvidia.com/uicomposer">
3
- <assets><presentation id="main" src="SimpleScene.uip"/></assets>
4
- </application>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <application xmlns="http://nvidia.com/uicomposer">
3
+ <assets><presentation id="main" src="SimpleScene.uip"/></assets>
4
+ </application>
@@ -1,35 +1,35 @@
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"><Material id="Material"/></Model>
11
- <Model id="Sphere2"><Material id="Material_001"/></Model>
12
- <Model id="Cube"><Material id="Material_002"/></Model>
13
- <Model id="Sphere3"><Material id="Material_003"/></Model>
14
- </Layer>
15
- </Scene>
16
- </Graph>
17
- <Logic>
18
- <State name="Master Slide" component="#Scene">
19
- <Add ref="#Layer"/>
20
- <Add ref="#Camera"/>
21
- <Add ref="#Light"/>
22
- <Add ref="#Sphere" name="Sphere1" position="-150 60 0" sourcepath="#Sphere"/>
23
- <Add ref="#Material" diffuse="0 0.752941 0"/>
24
- <Add ref="#Sphere2" name="Sphere2" position="150 60.0004 0" sourcepath="#Sphere"/>
25
- <Add ref="#Material_001" diffuse="0 0.75287 0"/>
26
- <Add ref="#Cube" name="Cube" position="0 60 0" rotation="-30 60 -20" sourcepath="#Cube"/>
27
- <Add ref="#Material_002" name="Material" diffuse="0.5 0 0"/>
28
- <State id="Scene-Slide1" name="Slide1">
29
- <Add ref="#Sphere3" name="NonMaster" position="-150 60 0" sourcepath="#Sphere"/>
30
- <Add ref="#Material_003" diffuse="0 0.752941 0"/>
31
- </State>
32
- </State>
33
- </Logic>
34
- </Project>
35
- </UIP>
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"><Material id="Material"/></Model>
11
+ <Model id="Sphere2"><Material id="Material_001"/></Model>
12
+ <Model id="Cube"><Material id="Material_002"/></Model>
13
+ <Model id="Sphere3"><Material id="Material_003"/></Model>
14
+ </Layer>
15
+ </Scene>
16
+ </Graph>
17
+ <Logic>
18
+ <State name="Master Slide" component="#Scene">
19
+ <Add ref="#Layer"/>
20
+ <Add ref="#Camera"/>
21
+ <Add ref="#Light"/>
22
+ <Add ref="#Sphere" name="Sphere1" position="-150 60 0" sourcepath="#Sphere"/>
23
+ <Add ref="#Material" diffuse="0 0.752941 0"/>
24
+ <Add ref="#Sphere2" name="Sphere2" position="150 60.0004 0" sourcepath="#Sphere"/>
25
+ <Add ref="#Material_001" diffuse="0 0.75287 0"/>
26
+ <Add ref="#Cube" name="Cube" position="0 60 0" rotation="-30 60 -20" sourcepath="#Cube"/>
27
+ <Add ref="#Material_002" name="Material" diffuse="0.5 0 0"/>
28
+ <State id="Scene-Slide1" name="Slide1">
29
+ <Add ref="#Sphere3" name="NonMaster" position="-150 60 0" sourcepath="#Sphere"/>
30
+ <Add ref="#Material_003" diffuse="0 0.752941 0"/>
31
+ </State>
32
+ </State>
33
+ </Logic>
34
+ </Project>
35
+ </UIP>
@@ -17,6 +17,7 @@ assert app['#logic']==app['../BMW_Cluster/states/logic.scxml']
17
17
 
18
18
  main = app['#main'] # Look up a presentation by asset id
19
19
  assert main == app.main_presentation # …or ask for the main rendered presentation
20
+ assert main == app.main # …also available as a shortcut name
20
21
  assert main.filename == 'BMW_Cluster.uip' # You can also ask for the full path via .file
21
22
  assert main == app['BMW_Cluster.uip'] # Look up a presentation by asset id
22
23
 
@@ -1,52 +1,52 @@
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
- app.save_all!
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
+ app.save_all!
@@ -1,20 +1,20 @@
1
- metadata 'MetaData.xml' # optional; also may be set via -m flag
2
- # uia 'projects/CustomClasses/CustomClasses.uia' # required before other commands
3
- uia 'projects/BMW_Cluster/BMW_Cluster.uia' # required before other commands
4
- show app.errors if app.errors?
5
-
6
- show app.image_usage # hash mapping image paths, relative to uia, to arrays of things referencing them: materials; scxml visual actions; effects;
7
- show app.image_paths # Just the paths
8
- show app.mesh_usage # mapping mesh paths (postfixed with version numbers) to referencing elements
9
- show app.mesh_paths # Just the paths (no version number information)
10
- show app.script_usage # hash mapping lua paths, relative to uia, to arrays of things referencing them: presentation/application behaviors
11
- show app.script_paths # just the paths
12
- show app.material_usage # hash mapping materials paths, relative to uia, to arrays referencing material elements
13
- show app.material_paths # just the paths
14
- show app.font_usage # hash mapping font paths, relative to uia, to arrays of referencing text elements
15
- show app.font_paths # just the paths
16
- show app.effect_usage # hash mapping effect paths, relative to uia, to arrays of referencing effect elements
17
- show app.effect_paths # just the paths
18
-
19
- show app.referenced_paths
20
- show app.unused_files # Remember to check for .uip and .scxml not referenced by .uia
1
+ metadata 'MetaData.xml' # optional; also may be set via -m flag
2
+ # uia 'projects/CustomClasses/CustomClasses.uia' # required before other commands
3
+ uia 'projects/BMW_Cluster/BMW_Cluster.uia' # required before other commands
4
+ show app.errors if app.errors?
5
+
6
+ show app.image_usage # hash mapping image paths, relative to uia, to arrays of things referencing them: materials; scxml visual actions; effects;
7
+ show app.image_paths # Just the paths
8
+ show app.mesh_usage # mapping mesh paths (postfixed with version numbers) to referencing elements
9
+ show app.mesh_paths # Just the paths (no version number information)
10
+ show app.script_usage # hash mapping lua paths, relative to uia, to arrays of things referencing them: presentation/application behaviors
11
+ show app.script_paths # just the paths
12
+ show app.material_usage # hash mapping materials paths, relative to uia, to arrays referencing material elements
13
+ show app.material_paths # just the paths
14
+ show app.font_usage # hash mapping font paths, relative to uia, to arrays of referencing text elements
15
+ show app.font_paths # just the paths
16
+ show app.effect_usage # hash mapping effect paths, relative to uia, to arrays of referencing effect elements
17
+ show app.effect_paths # just the paths
18
+
19
+ show app.referenced_paths
20
+ show app.unused_files # Remember to check for .uip and .scxml not referenced by .uia
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RUIC
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Kistner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-11 00:00:00.000000000 Z
11
+ date: 2014-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -151,13 +151,17 @@ files:
151
151
  - lib/ruic/statemachine.rb
152
152
  - lib/ruic/version.rb
153
153
  - ruic.gemspec
154
+ - test/MetaData-simple.xml
154
155
  - test/MetaData.xml
155
156
  - test/customclasses.ruic
156
157
  - test/filtering.ruic
158
+ - test/futureassets.ruic
157
159
  - test/nonmaster.ruic
160
+ - test/paths.ruic
158
161
  - test/projects/CustomClasses/Brush Strokes.effect
159
162
  - test/projects/CustomClasses/CustomClasses.uia
160
163
  - test/projects/CustomClasses/CustomClasses.uip
164
+ - test/projects/CustomClasses/FutureAsset.uip
161
165
  - test/projects/CustomClasses/copper.material
162
166
  - test/projects/CustomClasses/maps/UV-Checker.png
163
167
  - test/projects/CustomClasses/maps/effects/brushnoise.dds
@@ -189,8 +193,30 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
193
  version: '0'
190
194
  requirements: []
191
195
  rubyforge_project:
192
- rubygems_version: 2.0.14
196
+ rubygems_version: 2.4.2
193
197
  signing_key:
194
198
  specification_version: 4
195
199
  summary: Library and DSL analyzing and manipulating UI Composer applications and presentations.
196
- test_files: []
200
+ test_files:
201
+ - test/MetaData-simple.xml
202
+ - test/MetaData.xml
203
+ - test/customclasses.ruic
204
+ - test/filtering.ruic
205
+ - test/futureassets.ruic
206
+ - test/nonmaster.ruic
207
+ - test/paths.ruic
208
+ - test/projects/CustomClasses/Brush Strokes.effect
209
+ - test/projects/CustomClasses/CustomClasses.uia
210
+ - test/projects/CustomClasses/CustomClasses.uip
211
+ - test/projects/CustomClasses/FutureAsset.uip
212
+ - test/projects/CustomClasses/copper.material
213
+ - test/projects/CustomClasses/maps/UV-Checker.png
214
+ - test/projects/CustomClasses/maps/effects/brushnoise.dds
215
+ - test/projects/CustomClasses/maps/materials/spherical_checker.png
216
+ - test/projects/ReferencedMaterials/ReferencedMaterials.uia
217
+ - test/projects/ReferencedMaterials/ReferencedMaterials.uip
218
+ - test/projects/SimpleScene/SimpleScene.uia
219
+ - test/projects/SimpleScene/SimpleScene.uip
220
+ - test/properties.ruic
221
+ - test/referencematerials.ruic
222
+ - test/usage.ruic