|
@@ -61,11 +61,7 @@ namespace Max2Babylon
|
|
|
|
|
|
public static IntPtr GetNativeHandle(this INativeObject obj)
|
|
public static IntPtr GetNativeHandle(this INativeObject obj)
|
|
{
|
|
{
|
|
-#if MAX2015 || MAX2016 || MAX2017
|
|
|
|
return obj.NativePointer;
|
|
return obj.NativePointer;
|
|
-#else
|
|
|
|
- return obj.Handle;
|
|
|
|
-#endif
|
|
|
|
|
|
|
|
}
|
|
}
|
|
static Assembly GetWrappersAssembly()
|
|
static Assembly GetWrappersAssembly()
|
|
@@ -122,59 +118,7 @@ namespace Max2Babylon
|
|
}
|
|
}
|
|
|
|
|
|
public static IMatrix3 Identity { get { return Loader.Global.Matrix3.Create(XAxis, YAxis, ZAxis, Origin); } }
|
|
public static IMatrix3 Identity { get { return Loader.Global.Matrix3.Create(XAxis, YAxis, ZAxis, Origin); } }
|
|
-
|
|
|
|
-#if !MAX2015 && !MAX2016 && !MAX2017
|
|
|
|
- unsafe public static int GetParamBlockIndex(IIParamBlock paramBlock, string name)
|
|
|
|
- {
|
|
|
|
- for (short index = 0; index < paramBlock.NumParams; index++)
|
|
|
|
- {
|
|
|
|
- IGetParamName gpn = Loader.Global.GetParamName.Create("", index);
|
|
|
|
-
|
|
|
|
- paramBlock.NotifyDependents(Tools.Forever, (UIntPtr)gpn.Handle.ToPointer(), RefMessage.GetParamName, (SClass_ID)0xfffffff0, false, null);
|
|
|
|
-
|
|
|
|
- if (gpn.Name == name)
|
|
|
|
- {
|
|
|
|
- return index;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return -1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- public static int GetParamBlockValueInt(IIParamBlock paramBlock, string name)
|
|
|
|
- {
|
|
|
|
- var index = Tools.GetParamBlockIndex(paramBlock, name);
|
|
|
|
-
|
|
|
|
- if (index == -1)
|
|
|
|
- {
|
|
|
|
- return 0;
|
|
|
|
- }
|
|
|
|
- return paramBlock.GetInt(index, 0);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public static float GetParamBlockValueFloat(IIParamBlock paramBlock, string name)
|
|
|
|
- {
|
|
|
|
- var index = Tools.GetParamBlockIndex(paramBlock, name);
|
|
|
|
-
|
|
|
|
- if (index == -1)
|
|
|
|
- {
|
|
|
|
- return 0;
|
|
|
|
- }
|
|
|
|
- return paramBlock.GetFloat(index, 0);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public static float[] GetParamBlockValueColor(IIParamBlock paramBlock, string name)
|
|
|
|
- {
|
|
|
|
- var index = Tools.GetParamBlockIndex(paramBlock, name);
|
|
|
|
-
|
|
|
|
- if (index == -1)
|
|
|
|
- {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- return paramBlock.GetColor(index, 0).ToArray();
|
|
|
|
- }
|
|
|
|
-#endif
|
|
|
|
|
|
+
|
|
public static Vector3 ToEulerAngles(this IQuat q)
|
|
public static Vector3 ToEulerAngles(this IQuat q)
|
|
{
|
|
{
|
|
// Store the Euler angles in radians
|
|
// Store the Euler angles in radians
|
|
@@ -607,46 +551,27 @@ namespace Max2Babylon
|
|
public static void SetStringProperty(this IINode node, string propertyName, string defaultState)
|
|
public static void SetStringProperty(this IINode node, string propertyName, string defaultState)
|
|
{
|
|
{
|
|
string state = defaultState;
|
|
string state = defaultState;
|
|
-#if MAX2015 || MAX2016 || MAX2017
|
|
|
|
node.SetUserPropString(propertyName, state);
|
|
node.SetUserPropString(propertyName, state);
|
|
-#else
|
|
|
|
- node.SetUserPropString(ref propertyName, ref state);
|
|
|
|
-#endif
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public static bool GetBoolProperty(this IINode node, string propertyName, int defaultState = 0)
|
|
public static bool GetBoolProperty(this IINode node, string propertyName, int defaultState = 0)
|
|
{
|
|
{
|
|
int state = defaultState;
|
|
int state = defaultState;
|
|
-#if MAX2015 || MAX2016 || MAX2017
|
|
|
|
node.GetUserPropBool(propertyName, ref state);
|
|
node.GetUserPropBool(propertyName, ref state);
|
|
-#else
|
|
|
|
- node.GetUserPropBool(ref propertyName, ref state);
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
return state == 1;
|
|
return state == 1;
|
|
}
|
|
}
|
|
|
|
|
|
public static string GetStringProperty(this IINode node, string propertyName, string defaultState)
|
|
public static string GetStringProperty(this IINode node, string propertyName, string defaultState)
|
|
{
|
|
{
|
|
string state = defaultState;
|
|
string state = defaultState;
|
|
-#if MAX2015 || MAX2016 || MAX2017
|
|
|
|
node.GetUserPropString(propertyName, ref state);
|
|
node.GetUserPropString(propertyName, ref state);
|
|
-#else
|
|
|
|
- node.GetUserPropString(ref propertyName, ref state);
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
return state;
|
|
return state;
|
|
}
|
|
}
|
|
|
|
|
|
public static float GetFloatProperty(this IINode node, string propertyName, float defaultState = 0)
|
|
public static float GetFloatProperty(this IINode node, string propertyName, float defaultState = 0)
|
|
{
|
|
{
|
|
float state = defaultState;
|
|
float state = defaultState;
|
|
-#if MAX2015 || MAX2016 || MAX2017
|
|
|
|
node.GetUserPropFloat(propertyName, ref state);
|
|
node.GetUserPropFloat(propertyName, ref state);
|
|
-#else
|
|
|
|
- node.GetUserPropFloat(ref propertyName, ref state);
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
return state;
|
|
return state;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -654,28 +579,16 @@ namespace Max2Babylon
|
|
{
|
|
{
|
|
float state0 = 0;
|
|
float state0 = 0;
|
|
string name = propertyName + "_x";
|
|
string name = propertyName + "_x";
|
|
-#if MAX2015 || MAX2016 || MAX2017
|
|
|
|
node.GetUserPropFloat(name, ref state0);
|
|
node.GetUserPropFloat(name, ref state0);
|
|
-#else
|
|
|
|
- node.GetUserPropFloat(ref name, ref state0);
|
|
|
|
-#endif
|
|
|
|
|
|
|
|
|
|
|
|
float state1 = 0;
|
|
float state1 = 0;
|
|
name = propertyName + "_y";
|
|
name = propertyName + "_y";
|
|
-#if MAX2015 || MAX2016 || MAX2017
|
|
|
|
node.GetUserPropFloat(name, ref state1);
|
|
node.GetUserPropFloat(name, ref state1);
|
|
-#else
|
|
|
|
- node.GetUserPropFloat(ref name, ref state1);
|
|
|
|
-#endif
|
|
|
|
|
|
|
|
float state2 = 0;
|
|
float state2 = 0;
|
|
name = propertyName + "_z";
|
|
name = propertyName + "_z";
|
|
-#if MAX2015 || MAX2016 || MAX2017
|
|
|
|
node.GetUserPropFloat(name, ref state2);
|
|
node.GetUserPropFloat(name, ref state2);
|
|
-#else
|
|
|
|
- node.GetUserPropFloat(ref name, ref state2);
|
|
|
|
-#endif
|
|
|
|
|
|
|
|
return new[] { state0, state1, state2 };
|
|
return new[] { state0, state1, state2 };
|
|
}
|
|
}
|
|
@@ -736,11 +649,7 @@ namespace Max2Babylon
|
|
{
|
|
{
|
|
if (checkBox.CheckState != CheckState.Indeterminate)
|
|
if (checkBox.CheckState != CheckState.Indeterminate)
|
|
{
|
|
{
|
|
-#if MAX2015 || MAX2016 || MAX2017
|
|
|
|
node.SetUserPropBool(propertyName, checkBox.CheckState == CheckState.Checked);
|
|
node.SetUserPropBool(propertyName, checkBox.CheckState == CheckState.Checked);
|
|
-#else
|
|
|
|
- node.SetUserPropBool(ref propertyName, checkBox.CheckState == CheckState.Checked);
|
|
|
|
-#endif
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -757,11 +666,7 @@ namespace Max2Babylon
|
|
foreach (var node in nodes)
|
|
foreach (var node in nodes)
|
|
{
|
|
{
|
|
var value = textBox.Text;
|
|
var value = textBox.Text;
|
|
-#if MAX2015 || MAX2016 || MAX2017
|
|
|
|
node.SetUserPropString(propertyName, value);
|
|
node.SetUserPropString(propertyName, value);
|
|
-#else
|
|
|
|
- node.SetUserPropString(ref propertyName, ref value);
|
|
|
|
-#endif
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -774,11 +679,7 @@ namespace Max2Babylon
|
|
{
|
|
{
|
|
foreach (var node in nodes)
|
|
foreach (var node in nodes)
|
|
{
|
|
{
|
|
-#if MAX2015 || MAX2016 || MAX2017
|
|
|
|
node.SetUserPropFloat(propertyName, (float)nup.Value);
|
|
node.SetUserPropFloat(propertyName, (float)nup.Value);
|
|
-#else
|
|
|
|
- node.SetUserPropFloat(ref propertyName, (float)nup.Value);
|
|
|
|
-#endif
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -792,25 +693,13 @@ namespace Max2Babylon
|
|
public static void UpdateVector3Control(Vector3Control vector3Control, IINode node, string propertyName)
|
|
public static void UpdateVector3Control(Vector3Control vector3Control, IINode node, string propertyName)
|
|
{
|
|
{
|
|
string name = propertyName + "_x";
|
|
string name = propertyName + "_x";
|
|
-#if MAX2015 || MAX2016 || MAX2017
|
|
|
|
node.SetUserPropFloat(name, vector3Control.X);
|
|
node.SetUserPropFloat(name, vector3Control.X);
|
|
-#else
|
|
|
|
- node.SetUserPropFloat(ref name, vector3Control.X);
|
|
|
|
-#endif
|
|
|
|
|
|
|
|
name = propertyName + "_y";
|
|
name = propertyName + "_y";
|
|
-#if MAX2015 || MAX2016 || MAX2017
|
|
|
|
node.SetUserPropFloat(name, vector3Control.Y);
|
|
node.SetUserPropFloat(name, vector3Control.Y);
|
|
-#else
|
|
|
|
- node.SetUserPropFloat(ref name, vector3Control.Y);
|
|
|
|
-#endif
|
|
|
|
|
|
|
|
name = propertyName + "_z";
|
|
name = propertyName + "_z";
|
|
-#if MAX2015 || MAX2016 || MAX2017
|
|
|
|
node.SetUserPropFloat(name, vector3Control.Z);
|
|
node.SetUserPropFloat(name, vector3Control.Z);
|
|
-#else
|
|
|
|
- node.SetUserPropFloat(ref name, vector3Control.Z);
|
|
|
|
-#endif
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public static void UpdateVector3Control(Vector3Control vector3Control, List<IINode> nodes, string propertyName)
|
|
public static void UpdateVector3Control(Vector3Control vector3Control, List<IINode> nodes, string propertyName)
|
|
@@ -824,11 +713,7 @@ namespace Max2Babylon
|
|
public static void UpdateComboBox(ComboBox comboBox, IINode node, string propertyName)
|
|
public static void UpdateComboBox(ComboBox comboBox, IINode node, string propertyName)
|
|
{
|
|
{
|
|
var value = comboBox.SelectedItem.ToString();
|
|
var value = comboBox.SelectedItem.ToString();
|
|
-#if MAX2015 || MAX2016 || MAX2017
|
|
|
|
node.SetUserPropString(propertyName, value);
|
|
node.SetUserPropString(propertyName, value);
|
|
-#else
|
|
|
|
- node.SetUserPropString(ref propertyName, ref value);
|
|
|
|
-#endif
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public static void UpdateComboBox(ComboBox comboBox, List<IINode> nodes, string propertyName)
|
|
public static void UpdateComboBox(ComboBox comboBox, List<IINode> nodes, string propertyName)
|