diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-01-30 16:32:27 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-01-30 16:32:27 +0300 |
commit | 0d64857c3f2364349475728958fac211b0bad5a2 (patch) | |
tree | fe73096f14f2fef92aba25b4ad77e63e1c079465 /source | |
parent | b5cbc8bb606654a21e25cb616d60c89ac61c65a9 (diff) | |
parent | b3c4a2a8da7f1a243628da852d1b8fdc986cbc25 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source')
16 files changed, 134 insertions, 69 deletions
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index b952859e508..0d55b65fe65 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -256,6 +256,7 @@ void BKE_sculpt_update_mesh_elements( struct MultiresModifierData *BKE_sculpt_multires_active(struct Scene *scene, struct Object *ob); int BKE_sculpt_mask_layers_ensure(struct Object *ob, struct MultiresModifierData *mmd); +void BKE_sculpt_toolsettings_data_ensure(struct Scene *scene); enum { SCULPT_MASK_LAYER_CALC_VERT = (1 << 0), diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 152a882de97..2bf5d12e50e 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -1064,3 +1064,39 @@ int BKE_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd) return ret; } + +void BKE_sculpt_toolsettings_data_ensure(struct Scene *scene) +{ + Sculpt *sd = scene->toolsettings->sculpt; + if (sd == NULL) { + sd = scene->toolsettings->sculpt = MEM_callocN(sizeof(Sculpt), __func__); + + /* Turn on X plane mirror symmetry by default */ + sd->paint.symmetry_flags |= PAINT_SYMM_X; + sd->paint.flags |= PAINT_SHOW_BRUSH; + + /* Make sure at least dyntopo subdivision is enabled */ + sd->flags |= SCULPT_DYNTOPO_SUBDIVIDE | SCULPT_DYNTOPO_COLLAPSE; + } + + if (!sd->detail_size) { + sd->detail_size = 12; + } + if (!sd->detail_percent) { + sd->detail_percent = 25; + } + if (sd->constant_detail == 0.0f) { + sd->constant_detail = 3.0f; + } + + /* Set sane default tiling offsets */ + if (!sd->paint.tile_offset[0]) { + sd->paint.tile_offset[0] = 1.0f; + } + if (!sd->paint.tile_offset[1]) { + sd->paint.tile_offset[1] = 1.0f; + } + if (!sd->paint.tile_offset[2]) { + sd->paint.tile_offset[2] = 1.0f; + } +} diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 35167835646..a18c4405a31 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -1985,6 +1985,7 @@ static bool adjust_the_cycle_or_chain_fast(BoundVert *vstart, int np, bool iscyc g_prod[i] = gprod; gprod_sum += gprod; } + g_prod[0] = 1.0f; if (iscycle) { gprod *= g[0]; if (fabs(gprod - 1.0f) > BEVEL_EPSILON) { @@ -1993,8 +1994,6 @@ static bool adjust_the_cycle_or_chain_fast(BoundVert *vstart, int np, bool iscyc MEM_freeN(g_prod); return false; } - else - g_prod[0] = 1.0f; } if (gprod_sum == 0.0f) { MEM_freeN(g); @@ -2163,7 +2162,7 @@ static void adjust_offsets(BevelParams *bp) /* first follow paired edges in left->right direction */ v = vchainstart = vanchor; iscycle = false; - while(v->eon && !v->visited && !iscycle) { + while (v->eon && !v->visited && !iscycle) { enext = find_other_end_edge_half(bp, v->efirst, &bvcur); BLI_assert(enext != NULL); vnext = enext->leftv; @@ -2191,7 +2190,7 @@ static void adjust_offsets(BevelParams *bp) vchainstart = vnext; v->visited = true; v = vnext; - } while(!v->visited && v->eon); + } while (!v->visited && v->eon); adjust_the_cycle_or_chain(vchainstart, false); } } while ((vanchor = vanchor->next) != bv->vmesh->boundstart); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc index 2fc42efa440..8be974aae39 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -347,8 +347,8 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object) object_cow), DEG_OPCODE_POSE_INIT); op_node->set_as_entry(); - BLI_LISTBASE_FOREACH (bPoseChannel *, pchan, &object_cow->pose->chanbase) { - /* Local bone transform. */ + + BLI_LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index cfb73ecc2ad..281e58cf38a 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -939,18 +939,7 @@ void DepsgraphRelationBuilder::build_animdata_curves(ID *id) ComponentKey adt_key(id, DEG_NODE_TYPE_ANIMATION); TimeSourceKey time_src_key; add_relation(time_src_key, adt_key, "TimeSrc -> Animation"); - /* Build relations from animation operation to properties it changes. */ - build_animdata_curves_targets(id); -} - -void DepsgraphRelationBuilder::build_animdata_curves_targets(ID *id) -{ - AnimData *adt = BKE_animdata_from_id(id); - if (adt == NULL || adt->action == NULL) { - return; - } - /* Get source operation. */ - ComponentKey adt_key(id, DEG_NODE_TYPE_ANIMATION); + /* Get source operations. */ DepsNode *node_from = get_node(adt_key); BLI_assert(node_from != NULL); if (node_from == NULL) { @@ -958,10 +947,28 @@ void DepsgraphRelationBuilder::build_animdata_curves_targets(ID *id) } OperationDepsNode *operation_from = node_from->get_exit_operation(); BLI_assert(operation_from != NULL); + /* Build relations from animation operation to properties it changes. */ + if (adt->action != NULL) { + build_animdata_curves_targets(id, adt_key, + operation_from, + &adt->action->curves); + } + BLI_LISTBASE_FOREACH(NlaTrack *, nlt, &adt->nla_tracks) { + build_animdata_nlastrip_targets(id, adt_key, + operation_from, + &nlt->strips); + } +} + +void DepsgraphRelationBuilder::build_animdata_curves_targets( + ID *id, ComponentKey &adt_key, + OperationDepsNode *operation_from, + ListBase *curves) +{ /* Iterate over all curves and build relations. */ PointerRNA id_ptr; RNA_id_pointer_create(id, &id_ptr); - BLI_LISTBASE_FOREACH (FCurve *, fcu, &adt->action->curves) { + BLI_LISTBASE_FOREACH(FCurve *, fcu, curves) { PointerRNA ptr; PropertyRNA *prop; int index; @@ -1004,6 +1011,25 @@ void DepsgraphRelationBuilder::build_animdata_curves_targets(ID *id) } } +void DepsgraphRelationBuilder::build_animdata_nlastrip_targets( + ID *id, ComponentKey &adt_key, + OperationDepsNode *operation_from, + ListBase *strips) +{ + BLI_LISTBASE_FOREACH(NlaStrip *, strip, strips) { + if (strip->act != NULL) { + build_animdata_curves_targets(id, adt_key, + operation_from, + &strip->act->curves); + } + else if (strip->strips.first != NULL) { + build_animdata_nlastrip_targets(id, adt_key, + operation_from, + &strip->strips); + } + } +} + void DepsgraphRelationBuilder::build_animdata_drivers(ID *id) { AnimData *adt = BKE_animdata_from_id(id); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index 30b3219f989..4fcb2acc5f3 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -205,7 +205,14 @@ struct DepsgraphRelationBuilder RootPChanMap *root_map); void build_animdata(ID *id); void build_animdata_curves(ID *id); - void build_animdata_curves_targets(ID *id); + void build_animdata_curves_targets(ID *id, + ComponentKey &adt_key, + OperationDepsNode *operation_from, + ListBase *curves); + void build_animdata_nlastrip_targets(ID *id, + ComponentKey &adt_key, + OperationDepsNode *operation_from, + ListBase *strips); void build_animdata_drivers(ID *id); void build_driver(ID *id, FCurve *fcurve); void build_driver_data(ID *id, FCurve *fcurve); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc index ad812a4b505..563acd01bf2 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -443,16 +443,43 @@ void DepsgraphRelationBuilder::build_rig(Object *object) void DepsgraphRelationBuilder::build_proxy_rig(Object *object) { - OperationKey pose_init_key(&object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT); - OperationKey pose_done_key(&object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_DONE); + Object *proxy_from = object->proxy_from; + OperationKey pose_init_key(&object->id, + DEG_NODE_TYPE_EVAL_POSE, + DEG_OPCODE_POSE_INIT); + OperationKey pose_done_key(&object->id, + DEG_NODE_TYPE_EVAL_POSE, + DEG_OPCODE_POSE_DONE); BLI_LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { - OperationKey bone_local_key(&object->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_LOCAL); - OperationKey bone_ready_key(&object->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_READY); - OperationKey bone_done_key(&object->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_DONE); + OperationKey bone_local_key(&object->id, + DEG_NODE_TYPE_BONE, pchan->name, + DEG_OPCODE_BONE_LOCAL); + OperationKey bone_ready_key(&object->id, + DEG_NODE_TYPE_BONE, + pchan->name, + DEG_OPCODE_BONE_READY); + OperationKey bone_done_key(&object->id, + DEG_NODE_TYPE_BONE, + pchan->name, + DEG_OPCODE_BONE_DONE); add_relation(pose_init_key, bone_local_key, "Pose Init -> Bone Local"); add_relation(bone_local_key, bone_ready_key, "Local -> Ready"); add_relation(bone_ready_key, bone_done_key, "Ready -> Done"); add_relation(bone_done_key, pose_done_key, "Bone Done -> Pose Done"); + + if (pchan->prop != NULL) { + OperationKey bone_parameters(&object->id, + DEG_NODE_TYPE_PARAMETERS, + DEG_OPCODE_PARAMETERS_EVAL, + pchan->name); + OperationKey from_bone_parameters(&proxy_from->id, + DEG_NODE_TYPE_PARAMETERS, + DEG_OPCODE_PARAMETERS_EVAL, + pchan->name); + add_relation(from_bone_parameters, + bone_parameters, + "Proxy Bone Parameters"); + } } } diff --git a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc index 8fc4c0bcec1..a717448df4a 100644 --- a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc +++ b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc @@ -467,7 +467,7 @@ static void deg_debug_graphviz_node_relations(const DebugContext &ctx, deg_debug_fprintf(ctx, "["); /* Note: without label an id seem necessary to avoid bugs in graphviz/dot */ deg_debug_fprintf(ctx, "id=\"%s\"", rel->name); - deg_debug_fprintf(ctx, "label=\"%s\"", rel->name); + // deg_debug_fprintf(ctx, "label=\"%s\"", rel->name); deg_debug_fprintf(ctx, ",color="); deg_debug_graphviz_relation_color(ctx, rel); deg_debug_fprintf(ctx, ",penwidth=\"%f\"", penwidth); /* NOTE: edge from node to own cluster is not possible and gives graphviz diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 7eee053061e..e3eb4c7ac97 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -476,7 +476,7 @@ void ED_view3d_operator_properties_viewmat_get(struct wmOperator *op, int *winx, /* render */ void ED_view3d_stop_render_preview(struct wmWindowManager *wm, struct ARegion *ar); -void ED_view3d_shade_update(struct Main *bmain, struct Scene *scene, struct View3D *v3d, struct ScrArea *sa); +void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrArea *sa); #define V3D_IS_ZBUF(v3d) \ (((v3d)->flag & V3D_ZBUF_SELECT) && ((v3d)->drawtype > OB_WIRE)) diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 5697c48d381..1dc3f21afef 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -216,11 +216,6 @@ static bool ED_object_editmode_load_ex(Main *bmain, Object *obedit, const bool f if (freedata) ED_mball_editmball_free(obedit); } - /* Tag update so no access to freed data referenced from - * derived cache will happen. - */ - DEG_id_tag_update((ID *)obedit->data, 0); - return true; } diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 0c1df71b1aa..b536f42a54e 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -940,6 +940,9 @@ static void do_weight_paint_vertex( /* Toggle operator for turning vertex paint mode on or off (copied from sculpt.c) */ static void vertex_paint_init_session(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) { + /* Create persistent sculpt mode data */ + BKE_sculpt_toolsettings_data_ensure(scene); + if (ob->sculpt == NULL) { ob->sculpt = MEM_callocN(sizeof(SculptSession), "sculpt session"); BKE_sculpt_update_mesh_elements(eval_ctx, scene, scene->toolsettings->sculpt, ob, 0, false); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index c9d550aa4bd..2d71cc17a19 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -5602,11 +5602,12 @@ static void SCULPT_OT_symmetrize(wmOperatorType *ot) static void sculpt_init_session(const bContext *C, Scene *scene, Object *ob) { EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); - ob->sculpt = MEM_callocN(sizeof(SculptSession), "sculpt session"); + /* Create persistent sculpt mode data */ + BKE_sculpt_toolsettings_data_ensure(scene); + ob->sculpt = MEM_callocN(sizeof(SculptSession), "sculpt session"); BKE_sculpt_update_mesh_elements(&eval_ctx, scene, scene->toolsettings->sculpt, ob, 0, false); } @@ -5614,7 +5615,6 @@ static void sculpt_init_session(const bContext *C, Scene *scene, Object *ob) static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - ToolSettings *ts = CTX_data_tool_settings(C); Object *ob = CTX_data_active_object(C); const int mode_flag = OB_MODE_SCULPT; const bool is_mode_set = (ob->mode & mode_flag) != 0; @@ -5670,31 +5670,6 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op) if (flush_recalc) DEG_id_tag_update(&ob->id, OB_RECALC_DATA); - /* Create persistent sculpt mode data */ - if (!ts->sculpt) { - ts->sculpt = MEM_callocN(sizeof(Sculpt), "sculpt mode data"); - - /* Turn on X plane mirror symmetry by default */ - ts->sculpt->paint.symmetry_flags |= PAINT_SYMM_X; - ts->sculpt->paint.flags |= PAINT_SHOW_BRUSH; - - /* Make sure at least dyntopo subdivision is enabled */ - ts->sculpt->flags |= SCULPT_DYNTOPO_SUBDIVIDE | SCULPT_DYNTOPO_COLLAPSE; - } - - if (!ts->sculpt->detail_size) - ts->sculpt->detail_size = 12; - if (!ts->sculpt->detail_percent) - ts->sculpt->detail_percent = 25; - if (ts->sculpt->constant_detail == 0.0f) - ts->sculpt->constant_detail = 3.0f; - - /* Set sane default tiling offsets */ - if (!ts->sculpt->paint.tile_offset[0]) ts->sculpt->paint.tile_offset[0] = 1.0f; - if (!ts->sculpt->paint.tile_offset[1]) ts->sculpt->paint.tile_offset[1] = 1.0f; - if (!ts->sculpt->paint.tile_offset[2]) ts->sculpt->paint.tile_offset[2] = 1.0f; - - /* Create sculpt mode session data */ if (ob->sculpt) BKE_sculptsession_free(ob); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 1c46e42a9f5..24b3a9b9547 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -296,7 +296,7 @@ void ED_view3d_stop_render_preview(wmWindowManager *wm, ARegion *ar) } } -void ED_view3d_shade_update(Main *bmain, Scene *scene, View3D *v3d, ScrArea *sa) +void ED_view3d_shade_update(Main *bmain, View3D *v3d, ScrArea *sa) { wmWindowManager *wm = bmain->wm.first; @@ -308,10 +308,6 @@ void ED_view3d_shade_update(Main *bmain, Scene *scene, View3D *v3d, ScrArea *sa) ED_view3d_stop_render_preview(wm, ar); } } - else if (scene->obedit != NULL && scene->obedit->type == OB_MESH) { - /* Tag mesh to load edit data. */ - DEG_id_tag_update(scene->obedit->data, 0); - } } /* ******************** default callbacks for view3d space ***************** */ diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 2457a890f71..ba9432b932d 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -4696,7 +4696,7 @@ static int toggle_render_exec(bContext *C, wmOperator *UNUSED(op)) v3d->prev_drawtype = v3d->drawtype; v3d->drawtype = OB_RENDER; } - ED_view3d_shade_update(CTX_data_main(C), CTX_data_scene(C), v3d, CTX_wm_area(C)); + ED_view3d_shade_update(CTX_data_main(C), v3d, CTX_wm_area(C)); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); return OPERATOR_FINISHED; } diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 4ff8444cd71..f6019747b45 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -573,12 +573,12 @@ static void rna_SpaceView3D_layer_update(Main *bmain, Scene *UNUSED(scene), Poin DEG_on_visible_update(bmain, false); } -static void rna_SpaceView3D_viewport_shade_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_SpaceView3D_viewport_shade_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { View3D *v3d = (View3D *)(ptr->data); ScrArea *sa = rna_area_from_space(ptr); - ED_view3d_shade_update(bmain, scene, v3d, sa); + ED_view3d_shade_update(bmain, v3d, sa); } static void rna_SpaceView3D_matcap_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index 6b47d7c3474..b96991413ff 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -1348,7 +1348,7 @@ static const char arg_handle_render_frame_doc[] = "\n" "\t* +<frame> start frame relative, -<frame> end frame relative.\n" "\t* A comma separated list of frames can also be used (no spaces).\n" -"\t* A range of frames can be expressed using '..' seperator between the first and last frames (inclusive).\n" +"\t* A range of frames can be expressed using '..' separator between the first and last frames (inclusive).\n" ; static int arg_handle_render_frame(int argc, const char **argv, void *data) { |