|
|
I started to learn programming language C ++.
To transfer data from Blender in Povray, we use files
My idea: to give up files.
How will it work?
#include <iostream>
#include <string>
#include <Python.h>
#include <fx.h>
int grab(int, char **) {
PyObject *mName, *pModule, *pFunc, *pArgs, *pValue;
PyObject *cResult, *pName;
Py_Initialize();
PyRun_SimpleString("import sys");
PyRun_SimpleString("sys.path.append(\".\")");
PyRun_SimpleString("from bimport import hello");
mName = PyUnicode_FromString("bimport");
char fName[] = "hello";
pModule = PyImport_Import(mName);
pFunc = PyObject_GetAttrString(pModule, fName);
int i = 1;
long nL = 5;
PyObject* l = PyLong_FromLong(nL);
pArgs = PyTuple_New(i);
PyTuple_SetItem(pArgs, 0, l);
pValue = PyObject_CallObject(pFunc, pArgs);
cResult = PyTuple_GetItem(pValue,0);
pName = PyObject_Repr(cResult);
pName = PyUnicode_AsEncodedString(pName, "utf-8","Error ~");
const char *Hello = PyBytes_AS_STRING(pName);
std::cout << Hello << std::endl;
Py_Finalize();
return 0;
}
....................................
....................................
....................................
int main(int argc,char *argv[]){
FXApp application("Povray animator","Test");
application.init(argc,argv);
Awindow* window=new Awindow(&application);
application.addSignal(SIGINT,window,Awindow::ID_QUIT);
application.create();
if(argc>1) window->loadimage(argv[1]);
return application.run();
}
Also see the attachment.
I want to ask: I can anyone help tips?
Post a reply to this message
Attachments:
Download 'idea.jpg' (68 KB)
Preview of image 'idea.jpg'
|
|