8
$\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$
  • $\begingroup$ Is there something wrong with just using a float vector as is? $\endgroup$ – wchargin Oct 21 '13 at 2:51
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$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.