THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/12/2012 at 14:50, xxxxxxxx wrote:
Hi,
does any body encountered with such C4D behavior?
Place this code into *.pyp file as plugin and start C4D.
import c4d
from c4d import plugins
PLUGIN_ID = 1000001
class MyMessagePlugin(plugins.MessageData) :
def GetTimer(self) :
return 0
def CoreMessage(self, id, bc) :
if id == PLUGIN_ID:
print " ------------------------------------ "
for i in range(0, len(bc)) :
index = bc.GetIndexId(i)
print " *", bc.GetData(index)
return True
if __name__ == "__main__":
plugins.RegisterMessagePlugin(PLUGIN_ID, "Test Plugin", 0, MyMessagePlugin())
print "What python code needs to be written in CoreMessage(), to be able recognize two different messages?"
print "\nShouldn't bc parameter in CoreMessage() contain values 1 and 2?"
print "Does <PyCObject ...> contain these values? If do, how to access them?"
# Simulate call from some other plugin A function 1.
c4d.SpecialEventAdd(PLUGIN_ID, 1, 0)
# Simulate call from some other plugin A function 2.
c4d.SpecialEventAdd(PLUGIN_ID, 2, 0)
On R13 above code produces:
What python code needs to be written in CoreMessage(), to be able recognize two different messages?
Shouldn't bc parameter in CoreMessage() contain values 1 and 2?
Does <PyCObject ...> contain these values? If do, how to access them?
------------------------------------
* 1000001
* 4
* <PyCObject object at 0x11e83c120>
* <PyCObject object at 0x11e83c120>
------------------------------------
* 1000001
* 4
* <PyCObject object at 0x11e83c120>
* <PyCObject object at 0x11e83c120>
Any comments?
Thanks in advance
P.S.: Don't place above plugin code into C4D ScriptManager - studio will crash