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.c27
-rw-r--r--source/blender/editors/physics/rigidbody_object.c23
2 files changed, 37 insertions, 13 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 0ec8238f741..97994b65f40 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -524,15 +524,13 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
ED_view3d_viewcontext_init(C, &data->vc, data->depsgraph);
if (!XRAY_ENABLED(data->vc.v3d)) {
- if (data->vc.v3d->flag & V3D_INVALID_BACKBUF) {
- /* needed or else the draw matrix can be incorrect */
- view3d_operator_needs_opengl(C);
-
- ED_view3d_backbuf_depth_validate(&data->vc);
- /* we may need to force an update here by setting the rv3d as dirty
- * for now it seems ok, but take care!:
- * rv3d->depths->dirty = 1; */
- ED_view3d_depth_update(data->vc.region);
+ if (!(data->vc.v3d->runtime.flag & V3D_RUNTIME_DEPTHBUF_OVERRIDDEN)) {
+ ED_view3d_depth_override(data->depsgraph,
+ data->vc.region,
+ data->vc.v3d,
+ data->vc.obact,
+ V3D_DEPTH_OBJECT_ONLY,
+ true);
}
}
}
@@ -611,7 +609,7 @@ static bool key_test_depth(const PEData *data, const float co[3], const int scre
}
float win[3];
- ED_view3d_project(data->vc.region, co, win);
+ ED_view3d_project_v3(data->vc.region, co, win);
if (win[2] - 0.00001f > depth) {
return 0;
@@ -5377,8 +5375,7 @@ static bool particle_edit_toggle_poll(bContext *C)
return 0;
}
- return (ob->particlesystem.first || BKE_modifiers_findby_type(ob, eModifierType_Cloth) ||
- BKE_modifiers_findby_type(ob, eModifierType_Softbody));
+ return ED_object_particle_edit_mode_supported(ob);
}
static void free_all_psys_edit(Object *object)
@@ -5393,6 +5390,12 @@ static void free_all_psys_edit(Object *object)
}
}
+bool ED_object_particle_edit_mode_supported(const Object *ob)
+{
+ return (ob->particlesystem.first || BKE_modifiers_findby_type(ob, eModifierType_Cloth) ||
+ BKE_modifiers_findby_type(ob, eModifierType_Softbody));
+}
+
void ED_object_particle_edit_mode_enter_ex(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
/* Needed so #ParticleSystemModifierData.mesh_final is set. */
diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c
index 81a8b57776b..fca3b5817b0 100644
--- a/source/blender/editors/physics/rigidbody_object.c
+++ b/source/blender/editors/physics/rigidbody_object.c
@@ -520,6 +520,26 @@ static int rigidbody_objects_calc_mass_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
+static bool mass_calculate_poll_property(const bContext *UNUSED(C),
+ wmOperator *op,
+ const PropertyRNA *prop)
+{
+ const char *prop_id = RNA_property_identifier(prop);
+
+ /* Disable density input when not using the 'Custom' preset. */
+ if (STREQ(prop_id, "density")) {
+ int material = RNA_enum_get(op->ptr, "material");
+ if (material >= 0) {
+ RNA_def_property_clear_flag((PropertyRNA *)prop, PROP_EDITABLE);
+ }
+ else {
+ RNA_def_property_flag((PropertyRNA *)prop, PROP_EDITABLE);
+ }
+ }
+
+ return true;
+}
+
void RIGIDBODY_OT_mass_calculate(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -533,6 +553,7 @@ void RIGIDBODY_OT_mass_calculate(wmOperatorType *ot)
ot->invoke = WM_menu_invoke; /* XXX */
ot->exec = rigidbody_objects_calc_mass_exec;
ot->poll = ED_operator_rigidbody_active_poll;
+ ot->poll_property = mass_calculate_poll_property;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -554,7 +575,7 @@ void RIGIDBODY_OT_mass_calculate(wmOperatorType *ot)
FLT_MIN,
FLT_MAX,
"Density",
- "Custom density value (kg/m^3) to use instead of material preset",
+ "Density value (kg/m^3), allows custom value if the 'Custom' preset is used",
1.0f,
2500.0f);
}