[Bf-blender-cvs] [b7f7879ad26] fracture_modifier: added step option to convert to keyframes, new parameter popup dialog, also backported fseek fix to meshcache modifier
Martin Felke
noreply at git.blender.org
Mon May 29 21:34:14 CEST 2017
Commit: b7f7879ad263fba574416f0c28c2a2e0984ba9e8
Author: Martin Felke
Date: Mon May 29 21:33:40 2017 +0200
Branches: fracture_modifier
https://developer.blender.org/rBb7f7879ad263fba574416f0c28c2a2e0984ba9e8
added step option to convert to keyframes, new parameter popup dialog, also backported fseek fix to meshcache modifier
===================================================================
M release/scripts/startup/bl_ui/properties_physics_fracture.py
M source/blender/editors/object/object_modifier.c
M source/blender/modifiers/intern/MOD_meshcache_mdd.c
M source/blender/modifiers/intern/MOD_meshcache_pc2.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_physics_fracture.py b/release/scripts/startup/bl_ui/properties_physics_fracture.py
index d1639be367f..fd41310dde3 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fracture.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fracture.py
@@ -87,8 +87,10 @@ class PHYSICS_PT_fracture(PhysicButtonsPanel, Panel):
row.prop(md, "fracture_mode")
if md.fracture_mode == 'EXTERNAL':
- layout.context_pointer_set("modifier", md)
- layout.operator("object.rigidbody_convert_to_objects", text = "Convert To Objects")
+ col = layout.column(align=True)
+ col.context_pointer_set("modifier", md)
+ col.operator("object.rigidbody_convert_to_objects", text = "Convert To Objects")
+ col.operator("object.rigidbody_convert_to_keyframes", text = "Convert To Keyframed Objects")
return
if md.fracture_mode == 'DYNAMIC':
@@ -257,9 +259,10 @@ class PHYSICS_PT_fracture_utilities(PhysicButtonsPanel, Panel):
row.prop(md, "fix_normals")
row.prop(md, "nor_range")
- layout.context_pointer_set("modifier", md)
- layout.operator("object.rigidbody_convert_to_objects", text = "Convert To Objects")
- layout.operator("object.rigidbody_convert_to_keyframes", text = "Convert To Keyframed Objects")
+ col = layout.column(align=True)
+ col.context_pointer_set("modifier", md)
+ col.operator("object.rigidbody_convert_to_objects", text = "Convert To Objects")
+ col.operator("object.rigidbody_convert_to_keyframes", text = "Convert To Keyframed Objects")
if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__)
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 69605faea7b..a5be5533250 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -100,6 +100,8 @@
#include "ED_keyframing.h"
#include "ED_anim_api.h" //clean keyframes
+#include "UI_interface.h"
+
#include "WM_api.h"
#include "WM_types.h"
@@ -2342,83 +2344,6 @@ void OBJECT_OT_laplaciandeform_bind(wmOperatorType *ot)
/****************** rigidbody modifier refresh operator *********************/
-typedef struct FractureJob {
- /* from wmJob */
- void *owner;
- short *stop, *do_update;
- float *progress;
- int current_frame, total_progress;
- int start, end;
- struct FractureModifierData *fmd;
- struct Object *ob;
- struct Scene *scene;
- struct Group *gr;
-} FractureJob;
-
-
-static void fracture_free(void *customdata)
-{
- FractureJob *fj = customdata;
- MEM_freeN(fj);
-}
-
-static int fracture_breakjob(void *UNUSED(customdata))
-{
- /* FractureJob *fj = (FractureJob *)customdata;
- * return *(fj->stop); */
- return G.is_break; /* a workaround solution */
-}
-
-static void fracture_update(void *customdata)
-{
- FractureJob *fj = customdata;
- float progress;
-
- if (fj->fmd->frac_mesh == NULL)
- (*fj->progress) = 0.0f;
-
- if (fracture_breakjob(fj) && fj->fmd->frac_mesh)
- fj->fmd->frac_mesh->cancel = 1;
-
- /*(fj->do_update) = true; useless here... because in wm_jobs.c its set to false again, preventing update*/
- if (fj->fmd->frac_mesh)
- {
- progress = (float)(fj->fmd->frac_mesh->progress_counter) / (float)(fj->total_progress);
- (*fj->progress) = progress;
- }
-}
-
-static void fracture_startjob(void *customdata, short *stop, short *do_update, float *progress)
-{
- FractureJob *fj = customdata;
- FractureModifierData *fmd = fj->fmd;
- Object *ob = fj->ob;
- Scene* scene = fj->scene;
-
- fj->stop = stop;
- fj->do_update = do_update;
- fj->progress = progress;
- *(fj->stop) = 0; /*false*/
-
- G.is_break = false; /* XXX shared with render - replace with job 'stop' switch */
-
- /* arm the modifier... */
- fmd->refresh = true;
- *(fj->do_update) = true;
- *do_update = true;
- *stop = 0;
-
- /*...and trigger modifier execution HERE*/
- makeDerivedMesh(scene, ob, NULL, scene->customdata_mask | CD_MASK_BAREMESH, 0);
-}
-
-static void fracture_endjob(void *customdata)
-{
- FractureJob *fj = customdata;
- FractureModifierData *fmd = fj->fmd;
- fmd->refresh = false;
-}
-
static int fracture_poll(bContext *C)
{
return edit_modifier_poll_generic(C, &RNA_FractureModifier, 0);
@@ -2431,9 +2356,6 @@ static int fracture_refresh_exec(bContext *C, wmOperator *op)
float cfra = BKE_scene_frame_get(scene);
double start = 1.0;
FractureModifierData *rmd;
-// FractureJob *fj;
-// wmJob* wm_job;
- //RegionView3D *rv3d = CTX_wm_region_view3d(C);
rmd = (FractureModifierData *)modifiers_findByType(obact, eModifierType_Fracture);
if (!rmd)
@@ -2608,54 +2530,6 @@ void OBJECT_OT_fracture_refresh(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "reset", false, "Reset Shards", "Reset all shards in next refracture, instead of keeping similar ones");
}
-/****************** rigidbody constraint refresh operator *********************/
-
-#if 0
-static int rigidbody_refresh_constraints_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Object *obact = ED_object_active_context(C);
- FractureModifierData *rmd;
- Scene *scene = CTX_data_scene(C);
- float cfra = BKE_scene_frame_get(scene);
-
- rmd = (FractureModifierData *)modifiers_findByType(obact, eModifierType_Fracture);
-
- if (!rmd || (rmd && rmd->refresh) || (scene->rigidbody_world && cfra != scene->rigidbody_world->pointcache->startframe))
- return OPERATOR_CANCELLED;
-
- rmd->refresh_constraints = true;
-
- DAG_id_tag_update(&obact->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obact);
-
- return OPERATOR_FINISHED;
-}
-
-static int rigidbody_refresh_constraints_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
-{
- if (edit_modifier_invoke_properties(C, op) || true)
- return rigidbody_refresh_constraints_exec(C, op);
- else
- return OPERATOR_CANCELLED;
-}
-
-
-void OBJECT_OT_rigidbody_constraints_refresh(wmOperatorType *ot)
-{
- ot->name = "RigidBody Constraints Refresh";
- ot->description = "Refresh constraints in the Rigid Body modifier";
- ot->idname = "OBJECT_OT_rigidbody_constraints_refresh";
-
- ot->poll = fracture_poll;
- ot->invoke = rigidbody_refresh_constraints_invoke;
- ot->exec = rigidbody_refresh_constraints_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
- edit_modifier_properties(ot);
-}
-#endif
-
static void do_add_group_unchecked(Group* group, Object *ob, Base *bas)
{
GroupObject *go;
@@ -3213,7 +3087,7 @@ static bAnimContext* make_anim_context(Scene* scene, Object* ob)
static Object* do_convert_meshIsland(FractureModifierData* fmd, MeshIsland *mi, Group* gr, Object* ob, Scene* scene,
int start, int end, int count, Object* parent, bool is_baked,
PTCacheID* pid, PointCache *cache, float obloc[3], float diff[3], int *j, Base **base,
- float threshold, bool clean_chan, ReportList* reports)
+ float threshold, int step, ReportList* reports)
{
int i = 0;
Object* ob_new = NULL;
@@ -3261,19 +3135,21 @@ static Object* do_convert_meshIsland(FractureModifierData* fmd, MeshIsland *mi,
mul_m4_v3(ob_new->obmat, cent);
copy_v3_v3(ob_new->loc, cent);
- if (start < mi->start_frame) {
- start = mi->start_frame;
- }
+ if (mi->frame_count > 0) {
+ if (start < mi->start_frame) {
+ start = mi->start_frame;
+ }
- if (end != mi->start_frame + mi->frame_count) {
- end = mi->start_frame + mi->frame_count;
+ if (end != mi->start_frame + mi->frame_count) {
+ end = mi->start_frame + mi->frame_count;
+ }
}
if (mi->rigidbody->type == RBO_TYPE_ACTIVE)
{
bAnimContext *ac;
- short flag = INSERTKEY_NEEDED | INSERTKEY_XYZ2RGB;
- for (i = start; i < end; i++)
+ short flag = INSERTKEY_FAST | INSERTKEY_NEEDED | INSERTKEY_NO_USERPREF;
+ for (i = start; i < end; i += step)
{
float size[3];
copy_v3_v3(size, ob->size);
@@ -3293,7 +3169,7 @@ static Object* do_convert_meshIsland(FractureModifierData* fmd, MeshIsland *mi,
copy_qt_qt(rot, mi->rigidbody->orn);
}
}
- else
+ else //should not happen anymore, because baking is required now
{
loc[0] = mi->locs[i*3];
loc[1] = mi->locs[i*3+1];
@@ -3319,23 +3195,23 @@ static Object* do_convert_meshIsland(FractureModifierData* fmd, MeshIsland *mi,
copy_v3_v3(ob_new->size, size);
}
- insert_keyframe(NULL, (ID*)ob_new, NULL, "Location", "location", 0, i, flag, BEZT_KEYTYPE_KEYFRAME);
- insert_keyframe(NULL, (ID*)ob_new, NULL, "Location", "location", 1, i, flag, BEZT_KEYTYPE_KEYFRAME);
- insert_keyframe(NULL, (ID*)ob_new, NULL, "Location", "location", 2, i, flag, BEZT_KEYTYPE_KEYFRAME);
+ insert_keyframe(NULL, (ID*)ob_new, NULL, "Location", "location", 0, i, BEZT_KEYTYPE_KEYFRAME, flag);
+ insert_keyframe(NULL, (ID*)ob_new, NULL, "Location", "location", 1, i, BEZT_KEYTYPE_KEYFRAME, flag);
+ insert_keyframe(NULL, (ID*)ob_new, NULL, "Location", "location", 2, i, BEZT_KEYTYPE_KEYFRAME, flag);
- insert_keyframe(NULL, (ID*)ob_new, NULL, "Rotation", "rotation_euler", 0, i, flag, BEZT_KEYTYPE_KEYFRAME);
- insert_keyframe(NULL, (ID*)ob_new, NULL, "Rotation", "rotation_euler", 1, i, flag, BEZT_KEYTYPE_KEYFRAME);
- insert_keyframe(NULL, (ID*)ob_new, NULL, "Rotation", "rotation_euler", 2, i, flag, BEZT_KEYTYPE_KEYFRAME);
+ insert_keyframe(NULL, (ID*)ob_new, NULL, "Rotation", "rotation_euler", 0, i, BEZT_KEYTYPE_KEYFRAME, flag);
+ insert_keyframe(NULL, (ID*)ob_new, NULL, "Rotation", "rotation_euler", 1, i, BEZT_KEYTYPE_KEYFRAME, flag);
+ insert_keyframe(NULL, (ID*)ob_new, NULL, "Rotation", "rotation_euler", 2, i, BEZT_KEYTYPE_KEYFRAME, flag);
- insert_keyframe(NULL, (ID*)ob_new, NULL, "Scale", "scale", 0, i, flag, BEZT_KEYTYPE_KEYFRAME);
- insert_keyframe(NULL, (ID*)ob_new, NULL, "Scale", "scale", 1, i, flag, BEZT_KEYTYPE_KEYFRAME);
- insert_keyframe(NULL, (ID*)ob_new, NULL, "Scale", "scale", 2, i, flag, BEZT_KEYTYPE_KEYFRAME);
+ insert_keyframe(NULL, (ID*)ob_new, NULL, "Scale", "scale", 0, i, BEZT_KEYTYPE_KEYFRAME, flag);
+ in
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list