Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/rna_cleanup/rna_cleaner.py')
-rwxr-xr-xsource/blender/makesrna/rna_cleanup/rna_cleaner.py29
1 files changed, 20 insertions, 9 deletions
diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner.py b/source/blender/makesrna/rna_cleanup/rna_cleaner.py
index f623b1c673d..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)
@@ -195,8 +206,8 @@ def sort(props_list, sort_priority):
"""
# order based on the i-th element in lists
- if sort_priority == "class.from":
- props_list = sorted(props_list, key=lambda p: (p[2], p[3]))
+ if sort_priority == "class.to":
+ props_list = sorted(props_list, key=lambda p: (p[2], p[4]))
else:
i = sort_choices.index(sort_priority)
if i == 0:
@@ -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']