[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30249] trunk/blender/source/blender/ makesrna/rna_cleanup: - more misc rna rename updates

Campbell Barton ideasman42 at gmail.com
Tue Jul 13 01:43:14 CEST 2010


Revision: 30249
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30249
Author:   campbellbarton
Date:     2010-07-13 01:43:14 +0200 (Tue, 13 Jul 2010)

Log Message:
-----------
- more misc rna rename updates
- edited the rna_cleaner.py script to use repr() on descriptions so quotes dont result in invalid generated python scripts.

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/rna_cleanup/rna_cleaner.py
    trunk/blender/source/blender/makesrna/rna_cleanup/rna_properties.txt

Modified: trunk/blender/source/blender/makesrna/rna_cleanup/rna_cleaner.py
===================================================================
--- trunk/blender/source/blender/makesrna/rna_cleanup/rna_cleaner.py	2010-07-12 23:31:15 UTC (rev 30248)
+++ trunk/blender/source/blender/makesrna/rna_cleanup/rna_cleaner.py	2010-07-12 23:43:14 UTC (rev 30249)
@@ -57,7 +57,7 @@
         usage()
     if sys.argv[1] == '-h':
         help()
-    elif not (sys.argv[1][-4:] == '.txt' or sys.argv[1][-3:] == '.py'):
+    elif not (sys.argv[1].endswith(".txt") or sys.argv[1].endswith(".py")):
         print ('\nBad input file extension... exiting.')
         usage()
     else:
@@ -147,7 +147,7 @@
         changed = check_if_changed(bfrom, bto)
         
         # lists formatting
-        props=[comment, changed, bclass, bfrom, bto, kwcheck, btype, description]
+        props=[comment, changed, bclass, bfrom, bto, kwcheck, btype, repr(description)]
         props_list.append(props)
         props_length_max=list(map(max,zip(props_length_max,list(map(len,props)))))
         
@@ -164,9 +164,10 @@
 
     props_length_max = [0 for i in rna_api[0]] # this way if the vector will take more elements we are safe
     for index,props in enumerate(rna_api):
-        [comment, changed, bclass, bfrom, bto, kwcheck, btype, description] = props
+        comment, changed, bclass, bfrom, bto, kwcheck, btype, description = props
         kwcheck = check_prefix(bto)   # keyword-check
         changed = check_if_changed(bfrom, bto)  # changed?
+        description = repr(description)
         rna_api[index] = [comment, changed, bclass, bfrom, bto, kwcheck, btype, description]
         props_length = list(map(len,props)) # lengths
         props_length_max = list(map(max,zip(props_length_max,props_length)))    # max lengths
@@ -174,9 +175,9 @@
 
 
 def get_props(input_filename):
-    if input_filename[-4:] == '.txt':
+    if input_filename.endswith(".txt"):
         props_list,props_length_max = get_props_from_txt(input_filename)
-    elif input_filename[-3:] == '.py':
+    elif input_filename.endswith(".py"):
         props_list,props_length_max = get_props_from_py(input_filename)
     return (props_list,props_length_max)
 
@@ -200,16 +201,17 @@
 
 def file_basename(input_filename):
     # if needed will use os.path
-    if input_filename[-4:] == '.txt':
-        if input_filename[-9:] == '_work.txt':
-            base_filename = input_filename[:-9]
+    if input_filename.endswith(".txt"):
+        if input_filename.endswith("_work.txt"):
+            base_filename = input_filename.replace("_work.txt", "")
         else:
-            base_filename = input_filename[:-4]
-    elif input_filename[-3:] == '.py':
-        if input_filename[-8:] == '_work.py':
-            base_filename = input_filename[:-8]
+            base_filename = input_filename.replace(".txt", "")
+    elif input_filename.endswith(".py"):
+        if input_filename.endswith("_work.py"):
+            base_filename = input_filename.replace("_work.py", "")
         else:
-            base_filename = input_filename[:-3]
+            base_filename = input_filename.replace(".py", "")
+
     return base_filename
 
 
@@ -236,15 +238,21 @@
         # rna_api
         if props[0] == 'NOTE': indent = '#   '
         else: indent = '    '
-        rna += indent + '("%s", "%s", "%s", "%s", "%s"),\n' % tuple(props[2:5] + props[6:])    
+        rna += indent + '("%s", "%s", "%s", "%s", %s),\n' % tuple(props[2:5] + props[6:]) # description is alredy string formatted
         # py
         blanks = [' '* (x[0]-x[1]) for x in zip(props_length_max,list(map(len,props)))]
-        props = ['"%s"%s'%(x[0],x[1]) for x in zip(props,blanks)]
+        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)
 
     f_txt.write(txt)
     f_py.write("rna_api = [\n%s]\n" % py)
     f_rna.write("rna_api = [\n%s]\n" % rna)
+    
+    # write useful py script, wont hurt
+    f_py.write("\n'''\n")
+    f_py.write("for p_note, p_changed, p_class, p_from, p_to, p_check, p_type, p_desc in rna_api:\n")
+    f_py.write("    print(p_to)\n")
+    f_py.write("\n'''\n")
 
     f_txt.close()
     f_py.close()

Modified: trunk/blender/source/blender/makesrna/rna_cleanup/rna_properties.txt
===================================================================
--- trunk/blender/source/blender/makesrna/rna_cleanup/rna_properties.txt	2010-07-12 23:31:15 UTC (rev 30248)
+++ trunk/blender/source/blender/makesrna/rna_cleanup/rna_properties.txt	2010-07-12 23:43:14 UTC (rev 30249)
@@ -55,7 +55,7 @@
 AreaLamp.shadow_method -> shadow_method:    enum    Method to compute lamp shadow with
 AreaLamp.shadow_ray_samples_x -> shadow_ray_samples_x:    int    Amount of samples taken extra (samples x samples)
 AreaLamp.shadow_ray_samples_y -> shadow_ray_samples_y:    int    Amount of samples taken extra (samples x samples)
-AreaLamp.shadow_ray_sampling_method -> shadow_ray_sampling_method:    enum    Method for generating shadow samples: Adaptive QMC is fastest, Constant QMC is less noisy but slower
+AreaLamp.shadow_ray_sampling_method -> shadow_ray_sample_method:    enum    Method for generating shadow samples: Adaptive QMC is fastest, Constant QMC is less noisy but slower
 AreaLamp.shadow_soft_size -> shadow_soft_size:    float    Light size for ray shadow sampling (Raytraced shadows)
 AreaLamp.shape -> shape:    enum    Shape of the area lamp
 AreaLamp.size -> size:    float    Size of the area of the area Lamp, X direction size for Rectangle shapes
@@ -106,10 +106,10 @@
 BevelModifier.limit_method -> limit_method:    enum    
 BevelModifier.width -> width:    float    Bevel value/amount
 BezierSplinePoint.co -> co:    float    Coordinates of the control point
-BezierSplinePoint.handle1 -> handle1:    float    Coordinates of the first handle
-BezierSplinePoint.handle1_type -> handle1_type:    enum    Handle types
-BezierSplinePoint.handle2 -> handle2:    float    Coordinates of the second handle
-BezierSplinePoint.handle2_type -> handle2_type:    enum    Handle types
+BezierSplinePoint.handle1 -> handle_left:    float    Coordinates of the first handle
+BezierSplinePoint.handle1_type -> handle_left_type:    enum    Handle types
+BezierSplinePoint.handle2 -> handle_right:    float    Coordinates of the second handle
+BezierSplinePoint.handle2_type -> handle_right_type:    enum    Handle types
 BezierSplinePoint.radius -> radius:    float, (read-only)    Radius for bevelling
 BezierSplinePoint.tilt -> tilt:    float    Tilt in 3D View
 BezierSplinePoint.weight -> weight:    float    Softbody goal weight
@@ -134,18 +134,18 @@
 BoidSettings.active_boid_state -> active_boid_state:    pointer, (read-only)    
 BoidSettings.active_boid_state_index -> active_boid_state_index:    int    
 BoidSettings.aggression -> aggression:    float    Boid will fight this times stronger enemy
-BoidSettings.air_max_acc -> air_max_acc:    float    Maximum acceleration in air (relative to maximum speed)
-BoidSettings.air_max_ave -> air_max_ave:    float    Maximum angular velocity in air (relative to 180 degrees)
-BoidSettings.air_max_speed -> air_max_speed:    float    Maximum speed in air
-BoidSettings.air_min_speed -> air_min_speed:    float    Minimum speed in air (relative to maximum speed)
+BoidSettings.air_max_acc -> air_acc_max:    float    Maximum acceleration in air (relative to maximum speed)
+BoidSettings.air_max_ave -> air_ave_max:    float    Maximum angular velocity in air (relative to 180 degrees)
+BoidSettings.air_max_speed -> air_speed_max:    float    Maximum speed in air
+BoidSettings.air_min_speed -> air_speed_min:    float    Minimum speed in air (relative to maximum speed)
 BoidSettings.air_personal_space -> air_personal_space:    float    Radius of boids personal space in air (% of particle size)
 BoidSettings.banking -> bank:    float    Amount of rotation around velocity vector on turns
 BoidSettings.health -> health:    float    Initial boid health when born
 BoidSettings.height -> height:    float    Boid height relative to particle size
 BoidSettings.land_jump_speed -> land_jump_speed:    float    Maximum speed for jumping
-BoidSettings.land_max_acc -> land_max_acc:    float    Maximum acceleration on land (relative to maximum speed)
-BoidSettings.land_max_ave -> land_max_ave:    float    Maximum angular velocity on land (relative to 180 degrees)
-BoidSettings.land_max_speed -> land_max_speed:    float    Maximum speed on land
+BoidSettings.land_max_acc -> land_acc_max:    float    Maximum acceleration on land (relative to maximum speed)
+BoidSettings.land_max_ave -> land_ave_max:    float    Maximum angular velocity on land (relative to 180 degrees)
+BoidSettings.land_max_speed -> land_speed_max:    float    Maximum speed on land
 BoidSettings.land_personal_space -> land_personal_space:    float    Radius of boids personal space on land (% of particle size)
 BoidSettings.land_stick_force -> land_stick_force:    float    How strong a force must be to start effecting a boid on land
 BoidSettings.landing_smoothness -> land_smooth:    float    How smoothly the boids land
@@ -241,7 +241,7 @@
 ClothCollisionSettings.min_distance -> distance_min:    float    Minimum distance between collision objects before collision response takes in
 ClothCollisionSettings.self_collision_quality -> self_collision_quality:    int    How many self collision iterations should be done. (higher is better quality but slower)
 ClothCollisionSettings.self_friction -> self_friction:    float    Friction/damping with self contact
-ClothCollisionSettings.self_min_distance -> self_min_distance:    float    0.5 means no distance at all, 1.0 is maximum distance
+ClothCollisionSettings.self_min_distance -> self_distance_min:    float    0.5 means no distance at all, 1.0 is maximum distance
 ClothModifier.collision_settings -> collision_settings:    pointer, (read-only)    
 ClothModifier.point_cache -> point_cache:    pointer, (read-only)    
 ClothModifier.settings -> settings:    pointer, (read-only)    
@@ -302,8 +302,8 @@
 CompositorNodeBlur.factor_x -> factor_x:    float    
 CompositorNodeBlur.factor_y -> factor_y:    float    
 CompositorNodeBlur.filter_type -> filter_type:    enum    
-CompositorNodeBlur.sizex -> sizex:    int    

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list