RUIC 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -3
  3. data/HISTORY +110 -86
  4. data/README.md +220 -220
  5. data/bin/ruic +61 -61
  6. data/gui/TODO +2 -2
  7. data/gui/appattributesmodel.rb +51 -51
  8. data/gui/appelementsmodel.rb +126 -126
  9. data/gui/launch.rb +19 -19
  10. data/gui/makefile +14 -14
  11. data/gui/resources/style/dark.qss +459 -459
  12. data/gui/window.rb +90 -90
  13. data/gui/window.ui +753 -753
  14. data/lib/ruic.rb +191 -190
  15. data/lib/ruic/application.rb +25 -3
  16. data/lib/ruic/assets.rb +441 -436
  17. data/lib/ruic/attributes.rb +179 -178
  18. data/lib/ruic/behaviors.rb +0 -0
  19. data/lib/ruic/effect.rb +31 -31
  20. data/lib/ruic/interfaces.rb +0 -0
  21. data/lib/ruic/nicebytes.rb +29 -0
  22. data/lib/ruic/presentation.rb +6 -3
  23. data/lib/ruic/renderplugin.rb +17 -17
  24. data/lib/ruic/ripl.rb +45 -45
  25. data/lib/ruic/statemachine.rb +6 -0
  26. data/lib/ruic/version.rb +3 -3
  27. data/ruic.gemspec +25 -25
  28. data/test/MetaData-simple.xml +28 -28
  29. data/test/MetaData.xml +435 -435
  30. data/test/customclasses.ruic +29 -29
  31. data/test/filtering.ruic +42 -42
  32. data/test/futureassets.ruic +7 -7
  33. data/test/nonmaster.ruic +20 -20
  34. data/test/paths.ruic +16 -16
  35. data/test/projects/CustomClasses/CustomClasses.uia +7 -7
  36. data/test/projects/CustomClasses/CustomClasses.uip +40 -40
  37. data/test/projects/CustomClasses/FutureAsset.uip +17 -17
  38. data/test/projects/MissingAssets/Existing.uip +87 -87
  39. data/test/projects/MissingAssets/MissingAssets.uia +0 -0
  40. data/test/projects/MissingAssets/MissingAssets.uia-user +14 -14
  41. data/test/projects/MissingAssets/RoundedPlane-1/RoundedPlane-1.import +18 -18
  42. data/test/projects/MissingAssets/RoundedPlane-1/meshes/RoundedPlane.mesh +0 -0
  43. data/test/projects/MissingAssets/effects/effects.txt +0 -0
  44. data/test/projects/MissingAssets/effects/existing.effect +0 -0
  45. data/test/projects/MissingAssets/fonts/Arimo-Regular.ttf +0 -0
  46. data/test/projects/MissingAssets/fonts/Chivo-Black.ttf +0 -0
  47. data/test/projects/MissingAssets/fonts/OFL.txt +0 -0
  48. data/test/projects/MissingAssets/maps/effects/brushnoise.dds +0 -0
  49. data/test/projects/MissingAssets/maps/existing.png +0 -0
  50. data/test/projects/MissingAssets/maps/maps.txt +0 -0
  51. data/test/projects/MissingAssets/maps/materials/concrete_plain.png +0 -0
  52. data/test/projects/MissingAssets/maps/materials/concrete_plain_bump.png +0 -0
  53. data/test/projects/MissingAssets/maps/materials/spherical_checker.png +0 -0
  54. data/test/projects/MissingAssets/materials/concrete.material +0 -0
  55. data/test/projects/MissingAssets/materials/materials.txt +0 -0
  56. data/test/projects/MissingAssets/scripts/existing1.lua +0 -0
  57. data/test/projects/MissingAssets/scripts/existing2.lua +0 -0
  58. data/test/projects/MissingAssets/states/existing.scxml +0 -0
  59. data/test/projects/MissingAssets/tests/interface-navigation.scxml-test +0 -0
  60. data/test/projects/Paths/Paths.uia +4 -4
  61. data/test/projects/Paths/Paths.uip +98 -98
  62. data/test/projects/SimpleScene/SimpleScene.uia +4 -4
  63. data/test/projects/SimpleScene/SimpleScene.uip +35 -35
  64. data/test/properties.ruic +80 -80
  65. data/test/referencematerials.ruic +50 -50
  66. data/test/usage.ruic +54 -54
  67. metadata +5 -54
data/bin/ruic CHANGED
@@ -1,61 +1,61 @@
1
- #!/usr/bin/env ruby
2
-
3
- begin
4
- require 'ruic'
5
- rescue LoadError
6
- require 'rubygems'
7
- require 'ruic'
8
- end
9
-
10
- USAGE = <<ENDUSAGE
11
- Usage:
12
- ruic [-h] [-v] [-i] [-m path/to/MetaData.xml] [-u path/to/my.uia] [myscript.ruic]
13
- ENDUSAGE
14
-
15
- HELP = <<ENDHELP
16
- -h, --help Show this help.
17
- -v, --version Show the version number (#{RUIC::VERSION}).
18
- -i, --interactive Enter an interactive REPL after running the script (if any).
19
- -m, --metadata The path to use for MetaData.xml
20
- Will be overridden by any `metadata` call in your script.
21
- Default: #{RUIC::DEFAULTMETADATA}
22
- -u, --uia A UIC application file (.uia) to load.
23
- ENDHELP
24
-
25
- ARGS = {}
26
- UNFLAGGED_ARGS = [ :script ]
27
- next_arg = UNFLAGGED_ARGS.first
28
- ARGV.each do |arg|
29
- case arg
30
- when '-h','--help' then ARGS[:help] = true
31
- when '-v','--version' then ARGS[:version] = true
32
- when '-i','--interactive' then ARGS[:repl] = true
33
- when '-m','--metadata' then next_arg = :metadata
34
- when '-u','--uia' then next_arg = :uia
35
- else
36
- if next_arg
37
- ARGS[next_arg] = arg
38
- UNFLAGGED_ARGS.delete( next_arg )
39
- end
40
- next_arg = UNFLAGGED_ARGS.first
41
- end
42
- end
43
-
44
- if ARGS.delete(:version)
45
- puts "RUIC v#{RUIC::VERSION}"
46
- exit 0 if ARGS.empty?
47
- end
48
-
49
- if ARGS[:help]
50
- puts USAGE, HELP
51
- exit 0
52
- end
53
-
54
- if ARGS[:script] && File.extname(ARGS[:script])==".uia"
55
- ARGS[:uia] = ARGS[:script]
56
- ARGS[:script] = nil
57
- end
58
-
59
- %w[uia script metadata].each{ |arg| ARGS[arg]=File.expand_path(ARGS[arg]) if ARGS[arg=arg.to_sym] }
60
- ARGS[:repl] ||= !ARGS[:script]
61
- RUIC(ARGS)
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'ruic'
5
+ rescue LoadError
6
+ require 'rubygems'
7
+ require 'ruic'
8
+ end
9
+
10
+ USAGE = <<ENDUSAGE
11
+ Usage:
12
+ ruic [-h] [-v] [-i] [-m path/to/MetaData.xml] [-u path/to/my.uia] [myscript.ruic]
13
+ ENDUSAGE
14
+
15
+ HELP = <<ENDHELP
16
+ -h, --help Show this help.
17
+ -v, --version Show the version number (#{RUIC::VERSION}).
18
+ -i, --interactive Enter an interactive REPL after running the script (if any).
19
+ -m, --metadata The path to use for MetaData.xml
20
+ Will be overridden by any `metadata` call in your script.
21
+ Default: #{RUIC::DEFAULTMETADATA}
22
+ -u, --uia A UIC application file (.uia) to load.
23
+ ENDHELP
24
+
25
+ ARGS = {}
26
+ UNFLAGGED_ARGS = [ :script ]
27
+ next_arg = UNFLAGGED_ARGS.first
28
+ ARGV.each do |arg|
29
+ case arg
30
+ when '-h','--help' then ARGS[:help] = true
31
+ when '-v','--version' then ARGS[:version] = true
32
+ when '-i','--interactive' then ARGS[:repl] = true
33
+ when '-m','--metadata' then next_arg = :metadata
34
+ when '-u','--uia' then next_arg = :uia
35
+ else
36
+ if next_arg
37
+ ARGS[next_arg] = arg
38
+ UNFLAGGED_ARGS.delete( next_arg )
39
+ end
40
+ next_arg = UNFLAGGED_ARGS.first
41
+ end
42
+ end
43
+
44
+ if ARGS.delete(:version)
45
+ puts "RUIC v#{RUIC::VERSION}"
46
+ exit 0 if ARGS.empty?
47
+ end
48
+
49
+ if ARGS[:help]
50
+ puts USAGE, HELP
51
+ exit 0
52
+ end
53
+
54
+ if ARGS[:script] && File.extname(ARGS[:script])==".uia"
55
+ ARGS[:uia] = ARGS[:script]
56
+ ARGS[:script] = nil
57
+ end
58
+
59
+ %w[uia script metadata].each{ |arg| ARGS[arg]=File.expand_path(ARGS[arg]) if ARGS[arg=arg.to_sym] }
60
+ ARGS[:repl] ||= !ARGS[:script]
61
+ RUIC(ARGS)
data/gui/TODO CHANGED
@@ -1,2 +1,2 @@
1
- * Preferences file for last opened file directory - yml?
2
- * Revert!
1
+ * Preferences file for last opened file directory - yml?
2
+ * Revert!
@@ -1,51 +1,51 @@
1
- module UIC; end
2
- class UIC::GUI::AppAttributesModel < Qt::AbstractItemModel
3
- INVALIDINDEX = Qt::ModelIndex.new
4
- NODATA = Qt::Variant.new
5
- def initialize(qtparent,el)
6
- super(qtparent)
7
- @indexes = {} # indexed by [row,col]
8
- @root = Qt::ModelIndex.new
9
- @el = el
10
- el.properties.values.sort_by{ |p| p.formal.downcase }.each.with_index do |prop,i|
11
- @indexes[[i,0]] = createIndex( i, 0, Qt::Variant.new(prop.formal) )
12
- @indexes[[i,1]] = createIndex( i, 1, Qt::Variant.new(el[prop.name,0].to_s) )
13
- end
14
- end
15
-
16
- def columnCount( *any )
17
- 2
18
- end
19
-
20
- def index( row, col, parent=INVALIDINDEX )
21
- @indexes[[row,col]]
22
- end
23
-
24
- def headerData(section, orientation, role=Qt::DisplayRole)
25
- if orientation==Qt::Horizontal && role==Qt::DisplayRole
26
- case section
27
- when 0; Qt::Variant.new(tr("Attribute"))
28
- when 1; Qt::Variant.new(tr("Value"))
29
- else ; NODATA
30
- end
31
- else
32
- NODATA
33
- end
34
- end
35
-
36
- def parent(child)
37
- child.valid? ? @root : @INVALIDINDEX
38
- end
39
-
40
- def rowCount( parent=INVALIDINDEX )
41
- @rowcount ||= @el.properties.length
42
- end
43
-
44
- def data(index, role)
45
- if index.valid? && role == Qt::DisplayRole
46
- index.internal_pointer
47
- else
48
- NODATA
49
- end
50
- end
51
- end
1
+ module UIC; end
2
+ class UIC::GUI::AppAttributesModel < Qt::AbstractItemModel
3
+ INVALIDINDEX = Qt::ModelIndex.new
4
+ NODATA = Qt::Variant.new
5
+ def initialize(qtparent,el)
6
+ super(qtparent)
7
+ @indexes = {} # indexed by [row,col]
8
+ @root = Qt::ModelIndex.new
9
+ @el = el
10
+ el.properties.values.sort_by{ |p| p.formal.downcase }.each.with_index do |prop,i|
11
+ @indexes[[i,0]] = createIndex( i, 0, Qt::Variant.new(prop.formal) )
12
+ @indexes[[i,1]] = createIndex( i, 1, Qt::Variant.new(el[prop.name,0].to_s) )
13
+ end
14
+ end
15
+
16
+ def columnCount( *any )
17
+ 2
18
+ end
19
+
20
+ def index( row, col, parent=INVALIDINDEX )
21
+ @indexes[[row,col]]
22
+ end
23
+
24
+ def headerData(section, orientation, role=Qt::DisplayRole)
25
+ if orientation==Qt::Horizontal && role==Qt::DisplayRole
26
+ case section
27
+ when 0; Qt::Variant.new(tr("Attribute"))
28
+ when 1; Qt::Variant.new(tr("Value"))
29
+ else ; NODATA
30
+ end
31
+ else
32
+ NODATA
33
+ end
34
+ end
35
+
36
+ def parent(child)
37
+ child.valid? ? @root : @INVALIDINDEX
38
+ end
39
+
40
+ def rowCount( parent=INVALIDINDEX )
41
+ @rowcount ||= @el.properties.length
42
+ end
43
+
44
+ def data(index, role)
45
+ if index.valid? && role == Qt::DisplayRole
46
+ index.internal_pointer
47
+ else
48
+ NODATA
49
+ end
50
+ end
51
+ end
@@ -1,126 +1,126 @@
1
- module UIC; end
2
- class UIC::GUI::AppElementsModel < Qt::AbstractItemModel
3
- INVALIDINDEX = Qt::ModelIndex.new
4
- NODATA = Qt::Variant.new
5
- def initialize(qtparent,app)
6
- super(qtparent)
7
- @root = El.new(app,0)
8
- end
9
-
10
- def columnCount( *any )
11
- 2
12
- end
13
-
14
- def index( row, col, parent=INVALIDINDEX )
15
- parentEl = parent.valid? ? parent.internal_pointer : @root
16
- if childEl=parentEl.child(row)
17
- createIndex(row,col,childEl)
18
- else
19
- INVALIDINDEX
20
- end
21
- end
22
-
23
- def headerData(section, orientation, role=Qt::DisplayRole)
24
- if orientation==Qt::Horizontal && role==Qt::DisplayRole
25
- case section
26
- when 0; Qt::Variant.new(tr("Name"))
27
- when 1; Qt::Variant.new(tr("Type"))
28
- else ; NODATA
29
- end
30
- else
31
- NODATA
32
- end
33
- end
34
-
35
- def parent(child)
36
- if child.valid?
37
- parentEl = child.internal_pointer.parent
38
- if parentEl.nil? || parentEl==@root
39
- INVALIDINDEX
40
- else
41
- createIndex(parentEl.row, 0, parentEl)
42
- end
43
- else
44
- INVALIDINDEX
45
- end
46
- end
47
-
48
- def rowCount( parent=INVALIDINDEX )
49
- parentEl = parent.valid? ? parent.internal_pointer : @root
50
- parentEl.child_count
51
- end
52
-
53
- def data(index, role)
54
- if index.valid?
55
- element = index.internal_pointer
56
- case role
57
- when Qt::DisplayRole
58
- case index.column
59
- when 0; Qt::Variant.new(element.displayName)
60
- when 1; Qt::Variant.new(element.displayType)
61
- else ; NODATA
62
- end
63
- when Qt::DecorationRole
64
- index.column==0 ? element.icon : NODATA
65
- else
66
- NODATA
67
- end
68
- else
69
- NODATA
70
- end
71
- end
72
- end
73
-
74
- class UIC::GUI::AppElementsModel::El
75
- @by_el = {}
76
- class << self
77
- def [](el,row)
78
- @by_el[el] ||= self.new(el,row)
79
- end
80
- end
81
-
82
- attr_reader :row
83
- attr_reader :el
84
- def initialize(el,row)
85
- @el = el
86
- @isapp = el.is_a?( UIC::Application )
87
- @row = row
88
- end
89
- def child_count
90
- (@isapp ? @el.presentations : @el.children).length
91
- end
92
-
93
- def child(offset)
94
- kids = @isapp ? @el.presentations : @el.children
95
- self.class[ @isapp ? kids[offset].scene : kids[offset], offset ] if kids[offset]
96
- end
97
-
98
- def parent
99
- unless @el.is_a?( UIC::Application )
100
- self.class[@el.parent || @el.presentation.app, @row]
101
- end
102
- end
103
-
104
- def icon
105
- @icon ||= UIC::GUI::IconVariant[@el.type]
106
- end
107
-
108
- def displayName
109
- @el.type=='Scene' ? @el.path : @el.name
110
- end
111
- def displayType
112
- @el.type
113
- end
114
- end
115
-
116
- module UIC::GUI::IconVariant
117
- @by_path = {}
118
- def self.[]( alias_or_path )
119
- @by_path[alias_or_path] ||= begin
120
- icon = Qt::Pixmap.new(alias_or_path)
121
- icon = Qt::Pixmap.new(":/#{alias_or_path}") if icon.isNull
122
- icon = Qt::Pixmap.new(":/Unknown") if icon.isNull
123
- Qt::Variant.fromValue(icon)
124
- end
125
- end
126
- end
1
+ module UIC; end
2
+ class UIC::GUI::AppElementsModel < Qt::AbstractItemModel
3
+ INVALIDINDEX = Qt::ModelIndex.new
4
+ NODATA = Qt::Variant.new
5
+ def initialize(qtparent,app)
6
+ super(qtparent)
7
+ @root = El.new(app,0)
8
+ end
9
+
10
+ def columnCount( *any )
11
+ 2
12
+ end
13
+
14
+ def index( row, col, parent=INVALIDINDEX )
15
+ parentEl = parent.valid? ? parent.internal_pointer : @root
16
+ if childEl=parentEl.child(row)
17
+ createIndex(row,col,childEl)
18
+ else
19
+ INVALIDINDEX
20
+ end
21
+ end
22
+
23
+ def headerData(section, orientation, role=Qt::DisplayRole)
24
+ if orientation==Qt::Horizontal && role==Qt::DisplayRole
25
+ case section
26
+ when 0; Qt::Variant.new(tr("Name"))
27
+ when 1; Qt::Variant.new(tr("Type"))
28
+ else ; NODATA
29
+ end
30
+ else
31
+ NODATA
32
+ end
33
+ end
34
+
35
+ def parent(child)
36
+ if child.valid?
37
+ parentEl = child.internal_pointer.parent
38
+ if parentEl.nil? || parentEl==@root
39
+ INVALIDINDEX
40
+ else
41
+ createIndex(parentEl.row, 0, parentEl)
42
+ end
43
+ else
44
+ INVALIDINDEX
45
+ end
46
+ end
47
+
48
+ def rowCount( parent=INVALIDINDEX )
49
+ parentEl = parent.valid? ? parent.internal_pointer : @root
50
+ parentEl.child_count
51
+ end
52
+
53
+ def data(index, role)
54
+ if index.valid?
55
+ element = index.internal_pointer
56
+ case role
57
+ when Qt::DisplayRole
58
+ case index.column
59
+ when 0; Qt::Variant.new(element.displayName)
60
+ when 1; Qt::Variant.new(element.displayType)
61
+ else ; NODATA
62
+ end
63
+ when Qt::DecorationRole
64
+ index.column==0 ? element.icon : NODATA
65
+ else
66
+ NODATA
67
+ end
68
+ else
69
+ NODATA
70
+ end
71
+ end
72
+ end
73
+
74
+ class UIC::GUI::AppElementsModel::El
75
+ @by_el = {}
76
+ class << self
77
+ def [](el,row)
78
+ @by_el[el] ||= self.new(el,row)
79
+ end
80
+ end
81
+
82
+ attr_reader :row
83
+ attr_reader :el
84
+ def initialize(el,row)
85
+ @el = el
86
+ @isapp = el.is_a?( UIC::Application )
87
+ @row = row
88
+ end
89
+ def child_count
90
+ (@isapp ? @el.presentations : @el.children).length
91
+ end
92
+
93
+ def child(offset)
94
+ kids = @isapp ? @el.presentations : @el.children
95
+ self.class[ @isapp ? kids[offset].scene : kids[offset], offset ] if kids[offset]
96
+ end
97
+
98
+ def parent
99
+ unless @el.is_a?( UIC::Application )
100
+ self.class[@el.parent || @el.presentation.app, @row]
101
+ end
102
+ end
103
+
104
+ def icon
105
+ @icon ||= UIC::GUI::IconVariant[@el.type]
106
+ end
107
+
108
+ def displayName
109
+ @el.type=='Scene' ? @el.path : @el.name
110
+ end
111
+ def displayType
112
+ @el.type
113
+ end
114
+ end
115
+
116
+ module UIC::GUI::IconVariant
117
+ @by_path = {}
118
+ def self.[]( alias_or_path )
119
+ @by_path[alias_or_path] ||= begin
120
+ icon = Qt::Pixmap.new(alias_or_path)
121
+ icon = Qt::Pixmap.new(":/#{alias_or_path}") if icon.isNull
122
+ icon = Qt::Pixmap.new(":/Unknown") if icon.isNull
123
+ Qt::Variant.fromValue(icon)
124
+ end
125
+ end
126
+ end