Skip to content

Commit

Permalink
Update regular_solid to work with 4.3 (#5184)
Browse files Browse the repository at this point in the history
* Update regular_solid to work with 4.3

Added message to install "Extra Mesh Objects" to make this node work again

* update documentation
  • Loading branch information
vicdoval authored Jan 8, 2025
1 parent 05dd50c commit 2faf3da
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
11 changes: 9 additions & 2 deletions docs/nodes/generators_extended/regular_solid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ Regular Solid
Functionality
-------------

This node is a port to the Regular Solid functions (by dreampainter) now part of the Extra Objects Add-on bundled with Blender
This node is a port to the Regular Solid functions (by dreampainter) now part of the 'Extra Mesh Objects' Add-on that can be downloaded from the "Get Extensions" panel in the Blender properties
(https://archive.blender.org/wiki/index.php/Extensions:2.6/Py/Scripts/Add_Mesh/Add_Solid/)

It creates Platonic, Archimedean or Catalan solids


Inputs & Parameters
-------------------

Expand Down Expand Up @@ -68,4 +69,10 @@ Variations of the cube:
* Add: Vector-> :doc:`Vector Math </nodes/vector/math_mk3>`
* Matrix-> :doc:`Matrix In </nodes/matrix/matrix_in_mk4>`
* List->List Struct-> :doc:`List Repeater </nodes/list_struct/repeater>`
* Viz-> :doc:`Viewer Draw </nodes/viz/viewer_draw_mk4>`
* Viz-> :doc:`Viewer Draw </nodes/viz/viewer_draw_mk4>`


Notes
-----

As this node takes functions form the 'Extra Mesh Objects' add-on it wont work if the add-on is not installed, please download it before using the node
20 changes: 17 additions & 3 deletions nodes/generators_extended/regular_solid.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,27 @@
#
# ##### END GPL LICENSE BLOCK #####


import bpy

from bpy.props import IntProperty, FloatProperty, BoolProperty, EnumProperty, FloatVectorProperty
try:
from add_mesh_extra_objects.add_mesh_solid import createSolid
except ImportError:
createSolid = None
try:
import os
addons_dir = os.path.join(bpy.utils.resource_path('USER'), "extensions", "blender_org")
addon_path = os.path.join(addons_dir, "extra_mesh_objects", "add_mesh_solid.py")

if not os.path.exists(addon_path):
createSolid = None
else:
import importlib.util
spec = importlib.util.spec_from_file_location("add_mesh_solid", addon_path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
createSolid = module.createSolid
except:
createSolid = None

from mathutils import Vector
from sverchok.node_tree import SverchCustomTreeNode
Expand Down Expand Up @@ -230,7 +244,7 @@ def process(self):
return

if createSolid is None:
str_error = "There is no 'add_mesh_extra_objects' library. Node 'Regular Solid' does not work for a while. (In Blender 4.2-alpha)"
str_error = "This node needs 'Extra Mesh Objects' add-on installed to work properly"
print(str_error)
raise Exception(str_error)

Expand Down

0 comments on commit 2faf3da

Please sign in to comment.