Notifications
Clear all

[Closed] Need help with 3dsMax SDK, 3DXI, paramblocks

I am after a chunk of data that comes from a path constraint, called the % along path. This is an animatable value, and it looks like it is stored in the paramblocks2 for animatable values, according to header file comments.

My problem is i have no idea how to get to this data. Is it a part of the constraint, the controller, the node’s paramblock, or something else. And if it is in the nodes paramblock, how would i go about accessing this data.

I mostly use the IGame(3DXI) interface for exporting the data, however i have had to jump into the maxNodes to get to certain pieces of data.

I can access this property in maxscript i just do not know how it all translates back into IGame(3DXI), or the Max SDK.
This will get you the information from maxscript:

showProperties $.pos.controller.PathConstraint.percent

And it appears that pos.controller is a controller, and .PathConstraint is a SubAnim.

Thanks.

12 Replies

Hi Justin,

You can easily access these informations with 3DXI :

IGameControl* Control = Node->GetIGameControl();
IGameConstraint* Constraint = Control->GetConstraint(IGAME_POS); // Parameter can be IGAME_POS / IGAME_ROTI / IGAME_TM

I’m also a 3ds max SDK programmer, but it seems that there aren’t so much SDK programmers in this forum. Here is two 3ds max SDK forums :

http://dl3d.free.fr/phpBB2/viewforum.php?f=3

http://sparks.discreet.com/webboard/wbpx.dll/~maxsdk (It seems that this forum will disappear in the near future…)

That is what i suspected, however whenever I try and get the constraint pointer it is just a NULL pointer.

Is there something i must do first to prepare the control or constraint information?

Thanks

Look at “path_cnstrnt.cpp” in “samples\controllers” : this file contains path controller source code.

I think you can only access percent value of the path constraint using his parameter block ; percent property is at index 0 (path_percent is defined in the SDK).

This is what i have been struggling to do, I do not understand how to get access to the paramblock of the contraint. I have been playing around with the paramblocks, but is there one unified paramblock for each node, or does each contraint, animation, etc attached to a node have it’s own paramblock entry.

Thanks for your help, i will continue to dig into the paramblocks.

This is what i have been struggling to do, I do not understand how to get access to the paramblock of the contraint. I have been playing around with the paramblocks, but is there one unified paramblock for each node, or does each contraint, animation, etc attached to a node have it’s own paramblock entry.

I faced the same problems and asked myself this question :).

I’ve not enough knowledge on this subject, so I think the best solution for you is to post a topic about this problem in the first forum I’ve mentionned.

EDITED: sorry, I’ll post my answer later.

Hi.

I don’t know about the IGame interface but I faced this very problem a while ago. I had to access to the properties of a material created with MAXScript. Obviously I hadn’t got the definition file for this material.

So I created a ParamBlock manager through which I could access to any parameter of any Animatable object. Here I show you a little snip of my implementation.

This is the header:

/**********************************************
/* File: ParamBlockMngr.h
/* Author: Jonathan Garcia a.k.a HalfVector
/* Date: April 2006
/**********************************************/

#ifndef __HParamBlockMngr__H
#define __HParamBlockMngr__H

#include <Max.h>
#include <StdMat.h>
#include <iparamb2.h>

class ParamBlockMngr
{
public:

	static float GetFloat(Animatable *anim, TCHAR *name, TimeValue t = 0, int tabIndex = 0);

private:

	ParamBlockMngr() {}

	static BOOL GetParamID(Animatable *anim, TCHAR *name, int &blockIndex, int &id);
};

#endif

This is the source:

/**********************************************
/* File: ParamBlockMngr.cpp
/* Author: Jonathan Garcia a.k.a HalfVector
/* Date: April 2006
/**********************************************/

float ParamBlockMngr::GetFloat(Animatable *anim, TCHAR *name, TimeValue t, int tabIndex)
{
	assert(anim && name);
	
	float value = 0.0f;

	int blockIndex, id;
	if(GetParamID(anim, name, blockIndex, id))
	{
		IParamBlock2 *pb = anim->GetParamBlock(blockIndex);
	
		value = pb->GetFloat(id, t, tabIndex);
	}
	
	return value;
}

BOOL ParamBlockMngr::GetParamID(Animatable *anim, TCHAR *name, int &blockIndex, int &id)
{
	assert(anim && name);

	int nParamBlocks = anim->NumParamBlocks();
	for(blockIndex = 0; blockIndex < nParamBlocks; blockIndex++)
	{
		IParamBlock2 *pb = anim->GetParamBlock(blockIndex);

		if(!pb) continue;

		int nParams = pb->NumParams();
		for(int i = 0; i < nParams; i++)
		{
			id = pb->IndextoID(i);

			ParamDef def = pb->GetParamDef(id);

			if(!_tcsicmp(name, def.int_name))
				return TRUE;
		}
	}

	return FALSE;
}

And the way to retrieve the percentage parameter from a path constraint:

float percent = ParamBlockMngr::GetFloat(node->GetTMController()->GetPositionController(), _T("percent"));

Hope that helps.

Thank you very much HalfVector, I would have most likely struggled with this for another week. Now I can move on to much more fun things.

And, thank you for your support and advice as well ypuech, I know have a collection of forums to revieve help on MaxSDK related problems.

Best Regards

When stepping through this code, the only two values that it finds associated with the controller is the “weight” and “average” value. So my guess is the paramblock is not stored here. Any idea’s where it might be stored? Also i am using 3dsmax 8.0, do you know if maybe they relocated something since thiscode was written?

1 Reply
(@halfvector)
Joined: 11 months ago

Posts: 0

I don’t know, I tried this code in MAX8 and I was able to retrieve the percentage property. I’ll try again later.

Page 1 / 2