flak 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/bin/flak +5 -0
- data/flak.gemspec +31 -0
- data/lib/core_ext/string.rb +5 -0
- data/lib/flak/cpp.rb +137 -0
- data/lib/flak/delight.rb +121 -0
- data/lib/flak/doc.rb +259 -0
- data/lib/flak/gl.rb +10 -0
- data/lib/flak/mac.rb +23 -0
- data/lib/flak/max.rb +29 -0
- data/lib/flak/maya.rb +142 -0
- data/lib/flak/maya_app.rb +45 -0
- data/lib/flak/maya_plugin.rb +47 -0
- data/lib/flak/nuke.rb +29 -0
- data/lib/flak/target.rb +120 -0
- data/lib/flak/thor/cli.rb +7 -0
- data/lib/flak/thor/generate.rb +295 -0
- data/lib/flak/thor/junk/junk.rb +65 -0
- data/lib/flak/thor/templates/INSTALL.tt +115 -0
- data/lib/flak/thor/templates/Rakefile.tt +10 -0
- data/lib/flak/thor/templates/cpp.tt +153 -0
- data/lib/flak/thor/templates/delight.tt +14 -0
- data/lib/flak/thor/templates/env.tt +26 -0
- data/lib/flak/thor/templates/gl.tt +27 -0
- data/lib/flak/thor/templates/mac.tt +0 -0
- data/lib/flak/thor/templates/max.tt +1 -0
- data/lib/flak/thor/templates/maya.tt +16 -0
- data/lib/flak/thor/templates/maya_app.tt +80 -0
- data/lib/flak/thor/templates/maya_plugin.tt +59 -0
- data/lib/flak/thor/templates/nuke.tt +2 -0
- data/lib/flak/thor/templates/product.mel.tt +34 -0
- data/lib/flak/thor/templates/product.sh.tt +35 -0
- data/lib/flak/version.rb +3 -0
- data/lib/flak.rb +357 -0
- metadata +122 -0
data/lib/flak/maya.rb
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
4
|
+
module Flak
|
5
|
+
|
6
|
+
module Maya
|
7
|
+
|
8
|
+
|
9
|
+
def self.resolve_settings( existing_settings )
|
10
|
+
|
11
|
+
f = existing_settings[:root] + '/config/maya.yml'
|
12
|
+
h =Flak.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
|
13
|
+
|
14
|
+
maya_string =''
|
15
|
+
case existing_settings[:os]
|
16
|
+
when /linux_64/
|
17
|
+
maya_string = "maya#{h[:maya_version]}-x64"
|
18
|
+
when /darwin/
|
19
|
+
maya_string = "maya#{h[:maya_version]}"
|
20
|
+
when /win_64/
|
21
|
+
maya_string = "Maya#{h[:maya_version]}"
|
22
|
+
end
|
23
|
+
|
24
|
+
h[:maya_location] = File.join(h[:autodesk_location],maya_string)
|
25
|
+
h[:maya_release_path] = File.join(existing_settings[:versioned_os_release_path],'maya' )
|
26
|
+
h
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
def maya_script_release_path(file)
|
31
|
+
File.join(@settings[:maya_release_path] , 'scripts', file.pathmap('%f'))
|
32
|
+
end
|
33
|
+
|
34
|
+
def maya_icon_release_path(file)
|
35
|
+
File.join(@settings[:maya_release_path] ,'icons', file.pathmap('%f'))
|
36
|
+
end
|
37
|
+
|
38
|
+
def maya_scripted_plugin_release_path(file)
|
39
|
+
File.join(@settings[:maya_release_path] , 'plug-ins' , file.pathmap('%f'))
|
40
|
+
end
|
41
|
+
|
42
|
+
def maya_precompiled_plugin_release_path(file)
|
43
|
+
File.join(@settings[:maya_release_path] , 'plug-ins' , file.pathmap('%f'))
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
# if a command exists to do the conversion - make a file task for each of icon and out_icon
|
49
|
+
# that is - one for the hypershade and one for the outliner
|
50
|
+
def maya_instance_tasks
|
51
|
+
namespace @settings[:name].to_sym do
|
52
|
+
|
53
|
+
|
54
|
+
if ( @settings.has_key?(:dg_convert_cmd ) && @settings.has_key?(:outliner_convert_cmd ) )
|
55
|
+
files = @settings[:maya_node_icon_files]
|
56
|
+
unless files.nil?
|
57
|
+
|
58
|
+
# file tasks to convert icons for outliner and hypershade
|
59
|
+
######################################################
|
60
|
+
files.each do |f|
|
61
|
+
|
62
|
+
icon_release = File.join(@settings[:maya_release_path] , 'icons', f.pathmap('%f').ext('xpm'))
|
63
|
+
out_icon_release = File.join(@settings[:maya_release_path] , 'icons', "out_#{f.pathmap('%f').ext('xpm')}" )
|
64
|
+
|
65
|
+
icon = File.join("build", @settings[:product_revision] , 'icons', f.pathmap('%f').ext('xpm'))
|
66
|
+
out_icon = File.join("build", @settings[:product_revision], 'icons', "out_#{f.pathmap('%f').ext('xpm')}" )
|
67
|
+
|
68
|
+
|
69
|
+
file icon => f do |t|
|
70
|
+
Flak.make_dir_for(icon)
|
71
|
+
cmd = "#{@settings[:dg_convert_cmd]} #{f} #{icon}"
|
72
|
+
sh cmd
|
73
|
+
end
|
74
|
+
|
75
|
+
# dry this up
|
76
|
+
file out_icon => f do |t|
|
77
|
+
Flak.make_dir_for(out_icon)
|
78
|
+
cmd = "#{@settings[:outliner_convert_cmd]} #{f} #{out_icon}"
|
79
|
+
sh cmd
|
80
|
+
end
|
81
|
+
|
82
|
+
file icon_release => icon do |t|
|
83
|
+
Flak.make_dir_for(icon_release)
|
84
|
+
cp icon, icon_release
|
85
|
+
end
|
86
|
+
|
87
|
+
file out_icon_release => out_icon do |t|
|
88
|
+
Flak.make_dir_for(out_icon_release)
|
89
|
+
cp out_icon, out_icon_release
|
90
|
+
end
|
91
|
+
|
92
|
+
task :release =>[ icon_release , out_icon_release]
|
93
|
+
end
|
94
|
+
######################################################
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
if ( @settings.has_key?(:maya_convert_cmd ) )
|
101
|
+
files = @settings[:maya_icon_files]
|
102
|
+
unless files.nil?
|
103
|
+
|
104
|
+
# file tasks to convert icons for outliner and hypershade
|
105
|
+
######################################################
|
106
|
+
files.each do |f|
|
107
|
+
|
108
|
+
icon_release = File.join(@settings[:maya_release_path] , 'icons', f.pathmap('%f').ext('xpm'))
|
109
|
+
|
110
|
+
icon = File.join("build", @settings[:product_revision] , 'icons', f.pathmap('%f').ext('xpm'))
|
111
|
+
|
112
|
+
|
113
|
+
file icon => f do |t|
|
114
|
+
Flak.make_dir_for(icon)
|
115
|
+
cmd = "#{@settings[:maya_convert_cmd]} #{f} #{icon}"
|
116
|
+
sh cmd
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
file icon_release => icon do |t|
|
121
|
+
Flak.make_dir_for(icon_release)
|
122
|
+
cp icon, icon_release
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
task :release =>[ icon_release ]
|
127
|
+
end
|
128
|
+
######################################################
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
|
133
|
+
end
|
134
|
+
end
|
135
|
+
################################################################################
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Flak
|
4
|
+
|
5
|
+
module MayaApp
|
6
|
+
|
7
|
+
def self.resolve_settings( existing_settings )
|
8
|
+
|
9
|
+
f = existing_settings[:root] + '/config/maya_app.yml'
|
10
|
+
h =Flak.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
|
11
|
+
|
12
|
+
lib_path = File.join(existing_settings[:maya_location], h[:maya_relative_lib_path])
|
13
|
+
|
14
|
+
h[:lib_paths] = [ lib_path ]
|
15
|
+
|
16
|
+
|
17
|
+
more_linker_opts = []
|
18
|
+
case existing_settings[:os]
|
19
|
+
when /linux_64/
|
20
|
+
h[:include_paths] = [ File.join(existing_settings[:maya_location], "include" ) ]
|
21
|
+
more_linker_opts = ["-Wl,-rpath,#{lib_path}"]
|
22
|
+
when /darwin/
|
23
|
+
more_linker_opts = ["-Wl,-executable_path,#{lib_path}"]
|
24
|
+
h[:include_paths] = [ File.join(existing_settings[:maya_location],"devkit", "include" ) ]
|
25
|
+
when /win_64/
|
26
|
+
h[:include_paths] = [ File.join(existing_settings[:maya_location], "include" ) ]
|
27
|
+
end
|
28
|
+
|
29
|
+
h[:linker_options] ||= []
|
30
|
+
h[:linker_options] |= more_linker_opts
|
31
|
+
|
32
|
+
|
33
|
+
h[:compiler_options] |= [
|
34
|
+
"-D\"PLUGIN_VERSION=\\\"#{existing_settings[:product_revision]}\\\"\"",
|
35
|
+
"-D\"PLUGIN_VENDOR=\\\"#{existing_settings[:author_name].gsub(' ','')}\\\"\"",
|
36
|
+
"-D\"MAYA_VERSION=\\\"#{existing_settings[:maya_version]}\\\"\""
|
37
|
+
]
|
38
|
+
|
39
|
+
h
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Flak
|
4
|
+
|
5
|
+
|
6
|
+
module MayaPlugin
|
7
|
+
|
8
|
+
|
9
|
+
def self.resolve_settings( existing_settings )
|
10
|
+
|
11
|
+
|
12
|
+
f = existing_settings[:root] + '/config/maya_plugin.yml'
|
13
|
+
h =Flak.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
|
14
|
+
|
15
|
+
|
16
|
+
lib_path = File.join(existing_settings[:maya_location], h[:maya_relative_lib_path])
|
17
|
+
|
18
|
+
h[:lib_paths] = [ lib_path ]
|
19
|
+
|
20
|
+
more_linker_opts = []
|
21
|
+
case existing_settings[:os]
|
22
|
+
when /linux_64/
|
23
|
+
h[:include_paths] = [ File.join(existing_settings[:maya_location], "include" ) ]
|
24
|
+
more_linker_opts = ["-Wl,-rpath,#{lib_path}"]
|
25
|
+
when /darwin/
|
26
|
+
more_linker_opts = ["-Wl,-executable_path,#{lib_path}"]
|
27
|
+
h[:include_paths] = [ File.join(existing_settings[:maya_location],"devkit", "include" ) ]
|
28
|
+
when /win_64/
|
29
|
+
h[:include_paths] = [ File.join(existing_settings[:maya_location], "include" ) ]
|
30
|
+
end
|
31
|
+
|
32
|
+
h[:linker_options] ||= []
|
33
|
+
h[:linker_options] |= more_linker_opts
|
34
|
+
|
35
|
+
|
36
|
+
h[:compiler_options] |= [
|
37
|
+
"-D\"PLUGIN_VERSION=\\\"#{existing_settings[:product_revision]}\\\"\"",
|
38
|
+
"-D\"PLUGIN_VENDOR=\\\"#{existing_settings[:author_name].gsub(' ','')}\\\"\"",
|
39
|
+
"-D\"MAYA_VERSION=\\\"#{existing_settings[:maya_version]}\\\"\""
|
40
|
+
]
|
41
|
+
|
42
|
+
h
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
|
data/lib/flak/nuke.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
4
|
+
module Flak
|
5
|
+
|
6
|
+
module Nuke
|
7
|
+
|
8
|
+
def self.resolve_settings( existing_settings )
|
9
|
+
|
10
|
+
f = existing_settings[:root] + '/config/nuke.yml'
|
11
|
+
h =Flak.flatten_settings(f,existing_settings[:configuration], existing_settings[:os] )
|
12
|
+
|
13
|
+
case existing_settings[:os]
|
14
|
+
when /linux_64/
|
15
|
+
h[:nuke_location] = ""
|
16
|
+
when /darwin/
|
17
|
+
h[:nuke_location] = "/Applications/Nuke#{h[:nuke_version]}-32/Nuke#{h[:nuke_version]}.app/Contents"
|
18
|
+
when /win_64/
|
19
|
+
h[:nuke_location] = ""
|
20
|
+
end
|
21
|
+
h
|
22
|
+
end
|
23
|
+
|
24
|
+
def nuke_script_release_path(file)
|
25
|
+
File.join(@settings[:versioned_os_release_path], 'nuke', 'scripts', file.pathmap('%f'))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
data/lib/flak/target.rb
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
# This is where we prepare a target.
|
6
|
+
# The target will "inherit" settings and instance methods from modules specified in the target.yml file
|
7
|
+
module Flak
|
8
|
+
|
9
|
+
class Target
|
10
|
+
|
11
|
+
attr_accessor :settings
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
def initialize(root, target_file=nil)
|
17
|
+
|
18
|
+
@settings = Hash.new
|
19
|
+
# start building the settings hash
|
20
|
+
# need the config settings to bootstrap the process
|
21
|
+
self.extend( Flak )
|
22
|
+
@settings[:root] = root
|
23
|
+
#puts "TTTTTTTTTTTTT #{@settings[:root]}"
|
24
|
+
tmp = YAML::load_file( @settings[:root] + '/config/env.yml' )
|
25
|
+
@settings[:configuration] = tmp['configuration']
|
26
|
+
@settings[:os] = Flak.os
|
27
|
+
|
28
|
+
# settings goes in as config and os, and comes back fully resolved
|
29
|
+
|
30
|
+
h = Hash.new
|
31
|
+
|
32
|
+
# puts "RRRRRRRRRRRRR #{@settings[:root]}"
|
33
|
+
@settings = Flak.resolve_settings(@settings)
|
34
|
+
|
35
|
+
|
36
|
+
if File.exists?(target_file)
|
37
|
+
@settings[:target_file] = target_file
|
38
|
+
@settings[:target_dir] = File.dirname(target_file)
|
39
|
+
|
40
|
+
# puts "TTTTTTTTTTTTT #{@settings[:target_dir]}"
|
41
|
+
# puts "RRRRRRRRRRRRR #{@settings[:root]}"
|
42
|
+
@settings[:target_root] = File.join(@settings[:root], @settings[:target_dir] )
|
43
|
+
|
44
|
+
# to find out what templates to use, we need to look in the target.yml
|
45
|
+
h = YAML::load_file( target_file )
|
46
|
+
template_array = h['templates'] || []
|
47
|
+
|
48
|
+
# after integrate templates is done, all the settings in those
|
49
|
+
# templates will be flattened and merged into the settings hash
|
50
|
+
integrate_templates template_array
|
51
|
+
end
|
52
|
+
|
53
|
+
# now merge the settings from this target
|
54
|
+
@settings = Flak.merge_settings(@settings, Target.resolve_settings(@settings))
|
55
|
+
|
56
|
+
expand_filelists
|
57
|
+
instance_tasks
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
def self.resolve_settings(existing_settings)
|
62
|
+
Flak.flatten_settings(existing_settings[:target_file], existing_settings[:configuration],existing_settings[:os] )
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
# Integrate the templates into the target,
|
68
|
+
# The templates are modules and by "integrating templates", we are:
|
69
|
+
# 1. extending (picking up the module's instance methods)
|
70
|
+
# 2. then we build our own @settings instance data by merging in the settings from the modules
|
71
|
+
# See the merge settings method below for details of the merging strategy
|
72
|
+
def integrate_templates(template_array)
|
73
|
+
template_array.each do |template_name|
|
74
|
+
mod = Flak.const_get(template_name.split('_').collect {|w| w.capitalize}.join())
|
75
|
+
unless mod.kind_of? Module
|
76
|
+
raise TypeError, "#{mod.inspect} must be a Module"
|
77
|
+
end
|
78
|
+
self.extend( mod )
|
79
|
+
@settings = Flak.merge_settings(@settings, mod.resolve_settings(@settings))
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
# run all task synthesis methods that have been mixed in to this instance
|
86
|
+
# the convention is to name these tasks <filename>_instance_tasks in the module files
|
87
|
+
# in which they are defined.
|
88
|
+
# only make tasks if the target has a name - a target with no has probably been limited
|
89
|
+
# to only generate tasks for a specific OS (or configuration)
|
90
|
+
def instance_tasks
|
91
|
+
unless (@settings[:name].nil?)
|
92
|
+
self.public_methods.grep(/_instance_tasks/).each do |t|
|
93
|
+
self.send t
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
private
|
101
|
+
|
102
|
+
# resolve filename globs and prepend target_dir to file globs
|
103
|
+
# and path arrays. Its important that when specifying files in
|
104
|
+
#the yaml, the user sets the key names to be "<something>_files"
|
105
|
+
# or "<something>_paths".
|
106
|
+
# If the path given is relative, we prepend the path to
|
107
|
+
# the target file (target_dir) so that Rake has somewhere to work from
|
108
|
+
def expand_filelists
|
109
|
+
@settings.each do |k,v|
|
110
|
+
if k.to_s =~ /_files$|_paths$/
|
111
|
+
unless v.nil?
|
112
|
+
v = v.collect { |el| (el[0] == '/') || (el[1] ==":") ? el : File.join(@settings[:target_dir],el) }
|
113
|
+
@settings[(k.to_sym)] = k.to_s =~ /_files$/ ? FileList[v] : v
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,295 @@
|
|
1
|
+
module Flak
|
2
|
+
|
3
|
+
class Generate < Thor
|
4
|
+
|
5
|
+
TEMPLATES = ["env", "cpp", "delight","gl","mac","maya","maya_app","maya_plugin", "nuke"]
|
6
|
+
|
7
|
+
MAYA_PLUGIN_TEMPLATES = ["cpp", "gl","maya","maya_plugin"]
|
8
|
+
|
9
|
+
MAYA_APP_TEMPLATES = ["cpp", "gl","maya","maya_app"]
|
10
|
+
|
11
|
+
include Thor::Actions
|
12
|
+
|
13
|
+
attr_accessor :name, :tool_options, :project_options
|
14
|
+
|
15
|
+
def self.source_root
|
16
|
+
File.join(File.dirname(__FILE__), "templates")
|
17
|
+
end
|
18
|
+
|
19
|
+
no_tasks do
|
20
|
+
|
21
|
+
def project_wizard
|
22
|
+
opts = Hash.new
|
23
|
+
say("In order to set up paths, I need to know what will be included in this project")
|
24
|
+
opts[:maya_module] = yes?("Will this project contain a Maya module? (y/n)")
|
25
|
+
opts[:delight] = yes?("Will this project contain 3delight tools? (y/n)")
|
26
|
+
opts[:nuke] = yes?("Will this project contain nuke tools? (y/n)")
|
27
|
+
opts
|
28
|
+
end
|
29
|
+
|
30
|
+
def project_options
|
31
|
+
@project_options ||= project_wizard
|
32
|
+
end
|
33
|
+
|
34
|
+
def project_target_file_hash
|
35
|
+
h = Hash.new
|
36
|
+
|
37
|
+
h['name'] = "FlakProject#{name.camelize}"
|
38
|
+
|
39
|
+
if project_options[:maya_module]
|
40
|
+
# To copy the module mel file that will kick off the whole shebang
|
41
|
+
h['maya_script_copy_files'] = ["config/script/maya/*.mel","config/script/maya/*.py","config/script/maya/*.pyc"]
|
42
|
+
h['maya_script_erb_files'] = ["config/script/maya/erb/*.mel.erb","config/script/maya/erb/*.py.erb"]
|
43
|
+
h['templates'] = ["maya"]
|
44
|
+
end
|
45
|
+
|
46
|
+
h['shell_script_copy_files'] = ["config/script/shell/*.sh"]
|
47
|
+
h['shell_script_erb_files'] = ["config/script/shell/erb/*.erb"]
|
48
|
+
h
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
desc "project [name]", "Create a project"
|
55
|
+
map "p" => :project
|
56
|
+
def project(name)
|
57
|
+
empty_directory(name)
|
58
|
+
inside name do
|
59
|
+
invoke :config
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
desc "config [name]", "Makes all config and project based files"
|
65
|
+
def config(name)
|
66
|
+
opts = self.project_options
|
67
|
+
self.name= name
|
68
|
+
empty_directory("build")
|
69
|
+
|
70
|
+
copy_file("product.mel.tt", "config/script/maya/erb/#{name}.mel.erb")
|
71
|
+
copy_file("INSTALL.tt", "config/script/shell/erb/INSTALL.erb")
|
72
|
+
template("product.sh.tt", "config/script/shell/#{name}.sh")
|
73
|
+
|
74
|
+
create_file "target.yml" do
|
75
|
+
YAML::dump( project_target_file_hash )
|
76
|
+
end
|
77
|
+
|
78
|
+
# templates
|
79
|
+
TEMPLATES.each do |t|
|
80
|
+
template("#{t}.tt", "config/#{t}.yml")
|
81
|
+
end
|
82
|
+
|
83
|
+
# rakefile
|
84
|
+
template "Rakefile.tt", "Rakefile.rb"
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
no_tasks do
|
89
|
+
|
90
|
+
|
91
|
+
def tool_target_file_hash
|
92
|
+
h = Hash.new
|
93
|
+
maya_c_compile = true if tool_options[:maya_plugin] || tool_options[:maya_app]
|
94
|
+
c_compile = true if (maya_c_compile || tool_options[:bin] )
|
95
|
+
|
96
|
+
h['name'] = name.camelize
|
97
|
+
|
98
|
+
if tool_options[:maya]
|
99
|
+
h['maya_script_copy_files'] = ["maya/script/**/*.mel","maya/script/**/*.py","maya/script/**/*.pyc"]
|
100
|
+
h['maya_scripted_plugin_copy_files'] = ["maya/script/plugin/**/*.py","maya/script/plugin/**/*.pyc"]
|
101
|
+
|
102
|
+
h['maya_node_icon_files'] = ["maya/icons/node/*"]
|
103
|
+
h['maya_icon_files'] = ["maya/icons/*.jpg"]
|
104
|
+
h['maya_icon_copy_files'] = ["maya/icons/*.png","maya/icons/*.xbm","maya/icons/*.xpm"]
|
105
|
+
end
|
106
|
+
|
107
|
+
h['nuke_script_copy_files'] = ["nuke/python/*.py", "nuke/gizmo/*.gizmo", "nuke/scenes/*.nk"] if tool_options[:nuke]
|
108
|
+
|
109
|
+
h['include_paths'] = ["../../shared/src"] if c_compile
|
110
|
+
h['include_paths'] << "../../shared/src/maya" if maya_c_compile
|
111
|
+
h['libs'] = ["OpenMayaAnim","OpenMayaUI","OpenMayaRender","OpenMayaFX"] if maya_c_compile
|
112
|
+
|
113
|
+
h['templates'] = []
|
114
|
+
h['templates'] << "cpp" if c_compile
|
115
|
+
h['templates'] << "maya" if tool_options[:maya]
|
116
|
+
h['templates'] << "maya_plugin" if tool_options[:maya_plugin]
|
117
|
+
h['templates'] << "maya_app" if tool_options[:maya_app]
|
118
|
+
h['templates'] << "gl" if maya_c_compile
|
119
|
+
h['templates'] << "delight" if tool_options[:delight]
|
120
|
+
|
121
|
+
h['source_files'] = []
|
122
|
+
h['source_files'] << "maya/src/*.cpp" if maya_c_compile
|
123
|
+
h['source_files'] << "shell/src/*.cpp" if tool_options[:bin]
|
124
|
+
|
125
|
+
h['shell_script_copy_files'] = ["shell/script/*"] if tool_options[:shell]
|
126
|
+
h
|
127
|
+
end
|
128
|
+
|
129
|
+
def tool_wizard
|
130
|
+
opts = Hash.new
|
131
|
+
opts[:all] = yes?("Would you like to create a full project and pare it down later?: ")
|
132
|
+
|
133
|
+
if opts[:all]
|
134
|
+
opts[:maya] = true
|
135
|
+
opts[:maya_plugin] = true
|
136
|
+
opts[:maya_app] = false
|
137
|
+
opts[:delight] = true
|
138
|
+
opts[:shell] = true
|
139
|
+
opts[:bin] = false
|
140
|
+
opts[:applescript] = true
|
141
|
+
else
|
142
|
+
|
143
|
+
opts[:maya] = yes?("Will this tool contain files for Autodesk's Maya? (y/n)")
|
144
|
+
if opts[:maya] # always make scripts for maya projects
|
145
|
+
opts[:maya_plugin] = yes?("Is this tool a Maya plugin? (y/n)")
|
146
|
+
if (! opts[:maya_plugin] )
|
147
|
+
opts[:maya_app] = yes?("Is this tool a Maya standalone application? (y/n)")
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
opts[:delight] = yes?("Will this tool contain 3delight shaders filters or DSOs? (y/n)")
|
152
|
+
|
153
|
+
opts[:nuke] = yes?("Will this tool contain Nuke scripts or plugins? (y/n)")
|
154
|
+
|
155
|
+
opts[:shell] = yes?("Will this tool contain shell scripts? (y/n)")
|
156
|
+
|
157
|
+
#can only have one target
|
158
|
+
if (! (opts[:maya_plugin] || opts[:maya_app] ))
|
159
|
+
opts[:bin] = yes?("Will this tool contain a standalone compiled shell command? (y/n)")
|
160
|
+
end
|
161
|
+
|
162
|
+
opts[:applescript] = yes?("Will this tool contain Applescript files? (y/n)")
|
163
|
+
end
|
164
|
+
opts
|
165
|
+
end
|
166
|
+
|
167
|
+
def tool_options
|
168
|
+
@tool_options ||= tool_wizard
|
169
|
+
end
|
170
|
+
|
171
|
+
|
172
|
+
end
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
desc "tool [name]", "Make a tool"
|
177
|
+
#method_options %w( maya_script -s) => :boolean, %w( maya_app -a) => :boolean, %w( maya_plugin -p) => :boolean
|
178
|
+
map "t" => :tool
|
179
|
+
def tool(name)
|
180
|
+
# puts "DDD RRR #{destination_root}"
|
181
|
+
|
182
|
+
opts = self.tool_options
|
183
|
+
self.name= name
|
184
|
+
|
185
|
+
create_file "#{name}/target.yml" do
|
186
|
+
YAML::dump( tool_target_file_hash )
|
187
|
+
end
|
188
|
+
|
189
|
+
inside name, :verbose => true do
|
190
|
+
|
191
|
+
invoke :create_common_files
|
192
|
+
invoke :create_maya_tree if opts[:maya]
|
193
|
+
invoke :create_maya_plugin_tree if opts[:maya_plugin]
|
194
|
+
invoke :create_maya_app_tree if opts[:maya_app]
|
195
|
+
invoke :create_nuke_tree if opts[:nuke]
|
196
|
+
invoke :create_applescript_tree if opts[:applescript]
|
197
|
+
invoke :create_delight_tree if opts[:delight]
|
198
|
+
invoke :create_shell_tree if opts[:shell]
|
199
|
+
invoke :create_shell_cmd_tree if opts[:bin]
|
200
|
+
end
|
201
|
+
#end
|
202
|
+
end
|
203
|
+
|
204
|
+
|
205
|
+
#####################################
|
206
|
+
desc "create_common_files [name]", "Makes files that will be in every tool"
|
207
|
+
def create_common_files(name)
|
208
|
+
empty_directory('examples')
|
209
|
+
empty_directory('doc')
|
210
|
+
create_file "README.md"
|
211
|
+
create_file "LICENSE.md"
|
212
|
+
create_file "INSTALL.md"
|
213
|
+
end
|
214
|
+
#####################################
|
215
|
+
|
216
|
+
|
217
|
+
#####################################
|
218
|
+
desc "maya_script_tool [name]", "Makes tool files needed for Maya script development"
|
219
|
+
def create_maya_tree(name)
|
220
|
+
self.name= name
|
221
|
+
# create_file "maya/script/#{name}.py"
|
222
|
+
empty_directory("maya/script")
|
223
|
+
empty_directory("maya/icons/node")
|
224
|
+
end
|
225
|
+
|
226
|
+
desc "maya_plugin_tool [name]", "Makes tool files needed for Maya plugin development"
|
227
|
+
def create_maya_plugin_tree(name)
|
228
|
+
invoke :create_maya_app_tree
|
229
|
+
create_file "maya/src/plugin.cpp"
|
230
|
+
empty_directory("maya/script/plugin")
|
231
|
+
end
|
232
|
+
|
233
|
+
desc "maya_app_tool [name]", "Makes tool files needed for Maya app development"
|
234
|
+
def create_maya_app_tree(name)
|
235
|
+
invoke :create_maya_tree
|
236
|
+
create_file "maya/src/#{name}.cpp"
|
237
|
+
create_file "maya/src/#{name}.h"
|
238
|
+
end
|
239
|
+
#####################################
|
240
|
+
|
241
|
+
#####################################
|
242
|
+
desc "create_nuke_tree [name]", "Makes tool files needed for Maya script development"
|
243
|
+
def create_nuke_tree(name)
|
244
|
+
empty_directory('nuke/gizmo')
|
245
|
+
empty_directory('nuke/python')
|
246
|
+
empty_directory('nuke/scenes')
|
247
|
+
end
|
248
|
+
#####################################
|
249
|
+
|
250
|
+
#####################################
|
251
|
+
desc "create_delight_tree [name]", "Makes tool files needed for Maya script development"
|
252
|
+
def create_delight_tree(name)
|
253
|
+
empty_directory('delight/shader/include')
|
254
|
+
empty_directory('delight/shader/light')
|
255
|
+
empty_directory('delight/shader/surface')
|
256
|
+
empty_directory('delight/dso')
|
257
|
+
empty_directory('delight/filter')
|
258
|
+
end
|
259
|
+
#####################################
|
260
|
+
|
261
|
+
#####################################
|
262
|
+
desc "create_applescript_tree [name]", "Makes tool files needed for Maya script development"
|
263
|
+
def create_applescript_tree(name)
|
264
|
+
empty_directory('applescript')
|
265
|
+
end
|
266
|
+
#####################################
|
267
|
+
|
268
|
+
#####################################
|
269
|
+
desc "create_shell_tree [name]", "Makes tool files needed for Maya script development"
|
270
|
+
def create_shell_tree(name)
|
271
|
+
empty_directory('shell/script')
|
272
|
+
end
|
273
|
+
#####################################
|
274
|
+
|
275
|
+
#####################################
|
276
|
+
desc "create_shell_cmd_tree [name]", "Makes tool files needed for Maya script development"
|
277
|
+
def create_shell_cmd_tree(name)
|
278
|
+
invoke :create_shell_tree
|
279
|
+
empty_directory('shell/src')
|
280
|
+
end
|
281
|
+
#####################################
|
282
|
+
|
283
|
+
def self.banner(task, namespace = false, subcommand = true)
|
284
|
+
task.formatted_usage(self, true, subcommand).split(':').join(' ')
|
285
|
+
end
|
286
|
+
|
287
|
+
end
|
288
|
+
|
289
|
+
end
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|