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

    SpecialEventAdd data

    PYTHON Development
    0
    2
    573
    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
      Helper
      last edited by

      On 25/08/2014 at 10:58, xxxxxxxx wrote:

      I cant seem to find the correct way to get the personal data from a SpecialEventAdd()

      This is what I have:

      Outside of plugin:

      c4d.SpecialEventAdd(PLUGIN_ID,p1 = 1)
      

      In plugin:

      def CoreMessage(self, id, msg) :
              if id==PLUGIN_ID:
                  print msg
      

      This will print out the container but I cannot seem to find where the private data is located in the container.

      how do I get the p1 value?

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

        On 26/08/2014 at 09:36, xxxxxxxx wrote:

        So I managed to get this to work! After finding A post HERE. I Knew that it was possible but there was no way to sift through that amount of data in an efficient was.

        So checking the C++ documentation[URL-REMOVED] I found that p1 and p2 actually stand for c4d.BFM_CORE_PAR1 and c4d.BFM_CORE_PAR2 this resulted in much excitement! 😄

        I was then able to get somewhere and I feel this kind of information should be included in the docs and freely available. So I hope this will help anyone in the future trying to do the same thing and with that share their own findings.

        So here's how to make it work...

        Outside of the plugin: (In this case p1 is either 1 or 2 but can be any integer)

        c4d.SpecialEventAdd(PLUGIN_ID,p1 = 1)
        

        Within the plugin:

        def CoreMessage(self, id, msg) :
            if id == PLUGIN_ID:
                # Get the Void Container
                P1MSG_UN = msg.GetVoid(c4d.BFM_CORE_PAR1)
                
                # Get the actual data (This is beyond my knowledge but it works!)
                pythonapi.PyCObject_AsVoidPtr.restype = c_void_p
                pythonapi.PyCObject_AsVoidPtr.argtypes = [py_object]
                P1MSG_EN = pythonapi.PyCObject_AsVoidPtr(P1MSG_UN)
                
                if P1MSG_EN == 1: # If p1 = 1
                    #Do Something
                if P1MSG_EN == 2: # If p1 = 2
                    #Do Something else
                else:
                    pass
            
            return True
        

        [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

        1 Reply Last reply Reply Quote 0
        • HerzogVonWieselH HerzogVonWiesel referenced this topic on
        • First post
          Last post