Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    instantiate object from string

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 260 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 15/02/2009 at 06:23, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   10.5 
      Platform:    Mac  ;  
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      Hi,

      Is there any way to create an instance of an object given the class name as a string? Like:

      var className = "myClass";
      var myObject = new(className, ...);

      Does anybody know any trick or workaround to make this work?

      Thanks in advance for your help,
      Gambetti

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 15/02/2009 at 13:04, xxxxxxxx wrote:

        I don't think this is possible as the 'className' is a class nomenclature held by the interpreter/compiler and endemic to the actual code. There might be a trick to have text inserted into the code (as meta-code) but it would be precarious for certain.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 15/02/2009 at 15:53, xxxxxxxx wrote:

          Oh yes, of course, what a silly idea. I'm used to do this in interpreted languages like PHP, but of course this can't work with COFFEE.

          Cheers,
          Gambetti

          1 Reply Last reply Reply Quote 0
          • First post
            Last post