Blender  V3.3
Functions | Variables
MANTA_main.cpp File Reference
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <zlib.h>
#include "MANTA_main.h"
#include "Python.h"
#include "fluid_script.h"
#include "liquid_script.h"
#include "manta.h"
#include "smoke_script.h"
#include "BLI_fileops.h"
#include "BLI_path_util.h"
#include "BLI_utildefines.h"
#include "DNA_fluid_types.h"
#include "DNA_modifier_types.h"
#include "DNA_scene_types.h"
#include "MEM_guardedalloc.h"

Go to the source code of this file.

Functions

static PyObject * manta_python_main_module_create (const char *filename)
 
static void manta_python_main_module_activate (PyObject *mod_main)
 
static void manta_python_main_module_backup (PyObject **r_main_mod)
 
static void manta_python_main_module_restore (PyObject *main_mod)
 
static void manta_python_main_module_clear ()
 
static PyObject * manta_python_main_module_ensure ()
 
static string getCacheFileEnding (char cache_format)
 
static string getBooleanString (int value)
 
static string escapePath (string const &s)
 
static PyObject * callPythonFunction (string varName, string functionName, bool isAttribute=false)
 
static voidpyObjectToPointer (PyObject *inputObject)
 
static double pyObjectToDouble (PyObject *inputObject)
 
static long pyObjectToLong (PyObject *inputObject)
 
template<class T >
static TgetPointer (string pyObjectName, string pyFunctionName)
 

Variables

static PyObject * manta_main_module = nullptr
 

Function Documentation

◆ callPythonFunction()

static PyObject* callPythonFunction ( string  varName,
string  functionName,
bool  isAttribute = false 
)
static

Definition at line 1911 of file MANTA_main.cpp.

References manta_main_module, and MANTA::with_debug.

Referenced by MANTA::getFrame(), getPointer(), and MANTA::getTimestep().

◆ escapePath()

static string escapePath ( string const &  s)
static

◆ getBooleanString()

static string getBooleanString ( int  value)
static

Definition at line 741 of file MANTA_main.cpp.

◆ getCacheFileEnding()

static string getCacheFileEnding ( char  cache_format)
static

◆ getPointer()

template<class T >
static T* getPointer ( string  pyObjectName,
string  pyFunctionName 
)
static

Definition at line 2020 of file MANTA_main.cpp.

References callPythonFunction(), pyObjectToPointer(), and T.

Referenced by MANTA::updatePointers().

◆ manta_python_main_module_activate()

static void manta_python_main_module_activate ( PyObject *  mod_main)
static

Definition at line 598 of file MANTA_main.cpp.

◆ manta_python_main_module_backup()

static void manta_python_main_module_backup ( PyObject **  r_main_mod)
static

Definition at line 610 of file MANTA_main.cpp.

◆ manta_python_main_module_clear()

static void manta_python_main_module_clear ( )
static

Definition at line 633 of file MANTA_main.cpp.

References manta_main_module.

◆ manta_python_main_module_create()

static PyObject* manta_python_main_module_create ( const char *  filename)
static

Copied from PyC_DefaultNameSpace in Blender. with some differences:

Definition at line 583 of file MANTA_main.cpp.

Referenced by manta_python_main_module_ensure().

◆ manta_python_main_module_ensure()

static PyObject* manta_python_main_module_ensure ( )
static

Definition at line 641 of file MANTA_main.cpp.

References manta_main_module, and manta_python_main_module_create().

◆ manta_python_main_module_restore()

static void manta_python_main_module_restore ( PyObject *  main_mod)
static

Definition at line 617 of file MANTA_main.cpp.

◆ pyObjectToDouble()

static double pyObjectToDouble ( PyObject *  inputObject)
static

Definition at line 1988 of file MANTA_main.cpp.

References result.

Referenced by MANTA::getTimestep().

◆ pyObjectToLong()

static long pyObjectToLong ( PyObject *  inputObject)
static

Definition at line 2006 of file MANTA_main.cpp.

References result.

Referenced by MANTA::getFrame().

◆ pyObjectToPointer()

static void* pyObjectToPointer ( PyObject *  inputObject)
static

Definition at line 1963 of file MANTA_main.cpp.

References result, and str.

Referenced by getPointer().

Variable Documentation

◆ manta_main_module

PyObject* manta_main_module = nullptr
static

Mantaflow stores many variables in the globals() dict of the main module. To be able to access these variables, the same main module has to be used every time.

Unfortunately, we also depend on the fact that mantaflow dumps variables into this module using PyRun_SimpleString. So we can't easily create a separate module without changing mantaflow.

Definition at line 631 of file MANTA_main.cpp.

Referenced by callPythonFunction(), manta_python_main_module_clear(), and manta_python_main_module_ensure().