Notifications
Clear all

[Closed] Change SuperClass C++

Can I change a superclass for an node? I’m making a basic mesh object but don’t want the user to ever convert it to something or make it renderer.

I guess what would be nice is make a object then change it to a helper. But have it in the “Create Geometry” panel.

Or would be similar to the FumeFX object that is.


"----Class Of----------------------"
FumeFX
"----SuperClass Of-----------------"
GeometryClass

3ds max will not let you convert it to editable anything and the fume grid does not render.

Any thoughts

18 Replies

I guess it would be nice if there was a SetRenderable to work with IsRenderable() on the object level

 lo1

Return an empty mesh from GetRenderMesh.

Also return FALSE from CanConvertTo.

so what should I feed GetRenderMesh() not to make it render and what do I need in the third spot something about a View?


	BOOL Delete = FALSE;

	ip = GetCOREInterface();
	TimeValue t = GetCOREInterface()->GetTime();

	INode* node = theRender.ip->GetINodeByName(_T("Object001"));

	ObjectState os = node->EvalWorldState(t,TRUE);
	GeomObject *obj = (GeomObject*)os.obj;
	Mesh *mesh = obj->GetRenderMesh(t, node, ?, Delete);


I have not looked at the Don’t Convert yet

 lo1

Oh, I assumed you control the object source code, I didn’t realize you’re trying to do this for existing objects.

I might be going about this in a dumb way.

I have a Geometry plugin that makes a LOGO on creation. Say like multiscatter plugin would do. I want there to be no way the user can convert the logo into an editpoly or any item. I also don’t want the logo to render.

So I guess I’m not really doing this the correct way…

here is where I make it


int Render_ObjectCreateCallBack::proc(ViewExp *vpt,int msg, int point, int /*flags*/, IPoint2 m, Matrix3& mat ){
	if ( ! vpt || ! vpt->IsAlive() ){
		DbgAssert(!_T("Invalid viewport!"));
		return FALSE;
	}

	if (msg == MOUSE_POINT || msg == MOUSE_MOVE) {
		switch(point) {
		case 0: // only happens with MOUSE_POINT msg
			ob->suspendSnap = TRUE;
			sp0 = m;
			p0 = vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE);
			mat.SetTrans(p0);
			theRender.EditObject();  <- here is where I edit my new Logo
			ExecuteMAXScriptScript(_T("max modify mode"), 0, 0); <- didn't find the c++ yet 
			break;
		}
	}
	return FALSE;
}

Not sure if i will get away with this but…

I have changed this


virtual SClass_ID SuperClassID() { return GEOMOBJECT_CLASS_ID; }

to

virtual SClass_ID SuperClassID() { return HELPER_CLASS_ID; }

Max now thinks its a Dummy Object and does not render it.

 lo1

Oh, so you are in control of the code. In that case you should do what I suggested earlier.
I’m not sure what the problem is, just override CanConvertTo and always return FALSE.

hahaha, I didn’t understand how the Object Plugin class worked. I started with a basic class that didn’t have them when I started.


Object* MYCLASS::ConvertToType(TimeValue t, Class_ID obtype){
	//return SimpleObject::ConvertToType(t,obtype);
	return FALSE;
}


int MYCLASS::CanConvertToType(Class_ID obtype){
	return FALSE;
}


Mesh* MYCLASS::GetRenderMesh(TimeValue t, INode *inode, View& view, BOOL& needDelete) {
	Mesh *nmesh = new Mesh;
	return nmesh;
}

What you told me was right on the money.
Thanks for your help

Page 1 / 2