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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYimingWu <xp8110@outlook.com>2021-03-16 21:35:53 +0300
committerSebastian Parborg <darkdefende@gmail.com>2021-03-16 21:59:09 +0300
commit3e87d8a4315d794efff659e40f0bb9e34e2aec8a (patch)
tree0c51740d7eef76e85736fbc2da34856c76405e94 /source/blender/blenkernel/intern/gpencil.c
parent877238e2b7f5a1d8c7e705a0112f9d9b16df77d3 (diff)
Grease Pencil: Add LineArt modifier
This adds the LineArt grease pencil modifier. It takes objects or collections as input and generates various grease pencil lines from these objects with the help of the active scene camera. For example it can generate contour lines, intersection lines and crease lines to name a few. This is really useful as artists can then use 3D meshes to automatically generate grease pencil lines for characters, enviroments or other visualization purposes. These lines can then be baked and edited as regular grease pencil lines. Reviewed By: Sebastian Parborg, Antonio Vazquez, Matias Mendiola Differential Revision: http://developer.blender.org/D8758
Diffstat (limited to 'source/blender/blenkernel/intern/gpencil.c')
-rw-r--r--source/blender/blenkernel/intern/gpencil.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 00dcaad83db..3b46672f9cd 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1663,6 +1663,31 @@ bGPDlayer *BKE_gpencil_layer_active_get(bGPdata *gpd)
return NULL;
}
+bGPDlayer *BKE_gpencil_layer_get_by_name(bGPdata *gpd, char *name, int first_if_not_found)
+{
+ bGPDlayer *gpl;
+ int i = 0;
+
+ /* error checking */
+ if (ELEM(NULL, gpd, gpd->layers.first)) {
+ return NULL;
+ }
+
+ /* loop over layers until found (assume only one active) */
+ for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+ if (STREQ(name, gpl->info)) {
+ return gpl;
+ }
+ i++;
+ }
+
+ /* no such layer */
+ if (first_if_not_found) {
+ return gpd->layers.first;
+ }
+ return NULL;
+}
+
/**
* Set active grease pencil layer.
* \param gpd: Grease pencil data-block
@@ -2421,6 +2446,21 @@ int BKE_gpencil_object_material_index_get(Object *ob, Material *ma)
return -1;
}
+int BKE_gpencil_object_material_get_index_name(Object *ob, char *name)
+{
+ short *totcol = BKE_object_material_len_p(ob);
+ Material *read_ma = NULL;
+ for (short i = 0; i < *totcol; i++) {
+ read_ma = BKE_object_material_get(ob, i + 1);
+ /* Material names are like "MAMaterial.001" */
+ if (STREQ(name, &read_ma->id.name[2])) {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
/**
* Create a default palette.
* \param bmain: Main pointer