Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: samples/samples_gen.py

Issue 1723019: Fixed bug in samples conversion introduced by WebGL-related changes and... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/o3d/
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import posixpath 6 import posixpath
7 import sys 7 import sys
8 import os.path 8 import os.path
9 9
10 output_filename = 'samples_gen.gyp' 10 output_filename = 'samples_gen.gyp'
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 def write_action(asset, webgl_mode): 91 def write_action(asset, webgl_mode):
92 filename = posixpath.splitext(posixpath.basename(asset['path']))[0] 92 filename = posixpath.splitext(posixpath.basename(asset['path']))[0]
93 filename = filename.replace('.','_') 93 filename = filename.replace('.','_')
94 filename = filename.replace('-','_') 94 filename = filename.replace('-','_')
95 filename = filename.lower() 95 filename = filename.lower()
96 name = "convert_" + filename 96 name = "convert_" + filename
97 if webgl_mode: 97 if webgl_mode:
98 name = name + "_webgl" 98 name = name + "_webgl"
99 output = asset['path'].replace('convert_', '') 99 output = asset['path'].replace('convert_', '')
100 output = posixpath.splitext(output)[0] + ".o3dtgz" 100 output_base = posixpath.splitext(output)[0]
101 output_tgz = output_base + ".o3dtgz"
102 output_json = output_base + "/scene.json"
103 output = output_tgz
104 if webgl_mode:
105 output = output_json
101 output_dir = posixpath.dirname(output) 106 output_dir = posixpath.dirname(output)
102 output_file.write(" {\n") 107 output_file.write(" {\n")
103 output_file.write(" 'action_name': '%s',\n" % name) 108 output_file.write(" 'action_name': '%s',\n" % name)
104 output_file.write(" 'inputs': [\n") 109 output_file.write(" 'inputs': [\n")
105 output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") 110 output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n")
106 output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) 111 output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path'])
107 output_file.write(" ],\n") 112 output_file.write(" ],\n")
108 output_file.write(" 'outputs': [\n") 113 output_file.write(" 'outputs': [\n")
109 if sys.platform[:5] == 'linux': 114 if sys.platform[:5] == 'linux':
110 # TODO(gspencer): This is a HACK! We shouldn't need to put the 115 # TODO(gspencer): This is a HACK! We shouldn't need to put the
111 # absolute path here, but currently on Linux (scons), it is unable 116 # absolute path here, but currently on Linux (scons), it is unable
112 # to copy generated items out of the source tree (because the 117 # to copy generated items out of the source tree (because the
113 # repository mojo fails to find it and puts in the wrong path). 118 # repository mojo fails to find it and puts in the wrong path).
114 output_file.write(" '%s',\n" % posixpath.abspath(output)) 119 output_file.write(" '%s',\n" % posixpath.abspath(output))
115 else: 120 else:
116 output_file.write(" '../samples/%s',\n" % output) 121 output_file.write(" '../samples/%s',\n" % output)
117 output_file.write(" ],\n") 122 output_file.write(" ],\n")
118 output_file.write(" 'action': [\n") 123 output_file.write(" 'action': [\n")
119 output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") 124 output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n")
120 output_file.write(" '--no-condition',\n") 125 output_file.write(" '--no-condition',\n")
121 output_file.write(" '--up-axis=%s',\n" % asset['up']) 126 output_file.write(" '--up-axis=%s',\n" % asset['up'])
122 if webgl_mode: 127 if webgl_mode:
123 output_file.write(" '--no-binary',\n") 128 output_file.write(" '--no-binary',\n")
124 output_file.write(" '--no-archive',\n") 129 output_file.write(" '--no-archive',\n")
125 output_file.write(" '--convert-dds-to-png',\n") 130 output_file.write(" '--convert-dds-to-png',\n")
126 output_file.write(" '--convert-cg-to-glsl',\n") 131 output_file.write(" '--convert-cg-to-glsl',\n")
127 output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) 132 output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path'])
128 output_file.write(" '<(_outputs)',\n") 133 if webgl_mode:
134 output_file.write(" '%s',\n" % output_tgz)
135 else:
136 output_file.write(" '<(_outputs)',\n")
129 output_file.write(" ],\n") 137 output_file.write(" ],\n")
130 output_file.write(" },\n") 138 output_file.write(" },\n")
131 139
132 for asset in assets: 140 for asset in assets:
133 write_action(asset, False); 141 write_action(asset, False);
134 if asset.has_key('webgl'): 142 if asset.has_key('webgl'):
135 write_action(asset, True); 143 write_action(asset, True);
136 144
137 output_file.write(" ],\n") 145 output_file.write(" ],\n")
138 146
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 output_file.write(" ],\n") 192 output_file.write(" ],\n")
185 output_file.write(" },\n") 193 output_file.write(" },\n")
186 194
187 output_file.write(" ],\n") 195 output_file.write(" ],\n")
188 output_file.write(" },\n") 196 output_file.write(" },\n")
189 output_file.write(" ],\n") 197 output_file.write(" ],\n")
190 output_file.write("}\n") 198 output_file.write("}\n")
191 199
192 print output_filename 200 print output_filename
193 sys.exit(0) 201 sys.exit(0)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698