[Bf-extensions-cvs] [ff83176c] master: Fix T84328: Correct errors caused by renaming

Robert Guetzkow noreply at git.blender.org
Wed Dec 9 12:26:39 CET 2020


Commit: ff83176c7f46ec16666bec79bbda5d0147b5ed7c
Author: Robert Guetzkow
Date:   Wed Dec 9 12:19:13 2020 +0100
Branches: master
https://developer.blender.org/rBAff83176c7f46ec16666bec79bbda5d0147b5ed7c

Fix T84328: Correct errors caused by renaming

In rBA6aa8e130eff59059886e203ff95221609f63b222 all occurrences
of "lamp" where replaced with "light" which also accidentally
renamed "clamp" to "clight". In case of the x3d importer and
object carver add-on this broke some functionality. This
commit fixes the names to match the use the correct properties
of the Python API and use semantically correct names for other
add-on where the renaming didn't cause functional changes.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9782

===================================================================

M	io_scene_obj/__init__.py
M	io_scene_obj/import_obj.py
M	io_scene_x3d/export_x3d.py
M	io_scene_x3d/import_x3d.py
M	object_carver/carver_utils.py

===================================================================

diff --git a/io_scene_obj/__init__.py b/io_scene_obj/__init__.py
index e9fc8259..e20d50ea 100644
--- a/io_scene_obj/__init__.py
+++ b/io_scene_obj/__init__.py
@@ -110,7 +110,7 @@ class ImportOBJ(bpy.types.Operator, ImportHelper):
                    ),
             )
 
-    global_clight_size: FloatProperty(
+    global_clamp_size: FloatProperty(
             name="Clamp Size",
             description="Clamp bounds under this value (zero to disable)",
             min=0.0, max=1000.0,
@@ -196,7 +196,7 @@ class OBJ_PT_import_transform(bpy.types.Panel):
         sfile = context.space_data
         operator = sfile.active_operator
 
-        layout.prop(operator, "global_clight_size")
+        layout.prop(operator, "global_clamp_size")
         layout.prop(operator, "axis_forward")
         layout.prop(operator, "axis_up")
 
diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py
index 85db6aec..a303eda5 100644
--- a/io_scene_obj/import_obj.py
+++ b/io_scene_obj/import_obj.py
@@ -905,7 +905,7 @@ def any_number_as_int(svalue):
 def load(context,
          filepath,
          *,
-         global_clight_size=0.0,
+         global_clamp_size=0.0,
          use_smooth_groups=True,
          use_edges=True,
          use_split_objects=True,
@@ -1293,7 +1293,7 @@ def load(context,
         axis_min = [1000000000] * 3
         axis_max = [-1000000000] * 3
 
-        if global_clight_size:
+        if global_clamp_size:
             # Get all object bounds
             for ob in new_objects:
                 for v in ob.bound_box:
@@ -1307,7 +1307,7 @@ def load(context,
             max_axis = max(axis_max[0] - axis_min[0], axis_max[1] - axis_min[1], axis_max[2] - axis_min[2])
             scale = 1.0
 
-            while global_clight_size < max_axis * scale:
+            while global_clamp_size < max_axis * scale:
                 scale = scale / 10.0
 
             for obj in new_objects:
diff --git a/io_scene_x3d/export_x3d.py b/io_scene_x3d/export_x3d.py
index 517146cb..5ac7e557 100644
--- a/io_scene_x3d/export_x3d.py
+++ b/io_scene_x3d/export_x3d.py
@@ -48,7 +48,7 @@ H3D_CAMERA_FOLLOW = 'CAMERA_FOLLOW_TRANSFORM'
 H3D_VIEW_MATRIX = 'view_matrix'
 
 
-def clight_color(col):
+def clamp_color(col):
     return tuple([max(min(c, 1.0), 0.0) for c in col])
 
 
@@ -372,7 +372,7 @@ def export(file,
             ident_step = ident + (' ' * (-len(ident) + \
             fw('%s<Fog ' % ident)))
             fw('fogType="%s"\n' % ('LINEAR' if (mtype == 'LINEAR') else 'EXPONENTIAL'))
-            fw(ident_step + 'color="%.3f %.3f %.3f"\n' % clight_color(world.horizon_color))
+            fw(ident_step + 'color="%.3f %.3f %.3f"\n' % clamp_color(world.horizon_color))
             fw(ident_step + 'visibilityRange="%.3f"\n' % mparam.depth)
             fw(ident_step + '/>\n')
         else:
@@ -441,7 +441,7 @@ def export(file,
         fw(ident_step + 'radius="%.4f"\n' % radius)
         fw(ident_step + 'ambientIntensity="%.4f"\n' % amb_intensity)
         fw(ident_step + 'intensity="%.4f"\n' % intensity)
-        fw(ident_step + 'color="%.4f %.4f %.4f"\n' % clight_color(light.color))
+        fw(ident_step + 'color="%.4f %.4f %.4f"\n' % clamp_color(light.color))
         fw(ident_step + 'beamWidth="%.4f"\n' % beamWidth)
         fw(ident_step + 'cutOffAngle="%.4f"\n' % cutOffAngle)
         fw(ident_step + 'direction="%.4f %.4f %.4f"\n' % orientation)
@@ -468,7 +468,7 @@ def export(file,
         fw('%s<DirectionalLight ' % ident)))
         fw('DEF=%s\n' % light_id)
         fw(ident_step + 'ambientIntensity="%.4f"\n' % amb_intensity)
-        fw(ident_step + 'color="%.4f %.4f %.4f"\n' % clight_color(light.color))
+        fw(ident_step + 'color="%.4f %.4f %.4f"\n' % clamp_color(light.color))
         fw(ident_step + 'intensity="%.4f"\n' % intensity)
         fw(ident_step + 'direction="%.4f %.4f %.4f"\n' % orientation)
         fw(ident_step + '/>\n')
@@ -492,7 +492,7 @@ def export(file,
         fw('%s<PointLight ' % ident)))
         fw('DEF=%s\n' % light_id)
         fw(ident_step + 'ambientIntensity="%.4f"\n' % amb_intensity)
-        fw(ident_step + 'color="%.4f %.4f %.4f"\n' % clight_color(light.color))
+        fw(ident_step + 'color="%.4f %.4f %.4f"\n' % clamp_color(light.color))
 
         fw(ident_step + 'intensity="%.4f"\n' % intensity)
         fw(ident_step + 'radius="%.4f" \n' % light.distance)
@@ -978,9 +978,9 @@ def export(file,
             ident_step = ident + (' ' * (-len(ident) + \
             fw('%s<Material ' % ident)))
             fw('DEF=%s\n' % material_id)
-            fw(ident_step + 'diffuseColor="%.3f %.3f %.3f"\n' % clight_color(diffuseColor))
-            fw(ident_step + 'specularColor="%.3f %.3f %.3f"\n' % clight_color(specColor))
-            fw(ident_step + 'emissiveColor="%.3f %.3f %.3f"\n' % clight_color(emitColor))
+            fw(ident_step + 'diffuseColor="%.3f %.3f %.3f"\n' % clamp_color(diffuseColor))
+            fw(ident_step + 'specularColor="%.3f %.3f %.3f"\n' % clamp_color(specColor))
+            fw(ident_step + 'emissiveColor="%.3f %.3f %.3f"\n' % clamp_color(emitColor))
             fw(ident_step + 'ambientIntensity="%.3f"\n' % ambient)
             fw(ident_step + 'shininess="%.3f"\n' % shininess)
             fw(ident_step + 'transparency="%s"\n' % transp)
@@ -1307,15 +1307,15 @@ def export(file,
         # XXX World changed a lot in 2.8... For now do minimal get-it-to-work job.
         # ~ blending = world.use_sky_blend, world.use_sky_paper, world.use_sky_real
 
-        # ~ grd_triple = clight_color(world.horizon_color)
-        # ~ sky_triple = clight_color(world.zenith_color)
-        # ~ mix_triple = clight_color((grd_triple[i] + sky_triple[i]) / 2.0 for i in range(3))
+        # ~ grd_triple = clamp_color(world.horizon_color)
+        # ~ sky_triple = clamp_color(world.zenith_color)
+        # ~ mix_triple = clamp_color((grd_triple[i] + sky_triple[i]) / 2.0 for i in range(3))
 
         blending = (False, False, False)
 
-        grd_triple = clight_color(world.color)
-        sky_triple = clight_color(world.color)
-        mix_triple = clight_color((grd_triple[i] + sky_triple[i]) / 2.0 for i in range(3))
+        grd_triple = clamp_color(world.color)
+        sky_triple = clamp_color(world.color)
+        mix_triple = clamp_color((grd_triple[i] + sky_triple[i]) / 2.0 for i in range(3))
 
         ident_step = ident + (' ' * (-len(ident) + \
         fw('%s<Background ' % ident)))
diff --git a/io_scene_x3d/import_x3d.py b/io_scene_x3d/import_x3d.py
index 653b8d9f..5d681a96 100644
--- a/io_scene_x3d/import_x3d.py
+++ b/io_scene_x3d/import_x3d.py
@@ -2822,9 +2822,9 @@ def appearance_LoadTexture(tex_node, ancestry, node):
 
     if bpyima:  # Loading can still fail
         repeat_s = tex_node.getFieldAsBool('repeatS', True, ancestry)
-        bpyima.use_clight_x = not repeat_s
+        bpyima.use_clamp_x = not repeat_s
         repeat_t = tex_node.getFieldAsBool('repeatT', True, ancestry)
-        bpyima.use_clight_y = not repeat_t
+        bpyima.use_clamp_y = not repeat_t
 
         # Update the desc-based cache
         if desc:
diff --git a/object_carver/carver_utils.py b/object_carver/carver_utils.py
index 1bd7455f..b026c1d1 100644
--- a/object_carver/carver_utils.py
+++ b/object_carver/carver_utils.py
@@ -326,7 +326,7 @@ def CreateBevel(context, CurrentObject):
             mod.limit_method = 'WEIGHT'
             mod.width = 0.01
             mod.profile = 0.699099
-            mod.use_clight_overlap = False
+            mod.use_clamp_overlap = False
             mod.segments = 3
             mod.loop_slide = False



More information about the Bf-extensions-cvs mailing list