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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-05-03 13:51:53 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-05-03 13:54:59 +0400
commitb7f085d9c128f31d576c732c6439b5a71e8922ee (patch)
tree8a1fdc2e95470f61d9121b18b125dc272e87d536 /source/blender/blenkernel/intern/linestyle.c
parent6ec2d72eca618be05e9bf0723886b10e6d5efa46 (diff)
Patch D246: Texture Marks for freestyle strokes, written and contributed by Paolo Acampora.
Reviewers: brecht, kjym3, #freestyle Reviewed By: brecht, kjym3 Differential Revision: https://developer.blender.org/D246
Diffstat (limited to 'source/blender/blenkernel/intern/linestyle.c')
-rw-r--r--source/blender/blenkernel/intern/linestyle.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c
index 54ae0120c1b..ee55cf72419 100644
--- a/source/blender/blenkernel/intern/linestyle.c
+++ b/source/blender/blenkernel/intern/linestyle.c
@@ -46,6 +46,7 @@
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_linestyle.h"
+#include "BKE_node.h"
#include "BKE_texture.h"
#include "BKE_colortools.h"
#include "BKE_animsys.h"
@@ -80,7 +81,7 @@ static void default_linestyle_settings(FreestyleLineStyle *linestyle)
linestyle->thickness = 3.0f;
linestyle->thickness_position = LS_THICKNESS_CENTER;
linestyle->thickness_ratio = 0.5f;
- linestyle->flag = LS_SAME_OBJECT | LS_NO_SORTING;
+ linestyle->flag = LS_SAME_OBJECT | LS_NO_SORTING | LS_TEXTURE;
linestyle->chaining = LS_CHAINING_PLAIN;
linestyle->rounds = 3;
linestyle->min_angle = DEG2RADF(0.0f);
@@ -90,6 +91,7 @@ static void default_linestyle_settings(FreestyleLineStyle *linestyle)
linestyle->split_length = 100;
linestyle->sort_key = LS_SORT_KEY_DISTANCE_FROM_CAMERA;
linestyle->integration_type = LS_INTEGRATION_MEAN;
+ linestyle->texstep = 1.0f;
BLI_listbase_clear(&linestyle->color_modifiers);
BLI_listbase_clear(&linestyle->alpha_modifiers);
@@ -119,6 +121,19 @@ void BKE_free_linestyle(FreestyleLineStyle *linestyle)
{
LineStyleModifier *m;
+ MTex *mtex;
+ int a;
+
+ for (a = 0; a < MAX_MTEX; a++) {
+ mtex = linestyle->mtex[a];
+ if (mtex && mtex->tex) mtex->tex->id.us--;
+ if (mtex) MEM_freeN(mtex);
+ }
+ if (linestyle->nodetree) {
+ ntreeFreeTree(linestyle->nodetree);
+ MEM_freeN(linestyle->nodetree);
+ }
+
BKE_free_animdata(&linestyle->id);
while ((m = (LineStyleModifier *)linestyle->color_modifiers.first))
BKE_remove_linestyle_color_modifier(linestyle, m);
@@ -134,10 +149,22 @@ FreestyleLineStyle *BKE_copy_linestyle(FreestyleLineStyle *linestyle)
{
FreestyleLineStyle *new_linestyle;
LineStyleModifier *m;
+ int a;
new_linestyle = BKE_new_linestyle(linestyle->id.name + 2, NULL);
BKE_free_linestyle(new_linestyle);
+ for (a = 0; a < MAX_MTEX; a++) {
+ if (linestyle->mtex[a]) {
+ new_linestyle->mtex[a] = MEM_mallocN(sizeof(MTex), "BKE_copy_linestyle");
+ memcpy(new_linestyle->mtex[a], linestyle->mtex[a], sizeof(MTex));
+ id_us_plus((ID *)new_linestyle->mtex[a]->tex);
+ }
+ }
+ if (linestyle->nodetree) {
+ linestyle->nodetree = ntreeCopyTree(linestyle->nodetree);
+ }
+
new_linestyle->r = linestyle->r;
new_linestyle->g = linestyle->g;
new_linestyle->b = linestyle->b;
@@ -167,6 +194,7 @@ FreestyleLineStyle *BKE_copy_linestyle(FreestyleLineStyle *linestyle)
new_linestyle->dash3 = linestyle->dash3;
new_linestyle->gap3 = linestyle->gap3;
new_linestyle->panel = linestyle->panel;
+ new_linestyle->texstep = linestyle->texstep;
for (m = (LineStyleModifier *)linestyle->color_modifiers.first; m; m = m->next)
BKE_copy_linestyle_color_modifier(new_linestyle, m);
for (m = (LineStyleModifier *)linestyle->alpha_modifiers.first; m; m = m->next)