custom classes for scriptOp with maxscript on-fly assembly ?
#3
Here is what I'm trying to achieve from maxscript in order to get my classes back
I thaught just typing "using MyNamespace;" in a scriptOp would work but no..

Code:
fn MyAssembly =
(
    source  =
"//////////////////////////////////////////////////////   C#   ////////////////////////////////////////////////////////////////
using System;
using Autodesk.Max;      
using Autodesk.Max.Wrappers;
using tfcpp; // tyFlow namespace ???
 
namespace MyNamespace
{
   public class MyClass
   {
       public static void myMethod()
       {
        // bla bla using tyFlow.classes eventually
       }
   }
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
"

    local csharpProvider = dotnetobject "Microsoft.CSharp.CSharpCodeProvider"
    local compilerParams = dotnetobject "System.CodeDom.Compiler.CompilerParameters"
    compilerParams.ReferencedAssemblies.Add "Whatever is needed"
    compilerParams.GenerateInMemory = on
    local compilerResults = csharpProvider.CompileAssemblyFromSource compilerParams #(source)

    (compilerResults.CompiledAssembly).CreateInstance "MyNamespace.MyClass"
)

I wanted to do it from maxscript for convenience and of course for not having to restart max, but if prebuild dll is the only way, I'll do it.
I'm writing a Max helper pugin for character rigging purposes and IK solving, for now in maxscript/C# and maybe totally C# later..,
and I want it to work for both rigs and tyActors!

It would be great if you could point me how to load/access my classes in the scriptOp?
whether it be on max startup or on fly, using maxscript, cs file, or prebuilt dll...

thanks!
  Reply


Messages In This Thread
RE: custom classes for scriptOp with maxscript on-fly assembly ? - by Geoff - 05-31-2020, 01:01 PM

Forum Jump: