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");
66 PyErr_SetString(PyExc_TypeError,
"current scene not available");
70 &scene->
id, blender::RNA_Scene, scene);
71 return pyrna_struct_CreatePyObject(&ptr_scene);
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 " :param type: Ramp blend type.\n"
147 " :param color1: 1st color.\n"
148 " :type color1: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n"
149 " :param fac: Blend factor.\n"
150 " :type fac: float\n"
151 " :param 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");
157 PyObject *obj1, *obj2;
160 float a[4], fac,
b[4];
162 if (!PyArg_ParseTuple(args,
177 PyErr_SetString(PyExc_TypeError,
"argument 1 is an unknown ramp blend type");
184 "argument 2 must be a 3D vector "
185 "(either a tuple/list of 3 elements or Vector)") == -1)
193 "argument 4 must be a 3D vector "
194 "(either a tuple/list of 3 elements or Vector)") == -1)
204 Freestyle_evaluateColorRamp___doc__,
205 ".. function:: evaluateColorRamp(ramp, in)\n"
207 " Evaluate a color ramp at a point in the interval 0 to 1.\n"
209 " :param ramp: Color ramp object.\n"
210 " :type ramp: :class:`bpy.types.ColorRamp`\n"
211 " :param in: Value in the interval 0 to 1.\n"
213 " :return: color in RGBA format.\n"
214 " :rtype: :class:`mathutils.Vector`\n");
221 if (!PyArg_ParseTuple(args,
224 ":evaluateColorRamp",
231 if (!RNA_struct_is_a(py_srna->
ptr->type, blender::RNA_ColorRamp)) {
232 PyErr_SetString(PyExc_TypeError,
"1st argument is not a ColorRamp object");
236 if (!BKE_colorband_evaluate(coba,
in,
out)) {
237 PyErr_SetString(PyExc_ValueError,
"failed to evaluate the color ramp");
247 Freestyle_evaluateCurveMappingF___doc__,
248 ".. function:: evaluateCurveMappingF(cumap, cur, value)\n"
250 " Evaluate a curve mapping at a point in the interval 0 to 1.\n"
252 " :param cumap: Curve mapping object.\n"
253 " :type cumap: :class:`bpy.types.CurveMapping`\n"
254 " :param cur: Index of the curve to be used (0 <= cur <= 3).\n"
256 " :param value: Input value in the interval 0 to 1.\n"
257 " :type value: float\n"
258 " :return: Mapped output value.\n"
267 if (!PyArg_ParseTuple(args,
271 ":evaluateCurveMappingF",
279 if (!RNA_struct_is_a(py_srna->
ptr->type, blender::RNA_CurveMapping)) {
280 PyErr_SetString(PyExc_TypeError,
"1st argument is not a CurveMapping object");
283 if (cur < 0 || cur > 3) {
284 PyErr_SetString(PyExc_ValueError,
"2nd argument is out of range");
288 BKE_curvemapping_init(cumap);
292 BKE_curvemapping_changed(cumap,
false);
294 return PyFloat_FromDouble(BKE_curvemapping_evaluateF(cumap, cur, value));
302 "This module provides classes for defining line drawing rules (such as\n"
303 "predicates, functions, chaining iterators, and stroke shaders), as well\n"
304 "as helper functions for style module writing.\n"
309 "- :class:`BinaryPredicate0D`\n"
310 "- :class:`BinaryPredicate1D`\n"
312 " - :class:`FalseBP1D`\n"
313 " - :class:`Length2DBP1D`\n"
314 " - :class:`SameShapeIdBP1D`\n"
315 " - :class:`TrueBP1D`\n"
316 " - :class:`ViewMapGradientNormBP1D`\n"
319 "- :class:`Interface0D`\n"
321 " - :class:`CurvePoint`\n"
323 " - :class:`StrokeVertex`\n"
325 " - :class:`SVertex`\n"
326 " - :class:`ViewVertex`\n"
328 " - :class:`NonTVertex`\n"
329 " - :class:`TVertex`\n"
331 "- :class:`Interface1D`\n"
333 " - :class:`Curve`\n"
335 " - :class:`Chain`\n"
337 " - :class:`FEdge`\n"
339 " - :class:`FEdgeSharp`\n"
340 " - :class:`FEdgeSmooth`\n"
342 " - :class:`Stroke`\n"
343 " - :class:`ViewEdge`\n"
345 "- :class:`Iterator`\n"
347 " - :class:`AdjacencyIterator`\n"
348 " - :class:`CurvePointIterator`\n"
349 " - :class:`Interface0DIterator`\n"
350 " - :class:`SVertexIterator`\n"
351 " - :class:`StrokeVertexIterator`\n"
352 " - :class:`ViewEdgeIterator`\n"
354 " - :class:`ChainingIterator`\n"
356 " - :class:`ChainPredicateIterator`\n"
357 " - :class:`ChainSilhouetteIterator`\n"
359 " - :class:`orientedViewEdgeIterator`\n"
361 "- :class:`Material`\n"
363 "- :class:`Operators`\n"
364 "- :class:`SShape`\n"
365 "- :class:`StrokeAttribute`\n"
366 "- :class:`StrokeShader`\n"
368 " - :class:`BackboneStretcherShader`\n"
369 " - :class:`BezierCurveShader`\n"
370 " - :class:`BlenderTextureShader`\n"
371 " - :class:`CalligraphicShader`\n"
372 " - :class:`ColorNoiseShader`\n"
373 " - :class:`ColorVariationPatternShader`\n"
374 " - :class:`ConstantColorShader`\n"
375 " - :class:`ConstantThicknessShader`\n"
376 " - :class:`ConstrainedIncreasingThicknessShader`\n"
377 " - :class:`GuidingLinesShader`\n"
378 " - :class:`IncreasingColorShader`\n"
379 " - :class:`IncreasingThicknessShader`\n"
380 " - :class:`PolygonalizationShader`\n"
381 " - :class:`SamplingShader`\n"
382 " - :class:`SmoothingShader`\n"
383 " - :class:`SpatialNoiseShader`\n"
384 " - :class:`StrokeTextureShader`\n"
385 " - :class:`StrokeTextureStepShader`\n"
386 " - :class:`TextureAssignerShader`\n"
387 " - :class:`ThicknessNoiseShader`\n"
388 " - :class:`ThicknessVariationPatternShader`\n"
389 " - :class:`TipRemoverShader`\n"
390 " - :class:`fstreamShader`\n"
391 " - :class:`streamShader`\n"
393 "- :class:`UnaryFunction0D`\n"
395 " - :class:`UnaryFunction0DDouble`\n"
397 " - :class:`Curvature2DAngleF0D`\n"
398 " - :class:`DensityF0D`\n"
399 " - :class:`GetProjectedXF0D`\n"
400 " - :class:`GetProjectedYF0D`\n"
401 " - :class:`GetProjectedZF0D`\n"
402 " - :class:`GetXF0D`\n"
403 " - :class:`GetYF0D`\n"
404 " - :class:`GetZF0D`\n"
405 " - :class:`LocalAverageDepthF0D`\n"
406 " - :class:`ZDiscontinuityF0D`\n"
408 " - :class:`UnaryFunction0DEdgeNature`\n"
410 " - :class:`CurveNatureF0D`\n"
412 " - :class:`UnaryFunction0DFloat`\n"
414 " - :class:`GetCurvilinearAbscissaF0D`\n"
415 " - :class:`GetParameterF0D`\n"
416 " - :class:`GetViewMapGradientNormF0D`\n"
417 " - :class:`ReadCompleteViewMapPixelF0D`\n"
418 " - :class:`ReadMapPixelF0D`\n"
419 " - :class:`ReadSteerableViewMapPixelF0D`\n"
421 " - :class:`UnaryFunction0DId`\n"
423 " - :class:`ShapeIdF0D`\n"
425 " - :class:`UnaryFunction0DMaterial`\n"
427 " - :class:`MaterialF0D`\n"
429 " - :class:`UnaryFunction0DUnsigned`\n"
431 " - :class:`QuantitativeInvisibilityF0D`\n"
433 " - :class:`UnaryFunction0DVec2f`\n"
435 " - :class:`Normal2DF0D`\n"
436 " - :class:`VertexOrientation2DF0D`\n"
438 " - :class:`UnaryFunction0DVec3f`\n"
440 " - :class:`VertexOrientation3DF0D`\n"
442 " - :class:`UnaryFunction0DVectorViewShape`\n"
444 " - :class:`GetOccludersF0D`\n"
446 " - :class:`UnaryFunction0DViewShape`\n"
448 " - :class:`GetOccludeeF0D`\n"
449 " - :class:`GetShapeF0D`\n"
451 "- :class:`UnaryFunction1D`\n"
453 " - :class:`UnaryFunction1DDouble`\n"
455 " - :class:`Curvature2DAngleF1D`\n"
456 " - :class:`DensityF1D`\n"
457 " - :class:`GetCompleteViewMapDensityF1D`\n"
458 " - :class:`GetDirectionalViewMapDensityF1D`\n"
459 " - :class:`GetProjectedXF1D`\n"
460 " - :class:`GetProjectedYF1D`\n"
461 " - :class:`GetProjectedZF1D`\n"
462 " - :class:`GetSteerableViewMapDensityF1D`\n"
463 " - :class:`GetViewMapGradientNormF1D`\n"
464 " - :class:`GetXF1D`\n"
465 " - :class:`GetYF1D`\n"
466 " - :class:`GetZF1D`\n"
467 " - :class:`LocalAverageDepthF1D`\n"
468 " - :class:`ZDiscontinuityF1D`\n"
470 " - :class:`UnaryFunction1DEdgeNature`\n"
472 " - :class:`CurveNatureF1D`\n"
474 " - :class:`UnaryFunction1DFloat`\n"
475 " - :class:`UnaryFunction1DUnsigned`\n"
477 " - :class:`QuantitativeInvisibilityF1D`\n"
479 " - :class:`UnaryFunction1DVec2f`\n"
481 " - :class:`Normal2DF1D`\n"
482 " - :class:`Orientation2DF1D`\n"
484 " - :class:`UnaryFunction1DVec3f`\n"
486 " - :class:`Orientation3DF1D`\n"
488 " - :class:`UnaryFunction1DVectorViewShape`\n"
490 " - :class:`GetOccludeeF1D`\n"
491 " - :class:`GetOccludersF1D`\n"
492 " - :class:`GetShapeF1D`\n"
494 " - :class:`UnaryFunction1DVoid`\n"
496 " - :class:`ChainingTimeStampF1D`\n"
497 " - :class:`IncrementChainingTimeStampF1D`\n"
498 " - :class:`TimeStampF1D`\n"
500 "- :class:`UnaryPredicate0D`\n"
502 " - :class:`FalseUP0D`\n"
503 " - :class:`TrueUP0D`\n"
505 "- :class:`UnaryPredicate1D`\n"
507 " - :class:`ContourUP1D`\n"
508 " - :class:`DensityLowerThanUP1D`\n"
509 " - :class:`EqualToChainingTimeStampUP1D`\n"
510 " - :class:`EqualToTimeStampUP1D`\n"
511 " - :class:`ExternalContourUP1D`\n"
512 " - :class:`FalseUP1D`\n"
513 " - :class:`QuantitativeInvisibilityUP1D`\n"
514 " - :class:`ShapeUP1D`\n"
515 " - :class:`TrueUP1D`\n"
516 " - :class:`WithinImageBoundaryUP1D`\n"
518 "- :class:`ViewMap`\n"
519 "- :class:`ViewShape`\n"
520 "- :class:`IntegrationType`\n"
521 "- :class:`MediumType`\n"
522 "- :class:`Nature`\n"
529# pragma clang diagnostic push
530# pragma clang diagnostic ignored "-Wcast-function-type"
532# pragma GCC diagnostic push
533# pragma GCC diagnostic ignored "-Wcast-function-type"
541 Freestyle_getCurrentScene___doc__},
542 {
"blendRamp", (PyCFunction)
Freestyle_blendRamp, METH_VARARGS, Freestyle_blendRamp___doc__},
543 {
"evaluateColorRamp",
546 Freestyle_evaluateColorRamp___doc__},
547 {
"evaluateCurveMappingF",
550 Freestyle_evaluateCurveMappingF___doc__},
551 {
nullptr,
nullptr, 0,
nullptr},
556# pragma clang diagnostic pop
558# pragma GCC diagnostic pop
582 module = PyModule_Create(&module_definition);
586 PyDict_SetItemString(PySys_GetObject(
"modules"),
module_definition.m_name, module);
591 if (path.has_value()) {
593 blender::BLI_path_join(modpath,
sizeof(modpath), path->c_str(),
"modules");
594 PyObject *sys_path = PySys_GetObject(
"path");
596 PyList_Append(sys_path, py_modpath);
597 Py_DECREF(py_modpath);
599 printf(
"Adding Python path: %s\n", modpath);
604 "Freestyle: couldn't find 'scripts/freestyle/modules', Freestyle won't work properly.\n");
General operations, lookup, etc. for materials.
int BBox_Init(PyObject *module)
int BinaryPredicate0D_Init(PyObject *module)
int BinaryPredicate1D_Init(PyObject *module)
int ContextFunctions_Init(PyObject *module)
PyDoc_STRVAR(FalseBP1D___doc__, "Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`FalseBP1D`\n" "\n" ".. method:: __call__(inter1, inter2)\n" "\n" " Always returns false.\n" "\n" " :param inter1: The first Interface1D object.\n" " :type inter1: :class:`freestyle.types.Interface1D`\n" " :param inter2: The second Interface1D object.\n" " :type inter2: :class:`freestyle.types.Interface1D`\n" " :return: False.\n" " :rtype: bool\n")
static PyObject * Freestyle_evaluateColorRamp(PyObject *, PyObject *args)
static int ramp_blend_type(const char *type)
static PyModuleDef module_definition
static PyObject * Freestyle_evaluateCurveMappingF(PyObject *, PyObject *args)
static PyObject * Freestyle_getCurrentScene(PyObject *)
static PyObject * Freestyle_blendRamp(PyObject *, PyObject *args)
PyObject * Freestyle_Init()
static PyMethodDef module_functions[]
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)
void ramp_blend(int type, float r_col[4], float fac, const float col[4])
struct FreestyleGlobals g_freestyle
PyObject * PyC_UnicodeFromBytes(const char *str)
PyObject * Vector_CreatePyObject(const float *vec, const int vec_num, PyTypeObject *base_type)
int mathutils_array_parse(float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix)
PyTypeObject pyrna_struct_Type
@ CUMA_EXTEND_EXTRAPOLATE
PyObject_HEAD std::optional< PointerRNA > ptr