[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56835] trunk/blender: Fix #35368:
Brecht Van Lommel
brechtvanlommel at pandora.be
Thu May 16 02:07:02 CEST 2013
Revision: 56835
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56835
Author: blendix
Date: 2013-05-16 00:07:01 +0000 (Thu, 16 May 2013)
Log Message:
-----------
Fix #35368:
* Editing number of segments for particle hair did not update the viewport.
* Hidden particles were confusing, the paths were drawn but without the points.
Now it draws the path faded to indicate that they are hidden/locked.
* Select tips/roots operators now have options to select/deselect/toggle/invert.
Modified Paths:
--------------
trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
trunk/blender/source/blender/editors/physics/particle_edit.c
trunk/blender/source/blender/editors/space_view3d/drawobject.c
trunk/blender/source/blender/makesrna/intern/rna_particle.c
trunk/blender/source/blender/windowmanager/WM_api.h
trunk/blender/source/blender/windowmanager/intern/wm_operators.c
Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d.py 2013-05-15 22:55:30 UTC (rev 56834)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d.py 2013-05-16 00:07:01 UTC (rev 56835)
@@ -1437,16 +1437,34 @@
particle_edit = context.tool_settings.particle_edit
layout.operator("particle.rekey")
+ layout.operator("particle.delete")
+ layout.operator("particle.remove_doubles")
+ if particle_edit.select_mode == 'POINT':
+ layout.operator("particle.subdivide")
+
+ layout.operator("particle.weight_set")
layout.separator()
+
+ layout.operator("particle.mirror")
+
if particle_edit.select_mode == 'POINT':
- layout.operator("particle.subdivide")
+ layout.separator()
layout.operator("particle.select_roots")
layout.operator("particle.select_tips")
- layout.operator("particle.remove_doubles")
+ layout.separator()
+ layout.operator("particle.select_more")
+ layout.operator("particle.select_less")
+ layout.separator()
+
+ layout.operator("particle.select_all").action = 'TOGGLE'
+ layout.operator("particle.select_linked")
+ layout.operator("particle.select_all", text="Inverse").action = 'INVERT'
+
+
class VIEW3D_MT_particle_showhide(ShowHideMenu, Menu):
_operator_name = "particle"
Modified: trunk/blender/source/blender/editors/physics/particle_edit.c
===================================================================
--- trunk/blender/source/blender/editors/physics/particle_edit.c 2013-05-15 22:55:30 UTC (rev 56834)
+++ trunk/blender/source/blender/editors/physics/particle_edit.c 2013-05-16 00:07:01 UTC (rev 56835)
@@ -376,6 +376,9 @@
int invert;
int tot;
float vec[3];
+
+ int select_action;
+ int select_toggle_action;
} PEData;
static void PE_set_data(bContext *C, PEData *data)
@@ -1332,6 +1335,34 @@
/************************ de select all operator ************************/
+static void select_action_apply(PTCacheEditPoint *point, PTCacheEditKey *key, int action)
+{
+ switch (action) {
+ case SEL_SELECT:
+ if ((key->flag & PEK_SELECT) == 0) {
+ key->flag |= PEK_SELECT;
+ point->flag |= PEP_EDIT_RECALC;
+ }
+ break;
+ case SEL_DESELECT:
+ if (key->flag & PEK_SELECT) {
+ key->flag &= ~PEK_SELECT;
+ point->flag |= PEP_EDIT_RECALC;
+ }
+ break;
+ case SEL_INVERT:
+ if ((key->flag & PEK_SELECT) == 0) {
+ key->flag |= PEK_SELECT;
+ point->flag |= PEP_EDIT_RECALC;
+ }
+ else {
+ key->flag &= ~PEK_SELECT;
+ point->flag |= PEP_EDIT_RECALC;
+ }
+ break;
+ }
+}
+
static int pe_select_all_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
@@ -1355,30 +1386,7 @@
LOOP_VISIBLE_POINTS {
LOOP_VISIBLE_KEYS {
- switch (action) {
- case SEL_SELECT:
- if ((key->flag & PEK_SELECT) == 0) {
- key->flag |= PEK_SELECT;
- point->flag |= PEP_EDIT_RECALC;
- }
- break;
- case SEL_DESELECT:
- if (key->flag & PEK_SELECT) {
- key->flag &= ~PEK_SELECT;
- point->flag |= PEP_EDIT_RECALC;
- }
- break;
- case SEL_INVERT:
- if ((key->flag & PEK_SELECT) == 0) {
- key->flag |= PEK_SELECT;
- point->flag |= PEP_EDIT_RECALC;
- }
- else {
- key->flag &= ~PEK_SELECT;
- point->flag |= PEP_EDIT_RECALC;
- }
- break;
- }
+ select_action_apply(point, key, action);
}
}
@@ -1445,22 +1453,39 @@
return OPERATOR_FINISHED;
}
-/************************ select first operator ************************/
+/************************ select root operator ************************/
static void select_root(PEData *data, int point_index)
{
- if (data->edit->points[point_index].flag & PEP_HIDE)
+ PTCacheEditPoint *point = data->edit->points + point_index;
+ PTCacheEditKey *key = point->keys;
+
+ if (point->flag & PEP_HIDE)
return;
- data->edit->points[point_index].keys->flag |= PEK_SELECT;
- data->edit->points[point_index].flag |= PEP_EDIT_RECALC; /* redraw selection only */
+ if (data->select_action != SEL_TOGGLE)
+ select_action_apply(point, key, data->select_action);
+ else if (key->flag & PEK_SELECT)
+ data->select_toggle_action = SEL_DESELECT;
}
-static int select_roots_exec(bContext *C, wmOperator *UNUSED(op))
+static int select_roots_exec(bContext *C, wmOperator *op)
{
PEData data;
+ int action = RNA_enum_get(op->ptr, "action");
PE_set_data(C, &data);
+
+ if (action == SEL_TOGGLE) {
+ data.select_action = SEL_TOGGLE;
+ data.select_toggle_action = SEL_SELECT;
+
+ foreach_point(&data, select_root);
+
+ action = data.select_toggle_action;
+ }
+
+ data.select_action = action;
foreach_point(&data, select_root);
PE_update_selection(data.scene, data.ob, 1);
@@ -1482,26 +1507,44 @@
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* properties */
+ WM_operator_properties_select_action(ot, SEL_SELECT);
}
-/************************ select last operator ************************/
+/************************ select tip operator ************************/
static void select_tip(PEData *data, int point_index)
{
PTCacheEditPoint *point = data->edit->points + point_index;
+ PTCacheEditKey *key = &point->keys[point->totkey - 1];
if (point->flag & PEP_HIDE)
return;
- point->keys[point->totkey - 1].flag |= PEK_SELECT;
- point->flag |= PEP_EDIT_RECALC; /* redraw selection only */
+ if (data->select_action != SEL_TOGGLE)
+ select_action_apply(point, key, data->select_action);
+ else if (key->flag & PEK_SELECT)
+ data->select_toggle_action = SEL_DESELECT;
}
-static int select_tips_exec(bContext *C, wmOperator *UNUSED(op))
+static int select_tips_exec(bContext *C, wmOperator *op)
{
PEData data;
+ int action = RNA_enum_get(op->ptr, "action");
PE_set_data(C, &data);
+
+ if (action == SEL_TOGGLE) {
+ data.select_action = SEL_TOGGLE;
+ data.select_toggle_action = SEL_SELECT;
+
+ foreach_point(&data, select_tip);
+
+ action = data.select_toggle_action;
+ }
+
+ data.select_action = action;
foreach_point(&data, select_tip);
PE_update_selection(data.scene, data.ob, 1);
@@ -1523,6 +1566,9 @@
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* properties */
+ WM_operator_properties_select_action(ot, SEL_SELECT);
}
/************************ select linked operator ************************/
Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c 2013-05-15 22:55:30 UTC (rev 56834)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c 2013-05-16 00:07:01 UTC (rev 56835)
@@ -4785,12 +4785,11 @@
UI_GetThemeColor3fv(TH_VERTEX, nosel_col);
/* draw paths */
- if (timed) {
- glEnable(GL_BLEND);
- steps = (*edit->pathcache)->steps + 1;
- pathcol = MEM_callocN(steps * 4 * sizeof(float), "particle path color data");
- }
+ steps = (*edit->pathcache)->steps + 1;
+ glEnable(GL_BLEND);
+ pathcol = MEM_callocN(steps * 4 * sizeof(float), "particle path color data");
+
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
@@ -4804,11 +4803,19 @@
}
cache = edit->pathcache;
- for (i = 0; i < totpoint; i++) {
+ for (i = 0, point = edit->points; i < totpoint; i++, point++) {
path = cache[i];
glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->co);
- if (timed) {
+ if (point->flag & PEP_HIDE) {
+ for (k = 0, pcol = pathcol; k < steps; k++, pcol += 4) {
+ copy_v3_v3(pcol, path->col);
+ pcol[3] = 0.25f;
+ }
+
+ glColorPointer(4, GL_FLOAT, 4 * sizeof(float), pathcol);
+ }
+ else if (timed) {
for (k = 0, pcol = pathcol, pkey = path; k < steps; k++, pkey++, pcol += 4) {
copy_v3_v3(pcol, pkey->col);
pcol[3] = 1.0f - fabsf((float)(CFRA) -pkey->time) / (float)pset->fade_frames;
Modified: trunk/blender/source/blender/makesrna/intern/rna_particle.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_particle.c 2013-05-15 22:55:30 UTC (rev 56834)
+++ trunk/blender/source/blender/makesrna/intern/rna_particle.c 2013-05-16 00:07:01 UTC (rev 56835)
@@ -2294,7 +2294,7 @@
prop = RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 2, 50);
RNA_def_property_ui_text(prop, "Segments", "Number of hair segments");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
/*TODO: not found in UI, readonly? */
Modified: trunk/blender/source/blender/windowmanager/WM_api.h
===================================================================
--- trunk/blender/source/blender/windowmanager/WM_api.h 2013-05-15 22:55:30 UTC (rev 56834)
+++ trunk/blender/source/blender/windowmanager/WM_api.h 2013-05-16 00:07:01 UTC (rev 56835)
@@ -243,6 +243,7 @@
void WM_operator_properties_mouse_select(struct wmOperatorType *ot);
void WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, bool cursor);
void WM_operator_properties_select_all(struct wmOperatorType *ot);
+void WM_operator_properties_select_action(struct wmOperatorType *ot, int default_action);
bool WM_operator_check_ui_enabled(const struct bContext *C, const char *idname);
wmOperator *WM_operator_last_redo(const struct bContext *C);
Modified: trunk/blender/source/blender/windowmanager/intern/wm_operators.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_operators.c 2013-05-15 22:55:30 UTC (rev 56834)
+++ trunk/blender/source/blender/windowmanager/intern/wm_operators.c 2013-05-16 00:07:01 UTC (rev 56835)
@@ -1109,9 +1109,9 @@
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
}
-void WM_operator_properties_select_all(wmOperatorType *ot)
+void WM_operator_properties_select_action(wmOperatorType *ot, int default_action)
{
- static EnumPropertyItem select_all_actions[] = {
+ static EnumPropertyItem select_actions[] = {
{SEL_TOGGLE, "TOGGLE", 0, "Toggle", "Toggle selection for all elements"},
{SEL_SELECT, "SELECT", 0, "Select", "Select all elements"},
{SEL_DESELECT, "DESELECT", 0, "Deselect", "Deselect all elements"},
@@ -1119,9 +1119,14 @@
{0, NULL, 0, NULL, NULL}
};
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list