[Closed] Max SDK and Curve Control
I’ve been trying to add Curve Control (ICurveCtl) to my max map. I’ve gotten it working pretty well so far. It has its own reference so it gets saved correctly and works very well.
However, the problem arises when I have multiple maps with curve control. It doesn’t properly update the curve control view then I switch between the materials. So I have some kind of curve set up in MyMat_A and then open MyMat_B it shows the curve from MyMat_A in MyMat_B:s curve control view.
So basicly ALL maps with the curve control show the same curve from one of the curve controls however they still work correctly when rendering for example .
I think this is because I haven’t properly set up curves resourcemaker. (curve->RegisterResourceMaker()).
This following code crashes max every time and I’m not really sure why:
class DummyRefMaker : public ReferenceMaker {
public:
DummyRefMaker(BerconNoise *m) {berconNoise = m;}
BerconNoise *berconNoise;
void DeleteThis() {delete this;}
virtual void* GetInterface(ULONG id);
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID,RefMessage message){return REF_DONTCARE;}
};
void *DummyRefMaker::GetInterface(ULONG id) {
if(id == I_RESMAKER_INTERFACE)
return (void *) (ResourceMakerCallback *) berconNoise;
else
return ReferenceMaker::GetInterface(id);
}
And when I set up the curve I do this:
curve->RegisterResourceMaker(new DummyRefMaker(this));
Which feeds the DummyRefMaker pointer to my map.
Of course I can leave the whole RegisterResourceMaker stuff out but then problem which I first describes occurs, which I think is related to not registering the resource makers, I might be wrong about that.
Hi Jerry,
I take it you’ve pulled ccutil.cpp apart to see how it works? (sdk\howto\utilities\ccutil)
I’m a bit stuck for time at the moment, or I’d try and help you out a bit more. Sorry:shrug:
Dave
Well I still haven’t found a sollution for this problem. Does anybody have ideas what could cause this problem with curve control?
The example file only allows a single curve control window so I can’t really use it as guide here as it might have the same problem.
EDIT:
The problem is probably related to how material editor handles rollouts.
If I change from MyMat#1->Noise->MyMat#2 curve control is properly updated.
However if I go from MyMat#1->MyMat#2 it doesn’t work. It most likely just updates all the values on parameter block and doesn’t recreate the rollout and so it fails to update curve control.
Still no light at the end of the tunnel. The problem is that curve control doesn’t get message to update itself I guess, since it doesn’t really have any connections to paramblock.
When switching between two MyMat (in medit) it only sends WM_PAINT event to dlgproc and I can’t really use this to force any updates on curve control since it creates infinite loop if I do, I’m not even sure what commands I should use to force update it.
I know this can be done since Fallof map uses it, however the source code of Falloff map that comes with SDK is old and doesn’t have curve control. I guess the new one is made by 3rd party and so Autodesk doesn’t have rights to release its source code…