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