Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

MAX SDK : PB2Value <-> Value (or FPValue)

MAX SDK : PB2Value <-> Value (or FPValue)

denisT.MaxDoctor
Advisor Advisor
943 Views
8 Replies
Message 1 of 9

MAX SDK : PB2Value <-> Value (or FPValue)

denisT.MaxDoctor
Advisor
Advisor

can anyone point me to built-in methods from/to  Value and PB2Value

 

thanks

0 Likes
Accepted solutions (1)
944 Views
8 Replies
Replies (8)
Message 2 of 9

istan
Advisor
Advisor

PBAccessor does this.

0 Likes
Message 3 of 9

denisT.MaxDoctor
Advisor
Advisor

Are you sure about PBAccessor?

0 Likes
Message 4 of 9

istan
Advisor
Advisor

what exactly you need? I thought you want immediate action on ui input? Or do you simply ask about Set/GetValue()?

0 Likes
Message 5 of 9

klvnk
Collaborator
Collaborator
Accepted solution

Don't think theres anything in the core, something like this for PB2Value to Value ....

 

Value* GetValueFromPB(IParamBlock2* pb, ParamID id, ParamType2 type)
{
	PB2Value& pb2val =  pb->GetPB2Value(id);
	switch(type)
	{
		case TYPE_INT:
		case TYPE_BOOL:
		case TYPE_TIMEVALUE:
		case TYPE_RADIOBTN_INDEX:
		case TYPE_INDEX:

			return Integer::intern(pb2val.i);

		case TYPE_FLOAT: 
		case TYPE_ANGLE:
		case TYPE_PCNT_FRAC:
		case TYPE_WORLD:
		case TYPE_COLOR_CHANNEL:

			return Float::intern(pb2val.f);
		
		case TYPE_POINT3:
		case TYPE_RGBA:
		case TYPE_HSV:

			return new Point3Value(*pb2val.p);

	.....
	}
}
0 Likes
Message 6 of 9

istan
Advisor
Advisor

did you look into \maxsdk\include\maxscript\maxwrapper\mxsobjects.h?

 

 

0 Likes
Message 7 of 9

denisT.MaxDoctor
Advisor
Advisor

this is exactly what i do... i couldn't find any sdk built-in solution. it doesn't exist

0 Likes
Message 8 of 9

denisT.MaxDoctor
Advisor
Advisor

the SDK definitely needs ip's methods PB2Value <->  FPValue

0 Likes
Message 9 of 9

denisT.MaxDoctor
Advisor
Advisor

case TYPE_TIMEVALUE:

         return int_value(pb2val.i);

         return time_value(pb2val.t);

 

 

it seams more correct

0 Likes