Notifications
Clear all

[Closed] 3dsmax SDK adventure

Thanks for the tips Rogier, I’ll give them a try asaic.

On a slightly different note, it seems the mov’s on your home site are missing, I’d like to check them out some of them look really interesting.

Thanks again.

1 Reply
(@gumtree)
Joined: 10 months ago

Posts: 0

Hmmm, that’s a worry… All of them?
They seem to be there when I just checked a few. I think that some of the links of the 640×480 size movies may be dead as I didn’t have the space to upload them. All the 320×240 mov’s that load into the pages should be there. Maybe you’re missing a codec?

Here are direct links to the first three, that way you can download them and view them with your preferred viewer… I believe I encoded them with the Sorensen Video 3 codec.

http://www.rogierfransen.com.au/GumData/movies/Ghost_CustomPFlowPlugin_320.mov
http://www.rogierfransen.com.au/GumData/movies/StreetBoat_CustomDynamicsPlugin_320.mov
http://www.rogierfransen.com.au/GumData/movies/RippingClothTest_CustomDynamicsPlugin_320.mov

Rogier

This is a handy function that will return the base Editable_Poly object. The good thing is that it works even though there are modifiers on the object. It does something very similar to:
$.baseObject
in MaxScript.

Notice that you muse use pnode->GetObjectRef() and then objectRef->FindBaseObject() to get the base object.

So far I have found that it’s possible to improve the functions in MaxScripts alot, it’s possible to make them far faster. However every time you think you are finished there always popup another tricky problem situation, the sdk has many more of these kinds of problems I’m afraid.

/Andreas

MNMesh* GetMNMeshFromNode(INode* pnode)
{
	//The function returns a pointer to the MNMesh object of an Editable_Poly object. If it's not an editable_poly it will cause a MaxScript Exception	
	
	Object* objectRef=pnode->GetObjectRef();	
	Object* baseObject=objectRef->FindBaseObject();
	MNMesh* mm=0;
	TSTR idName;
	baseObject->GetClassName(idName); //The name of the BaseObject Class for example Editable_Poly
	bool isPoly=true;
	
	if (baseObject->ClassID()==EPOLYOBJ_CLASS_ID) //Verify that node is an OBJECT
	{				
		EPoly *cd=(EPoly *)(baseObject->GetInterface(EPOLY_INTERFACE));
		mm=cd->GetMeshPtr();
	}
	else
		isPoly=false;

	if (isPoly ==false) { throw RuntimeError("The object is not an Editable_Poly");}

	return mm;    
}

This is a small function that returns the position of an Edge (so the center point of the edge).

As you see the vertices of an MNMesh (that you have for Editable_Polys) can be reached by
mm->v[index]



Point3 GetEdgePos(MNMesh* mm, int edgeNbr)
{
	//Calculates the middle position of an Edge
	Point3 EdgePos;
	Point3* p1;
	Point3* p2;
	
	p1=&(mm->v[(mm->e[edgeNbr].v1)].p);
	p2=&(mm->v[(mm->e[edgeNbr].v1)].p);
	EdgePos.x=(p1->x+p2->x)/2;
	EdgePos.y=(p1->y+p2->y)/2;
	EdgePos.z=(p1->z+p2->z)/2;

	return EdgePos;
}

To create a new Editable_Poly object (and a node) write like this (I will update this example more when I have found more about it):


	PolyObject *newObj = CreateEditablePolyObject();
	INode *node = GetCOREInterface()->CreateObjectNode(newObj);

Important.
If you get link errors when you add CreateEditablePolyObject then you must include the library functions.
This one needs the library:
Poly.lib

You add these libraries in the Solution Properties and
Linker/Input/Additinal Dependencies. My dependencies look like this for my current project:

mnmath.lib odbc32.lib odbccp32.lib comctl32.lib bmm.lib core.lib geom.lib gfx.lib mesh.lib maxutil.lib maxscrpt.lib gup.lib paramblk2.lib Poly.lib

Here you can see that I’m using the math, mesh, maxscript and poly functions.

/Andreas

Hey, I need to kind of bump this thread

Does anyone know how to pass max names, ie. #thing, #hello, #whatever to a new function in an extension?

Thanks guys.

f97ao
does anyone happened to stumble in a way in max SDK to create a viewport window attached in a roullout, sorry to ask but i want to build a small lightmanager with some CG shading language included and i wanted to try and put it inside my rollout along with all the other light components…
hugs
bernielomax

Nope, but I have tried. It doesn’t work as Integer that is for sure.

Some of the things are very difficult in the sdk I must say. To create a new editable_poly object and to do it was sure is difficult. I have spent two weeks on that problem alone, but it looks like it will turn out fast in the end.

Regarding viewports in rollout, I think you will have serious problems with that I’m afraid. Max has many restrictions regarding viewports and it doesn’t seem to be easy to create floating viewports etc. Has anyone drawn lines in the viewports by the way. I need to do that in a plugin, but haven’t started yet. I remember that in MaxScript the lines always flickered, but this should hopefully be possible to solve in the sdk.

Is anyone running Visual 2005 with Max 8 by the way? I just installed 2005 here home, but I have problem compiling my plugins.

/Andreas

You’d think that maxscript extensions would be one of the most documented in the maxsdk, I found a great reference, in the maxsdk\samples\maxscript\mxsagni. A great many maxscript exposures are define in this project, it’s helped me quite a bit.

I figured out how to do the name thing.

You can type check with:
is_name()

and you can make a comparison with:
arr_list[i] == Name::intern(“yournamehere”);

You could probably do something better with a define and some enums though, but that’s the basics.

Now I have a different question, I’m busy making a function that takes a ray defined in script, casts it through the scene and finds all objects that it intersects with it, returning : #(#(object, intersection ray (pos + normal), distance from ray origin), …), I have a few uses for this, now I need to add a filter: option to it, does anyone know how to pass and execute a maxscript using variables in c++?

Thanks.

Im a newbe when its come to maxSDK so please forgive me if Im being real dumb . I have just installed the max SDK and installed Microsoft Visual Studio .NET 2003 . now Im trying to get the 3dsmaxPluginWizard to run . Ive edited the ABSOLUTE PATH parameter to reflect the new location of the 3dsmaxPluginWizard root directory. Ive aslo changed the first line of the 3dsmaxPluginWizard.vsz file from VSWIZARD 7.0 to VSWIZARD 7.1 .
but when I go to make a new project using the PluginWizard I get an error ” Object with program ID VsWizard.VsWizardEngine cannot be created”. Im running 3Dmax 8 by the way.
would anyone here know why Im getting this error ? any tips would be great .

thanks for reading

ok I sorted it , seems I needed to download an updated 3dsmaxPluginWizard . it seems to be working now . now I just need to learn how to use it .

Page 3 / 4