40#include "RNA_prototypes.hh"
43#include "../generic/py_capi_utils.hh"
58 Freestyle_getCurrentScene___doc__,
59 ".. function:: getCurrentScene()\n"
61 " Returns the current scene.\n"
63 " :return: The current scene.\n"
64 " :rtype: :class:`bpy.types.Scene`\n");
70 PyErr_SetString(PyExc_TypeError,
"current scene not available");
81 if (
STREQ(type,
"MIX")) {
84 if (
STREQ(type,
"ADD")) {
87 if (
STREQ(type,
"MULTIPLY")) {
90 if (
STREQ(type,
"SUBTRACT")) {
93 if (
STREQ(type,
"SCREEN")) {
96 if (
STREQ(type,
"DIVIDE")) {
99 if (
STREQ(type,
"DIFFERENCE")) {
102 if (
STREQ(type,
"EXCLUSION")) {
105 if (
STREQ(type,
"DARKEN")) {
108 if (
STREQ(type,
"LIGHTEN")) {
111 if (
STREQ(type,
"OVERLAY")) {
114 if (
STREQ(type,
"DODGE")) {
117 if (
STREQ(type,
"BURN")) {
120 if (
STREQ(type,
"HUE")) {
123 if (
STREQ(type,
"SATURATION")) {
126 if (
STREQ(type,
"VALUE")) {
129 if (
STREQ(type,
"COLOR")) {
132 if (
STREQ(type,
"SOFT_LIGHT")) {
135 if (
STREQ(type,
"LINEAR_LIGHT")) {
145 Freestyle_blendRamp___doc__,
146 ".. function:: blendRamp(type, color1, fac, color2)\n"
148 " Blend two colors according to a ramp blend type.\n"
150 " :arg type: Ramp blend type.\n"
152 " :arg color1: 1st color.\n"
153 " :type color1: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n"
154 " :arg fac: Blend factor.\n"
155 " :type fac: float\n"
156 " :arg color2: 1st color.\n"
157 " :type color2: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n"
158 " :return: Blended color in RGB format.\n"
159 " :rtype: :class:`mathutils.Vector`\n");
163 PyObject *obj1, *obj2;
166 float a[3], fac,
b[3];
168 if (!PyArg_ParseTuple(args,
"sOfO", &s, &obj1, &fac, &obj2)) {
173 PyErr_SetString(PyExc_TypeError,
"argument 1 is an unknown ramp blend type");
180 "argument 2 must be a 3D vector "
181 "(either a tuple/list of 3 elements or Vector)") == -1)
189 "argument 4 must be a 3D vector "
190 "(either a tuple/list of 3 elements or Vector)") == -1)
200 Freestyle_evaluateColorRamp___doc__,
201 ".. function:: evaluateColorRamp(ramp, in)\n"
203 " Evaluate a color ramp at a point in the interval 0 to 1.\n"
205 " :arg ramp: Color ramp object.\n"
206 " :type ramp: :class:`bpy.types.ColorRamp`\n"
207 " :arg in: Value in the interval 0 to 1.\n"
209 " :return: color in RGBA format.\n"
210 " :rtype: :class:`mathutils.Vector`\n");
222 PyErr_SetString(PyExc_TypeError,
"1st argument is not a ColorRamp object");
227 PyErr_SetString(PyExc_ValueError,
"failed to evaluate the color ramp");
237 Freestyle_evaluateCurveMappingF___doc__,
238 ".. function:: evaluateCurveMappingF(cumap, cur, value)\n"
240 " Evaluate a curve mapping at a point in the interval 0 to 1.\n"
242 " :arg cumap: Curve mapping object.\n"
243 " :type cumap: :class:`bpy.types.CurveMapping`\n"
244 " :arg cur: Index of the curve to be used (0 <= cur <= 3).\n"
246 " :arg value: Input value in the interval 0 to 1.\n"
247 " :type value: float\n"
248 " :return: Mapped output value.\n"
258 if (!PyArg_ParseTuple(args,
"O!if", &
pyrna_struct_Type, &py_srna, &cur, &value)) {
262 PyErr_SetString(PyExc_TypeError,
"1st argument is not a CurveMapping object");
265 if (cur < 0 || cur > 3) {
266 PyErr_SetString(PyExc_ValueError,
"2nd argument is out of range");
273 cumap->
flag &= ~CUMA_EXTEND_EXTRAPOLATE;
284 "This module provides classes for defining line drawing rules (such as\n"
285 "predicates, functions, chaining iterators, and stroke shaders), as well\n"
286 "as helper functions for style module writing.\n"
291 "- :class:`BinaryPredicate0D`\n"
292 "- :class:`BinaryPredicate1D`\n"
294 " - :class:`FalseBP1D`\n"
295 " - :class:`Length2DBP1D`\n"
296 " - :class:`SameShapeIdBP1D`\n"
297 " - :class:`TrueBP1D`\n"
298 " - :class:`ViewMapGradientNormBP1D`\n"
301 "- :class:`Interface0D`\n"
303 " - :class:`CurvePoint`\n"
305 " - :class:`StrokeVertex`\n"
307 " - :class:`SVertex`\n"
308 " - :class:`ViewVertex`\n"
310 " - :class:`NonTVertex`\n"
311 " - :class:`TVertex`\n"
313 "- :class:`Interface1D`\n"
315 " - :class:`Curve`\n"
317 " - :class:`Chain`\n"
319 " - :class:`FEdge`\n"
321 " - :class:`FEdgeSharp`\n"
322 " - :class:`FEdgeSmooth`\n"
324 " - :class:`Stroke`\n"
325 " - :class:`ViewEdge`\n"
327 "- :class:`Iterator`\n"
329 " - :class:`AdjacencyIterator`\n"
330 " - :class:`CurvePointIterator`\n"
331 " - :class:`Interface0DIterator`\n"
332 " - :class:`SVertexIterator`\n"
333 " - :class:`StrokeVertexIterator`\n"
334 " - :class:`ViewEdgeIterator`\n"
336 " - :class:`ChainingIterator`\n"
338 " - :class:`ChainPredicateIterator`\n"
339 " - :class:`ChainSilhouetteIterator`\n"
341 " - :class:`orientedViewEdgeIterator`\n"
343 "- :class:`Material`\n"
345 "- :class:`Operators`\n"
346 "- :class:`SShape`\n"
347 "- :class:`StrokeAttribute`\n"
348 "- :class:`StrokeShader`\n"
350 " - :class:`BackboneStretcherShader`\n"
351 " - :class:`BezierCurveShader`\n"
352 " - :class:`BlenderTextureShader`\n"
353 " - :class:`CalligraphicShader`\n"
354 " - :class:`ColorNoiseShader`\n"
355 " - :class:`ColorVariationPatternShader`\n"
356 " - :class:`ConstantColorShader`\n"
357 " - :class:`ConstantThicknessShader`\n"
358 " - :class:`ConstrainedIncreasingThicknessShader`\n"
359 " - :class:`GuidingLinesShader`\n"
360 " - :class:`IncreasingColorShader`\n"
361 " - :class:`IncreasingThicknessShader`\n"
362 " - :class:`PolygonalizationShader`\n"
363 " - :class:`SamplingShader`\n"
364 " - :class:`SmoothingShader`\n"
365 " - :class:`SpatialNoiseShader`\n"
366 " - :class:`StrokeTextureShader`\n"
367 " - :class:`StrokeTextureStepShader`\n"
368 " - :class:`TextureAssignerShader`\n"
369 " - :class:`ThicknessNoiseShader`\n"
370 " - :class:`ThicknessVariationPatternShader`\n"
371 " - :class:`TipRemoverShader`\n"
372 " - :class:`fstreamShader`\n"
373 " - :class:`streamShader`\n"
375 "- :class:`UnaryFunction0D`\n"
377 " - :class:`UnaryFunction0DDouble`\n"
379 " - :class:`Curvature2DAngleF0D`\n"
380 " - :class:`DensityF0D`\n"
381 " - :class:`GetProjectedXF0D`\n"
382 " - :class:`GetProjectedYF0D`\n"
383 " - :class:`GetProjectedZF0D`\n"
384 " - :class:`GetXF0D`\n"
385 " - :class:`GetYF0D`\n"
386 " - :class:`GetZF0D`\n"
387 " - :class:`LocalAverageDepthF0D`\n"
388 " - :class:`ZDiscontinuityF0D`\n"
390 " - :class:`UnaryFunction0DEdgeNature`\n"
392 " - :class:`CurveNatureF0D`\n"
394 " - :class:`UnaryFunction0DFloat`\n"
396 " - :class:`GetCurvilinearAbscissaF0D`\n"
397 " - :class:`GetParameterF0D`\n"
398 " - :class:`GetViewMapGradientNormF0D`\n"
399 " - :class:`ReadCompleteViewMapPixelF0D`\n"
400 " - :class:`ReadMapPixelF0D`\n"
401 " - :class:`ReadSteerableViewMapPixelF0D`\n"
403 " - :class:`UnaryFunction0DId`\n"
405 " - :class:`ShapeIdF0D`\n"
407 " - :class:`UnaryFunction0DMaterial`\n"
409 " - :class:`MaterialF0D`\n"
411 " - :class:`UnaryFunction0DUnsigned`\n"
413 " - :class:`QuantitativeInvisibilityF0D`\n"
415 " - :class:`UnaryFunction0DVec2f`\n"
417 " - :class:`Normal2DF0D`\n"
418 " - :class:`VertexOrientation2DF0D`\n"
420 " - :class:`UnaryFunction0DVec3f`\n"
422 " - :class:`VertexOrientation3DF0D`\n"
424 " - :class:`UnaryFunction0DVectorViewShape`\n"
426 " - :class:`GetOccludersF0D`\n"
428 " - :class:`UnaryFunction0DViewShape`\n"
430 " - :class:`GetOccludeeF0D`\n"
431 " - :class:`GetShapeF0D`\n"
433 "- :class:`UnaryFunction1D`\n"
435 " - :class:`UnaryFunction1DDouble`\n"
437 " - :class:`Curvature2DAngleF1D`\n"
438 " - :class:`DensityF1D`\n"
439 " - :class:`GetCompleteViewMapDensityF1D`\n"
440 " - :class:`GetDirectionalViewMapDensityF1D`\n"
441 " - :class:`GetProjectedXF1D`\n"
442 " - :class:`GetProjectedYF1D`\n"
443 " - :class:`GetProjectedZF1D`\n"
444 " - :class:`GetSteerableViewMapDensityF1D`\n"
445 " - :class:`GetViewMapGradientNormF1D`\n"
446 " - :class:`GetXF1D`\n"
447 " - :class:`GetYF1D`\n"
448 " - :class:`GetZF1D`\n"
449 " - :class:`LocalAverageDepthF1D`\n"
450 " - :class:`ZDiscontinuityF1D`\n"
452 " - :class:`UnaryFunction1DEdgeNature`\n"
454 " - :class:`CurveNatureF1D`\n"
456 " - :class:`UnaryFunction1DFloat`\n"
457 " - :class:`UnaryFunction1DUnsigned`\n"
459 " - :class:`QuantitativeInvisibilityF1D`\n"
461 " - :class:`UnaryFunction1DVec2f`\n"
463 " - :class:`Normal2DF1D`\n"
464 " - :class:`Orientation2DF1D`\n"
466 " - :class:`UnaryFunction1DVec3f`\n"
468 " - :class:`Orientation3DF1D`\n"
470 " - :class:`UnaryFunction1DVectorViewShape`\n"
472 " - :class:`GetOccludeeF1D`\n"
473 " - :class:`GetOccludersF1D`\n"
474 " - :class:`GetShapeF1D`\n"
476 " - :class:`UnaryFunction1DVoid`\n"
478 " - :class:`ChainingTimeStampF1D`\n"
479 " - :class:`IncrementChainingTimeStampF1D`\n"
480 " - :class:`TimeStampF1D`\n"
482 "- :class:`UnaryPredicate0D`\n"
484 " - :class:`FalseUP0D`\n"
485 " - :class:`TrueUP0D`\n"
487 "- :class:`UnaryPredicate1D`\n"
489 " - :class:`ContourUP1D`\n"
490 " - :class:`DensityLowerThanUP1D`\n"
491 " - :class:`EqualToChainingTimeStampUP1D`\n"
492 " - :class:`EqualToTimeStampUP1D`\n"
493 " - :class:`ExternalContourUP1D`\n"
494 " - :class:`FalseUP1D`\n"
495 " - :class:`QuantitativeInvisibilityUP1D`\n"
496 " - :class:`ShapeUP1D`\n"
497 " - :class:`TrueUP1D`\n"
498 " - :class:`WithinImageBoundaryUP1D`\n"
500 "- :class:`ViewMap`\n"
501 "- :class:`ViewShape`\n"
502 "- :class:`IntegrationType`\n"
503 "- :class:`MediumType`\n"
504 "- :class:`Nature`\n"
513 Freestyle_getCurrentScene___doc__},
514 {
"blendRamp", (PyCFunction)
Freestyle_blendRamp, METH_VARARGS, Freestyle_blendRamp___doc__},
515 {
"evaluateColorRamp",
518 Freestyle_evaluateColorRamp___doc__},
519 {
"evaluateCurveMappingF",
522 Freestyle_evaluateCurveMappingF___doc__},
523 {
nullptr,
nullptr, 0,
nullptr},
529 PyModuleDef_HEAD_INIT,
546 module = PyModule_Create(&module_definition);
555 if (path.has_value()) {
557 BLI_path_join(modpath,
sizeof(modpath), path->c_str(),
"modules");
558 PyObject *sys_path = PySys_GetObject(
"path");
560 PyList_Append(sys_path, py_modpath);
561 Py_DECREF(py_modpath);
563 printf(
"Adding Python path: %s\n", modpath);
568 "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)
int ContextFunctions_Init(PyObject *module)
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()
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")
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)
@ CUMA_EXTEND_EXTRAPOLATE
struct FreestyleGlobals g_freestyle
PyTypeObject pyrna_struct_Type
PyObject * pyrna_struct_CreatePyObject(PointerRNA *ptr)
local_group_size(16, 16) .push_constant(Type b
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(ID *id, StructRNA *type, void *data)
PyObject_HEAD PointerRNA ptr