0
$\begingroup$

The objects have a Custom Property called RequiredVerticesArray, which stores the indices of the vertices that should be displayed.

How to read this array through Geometry Nodes and display only these vertices?

Essentially, I need the Mask Modifier functionality, but without creating a separate vertex group for each object. Because different objects can have the same mesh, but must display different vertices.

If I cannot directly pass RequiredVerticesArray, is it possible to pass it as a string like "1, 2, 3, 4, ..." and then convert it into an array inside the geometry nodes?

$\endgroup$
6
  • $\begingroup$ Well you need to discriminate those vertices somehow... By their position? By the fact they're not connected to any edges? You could specify in the modifier panel how many such vertices they are and require that those vertices have the first indices... $\endgroup$ Commented Jun 25 at 10:33
  • $\begingroup$ No, it is not possible. You should store data inside Attributes $\endgroup$
    – Crantisz
    Commented Jun 25 at 11:04
  • $\begingroup$ @Crantisz what is impossible specifically? $\endgroup$ Commented Jun 25 at 11:33
  • $\begingroup$ @MarkusvonBroady Pass array/string into Geometry Nodes $\endgroup$
    – Crantisz
    Commented Jun 25 at 11:34
  • $\begingroup$ @Crantisz I think OP by array means vertices, which act as an array as far as data is concerned - see How to instantiate objects on individual/selected points in geometry nodes? (section: "Using another geometry"). Also you can pass a string as an input in the modifier panel. $\endgroup$ Commented Jun 25 at 11:38

2 Answers 2

0
$\begingroup$

Passing an array/string into Geometry Nodes is not possible, You should store data inside Attributes.

Here is an example how you can do this using Python:

import bpy
import random
import bmesh

obj = bpy.context.object

# Get BMesh to manipulate mesh data:
me = obj.data
bpy.ops.object.mode_set(mode='EDIT')
bm = bmesh.from_edit_mesh(me)

# Make an int attribute:
if 'Test Int' not in bm.verts.layers.int.keys():
    bm.verts.layers.int.new('Test Int')
    
intLayer = bm.verts.layers.int['Test Int']
   
# Set a random int in each vertex:
for v in bm.verts:
    v[intLayer] = random.randint(1,10)
    
bmesh.update_edit_mesh(me)

In my example, I store random integer in each vertex, you should put your code here, that reads data from file or so

After that, you can get Test Int attribute like this:

enter image description here

$\endgroup$
0
$\begingroup$

If you have identical geometry, you can transfer data from one to another using Sample nearest node:

enter image description here

Sample nearest finds nearest point at given geometry and returns index of this point, that you can use in Sample Index node. Sample Index can return the attribute value from this point.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .