Object creation

 
 
 
Posted by:kyle
Data created:9 June 2009
If I wanted to create spheres and other base primitives. Is there something I'm missing Interface.CreateInstance() causes a crash and the CLASS_ID defines for the base types seem to be missing.
Hi Kyle,\nI seem to have no problem creating object instances using Interface.CreateInstance(...)

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Hi Kyle,\nI seem to have no problem creating object instances using Interface.CreateInstance(...)\nFor example,\nobject maxInstance = Plugin.Instance.Global.COREInterface.CreateInstance( classDesc.SuperClassID, classDesc.ClassID );\nexecutes fine for any give ClassDesc.\nCan you show any code that reproduces the crash?\nFor the base type class ids, you have to get them manually from .h files and build using global.ClassID( parta, partb ). Here is an enumeration of ClassID types I did from inside Max:\nhttp://www.ephere.com/file.download?p=MaxDotNet&r=Files&f=Utilities.cs\nHope this helps.\nMarsel
Hi Kyle,

I seem to have no problem creating object instances using Interface.CreateInstance(...)

For example,

object maxInstance = Plugin.Instance.Global.COREInterface.CreateInstance( classDesc.SuperClassID, classDesc.ClassID );

executes fine for any give ClassDesc.

Can you show any code that reproduces the crash?

For the base type class ids, you have to get them manually from .h files and build using global.ClassID( parta, partb ). Here is an enumeration of ClassID types I did from inside Max:

http://www.ephere.com/file.download?p=MaxDotNet&r=Files&f=Utilities.cs

Hope this helps.

Marsel

Marsel Khadiyev (Software Developer, EPHERE Inc.)

P.S. In your case casting to IGeomObject should work, but not sure how useful that is to you at the moment.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Are the parts not yet implemented documented somewhere?
There is no concrete list of classes that are not being upcast at the moment. Currently all super class id's are being cast to their appropriate interfaces (ie. WSM_CLASS_ID -> IModifier, PARAMETER_BLOCK_CLASS_ID -> IIParamBlock, etc.) From the derived classes that come with the SDK only following are currently being cast: Materials: MultiMtl, StdMat2 Texmaps: StdMirror, StdCubic, GradTex, BitmapTex Systems: IXRefObject Atmospherics: StdFog Misc.: ILayerManager, MtlBaseLib As I mentioned, this list will be much more complete in the next few builds.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Oh, and it will also properly cast all managed plugins, if there are any. So if its supposed to return MyManagedClass, you can safely cast to that.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Do you know when you expect to have those changes up?
Should be up in a week or so. Are you doing something urgent?

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Nope, we just want to properly evaluate the library I'm just trying to get a feel for when we can see a more complete version.
Hi Kyle, Sorry for the delay. I am currently working on updating Max.NET and it should be available soon. I will let you know when it is up. Which version of Max are you using? - Marsel

Marsel Khadiyev (Software Developer, EPHERE Inc.)

We're currently using Max2009.
Hi Kyle, New build is now up with additions you requested. - Marsel

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Those things certainly help, thanks.