Page 1 of 1

RealFlow Vector type

Posted: Fri Oct 11, 2013 11:42 pm
by jesse nicodemus
Hello,

I seem to be having trouble with the RealFlow Vector type. I am using a python function that gets all parameters then grabs all their values. Some of the values are pointers for RealFlow Vector. Type(foo) is successfully identifying the vectors but the if statement will not except RealFlow Vector as a type to check against.

# this works
rfKeys = node.getParameter('Scale')
if type(rfKeys) is float:
scene.message('is a float')
else:
scene.message('is not a float')


# this does not work
# it will also break if I replace the vector with a float or str.
rfKeys = node.getParameter('Scale')
if type(rfKeys) is RealFlow Vector:
scene.message('is a RealFlow Vector')
else:
scene.message('is not a RealFlow Vector')


type(rfKeys) returns <type,'RealFlow Vector'> but will not check for it.

I have also tried:
RealFlowVector
Vector


Is there another way to test for this? Any information would be great.

Thanks,

Jesse

Re: RealFlow Vector type

Posted: Mon Oct 14, 2013 11:02 am
by LuisMiguel
Hello jesse,

have you tried with PARAM_TYPE_VECTOR?.

luisM.

Re: RealFlow Vector type

Posted: Mon Oct 14, 2013 9:21 pm
by jesse nicodemus
Hello Luis,

That did not seem to work. Rather than testing against the output of type(attr) I converted to a string and that is working.

attrTest = type(attr)
if str(attrTest) == "<type 'RealFlow Vector'>":
scene.message('success')

Re: RealFlow Vector type

Posted: Tue Oct 15, 2013 12:57 pm
by Alex
Another way could be something like this:

Code: Select all

vectorType = type(Vector.new())
...
if type(attr) is vectorType:
  scene.message('success')