POV-Ray : Newsgroups : povray.binaries.programming : My idea: Developers need tips! Help me, please! : My idea: Developers need tips! Help me, please! Server Time
25 Apr 2024 13:54:56 EDT (-0400)
  My idea: Developers need tips! Help me, please!  
From: LanuHum
Date: 24 Jul 2016 13:35:01
Message: <web.5794fb80297eff0b7a3e03fe0@news.povray.org>
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'
idea.jpg


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.