* Image painting back. 2d paint, 3d paint and projection, undo,
  pressure, repeating paint operations, etc should all work.
  Drawing cursor needs a bit of work, only gets shown when enabling
  texture paint mode now.

* Move sculpt, image paint, and vertex/weight paint into a single
  sculpt_paint module. Doesn't make much difference now, but nice
  to have it together for better integration and consistency in
  the future.
This commit is contained in:
Brecht Van Lommel 2009-02-19 23:53:40 +00:00
parent 2cb5af58a6
commit 8e41a21607
36 changed files with 5493 additions and 283 deletions

View File

@ -29,6 +29,6 @@
# Bounces make to subdirectories.
SOURCEDIR = source/blender/editors
DIRS = armature mesh animation object sculpt datafiles transform screen curve gpencil physics preview uvedit space_outliner space_time space_view3d interface util space_api space_graph space_image space_node space_buttons space_info space_file space_sound space_action space_nla space_script space_text space_sequencer
DIRS = armature mesh animation object sculpt_paint datafiles transform screen curve gpencil physics preview uvedit space_outliner space_time space_view3d interface util space_api space_graph space_image space_node space_buttons space_info space_file space_sound space_action space_nla space_script space_text space_sequencer
include nan_subdirs.mk

View File

@ -31,5 +31,5 @@ SConscript(['datafiles/SConscript',
'space_sequencer/SConscript',
'transform/SConscript',
'screen/SConscript',
'sculpt/SConscript',
'sculpt_paint/SConscript',
'uvedit/SConscript'])

View File

@ -99,6 +99,7 @@ void ED_keymap_screen(struct wmWindowManager *wm);
int ED_operator_screenactive(struct bContext *C);
int ED_operator_screen_mainwinactive(struct bContext *C);
int ED_operator_areaactive(struct bContext *C);
int ED_operator_regionactive(struct bContext *C);
int ED_operator_scene_editable(struct bContext *C);

View File

@ -31,7 +31,15 @@
struct bContext;
struct wmWindowManager;
/* sculpt.c */
void ED_operatortypes_sculpt(void);
void ED_keymap_sculpt(wmWindowManager *wm);
void ED_keymap_sculpt(struct wmWindowManager *wm);
/* paint_ops.c */
void ED_operatortypes_paint(void);
/* paint_image.c */
void undo_imagepaint_step(int step);
void undo_imagepaint_clear(void);
#endif

View File

@ -112,6 +112,8 @@ unsigned int view3d_sample_backbuf_rect(struct ViewContext *vc, short mval[2], i
void *handle, unsigned int (*indextest)(void *handle, unsigned int index));
unsigned int view3d_sample_backbuf(struct ViewContext *vc, int x, int y);
int view_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, short *mval, float mouse_worldloc[3]);
/* select */
#define MAXPICKBUF 10000
short view3d_opengl_select(struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, rcti *input);
@ -119,6 +121,7 @@ short view3d_opengl_select(struct ViewContext *vc, unsigned int *buffer, unsigne
void view3d_set_viewcontext(struct bContext *C, struct ViewContext *vc);
void view3d_operator_needs_opengl(const struct bContext *C);
void view3d_get_view_aligned_coordinate(struct ViewContext *vc, float *fp, short mval[2]);
void view3d_get_object_project_mat(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4], float vmat[4][4]);;
/* XXX should move to arithb.c */
int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, short x2, short y2);
@ -126,6 +129,5 @@ int edge_inside_circle(short centx, short centy, short rad, short x1, short y1,
/* modes */
void ED_view3d_exit_paint_modes(struct bContext *C);
#endif /* ED_VIEW3D_H */

View File

@ -144,16 +144,6 @@ MTFace *EM_get_active_mtface(EditMesh *em, EditFace **act_efa, MCol **mcol, int
return NULL;
}
static void make_tfaces(Object *ob)
{
Mesh *me= ob->data;
if(!me->mtface) {
me->mtface= CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DEFAULT,
NULL, me->totface);
}
}
void reveal_tface(Scene *scene)
{
Mesh *me;
@ -734,155 +724,4 @@ void face_borderselect(Scene *scene, ARegion *ar)
#endif
}
/* Texture Paint */
void set_texturepaint(Scene *scene) /* toggle */
{
Object *ob = OBACT;
Mesh *me = 0;
if(ob==NULL) return;
if (object_data_is_libdata(ob)) {
// XXX error_libdata();
return;
}
me= get_mesh(ob);
if(me)
DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
if(G.f & G_TEXTUREPAINT) {
G.f &= ~G_TEXTUREPAINT;
GPU_paint_set_mipmap(1);
}
else if (me) {
G.f |= G_TEXTUREPAINT;
if(me->mtface==NULL)
make_tfaces(ob);
brush_check_exists(&scene->toolsettings->imapaint.brush);
GPU_paint_set_mipmap(0);
}
}
static void texpaint_project(Object *ob, float *model, float *proj, float *co, float *pco)
{
VECCOPY(pco, co);
pco[3]= 1.0f;
Mat4MulVecfl(ob->obmat, pco);
Mat4MulVecfl((float(*)[4])model, pco);
Mat4MulVec4fl((float(*)[4])proj, pco);
}
static void texpaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, float *co, float *w)
{
float pv1[4], pv2[4], pv3[4], h[3], divw;
float model[16], proj[16], wmat[3][3], invwmat[3][3];
GLint view[4];
/* compute barycentric coordinates */
/* get the needed opengl matrices */
glGetIntegerv(GL_VIEWPORT, view);
glGetFloatv(GL_MODELVIEW_MATRIX, model);
glGetFloatv(GL_PROJECTION_MATRIX, proj);
view[0] = view[1] = 0;
/* project the verts */
texpaint_project(ob, model, proj, v1, pv1);
texpaint_project(ob, model, proj, v2, pv2);
texpaint_project(ob, model, proj, v3, pv3);
/* do inverse view mapping, see gluProject man page */
h[0]= (co[0] - view[0])*2.0f/view[2] - 1;
h[1]= (co[1] - view[1])*2.0f/view[3] - 1;
h[2]= 1.0f;
/* solve for (w1,w2,w3)/perspdiv in:
h*perspdiv = Project*Model*(w1*v1 + w2*v2 + w3*v3) */
wmat[0][0]= pv1[0]; wmat[1][0]= pv2[0]; wmat[2][0]= pv3[0];
wmat[0][1]= pv1[1]; wmat[1][1]= pv2[1]; wmat[2][1]= pv3[1];
wmat[0][2]= pv1[3]; wmat[1][2]= pv2[3]; wmat[2][2]= pv3[3];
Mat3Inv(invwmat, wmat);
Mat3MulVecfl(invwmat, h);
VECCOPY(w, h);
/* w is still divided by perspdiv, make it sum to one */
divw= w[0] + w[1] + w[2];
if(divw != 0.0f)
VecMulf(w, 1.0f/divw);
}
/* compute uv coordinates of mouse in face */
void texpaint_pick_uv(Scene *scene, Object *ob, Mesh *mesh, unsigned int faceindex, short *xy, float *uv)
{
DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
int *index = dm->getFaceDataArray(dm, CD_ORIGINDEX);
MTFace *tface = dm->getFaceDataArray(dm, CD_MTFACE), *tf;
int numfaces = dm->getNumFaces(dm), a;
float p[2], w[3], absw, minabsw;
MFace mf;
MVert mv[4];
minabsw = 1e10;
uv[0] = uv[1] = 0.0;
// XXX persp(PERSP_VIEW);
/* test all faces in the derivedmesh with the original index of the picked face */
for (a = 0; a < numfaces; a++) {
if (index[a] == faceindex) {
dm->getFace(dm, a, &mf);
dm->getVert(dm, mf.v1, &mv[0]);
dm->getVert(dm, mf.v2, &mv[1]);
dm->getVert(dm, mf.v3, &mv[2]);
if (mf.v4)
dm->getVert(dm, mf.v4, &mv[3]);
tf= &tface[a];
p[0]= xy[0];
p[1]= xy[1];
if (mf.v4) {
/* the triangle with the largest absolute values is the one
with the most negative weights */
texpaint_tri_weights(ob, mv[0].co, mv[1].co, mv[3].co, p, w);
absw= fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
if(absw < minabsw) {
uv[0]= tf->uv[0][0]*w[0] + tf->uv[1][0]*w[1] + tf->uv[3][0]*w[2];
uv[1]= tf->uv[0][1]*w[0] + tf->uv[1][1]*w[1] + tf->uv[3][1]*w[2];
minabsw = absw;
}
texpaint_tri_weights(ob, mv[1].co, mv[2].co, mv[3].co, p, w);
absw= fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
if (absw < minabsw) {
uv[0]= tf->uv[1][0]*w[0] + tf->uv[2][0]*w[1] + tf->uv[3][0]*w[2];
uv[1]= tf->uv[1][1]*w[0] + tf->uv[2][1]*w[1] + tf->uv[3][1]*w[2];
minabsw = absw;
}
}
else {
texpaint_tri_weights(ob, mv[0].co, mv[1].co, mv[2].co, p, w);
absw= fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
if (absw < minabsw) {
uv[0]= tf->uv[0][0]*w[0] + tf->uv[1][0]*w[1] + tf->uv[2][0]*w[2];
uv[1]= tf->uv[0][1]*w[0] + tf->uv[1][1]*w[1] + tf->uv[2][1]*w[2];
minabsw = absw;
}
}
}
}
dm->release(dm);
}

View File

@ -73,6 +73,14 @@
/* ************** Exported Poll tests ********************** */
int ED_operator_regionactive(bContext *C)
{
if(CTX_wm_window(C)==NULL) return 0;
if(CTX_wm_screen(C)==NULL) return 0;
if(CTX_wm_region(C)==NULL) return 0;
return 1;
}
int ED_operator_areaactive(bContext *C)
{
if(CTX_wm_window(C)==NULL) return 0;

View File

@ -28,7 +28,7 @@
#
# Makes module object directory and bounces make to subdirectories.
LIBNAME = ed_sculpt
LIBNAME = ed_sculpt_paint
DIR = $(OCGDIR)/blender/$(LIBNAME)
include nan_compile.mk

View File

@ -8,4 +8,4 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../render/extern/include #/intern/guardedalloc #intern/bmfont'
incs += ' ../../gpu ../../makesrna'
env.BlenderLib ( 'bf_editors_sculpt', sources, Split(incs), [], libtype=['core'], priority=[40] )
env.BlenderLib ( 'bf_editors_sculpt_paint', sources, Split(incs), [], libtype=['core'], priority=[40] )

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,62 @@
/**
* $Id:
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
*
*
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef ED_PAINT_INTERN_H
#define ED_PAINT_INTERN_H
struct Scene;
struct Object;
struct Mesh;
struct ViewContext;
struct wmOperatorType;
struct ARegion;
/* paint_vertex.c */
void PAINT_OT_weight_paint_toggle(struct wmOperatorType *ot);
void PAINT_OT_weight_paint_radial_control(struct wmOperatorType *ot);
void PAINT_OT_weight_paint(struct wmOperatorType *ot);
void PAINT_OT_vertex_paint_radial_control(struct wmOperatorType *ot);
void PAINT_OT_vertex_paint_toggle(struct wmOperatorType *ot);
void PAINT_OT_vertex_paint(struct wmOperatorType *ot);
/* paint_image.c */
void PAINT_OT_image_paint(struct wmOperatorType *ot);
void PAINT_OT_grab_clone(struct wmOperatorType *ot);
void PAINT_OT_sample_color(struct wmOperatorType *ot);
void PAINT_OT_set_clone_cursor(struct wmOperatorType *ot);
void PAINT_OT_texture_paint_toggle(struct wmOperatorType *ot);
/* paint_utils.c */
int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, int *mval, unsigned int *index);
void imapaint_pick_uv(struct Scene *scene, struct Object *ob, struct Mesh *mesh, unsigned int faceindex, int *xy, float *uv);
void paint_sample_color(struct Scene *scene, struct ARegion *ar, int x, int y);
#endif /* ED_PAINT_INTERN_H */

View File

@ -0,0 +1,30 @@
#include "ED_sculpt.h"
#include "WM_api.h"
#include "WM_types.h"
#include "paint_intern.h"
/**************************** registration **********************************/
void ED_operatortypes_paint(void)
{
/* image */
WM_operatortype_append(PAINT_OT_texture_paint_toggle);
WM_operatortype_append(PAINT_OT_image_paint);
WM_operatortype_append(PAINT_OT_sample_color);
WM_operatortype_append(PAINT_OT_grab_clone);
WM_operatortype_append(PAINT_OT_set_clone_cursor);
/* weight */
WM_operatortype_append(PAINT_OT_weight_paint_toggle);
WM_operatortype_append(PAINT_OT_weight_paint_radial_control);
WM_operatortype_append(PAINT_OT_weight_paint);
/* vertex */
WM_operatortype_append(PAINT_OT_vertex_paint_radial_control);
WM_operatortype_append(PAINT_OT_vertex_paint_toggle);
WM_operatortype_append(PAINT_OT_vertex_paint);
}

View File

@ -0,0 +1,191 @@
#include <math.h>
#include <stdlib.h>
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "BLI_arithb.h"
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_utildefines.h"
#include "BIF_gl.h"
#include "ED_view3d.h"
#include "paint_intern.h"
/* 3D Paint */
static void imapaint_project(Object *ob, float *model, float *proj, float *co, float *pco)
{
VECCOPY(pco, co);
pco[3]= 1.0f;
Mat4MulVecfl(ob->obmat, pco);
Mat4MulVecfl((float(*)[4])model, pco);
Mat4MulVec4fl((float(*)[4])proj, pco);
}
static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, float *co, float *w)
{
float pv1[4], pv2[4], pv3[4], h[3], divw;
float model[16], proj[16], wmat[3][3], invwmat[3][3];
GLint view[4];
/* compute barycentric coordinates */
/* get the needed opengl matrices */
glGetIntegerv(GL_VIEWPORT, view);
glGetFloatv(GL_MODELVIEW_MATRIX, model);
glGetFloatv(GL_PROJECTION_MATRIX, proj);
view[0] = view[1] = 0;
/* project the verts */
imapaint_project(ob, model, proj, v1, pv1);
imapaint_project(ob, model, proj, v2, pv2);
imapaint_project(ob, model, proj, v3, pv3);
/* do inverse view mapping, see gluProject man page */
h[0]= (co[0] - view[0])*2.0f/view[2] - 1;
h[1]= (co[1] - view[1])*2.0f/view[3] - 1;
h[2]= 1.0f;
/* solve for(w1,w2,w3)/perspdiv in:
h*perspdiv = Project*Model*(w1*v1 + w2*v2 + w3*v3) */
wmat[0][0]= pv1[0]; wmat[1][0]= pv2[0]; wmat[2][0]= pv3[0];
wmat[0][1]= pv1[1]; wmat[1][1]= pv2[1]; wmat[2][1]= pv3[1];
wmat[0][2]= pv1[3]; wmat[1][2]= pv2[3]; wmat[2][2]= pv3[3];
Mat3Inv(invwmat, wmat);
Mat3MulVecfl(invwmat, h);
VECCOPY(w, h);
/* w is still divided by perspdiv, make it sum to one */
divw= w[0] + w[1] + w[2];
if(divw != 0.0f)
VecMulf(w, 1.0f/divw);
}
/* compute uv coordinates of mouse in face */
void imapaint_pick_uv(Scene *scene, Object *ob, Mesh *mesh, unsigned int faceindex, int *xy, float *uv)
{
DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
int *index = dm->getFaceDataArray(dm, CD_ORIGINDEX);
MTFace *tface = dm->getFaceDataArray(dm, CD_MTFACE), *tf;
int numfaces = dm->getNumFaces(dm), a;
float p[2], w[3], absw, minabsw;
MFace mf;
MVert mv[4];
minabsw = 1e10;
uv[0] = uv[1] = 0.0;
/* test all faces in the derivedmesh with the original index of the picked face */
for(a = 0; a < numfaces; a++) {
if(index[a] == faceindex) {
dm->getFace(dm, a, &mf);
dm->getVert(dm, mf.v1, &mv[0]);
dm->getVert(dm, mf.v2, &mv[1]);
dm->getVert(dm, mf.v3, &mv[2]);
if(mf.v4)
dm->getVert(dm, mf.v4, &mv[3]);
tf= &tface[a];
p[0]= xy[0];
p[1]= xy[1];
if(mf.v4) {
/* the triangle with the largest absolute values is the one
with the most negative weights */
imapaint_tri_weights(ob, mv[0].co, mv[1].co, mv[3].co, p, w);
absw= fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
if(absw < minabsw) {
uv[0]= tf->uv[0][0]*w[0] + tf->uv[1][0]*w[1] + tf->uv[3][0]*w[2];
uv[1]= tf->uv[0][1]*w[0] + tf->uv[1][1]*w[1] + tf->uv[3][1]*w[2];
minabsw = absw;
}
imapaint_tri_weights(ob, mv[1].co, mv[2].co, mv[3].co, p, w);
absw= fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
if(absw < minabsw) {
uv[0]= tf->uv[1][0]*w[0] + tf->uv[2][0]*w[1] + tf->uv[3][0]*w[2];
uv[1]= tf->uv[1][1]*w[0] + tf->uv[2][1]*w[1] + tf->uv[3][1]*w[2];
minabsw = absw;
}
}
else {
imapaint_tri_weights(ob, mv[0].co, mv[1].co, mv[2].co, p, w);
absw= fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
if(absw < minabsw) {
uv[0]= tf->uv[0][0]*w[0] + tf->uv[1][0]*w[1] + tf->uv[2][0]*w[2];
uv[1]= tf->uv[0][1]*w[0] + tf->uv[1][1]*w[1] + tf->uv[2][1]*w[2];
minabsw = absw;
}
}
}
}
dm->release(dm);
}
///* returns 0 if not found, otherwise 1 */
int imapaint_pick_face(ViewContext *vc, Mesh *me, int *mval, unsigned int *index)
{
if(!me || me->totface==0)
return 0;
/* sample only on the exact position */
*index = view3d_sample_backbuf(vc, mval[0], mval[1]);
if((*index)<=0 || (*index)>(unsigned int)me->totface)
return 0;
(*index)--;
return 1;
}
/* used for both 3d view and image window */
void paint_sample_color(Scene *scene, ARegion *ar, int x, int y) /* frontbuf */
{
VPaint *vp= scene->toolsettings->vpaint;
unsigned int col;
char *cp;
CLAMP(x, 0, ar->winx);
CLAMP(y, 0, ar->winy);
glReadBuffer(GL_FRONT);
glReadPixels(x+ar->winrct.xmin, y+ar->winrct.ymin, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
glReadBuffer(GL_BACK);
cp = (char *)&col;
if(G.f & (G_VERTEXPAINT|G_WEIGHTPAINT)) {
vp->r= cp[0]/255.0f;
vp->g= cp[1]/255.0f;
vp->b= cp[2]/255.0f;
}
else {
Brush *brush= scene->toolsettings->imapaint.brush;
if(brush) {
brush->rgb[0]= cp[0]/255.0f;
brush->rgb[1]= cp[1]/255.0f;
brush->rgb[2]= cp[2]/255.0f;
}
}
}

View File

@ -90,8 +90,6 @@
#include "ED_util.h"
#include "ED_view3d.h"
#include "view3d_intern.h"
/* vp->mode */
#define VP_MIX 0
#define VP_ADD 1
@ -581,45 +579,6 @@ void vpaint_dogamma(Scene *scene)
}
}
/* used for both 3d view and image window */
void sample_vpaint(Scene *scene, ARegion *ar) /* frontbuf */
{
VPaint *vp= scene->toolsettings->vpaint;
unsigned int col;
int x, y;
short mval[2];
char *cp;
// getmouseco_areawin(mval);
x= mval[0]; y= mval[1];
if(x<0 || y<0) return;
if(x>=ar->winx || y>=ar->winy) return;
glReadBuffer(GL_FRONT);
glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
glReadBuffer(GL_BACK);
cp = (char *)&col;
if(G.f & (G_VERTEXPAINT|G_WEIGHTPAINT)) {
vp->r= cp[0]/255.0f;
vp->g= cp[1]/255.0f;
vp->b= cp[2]/255.0f;
}
else {
Brush *brush= scene->toolsettings->imapaint.brush;
if(brush) {
brush->rgb[0]= cp[0]/255.0f;
brush->rgb[1]= cp[1]/255.0f;
brush->rgb[2]= cp[2]/255.0f;
}
}
}
static unsigned int mcol_blend(unsigned int col1, unsigned int col2, int fac)
{
char *cp1, *cp2, *cp;
@ -1201,12 +1160,12 @@ static int paint_poll_test(bContext *C)
return 1;
}
void VIEW3D_OT_wpaint_toggle(wmOperatorType *ot)
void PAINT_OT_weight_paint_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Weight Paint Mode";
ot->idname= "VIEW3D_OT_wpaint_toggle";
ot->idname= "PAINT_OT_weight_paint_toggle";
/* api callbacks */
ot->exec= set_wpaint;
@ -1222,7 +1181,7 @@ void VIEW3D_OT_wpaint_toggle(wmOperatorType *ot)
void paint_radial_control_invoke(wmOperator *op, VPaint *vp)
{
int mode = RNA_int_get(op->ptr, "mode");
float original_value= 1.0f;
float original_value;
if(mode == WM_RADIALCONTROL_SIZE)
original_value = vp->size;
@ -1291,12 +1250,12 @@ static int wpaint_radial_control_exec(bContext *C, wmOperator *op)
return ret;
}
void VIEW3D_OT_wpaint_radial_control(wmOperatorType *ot)
void PAINT_OT_weight_paint_radial_control(wmOperatorType *ot)
{
WM_OT_radial_control_partial(ot);
ot->name= "Weight Paint Radial Control";
ot->idname= "VIEW3D_OT_wpaint_radial_control";
ot->idname= "PAINT_OT_weight_paint_radial_control";
ot->invoke= wpaint_radial_control_invoke;
ot->modal= wpaint_radial_control_modal;
@ -1307,12 +1266,12 @@ void VIEW3D_OT_wpaint_radial_control(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
void VIEW3D_OT_vpaint_radial_control(wmOperatorType *ot)
void PAINT_OT_vertex_paint_radial_control(wmOperatorType *ot)
{
WM_OT_radial_control_partial(ot);
ot->name= "Vertex Paint Radial Control";
ot->idname= "VIEW3D_OT_vpaint_radial_control";
ot->idname= "PAINT_OT_vertex_paint_radial_control";
ot->invoke= vpaint_radial_control_invoke;
ot->modal= vpaint_radial_control_modal;
@ -1391,6 +1350,7 @@ static int wpaint_modal(bContext *C, wmOperator *op, wmEvent *event)
float paintweight= wp->weight;
int *indexar= wpd->indexar;
int totindex, index, alpha, totw;
short mval[2];
view3d_operator_needs_opengl(C);
@ -1401,12 +1361,15 @@ static int wpaint_modal(bContext *C, wmOperator *op, wmEvent *event)
MTC_Mat4SwapMat4(wpd->vc.rv3d->persmat, mat);
mval[0]= event->x - vc->ar->winrct.xmin;
mval[1]= event->y - vc->ar->winrct.ymin;
/* which faces are involved */
if(wp->flag & VP_AREA) {
totindex= sample_backbuf_area(vc, indexar, me->totface, event->mval[0], event->mval[1], wp->size);
totindex= sample_backbuf_area(vc, indexar, me->totface, mval[0], mval[1], wp->size);
}
else {
indexar[0]= view3d_sample_backbuf(vc, event->mval[0], event->mval[1]);
indexar[0]= view3d_sample_backbuf(vc, mval[0], mval[1]);
if(indexar[0]) totindex= 1;
else totindex= 0;
}
@ -1481,7 +1444,7 @@ static int wpaint_modal(bContext *C, wmOperator *op, wmEvent *event)
MFace *mface= me->mface + (indexar[index]-1);
if((me->dvert+mface->v1)->flag) {
alpha= calc_vp_alpha_dl(wp, vc, wpd->wpimat, wpd->vertexcosnos+6*mface->v1, event->mval);
alpha= calc_vp_alpha_dl(wp, vc, wpd->wpimat, wpd->vertexcosnos+6*mface->v1, mval);
if(alpha) {
do_weight_paint_vertex(wp, ob, mface->v1, alpha, paintweight, wpd->vgroup_mirror);
}
@ -1489,7 +1452,7 @@ static int wpaint_modal(bContext *C, wmOperator *op, wmEvent *event)
}
if((me->dvert+mface->v2)->flag) {
alpha= calc_vp_alpha_dl(wp, vc, wpd->wpimat, wpd->vertexcosnos+6*mface->v2, event->mval);
alpha= calc_vp_alpha_dl(wp, vc, wpd->wpimat, wpd->vertexcosnos+6*mface->v2, mval);
if(alpha) {
do_weight_paint_vertex(wp, ob, mface->v2, alpha, paintweight, wpd->vgroup_mirror);
}
@ -1497,7 +1460,7 @@ static int wpaint_modal(bContext *C, wmOperator *op, wmEvent *event)
}
if((me->dvert+mface->v3)->flag) {
alpha= calc_vp_alpha_dl(wp, vc, wpd->wpimat, wpd->vertexcosnos+6*mface->v3, event->mval);
alpha= calc_vp_alpha_dl(wp, vc, wpd->wpimat, wpd->vertexcosnos+6*mface->v3, mval);
if(alpha) {
do_weight_paint_vertex(wp, ob, mface->v3, alpha, paintweight, wpd->vgroup_mirror);
}
@ -1506,7 +1469,7 @@ static int wpaint_modal(bContext *C, wmOperator *op, wmEvent *event)
if((me->dvert+mface->v4)->flag) {
if(mface->v4) {
alpha= calc_vp_alpha_dl(wp, vc, wpd->wpimat, wpd->vertexcosnos+6*mface->v4, event->mval);
alpha= calc_vp_alpha_dl(wp, vc, wpd->wpimat, wpd->vertexcosnos+6*mface->v4, mval);
if(alpha) {
do_weight_paint_vertex(wp, ob, mface->v4, alpha, paintweight, wpd->vgroup_mirror);
}
@ -1628,12 +1591,12 @@ static int wpaint_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
void VIEW3D_OT_wpaint(wmOperatorType *ot)
void PAINT_OT_weight_paint(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Weight Paint";
ot->idname= "VIEW3D_OT_wpaint";
ot->idname= "PAINT_OT_weight_paint";
/* api callbacks */
ot->invoke= wpaint_invoke;
@ -1646,7 +1609,6 @@ void VIEW3D_OT_wpaint(wmOperatorType *ot)
}
/* ************ set / clear vertex paint mode ********** */
@ -1704,12 +1666,12 @@ static int set_vpaint(bContext *C, wmOperator *op) /* toggle */
return OPERATOR_FINISHED;
}
void VIEW3D_OT_vpaint_toggle(wmOperatorType *ot)
void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Vertex Paint Mode";
ot->idname= "VIEW3D_OT_vpaint_toggle";
ot->idname= "PAINT_OT_vertex_paint_toggle";
/* api callbacks */
ot->exec= set_vpaint;
@ -1789,6 +1751,7 @@ static int vpaint_modal(bContext *C, wmOperator *op, wmEvent *event)
float mat[4][4];
int *indexar= vpd->indexar;
int totindex, index;
short mval[2];
view3d_operator_needs_opengl(C);
@ -1797,12 +1760,15 @@ static int vpaint_modal(bContext *C, wmOperator *op, wmEvent *event)
wmGetSingleMatrix(mat);
wmLoadMatrix(vc->rv3d->viewmat);
mval[0]= event->x - vc->ar->winrct.xmin;
mval[1]= event->y - vc->ar->winrct.ymin;
/* which faces are involved */
if(vp->flag & VP_AREA) {
totindex= sample_backbuf_area(vc, indexar, me->totface, event->mval[0], event->mval[1], vp->size);
totindex= sample_backbuf_area(vc, indexar, me->totface, mval[0], mval[1], vp->size);
}
else {
indexar[0]= view3d_sample_backbuf(vc, event->mval[0], event->mval[1]);
indexar[0]= view3d_sample_backbuf(vc, mval[0], mval[1]);
if(indexar[0]) totindex= 1;
else totindex= 0;
}
@ -1851,17 +1817,17 @@ static int vpaint_modal(bContext *C, wmOperator *op, wmEvent *event)
}
alpha= calc_vp_alpha_dl(vp, vc, vpd->vpimat, vpd->vertexcosnos+6*mface->v1, event->mval);
alpha= calc_vp_alpha_dl(vp, vc, vpd->vpimat, vpd->vertexcosnos+6*mface->v1, mval);
if(alpha) vpaint_blend(vp, mcol, mcolorig, vpd->paintcol, alpha);
alpha= calc_vp_alpha_dl(vp, vc, vpd->vpimat, vpd->vertexcosnos+6*mface->v2, event->mval);
alpha= calc_vp_alpha_dl(vp, vc, vpd->vpimat, vpd->vertexcosnos+6*mface->v2, mval);
if(alpha) vpaint_blend(vp, mcol+1, mcolorig+1, vpd->paintcol, alpha);
alpha= calc_vp_alpha_dl(vp, vc, vpd->vpimat, vpd->vertexcosnos+6*mface->v3, event->mval);
alpha= calc_vp_alpha_dl(vp, vc, vpd->vpimat, vpd->vertexcosnos+6*mface->v3, mval);
if(alpha) vpaint_blend(vp, mcol+2, mcolorig+2, vpd->paintcol, alpha);
if(mface->v4) {
alpha= calc_vp_alpha_dl(vp, vc, vpd->vpimat, vpd->vertexcosnos+6*mface->v4, event->mval);
alpha= calc_vp_alpha_dl(vp, vc, vpd->vpimat, vpd->vertexcosnos+6*mface->v4, mval);
if(alpha) vpaint_blend(vp, mcol+3, mcolorig+3, vpd->paintcol, alpha);
}
}
@ -1922,12 +1888,12 @@ static int vpaint_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
void VIEW3D_OT_vpaint(wmOperatorType *ot)
void PAINT_OT_vertex_paint(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Vertex Paint";
ot->idname= "VIEW3D_OT_vpaint";
ot->idname= "PAINT_OT_vertex_paint";
/* api callbacks */
ot->invoke= vpaint_invoke;
@ -1940,4 +1906,3 @@ void VIEW3D_OT_vpaint(wmOperatorType *ot)
}

View File

@ -82,6 +82,7 @@ void ED_spacetypes_init(void)
ED_operatortypes_mesh();
ED_operatortypes_sculpt();
ED_operatortypes_uvedit();
ED_operatortypes_paint();
ED_operatortypes_curve();
ED_operatortypes_armature();
ED_marker_operatortypes();

View File

@ -189,6 +189,10 @@ void image_keymap(struct wmWindowManager *wm)
WM_keymap_add_item(keymap, "IMAGE_OT_reload", RKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_save", SKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "PAINT_OT_image_paint", ACTIONMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_grab_clone", SELECTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_sample_color", SELECTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_sample", ACTIONMOUSE, KM_PRESS, 0, 0);
RNA_enum_set(WM_keymap_add_item(keymap, "IMAGE_OT_set_curves_point", ACTIONMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "point", 0);
RNA_enum_set(WM_keymap_add_item(keymap, "IMAGE_OT_set_curves_point", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "point", 1);
@ -353,6 +357,10 @@ static void image_main_area_init(wmWindowManager *wm, ARegion *ar)
// image space manages own v2d
// UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
/* image paint polls for mode */
keymap= WM_keymap_listbase(wm, "ImagePaint", SPACE_IMAGE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
/* own keymap */
keymap= WM_keymap_listbase(wm, "Image", SPACE_IMAGE, 0);

View File

@ -478,7 +478,7 @@ void draw_mesh_text(Scene *scene, Object *ob, int glsl)
return;
/* don't draw when editing */
if(me->edit_mesh)
if(ob == scene->obedit)
return;
else if(ob==OBACT)
if(FACESEL_PAINT_TEST)
@ -558,7 +558,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
/* draw the textured mesh */
draw_textured_begin(scene, v3d, rv3d, ob);
if(me->edit_mesh) {
if(ob == scene->obedit) {
dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, me->edit_mesh);
} else if(faceselect) {
if(G.f & G_WEIGHTPAINT)
@ -566,8 +566,9 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
else
dm->drawMappedFacesTex(dm, draw_tface_mapped__set_draw, me);
}
else
else {
dm->drawFacesTex(dm, draw_tface__set_draw);
}
/* draw game engine text hack */
if(get_ob_property(ob, "Text"))
@ -576,7 +577,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
draw_textured_end();
/* draw edges and selected faces over textured mesh */
if(!me->edit_mesh && faceselect)
if(!(ob == scene->obedit) && faceselect)
draw_tfaces3D(rv3d, ob, me, dm);
/* reset from negative scale correction */

View File

@ -5360,9 +5360,10 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
switch( ob->type) {
case OB_MESH:
{
Mesh *me= ob->data;
EditMesh *em= me->edit_mesh;
if(em) {
if(ob == scene->obedit) {
Mesh *me= ob->data;
EditMesh *em= me->edit_mesh;
DerivedMesh *dm = editmesh_get_derived_cage(scene, ob, em, CD_MASK_BAREMESH);
EM_init_index_arrays(em, 1, 1, 1);
@ -5415,7 +5416,7 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r
DerivedMesh *dm=NULL, *edm=NULL;
int glsl;
if(me->edit_mesh)
if(ob == scene->obedit)
edm= editmesh_get_derived_base(ob, me->edit_mesh);
else
dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);

View File

@ -272,6 +272,9 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar)
/* modal ops keymaps */
view3d_modal_keymaps(wm, ar, rv3d->lastmode);
/* operator poll checks for modes */
keymap= WM_keymap_listbase(wm, "ImagePaint", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
/* type callback, not region itself */
@ -368,6 +371,11 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
}
case NC_IMAGE:
/* this could be more fine grained checks if we had
* more context than just the region */
ED_region_tag_redraw(ar);
break;
}
}

View File

@ -1081,7 +1081,7 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
#endif
if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT);
else if((G.f & G_TEXTUREPAINT) && scene->toolsettings && (scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE)==0);
else if((G.f & G_TEXTUREPAINT) && scene->toolsettings && (scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE));
else if(scene->obedit && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT));
else {
v3d->flag &= ~V3D_NEEDBACKBUFDRAW;

View File

@ -137,10 +137,12 @@ static int retopo_mesh_paint_check() {return 0;}
/* well... in this file a lot of view mode manipulation happens, so let's have it defined here */
void ED_view3d_exit_paint_modes(bContext *C)
{
if(G.f & G_TEXTUREPAINT)
WM_operator_name_call(C, "PAINT_OT_texture_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
if(G.f & G_VERTEXPAINT)
WM_operator_name_call(C, "VIEW3D_OT_vpaint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
WM_operator_name_call(C, "PAINT_OT_vertex_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
else if(G.f & G_WEIGHTPAINT)
WM_operator_name_call(C, "VIEW3D_OT_wpaint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
WM_operator_name_call(C, "PAINT_OT_weight_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
if(G.f & G_SCULPTMODE)
WM_operator_name_call(C, "SCULPT_OT_sculptmode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
@ -5019,7 +5021,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
ED_view3d_exit_paint_modes(C);
if(obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
WM_operator_name_call(C, "VIEW3D_OT_vpaint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
WM_operator_name_call(C, "PAINT_OT_vertex_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
}
}
else if (v3d->modeselect == V3D_TEXTUREPAINTMODE_SEL) {
@ -5027,8 +5029,8 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
v3d->flag &= ~V3D_MODE;
ED_view3d_exit_paint_modes(C);
if(obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
// XXX set_texturepaint();
WM_operator_name_call(C, "PAINT_OT_texture_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
}
}
else if (v3d->modeselect == V3D_WEIGHTPAINTMODE_SEL) {
@ -5038,7 +5040,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
if(obedit)
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
WM_operator_name_call(C, "VIEW3D_OT_wpaint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
WM_operator_name_call(C, "PAINT_OT_weight_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
}
}
else if (v3d->modeselect == V3D_POSEMODE_SEL) {

View File

@ -112,14 +112,6 @@ void VIEW3D_OT_circle_select(struct wmOperatorType *ot);
void VIEW3D_OT_borderselect(struct wmOperatorType *ot);
void VIEW3D_OT_lasso_select(struct wmOperatorType *ot);
/* vpaint.c */
void VIEW3D_OT_vpaint_radial_control(struct wmOperatorType *ot);
void VIEW3D_OT_wpaint_radial_control(struct wmOperatorType *ot);
void VIEW3D_OT_vpaint_toggle(struct wmOperatorType *ot);
void VIEW3D_OT_vpaint(struct wmOperatorType *ot);
void VIEW3D_OT_wpaint_toggle(struct wmOperatorType *ot);
void VIEW3D_OT_wpaint(struct wmOperatorType *ot);
/* view3d_view.c */
void VIEW3D_OT_smoothview(struct wmOperatorType *ot);
void VIEW3D_OT_setcameratoview(struct wmOperatorType *ot);
@ -130,6 +122,8 @@ int boundbox_clip(RegionView3D *rv3d, float obmat[][4], struct BoundBox *bb);
void view3d_project_short_clip(struct ARegion *ar, float *vec, short *adr, float projmat[4][4], float wmat[4][4]);
void view3d_project_short_noclip(struct ARegion *ar, float *vec, short *adr, float mat[4][4]);
void view3d_project_float(struct ARegion *a, float *vec, float *adr, float mat[4][4]);
void centerview(struct ARegion *ar, View3D *v3d);
void smooth_view(struct bContext *C, Object *, Object *, float *ofs, float *quat, float *dist, float *lens);

View File

@ -83,12 +83,6 @@ void view3d_operatortypes(void)
WM_operatortype_append(VIEW3D_OT_lasso_select);
WM_operatortype_append(VIEW3D_OT_setcameratoview);
WM_operatortype_append(VIEW3D_OT_drawtype);
WM_operatortype_append(VIEW3D_OT_vpaint_radial_control);
WM_operatortype_append(VIEW3D_OT_wpaint_radial_control);
WM_operatortype_append(VIEW3D_OT_vpaint_toggle);
WM_operatortype_append(VIEW3D_OT_wpaint_toggle);
WM_operatortype_append(VIEW3D_OT_vpaint);
WM_operatortype_append(VIEW3D_OT_wpaint);
WM_operatortype_append(VIEW3D_OT_editmesh_face_toolbox);
WM_operatortype_append(VIEW3D_OT_properties);
WM_operatortype_append(VIEW3D_OT_localview);
@ -109,8 +103,8 @@ void view3d_keymap(wmWindowManager *wm)
ListBase *keymap= WM_keymap_listbase(wm, "View3D Generic", SPACE_VIEW3D, 0);
wmKeymapItem *km;
WM_keymap_add_item(keymap, "VIEW3D_OT_vpaint_toggle", VKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_wpaint_toggle", TABKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "PAINT_OT_vertex_paint_toggle", VKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_weight_paint_toggle", TABKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_properties", NKEY, KM_PRESS, 0, 0);
@ -118,8 +112,12 @@ void view3d_keymap(wmWindowManager *wm)
keymap= WM_keymap_listbase(wm, "View3D", SPACE_VIEW3D, 0);
/* paint poll checks mode */
WM_keymap_verify_item(keymap, "VIEW3D_OT_vpaint", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "VIEW3D_OT_wpaint", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "PAINT_OT_vertex_paint", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "PAINT_OT_weight_paint", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_image_paint", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_sample_color", RIGHTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_set_clone_cursor", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
@ -196,10 +194,10 @@ void view3d_keymap(wmWindowManager *wm)
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_radial_control", FKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", WM_RADIALCONTROL_ANGLE);
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_vpaint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_wpaint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_vpaint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_wpaint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_vertex_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_vertex_paint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_paint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
/* TODO - this is just while we have no way to load a text datablock */
RNA_string_set(WM_keymap_add_item(keymap, "SCRIPT_OT_run_pyfile", PKEY, KM_PRESS, 0, 0)->ptr, "filename", "test.py");

View File

@ -45,6 +45,7 @@
#include "ED_armature.h"
#include "ED_mesh.h"
#include "ED_sculpt.h"
#include "ED_util.h"
#include "UI_text.h"
@ -57,6 +58,7 @@ void ED_editors_exit(bContext *C)
/* frees all editmode undos */
undo_editmode_clear();
undo_imagepaint_clear();
/* global in meshtools... */
mesh_octree_table(ob, NULL, NULL, 'e');

View File

@ -60,6 +60,7 @@
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_sculpt.h"
#include "ED_util.h"
#include "WM_api.h"
@ -72,7 +73,6 @@
/* ********* XXX **************** */
static void undo_push_mball() {}
static void undo_imagepaint_step() {}
static void sound_initialize_sounds() {}
/* ********* XXX **************** */

View File

@ -45,6 +45,7 @@ CPPFLAGS += -I../../blenlib
CPPFLAGS += -I../../makesdna
CPPFLAGS += -I../../makesrna
CPPFLAGS += -I../../imbuf
CPPFLAGS += -I../../gpu
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
CPPFLAGS += -I$(NAN_OPENNL)/include

View File

@ -5,6 +5,6 @@ sources = env.Glob('*.c')
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../makesrna #/intern/opennl/extern'
incs += ' ../../makesrna #/intern/opennl/extern ../../gpu'
env.BlenderLib ( 'bf_editors_uvedit', sources, Split(incs), [], libtype=['core'], priority=[45] )

View File

@ -51,7 +51,7 @@ typedef struct Brush {
struct BrushClone clone;
struct CurveMapping *curve; /* falloff curve */
struct CurveMapping *curve; /* falloff curve */
struct MTex *mtex[18]; /* MAX_MTEX */
short flag, blend; /* general purpose flag, blend mode */
@ -63,7 +63,7 @@ typedef struct Brush {
float rgb[3]; /* color */
float alpha; /* opacity */
float rot; /* rotation in radians */
float rot; /* rotation in radians */
short texact; /* active texture */
char sculpt_tool; /* active tool */

View File

@ -354,6 +354,8 @@ typedef struct ImagePaintSettings {
/* for projection painting only */
short seam_bleed,normal_angle;
void *paintcursor; /* wm handle */
} ImagePaintSettings;
typedef struct ParticleBrushData {

View File

@ -445,7 +445,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, " else data->%s &= ~(%d<<%d);\n", dp->dnaname, dp->booleanbit, i);
}
else {
fprintf(f, " (&data->%s)[%d]= %s\n", dp->dnaname, i, (dp->booleannegative)? "!": "");
fprintf(f, " (&data->%s)[%d]= %s", dp->dnaname, i, (dp->booleannegative)? "!": "");
rna_clamp_value(f, prop, 1, i);
}
}
@ -462,7 +462,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, " data->%s[%d]= FTOCHAR(values[%d]);\n", dp->dnaname, i, i);
}
else {
fprintf(f, " data->%s[%d]= %s\n", dp->dnaname, i, (dp->booleannegative)? "!": "");
fprintf(f, " data->%s[%d]= %s", dp->dnaname, i, (dp->booleannegative)? "!": "");
rna_clamp_value(f, prop, 1, i);
}
}

View File

@ -241,10 +241,14 @@ static void rna_def_operator_stroke_element(BlenderRNA *brna)
RNA_def_property_array(prop, 2);
RNA_def_property_ui_text(prop, "Mouse", "");
/*prop= RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE);
prop= RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
RNA_def_property_range(prop, 0, 1);
RNA_def_property_ui_text(prop, "Pressure", "");*/
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Pressure", "Tablet pressure.");
prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
RNA_def_property_ui_text(prop, "Time", "");
prop= RNA_def_property(srna, "flip", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
@ -252,8 +256,6 @@ static void rna_def_operator_stroke_element(BlenderRNA *brna)
/* XXX: Tool (this will be for pressing a modifier key for a different brush,
e.g. switching to a Smooth brush in the middle of the stroke */
/* XXX: Time (should be useful for airbrush mode) */
}
void RNA_def_brush(BlenderRNA *brna)

View File

@ -155,6 +155,7 @@ typedef struct wmNotifier {
#define NC_LAMP (8<<24)
#define NC_GROUP (9<<24)
#define NC_IMAGE (10<<24)
#define NC_BRUSH (11<<24)
/* data type, 256 entries is enough, it can overlap */
#define NOTE_DATA 0x00FF0000

View File

@ -40,6 +40,11 @@
#define EVT_DATA_GESTURE 2
#define EVT_DATA_TIMER 3
/* tablet active */
#define EVT_TABLET_NONE 0
#define EVT_TABLET_STYLUS 1
#define EVT_TABLET_ERASER 2
#define MOUSEX 0x004
#define MOUSEY 0x005