From adb9e98dd4a7b7d586b054d1559db977caf920f0 Mon Sep 17 00:00:00 2001 From: "Vladimir Spivak(cwolf3d)" <cwolf3d@gmail.com> Date: Sun, 11 Apr 2021 20:46:12 +0300 Subject: [PATCH] Fix T87212: Multiple-Parameter Functions for Math Surfaces in Extra Objects --- .../add_mesh_3d_function_surface.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 2faae6054..c4520adcc 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 -- GitLab