IntPtr for Vertices

 
 
 
Posted by:MichiMichbeck
Data created:29 June 2010

Hey Marsel, I am currently trying to access the vertex-index list of an IMNFace. In c++ you just get a pointer to an int array. In Max.net you get an IntPtr. I am new to C# programming - can you tell me how to use this IntPtr? It looks like

IMNFace poly;
int vert_index_1;

vert_index_1 = poly.Vtx(0) ???

poly.Vtx gives the IntPtr in this case!

Thx in advance
Regards, Michbeck

I'll have a look at that for the next build, thanks.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Those properties should be available as int arrays in next build.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Hey Michbeck,

New build is out which addresses all issues you have accumulated over the past while.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Thx for the new build Marsel! The installation was successful but when compiling my plugIns an error is thrown which says that there that method NotifyRefChanged(...) is not found anymore to be overriden!

public override RefResult NotifyRefChanged(IInterval changeInt, IReferenceTarget hTarget, ref UIntPtr partID, RefMessage message)
{
    return RefResult.Succeed;
}

I have to comment the method in order to compile correctly, but the method is essential I think and my PlugIn doesnt work as before. Is this method now implemented somewhere else?

Regards, Michbeck     

Please reinstall it again (delete Autodesk.Max.dll first). I have made some fixes to the build today and I think this should fix it.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

I always delete all files concerning Max.Net before reinstalling - did it again now, but the method NotifyRefChanged(...) is not found as supposed to!

I'll check this out. Which 3dsmax version are you using again?

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Thank you. Its 3dsmax 2009 32bit at the moment.

Ok I'll look at it. I'm on Max 2010 and I do rely on NotifyRefChanged too, which seems to be working fine. So must be 2009/9 thing.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Ok I think this should be sorted. Try reinstalling again.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Hey Marsel, the installation worked fine and the NotifyRefChanged is correctly found again! But I have the feeling that something might not be correct. I compiled my extrusion modifier and the parameter block is actually ignored by the program - a change of the parameter value for extrusion doesnt invoke a call to ModifyObject() what is essentiell and worked for the last builds! Maybe you have changed something more in that build that is related to the NotifyRefChanged?

Furthermore there is one more IntPtr which acutally should be a List<int>. It is in the method IMNMesh.newFace(... IntPtr ...) ! Would be nice if you correct this for the next build! Maybe there are more IntPtr in the context of MNMesh!

Thx Marsel
Regards, Michbeck

Hi Michbeck,

So the parameters appear in the modifier properly but any change to them doesn't invoke any update? I'm trying to track down what could be causing that. There have been many internal changes in the last build so its quite possible that something got disconnected.

I'll also look into IMNMesh.newFace(...). Unfortunately it is very hard to detect where arrays should be used instead of pointers automatically, so that stuff needs to be specified manually. If you find more places let me know and I'll convert those for future builds.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Hi Michbeck,

Are you still experiencing this problem. I'd like to nail it down.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Hey Marsel, as we were discussing several issues in this thread please tell me which problem you are referring to? The remaining IntPtr - problems will be fixed with the next builds, right?

Greets
Michbeck

Hi Michbeck,

I was referring to the problem of Modify(...) function not being called after parameter changes. I will fix the remaining IntPtr in the next build, yes.

Cheers

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Yeah, somehow the function is not called! I tested it with a similar plugin in c++ and it is called properly.

Regards
MIchbeck

Ok I'll dig into it again I guess, not sure why that'd happen. From the code I looked at everything should be wired up properly. I guess I'll have to made a diff. to see exactly what I changed between last two builds.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Hey Marsel - just to make it clear I checked the problem of Modify-method not being called after parameter changes over the last 3 builds: It only works in the build I have been developing my Modifier (simple Extrusion) with - build 1.2.1.0 ! It doesnt work with the current build and it doesnt work with the older version 1.2.0.0 ! I also tried your Plane-Sample with one parameter and it works in all of these versions - so maybe it is a problem with the modifier-classes only.

Have fun at the Siggraph 2010! All the Best!
Michbeck

Hey Michbeck,

Thanks for this info, it is very useful. I will try to narrow down what in particular I changed in 1.2.1 and hopefully that will shed some light. I have also successfully tried the plane sample. I will also be doing work to ensure Texmap plugins work properly in next build, and will look at Modifiers and making them work too after Siggraph.

Thanks for the kind wishes!

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Hey Marsel - I hope you enjoyed the Siggraph :)

I see the new build is online since 7.August - does it fix some of the issues we were discussing about in the recent threads (avoid IntPtr, modifier problems etc.) or are you just working on it?

Best Regards
Michbeck

Hey Michbeck,

Thanks, yeah Siggraph was a blast :) The IntPtr problem is resolved (from what remember), at least in places where you pointed out. Or maybe I'm missing something. The modifier not updating on parameter change is probably still there as I just didn't have enough time to get to it yet. I am releasing another build today probably so hopefully I'll take a look at the modifier update issue for next one.

If there's anything urgent you need to fix please let me know.

Marsel

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Hey Marsel, ok I'll check out the latest builds - nothing urgent at the moment!

Michbeck