-
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
WISHLIST: SV Custom SET and GET Attribute for Geometry Nodes instancing #3960
Comments
If it can be done in python then it can be done in sverchok |
Yes, I am trying to dig more into it. Bradley Animation is using AN version with some extra nodes from Kuldeep Singh to set custom attribute. |
In the past, we have already Attribute "Col". But in recent Blender there is also "Geometry" etc which I hardly used. But probably related to Geometry Nodes instancing. https://docs.blender.org/manual/en/latest/render/shader_nodes/input/attribute.html |
Currently reading this: |
This is looks like original code of the node. code if object is None: return object
if object.type != "MESH": self.raiseErrorMessage("Object should be Mesh type.")
if attName == "": self.raiseErrorMessage("Attribute name can't be empty.")
attribute = object.data.attributes.get(attName)
if attribute is None:
attribute = object.data.attributes.new(attName, self.dataType, self.domain)
elif attribute.data_type != self.dataType or attribute.domain != self.domain:
object.data.attributes.remove(attribute)
attribute = object.data.attributes.new(attName, self.dataType, self.domain)
if self.domain == "POINT":
amount = len(object.data.vertices)
elif self.domain == "EDGE":
amount = len(object.data.edges)
elif self.domain == "CORNER":
amount = len(object.data.loops)
else:
amount = len(object.data.polygons)
if self.dataType == "FLOAT":
_data = FloatList.fromValues(VirtualDoubleList.create(data, 0).materialize(amount))
elif self.dataType == "INT":
_data = VirtualLongList.create(data, 0).materialize(amount)
elif self.dataType == "FLOAT2":
_data = VirtualVector2DList.create(data, Vector((0, 0))).materialize(amount)
elif self.dataType == "FLOAT_VECTOR":
_data = VirtualVector3DList.create(data, Vector((0, 0, 0))).materialize(amount)
elif self.dataType in ["FLOAT_COLOR", "BYTE_COLOR"]:
_data = VirtualColorList.create(data, Color((0, 0, 0, 0))).materialize(amount)
else:
_data = VirtualBooleanList.create(data, False).materialize(amount)
if self.dataType in ["FLOAT", "INT", "BOOLEAN"]:
attribute.data.foreach_set("value", _data.asMemoryView())
elif self.dataType in ["FLOAT2", "FLOAT_VECTOR"]:
attribute.data.foreach_set("vector", _data.asMemoryView())
else:
attribute.data.foreach_set("color", _data.asMemoryView())
attribute.data.update()
return object |
So far, the most interesting bits of Geometry Nodes is the ability to separate Vertex Color data like "SvCol" XYZ, then inject it back into Geometry Nodes mesh. |
Hey @Durman, I noticed an interesting tool in your screenshot. And quite useful. |
Do you mean spreadsheet editor? This is not what can be done with Python so it is build-in functionality. Now it's in 2.93 Blender version. It shows some attributes of selected mesh. Later more functionality will be added like filtering, editing values and etc. So it's on early development stage. |
Oh! I see! It is great to know it's coming and thanks! |
@enzyme69 or someone else, do you have any ideas in mind about usecases for the |
It's probably for Geometry Nodes and instancing and things like Attribute Transfer node. If SV nodes can provide data like for example for index instance. Set Mesh Atrribute ... maybe:
I think Kuldeep shows some Animation Nodes set and get custom attribute. |
This idea would be pretty useful for use it with geonodes fields. |
Snapshot:
As shown by Bradley Animation with Animation Nodes here:
https://www.youtube.com/watch?v=EmMyxSRGhRc
I am wondering if SV can support the creation of Custom Attribute (Points) and fill it values so that Geometry Nodes can understand the value and using it for instancing.
The text was updated successfully, but these errors were encountered: