[Bf-extensions-cvs] [adb9e98d] master: Fix T87212: Multiple-Parameter Functions for Math Surfaces in Extra Objects

Vladimir Spivakcwolf3d noreply at git.blender.org
Sun Apr 11 19:47:55 CEST 2021


Commit: adb9e98dd4a7b7d586b054d1559db977caf920f0
Author: Vladimir Spivak(cwolf3d)
Date:   Sun Apr 11 20:46:12 2021 +0300
Branches: master
https://developer.blender.org/rBAadb9e98dd4a7b7d586b054d1559db977caf920f0

Fix T87212: Multiple-Parameter Functions for Math Surfaces in Extra Objects

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

M	add_mesh_extra_objects/add_mesh_3d_function_surface.py

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

diff --git a/add_mesh_extra_objects/add_mesh_3d_function_surface.py b/add_mesh_extra_objects/add_mesh_3d_function_surface.py
index 2faae605..c4520adc 100644
--- a/add_mesh_extra_objects/add_mesh_3d_function_surface.py
+++ b/add_mesh_extra_objects/add_mesh_3d_function_surface.py
@@ -1,6 +1,8 @@
 # GPL # original by Buerbaum Martin (Pontiac), Elod Csirmaz
 
 import bpy
+import math
+import numpy
 from mathutils import *
 from math import *
 from bpy.types import Operator
@@ -13,13 +15,18 @@ from bpy.props import (
 
 
 # List of safe functions for eval()
-safe_list = ['math', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'cosh',
+safe_list = ['acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'cosh',
     'degrees', 'e', 'exp', 'fabs', 'floor', 'fmod', 'frexp', 'hypot',
     'ldexp', 'log', 'log10', 'modf', 'pi', 'pow', 'radians',
-    'sin', 'sinh', 'sqrt', 'tan', 'tanh']
+    'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'gcd']
 
 # Use the list to filter the local namespace
 safe_dict = dict((k, globals().get(k, None)) for k in safe_list)
+safe_dict['math'] = math
+safe_dict['numpy'] = safe_dict['np'] = numpy
+safe_dict['lcm'] = numpy.lcm
+safe_dict['max'] = max
+safe_dict['min'] = min
 
 
 # Stores the values of a list of properties and the



More information about the Bf-extensions-cvs mailing list