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