diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-08-15 20:50:58 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-08-15 20:50:58 +0400 |
commit | e2a6a0b377bf6aa51832d45876a074cc92445ad1 (patch) | |
tree | 0f0761658cec9eb78c76f588eb240d9c0202107f /source/blender/makesrna/rna_cleanup/rna_cleaner.py | |
parent | 3a34d669e197b874d757a320ecae46d99714e2c2 (diff) |
change for sorting rna cleaner (was broken), diff's on rna_properties.txt will stop being so big now.
Diffstat (limited to 'source/blender/makesrna/rna_cleanup/rna_cleaner.py')
-rwxr-xr-x | source/blender/makesrna/rna_cleanup/rna_cleaner.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner.py b/source/blender/makesrna/rna_cleanup/rna_cleaner.py index 5eac1d295e8..24b4db99e7a 100755 --- a/source/blender/makesrna/rna_cleanup/rna_cleaner.py +++ b/source/blender/makesrna/rna_cleanup/rna_cleaner.py @@ -109,6 +109,11 @@ def get_props_from_txt(input_filename): props_list=[] props_length_max=[0,0,0,0,0,0,0,0] + + done_text = "+" + done = 0 + tot = 0 + for line in file_lines: # debug @@ -141,8 +146,8 @@ def get_props_from_txt(input_filename): # type, description try: [btype, description] = tail.split(None, 1) - if '"' in description: - description.replace('"', "'") + # make life easy and strip quotes + description = description.replace("'", "").replace('"', "").replace("\\", "").strip() except ValueError: [btype, description] = [tail,'NO DESCRIPTION'] @@ -153,10 +158,16 @@ def get_props_from_txt(input_filename): changed = check_if_changed(bfrom, bto) # lists formatting - props=[comment, changed, bclass, bfrom, bto, kwcheck, btype, repr(description)] + props=[comment, changed, bclass, bfrom, bto, kwcheck, btype, description] props_list.append(props) props_length_max=list(map(max,zip(props_length_max,list(map(len,props))))) + if done_text in comment: + done += 1 + tot += 1 + + print("Total done %.2f" % (done / tot * 100.0) ) + return (props_list,props_length_max) @@ -243,15 +254,15 @@ def write_files(basename, props_list, props_length_max): for props in props_list: #txt if props[0] != '': txt += '%s * ' % props[0] # comment - txt += '%s.%s -> %s: %s %s\n' % tuple(props[2:5] + props[6:]) # skipping keyword-check + txt += '%s.%s -> %s: %s "%s"\n' % tuple(props[2:5] + props[6:]) # skipping keyword-check # rna_api if props[0] == 'NOTE': indent = '# ' else: indent = ' ' - rna += indent + '("%s", "%s", "%s", "%s", %s),\n' % tuple(props[2:5] + props[6:]) # description is already string formatted + rna += indent + '("%s", "%s", "%s", "%s", "%s"),\n' % tuple(props[2:5] + props[6:]) # description is already string formatted # py blanks = [' '* (x[0]-x[1]) for x in zip(props_length_max,list(map(len,props)))] props = [('"%s"%s' if props[-1] != x[0] else "%s%s") % (x[0],x[1]) for x in zip(props,blanks)] - py += indent + '(%s, %s, %s, %s, %s, %s, %s, %s),\n' % tuple(props) + py += indent + '(%s, %s, %s, %s, %s, %s, %s, "%s"),\n' % tuple(props) f_txt.write(txt) f_py.write("rna_api = [\n%s]\n" % py) @@ -275,7 +286,7 @@ def main(): global sort_choices, default_sort_choice global kw_prefixes, kw - sort_choices = ['note','changed','class','from','to','kw', 'class.from'] + sort_choices = ['note','changed','class','from','to','kw', 'class.to'] default_sort_choice = sort_choices[-1] kw_prefixes = [ 'active','apply','bl','exclude','has','invert','is','lock', \ 'pressed','show','show_only','use','use_only','layers','states', 'select'] |