Reading array parsed via FPValue in C++ SDK

Reading array parsed via FPValue in C++ SDK

Anonymous
Not applicable
824 Views
4 Replies
Message 1 of 5

Reading array parsed via FPValue in C++ SDK

Anonymous
Not applicable

Let's assume that I have a maxscript witch returns a constant array with sub arrays as below.

myArray = #( #(1,2,3), #(4,5,6), #(7,8,9), #(10,11,12) )

 

I'm calling a maxscript that returns above array in C++. 

 

 

FPValue fpv;
ExecuteMAXScriptScript( cmdStr, false, &fpv );

How can I read array from a FPValue? I need to get elements in sub arrays of the returned array.

0 Likes
825 Views
4 Replies
Replies (4)
Message 2 of 5

denisT.MaxDoctor
Advisor
Advisor

why do you want to make your life more complicated?

is it not easier to read (get) an Array than a FPValue?

 

 

whatever... if you do everything right the FPValue will get an Array value in .v  property

Message 3 of 5

Anonymous
Not applicable

Thank you for the answer.


Could  you please elaborate "is it not easier to read (get) an Array than a FPValue?".

Is there an easier way to return multiple values from maxscript and get it to C++ end?

0 Likes
Message 4 of 5

denisT.MaxDoctor
Advisor
Advisor

how do you pass "cmdStr" variable (argument) to SDK? Depending on it you can find a way to pass an Array value

0 Likes
Message 5 of 5

Anonymous
Not applicable

Value of the cmdStr is,

 

 

fileIn "path/to/maxscript/script.ms"

 

 

Content of maxscript,

(
	abcd = 0
	
	fn MyFunc =
	(
		myArray = #( #(1,2,3), #(4,5,6), #(7,8,9), #(10,11,12) )
		return myArray
	)

	on execute do
	(
		abcd = MyFunc()
		abcd
	)
)

It is executed as,

ExecuteMAXScriptScript( "fileIn \"path/to/maxscript/script.ms\"", false, &fpv  )

I was not been able to read returned array from fpv.v

0 Likes