SpecialEventAdd data
-
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?
-
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.
-