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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Migrating from the Classic API

    Cinema 4D SDK
    2
    3
    729
    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.
    • C4DSC
      C4DS
      last edited by

      Hello again,
      It's been a while 😉

      I am currently still using the classic API for all plugins, and was looking into creating small "learning" plugins using the new API. Wanted to do so with baby steps, so I thought first to use the classic API for the main framework of the plugin (using PluginStart and the regular registration methods) while using some functionality of the MAXON API.
      Not sure if this is even possible, using a mix of classic and new API.

      For a first "learning" plugin I though to keep it simple and implement a plugin that has no interaction, but simply displays some information (in the console) when Cinema4D starts.
      So, I thought of displaying the MAC address.

      From the legacy forum I found a way to do so using the classic API
      https://developers.maxon.net/forum/topic/10754/14198_how-to-get-the-ethernet-id-list-solved

      And since GetMacAddress doesn't seem to be available in classic API of R20, that's a good opportunity for a learning experience. Well, there seems to be a Machine class which contains GetMacAddress, but haven't found a way how to use that.
      And since the purpose was to use the MAXON API I looked further and found NetworkAdapterInterface.
      Went looking for information on interfaces, implementation and usage, but examples on GitHub weren't useful. I just cannot wrap my head around it.

      The cinemasdk has examples for tool plugins, object, shader, ... These all are resources to learn from. Aren't there any full plugin examples using the new MAXON API? Or have I been looking at the wrong place?

      To be honest, first steps into the new API were quite frustratingly overwhelmed.

      1 Reply Last reply Reply Quote 0
      • r_giganteR
        r_gigante
        last edited by

        Hi Daniel, thanks for reaching us and for keeping touching the MAXON API.

        First thing first: we do appreciate every single comment spent on this topic, even critical comments like yours, because in the end it means that the community is approaching to it and this is, any case, good!

        Getting back to your question, considering that MAXON API is indeed young (yet powerful), it indeed should be used in conjuction with classic API in order to keep delivering plugins until the MAXON API will replace completely the old one.

        With regard to your second point I do confirm that although NetwordAdapterInterface is just an interface which could be implemented by 3rd party developers for customized implementations, I'd like to point you to NetworkIpInterface which is a static interface to access network functionality.

        In addition to this notes I also would like to point you to the Initialization section in our documentation where the MAXON_INITIALIZATION is explained in all its glory and which, in this case where only MAXON API calls are used, can be handy.

        Finally below the code I used to achieve the desired functionality

        static maxon::Result<void> InitGlobalString()
        {
        	iferr_scope;
        	
        	// get all the adapters on the machine
        	maxon::BaseArray<maxon::NetworkAdapter> allNets = maxon::NetworkIpInterface::GetAllNetworkAdapters() iferr_return;
        	
        	// browse all of them and print the MAC-address
        	for (const maxon::NetworkAdapter& adapter : allNets)
        	{
        		maxon::BaseArray<UChar> macadr = adapter.GetMacAddress() iferr_return;
        		ApplicationOutput("Adapter [@]: @", adapter.GetName(), maxon::NetworkIpInterface::MacAddressToString(macadr));
        	}
        	
        	return maxon::OK;
        }
        // called on system end
        static void ClearGlobalString()
        {
        	// do nothing
        }
        MAXON_INITIALIZATION(InitGlobalString, ClearGlobalString);
        

        Last but not least, whislt I recommend you to have a look at the microsdk example which represent the simpler yet fully working example of the MAXON API in use, I confirm that more examples are in the work and will for sure be part of a future SDK revision.

        Best, Riccardo

        1 Reply Last reply Reply Quote 2
        • C4DSC
          C4DS
          last edited by

          Thanks Riccardo,
          It all (well, some of it) starts to make sense after your explanation. A big step forward in starting to understand how to proceed with the MAXON API.

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