Retrieving a value form en external source
On 27/11/2015 at 07:03, xxxxxxxx wrote:
Cinema 4D Version: 16
Platform: Windows ;
Language(s) : C.O.F.F.E.E ; C++ ; XPRESSO ; PYTHON ;
Lets say that I have a have a value that stored somewhere in the memory , something like x=15,and this value had beed stored through other software (not C4d),is there way to actually retrieve that value , or maybe something that works like a rest interface .
I haven't had in experience in c4d python scripting but I'm just asking if that is doable or not because I have something in mind that I need to achieve.
On 27/11/2015 at 07:33, xxxxxxxx wrote:
A file or clipboard would be the simplest. Sharing 'memory' between applications can't happen directly (will not get into the details). You can expose that information using, say, a dynamic library interface but that is a bit advanced programming there. If you can write a script or plugin in the other software to put the value into a file/clipboard, then you can do the same to get the value from there. Either way, you need some common interface outside of the private memory of each application to get at information stored in memory of another application.
On 27/11/2015 at 08:57, xxxxxxxx wrote:
good,will I can actually write a script in my program that will write the values onto a text file,in this case I have two questions :
1.how can I parse text file in c4d ,is there way to do that though expresso or python(I haven't used python before ).
2.Is there way to keep c4d listing to that value , meaning the text file will have the value that will be changed overtime as my script is updating the text file (I can do that ) , but then is it possible to force c4d to keep listening to that value and getting the latest one (real time )?
On 27/11/2015 at 12:47, xxxxxxxx wrote:
As far as I know, Xpresso nodes don't have file access. Python can for certain. One thing that I found while researching this is the use of pipes to set stdin/stdout between two applications. This provides a simple iostream between them - but it must be established simultaneously (both apps started together) so I am unsure of the efficacy. Whether or not pipes (traditionally command line redirections) can be established during execution is not something that I can answer.
If you go the file route, the easiest way to have C4D keep listening would be to have a timer (in a MessageData plugin or GeDialog) check on some change periodically (change as in file data/time). In such a case, I would use a large timer value (in seconds if possible) since file access and reading is slow and could freeze C4D.
On 30/11/2015 at 05:16, xxxxxxxx wrote:
welcome to the Plugin Café forums
Are you mainly interested in a Python solution? Then I'd move this thread into the Python sub-forum.