interactions between two or more plugins which are in a single Python file
-
how can I make interactions between two or more plugins which are created in a single Python file, including the commandData plugin and the toolData plugin. now, I want to send a message from a toolData plugin to two or more commandData plugins if the 'if' conditions is Ture. but, I don't want to use global values in Python. How can I realize that. Thank guys!
-
-
@c4ds I had got a try.
I write codes:commandPlugin=c4d.plugins.FindPllugin(the plugin id, c4d.PLUGINTYPE_ANY) commandPlugin.Message(the integer) in GetCursorInfo() called back function of toolData. and, codes: if type== the integer: print(the integer)
in Message() called back function of commandData.
but the codes can't print "the integer" when I move the mouse with the toolData.
actually, I change codes like that:
print(the integer)
in Message() called back function of commandData. .
but I still can not receive a message.
I want to change a value or execute a function in the commandData baesd on the mouse movement of toolData or a message from toolData -
@Ling
You cannot simply call Message(the integer) on a CommandData.
As I mentioned in the link (https://developers.maxon.net/forum/topic/13379/send-message-to-commanddata) the CommandData expects a message of type MSG_COMMAND. You cannot pass any integer.But since you want to send more information than just an integer you then cannot use the solution I provided by using the CommandData.ExecuteSubID.
Note that a CommandData is more like a "single-shot" action. It would probably be a better idea to look for something else to "change a value" than a CommandData.
Without knowing the whole idea behind your plugin it is hard to suggest something. -
@c4ds Thanks! I had changed my solution. Thank you to reply me!
-
@ling said in interactions between two or more plugins which are in a single Python file:
I had changed my solution.
If you could share the solution, or at least the concept behind it, this might help others with a similar problem looking for a solution.
-
I just use 'global value' to settle this problem. it is not good way or good solution for coding. but I have to solve this problem in a short time because it is just a little part of my plugin. I have so many problems to deal with that I can not waste my time.I think the message of commandData will update or call back when this command gui updates, or message maybe update with other conditions.sorry! I just a newbie for programming.
-
Hi,
I'm happy that you solved your issue.
For your next post, and i know you can see that as a waste of time, please follow our guidelines. Use the functionalities of the forum to mark your thread as a question, and mark it as solved when it's done. (Even for a negative answer).Please use also tags, that help us to understand and answer faster without guessing. Language you are using (python, c++) cinema4D version, everything that can help us to understand your issue.
You will also find on those guidelines how to explain your issue. Sometimes people want a solution for an issue creating by a bad workflow.
In your case, it looks more like sharing information between plugins. There are several answers/possibilities for that.
This forum is also about stepping back, having a fresh eye on your issue and move forward
Cheers,
Manuel