RUIC 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +270 -267
- data/bin/ruic +0 -0
- data/gui/TODO +2 -2
- data/gui/appattributesmodel.rb +51 -51
- data/gui/appelementsmodel.rb +126 -126
- data/gui/launch.rb +19 -19
- data/gui/makefile +14 -14
- data/gui/resources/style/dark.qss +459 -459
- data/gui/window.rb +90 -90
- data/gui/window.ui +753 -753
- data/lib/ruic.rb +0 -0
- data/lib/ruic/application.rb +1 -0
- data/lib/ruic/assets.rb +287 -281
- data/lib/ruic/attributes.rb +165 -165
- data/lib/ruic/behaviors.rb +0 -0
- data/lib/ruic/interfaces.rb +0 -0
- data/lib/ruic/presentation.rb +0 -0
- data/lib/ruic/ripl-after-result.rb +11 -11
- data/lib/ruic/statemachine.rb +0 -0
- data/lib/ruic/version.rb +2 -2
- data/ruic.gemspec +25 -25
- data/test/MetaData-simple.xml +28 -0
- data/test/MetaData.xml +435 -387
- data/test/customclasses.ruic +2 -2
- data/test/filtering.ruic +44 -35
- data/test/futureassets.ruic +9 -0
- data/test/nonmaster.ruic +0 -0
- data/test/paths.ruic +19 -0
- data/test/projects/CustomClasses/CustomClasses.uia +1 -0
- data/test/projects/CustomClasses/FutureAsset.uip +17 -0
- data/test/projects/SimpleScene/SimpleScene.uia +4 -4
- data/test/projects/SimpleScene/SimpleScene.uip +35 -35
- data/test/properties.ruic +1 -0
- data/test/referencematerials.ruic +52 -52
- data/test/usage.ruic +20 -20
- metadata +30 -4
data/lib/ruic/attributes.rb
CHANGED
@@ -1,165 +1,165 @@
|
|
1
|
-
#encoding: utf-8
|
2
|
-
class UIC::Property
|
3
|
-
class << self; attr_accessor :default; end
|
4
|
-
def initialize(el); @el = el; end
|
5
|
-
def name; @name||=@el['name']; end
|
6
|
-
def type; @type||=@el['type']; end
|
7
|
-
def formal; @formal||=@el['formalName'] || @el['name']; end
|
8
|
-
def min; @el['min']; end
|
9
|
-
def max; @el['max']; end
|
10
|
-
def description; @desc||=@el['description']; end
|
11
|
-
def default; @def ||= (@el['default'] || self.class.default); end
|
12
|
-
def get(asset,slide)
|
13
|
-
if asset.slide? || asset.has_slide?(slide)
|
14
|
-
asset.presentation.get_attribute(asset.el,name,slide) || default
|
15
|
-
end
|
16
|
-
end
|
17
|
-
def set(asset,new_value,slide_name_or_index)
|
18
|
-
asset.presentation.set_attribute(asset.el,name,slide_name_or_index,new_value)
|
19
|
-
end
|
20
|
-
def inspect
|
21
|
-
"<#{type} '#{name}'>"
|
22
|
-
end
|
23
|
-
|
24
|
-
class String < self
|
25
|
-
self.default = ''
|
26
|
-
end
|
27
|
-
MultiLineString = String
|
28
|
-
|
29
|
-
class Float < self
|
30
|
-
self.default = 0.0
|
31
|
-
def get(asset,slide); super.to_f; end
|
32
|
-
end
|
33
|
-
class Long < self
|
34
|
-
self.default = 0
|
35
|
-
def get(asset,slide); super.to_i; end
|
36
|
-
end
|
37
|
-
class Boolean < self
|
38
|
-
self.default = false
|
39
|
-
def get(asset,slide); super=='True'; end
|
40
|
-
def set(asset,new_value,slide_name_or_index)
|
41
|
-
super( asset, new_value ? 'True' : 'False', slide_name_or_index )
|
42
|
-
end
|
43
|
-
end
|
44
|
-
class Vector < self
|
45
|
-
self.default = '0 0 0'
|
46
|
-
def get(asset,slide)
|
47
|
-
VectorValue.new(asset,self,slide,super)
|
48
|
-
end
|
49
|
-
def set(asset,new_value,slide_name_or_index)
|
50
|
-
new_value = new_value.join(' ') if new_value.is_a?(Array)
|
51
|
-
super( asset, new_value, slide_name_or_index )
|
52
|
-
end
|
53
|
-
end
|
54
|
-
Rotation = Vector
|
55
|
-
Color = Vector
|
56
|
-
Float2 = Vector
|
57
|
-
class Image < self
|
58
|
-
self.default = nil
|
59
|
-
def get(asset,slide)
|
60
|
-
if idref = super
|
61
|
-
result = asset.presentation.asset_by_id( idref[1..-1] )
|
62
|
-
slide ? result.on_slide( slide ) : result
|
63
|
-
end
|
64
|
-
end
|
65
|
-
def set(asset,new_value,slide)
|
66
|
-
raise "Setting image attributes not yet supported"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
class Texture < String
|
70
|
-
def get(asset,slide)
|
71
|
-
if path=super
|
72
|
-
path.empty? ? nil : path
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
class ObjectRef < self
|
78
|
-
self.default = nil
|
79
|
-
def get(asset,slide)
|
80
|
-
ref = super
|
81
|
-
type = :absolute
|
82
|
-
obj = nil
|
83
|
-
unless ref=='' || ref.nil?
|
84
|
-
type = ref[0]=='#' ? :absolute : :path
|
85
|
-
ref = type==:absolute ? asset.presentation.asset_by_id( ref[1..-1] ) : asset.presentation.at( ref, asset.el )
|
86
|
-
end
|
87
|
-
ObjectReference.new(asset,self,slide,ref,type)
|
88
|
-
end
|
89
|
-
def set(asset,new_object,slide)
|
90
|
-
get(asset,slide).object = new_object
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
class ObjectReference
|
95
|
-
attr_reader :object, :type
|
96
|
-
def initialize(asset,property,slide,object=nil,type=nil)
|
97
|
-
@asset = asset
|
98
|
-
@name = property.name
|
99
|
-
@slide = slide
|
100
|
-
@object = object
|
101
|
-
@type = type
|
102
|
-
end
|
103
|
-
def object=(new_object)
|
104
|
-
raise "ObjectRef must be set to an asset (not a #{new_object.class.name})" unless new_object.is_a?(UIC::Asset::Root)
|
105
|
-
@object = new_object
|
106
|
-
write_value!
|
107
|
-
end
|
108
|
-
def type=(new_type)
|
109
|
-
raise "ObjectRef types must be either :absolute or :path (not #{new_type.inspect})" unless [:absolute,:path].include?(new_type)
|
110
|
-
@type = new_type
|
111
|
-
write_value!
|
112
|
-
end
|
113
|
-
private
|
114
|
-
def write_value!
|
115
|
-
path = case @object
|
116
|
-
when NilClass then ""
|
117
|
-
else case @type
|
118
|
-
when :absolute then "##{@object.el['id']}"
|
119
|
-
when :path then @asset.presentation.path_to( @object.el, @asset.el ).sub(/^[^:.]+:/,'')
|
120
|
-
# when :root then @asset.presentation.path_to( @object.el ).sub(/^[^:.]+:/,'')
|
121
|
-
end
|
122
|
-
end
|
123
|
-
@asset.presentation.set_attribute( @asset.el, @name, @slide, path )
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
Import = String #TODO: a real class
|
128
|
-
Mesh = String #TODO: a real class
|
129
|
-
Renderable = String #TODO: a real class
|
130
|
-
Font = String #TODO: a real class
|
131
|
-
FontSize = Long
|
132
|
-
|
133
|
-
StringListOrInt = String #TODO: a real class
|
134
|
-
|
135
|
-
class VectorValue
|
136
|
-
attr_reader :x, :y, :z
|
137
|
-
def initialize(asset,property,slide,str)
|
138
|
-
@asset = asset
|
139
|
-
@property = property
|
140
|
-
@slide = slide
|
141
|
-
@x, @y, @z = str.split(/\s+/).map(&:to_f)
|
142
|
-
end
|
143
|
-
def setall
|
144
|
-
@property.set( @asset, to_s, @slide )
|
145
|
-
end
|
146
|
-
def x=(n); @x=n; setall end
|
147
|
-
def y=(n); @y=n; setall end
|
148
|
-
def z=(n); @z=n; setall end
|
149
|
-
alias_method :r, :x
|
150
|
-
alias_method :g, :y
|
151
|
-
alias_method :b, :z
|
152
|
-
alias_method :r=, :x=
|
153
|
-
alias_method :g=, :y=
|
154
|
-
alias_method :b=, :z=
|
155
|
-
def inspect
|
156
|
-
"<#{@asset.path}.#{@property.name}: #{self}>"
|
157
|
-
end
|
158
|
-
def to_s
|
159
|
-
to_a.join(' ')
|
160
|
-
end
|
161
|
-
def to_a
|
162
|
-
[x,y,z]
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
1
|
+
#encoding: utf-8
|
2
|
+
class UIC::Property
|
3
|
+
class << self; attr_accessor :default; end
|
4
|
+
def initialize(el); @el = el; end
|
5
|
+
def name; @name||=@el['name']; end
|
6
|
+
def type; @type||=@el['type']; end
|
7
|
+
def formal; @formal||=@el['formalName'] || @el['name']; end
|
8
|
+
def min; @el['min']; end
|
9
|
+
def max; @el['max']; end
|
10
|
+
def description; @desc||=@el['description']; end
|
11
|
+
def default; @def ||= (@el['default'] || self.class.default); end
|
12
|
+
def get(asset,slide)
|
13
|
+
if asset.slide? || asset.has_slide?(slide)
|
14
|
+
asset.presentation.get_attribute(asset.el,name,slide) || default
|
15
|
+
end
|
16
|
+
end
|
17
|
+
def set(asset,new_value,slide_name_or_index)
|
18
|
+
asset.presentation.set_attribute(asset.el,name,slide_name_or_index,new_value)
|
19
|
+
end
|
20
|
+
def inspect
|
21
|
+
"<#{type} '#{name}'>"
|
22
|
+
end
|
23
|
+
|
24
|
+
class String < self
|
25
|
+
self.default = ''
|
26
|
+
end
|
27
|
+
MultiLineString = String
|
28
|
+
|
29
|
+
class Float < self
|
30
|
+
self.default = 0.0
|
31
|
+
def get(asset,slide); super.to_f; end
|
32
|
+
end
|
33
|
+
class Long < self
|
34
|
+
self.default = 0
|
35
|
+
def get(asset,slide); super.to_i; end
|
36
|
+
end
|
37
|
+
class Boolean < self
|
38
|
+
self.default = false
|
39
|
+
def get(asset,slide); super=='True'; end
|
40
|
+
def set(asset,new_value,slide_name_or_index)
|
41
|
+
super( asset, new_value ? 'True' : 'False', slide_name_or_index )
|
42
|
+
end
|
43
|
+
end
|
44
|
+
class Vector < self
|
45
|
+
self.default = '0 0 0'
|
46
|
+
def get(asset,slide)
|
47
|
+
VectorValue.new(asset,self,slide,super)
|
48
|
+
end
|
49
|
+
def set(asset,new_value,slide_name_or_index)
|
50
|
+
new_value = new_value.join(' ') if new_value.is_a?(Array)
|
51
|
+
super( asset, new_value, slide_name_or_index )
|
52
|
+
end
|
53
|
+
end
|
54
|
+
Rotation = Vector
|
55
|
+
Color = Vector
|
56
|
+
Float2 = Vector
|
57
|
+
class Image < self
|
58
|
+
self.default = nil
|
59
|
+
def get(asset,slide)
|
60
|
+
if idref = super
|
61
|
+
result = asset.presentation.asset_by_id( idref[1..-1] )
|
62
|
+
slide ? result.on_slide( slide ) : result
|
63
|
+
end
|
64
|
+
end
|
65
|
+
def set(asset,new_value,slide)
|
66
|
+
raise "Setting image attributes not yet supported"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
class Texture < String
|
70
|
+
def get(asset,slide)
|
71
|
+
if path=super
|
72
|
+
path.empty? ? nil : path.gsub( '\\', '/' ).sub( /^.\// ,'' )
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class ObjectRef < self
|
78
|
+
self.default = nil
|
79
|
+
def get(asset,slide)
|
80
|
+
ref = super
|
81
|
+
type = :absolute
|
82
|
+
obj = nil
|
83
|
+
unless ref=='' || ref.nil?
|
84
|
+
type = ref[0]=='#' ? :absolute : :path
|
85
|
+
ref = type==:absolute ? asset.presentation.asset_by_id( ref[1..-1] ) : asset.presentation.at( ref, asset.el )
|
86
|
+
end
|
87
|
+
ObjectReference.new(asset,self,slide,ref,type)
|
88
|
+
end
|
89
|
+
def set(asset,new_object,slide)
|
90
|
+
get(asset,slide).object = new_object
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
class ObjectReference
|
95
|
+
attr_reader :object, :type
|
96
|
+
def initialize(asset,property,slide,object=nil,type=nil)
|
97
|
+
@asset = asset
|
98
|
+
@name = property.name
|
99
|
+
@slide = slide
|
100
|
+
@object = object
|
101
|
+
@type = type
|
102
|
+
end
|
103
|
+
def object=(new_object)
|
104
|
+
raise "ObjectRef must be set to an asset (not a #{new_object.class.name})" unless new_object.is_a?(UIC::Asset::Root)
|
105
|
+
@object = new_object
|
106
|
+
write_value!
|
107
|
+
end
|
108
|
+
def type=(new_type)
|
109
|
+
raise "ObjectRef types must be either :absolute or :path (not #{new_type.inspect})" unless [:absolute,:path].include?(new_type)
|
110
|
+
@type = new_type
|
111
|
+
write_value!
|
112
|
+
end
|
113
|
+
private
|
114
|
+
def write_value!
|
115
|
+
path = case @object
|
116
|
+
when NilClass then ""
|
117
|
+
else case @type
|
118
|
+
when :absolute then "##{@object.el['id']}"
|
119
|
+
when :path then @asset.presentation.path_to( @object.el, @asset.el ).sub(/^[^:.]+:/,'')
|
120
|
+
# when :root then @asset.presentation.path_to( @object.el ).sub(/^[^:.]+:/,'')
|
121
|
+
end
|
122
|
+
end
|
123
|
+
@asset.presentation.set_attribute( @asset.el, @name, @slide, path )
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
Import = String #TODO: a real class
|
128
|
+
Mesh = String #TODO: a real class
|
129
|
+
Renderable = String #TODO: a real class
|
130
|
+
Font = String #TODO: a real class
|
131
|
+
FontSize = Long
|
132
|
+
|
133
|
+
StringListOrInt = String #TODO: a real class
|
134
|
+
|
135
|
+
class VectorValue
|
136
|
+
attr_reader :x, :y, :z
|
137
|
+
def initialize(asset,property,slide,str)
|
138
|
+
@asset = asset
|
139
|
+
@property = property
|
140
|
+
@slide = slide
|
141
|
+
@x, @y, @z = str.split(/\s+/).map(&:to_f)
|
142
|
+
end
|
143
|
+
def setall
|
144
|
+
@property.set( @asset, to_s, @slide )
|
145
|
+
end
|
146
|
+
def x=(n); @x=n; setall end
|
147
|
+
def y=(n); @y=n; setall end
|
148
|
+
def z=(n); @z=n; setall end
|
149
|
+
alias_method :r, :x
|
150
|
+
alias_method :g, :y
|
151
|
+
alias_method :b, :z
|
152
|
+
alias_method :r=, :x=
|
153
|
+
alias_method :g=, :y=
|
154
|
+
alias_method :b=, :z=
|
155
|
+
def inspect
|
156
|
+
"<#{@asset.path}.#{@property.name}: #{self}>"
|
157
|
+
end
|
158
|
+
def to_s
|
159
|
+
to_a.join(' ')
|
160
|
+
end
|
161
|
+
def to_a
|
162
|
+
[x,y,z]
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
data/lib/ruic/behaviors.rb
CHANGED
File without changes
|
data/lib/ruic/interfaces.rb
CHANGED
File without changes
|
data/lib/ruic/presentation.rb
CHANGED
File without changes
|
@@ -1,12 +1,12 @@
|
|
1
|
-
module Ripl::AfterResult
|
2
|
-
def print_result(result)
|
3
|
-
super
|
4
|
-
if after=config[:after_result]
|
5
|
-
if after.respond_to?(:call)
|
6
|
-
after.call(result)
|
7
|
-
else
|
8
|
-
puts after
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
1
|
+
module Ripl::AfterResult
|
2
|
+
def print_result(result)
|
3
|
+
super
|
4
|
+
if after=config[:after_result]
|
5
|
+
if after.respond_to?(:call)
|
6
|
+
after.call(result)
|
7
|
+
else
|
8
|
+
puts after
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
12
|
end
|
data/lib/ruic/statemachine.rb
CHANGED
File without changes
|
data/lib/ruic/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
class RUIC
|
2
|
-
VERSION = '0.4.
|
1
|
+
class RUIC
|
2
|
+
VERSION = '0.4.1'
|
3
3
|
end
|
data/ruic.gemspec
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
$: << File.expand_path("../lib", __FILE__)
|
3
|
-
require "ruic/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = "RUIC"
|
7
|
-
s.version = RUIC::VERSION
|
8
|
-
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ["Gavin Kistner"]
|
10
|
-
s.email = ["gavin@phrogz.net"]
|
11
|
-
s.license = "MIT License"
|
12
|
-
s.summary = %q{Library and DSL analyzing and manipulating UI Composer applications and presentations.}
|
13
|
-
s.description = %q{RUIC is a library that understands the XML formats used by NVIDIA's "UI Composer" tool suite. In addition to APIs for analyzing and manipulating these files—the UIC portion of the library—it also includes a mini DSL for writing scripts that can be run by the `ruic` interpreter.}
|
14
|
-
s.homepage = "https://github.com/Phrogz/RUIC"
|
15
|
-
|
16
|
-
s.add_runtime_dependency "nokogiri", '~> 1'
|
17
|
-
s.add_runtime_dependency "ripl", '~> 0'
|
18
|
-
s.add_runtime_dependency "ripl-multi_line", '~> 0'
|
19
|
-
s.add_runtime_dependency "ripl-irb", '~> 0'
|
20
|
-
|
21
|
-
s.files = `git ls-files`.split("\n")
|
22
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
23
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
24
|
-
s.require_paths = ["lib"]
|
25
|
-
s.bindir = 'bin'
|
1
|
+
# encoding: UTF-8
|
2
|
+
$: << File.expand_path("../lib", __FILE__)
|
3
|
+
require "ruic/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "RUIC"
|
7
|
+
s.version = RUIC::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Gavin Kistner"]
|
10
|
+
s.email = ["gavin@phrogz.net"]
|
11
|
+
s.license = "MIT License"
|
12
|
+
s.summary = %q{Library and DSL analyzing and manipulating UI Composer applications and presentations.}
|
13
|
+
s.description = %q{RUIC is a library that understands the XML formats used by NVIDIA's "UI Composer" tool suite. In addition to APIs for analyzing and manipulating these files—the UIC portion of the library—it also includes a mini DSL for writing scripts that can be run by the `ruic` interpreter.}
|
14
|
+
s.homepage = "https://github.com/Phrogz/RUIC"
|
15
|
+
|
16
|
+
s.add_runtime_dependency "nokogiri", '~> 1'
|
17
|
+
s.add_runtime_dependency "ripl", '~> 0'
|
18
|
+
s.add_runtime_dependency "ripl-multi_line", '~> 0'
|
19
|
+
s.add_runtime_dependency "ripl-irb", '~> 0'
|
20
|
+
|
21
|
+
s.files = `git ls-files`.split("\n")
|
22
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
23
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
24
|
+
s.require_paths = ["lib"]
|
25
|
+
s.bindir = 'bin'
|
26
26
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<MetaData>
|
3
|
+
<Alias/>
|
4
|
+
<Asset>
|
5
|
+
<Property name="eyeball" formalName="Visible" type="Boolean" default="True" hidden="True" />
|
6
|
+
</Asset>
|
7
|
+
<Behavior/>
|
8
|
+
<Camera/>
|
9
|
+
<Component/>
|
10
|
+
<Effect/>
|
11
|
+
<Group/>
|
12
|
+
<Image/>
|
13
|
+
<Layer/>
|
14
|
+
<Light/>
|
15
|
+
<MaterialBase/>
|
16
|
+
<Material/>
|
17
|
+
<ReferencedMaterial/>
|
18
|
+
<Model/>
|
19
|
+
<Node/>
|
20
|
+
<Path/>
|
21
|
+
<PathAnchorPoint/>
|
22
|
+
<RenderPlugin/>
|
23
|
+
<Scene/>
|
24
|
+
<Slide/>
|
25
|
+
<SlideOwner/>
|
26
|
+
<Text/>
|
27
|
+
<XYZZY/>
|
28
|
+
</MetaData>
|