-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added "Receive From Socar" generator (ext) node #3281
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nothing to add, it"s a straightforward node.
I was a bit skeptical about the default mesh data (takes over 500 lines of code). If required, I"ll revert back to a simple cube data (8 v, 12 e, 6 f) |
we can provide a geometry module in |
COOL! |
I expect that when a new mesh will be set to the node properties Sverchok node tree will be evaluated three times in a row. What is not very cool. |
I’ll remove the “update” for verts and edges property. The props are set in this very order, so the update will be called one time only, AFTER the data has been set. |
there"s a lot of ways to implement this kind of node, usually only a steady stream of users will show us what they really need |
I would suggest to remove update function from all properties and add a method to the node, like this: def set_mesh(self, verts, edges, faces):
self.verts = verts,
self.edges = edges
self.faces = faces
updateNode(self, None) It will make setting mesh process more clear. |
Nice and clean! Working on it.. |
here"s that logo compressed into import sverchok
from sverchok.nodes.modifier_make.solidify import solidify
def make_sorcar_logo():
""" makes sorcar 3d - literal data"""
a = 0.4233
b = 0.7778
c = 0.6878
d = 0.3333
e = 1.0
f = 0.9100
g = 0.8678
h = 0.2433
i = 0.6456
j = 0.5556
k = 0.4656
l = 0.2011
m = 0.1111
n = 0.0211
verts_2d = [
(-a, -b), (-c, -b), (-b, -c), (-b, -d), (-e, -d), (-e, -f), (-f, -e), (-d, -e),
(-d, -g), (-h, -b), (+h, -b), (+d, -g), (+d, -e), (+f, -e), (+e, -f), (+e, -d),
(+b, -d), (+b, -c), (+c, -b), (+a, -b), (+d, -c), (+d, -i), (+a, -j), (+k, -j),
(+j, -k), (+j, -l), (+k, -m), (+a, -m), (+d, -n), (+d, +n), (+h, +m), (-h, +m),
(-d, +l), (-d, +k), (-h, +j), (+h, +j), (+d, +k), (+d, +a), (+a, +d), (+k, +d),
(+j, +a), (+j, +k), (+k, +j), (+a, +j), (+d, +i), (+d, +c), (+a, +b), (+c, +b),
(+b, +c), (+b, +d), (+e, +d), (+e, +f), (+f, +e), (+d, +e), (+d, +g), (+h, +b),
(-h, +b), (-d, +g), (-d, +e), (-f, +e), (-e, +f), (-e, +d), (-b, +d), (-b, +c),
(-c, +b), (-a, +b), (-d, +c), (-d, +i), (-a, +j), (-k, +j), (-j, +k), (-j, +l),
(-k, +m), (-a, +m), (-d, +n), (-d, -n), (-h, -m), (+h, -m), (+d, -l), (+d, -k),
(+h, -j), (-h, -j), (-d, -k), (-d, -a), (-a, -d), (-k, -d), (-j, -a), (-j, -k),
(-k, -j), (-a, -j), (-d, -i), (-d, -c)
]
verts_3d = [(v[0], v[1], 0.05) for v in verts_2d]
face = list(range(len(verts_3d)))
verts, edges, faces, _ = solidify(verts_3d, [face], [0.1])
return verts, edges, faces |
can we merge? |
I haven’t updated the code yet. Will push the new method with compressed mesh by tomorrow. Also, I was thinking of adding 3 new component mask outputs so that we can retain the selection. |
from sverchok.utils.modules.geom_sorcar import make_sorcar_logo | ||
|
||
class SvReceiveFromSorcarNode(bpy.types.Node, SverchCustomTreeNode): | ||
''' Receive Mesh Data From Sorcar ''' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have a useful scheme for this , and it makes tooltips for our menus automatically
"""
Triggers: sorcar sc receive
Tooltip: Receive Mesh Data From Sorcar
A short description for reader of node code <---not mandatory, but you could include links of interest.
"""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I don"t have any links of interest (maybe except for this PR as it has some info on the top), so I"ll create a separate small description and add some comments in the code.
|
||
verts: StringProperty(name='Vertices', | ||
default=repr([sc_v]), | ||
options={'ANIMATABLE'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
animatable is redundant. this is the default state of properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied the code from generators -> sphere.py
when I started, so I thought this was the standard way Sverchok node properties were made. It also has a one-line description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, but it"s not so useful to restate the default. i"m not going to retrospectively remove them, but whenever a node gets added or updated i try to nip that in the bud.
|
||
|
||
def unregister(): | ||
bpy.utils.unregister_class(SvReceiveFromSorcarNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a new empty line
utils/modules/geom_sorcar.py
Outdated
verts_3d = [(v[0], v[1], 0.05) for v in verts_2d] | ||
face = list(range(len(verts_3d))) | ||
verts, edges, faces, _ = solidify(verts_3d, [face], [0.1]) | ||
return verts, edges, faces |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a new empty line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other than these things, it seems OK. i"m sure our adventurous users will be happy to have this kind of convenience. glad we can collaborate in this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for all the effort!
utils/modules/geom_sorcar.py
Outdated
verts_3d = [(v[0], v[1], 0.05) for v in verts_2d] | ||
face = list(range(len(verts_3d))) | ||
verts, edges, faces, _ = solidify(verts_3d, [face], [0.1]) | ||
return verts, edges, faces |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other than these things, it seems OK. i"m sure our adventurous users will be happy to have this kind of convenience. glad we can collaborate in this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at this point it"s more useful to have users ride the node than suggesting code changes.
Missing "Send to Sorcar" node in SV And also getting error when sending to SV from SC.
|
Sorry, issue from my side. I modified the "Receive From Sorcar" node in the last few commits which allows you to get selection mask as well, but the code for Sorcar node is not yet updated.
Testing for bugs currently, as selection mask inputs have been added to that node as well. Will be creating a separate PR for it. |
@aachman98 Did a separate PR ever get created to add the "Send to Sorcar" node? As of now, it appears to still be missing. |
ATM |
Addressed problem description
Addition of a generator node to receive data input from node output. This is a dedicated node which presents a one-sided connection between Sverchok & Sorcar where mesh data is transferred from the latter.
Node Name: Receive From Sorcar
Node Category: Generators -> Generators Extended
Class Name: SvReceiveFromSorcarNode
Solution description
Usage
The node comes with 6 outputs: Vertices, Edges, Faces, VerticesMask, EdgesMask, FacesMask
Each of the socket corresponds to the components of the mesh data being stored in the node properties (namely "verts", "edges", "faces") and the their selection mask.
Default
By default, a simple Sorcar logo mesh is contained. The node behaves as a single-mesh-output node unless paired with node in the Sorcar nodetree.
Referenced
This node can be referenced inside Sorcar, and the mesh data of the object (passed as input) is transferred to this node. The node properties hold the data (unless modified externally) allowing users to remove/modify Sorcar nodetree or the object in the scene without losing the geometry.
Parameter updates
This node will update in the same way as expected from all the other Sverchok nodes. Since the mesh data and component masks are stored internally, re-evaluating Sorcar nodetree is not necessary.
In case of any update of parameters in Sorcar, the new mesh will be set in the properties once when the node gets executed, and will act as the new starting point. No further evaluations are required.
In the following examples, I first modify the Sverchok nodetree (added "Unsubdivide" node) and then modify a Sorcar node parameter ("Offset" in Poke node) to demonstrate the seamless non-destructive workflow.
Video demo: https://www.youtube.com/watch?v=pTIiMj5GpyI
Preflight checklist