Welcome to mirror list, hosted at ThFree Co, Russian Federation.

BKE_brush_engine.h « blenkernel « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5695cae3649a383810dee4cf2b6d1027ec308980 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#pragma once

/*
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
 * All rights reserved.
 */

/** \file
 * \ingroup bke
 * \brief New brush engine for sculpt
 */
#ifdef __cplusplus
extern "C" {
#endif

#include "RNA_types.h"

/*
The new brush engine is based on command lists.  These lists
will eventually be created by a node editor.

Key is the concept of BrushChannels.  A brush channel is
a logical parameter with a type, input settings (e.g. pen),
a falloff curve, etc.

Brush channels have a concept of inheritance.  There is a
BrushChannelSet (collection of channels) in Sculpt,
in Brush, and in BrushCommand.  Inheritence behavior
is controller via BrushChannel->flag.

This should completely replace UnifiedPaintSettings.
*/
struct BrushChannel;

#include "BLO_read_write.h"
#include "DNA_sculpt_brush_types.h"

typedef struct BrushMappingDef {
  int curve;
  bool enabled;
  bool inv;
  float min, max;
  int blendmode;
} BrushMappingDef;

typedef struct BrushMappingPreset {
  // must match order of BRUSH_MAPPING_XXX enums
  struct BrushMappingDef pressure, xtilt, ytilt, angle, speed;
} BrushMappingPreset;

#define MAX_BRUSH_ENUM_DEF 32

typedef struct BrushEnumDef {
  EnumPropertyItem items[MAX_BRUSH_ENUM_DEF];
} BrushEnumDef;

typedef struct BrushChannelType {
  char name[32], idname[32];
  float min, max, soft_min, soft_max;
  BrushMappingPreset mappings;

  int type, flag;
  int ivalue;
  float fvalue;
  BrushEnumDef enumdef;  // if an enum type
} BrushChannelType;

typedef struct BrushCommand {
  int tool;
  struct BrushChannelSet *params;
  struct BrushChannelSet *params_final;
  int totparam;
} BrushCommand;

typedef struct BrushCommandList {
  BrushCommand *commands;
  int totcommand;
} BrushCommandList;

void BKE_brush_channel_free(BrushChannel *ch);
void BKE_brush_channel_copy(BrushChannel *dst, BrushChannel *src);
void BKE_brush_channel_init(BrushChannel *ch, BrushChannelType *def);
BrushChannelSet *BKE_brush_channelset_create();

void BKE_brush_channelset_free(BrushChannelSet *chset);
void BKE_brush_channelset_add(BrushChannelSet *chset, BrushChannel *ch);

BrushChannel *BKE_brush_channelset_lookup(BrushChannelSet *chset, const char *idname);

bool BKE_brush_channelset_has(BrushChannelSet *chset, const char *idname);

void BKE_brush_channelset_add_builtin(BrushChannelSet *chset, const char *idname);
bool BKE_brush_channelset_ensure_builtin(BrushChannelSet *chset, const char *idname);

void BKE_brush_channelset_merge(BrushChannelSet *dst,
                                BrushChannelSet *child,
                                BrushChannelSet *parent);

void BKE_brush_resolve_channels(struct Brush *brush, struct Sculpt *sd);
int BKE_brush_channel_get_int(BrushChannelSet *chset, char *idname);
float BKE_brush_channel_get_float(BrushChannelSet *chset, char *idname);
float BKE_brush_channel_set_float(BrushChannelSet *chset, char *idname, float val);
void BKE_brush_init_toolsettings(struct Sculpt *sd);
void BKE_brush_builtin_create(struct Brush *brush, int tool);
BrushCommandList *BKE_brush_commandlist_create();
void BKE_brush_commandlist_free(BrushCommandList *cl);
BrushCommand *BKE_brush_commandlist_add(BrushCommandList *cl);
BrushCommand *BKE_brush_command_init(BrushCommand *command, int tool);
void BKE_builtin_commandlist_create(BrushChannelSet *chset, BrushCommandList *cl, int tool);
void BKE_brush_channelset_read(BlendDataReader *reader, BrushChannelSet *cset);
void BKE_brush_channelset_write(BlendWriter *writer, BrushChannelSet *cset);

#ifdef __cplusplus
}
#endif