9
$\begingroup$

How can I transfer a collection of float values to a node socket​​?

This is what I've tried:

  • Create a list of float values ​​and convert each of them to a string
  • Pass the string to the socket
  • In the right place in the script, I will retrieve the float values by accessing the string values from within an eval() function:

list_x = eval(self.inputs['Points'].VectorProperty.x)

list_y = eval(self.inputs['Points'].VectorProperty.y)

list_point = list(zip(list_x, list_y))

I understand that this is not correct. But what is the correct way to do this?

code

$\endgroup$
1
  • $\begingroup$ Is there something wrong with just using a float vector as is? $\endgroup$
    – wchargin
    Commented Oct 21, 2013 at 2:51

1 Answer 1

1
$\begingroup$

In the case you are describing you can use the NodeSocketVector a socket. It is a built in NodeSocket.

class MyNode(Node):
    def init(self):
        self.outputs.new('NodeSocketVector', name="Vector")

    def get_output_vector_value(self):
        return self.inputs[0].default_value
$\endgroup$

You must log in to answer this question.

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