3ds Max .net C# Morpher Change Properties

3ds Max .net C# Morpher Change Properties

Anonymous
Not applicable
957 Views
5 Replies
Message 1 of 6

3ds Max .net C# Morpher Change Properties

Anonymous
Not applicable

I have a valid IModifier Object that represents a morpher.

How it is possible to change the properties for example the morph target weights with .net ?

Thank you !

 

ps:

The .NET technology was introduced to make programming easier and safer.
3ds .net is almost not documented at all, what sense does it make if you have to work through the complicated c ++ code to understand the .NET variant?

Unbenannt.png

0 Likes
958 Views
5 Replies
Replies (5)
Message 2 of 6

denisT.MaxDoctor
Advisor
Advisor

I will be very surprised if there is anything in MAX .NET to work with the Morpher modifier.

 

The fact is that the whole interface with the Morpher is built on a specially provided set of functions and methods know as class MorphR3 (c++) and WM3_MC_* (mxs).

 

 

0 Likes
Message 3 of 6

Anonymous
Not applicable

with .net you get quite far.
But there is a problem in detail:
morphWeight.GetConstraint(controlType) fails


code.png

 

Assembly wrappersAssembly = Assembly.Load("Autodesk.Max.Wrappers, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
  Type type = wrappersAssembly.GetType("Autodesk.Max.Wrappers.IGameMorpher");
  ConstructorInfo constructor = type.GetConstructors()[0];
  IIGameMorpher morpher = (IIGameMorpher)constructor.Invoke(new object[] { modifier.NativePointer, false });

  for (int ii = 0; ii < morpher.NumberOfMorphTargets; ii++)
  {
   IIGameControl morphWeight = morpher.GetMorphWeight(ii);

   // For each control type (float, vec3...)
   var controlTypes = Enum.GetValues(typeof(IGameControlType)).Cast<IGameControlType>();
   foreach (var controlType in controlTypes)
   {
    IIGameConstraint constraint = morphWeight.GetConstraint(controlType);
    if (constraint != null)
    {
     // Never reach here 😞
    }
   }

  }

0 Likes
Message 4 of 6

denisT.MaxDoctor
Advisor
Advisor

my answer was on your original question where you asked about how to set weight...

 

IGame is all about how to get only

0 Likes
Message 5 of 6

Anonymous
Not applicable

Thanks for the information. That was inaccurately described by me. In the first stage 'get weight' would be enough.
I see it has no purpose and I have to work through the unmanaged SDK to really understand the context. As an experienced c ++ SDK developer, do you have any idea what's wrong with the above code?

0 Likes
Message 6 of 6

denisT.MaxDoctor
Advisor
Advisor

why C#?

 

in c++ everything is clear (as well as in MXS)

 

maybe just execute mxs string form c# to get the value? it's ugly i know, but you really need it and need it quick...   

 

IGame doesn't provide a morph weight value if weight is not animated (doesn't have any controller) as i can see. 

0 Likes