3

I'm working on Blender C++ code for a degree thesis.

When I apply a stroke to an object in the sculpting system, I have to save informations about brushes and their locations. To do that, I save into a file all datas of Brush type defined in blender/makesdna/DNA_brush_types.h except for these values:

ID id;
struct BrushClone clone;
struct CurveMapping *curve; /* falloff curve */
struct MTex mtex;
struct MTex mask_mtex;
struct Brush *toggle_brush;
struct ImBuf *icon_imbuf;
PreviewImage *preview;
char icon_filepath[1024]; /* 1024 = FILE_MAX */

I save them into the function sculpt_stroke_done of /blender/editors/sculpt_paint/sculpt.c.

For its location I save mouse coordinates into sculpt_stroke_test_start of the same source file.

Then, into a new instance of Blender, I want to reload that info to apply to an object the same stroke, and I want that it happens also clicking everywhere into the 3d view (not only clicking over the object). I do this loading file information into /blender/editors/sculpt_paint/paint_stroke.c (paint_stroke_new method). I'm making tests into the starting Blender context (sculpting the cube into the initial scene of Blender), and with strokes defined by only one click (the simplest brush I think). At the moment, the result is this: when I try to reapply the same brush, I obtain a transformation of the cube (scale or translation I mean). Anyway it seems to apply also the brush, but the sculpting deformation isn't the same of the saved brush. My professor suggested me to find other parameters that i have to save, but what?

Can someone help me?

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
Jarvis
  • 31
  • 4

0 Answers0