clone and stencil layer access added, renamed mask to stencil layer internally

This commit is contained in:
2009-12-22 10:48:13 +00:00
parent 5a3ac3ceeb
commit 3221dea46e
9 changed files with 131 additions and 185 deletions

View File

@@ -826,24 +826,51 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel):
col.active = (ipaint.use_normal_falloff and use_projection)
col.prop(ipaint, "normal_angle", text="")
split = layout.split(percentage=0.7)
col = layout.column(align=False)
row = col.row()
row.active = (use_projection)
row.prop(ipaint, "use_stencil_layer", text="Stencil")
col = split.column(align=False)
col.active = (use_projection)
col.prop(ipaint, "use_stencil_layer")
col = split.column(align=False)
col.active = (use_projection and ipaint.use_stencil_layer)
col.prop(ipaint, "invert_stencil", text="Inv")
row2 = row.row(align=False)
row2.active = (use_projection and ipaint.use_stencil_layer)
row2.menu("VIEW3D_MT_tools_projectpaint_stencil", text=context.active_object.data.uv_texture_stencil.name)
row2.prop(ipaint, "invert_stencil", text="", icon='IMAGE_ALPHA')
col = layout.column()
sub = col.column()
sub.active = (settings.tool == 'CLONE')
sub.prop(ipaint, "use_clone_layer")
row = sub.row()
row.active = (settings.tool == 'CLONE')
row.prop(ipaint, "use_clone_layer", text="Clone")
row.menu("VIEW3D_MT_tools_projectpaint_clone", text=context.active_object.data.uv_texture_clone.name)
sub = col.column()
sub.prop(ipaint, "seam_bleed")
class VIEW3D_MT_tools_projectpaint_clone(bpy.types.Menu):
bl_label = "Clone Layer"
def draw(self, context):
layout = self.layout
for i, tex in enumerate(context.active_object.data.uv_textures):
prop = layout.operator("wm.context_set_int", text=tex.name)
prop.path = "active_object.data.uv_texture_clone_index"
prop.value = i
class VIEW3D_MT_tools_projectpaint_stencil(bpy.types.Menu):
bl_label = "Mask Layer"
def draw(self, context):
layout = self.layout
for i, tex in enumerate(context.active_object.data.uv_textures):
prop = layout.operator("wm.context_set_int", text=tex.name)
prop.path = "active_object.data.uv_texture_stencil_index"
prop.value = i
bpy.types.register(VIEW3D_MT_tools_projectpaint_clone)
bpy.types.register(VIEW3D_MT_tools_projectpaint_stencil)
class VIEW3D_PT_tools_particlemode(View3DPanel):
'''default tools for particle mode'''

View File

@@ -198,11 +198,11 @@ int CustomData_get_named_layer_index(const struct CustomData *data, int type, ch
int CustomData_get_active_layer_index(const struct CustomData *data, int type);
int CustomData_get_render_layer_index(const struct CustomData *data, int type);
int CustomData_get_clone_layer_index(const struct CustomData *data, int type);
int CustomData_get_mask_layer_index(const struct CustomData *data, int type);
int CustomData_get_stencil_layer_index(const struct CustomData *data, int type);
int CustomData_get_active_layer(const struct CustomData *data, int type);
int CustomData_get_render_layer(const struct CustomData *data, int type);
int CustomData_get_clone_layer(const struct CustomData *data, int type);
int CustomData_get_mask_layer(const struct CustomData *data, int type);
int CustomData_get_stencil_layer(const struct CustomData *data, int type);
/* copies the data from source to the data element at index in the first
* layer of type
@@ -231,13 +231,13 @@ void *CustomData_set_layer_n(const struct CustomData *data, int type, int n, voi
void CustomData_set_layer_active(struct CustomData *data, int type, int n);
void CustomData_set_layer_render(struct CustomData *data, int type, int n);
void CustomData_set_layer_clone(struct CustomData *data, int type, int n);
void CustomData_set_layer_mask(struct CustomData *data, int type, int n);
void CustomData_set_layer_stencil(struct CustomData *data, int type, int n);
/* same as above but works with an index from CustomData_get_layer_index */
void CustomData_set_layer_active_index(struct CustomData *data, int type, int n);
void CustomData_set_layer_render_index(struct CustomData *data, int type, int n);
void CustomData_set_layer_clone_index(struct CustomData *data, int type, int n);
void CustomData_set_layer_mask_index(struct CustomData *data, int type, int n);
void CustomData_set_layer_stencil_index(struct CustomData *data, int type, int n);
/* adds flag to the layer flags */
void CustomData_set_layer_flag(struct CustomData *data, int type, int flag);

View File

@@ -1006,7 +1006,7 @@ int CustomData_get_clone_layer_index(const CustomData *data, int type)
return -1;
}
int CustomData_get_mask_layer_index(const CustomData *data, int type)
int CustomData_get_stencil_layer_index(const CustomData *data, int type)
{
int i;
@@ -1050,7 +1050,7 @@ int CustomData_get_clone_layer(const CustomData *data, int type)
return -1;
}
int CustomData_get_mask_layer(const CustomData *data, int type)
int CustomData_get_stencil_layer(const CustomData *data, int type)
{
int i;
@@ -1088,7 +1088,7 @@ void CustomData_set_layer_clone(CustomData *data, int type, int n)
data->layers[i].active_clone = n;
}
void CustomData_set_layer_mask(CustomData *data, int type, int n)
void CustomData_set_layer_stencil(CustomData *data, int type, int n)
{
int i;
@@ -1125,7 +1125,7 @@ void CustomData_set_layer_clone_index(CustomData *data, int type, int n)
data->layers[i].active_clone = n-i;
}
void CustomData_set_layer_mask_index(CustomData *data, int type, int n)
void CustomData_set_layer_stencil_index(CustomData *data, int type, int n)
{
int i;

View File

@@ -72,10 +72,10 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
{
Mesh *me = ob->data;
CustomData *data= (me->edit_mesh)? &me->edit_mesh->fdata: &me->fdata;
void *actlayerdata, *rndlayerdata, *clonelayerdata, *masklayerdata, *layerdata=layer->data;
void *actlayerdata, *rndlayerdata, *clonelayerdata, *stencillayerdata, *layerdata=layer->data;
int type= layer->type;
int index= CustomData_get_layer_index(data, type);
int i, actindex, rndindex, cloneindex, maskindex;
int i, actindex, rndindex, cloneindex, stencilindex;
/* ok, deleting a non-active layer needs to preserve the active layer indices.
to do this, we store a pointer to the .data member of both layer and the active layer,
@@ -87,7 +87,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
actlayerdata = data->layers[CustomData_get_active_layer_index(data, type)].data;
rndlayerdata = data->layers[CustomData_get_render_layer_index(data, type)].data;
clonelayerdata = data->layers[CustomData_get_clone_layer_index(data, type)].data;
masklayerdata = data->layers[CustomData_get_mask_layer_index(data, type)].data;
stencillayerdata = data->layers[CustomData_get_stencil_layer_index(data, type)].data;
CustomData_set_layer_active(data, type, layer - &data->layers[index]);
if(me->edit_mesh) {
@@ -144,18 +144,18 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
CustomData_set_layer_clone(data, type, cloneindex);
}
if (masklayerdata != layerdata) {
if (stencillayerdata != layerdata) {
/* find index */
maskindex = CustomData_get_layer_index(data, type);
for (i=maskindex; i<data->totlayer; i++) {
if (data->layers[i].data == masklayerdata) {
maskindex = i - maskindex;
stencilindex = CustomData_get_layer_index(data, type);
for (i=stencilindex; i<data->totlayer; i++) {
if (data->layers[i].data == stencillayerdata) {
stencilindex = i - stencilindex;
break;
}
}
/* set index */
CustomData_set_layer_mask(data, type, maskindex);
CustomData_set_layer_stencil(data, type, stencilindex);
}
}

View File

@@ -228,7 +228,7 @@ typedef struct ProjPaintState {
MFace *dm_mface;
MTFace *dm_mtface;
MTFace *dm_mtface_clone; /* other UV layer, use for cloning between layers */
MTFace *dm_mtface_mask;
MTFace *dm_mtface_stencil;
/* projection painting only */
MemArena *arena_mt[BLENDER_MAX_THREADS];/* for multithreading, the first item is sometimes used for non threaded cases too */
@@ -257,8 +257,8 @@ typedef struct ProjPaintState {
/* options for projection painting */
int do_layer_clone;
int do_layer_mask;
int do_layer_mask_inv;
int do_layer_stencil;
int do_layer_stencil_inv;
short do_occlude; /* Use raytraced occlusion? - ortherwise will paint right through to the back*/
short do_backfacecull; /* ignore faces with normals pointing away, skips a lot of raycasts if your normals are correctly flipped */
@@ -1265,10 +1265,10 @@ float project_paint_uvpixel_mask(
float mask;
/* Image Mask */
if (ps->do_layer_mask) {
if (ps->do_layer_stencil) {
/* another UV layers image is masking this one's */
ImBuf *ibuf_other;
const MTFace *tf_other = ps->dm_mtface_mask + face_index;
const MTFace *tf_other = ps->dm_mtface_stencil + face_index;
if (tf_other->tpage && (ibuf_other = BKE_image_get_ibuf(tf_other->tpage, NULL))) {
/* BKE_image_get_ibuf - TODO - this may be slow */
@@ -1284,7 +1284,7 @@ float project_paint_uvpixel_mask(
mask = ((rgba_ub[0]+rgba_ub[1]+rgba_ub[2])/(256*3.0f)) * (rgba_ub[3]/256.0f);
}
if (!ps->do_layer_mask_inv) /* matching the gimps layer mask black/white rules, white==full opacity */
if (!ps->do_layer_stencil_inv) /* matching the gimps layer mask black/white rules, white==full opacity */
mask = (1.0f - mask);
if (mask == 0.0f) {
@@ -2863,15 +2863,15 @@ static void project_paint_begin(ProjPaintState *ps)
}
}
if (ps->do_layer_mask) {
//int layer_num = CustomData_get_mask_layer(&ps->dm->faceData, CD_MTFACE);
int layer_num = CustomData_get_mask_layer(&((Mesh *)ps->ob->data)->fdata, CD_MTFACE);
if (ps->do_layer_stencil) {
//int layer_num = CustomData_get_stencil_layer(&ps->dm->faceData, CD_MTFACE);
int layer_num = CustomData_get_stencil_layer(&((Mesh *)ps->ob->data)->fdata, CD_MTFACE);
if (layer_num != -1)
ps->dm_mtface_mask = CustomData_get_layer_n(&ps->dm->faceData, CD_MTFACE, layer_num);
ps->dm_mtface_stencil = CustomData_get_layer_n(&ps->dm->faceData, CD_MTFACE, layer_num);
if (ps->dm_mtface_mask==NULL || ps->dm_mtface_mask==ps->dm_mtface) {
ps->do_layer_mask = 0;
ps->dm_mtface_mask = NULL;
if (ps->dm_mtface_stencil==NULL || ps->dm_mtface_stencil==ps->dm_mtface) {
ps->do_layer_stencil = 0;
ps->dm_mtface_stencil = NULL;
}
}
@@ -4438,8 +4438,8 @@ static int texture_paint_init(bContext *C, wmOperator *op)
if (pop->ps.tool == PAINT_TOOL_CLONE)
pop->ps.do_layer_clone = (settings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_CLONE);
pop->ps.do_layer_mask = (settings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_MASK) ? 1 : 0;
pop->ps.do_layer_mask_inv = (settings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_MASK_INV) ? 1 : 0;
pop->ps.do_layer_stencil = (settings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_STENCIL) ? 1 : 0;
pop->ps.do_layer_stencil_inv = (settings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_STENCIL_INV) ? 1 : 0;
#ifndef PROJ_DEBUG_NOSEAMBLEED

View File

@@ -363,133 +363,6 @@ static void image_editcursor_buts(const bContext *C, View2D *v2d, uiBlock *block
}
}
#if 0
static void image_panel_view_properties(const bContext *C, Panel *pa)
{
}
#endif
void brush_buttons(const bContext *C, uiBlock *block, short fromsima,
int evt_nop, int evt_change,
int evt_browse, int evt_local,
int evt_del, int evt_keepdata,
int evt_texbrowse, int evt_texdel)
{
// SpaceImage *sima= CTX_wm_space_image(C);
ToolSettings *settings= CTX_data_tool_settings(C);
Brush *brush= paint_brush(&settings->imapaint.paint);
ID *id;
int yco, xco, butw, but_idx;
// short *menupoin = &(sima->menunr); // XXX : &(G.buts->menunr);
short do_project = settings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE ? 0:1;
yco= 160;
butw = fromsima ? 80 : 106;
uiBlockBeginAlign(block);
but_idx = 0;
uiDefButS(block, ROW, evt_change, "Draw", butw*(but_idx++),yco,butw,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_DRAW, 0, 0, "Draw brush");
if (fromsima || do_project==0)
uiDefButS(block, ROW, evt_change, "Soften", butw*(but_idx++), yco,butw,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SOFTEN, 0, 0, "Soften brush");
uiDefButS(block, ROW, evt_change, "Smear", butw*(but_idx++), yco,butw,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SMEAR, 0, 0, "Smear brush");
if (fromsima || do_project)
uiDefButS(block, ROW, evt_change, "Clone", butw*(but_idx++), yco,butw,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_CLONE, 0, 0, "Clone brush, use RMB to drag source image");
uiBlockEndAlign(block);
yco -= 30;
id= (ID*)brush;
xco= 200; // std_libbuttons(block, 0, yco, 0, NULL, evt_browse, ID_BR, 0, id, NULL, menupoin, 0, evt_local, evt_del, 0, evt_keepdata);
if(brush && !brush->id.lib) {
butw= 320-(xco+10);
uiDefButS(block, MENU, evt_nop, "Mix %x0|Add %x1|Subtract %x2|Multiply %x3|Lighten %x4|Darken %x5|Erase Alpha %x6|Add Alpha %x7", xco+10,yco,butw,19, &brush->blend, 0, 0, 0, 0, "Blending method for applying brushes");
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG|BIT, BRUSH_AIRBRUSH, evt_change, "Airbrush", xco+10,yco-25,butw/2,19, &brush->flag, 0, 0, 0, 0, "Keep applying paint effect while holding mouse (spray)");
uiDefButF(block, NUM, evt_nop, "", xco+10 + butw/2,yco-25,butw/2,19, &brush->rate, 0.01, 1.0, 0, 0, "Number of paints per second for Airbrush");
uiBlockEndAlign(block);
if (fromsima) {
uiDefButBitS(block, TOG|BIT, BRUSH_TORUS, evt_change, "Wrap", xco+10,yco-45,butw,19, &brush->flag, 0, 0, 0, 0, "Enables torus wrapping");
yco -= 25;
}
else {
yco -= 25;
uiBlockBeginAlign(block);
uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_DISABLE, B_REDR, "Project Paint", xco+10,yco-25,butw,19, &settings->imapaint.flag, 0, 0, 0, 0, "Use projection painting for improved consistency in the brush strokes");
if ((settings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE)==0) {
/* Projection Painting */
uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_XRAY, B_NOP, "Occlude", xco+10,yco-45,butw/2,19, &settings->imapaint.flag, 0, 0, 0, 0, "Only paint onto the faces directly under the brush (slower)");
uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_BACKFACE, B_NOP, "Cull", xco+10+butw/2,yco-45,butw/2,19, &settings->imapaint.flag, 0, 0, 0, 0, "Ignore faces pointing away from the view (faster)");
uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_FLAT, B_NOP, "Normal", xco+10,yco-65,butw/2,19, &settings->imapaint.flag, 0, 0, 0, 0, "Paint most on faces pointing towards the view");
uiDefButS(block, NUM, B_NOP, "", xco+10 +(butw/2),yco-65,butw/2,19, &settings->imapaint.normal_angle, 10.0, 90.0, 0, 0, "Paint most on faces pointing towards the view acording to this angle");
uiDefButS(block, NUM, B_NOP, "Bleed: ", xco+10,yco-85,butw,19, &settings->imapaint.seam_bleed, 0.0, 8.0, 0, 0, "Extend paint beyond the faces UVs to reduce seams (in pixels, slower)");
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG|BIT, IMAGEPAINT_PROJECT_LAYER_MASK, B_NOP, "Stencil Layer", xco+10,yco-110,butw-30,19, &settings->imapaint.flag, 0, 0, 0, 0, "Set the mask layer from the UV layer buttons");
uiDefButBitS(block, TOG|BIT, IMAGEPAINT_PROJECT_LAYER_MASK_INV, B_NOP, "Inv", xco+10 + butw-30,yco-110,30,19, &settings->imapaint.flag, 0, 0, 0, 0, "Invert the mask");
uiBlockEndAlign(block);
}
uiBlockEndAlign(block);
}
uiBlockBeginAlign(block);
uiDefButF(block, COL, B_VPCOLSLI, "", 0,yco,200,19, brush->rgb, 0, 0, 0, 0, "");
uiDefButF(block, NUMSLI, evt_nop, "Opacity ", 0,yco-20,180,19, &brush->alpha, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
uiDefIconButBitS(block, TOG|BIT, BRUSH_ALPHA_PRESSURE, evt_nop, ICON_STYLUS_PRESSURE, 180,yco-20,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
uiDefButI(block, NUMSLI, evt_nop, "Size ", 0,yco-40,180,19, &brush->size, 1, 200, 0, 0, "The size of the brush");
uiDefIconButBitS(block, TOG|BIT, BRUSH_SIZE_PRESSURE, evt_nop, ICON_STYLUS_PRESSURE, 180,yco-40,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
// uiDefButF(block, NUMSLI, evt_nop, "Falloff ", 0,yco-60,180,19, &brush->innerradius, 0.0, 1.0, 0, 0, "The fall off radius of the brush");
// uiDefIconButBitS(block, TOG|BIT, BRUSH_RAD_PRESSURE, evt_nop, ICON_STYLUS_PRESSURE, 180,yco-60,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
uiDefButF(block, NUMSLI, evt_nop, "Spacing ",0,yco-80,180,19, &brush->spacing, 1.0, 100.0, 0, 0, "Repeating paint on %% of brush diameter");
uiDefIconButBitS(block, TOG|BIT, BRUSH_SPACING_PRESSURE, evt_nop, ICON_STYLUS_PRESSURE, 180,yco-80,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
uiBlockEndAlign(block);
yco -= 110;
if(fromsima && settings->imapaint.tool == PAINT_TOOL_CLONE) {
id= (ID*)brush->clone.image;
xco= 200; // std_libbuttons(block, 0, yco, 0, NULL, B_SIMACLONEBROWSE, ID_IM, 0, id, 0, menupoin, 0, 0, B_SIMACLONEDELETE, 0, 0);
if(id) {
butw= 320-(xco+5);
uiDefButF(block, NUMSLI, evt_change, "B ",xco+5,yco,butw,19, &brush->clone.alpha , 0.0, 1.0, 0, 0, "Opacity of clone image display");
}
}
else {
if (
(fromsima==0) && /* 3D View */
(settings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE)==0 && /* Projection Painting */
(settings->imapaint.tool == PAINT_TOOL_CLONE)
) {
butw = 130;
uiDefButBitS(block, TOG|BIT, IMAGEPAINT_PROJECT_LAYER_CLONE, B_REDR, "Clone Layer", 0,yco,butw,20, &settings->imapaint.flag, 0, 0, 0, 0, "Use another UV layer as clone source, otherwise use 3D the cursor as the source");
}
else {
MTex *mtex= brush->mtex[brush->texact];
id= (mtex)? (ID*)mtex->tex: NULL;
xco= 200; // std_libbuttons(block, 0, yco, 0, NULL, evt_texbrowse, ID_TE, 0, id, NULL, menupoin, 0, 0, evt_texdel, 0, 0);
/*uiDefButBitS(block, TOG|BIT, BRUSH_FIXED_TEX, evt_change, "Fixed", xco+5,yco,butw,19, &brush->flag, 0, 0, 0, 0, "Keep texture origin in fixed position");*/
}
}
}
#if 0
uiDefButBitS(block, TOG|BIT, IMAGEPAINT_DRAW_TOOL_DRAWING, B_SIMABRUSHCHANGE, "TD", 0,1,50,19, &settings->imapaint.flag.flag, 0, 0, 0, 0, "Enables brush shape while drawing");
uiDefButBitS(block, TOG|BIT, IMAGEPAINT_DRAW_TOOL, B_SIMABRUSHCHANGE, "TP", 50,1,50,19, &settings->imapaint.flag.flag, 0, 0, 0, 0, "Enables brush shape while not drawing");
#endif
}
static int image_panel_poll(const bContext *C, PanelType *pt)
{
SpaceImage *sima= CTX_wm_space_image(C);

View File

@@ -1092,8 +1092,8 @@ typedef enum SculptFlags {
#define IMAGEPAINT_PROJECT_BACKFACE 32
#define IMAGEPAINT_PROJECT_FLAT 64
#define IMAGEPAINT_PROJECT_LAYER_CLONE 128
#define IMAGEPAINT_PROJECT_LAYER_MASK 256
#define IMAGEPAINT_PROJECT_LAYER_MASK_INV 512
#define IMAGEPAINT_PROJECT_LAYER_STENCIL 256
#define IMAGEPAINT_PROJECT_LAYER_STENCIL_INV 512
/* toolsettings->uvcalc_flag */
#define UVCALC_FILLHOLES 1

View File

@@ -330,7 +330,7 @@ static PointerRNA rna_Mesh_active_uv_texture_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFaceLayer, cdl);
}
static PointerRNA rna_Mesh_clone_uv_texture_get(PointerRNA *ptr)
static PointerRNA rna_Mesh_uv_texture_clone_get(PointerRNA *ptr)
{
Mesh *me= (Mesh*)ptr->data;
CustomData *fdata= rna_mesh_fdata(me);
@@ -340,6 +340,16 @@ static PointerRNA rna_Mesh_clone_uv_texture_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFaceLayer, cdl);
}
static PointerRNA rna_Mesh_uv_texture_stencil_get(PointerRNA *ptr)
{
Mesh *me= (Mesh*)ptr->data;
CustomData *fdata= rna_mesh_fdata(me);
int index= CustomData_get_stencil_layer_index(fdata, CD_MTFACE);
CustomDataLayer *cdl= (index == -1)? NULL: &fdata->layers[index];
return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFaceLayer, cdl);
}
static void rna_Mesh_active_uv_texture_set(PointerRNA *ptr, PointerRNA value)
{
Mesh *me= (Mesh*)ptr->data;
@@ -356,7 +366,7 @@ static void rna_Mesh_active_uv_texture_set(PointerRNA *ptr, PointerRNA value)
}
}
static void rna_Mesh_clone_uv_texture_set(PointerRNA *ptr, PointerRNA value)
static void rna_Mesh_uv_texture_clone_set(PointerRNA *ptr, PointerRNA value)
{
Mesh *me= (Mesh*)ptr->data;
CustomData *fdata= rna_mesh_fdata(me);
@@ -366,7 +376,21 @@ static void rna_Mesh_clone_uv_texture_set(PointerRNA *ptr, PointerRNA value)
for(cdl=fdata->layers, a=0; a<fdata->totlayer; cdl++, a++) {
if(value.data == cdl) {
CustomData_set_layer_clone_index(fdata, CD_MTFACE, a);
mesh_update_customdata_pointers(me);
return;
}
}
}
static void rna_Mesh_uv_texture_stencil_set(PointerRNA *ptr, PointerRNA value)
{
Mesh *me= (Mesh*)ptr->data;
CustomData *fdata= rna_mesh_fdata(me);
CustomDataLayer *cdl;
int a;
for(cdl=fdata->layers, a=0; a<fdata->totlayer; cdl++, a++) {
if(value.data == cdl) {
CustomData_set_layer_stencil_index(fdata, CD_MTFACE, a);
return;
}
}
@@ -379,13 +403,20 @@ static int rna_Mesh_active_uv_texture_index_get(PointerRNA *ptr)
return CustomData_get_active_layer(fdata, CD_MTFACE);
}
static int rna_Mesh_clone_uv_texture_index_get(PointerRNA *ptr)
static int rna_Mesh_uv_texture_clone_index_get(PointerRNA *ptr)
{
Mesh *me= (Mesh*)ptr->data;
CustomData *fdata= rna_mesh_fdata(me);
return CustomData_get_clone_layer(fdata, CD_MTFACE);
}
static int rna_Mesh_uv_texture_stencil_index_get(PointerRNA *ptr)
{
Mesh *me= (Mesh*)ptr->data;
CustomData *fdata= rna_mesh_fdata(me);
return CustomData_get_stencil_layer(fdata, CD_MTFACE);
}
static void rna_Mesh_active_uv_texture_index_set(PointerRNA *ptr, int value)
{
Mesh *me= (Mesh*)ptr->data;
@@ -395,13 +426,20 @@ static void rna_Mesh_active_uv_texture_index_set(PointerRNA *ptr, int value)
mesh_update_customdata_pointers(me);
}
static void rna_Mesh_clone_uv_texture_index_set(PointerRNA *ptr, int value)
static void rna_Mesh_uv_texture_clone_index_set(PointerRNA *ptr, int value)
{
Mesh *me= (Mesh*)ptr->data;
CustomData *fdata= rna_mesh_fdata(me);
CustomData_set_layer_clone(fdata, CD_MTFACE, value);
mesh_update_customdata_pointers(me);
}
static void rna_Mesh_uv_texture_stencil_index_set(PointerRNA *ptr, int value)
{
Mesh *me= (Mesh*)ptr->data;
CustomData *fdata= rna_mesh_fdata(me);
CustomData_set_layer_stencil(fdata, CD_MTFACE, value);
}
static void rna_Mesh_active_uv_texture_index_range(PointerRNA *ptr, int *min, int *max)
@@ -1593,17 +1631,25 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Active UV Texture Index", "Active UV texture index.");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
prop= RNA_def_property(srna, "clone_uv_texture", PROP_POINTER, PROP_UNSIGNED);
prop= RNA_def_property(srna, "uv_texture_clone", PROP_POINTER, PROP_UNSIGNED);
RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
RNA_def_property_pointer_funcs(prop, "rna_Mesh_clone_uv_texture_get", "rna_Mesh_clone_uv_texture_set", NULL);
RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_clone_get", "rna_Mesh_uv_texture_clone_set", NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Clone UV Texture", "UV texture to be used as cloning source.");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
prop= RNA_def_property(srna, "clone_uv_texture_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_funcs(prop, "rna_Mesh_clone_uv_texture_index_get", "rna_Mesh_clone_uv_texture_index_set", "rna_Mesh_active_uv_texture_index_range");
prop= RNA_def_property(srna, "uv_texture_clone_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_clone_index_get", "rna_Mesh_uv_texture_clone_index_set", "rna_Mesh_active_uv_texture_index_range");
RNA_def_property_ui_text(prop, "Clone UV Texture Index", "Clone UV texture index.");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
prop= RNA_def_property(srna, "uv_texture_stencil", PROP_POINTER, PROP_UNSIGNED);
RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_stencil_get", "rna_Mesh_uv_texture_stencil_set", NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Mask UV Texture", "UV texture to mask the painted area.");
prop= RNA_def_property(srna, "uv_texture_stencil_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_stencil_index_get", "rna_Mesh_uv_texture_stencil_index_set", "rna_Mesh_active_uv_texture_index_range");
RNA_def_property_ui_text(prop, "Mask UV Texture Index", "Mask UV texture index.");
/* Vertex colors */

View File

@@ -315,11 +315,11 @@ static void rna_def_image_paint(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Normal", "Paint most on faces pointing towards the view");
prop= RNA_def_property(srna, "use_stencil_layer", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_MASK);
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL);
RNA_def_property_ui_text(prop, "Stencil Layer", "Set the mask layer from the UV layer buttons");
prop= RNA_def_property(srna, "invert_stencil", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_MASK_INV);
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL_INV);
RNA_def_property_ui_text(prop, "Invert", "Invert the stencil layer");
prop= RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE);