本文整理汇总了C++中DAG_relations_tag_update函数的典型用法代码示例。如果您正苦于以下问题:C++ DAG_relations_tag_update函数的具体用法?C++ DAG_relations_tag_update怎么用?C++ DAG_relations_tag_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DAG_relations_tag_update函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: type_toggle_exec
static int type_toggle_exec(bContext *C, wmOperator *op)
{
Object *cObject = ED_object_context(C);
Scene *scene = CTX_data_scene(C);
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(cObject, eModifierType_DynamicPaint);
int type = RNA_enum_get(op->ptr, "type");
if (!pmd) return OPERATOR_CANCELLED;
/* if type is already enabled, toggle it off */
if (type == MOD_DYNAMICPAINT_TYPE_CANVAS && pmd->canvas) {
dynamicPaint_freeCanvas(pmd);
}
else if (type == MOD_DYNAMICPAINT_TYPE_BRUSH && pmd->brush) {
dynamicPaint_freeBrush(pmd);
}
/* else create a new type */
else {
if (!dynamicPaint_createType(pmd, type, scene))
return OPERATOR_CANCELLED;
}
/* update dependency */
DAG_id_tag_update(&cObject->id, OB_RECALC_DATA);
DAG_relations_tag_update(CTX_data_main(C));
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, cObject);
return OPERATOR_FINISHED;
}
示例2: outliner_animdata_operation_exec
static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
{
SpaceOops *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutliner_AnimDataOps event;
short updateDeps = 0;
/* check for invalid states */
if (soops == NULL)
return OPERATOR_CANCELLED;
event = RNA_enum_get(op->ptr, "type");
set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
if (datalevel != TSE_ANIM_DATA)
return OPERATOR_CANCELLED;
/* perform the core operation */
switch (event) {
case OUTLINER_ANIMOP_SET_ACT:
/* delegate once again... */
WM_operator_name_call(C, "OUTLINER_OT_action_set", WM_OP_INVOKE_REGION_WIN, NULL);
break;
case OUTLINER_ANIMOP_CLEAR_ACT:
/* clear active action - using standard rules */
outliner_do_data_operation(soops, datalevel, event, &soops->tree, unlinkact_animdata_cb, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
ED_undo_push(C, "Unlink action");
break;
case OUTLINER_ANIMOP_REFRESH_DRV:
outliner_do_data_operation(soops, datalevel, event, &soops->tree, refreshdrivers_animdata_cb, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL);
//ED_undo_push(C, "Refresh Drivers"); /* no undo needed - shouldn't have any impact? */
updateDeps = 1;
break;
case OUTLINER_ANIMOP_CLEAR_DRV:
outliner_do_data_operation(soops, datalevel, event, &soops->tree, cleardrivers_animdata_cb, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL);
ED_undo_push(C, "Clear Drivers");
updateDeps = 1;
break;
default: // invalid
break;
}
/* update dependencies */
if (updateDeps) {
/* rebuild depsgraph for the new deps */
DAG_relations_tag_update(CTX_data_main(C));
}
return OPERATOR_FINISHED;
}
示例3: rule_del_exec
static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings);
ParticleSettings *part = ptr.data;
BoidRule *rule;
BoidState *state;
if (!part || part->phystype != PART_PHYS_BOIDS)
return OPERATOR_CANCELLED;
state = boid_get_current_state(part->boids);
for (rule=state->rules.first; rule; rule=rule->next) {
if (rule->flag & BOIDRULE_CURRENT) {
BLI_remlink(&state->rules, rule);
MEM_freeN(rule);
break;
}
}
rule = state->rules.first;
if (rule)
rule->flag |= BOIDRULE_CURRENT;
DAG_relations_tag_update(bmain);
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
return OPERATOR_FINISHED;
}
示例4: new_particle_target_exec
static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
Object *ob = ptr.id.data;
ParticleTarget *pt;
if (!psys)
return OPERATOR_CANCELLED;
pt = psys->targets.first;
for (; pt; pt=pt->next)
pt->flag &= ~PTARGET_CURRENT;
pt = MEM_callocN(sizeof(ParticleTarget), "keyed particle target");
pt->flag |= PTARGET_CURRENT;
pt->psys = 1;
BLI_addtail(&psys->targets, pt);
DAG_relations_tag_update(bmain);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
return OPERATOR_FINISHED;
}
示例5: remove_particle_target_exec
static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
Object *ob = ptr.id.data;
ParticleTarget *pt;
if (!psys)
return OPERATOR_CANCELLED;
pt = psys->targets.first;
for (; pt; pt=pt->next) {
if (pt->flag & PTARGET_CURRENT) {
BLI_remlink(&psys->targets, pt);
MEM_freeN(pt);
break;
}
}
pt = psys->targets.last;
if (pt)
pt->flag |= PTARGET_CURRENT;
DAG_relations_tag_update(bmain);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
return OPERATOR_FINISHED;
}
示例6: remove_driver_button_exec
static int remove_driver_button_exec(bContext *C, wmOperator *op)
{
PointerRNA ptr = {{NULL}};
PropertyRNA *prop = NULL;
short success = 0;
int index;
const bool all = RNA_boolean_get(op->ptr, "all");
/* try to find driver using property retrieved from UI */
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
if (all)
index = -1;
if (ptr.id.data && ptr.data && prop) {
char *path = BKE_animdata_driver_path_hack(C, &ptr, prop, NULL);
if (path) {
success = ANIM_remove_driver(op->reports, ptr.id.data, path, index, 0);
MEM_freeN(path);
}
}
if (success) {
/* send updates */
UI_context_update_anim_flag(C);
DAG_relations_tag_update(CTX_data_main(C));
WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX
}
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
示例7: new_particle_settings_exec
static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
ParticleSystem *psys;
ParticleSettings *part = NULL;
Object *ob;
PointerRNA ptr;
ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
psys = ptr.data;
/* add or copy particle setting */
if (psys->part)
part= BKE_particlesettings_copy(psys->part);
else
part= psys_new_settings("ParticleSettings", bmain);
ob= ptr.id.data;
if (psys->part)
psys->part->id.us--;
psys->part = part;
psys_check_boid_data(psys);
DAG_relations_tag_update(bmain);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
return OPERATOR_FINISHED;
}
示例8: add_driver_button_none
/* Wrapper for creating a driver without knowing what the targets will be yet (i.e. "manual/add later") */
static int add_driver_button_none(bContext *C, wmOperator *op, short mapping_type)
{
PointerRNA ptr = {{NULL}};
PropertyRNA *prop = NULL;
int index;
int success = 0;
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
if (mapping_type == CREATEDRIVER_MAPPING_NONE_ALL)
index = -1;
if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) {
char *path = BKE_animdata_driver_path_hack(C, &ptr, prop, NULL);
short flags = CREATEDRIVER_WITH_DEFAULT_DVAR;
if (path) {
success += ANIM_add_driver(op->reports, ptr.id.data, path, index, flags, DRIVER_TYPE_PYTHON);
MEM_freeN(path);
}
}
if (success) {
/* send updates */
UI_context_update_anim_flag(C);
DAG_relations_tag_update(CTX_data_main(C));
WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
示例9: state_del_exec
static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings);
ParticleSettings *part = ptr.data;
BoidState *state;
if (!part || part->phystype != PART_PHYS_BOIDS)
return OPERATOR_CANCELLED;
for (state=part->boids->states.first; state; state=state->next) {
if (state->flag & BOIDSTATE_CURRENT) {
BLI_remlink(&part->boids->states, state);
MEM_freeN(state);
break;
}
}
/* there must be at least one state */
if (!part->boids->states.first) {
state = boid_new_state(part->boids);
BLI_addtail(&part->boids->states, state);
}
else
state = part->boids->states.first;
state->flag |= BOIDSTATE_CURRENT;
DAG_relations_tag_update(bmain);
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
return OPERATOR_FINISHED;
}
示例10: BKE_pose_tag_recalc
/* Tag pose for recalc. Also tag all related data to be recalc. */
void BKE_pose_tag_recalc(Main *bmain, bPose *pose)
{
pose->flag |= POSE_RECALC;
/* Depsgraph components depends on actual pose state,
* if pose was changed depsgraph is to be updated as well.
*/
DAG_relations_tag_update(bmain);
}
示例11: rna_Depsgraph_debug_rebuild
static void rna_Depsgraph_debug_rebuild(Depsgraph *UNUSED(graph), Main *bmain)
{
Scene *sce;
DAG_relations_tag_update(bmain);
for (sce = bmain->scene.first; sce; sce = sce->id.next) {
DAG_scene_relations_rebuild(bmain, sce);
DEG_graph_on_visible_update(bmain, sce);
}
}
示例12: ED_rigidbody_object_remove
void ED_rigidbody_object_remove(Main *bmain, Scene *scene, Object *ob)
{
RigidBodyWorld *rbw = BKE_rigidbody_get_world(scene);
BKE_rigidbody_remove_object(scene, ob);
if (rbw)
BKE_group_object_unlink(rbw->group, ob, scene, NULL);
DAG_relations_tag_update(bmain);
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
示例13: shape_key_add_exec
static int shape_key_add_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_context(C);
const bool from_mix = RNA_boolean_get(op->ptr, "from_mix");
ED_object_shape_key_add(C, ob, from_mix);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
DAG_relations_tag_update(CTX_data_main(C));
return OPERATOR_FINISHED;
}
示例14: outliner_group_operation_exec
static int outliner_group_operation_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
SpaceOops *soops = CTX_wm_space_outliner(C);
int event;
/* check for invalid states */
if (soops == NULL)
return OPERATOR_CANCELLED;
event = RNA_enum_get(op->ptr, "type");
switch (event) {
case OL_GROUPOP_UNLINK:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_group_cb);
break;
case OL_GROUPOP_LOCAL:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb);
break;
case OL_GROUPOP_LINK:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_linkobs2scene_cb);
break;
case OL_GROUPOP_INSTANCE:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_instance_cb);
break;
case OL_GROUPOP_TOGVIS:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_visibility_cb);
break;
case OL_GROUPOP_TOGSEL:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_selectability_cb);
break;
case OL_GROUPOP_TOGREN:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_renderability_cb);
break;
case OL_GROUPOP_RENAME:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb);
break;
default:
BLI_assert(0);
}
if (event == 3) { /* instance */
/* works without this except if you try render right after, see: 22027 */
DAG_relations_tag_update(CTX_data_main(C));
}
ED_undo_push(C, prop_group_op_types[event - 1].name);
WM_event_add_notifier(C, NC_GROUP, NULL);
return OPERATOR_FINISHED;
}
示例15: objects_add_active_exec
static int objects_add_active_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_context(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
int single_group_index = RNA_enum_get(op->ptr, "group");
Group *single_group = group_object_active_find_index(ob, single_group_index);
Group *group;
bool is_cycle = false;
bool updated = false;
if (ob == NULL)
return OPERATOR_CANCELLED;
/* now add all selected objects to the group(s) */
for (group = bmain->group.first; group; group = group->id.next) {
if (single_group && group != single_group)
continue;
if (!BKE_group_object_exists(group, ob))
continue;
/* for recursive check */
BKE_main_id_tag_listbase(&bmain->group, true);
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
if (group_link_early_exit_check(group, base->object))
continue;
if (base->object->dup_group != group && !check_group_contains_object_recursive(group, base->object)) {
BKE_group_object_add(group, base->object, scene, base);
updated = true;
}
else {
is_cycle = true;
}
}
CTX_DATA_END;
}
if (is_cycle)
BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected");
if (!updated)
return OPERATOR_CANCELLED;
DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}