Blender V5.3
BPy_BlenderTextureShader.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2004-2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10
12
14
15using namespace Freestyle;
16
18
19//------------------------INSTANCE METHODS ----------------------------------
20
22 /* Wrap. */
23 BlenderTextureShader___doc__,
24 "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`BlenderTextureShader`\n"
25 "\n"
26 "[Texture shader]\n"
27 "\n"
28 ".. method:: __init__(texture)\n"
29 "\n"
30 " Builds a BlenderTextureShader object.\n"
31 "\n"
32 " :param texture: A line style texture slot or a shader node tree to define "
33 "a set of textures.\n"
34 " :type texture: :class:`bpy.types.LineStyleTextureSlot` | "
35 ":class:`bpy.types.ShaderNodeTree`\n"
36 "\n"
37 ".. method:: shade(stroke)\n"
38 "\n"
39 " Assigns a blender texture slot to the stroke shading in order to\n"
40 " simulate marks.\n"
41 "\n"
42 " :param stroke: A Stroke object.\n"
43 " :type stroke: :class:`freestyle.types.Stroke`\n");
45 PyObject *args,
46 PyObject *kwds)
47{
48 static const char *kwlist[] = {"texture", nullptr};
49 PyObject *obj;
50 blender::MTex *_mtex;
51 blender::bNodeTree *_nodetree;
52
53 if (!PyArg_ParseTupleAndKeywords(args,
54 kwds,
55 "O" /* `texture` */
56 ":__init__",
57 (char **)kwlist,
58 &obj))
59 {
60 return -1;
61 }
62 _mtex = (blender::MTex *)blender::PyC_RNA_AsPointer(obj, "LineStyleTextureSlot");
63 if (_mtex) {
65 return 0;
66 }
67 PyErr_Clear();
68 _nodetree = (blender::bNodeTree *)blender::PyC_RNA_AsPointer(obj, "ShaderNodeTree");
69 if (_nodetree) {
70 self->py_ss.ss = new StrokeShaders::BlenderTextureShader(_nodetree);
71 return 0;
72 }
73 PyErr_Format(PyExc_TypeError,
74 "expected either 'LineStyleTextureSlot' or 'ShaderNodeTree', "
75 "found '%.200s' instead",
76 Py_TYPE(obj)->tp_name);
77 return -1;
78}
79
80/*-----------------------BPy_BlenderTextureShader type definition ------------------------------*/
81
83 /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0)
84 /*tp_name*/ "BlenderTextureShader",
85 /*tp_basicsize*/ sizeof(BPy_BlenderTextureShader),
86 /*tp_itemsize*/ 0,
87 /*tp_dealloc*/ nullptr,
88 /*tp_vectorcall_offset*/ 0,
89 /*tp_getattr*/ nullptr,
90 /*tp_setattr*/ nullptr,
91 /*tp_as_async*/ nullptr,
92 /*tp_repr*/ nullptr,
93 /*tp_as_number*/ nullptr,
94 /*tp_as_sequence*/ nullptr,
95 /*tp_as_mapping*/ nullptr,
96 /*tp_hash*/ nullptr,
97 /*tp_call*/ nullptr,
98 /*tp_str*/ nullptr,
99 /*tp_getattro*/ nullptr,
100 /*tp_setattro*/ nullptr,
101 /*tp_as_buffer*/ nullptr,
102 /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
103 /*tp_doc*/ BlenderTextureShader___doc__,
104 /*tp_traverse*/ nullptr,
105 /*tp_clear*/ nullptr,
106 /*tp_richcompare*/ nullptr,
107 /*tp_weaklistoffset*/ 0,
108 /*tp_iter*/ nullptr,
109 /*tp_iternext*/ nullptr,
110 /*tp_methods*/ nullptr,
111 /*tp_members*/ nullptr,
112 /*tp_getset*/ nullptr,
113 /*tp_base*/ &StrokeShader_Type,
114 /*tp_dict*/ nullptr,
115 /*tp_descr_get*/ nullptr,
116 /*tp_descr_set*/ nullptr,
117 /*tp_dictoffset*/ 0,
118 /*tp_init*/ (initproc)BlenderTextureShader___init__,
119 /*tp_alloc*/ nullptr,
120 /*tp_new*/ nullptr,
121};
122
static int BlenderTextureShader___init__(BPy_BlenderTextureShader *self, PyObject *args, PyObject *kwds)
PyTypeObject BlenderTextureShader_Type
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")
PyTypeObject StrokeShader_Type
Class gathering basic stroke shaders.
inherits from class Rep
Definition AppCanvas.cpp:20
void * PyC_RNA_AsPointer(PyObject *value, const char *type_name)
PyObject_HEAD Freestyle::StrokeShader * ss