Blender V5.0
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 " :arg 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 " :arg 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 MTex *_mtex;
51 bNodeTree *_nodetree;
52
53 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj)) {
54 return -1;
55 }
56 _mtex = (MTex *)PyC_RNA_AsPointer(obj, "LineStyleTextureSlot");
57 if (_mtex) {
58 self->py_ss.ss = new StrokeShaders::BlenderTextureShader(_mtex);
59 return 0;
60 }
61 PyErr_Clear();
62 _nodetree = (bNodeTree *)PyC_RNA_AsPointer(obj, "ShaderNodeTree");
63 if (_nodetree) {
64 self->py_ss.ss = new StrokeShaders::BlenderTextureShader(_nodetree);
65 return 0;
66 }
67 PyErr_Format(PyExc_TypeError,
68 "expected either 'LineStyleTextureSlot' or 'ShaderNodeTree', "
69 "found '%.200s' instead",
70 Py_TYPE(obj)->tp_name);
71 return -1;
72}
73
74/*-----------------------BPy_BlenderTextureShader type definition ------------------------------*/
75
77 /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0)
78 /*tp_name*/ "BlenderTextureShader",
79 /*tp_basicsize*/ sizeof(BPy_BlenderTextureShader),
80 /*tp_itemsize*/ 0,
81 /*tp_dealloc*/ nullptr,
82 /*tp_vectorcall_offset*/ 0,
83 /*tp_getattr*/ nullptr,
84 /*tp_setattr*/ nullptr,
85 /*tp_as_async*/ nullptr,
86 /*tp_repr*/ nullptr,
87 /*tp_as_number*/ nullptr,
88 /*tp_as_sequence*/ nullptr,
89 /*tp_as_mapping*/ nullptr,
90 /*tp_hash*/ nullptr,
91 /*tp_call*/ nullptr,
92 /*tp_str*/ nullptr,
93 /*tp_getattro*/ nullptr,
94 /*tp_setattro*/ nullptr,
95 /*tp_as_buffer*/ nullptr,
96 /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
97 /*tp_doc*/ BlenderTextureShader___doc__,
98 /*tp_traverse*/ nullptr,
99 /*tp_clear*/ nullptr,
100 /*tp_richcompare*/ nullptr,
101 /*tp_weaklistoffset*/ 0,
102 /*tp_iter*/ nullptr,
103 /*tp_iternext*/ nullptr,
104 /*tp_methods*/ nullptr,
105 /*tp_members*/ nullptr,
106 /*tp_getset*/ nullptr,
107 /*tp_base*/ &StrokeShader_Type,
108 /*tp_dict*/ nullptr,
109 /*tp_descr_get*/ nullptr,
110 /*tp_descr_set*/ nullptr,
111 /*tp_dictoffset*/ 0,
112 /*tp_init*/ (initproc)BlenderTextureShader___init__,
113 /*tp_alloc*/ nullptr,
114 /*tp_new*/ nullptr,
115};
116
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 " "a set of textures.\n" " :type texture: :class:`bpy.types.LineStyleTextureSlot` | " ":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)