From b5f39863fad254f78f7b7068c5fc4e00e31279fb Mon Sep 17 00:00:00 2001 From: Nika Kutsniashvili Date: Tue, 2 Jul 2024 15:00:52 +0400 Subject: [PATCH 1/2] Register pre-made operator presets --- source/__init__.py | 4 +++ source/install_presets.py | 35 +++++++++++++++++++ .../mesh.primitive_round_cube_add/Capsule.py | 8 +++++ .../mesh.primitive_round_cube_add/Clay_Bar.py | 8 +++++ .../mesh.primitive_round_cube_add/Cube.py | 9 +++++ .../mesh.primitive_round_cube_add/Grid_3D.py | 7 ++++ .../Octahedron.py | 9 +++++ .../Quadsphere.py | 8 +++++ .../Rounded_Cube.py | 8 +++++ .../bonbon.py | 22 ++++++++++++ .../boy.py | 22 ++++++++++++ .../catalan.py | 22 ++++++++++++ .../catenoid.py | 22 ++++++++++++ .../clifford_torus.py | 22 ++++++++++++ .../cochlea.py | 22 ++++++++++++ .../cosinus.py | 22 ++++++++++++ .../dini.py | 22 ++++++++++++ .../enneper.py | 22 ++++++++++++ .../helicoidal.py | 22 ++++++++++++ .../helix.py | 22 ++++++++++++ .../hexahedron.py | 22 ++++++++++++ .../hyperhelicoidal.py | 22 ++++++++++++ .../klein.py | 22 ++++++++++++ .../moebius.py | 22 ++++++++++++ .../pseudo_catenoid.py | 22 ++++++++++++ .../pseudosphere.py | 22 ++++++++++++ .../ridged_torus.py | 22 ++++++++++++ .../shell.py | 22 ++++++++++++ .../sine.py | 22 ++++++++++++ .../snake.py | 22 ++++++++++++ .../sterosphere.py | 22 ++++++++++++ .../torus.py | 22 ++++++++++++ .../twisted_torus.py | 22 ++++++++++++ 33 files changed, 624 insertions(+) create mode 100644 source/install_presets.py create mode 100644 source/presets/mesh.primitive_round_cube_add/Capsule.py create mode 100644 source/presets/mesh.primitive_round_cube_add/Clay_Bar.py create mode 100644 source/presets/mesh.primitive_round_cube_add/Cube.py create mode 100644 source/presets/mesh.primitive_round_cube_add/Grid_3D.py create mode 100644 source/presets/mesh.primitive_round_cube_add/Octahedron.py create mode 100644 source/presets/mesh.primitive_round_cube_add/Quadsphere.py create mode 100644 source/presets/mesh.primitive_round_cube_add/Rounded_Cube.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/bonbon.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/boy.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/catalan.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/catenoid.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/clifford_torus.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/cochlea.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/cosinus.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/dini.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/enneper.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/helicoidal.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/helix.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/hexahedron.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/hyperhelicoidal.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/klein.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/moebius.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/pseudo_catenoid.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/pseudosphere.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/ridged_torus.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/shell.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/sine.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/snake.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/sterosphere.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/torus.py create mode 100644 source/presets/mesh.primitive_xyz_function_surface/twisted_torus.py diff --git a/source/__init__.py b/source/__init__.py index 7b43ff6..18fe13f 100644 --- a/source/__init__.py +++ b/source/__init__.py @@ -35,6 +35,7 @@ if "bpy" in locals(): importlib.reload(Blocks) importlib.reload(Wallfactory) importlib.reload(add_mesh_triangles) + importlib.reload(install_presets) else: from . import add_mesh_star from . import add_mesh_twisted_torus @@ -57,6 +58,7 @@ else: from . import Blocks from . import Wallfactory from . import add_mesh_triangles + from . import install_presets from .add_mesh_rocks import __init__ from .add_mesh_rocks import rockgen @@ -407,6 +409,7 @@ def register(): register_class(cls) add_mesh_rocks.register() + install_presets.register() # Add "Extras" menu to the "Add Mesh" menu and context menu. bpy.types.VIEW3D_MT_mesh_add.append(menu_func) @@ -423,6 +426,7 @@ def unregister(): unregister_class(cls) add_mesh_rocks.unregister() + install_presets.unregister() if __name__ == "__main__": register() diff --git a/source/install_presets.py b/source/install_presets.py new file mode 100644 index 0000000..46f788f --- /dev/null +++ b/source/install_presets.py @@ -0,0 +1,35 @@ +import os +import shutil + + +addon_folder = os.path.dirname(os.path.realpath(__file__)) + +repository_folder = os.path.dirname(addon_folder) +extensions_folder = os.path.dirname(repository_folder) +version_folder = os.path.dirname(extensions_folder) +presets_folder = os.path.join(version_folder, 'scripts', 'presets') + + +### PRESETS INSTALL #### + +source_directory = os.path.join(addon_folder, "presets") +destination_directory = os.path.join(presets_folder, "operator") + + +def copy_subfolders(source_dir, destination_dir): + if not os.path.exists(destination_dir): + os.makedirs(destination_dir) + + for item in os.listdir(source_dir): + source_path = os.path.join(source_dir, item) + destination_path = os.path.join(destination_dir, item) + + if os.path.isdir(source_path): + if os.path.exists(destination_path): + continue + + shutil.copytree(source_path, destination_path) + + +def register(): + copy_subfolders(source_directory, destination_directory) diff --git a/source/presets/mesh.primitive_round_cube_add/Capsule.py b/source/presets/mesh.primitive_round_cube_add/Capsule.py new file mode 100644 index 0000000..c758377 --- /dev/null +++ b/source/presets/mesh.primitive_round_cube_add/Capsule.py @@ -0,0 +1,8 @@ +import bpy +op = bpy.context.active_operator + +op.radius = 0.5 +op.arc_div = 8 +op.lin_div = 0 +op.size = (0.0, 0.0, 3.0) +op.div_type = 'CORNERS' diff --git a/source/presets/mesh.primitive_round_cube_add/Clay_Bar.py b/source/presets/mesh.primitive_round_cube_add/Clay_Bar.py new file mode 100644 index 0000000..421fc8d --- /dev/null +++ b/source/presets/mesh.primitive_round_cube_add/Clay_Bar.py @@ -0,0 +1,8 @@ +import bpy +op = bpy.context.active_operator + +op.radius = 0.4 +op.arc_div = 8 +op.lin_div = 0 +op.size = (1.5, 3.0, 1.0) +op.div_type = 'ALL' diff --git a/source/presets/mesh.primitive_round_cube_add/Cube.py b/source/presets/mesh.primitive_round_cube_add/Cube.py new file mode 100644 index 0000000..4b30b5b --- /dev/null +++ b/source/presets/mesh.primitive_round_cube_add/Cube.py @@ -0,0 +1,9 @@ +import bpy +op = bpy.context.active_operator + +op.radius = 0.0 +op.arc_div = 1 +op.lin_div = 0 +op.size = (2.0, 2.0, 2.0) +op.div_type = 'CORNERS' +op.odd_axis_align = False diff --git a/source/presets/mesh.primitive_round_cube_add/Grid_3D.py b/source/presets/mesh.primitive_round_cube_add/Grid_3D.py new file mode 100644 index 0000000..248c7f2 --- /dev/null +++ b/source/presets/mesh.primitive_round_cube_add/Grid_3D.py @@ -0,0 +1,7 @@ +import bpy +op = bpy.context.active_operator + +op.radius = 0 +op.size = (2, 2, 2) +op.lin_div = 5 +op.div_type = 'ALL' diff --git a/source/presets/mesh.primitive_round_cube_add/Octahedron.py b/source/presets/mesh.primitive_round_cube_add/Octahedron.py new file mode 100644 index 0000000..4685cfc --- /dev/null +++ b/source/presets/mesh.primitive_round_cube_add/Octahedron.py @@ -0,0 +1,9 @@ +import bpy +op = bpy.context.active_operator + +op.radius = 1.0 +op.arc_div = 1 +op.lin_div = 0 +op.size = (0.0, 0.0, 0.0) +op.div_type = 'CORNERS' +op.odd_axis_align = True diff --git a/source/presets/mesh.primitive_round_cube_add/Quadsphere.py b/source/presets/mesh.primitive_round_cube_add/Quadsphere.py new file mode 100644 index 0000000..0a7ad4e --- /dev/null +++ b/source/presets/mesh.primitive_round_cube_add/Quadsphere.py @@ -0,0 +1,8 @@ +import bpy +op = bpy.context.active_operator + +op.radius = 1.0 +op.arc_div = 8 +op.lin_div = 0 +op.size = (0.0, 0.0, 0.0) +op.div_type = 'CORNERS' diff --git a/source/presets/mesh.primitive_round_cube_add/Rounded_Cube.py b/source/presets/mesh.primitive_round_cube_add/Rounded_Cube.py new file mode 100644 index 0000000..b1660b8 --- /dev/null +++ b/source/presets/mesh.primitive_round_cube_add/Rounded_Cube.py @@ -0,0 +1,8 @@ +import bpy +op = bpy.context.active_operator + +op.radius = 0.25 +op.arc_div = 8 +op.lin_div = 0 +op.size = (2.0, 2.0, 2.0) +op.div_type = 'CORNERS' diff --git a/source/presets/mesh.primitive_xyz_function_surface/bonbon.py b/source/presets/mesh.primitive_xyz_function_surface/bonbon.py new file mode 100644 index 0000000..b464e76 --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/bonbon.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = 'u' +op.y_eq = 'cos(u)*sin(v)' +op.z_eq = 'cos(u)*cos(v)' +op.range_u_min = 0.0 +op.range_u_max = 6.2831854820251465 +op.range_u_step = 32 +op.wrap_u = False +op.range_v_min = 0.0 +op.range_v_max = 6.2831854820251465 +op.range_v_step = 128 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/boy.py b/source/presets/mesh.primitive_xyz_function_surface/boy.py new file mode 100644 index 0000000..2537883 --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/boy.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = '2/3* (cos(u)* cos(2*v) + sqrt(2)* sin(u)* cos(v))* cos(u) / (sqrt(2) - sin(2*u)* sin(3*v))' +op.y_eq = 'sqrt(2)* cos(u)* cos(u) / (sqrt(2) - sin(2*u)* sin(3*v))' +op.z_eq = '2/3* (cos(u)* sin(2*v) - sqrt(2)* sin(u)* sin(v))* cos(u) / (sqrt(2) - sin(2*u)* sin(3*v))' +op.range_u_min = 0.0 +op.range_u_max = 3.1415927410125732 +op.range_u_step = 32 +op.wrap_u = False +op.range_v_min = 0.0 +op.range_v_max = 3.1415927410125732 +op.range_v_step = 64 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/catalan.py b/source/presets/mesh.primitive_xyz_function_surface/catalan.py new file mode 100644 index 0000000..8c87675 --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/catalan.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = 'u-sin(u)*cosh(v)' +op.y_eq = '4*sin(1/2*u)*sinh(v/2)' +op.z_eq = '1-cos(u)*cosh(v)' +op.range_u_min = -3.1415927410125732 +op.range_u_max = 9.42477798461914 +op.range_u_step = 32 +op.wrap_u = False +op.range_v_min = -2.0 +op.range_v_max = 2.0 +op.range_v_step = 128 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/catenoid.py b/source/presets/mesh.primitive_xyz_function_surface/catenoid.py new file mode 100644 index 0000000..98e12ba --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/catenoid.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = '2*cosh(v/2)*cos(u)' +op.y_eq = 'v' +op.z_eq = '2*cosh(v/2)*sin(u)' +op.range_u_min = -3.1415927410125732 +op.range_u_max = 3.1415927410125732 +op.range_u_step = 32 +op.wrap_u = True +op.range_v_min = -3.1415927410125732 +op.range_v_max = 3.1415927410125732 +op.range_v_step = 128 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/clifford_torus.py b/source/presets/mesh.primitive_xyz_function_surface/clifford_torus.py new file mode 100644 index 0000000..7e14f55 --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/clifford_torus.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = 'cos(u+v)/(sqrt(2.)+cos(v-u))' +op.y_eq = 'sin(v-u)/(sqrt(2.)+cos(v-u))' +op.z_eq = 'sin(u+v)/(sqrt(2.)+cos(v-u))' +op.range_u_min = 0.0 +op.range_u_max = 3.140000104904175 +op.range_u_step = 8 +op.wrap_u = False +op.range_v_min = 0.0 +op.range_v_max = 6.2831854820251465 +op.range_v_step = 128 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/cochlea.py b/source/presets/mesh.primitive_xyz_function_surface/cochlea.py new file mode 100644 index 0000000..0e9ed68 --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/cochlea.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = 'v*cos(u)' +op.y_eq = 'v*sin(u)' +op.z_eq = '0.4*u' +op.range_u_min = 0.0 +op.range_u_max = 12.566370964050293 +op.range_u_step = 32 +op.wrap_u = False +op.range_v_min = 0.0 +op.range_v_max = 2.0 +op.range_v_step = 32 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/cosinus.py b/source/presets/mesh.primitive_xyz_function_surface/cosinus.py new file mode 100644 index 0000000..a8b3e5d --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/cosinus.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = 'u' +op.y_eq = 'sin(pi*((u)**2+(v)**2))/2' +op.z_eq = 'v' +op.range_u_min = -1.0 +op.range_u_max = 1.0 +op.range_u_step = 32 +op.wrap_u = False +op.range_v_min = -1.0 +op.range_v_max = 1.0 +op.range_v_step = 128 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/dini.py b/source/presets/mesh.primitive_xyz_function_surface/dini.py new file mode 100644 index 0000000..aef4591 --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/dini.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = 'a*cos(u)*sin(v)' +op.y_eq = 'a*sin(u)*sin(v)' +op.z_eq = '(cos(v)+log(tan(v/2)+1e-2)) + b*u' +op.range_u_min = 0.0 +op.range_u_max = 12.566370964050293 +op.range_u_step = 128 +op.wrap_u = False +op.range_v_min = 0.0 +op.range_v_max = 2.0 +op.range_v_step = 128 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '1' +op.b_eq = '0.2' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/enneper.py b/source/presets/mesh.primitive_xyz_function_surface/enneper.py new file mode 100644 index 0000000..ebeb4d7 --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/enneper.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = 'u -u**3/3 + u*v**2' +op.y_eq = 'u**2 - v**2' +op.z_eq = 'v -v**3/3 + v*u**2' +op.range_u_min = -2.0 +op.range_u_max = 2.0 +op.range_u_step = 32 +op.wrap_u = False +op.range_v_min = -2.0 +op.range_v_max = 2.0 +op.range_v_step = 32 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/helicoidal.py b/source/presets/mesh.primitive_xyz_function_surface/helicoidal.py new file mode 100644 index 0000000..d6c4bf1 --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/helicoidal.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = 'sinh(v)*sin(u)' +op.y_eq = '3*u' +op.z_eq = '-sinh(v)*cos(u)' +op.range_u_min = -3.1415927410125732 +op.range_u_max = 3.1415927410125732 +op.range_u_step = 32 +op.wrap_u = False +op.range_v_min = -3.1415927410125732 +op.range_v_max = 3.1415927410125732 +op.range_v_step = 32 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/helix.py b/source/presets/mesh.primitive_xyz_function_surface/helix.py new file mode 100644 index 0000000..ba22cac --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/helix.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = '(1-0.1*cos(v))*cos(u)' +op.y_eq = '0.1*(sin(v) + u/1.7 -10)' +op.z_eq = '(1-0.1*cos(v))*sin(u)' +op.range_u_min = 0.0 +op.range_u_max = 12.566370964050293 +op.range_u_step = 128 +op.wrap_u = False +op.range_v_min = 0.0 +op.range_v_max = 6.2831854820251465 +op.range_v_step = 128 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/hexahedron.py b/source/presets/mesh.primitive_xyz_function_surface/hexahedron.py new file mode 100644 index 0000000..d532eb6 --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/hexahedron.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = 'cos(v)**3*cos(u)**3' +op.y_eq = 'sin(u)**3' +op.z_eq = 'sin(v)**3*cos(u)**3' +op.range_u_min = -1.2999999523162842 +op.range_u_max = 1.2999999523162842 +op.range_u_step = 32 +op.wrap_u = False +op.range_v_min = 0.0 +op.range_v_max = 6.2831854820251465 +op.range_v_step = 32 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/hyperhelicoidal.py b/source/presets/mesh.primitive_xyz_function_surface/hyperhelicoidal.py new file mode 100644 index 0000000..74feb2c --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/hyperhelicoidal.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = '(sinh(v)*cos(3*u))/(1+cosh(u)*cosh(v))' +op.y_eq = '(cosh(v)*sinh(u))/(1+cosh(u)*cosh(v))' +op.z_eq = '(sinh(v)*sin(3*u))/(1+cosh(u)*cosh(v))' +op.range_u_min = -3.1415927410125732 +op.range_u_max = 3.1415927410125732 +op.range_u_step = 32 +op.wrap_u = False +op.range_v_min = -3.1415927410125732 +op.range_v_max = 3.1415927410125732 +op.range_v_step = 128 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/klein.py b/source/presets/mesh.primitive_xyz_function_surface/klein.py new file mode 100644 index 0000000..cc568d7 --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/klein.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = '(3*(1+sin(v)) + 2*(1-cos(v)/2)*cos(u))*cos(v)' +op.y_eq = '(4+2*(1-cos(v)/2)*cos(u))*sin(v)' +op.z_eq = '-2*(1-cos(v)/2)*sin(u)' +op.range_u_min = 0.0 +op.range_u_max = 6.2831854820251465 +op.range_u_step = 32 +op.wrap_u = True +op.range_v_min = 0.0 +op.range_v_max = 6.2831854820251465 +op.range_v_step = 128 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/moebius.py b/source/presets/mesh.primitive_xyz_function_surface/moebius.py new file mode 100644 index 0000000..020ddbc --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/moebius.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = 'cos(v)+u*cos(v/2)*cos(v)' +op.y_eq = 'u*sin(v/2)' +op.z_eq = 'sin(v)+u*cos(v/2)*sin(v)' +op.range_u_min = -0.4000000059604645 +op.range_u_max = 0.4000000059604645 +op.range_u_step = 32 +op.wrap_u = False +op.range_v_min = 0.0 +op.range_v_max = 6.2831854820251465 +op.range_v_step = 32 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/pseudo_catenoid.py b/source/presets/mesh.primitive_xyz_function_surface/pseudo_catenoid.py new file mode 100644 index 0000000..b21df38 --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/pseudo_catenoid.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = '2.2*(2*cosh(v/2)*cos(u)) ' +op.y_eq = '1.51166 * (2*cosh(v/2)*sin(u) * sin((2.2*(2*cosh(v/2)*cos(u)) - -11.0404)*2*pi*1/22.0513) + 1.8*(v) * cos((2.2*(2*cosh(v/2)*cos(u)) - -11.0404)*2*pi*1/22.0513)) ' +op.z_eq = '1.51166 * (2*cosh(v/2)*sin(u) * cos((2.2*(2*cosh(v/2)*cos(u)) - -11.0404)*2*pi*1/22.0513) - 1.8*(v) * sin((2.2*(2*cosh(v/2)*cos(u)) - -11.0404)*2*pi*1/22.0513)) ' +op.range_u_min = -3.1415927410125732 +op.range_u_max = 3.1415927410125732 +op.range_u_step = 32 +op.wrap_u = False +op.range_v_min = -3.1415927410125732 +op.range_v_max = 3.1415927410125732 +op.range_v_step = 128 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/pseudosphere.py b/source/presets/mesh.primitive_xyz_function_surface/pseudosphere.py new file mode 100644 index 0000000..2bcb373 --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/pseudosphere.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = 'cos(u)*cos(v)+sin((sin(u)+1)*2*pi) ' +op.y_eq = '4*sin(u) ' +op.z_eq = 'cos(u)*sin(v)+cos((sin(u)+1)*2*pi) ' +op.range_u_min = -1.5707963705062866 +op.range_u_max = 1.5707963705062866 +op.range_u_step = 32 +op.wrap_u = False +op.range_v_min = 0.0 +op.range_v_max = 6.2831854820251465 +op.range_v_step = 128 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/ridged_torus.py b/source/presets/mesh.primitive_xyz_function_surface/ridged_torus.py new file mode 100644 index 0000000..96cddfc --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/ridged_torus.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = 'a*cos(u)+(b*sin(f*u)+c)*cos(u)*cos(v)' +op.y_eq = 'a*sin(u)+(b*sin(f*u)+c)*sin(u)*cos(v)' +op.z_eq = '(b*sin(f*u)+c)*sin(v)' +op.range_u_min = 0.0 +op.range_u_max = 6.2831854820251465 +op.range_u_step = 128 +op.wrap_u = False +op.range_v_min = 0.0 +op.range_v_max = 6.2831854820251465 +op.range_v_step = 32 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '5' +op.b_eq = '0.6' +op.c_eq = '2' +op.f_eq = '10' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/shell.py b/source/presets/mesh.primitive_xyz_function_surface/shell.py new file mode 100644 index 0000000..d2437bb --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/shell.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = 'cos(v)*(1+cos(u))*sin(v/8)' +op.y_eq = 'sin(u)*sin(v/8)+cos(v/8)*1.5' +op.z_eq = 'sin(v)*(1+cos(u))*sin(v/8)' +op.range_u_min = 0.0 +op.range_u_max = 6.2831854820251465 +op.range_u_step = 32 +op.wrap_u = True +op.range_v_min = 0.0 +op.range_v_max = 12.566370964050293 +op.range_v_step = 128 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/sine.py b/source/presets/mesh.primitive_xyz_function_surface/sine.py new file mode 100644 index 0000000..d6b9fa5 --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/sine.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = 'sin(u)' +op.y_eq = 'sin(v)' +op.z_eq = 'sin(u+v)' +op.range_u_min = 0.0 +op.range_u_max = 6.2831854820251465 +op.range_u_step = 128 +op.wrap_u = True +op.range_v_min = 0.0 +op.range_v_max = 6.2831854820251465 +op.range_v_step = 128 +op.wrap_v = True +op.close_v = True +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/snake.py b/source/presets/mesh.primitive_xyz_function_surface/snake.py new file mode 100644 index 0000000..b2c4269 --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/snake.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = '1.2*(1 -v/(2*pi))*cos(3*v)*(1 + cos(u)) + 3*cos(3*v)' +op.y_eq = '9*v/(2*pi) + 1.2*(1 - v/(2*pi))*sin(u)' +op.z_eq = '1.2*(1 -v/(2*pi))*sin(3*v)*(1 + cos(u)) + 3*sin(3*v)' +op.range_u_min = 0.0 +op.range_u_max = 6.2831854820251465 +op.range_u_step = 32 +op.wrap_u = False +op.range_v_min = 0.0 +op.range_v_max = 6.2831854820251465 +op.range_v_step = 64 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/sterosphere.py b/source/presets/mesh.primitive_xyz_function_surface/sterosphere.py new file mode 100644 index 0000000..366b81c --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/sterosphere.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = '2.*u/(u*u+v*v+1.)' +op.y_eq = '(u*u+v*v-1.)/(u*u+v*v+1.)' +op.z_eq = '2.*v/(u*u+v*v+1.)' +op.range_u_min = -2.0 +op.range_u_max = 2.0 +op.range_u_step = 32 +op.wrap_u = False +op.range_v_min = -2.0 +op.range_v_max = 2.0 +op.range_v_step = 32 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/torus.py b/source/presets/mesh.primitive_xyz_function_surface/torus.py new file mode 100644 index 0000000..82b5923 --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/torus.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = '(1+0.5*cos(u))*cos(v)' +op.y_eq = '0.5*sin(u)' +op.z_eq = '(1+0.5*cos(u))*sin(v)' +op.range_u_min = 0.0 +op.range_u_max = 6.2831854820251465 +op.range_u_step = 32 +op.wrap_u = False +op.range_v_min = 0.0 +op.range_v_max = 6.2831854820251465 +op.range_v_step = 128 +op.wrap_v = False +op.close_v = False +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' diff --git a/source/presets/mesh.primitive_xyz_function_surface/twisted_torus.py b/source/presets/mesh.primitive_xyz_function_surface/twisted_torus.py new file mode 100644 index 0000000..b94eff6 --- /dev/null +++ b/source/presets/mesh.primitive_xyz_function_surface/twisted_torus.py @@ -0,0 +1,22 @@ +import bpy +op = bpy.context.active_operator + +op.x_eq = 'cos(u)*(6-(5./4. + sin(3*v))*sin(v-3*u))' +op.y_eq = '(6-(5./4. + sin(3*v))*sin(v-3*u))*sin(u)' +op.z_eq = '-cos(v-3*u)*(5./4.+sin(3*v))' +op.range_u_min = 0.0 +op.range_u_max = 6.2831854820251465 +op.range_u_step = 128 +op.wrap_u = True +op.range_v_min = 0.0 +op.range_v_max = 6.2831854820251465 +op.range_v_step = 32 +op.wrap_v = True +op.close_v = True +op.n_eq = 1 +op.a_eq = '0' +op.b_eq = '0' +op.c_eq = '0' +op.f_eq = '0' +op.g_eq = '0' +op.h_eq = '0' -- 2.30.2 From b21e4b3356738c1f66be1f64ebb93fb482a75fe1 Mon Sep 17 00:00:00 2001 From: Nika Kutsniashvili Date: Mon, 8 Jul 2024 14:24:46 +0400 Subject: [PATCH 2/2] Dont try to unregister install_presets --- source/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/source/__init__.py b/source/__init__.py index 18fe13f..b6f8c23 100644 --- a/source/__init__.py +++ b/source/__init__.py @@ -426,7 +426,6 @@ def unregister(): unregister_class(cls) add_mesh_rocks.unregister() - install_presets.unregister() if __name__ == "__main__": register() -- 2.30.2