How can I create a tag which has same outputs as Vertex Map tag?
-
I want to create a tag with the outputs(vertex weights) same as Vertex Map.
I know I can generate Vertex Map directly, but I don't want do that.
I want a simple example.
Please! -
Hello @lingza,
Thank you for reaching out to us. Your question is a bit ambiguous; I will answer in a series of statements.
- You cannot implement a custom
VertexMapTag
, the type has not even been wrapped for Python. You also cannot implement aVariableTag
, the parent class ofVertexMapTag
. Both classes are what some languages call a 'sealed' class, you cannot inherit from them. - Read and write access for vertexmaps must happen via the abstracted
VariableTag
interface in Python. - If you want to implement a tag which outputs to a vertexmap, the only option is to add a linkbox to that tag and then write to that linked tag. This can result in a bit clunky user experience but works well enough. I used this pattern for example in a presentation for a German university Maxon held. At the example of "local thickness", a tag that writes the local volume for each vertex via ray casting. The example was more aimed at prototyping, and was only realized as a programming tag, but is in practice the same as a full-blown plugin. You can find the setup here and the repository here.
- In C++ you have a different option, a
CustomDataTag
, an entity of the maxon API which is realized by implementing two interfaces, the class and display interface. Such tag is similar as it also allows to write per vertex or polygon data (with much more flexibility for which type of data you can write) and then to display that data in some shaded fashion on a mesh. TheCustomDataTag
is however NOT a replacement for aVertexMapTag
, i.e., you cannot use aCustomDataTag
instance in place of aVertexMapTag
.
In the end it depends on what you mean with '[the] same as [a] vertex map'. If you just want something similar in functionality, the C++ interface
CustomDataTag
is what you are looking for. If you want to write vretexmap data as aVertexMapTag
, you must use the pattern lined out under point 3.Cheers,
Ferdinand - You cannot implement a custom
-
@ferdinand Thank you so much!
I am not professional in c++.I optimze my workflow with Density Map in ZRemesher in Remesh generator.
ZRemesher uses vertex weights from the vertex map as density map after I put a vertex map into Density Map linkbox.Actually, I mean that I want to create a tag which contains the vertex weights, then vertex weights are used by ZRemesher after I put the tag into Density Map linkbox.
So I don't need a "vertex map" indeed, but I need a tag I describe above. -
Hello @lingza,
well as lined out, you cannot implement a
VertexmMapTag
which is the same as a normalVertexMapTag
but has extra parameters to realize your desired functionality.You can solve this problem with either the pattern I described under point 3 in my last posting, or by implementing a
ToolData
plugin which simply generates the tag. The solution using a driver tag has the advantage that the user can continuously tweak the output of the vertexmap, while a tool must be picked up again.Actually, I mean that I want to create a tag which contains the vertex weights, then vertex weights are used by ZRemesher after I put the tag into Density Map linkbox.
So I don't need a "vertex map" indeed, but I need a tag I describe above.This is unfortunately not true. You will need a vertex map tag, as this parameter, the Density Map parameter, will accept only a
VertexMapTag
. It will not know what to do with aCustomDataTag
. I would recommend having a look at the project file I have posted above, it contains a practical example for the pattern of a tag driving a vertex map.Cheers,
Ferdinand