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:
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r--source/blender/editors/physics/particle_edit.c106
-rw-r--r--source/blender/editors/physics/physics_intern.h1
-rw-r--r--source/blender/editors/physics/physics_ops.c15
-rw-r--r--source/blender/editors/physics/physics_pointcache.c11
4 files changed, 37 insertions, 96 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 1c9f9e60e14..f4f66c17459 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -338,7 +338,7 @@ typedef struct PEData {
DerivedMesh *dm;
PTCacheEdit *edit;
- const short *mval;
+ const int *mval;
rcti *rect;
float rad;
float dist;
@@ -439,9 +439,9 @@ static int key_test_depth(PEData *data, float co[3])
static int key_inside_circle(PEData *data, float rad, float co[3], float *distance)
{
float dx, dy, dist;
- short sco[2];
+ int sco[2];
- project_short(data->vc.ar, co, sco);
+ project_int(data->vc.ar, co, sco);
if(sco[0] == IS_CLIPPED)
return 0;
@@ -465,9 +465,9 @@ static int key_inside_circle(PEData *data, float rad, float co[3], float *distan
static int key_inside_rect(PEData *data, float co[3])
{
- short sco[2];
+ int sco[2];
- project_short(data->vc.ar, co,sco);
+ project_int(data->vc.ar, co,sco);
if(sco[0] == IS_CLIPPED)
return 0;
@@ -1369,7 +1369,7 @@ void PARTICLE_OT_select_all(wmOperatorType *ot)
/************************ pick select operator ************************/
-int PE_mouse_particles(bContext *C, const short mval[2], int extend)
+int PE_mouse_particles(bContext *C, const int mval[2], int extend)
{
PEData data;
Scene *scene= CTX_data_scene(C);
@@ -1484,7 +1484,7 @@ void PARTICLE_OT_select_tips(wmOperatorType *ot)
static int select_linked_exec(bContext *C, wmOperator *op)
{
PEData data;
- short mval[2];
+ int mval[2];
int location[2];
RNA_int_get_array(op->ptr, "location", location);
@@ -1574,7 +1574,7 @@ int PE_border_select(bContext *C, rcti *rect, int select, int extend)
/************************ circle select operator ************************/
-int PE_circle_select(bContext *C, int selecting, const short mval[2], float rad)
+int PE_circle_select(bContext *C, int selecting, const int mval[2], float rad)
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
@@ -1599,7 +1599,7 @@ int PE_circle_select(bContext *C, int selecting, const short mval[2], float rad)
/************************ lasso select operator ************************/
-int PE_lasso_select(bContext *C, short mcords[][2], short moves, short extend, short select)
+int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, short select)
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
@@ -1610,7 +1610,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short extend, s
ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
POINT_P; KEY_K;
float co[3], mat[4][4]= MAT4_UNITY;
- short vertco[2];
+ int vertco[2];
PEData data;
@@ -1631,7 +1631,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short extend, s
LOOP_KEYS {
VECCOPY(co, key->co);
mul_m4_v3(mat, co);
- project_short(ar, co, vertco);
+ project_int(ar, co, vertco);
if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
if(select && !(key->flag & PEK_SELECT)) {
key->flag |= PEK_SELECT;
@@ -1649,7 +1649,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short extend, s
VECCOPY(co, key->co);
mul_m4_v3(mat, co);
- project_short(ar, co,vertco);
+ project_int(ar, co,vertco);
if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
if(select && !(key->flag & PEK_SELECT)) {
key->flag |= PEK_SELECT;
@@ -2521,80 +2521,6 @@ static void toggle_particle_cursor(bContext *C, int enable)
pset->paintcursor= WM_paint_cursor_activate(CTX_wm_manager(C), PE_poll_view3d, brush_drawcursor, NULL);
}
-/********************* radial control operator *********************/
-
-static int brush_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
- ParticleEditSettings *pset= PE_settings(CTX_data_scene(C));
- ParticleBrushData *brush;
- int mode = RNA_enum_get(op->ptr, "mode");
- float original_value=1.0f;
-
- if(pset->brushtype < 0)
- return OPERATOR_CANCELLED;
-
- brush= &pset->brush[pset->brushtype];
-
- toggle_particle_cursor(C, 0);
-
- if(mode == WM_RADIALCONTROL_SIZE)
- original_value = brush->size;
- else if(mode == WM_RADIALCONTROL_STRENGTH)
- original_value = brush->strength;
-
- RNA_float_set(op->ptr, "initial_value", original_value);
-
- return WM_radial_control_invoke(C, op, event);
-}
-
-static int brush_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
-{
- int ret = WM_radial_control_modal(C, op, event);
-
- if(ret != OPERATOR_RUNNING_MODAL)
- toggle_particle_cursor(C, 1);
-
- return ret;
-}
-
-static int brush_radial_control_exec(bContext *C, wmOperator *op)
-{
- ParticleEditSettings *pset= PE_settings(CTX_data_scene(C));
- ParticleBrushData *brush;
- int mode = RNA_enum_get(op->ptr, "mode");
- float new_value = RNA_float_get(op->ptr, "new_value");
-
- if(pset->brushtype < 0)
- return OPERATOR_CANCELLED;
-
- brush= &pset->brush[pset->brushtype];
-
- if(mode == WM_RADIALCONTROL_SIZE)
- brush->size= new_value;
- else if(mode == WM_RADIALCONTROL_STRENGTH)
- brush->strength= new_value;
-
- WM_event_add_notifier(C, NC_WINDOW, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-void PARTICLE_OT_brush_radial_control(wmOperatorType *ot)
-{
- WM_OT_radial_control_partial(ot);
-
- ot->name= "Brush Radial Control";
- ot->idname= "PARTICLE_OT_brush_radial_control";
-
- ot->invoke= brush_radial_control_invoke;
- ot->modal= brush_radial_control_modal;
- ot->exec= brush_radial_control_exec;
- ot->poll= PE_poll;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
-}
-
/*************************** delete operator **************************/
enum { DEL_PARTICLE, DEL_KEY };
@@ -2845,7 +2771,7 @@ static void brush_cut(PEData *data, int pa_index)
float rad2, cut_time= 1.0;
float x0, x1, v0, v1, o0, o1, xo0, xo1, d, dv;
int k, cut, keys= (int)pow(2.0, (double)pset->draw_step);
- short vertco[2];
+ int vertco[2];
/* blunt scissors */
if(BLI_frand() > data->cutfac) return;
@@ -2858,7 +2784,7 @@ static void brush_cut(PEData *data, int pa_index)
cut=0;
- project_short_noclip(ar, key->co, vertco);
+ project_int_noclip(ar, key->co, vertco);
x0= (float)vertco[0];
x1= (float)vertco[1];
@@ -2876,7 +2802,7 @@ static void brush_cut(PEData *data, int pa_index)
else {
/* calculate path time closest to root that was inside the circle */
for(k=1, key++; k<=keys; k++, key++) {
- project_short_noclip(ar, key->co, vertco);
+ project_int_noclip(ar, key->co, vertco);
if(key_test_depth(data, key->co) == 0) {
x0= (float)vertco[0];
@@ -3540,7 +3466,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
ParticleBrushData *brush= &pset->brush[pset->brushtype];
ARegion *ar= CTX_wm_region(C);
float vec[3], mousef[2];
- short mval[2], mvalo[2];
+ int mval[2], mvalo[2];
int flip, mouse[2], dx, dy, removed= 0, added=0, selected= 0;
int lock_root = pset->flag & PE_LOCK_FIRST;
diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h
index d447da3f8c4..71f1128baf0 100644
--- a/source/blender/editors/physics/physics_intern.h
+++ b/source/blender/editors/physics/physics_intern.h
@@ -60,7 +60,6 @@ void PARTICLE_OT_delete(struct wmOperatorType *ot);
void PARTICLE_OT_mirror(struct wmOperatorType *ot);
void PARTICLE_OT_brush_edit(struct wmOperatorType *ot);
-void PARTICLE_OT_brush_radial_control(struct wmOperatorType *ot);
void PARTICLE_OT_particle_edit_toggle(struct wmOperatorType *ot);
void PARTICLE_OT_edited_clear(struct wmOperatorType *ot);
diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c
index 02b2fad7a00..56bd8b97532 100644
--- a/source/blender/editors/physics/physics_ops.c
+++ b/source/blender/editors/physics/physics_ops.c
@@ -66,7 +66,6 @@ static void operatortypes_particle(void)
WM_operatortype_append(PARTICLE_OT_mirror);
WM_operatortype_append(PARTICLE_OT_brush_edit);
- WM_operatortype_append(PARTICLE_OT_brush_radial_control);
WM_operatortype_append(PARTICLE_OT_particle_edit_toggle);
WM_operatortype_append(PARTICLE_OT_edited_clear);
@@ -91,6 +90,7 @@ static void operatortypes_particle(void)
static void keymap_particle(wmKeyConfig *keyconf)
{
+ wmKeyMapItem *kmi;
wmKeyMap *keymap;
keymap= WM_keymap_find(keyconf, "Particle", 0, 0);
@@ -110,10 +110,19 @@ static void keymap_particle(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, 0, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1);
+ kmi = WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_ANY, 0);
+ RNA_boolean_set(kmi->ptr, "release_confirm", 1);
+
WM_keymap_add_item(keymap, "PARTICLE_OT_brush_edit", LEFTMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PARTICLE_OT_brush_edit", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
- RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_brush_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
- RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_brush_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
+
+ /* size radial control */
+ kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, 0, 0);
+ RNA_string_set(kmi->ptr, "data_path", "tool_settings.particle_edit.brush.size");
+
+ /* size radial control */
+ kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_string_set(kmi->ptr, "data_path", "tool_settings.particle_edit.brush.strength");
WM_keymap_add_menu(keymap, "VIEW3D_MT_particle_specials", WKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c
index df6cdb577a2..797ead3cd90 100644
--- a/source/blender/editors/physics/physics_pointcache.c
+++ b/source/blender/editors/physics/physics_pointcache.c
@@ -156,6 +156,7 @@ void PTCACHE_OT_bake_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Bake All Physics";
+ ot->description= "Bake all physics";
ot->idname= "PTCACHE_OT_bake_all";
/* api callbacks */
@@ -171,6 +172,7 @@ void PTCACHE_OT_free_bake_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Free All Physics Bakes";
+ ot->name= "Free all physics bakes";
ot->idname= "PTCACHE_OT_free_bake_all";
/* api callbacks */
@@ -268,6 +270,7 @@ void PTCACHE_OT_bake(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Bake Physics";
+ ot->description= "Bake physics";
ot->idname= "PTCACHE_OT_bake";
/* api callbacks */
@@ -283,6 +286,7 @@ void PTCACHE_OT_free_bake(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Free Physics Bake";
+ ot->description= "Free physics bake";
ot->idname= "PTCACHE_OT_free_bake";
/* api callbacks */
@@ -296,6 +300,7 @@ void PTCACHE_OT_bake_from_cache(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Bake From Cache";
+ ot->description= "Bake from cache";
ot->idname= "PTCACHE_OT_bake_from_cache";
/* api callbacks */
@@ -364,7 +369,8 @@ static int ptcache_remove_exec(bContext *C, wmOperator *UNUSED(op))
void PTCACHE_OT_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add new cache";
+ ot->name= "Add New Cache";
+ ot->description= "Add new cache";
ot->idname= "PTCACHE_OT_add";
/* api callbacks */
@@ -377,7 +383,8 @@ void PTCACHE_OT_add(wmOperatorType *ot)
void PTCACHE_OT_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete current cache";
+ ot->name= "Delete Current Cache";
+ ot->description= "Delete current cache";
ot->idname= "PTCACHE_OT_remove";
/* api callbacks */