~ubuntu-branches/ubuntu/trusty/blender/trusty-proposed

« back to all changes in this revision

Viewing changes to source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2013-08-14 10:43:49 UTC
  • mfrom: (14.2.19 sid)
  • Revision ID: package-import@ubuntu.com-20130814104349-t1d5mtwkphp12dyj
Tags: 2.68a-3
* Upload to unstable
* debian/: python3.3 Depends simplified
  - debian/control: python3.3 Depends dropped
    for blender-data package
  - 0001-blender_thumbnailer.patch refreshed
* debian/control: libavcodec b-dep versioning dropped

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * ***** BEGIN GPL LICENSE BLOCK *****
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU General Public License
 
6
 * as published by the Free Software Foundation; either version 2
 
7
 * of the License, or (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software Foundation,
 
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
17
 *
 
18
 * ***** END GPL LICENSE BLOCK *****
 
19
 */
 
20
 
 
21
/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp
 
22
 *  \ingroup freestyle
 
23
 */
 
24
 
 
25
#include "BPy_StrokeTextureShader.h"
 
26
 
 
27
#include "../../stroke/BasicStrokeShaders.h"
 
28
#include "../BPy_Convert.h"
 
29
#include "../BPy_MediumType.h"
 
30
 
 
31
#ifdef __cplusplus
 
32
extern "C" {
 
33
#endif
 
34
 
 
35
///////////////////////////////////////////////////////////////////////////////////////////
 
36
 
 
37
//------------------------INSTANCE METHODS ----------------------------------
 
38
 
 
39
static char StrokeTextureShader___doc__[] =
 
40
"Class hierarchy: :class:`StrokeShader` > :class:`StrokeTextureShader`\n"
 
41
"\n"
 
42
"[Texture shader]\n"
 
43
"\n"
 
44
".. method:: __init__(texture_file, medium_type=Stroke.OPAQUE_MEDIUM, tips=False)\n"
 
45
"\n"
 
46
"   Builds a StrokeTextureShader object.\n"
 
47
"\n"
 
48
"   :arg texture_file: \n"
 
49
"   :type texture_file: str\n"
 
50
"   :arg medium_type: The medium type and therefore, the blending mode\n"
 
51
"      that must be used for the rendering of this stroke.\n"
 
52
"   :type medium_type: :class:`MediumType`\n"
 
53
"   :arg tips: Tells whether the texture includes tips or not.  If it\n"
 
54
"      is the case, the texture image must respect the following format.\n"
 
55
"   :type tips: bool\n"
 
56
"\n"
 
57
"   The format of a texture image including tips::\n"
 
58
"\n"
 
59
"       ___________\n"
 
60
"      |           |\n"
 
61
"      |     A     |\n"
 
62
"      |___________|\n"
 
63
"      |     |     |\n"
 
64
"      |  B  |  C  |\n"
 
65
"      |_____|_____|\n"
 
66
"\n"
 
67
"   * A : The stroke's corpus texture.\n"
 
68
"   * B : The stroke's left extremity texture.\n"
 
69
"   * C : The stroke's right extremity texture.\n"
 
70
"\n"
 
71
".. method:: shade(stroke)\n"
 
72
"\n"
 
73
"   Assigns a texture and a blending mode to the stroke in order to\n"
 
74
"   simulate its marks system.\n"
 
75
"\n"
 
76
"   :arg stroke: A Stroke object.\n"
 
77
"   :type stroke: :class:`Stroke`\n";
 
78
 
 
79
static int StrokeTextureShader___init__(BPy_StrokeTextureShader *self, PyObject *args, PyObject *kwds)
 
80
{
 
81
        static const char *kwlist[] = {"texture_file", "medium_type", "tips", NULL};
 
82
        const char *s1;
 
83
        PyObject *obj2 = 0, *obj3 = 0;
 
84
 
 
85
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|O!O!", (char **)kwlist,
 
86
                                         &s1, &MediumType_Type, &obj2, &PyBool_Type, &obj3))
 
87
        {
 
88
                return -1;
 
89
        }
 
90
        Stroke::MediumType mt = (!obj2) ? Stroke::OPAQUE_MEDIUM : MediumType_from_BPy_MediumType(obj2);
 
91
        bool b = (!obj3) ? false : bool_from_PyBool(obj3);
 
92
        self->py_ss.ss = new StrokeShaders::StrokeTextureShader(s1, mt, b);
 
93
        return 0;
 
94
}
 
95
 
 
96
/*-----------------------BPy_StrokeTextureShader type definition ------------------------------*/
 
97
 
 
98
PyTypeObject StrokeTextureShader_Type = {
 
99
        PyVarObject_HEAD_INIT(NULL, 0)
 
100
        "StrokeTextureShader",          /* tp_name */
 
101
        sizeof(BPy_StrokeTextureShader), /* tp_basicsize */
 
102
        0,                              /* tp_itemsize */
 
103
        0,                              /* tp_dealloc */
 
104
        0,                              /* tp_print */
 
105
        0,                              /* tp_getattr */
 
106
        0,                              /* tp_setattr */
 
107
        0,                              /* tp_reserved */
 
108
        0,                              /* tp_repr */
 
109
        0,                              /* tp_as_number */
 
110
        0,                              /* tp_as_sequence */
 
111
        0,                              /* tp_as_mapping */
 
112
        0,                              /* tp_hash  */
 
113
        0,                              /* tp_call */
 
114
        0,                              /* tp_str */
 
115
        0,                              /* tp_getattro */
 
116
        0,                              /* tp_setattro */
 
117
        0,                              /* tp_as_buffer */
 
118
        Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
 
119
        StrokeTextureShader___doc__,    /* tp_doc */
 
120
        0,                              /* tp_traverse */
 
121
        0,                              /* tp_clear */
 
122
        0,                              /* tp_richcompare */
 
123
        0,                              /* tp_weaklistoffset */
 
124
        0,                              /* tp_iter */
 
125
        0,                              /* tp_iternext */
 
126
        0,                              /* tp_methods */
 
127
        0,                              /* tp_members */
 
128
        0,                              /* tp_getset */
 
129
        &StrokeShader_Type,             /* tp_base */
 
130
        0,                              /* tp_dict */
 
131
        0,                              /* tp_descr_get */
 
132
        0,                              /* tp_descr_set */
 
133
        0,                              /* tp_dictoffset */
 
134
        (initproc)StrokeTextureShader___init__, /* tp_init */
 
135
        0,                              /* tp_alloc */
 
136
        0,                              /* tp_new */
 
137
};
 
138
 
 
139
///////////////////////////////////////////////////////////////////////////////////////////
 
140
 
 
141
#ifdef __cplusplus
 
142
}
 
143
#endif