File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -158,9 +158,15 @@ def format_source(source, indent_size):
158
158
159
159
# returns the name of a type.. ie struct <name>, enum <name>
160
160
def type_name (type_declaration ):
161
- pos = type_declaration .find ("{" )
162
- name = type_declaration [:pos ].strip ().split ()[1 ]
163
- return name
161
+ # skip past templates (allow multiple template parameters)
162
+ if type_declaration .find ("<" ) != - 1 :
163
+ template_end = enclose ("<" , ">" , type_declaration , 0 )
164
+ return type_declaration [template_end :].strip ().split ()[0 ]
165
+ else :
166
+ # assume the type name is the second token
167
+ pos = type_declaration .find ("{" )
168
+ name = type_declaration [:pos ].strip ().split ()[1 ]
169
+ return name
164
170
165
171
166
172
# get the typename stripping resource_array[21] arrays and return (resource_array, 21)
Original file line number Diff line number Diff line change @@ -1026,6 +1026,14 @@ def load_pmfx_jsn(filepath, root):
1026
1026
to_search .add (import_name )
1027
1027
if line .startswith ("{" ):
1028
1028
break
1029
+ # strip rouge includes
1030
+ if all_shader_source .find ("#include" ) != - 1 :
1031
+ src = all_shader_source .splitlines ()
1032
+ strip_src = ""
1033
+ for line in src :
1034
+ if line .find ("#include" ) == - 1 :
1035
+ strip_src += line + "\n "
1036
+ all_shader_source = strip_src
1029
1037
return (pmfx , all_shader_source , all_included_files )
1030
1038
1031
1039
You can’t perform that action at this time.
0 commit comments