40#include "RNA_prototypes.hh"
43#include "../generic/py_capi_utils.hh"
55 Freestyle_getCurrentScene___doc__,
56 ".. function:: getCurrentScene()\n"
58 " Returns the current scene.\n"
60 " :return: The current scene.\n"
61 " :rtype: :class:`bpy.types.Scene`\n");
67 PyErr_SetString(PyExc_TypeError,
"current scene not available");
78 if (
STREQ(type,
"MIX")) {
81 if (
STREQ(type,
"ADD")) {
84 if (
STREQ(type,
"MULTIPLY")) {
87 if (
STREQ(type,
"SUBTRACT")) {
90 if (
STREQ(type,
"SCREEN")) {
93 if (
STREQ(type,
"DIVIDE")) {
96 if (
STREQ(type,
"DIFFERENCE")) {
99 if (
STREQ(type,
"EXCLUSION")) {
102 if (
STREQ(type,
"DARKEN")) {
105 if (
STREQ(type,
"LIGHTEN")) {
108 if (
STREQ(type,
"OVERLAY")) {
111 if (
STREQ(type,
"DODGE")) {
114 if (
STREQ(type,
"BURN")) {
117 if (
STREQ(type,
"HUE")) {
120 if (
STREQ(type,
"SATURATION")) {
123 if (
STREQ(type,
"VALUE")) {
126 if (
STREQ(type,
"COLOR")) {
129 if (
STREQ(type,
"SOFT_LIGHT")) {
132 if (
STREQ(type,
"LINEAR_LIGHT")) {
140 Freestyle_blendRamp___doc__,
141 ".. function:: blendRamp(type, color1, fac, color2)\n"
143 " Blend two colors according to a ramp blend type.\n"
145 " :arg type: Ramp blend type.\n"
147 " :arg color1: 1st color.\n"
148 " :type color1: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n"
149 " :arg fac: Blend factor.\n"
150 " :type fac: float\n"
151 " :arg color2: 1st color.\n"
152 " :type color2: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n"
153 " :return: Blended color in RGB format.\n"
154 " :rtype: :class:`mathutils.Vector`\n");
158 PyObject *obj1, *obj2;
161 float a[3], fac,
b[3];
163 if (!PyArg_ParseTuple(args,
"sOfO", &s, &obj1, &fac, &obj2)) {
168 PyErr_SetString(PyExc_TypeError,
"argument 1 is an unknown ramp blend type");
175 "argument 2 must be a 3D vector "
176 "(either a tuple/list of 3 elements or Vector)") == -1)
184 "argument 4 must be a 3D vector "
185 "(either a tuple/list of 3 elements or Vector)") == -1)
195 Freestyle_evaluateColorRamp___doc__,
196 ".. function:: evaluateColorRamp(ramp, in)\n"
198 " Evaluate a color ramp at a point in the interval 0 to 1.\n"
200 " :arg ramp: Color ramp object.\n"
201 " :type ramp: :class:`bpy.types.ColorRamp`\n"
202 " :arg in: Value in the interval 0 to 1.\n"
204 " :return: color in RGBA format.\n"
205 " :rtype: :class:`mathutils.Vector`\n");
217 PyErr_SetString(PyExc_TypeError,
"1st argument is not a ColorRamp object");
222 PyErr_SetString(PyExc_ValueError,
"failed to evaluate the color ramp");
232 Freestyle_evaluateCurveMappingF___doc__,
233 ".. function:: evaluateCurveMappingF(cumap, cur, value)\n"
235 " Evaluate a curve mapping at a point in the interval 0 to 1.\n"
237 " :arg cumap: Curve mapping object.\n"
238 " :type cumap: :class:`bpy.types.CurveMapping`\n"
239 " :arg cur: Index of the curve to be used (0 <= cur <= 3).\n"
241 " :arg value: Input value in the interval 0 to 1.\n"
242 " :type value: float\n"
243 " :return: Mapped output value.\n"
253 if (!PyArg_ParseTuple(args,
"O!if", &
pyrna_struct_Type, &py_srna, &cur, &value)) {
257 PyErr_SetString(PyExc_TypeError,
"1st argument is not a CurveMapping object");
260 if (cur < 0 || cur > 3) {
261 PyErr_SetString(PyExc_ValueError,
"2nd argument is out of range");
279 "This module provides classes for defining line drawing rules (such as\n"
280 "predicates, functions, chaining iterators, and stroke shaders), as well\n"
281 "as helper functions for style module writing.\n"
286 "- :class:`BinaryPredicate0D`\n"
287 "- :class:`BinaryPredicate1D`\n"
289 " - :class:`FalseBP1D`\n"
290 " - :class:`Length2DBP1D`\n"
291 " - :class:`SameShapeIdBP1D`\n"
292 " - :class:`TrueBP1D`\n"
293 " - :class:`ViewMapGradientNormBP1D`\n"
296 "- :class:`Interface0D`\n"
298 " - :class:`CurvePoint`\n"
300 " - :class:`StrokeVertex`\n"
302 " - :class:`SVertex`\n"
303 " - :class:`ViewVertex`\n"
305 " - :class:`NonTVertex`\n"
306 " - :class:`TVertex`\n"
308 "- :class:`Interface1D`\n"
310 " - :class:`Curve`\n"
312 " - :class:`Chain`\n"
314 " - :class:`FEdge`\n"
316 " - :class:`FEdgeSharp`\n"
317 " - :class:`FEdgeSmooth`\n"
319 " - :class:`Stroke`\n"
320 " - :class:`ViewEdge`\n"
322 "- :class:`Iterator`\n"
324 " - :class:`AdjacencyIterator`\n"
325 " - :class:`CurvePointIterator`\n"
326 " - :class:`Interface0DIterator`\n"
327 " - :class:`SVertexIterator`\n"
328 " - :class:`StrokeVertexIterator`\n"
329 " - :class:`ViewEdgeIterator`\n"
331 " - :class:`ChainingIterator`\n"
333 " - :class:`ChainPredicateIterator`\n"
334 " - :class:`ChainSilhouetteIterator`\n"
336 " - :class:`orientedViewEdgeIterator`\n"
338 "- :class:`Material`\n"
340 "- :class:`Operators`\n"
341 "- :class:`SShape`\n"
342 "- :class:`StrokeAttribute`\n"
343 "- :class:`StrokeShader`\n"
345 " - :class:`BackboneStretcherShader`\n"
346 " - :class:`BezierCurveShader`\n"
347 " - :class:`BlenderTextureShader`\n"
348 " - :class:`CalligraphicShader`\n"
349 " - :class:`ColorNoiseShader`\n"
350 " - :class:`ColorVariationPatternShader`\n"
351 " - :class:`ConstantColorShader`\n"
352 " - :class:`ConstantThicknessShader`\n"
353 " - :class:`ConstrainedIncreasingThicknessShader`\n"
354 " - :class:`GuidingLinesShader`\n"
355 " - :class:`IncreasingColorShader`\n"
356 " - :class:`IncreasingThicknessShader`\n"
357 " - :class:`PolygonalizationShader`\n"
358 " - :class:`SamplingShader`\n"
359 " - :class:`SmoothingShader`\n"
360 " - :class:`SpatialNoiseShader`\n"
361 " - :class:`StrokeTextureShader`\n"
362 " - :class:`StrokeTextureStepShader`\n"
363 " - :class:`TextureAssignerShader`\n"
364 " - :class:`ThicknessNoiseShader`\n"
365 " - :class:`ThicknessVariationPatternShader`\n"
366 " - :class:`TipRemoverShader`\n"
367 " - :class:`fstreamShader`\n"
368 " - :class:`streamShader`\n"
370 "- :class:`UnaryFunction0D`\n"
372 " - :class:`UnaryFunction0DDouble`\n"
374 " - :class:`Curvature2DAngleF0D`\n"
375 " - :class:`DensityF0D`\n"
376 " - :class:`GetProjectedXF0D`\n"
377 " - :class:`GetProjectedYF0D`\n"
378 " - :class:`GetProjectedZF0D`\n"
379 " - :class:`GetXF0D`\n"
380 " - :class:`GetYF0D`\n"
381 " - :class:`GetZF0D`\n"
382 " - :class:`LocalAverageDepthF0D`\n"
383 " - :class:`ZDiscontinuityF0D`\n"
385 " - :class:`UnaryFunction0DEdgeNature`\n"
387 " - :class:`CurveNatureF0D`\n"
389 " - :class:`UnaryFunction0DFloat`\n"
391 " - :class:`GetCurvilinearAbscissaF0D`\n"
392 " - :class:`GetParameterF0D`\n"
393 " - :class:`GetViewMapGradientNormF0D`\n"
394 " - :class:`ReadCompleteViewMapPixelF0D`\n"
395 " - :class:`ReadMapPixelF0D`\n"
396 " - :class:`ReadSteerableViewMapPixelF0D`\n"
398 " - :class:`UnaryFunction0DId`\n"
400 " - :class:`ShapeIdF0D`\n"
402 " - :class:`UnaryFunction0DMaterial`\n"
404 " - :class:`MaterialF0D`\n"
406 " - :class:`UnaryFunction0DUnsigned`\n"
408 " - :class:`QuantitativeInvisibilityF0D`\n"
410 " - :class:`UnaryFunction0DVec2f`\n"
412 " - :class:`Normal2DF0D`\n"
413 " - :class:`VertexOrientation2DF0D`\n"
415 " - :class:`UnaryFunction0DVec3f`\n"
417 " - :class:`VertexOrientation3DF0D`\n"
419 " - :class:`UnaryFunction0DVectorViewShape`\n"
421 " - :class:`GetOccludersF0D`\n"
423 " - :class:`UnaryFunction0DViewShape`\n"
425 " - :class:`GetOccludeeF0D`\n"
426 " - :class:`GetShapeF0D`\n"
428 "- :class:`UnaryFunction1D`\n"
430 " - :class:`UnaryFunction1DDouble`\n"
432 " - :class:`Curvature2DAngleF1D`\n"
433 " - :class:`DensityF1D`\n"
434 " - :class:`GetCompleteViewMapDensityF1D`\n"
435 " - :class:`GetDirectionalViewMapDensityF1D`\n"
436 " - :class:`GetProjectedXF1D`\n"
437 " - :class:`GetProjectedYF1D`\n"
438 " - :class:`GetProjectedZF1D`\n"
439 " - :class:`GetSteerableViewMapDensityF1D`\n"
440 " - :class:`GetViewMapGradientNormF1D`\n"
441 " - :class:`GetXF1D`\n"
442 " - :class:`GetYF1D`\n"
443 " - :class:`GetZF1D`\n"
444 " - :class:`LocalAverageDepthF1D`\n"
445 " - :class:`ZDiscontinuityF1D`\n"
447 " - :class:`UnaryFunction1DEdgeNature`\n"
449 " - :class:`CurveNatureF1D`\n"
451 " - :class:`UnaryFunction1DFloat`\n"
452 " - :class:`UnaryFunction1DUnsigned`\n"
454 " - :class:`QuantitativeInvisibilityF1D`\n"
456 " - :class:`UnaryFunction1DVec2f`\n"
458 " - :class:`Normal2DF1D`\n"
459 " - :class:`Orientation2DF1D`\n"
461 " - :class:`UnaryFunction1DVec3f`\n"
463 " - :class:`Orientation3DF1D`\n"
465 " - :class:`UnaryFunction1DVectorViewShape`\n"
467 " - :class:`GetOccludeeF1D`\n"
468 " - :class:`GetOccludersF1D`\n"
469 " - :class:`GetShapeF1D`\n"
471 " - :class:`UnaryFunction1DVoid`\n"
473 " - :class:`ChainingTimeStampF1D`\n"
474 " - :class:`IncrementChainingTimeStampF1D`\n"
475 " - :class:`TimeStampF1D`\n"
477 "- :class:`UnaryPredicate0D`\n"
479 " - :class:`FalseUP0D`\n"
480 " - :class:`TrueUP0D`\n"
482 "- :class:`UnaryPredicate1D`\n"
484 " - :class:`ContourUP1D`\n"
485 " - :class:`DensityLowerThanUP1D`\n"
486 " - :class:`EqualToChainingTimeStampUP1D`\n"
487 " - :class:`EqualToTimeStampUP1D`\n"
488 " - :class:`ExternalContourUP1D`\n"
489 " - :class:`FalseUP1D`\n"
490 " - :class:`QuantitativeInvisibilityUP1D`\n"
491 " - :class:`ShapeUP1D`\n"
492 " - :class:`TrueUP1D`\n"
493 " - :class:`WithinImageBoundaryUP1D`\n"
495 "- :class:`ViewMap`\n"
496 "- :class:`ViewShape`\n"
497 "- :class:`IntegrationType`\n"
498 "- :class:`MediumType`\n"
499 "- :class:`Nature`\n"
506# pragma clang diagnostic push
507# pragma clang diagnostic ignored "-Wcast-function-type"
509# pragma GCC diagnostic push
510# pragma GCC diagnostic ignored "-Wcast-function-type"
518 Freestyle_getCurrentScene___doc__},
519 {
"blendRamp", (PyCFunction)
Freestyle_blendRamp, METH_VARARGS, Freestyle_blendRamp___doc__},
520 {
"evaluateColorRamp",
523 Freestyle_evaluateColorRamp___doc__},
524 {
"evaluateCurveMappingF",
527 Freestyle_evaluateCurveMappingF___doc__},
528 {
nullptr,
nullptr, 0,
nullptr},
533# pragma clang diagnostic pop
535# pragma GCC diagnostic pop
559 module = PyModule_Create(&module_definition);
568 if (path.has_value()) {
570 BLI_path_join(modpath,
sizeof(modpath), path->c_str(),
"modules");
571 PyObject *sys_path = PySys_GetObject(
"path");
573 PyList_Append(sys_path, py_modpath);
574 Py_DECREF(py_modpath);
576 printf(
"Adding Python path: %s\n", modpath);
581 "Freestyle: couldn't find 'scripts/freestyle/modules', Freestyle won't work properly.\n");
std::optional< std::string > BKE_appdir_folder_id(int folder_id, const char *subfolder) ATTR_WARN_UNUSED_RESULT
bool BKE_colorband_evaluate(const ColorBand *coba, float in, float out[4])
General operations, lookup, etc. for materials.
void ramp_blend(int type, float r_col[3], float fac, const float col[3])
#define BLI_path_join(...)
int BBox_Init(PyObject *module)
int BinaryPredicate0D_Init(PyObject *module)
int BinaryPredicate1D_Init(PyObject *module)
static PyModuleDef module_definition
int ContextFunctions_Init(PyObject *module)
static PyMethodDef module_functions[]
static PyObject * Freestyle_evaluateColorRamp(PyObject *, PyObject *args)
static int ramp_blend_type(const char *type)
static PyObject * Freestyle_evaluateCurveMappingF(PyObject *, PyObject *args)
static PyObject * Freestyle_getCurrentScene(PyObject *)
static PyObject * Freestyle_blendRamp(PyObject *, PyObject *args)
PyObject * Freestyle_Init()
PyDoc_STRVAR(Freestyle_getCurrentScene___doc__, ".. function:: getCurrentScene()\n" "\n" " Returns the current scene.\n" "\n" " :return: The current scene.\n" " :rtype: :class:`bpy.types.Scene`\n")
int FrsMaterial_Init(PyObject *module)
int FrsNoise_Init(PyObject *module)
int Id_Init(PyObject *module)
int IntegrationType_Init(PyObject *module)
int Interface0D_Init(PyObject *module)
int Interface1D_Init(PyObject *module)
int Iterator_Init(PyObject *module)
int MediumType_Init(PyObject *module)
int Nature_Init(PyObject *module)
int Operators_Init(PyObject *module)
int SShape_Init(PyObject *module)
int StrokeAttribute_Init(PyObject *module)
int StrokeShader_Init(PyObject *module)
int UnaryFunction0D_Init(PyObject *module)
int UnaryFunction1D_Init(PyObject *module)
int UnaryPredicate0D_Init(PyObject *module)
int UnaryPredicate1D_Init(PyObject *module)
int ViewMap_Init(PyObject *module)
int ViewShape_Init(PyObject *module)
@ CUMA_EXTEND_EXTRAPOLATE
struct FreestyleGlobals g_freestyle
PyTypeObject pyrna_struct_Type
PyObject * pyrna_struct_CreatePyObject(PointerRNA *ptr)
int mathutils_array_parse(float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix)
PyObject * Vector_CreatePyObject(const float *vec, const int vec_num, PyTypeObject *base_type)
PyObject * PyC_UnicodeFromBytes(const char *str)
static struct PyModuleDef module
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
PyObject_HEAD std::optional< PointerRNA > ptr