[Bf-extensions-cvs] [13eb2d2e] master: Add Curve: Extra Objects addon: add_curve_torus_knots: error correction when creating material

Spivak Vladimir cwolf3d noreply at git.blender.org
Sun Jul 14 00:17:44 CEST 2019


Commit: 13eb2d2e68afe6dd2f7ddd0d897718f8599baf82
Author: Spivak Vladimir (cwolf3d)
Date:   Sun Jul 14 01:17:09 2019 +0300
Branches: master
https://developer.blender.org/rBA13eb2d2e68afe6dd2f7ddd0d897718f8599baf82

Add Curve: Extra Objects addon: add_curve_torus_knots: error correction when creating material

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

M	add_curve_extra_objects/add_curve_torus_knots.py

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

diff --git a/add_curve_extra_objects/add_curve_torus_knots.py b/add_curve_extra_objects/add_curve_torus_knots.py
index 3b2b362c..ea00bd2a 100644
--- a/add_curve_extra_objects/add_curve_torus_knots.py
+++ b/add_curve_extra_objects/add_curve_torus_knots.py
@@ -269,13 +269,11 @@ def create_torus_knot(self, context):
     # set object in the scene
     scene = bpy.context.scene
     scene.collection.objects.link(new_obj)  # place in active scene
+    bpy.ops.object.select_all(action='DESELECT')
     new_obj.select_set(True)  # set as selected
-    #scene.objects.active = new_obj  # set as active
+    bpy.context.view_layer.objects.active = new_obj
     new_obj.matrix_world = self.align_matrix  # apply matrix
-
-    # set BEZIER handles
-    #if splineType == 'BEZIER':
-    #    setBezierHandles(new_obj, self.handleType)
+    bpy.context.view_layer.update()
 
     return
 
@@ -331,9 +329,9 @@ def addLinkColors(self, curveData):
             mat.diffuse_color = (*colors[cID], 1.0)
 
         if self.options_plus:
-            mat.diffuse_color.s = self.saturation
+            mat.diffuse_color = (mat.diffuse_color[0] * self.saturation, mat.diffuse_color[1] * self.saturation, mat.diffuse_color[2] * self.saturation, 1.0)
         else:
-            mat.diffuse_color.s = 0.75
+            mat.diffuse_color = (mat.diffuse_color[0] * 0.75, mat.diffuse_color[1] * 0.75, mat.diffuse_color[2] * 0.75, 1.0)
 
         me.materials.append(mat)



More information about the Bf-extensions-cvs mailing list