2012-12-11 22:00:22 +00:00
|
|
|
/*
|
2010-06-25 22:45:42 +00:00
|
|
|
* 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) 2010 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
2012-12-11 22:00:22 +00:00
|
|
|
#ifndef __BKE_LINESTYLE_H__
|
|
|
|
#define __BKE_LINESTYLE_H__
|
2012-12-20 07:57:26 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
|
|
|
* \brief Blender kernel freestyle line style functionality.
|
2012-12-11 22:00:22 +00:00
|
|
|
*/
|
2010-06-25 22:45:42 +00:00
|
|
|
|
2010-07-20 17:57:33 +00:00
|
|
|
#include "DNA_linestyle_types.h"
|
|
|
|
|
2014-07-19 15:33:15 +09:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2010-07-20 17:57:33 +00:00
|
|
|
#define LS_MODIFIER_TYPE_COLOR 1
|
|
|
|
#define LS_MODIFIER_TYPE_ALPHA 2
|
|
|
|
#define LS_MODIFIER_TYPE_THICKNESS 3
|
2011-08-19 14:05:11 +00:00
|
|
|
#define LS_MODIFIER_TYPE_GEOMETRY 4
|
2010-06-25 22:45:42 +00:00
|
|
|
|
2019-01-28 21:08:24 +11:00
|
|
|
struct ColorBand;
|
2010-06-25 22:45:42 +00:00
|
|
|
struct Main;
|
2010-11-29 21:24:55 +00:00
|
|
|
struct Object;
|
2018-04-24 15:20:17 +02:00
|
|
|
struct ViewLayer;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bContext;
|
2010-06-25 22:45:42 +00:00
|
|
|
|
First step to handle missing libs/datablocks when reading a file.
Idea is, instead of ignoring completely missing linked datablocks, to
create void placeholders for them.
That way, you can work on your file, save it, and find again your missing data once
lib becomes available again. Or you can edit missing lib's path (in Outliner),
save and reload the file, and you are done.
Also, Outliner now shows broken libraries (and placeholders) with a 'broken lib' icon.
Future plans are also to be able to relocate missing libs and reload them at runtime.
Code notes:
- Placeholder ID is just a regular datablock of same type as expected linked one,
with 'default' data, and a LIB_MISSING bitflag set.
- To allow creation of such datablocks, creation of datablocks in BKE was split in two step:
+ Allocation of memory itself.
+ Setting of all internal data to default values.
See also the design task (T43351).
Reviewed by @campbellbarton, thanks a bunch!
Differential Revision: https://developer.blender.org/D1394
2015-10-20 14:44:57 +02:00
|
|
|
void BKE_linestyle_init(struct FreestyleLineStyle *linestyle);
|
2015-03-19 14:33:05 +11:00
|
|
|
FreestyleLineStyle *BKE_linestyle_new(struct Main *bmain, const char *name);
|
2014-07-16 15:13:40 +10:00
|
|
|
void BKE_linestyle_free(FreestyleLineStyle *linestyle);
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
void BKE_linestyle_copy_data(
|
|
|
|
struct Main *bmain, struct FreestyleLineStyle *linestyle_dst, const struct FreestyleLineStyle *linestyle_src,
|
|
|
|
const int flag);
|
2017-06-14 22:36:30 +02:00
|
|
|
FreestyleLineStyle *BKE_linestyle_copy(struct Main *bmain, const FreestyleLineStyle *linestyle);
|
2011-11-14 00:43:37 +00:00
|
|
|
|
2016-07-21 16:09:08 +02:00
|
|
|
void BKE_linestyle_make_local(struct Main *bmain, struct FreestyleLineStyle *linestyle, const bool lib_local);
|
|
|
|
|
2018-04-24 15:20:17 +02:00
|
|
|
FreestyleLineStyle *BKE_linestyle_active_from_view_layer(struct ViewLayer *view_layer);
|
2014-07-16 13:36:39 +09:00
|
|
|
|
2014-07-17 09:23:30 +09:00
|
|
|
LineStyleModifier *BKE_linestyle_color_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type);
|
|
|
|
LineStyleModifier *BKE_linestyle_alpha_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type);
|
|
|
|
LineStyleModifier *BKE_linestyle_thickness_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type);
|
|
|
|
LineStyleModifier *BKE_linestyle_geometry_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type);
|
2010-07-20 17:57:33 +00:00
|
|
|
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
LineStyleModifier *BKE_linestyle_color_modifier_copy(
|
|
|
|
FreestyleLineStyle *linestyle, const LineStyleModifier *m, const int flag);
|
|
|
|
LineStyleModifier *BKE_linestyle_alpha_modifier_copy(
|
|
|
|
FreestyleLineStyle *linestyle, const LineStyleModifier *m, const int flag);
|
|
|
|
LineStyleModifier *BKE_linestyle_thickness_modifier_copy(
|
|
|
|
FreestyleLineStyle *linestyle, const LineStyleModifier *m, const int flag);
|
|
|
|
LineStyleModifier *BKE_linestyle_geometry_modifier_copy(
|
|
|
|
FreestyleLineStyle *linestyle, const LineStyleModifier *m, const int flag);
|
2010-07-20 17:57:33 +00:00
|
|
|
|
2014-07-17 09:23:30 +09:00
|
|
|
int BKE_linestyle_color_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier);
|
|
|
|
int BKE_linestyle_alpha_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier);
|
|
|
|
int BKE_linestyle_thickness_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier);
|
|
|
|
int BKE_linestyle_geometry_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier);
|
2010-07-20 17:57:33 +00:00
|
|
|
|
2016-09-18 21:36:34 +02:00
|
|
|
bool BKE_linestyle_color_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction);
|
|
|
|
bool BKE_linestyle_alpha_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction);
|
|
|
|
bool BKE_linestyle_thickness_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction);
|
|
|
|
bool BKE_linestyle_geometry_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction);
|
2010-09-18 00:31:22 +00:00
|
|
|
|
2014-07-16 15:13:40 +10:00
|
|
|
void BKE_linestyle_modifier_list_color_ramps(FreestyleLineStyle *linestyle, ListBase *listbase);
|
|
|
|
char *BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle, struct ColorBand *color_ramp);
|
2010-11-29 21:24:55 +00:00
|
|
|
|
2014-07-19 15:33:15 +09:00
|
|
|
bool BKE_linestyle_use_textures(FreestyleLineStyle *linestyle, const bool use_shading_nodes);
|
|
|
|
|
2014-07-16 15:25:10 +09:00
|
|
|
void BKE_linestyle_default_shader(const struct bContext *C, FreestyleLineStyle *linestyle);
|
|
|
|
|
2014-07-19 15:33:15 +09:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-12-20 07:57:26 +00:00
|
|
|
#endif /* __BKE_LINESTYLE_H__ */
|