Bercon
01-07-2008, 02:07 PM
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.
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.
