diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-12-09 18:24:55 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-12-09 18:24:55 +0300 |
commit | 6639ba6b867581ece49423f2c92651727fd4552f (patch) | |
tree | 7409467d03f9bb9cbae22003cd55a7c7edcb814d /source/blender/makesrna | |
parent | 8df3e7b54c52273b8698f2352b53ce1f79fe4b87 (diff) | |
parent | daf043b3fea6e8c8c3430d0055a8e3a721a0770a (diff) |
Sculpt Branch:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r25180:25245
Diffstat (limited to 'source/blender/makesrna')
45 files changed, 574 insertions, 389 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 263183cadd8..edbe55ba11d 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -38,6 +38,7 @@ struct bContext; struct ID; struct Main; struct ReportList; +struct Scene; /* Types */ @@ -649,6 +650,7 @@ int RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop); int RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_update(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop); +void RNA_property_update_main(struct Main *bmain, struct Scene *scene, PointerRNA *ptr, PropertyRNA *prop); /* Property Data */ diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 8743bb39d57..18fb2700bbf 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -166,6 +166,9 @@ typedef enum PropertyFlag { /* flag contains multiple enums */ PROP_ENUM_FLAG = 1<<21, + /* need context for update function */ + PROP_CONTEXT_UPDATE = 1<<22, + /* internal flags */ PROP_BUILTIN = 1<<7, PROP_EXPORT = 1<<8, diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 037b866edba..96953cefa2e 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1763,7 +1763,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr rna_print_c_string(f, prop->description); fprintf(f, ",\n\t"); fprintf(f, "%d,\n", prop->icon); fprintf(f, "\t%s, %s|%s, %s, %d, {%d, %d, %d}, %d,\n", rna_property_typename(prop->type), rna_property_subtypename(prop->subtype), rna_property_subtype_unit(prop->subtype), rna_function_string(prop->getlength), prop->arraydimension, prop->arraylength[0], prop->arraylength[1], prop->arraylength[2], prop->totarraylength); - fprintf(f, "\t%s, %d, %s, %s,\n", rna_function_string(prop->update), prop->noteflag, rna_function_string(prop->editable), rna_function_string(prop->itemeditable)); + fprintf(f, "\t%s%s, %d, %s, %s,\n", (prop->flag & PROP_CONTEXT_UPDATE)? "(UpdateFunc)": "", rna_function_string(prop->update), prop->noteflag, rna_function_string(prop->editable), rna_function_string(prop->itemeditable)); if(prop->flag & PROP_RAW_ACCESS) rna_set_raw_offset(f, srna, prop); else fprintf(f, "\t0, 0"); @@ -2050,11 +2050,13 @@ static void rna_generate(BlenderRNA *brna, FILE *f, char *filename, char *api_fi fprintf(f, "#include <stddef.h>\n\n"); fprintf(f, "#include \"DNA_ID.h\"\n"); + fprintf(f, "#include \"DNA_scene_types.h\"\n"); fprintf(f, "#include \"BLI_blenlib.h\"\n\n"); fprintf(f, "#include \"BKE_context.h\"\n"); fprintf(f, "#include \"BKE_library.h\"\n"); + fprintf(f, "#include \"BKE_main.h\"\n"); fprintf(f, "#include \"BKE_report.h\"\n"); fprintf(f, "#include \"BKE_utildefines.h\"\n\n"); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 360f43428d1..174cb13b0cd 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -29,6 +29,7 @@ #include "MEM_guardedalloc.h" #include "DNA_ID.h" +#include "DNA_scene_types.h" #include "DNA_windowmanager_types.h" #include "BLI_blenlib.h" @@ -37,6 +38,7 @@ #include "BKE_context.h" #include "BKE_idprop.h" +#include "BKE_main.h" #include "BKE_report.h" #include "BKE_utildefines.h" @@ -1103,23 +1105,41 @@ int RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop) return 0; } -void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop) +static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop) { int is_rna = (prop->magic == RNA_MAGIC); prop= rna_ensure_property(prop); if(is_rna) { - if(prop->update) - prop->update(C, ptr); + if(prop->update) { + /* ideally no context would be needed for update, but there's some + parts of the code that need it still, so we have this exception */ + if(prop->flag & PROP_CONTEXT_UPDATE) { + if(C) ((ContextUpdateFunc)prop->update)(C, ptr); + } + else + prop->update(bmain, scene, ptr); + } if(prop->noteflag) - WM_event_add_notifier(C, prop->noteflag, ptr->id.data); + WM_main_add_notifier(prop->noteflag, ptr->id.data); } else { /* WARNING! This is so property drivers update the display! * not especially nice */ DAG_id_flush_update(ptr->id.data, OB_RECALC_OB); - WM_event_add_notifier(C, NC_WINDOW, NULL); + WM_main_add_notifier(NC_WINDOW, NULL); } + +} + +void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop) +{ + rna_property_update(C, CTX_data_main(C), CTX_data_scene(C), ptr, prop); +} + +void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop) +{ + rna_property_update(NULL, bmain, scene, ptr, prop); } /* Property Data */ diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 3708d810cca..0568652488d 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -144,13 +144,13 @@ static void rna_def_dopesheet(BlenderRNA *brna) prop= RNA_def_property(srna, "include_missing_nla", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NLA_NOACT); - RNA_def_property_ui_text(prop, "Include Missing NLA", "Include Animation Data blocks with no NLA Data."); + RNA_def_property_ui_text(prop, "Include Missing NLA", "Include Animation Data blocks with no NLA data. (NLA Editor only)"); RNA_def_property_ui_icon(prop, ICON_ACTION, 0); RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL); prop= RNA_def_property(srna, "collapse_summary", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ADS_FLAG_SUMMARY_COLLAPSED); - RNA_def_property_ui_text(prop, "Collapse Summary", "Collapse summary when shown, so all other channels get hidden."); + RNA_def_property_ui_text(prop, "Collapse Summary", "Collapse summary when shown, so all other channels get hidden. (DopeSheet Window Editors Only)"); RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL); } diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 371f14be753..4859f23967f 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -46,14 +46,15 @@ #include "BKE_main.h" #include "ED_armature.h" +#include "BKE_armature.h" -static void rna_Armature_update_data(bContext *C, PointerRNA *ptr) +static void rna_Armature_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) { ID *id= ptr->id.data; DAG_id_flush_update(id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, id); - //WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); + WM_main_add_notifier(NC_GEOM|ND_DATA, id); + //WM_main_add_notifier(NC_OBJECT|ND_POSE, NULL); } @@ -103,11 +104,11 @@ void rna_Armature_edit_bone_remove(bArmature *arm, EditBone *ebone) ED_armature_edit_bone_remove(arm, ebone); } -static void rna_Armature_redraw_data(bContext *C, PointerRNA *ptr) +static void rna_Armature_redraw_data(Main *bmain, Scene *scene, PointerRNA *ptr) { ID *id= ptr->id.data; - WM_event_add_notifier(C, NC_GEOM|ND_DATA, id); + WM_main_add_notifier(NC_GEOM|ND_DATA, id); } static char *rna_Bone_path(PointerRNA *ptr) @@ -279,10 +280,6 @@ static void rna_EditBone_parent_set(PointerRNA *ptr, PointerRNA value) EditBone *ebone= (EditBone*)(ptr->data); EditBone *pbone, *parbone= (EditBone*)value.data; - /* within same armature */ - if(value.id.data != ptr->id.data) - return; - if(parbone == NULL) { if(ebone->parent && !(ebone->parent->flag & BONE_ROOTSEL)) ebone->parent->flag &= ~BONE_TIPSEL; @@ -291,6 +288,10 @@ static void rna_EditBone_parent_set(PointerRNA *ptr, PointerRNA value) ebone->flag &= ~BONE_CONNECTED; } else { + /* within same armature */ + if(value.id.data != ptr->id.data) + return; + /* make sure this is a valid child */ if(parbone == ebone) return; @@ -304,7 +305,22 @@ static void rna_EditBone_parent_set(PointerRNA *ptr, PointerRNA value) } } -static void rna_Armature_editbone_transform_update(bContext *C, PointerRNA *ptr) +static void rna_EditBone_matrix_get(PointerRNA *ptr, float *values) +{ + EditBone *ebone= (EditBone*)(ptr->data); + + float delta[3], tmat[3][3], mat[4][4]; + + /* Find the current bone matrix */ + sub_v3_v3v3(delta, ebone->tail, ebone->head); + vec_roll_to_mat3(delta, ebone->roll, tmat); + copy_m4_m3(mat, tmat); + VECCOPY(mat[3], ebone->head); + + memcpy(values, mat, 16 * sizeof(float)); +} + +static void rna_Armature_editbone_transform_update(Main *bmain, Scene *scene, PointerRNA *ptr) { bArmature *arm= (bArmature*)ptr->id.data; EditBone *ebone= (EditBone*)ptr->data; @@ -339,7 +355,7 @@ static void rna_Armature_editbone_transform_update(bContext *C, PointerRNA *ptr) } } - rna_Armature_update_data(C, ptr); + rna_Armature_update_data(bmain, scene, ptr); } static void rna_Armature_bones_next(CollectionPropertyIterator *iter) @@ -618,6 +634,14 @@ static void rna_def_edit_bone(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Tail Selected", ""); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); + /* calculated and read only, not actual data access */ + prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX); + //RNA_def_property_float_sdna(prop, NULL, ""); // doesnt access any real data + RNA_def_property_array(prop, 16); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Editbone Matrix", "Read-only matrix calculated from the roll (armature space)."); + RNA_def_property_float_funcs(prop, "rna_EditBone_matrix_get", NULL, NULL); // TODO - this could be made writable also + RNA_api_armature_edit_bone(srna); RNA_define_verify_sdna(1); diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 37b957a16ca..01d8a4db498 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -72,7 +72,7 @@ EnumPropertyItem boidruleset_type_items[] ={ #include "BKE_depsgraph.h" #include "BKE_particle.h" -static void rna_Boids_reset(bContext *C, PointerRNA *ptr) +static void rna_Boids_reset(Main *bmain, Scene *scene, PointerRNA *ptr) { if(ptr->type==&RNA_ParticleSystem) { ParticleSystem *psys = (ParticleSystem*)ptr->data; @@ -84,12 +84,10 @@ static void rna_Boids_reset(bContext *C, PointerRNA *ptr) else DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET); - WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL); + WM_main_add_notifier(NC_OBJECT|ND_PARTICLE_DATA, NULL); } -static void rna_Boids_reset_deps(bContext *C, PointerRNA *ptr) +static void rna_Boids_reset_deps(Main *bmain, Scene *scene, PointerRNA *ptr) { - Scene *scene = CTX_data_scene(C); - if(ptr->type==&RNA_ParticleSystem) { ParticleSystem *psys = (ParticleSystem*)ptr->data; @@ -102,7 +100,7 @@ static void rna_Boids_reset_deps(bContext *C, PointerRNA *ptr) DAG_scene_sort(scene); - WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL); + WM_main_add_notifier(NC_OBJECT|ND_PARTICLE_DATA, NULL); } static StructRNA* rna_BoidRule_refine(struct PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 417750189fc..7f7126c659a 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -76,10 +76,10 @@ static void rna_Brush_active_texture_set(PointerRNA *ptr, PointerRNA value) set_current_brush_texture(br, value.data); } -static void rna_Brush_update(bContext *C, PointerRNA *ptr) +static void rna_Brush_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Brush *br= (Brush*)ptr->data; - WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, br); + WM_main_add_notifier(NC_BRUSH|NA_EDITED, br); } static float rna_BrushTextureSlot_angle_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 6254041c7ef..1715df1809a 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -37,13 +37,13 @@ #ifdef RNA_RUNTIME -static void rna_Camera_angle_update(bContext *C, PointerRNA *ptr) +static void rna_Camera_angle_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Camera *cam= (Camera*)ptr->id.data; cam->lens = 16.0f / tan(M_PI*cam->angle/360.0f); } -static void rna_Camera_lens_update(bContext *C, PointerRNA *ptr) +static void rna_Camera_lens_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Camera *cam= (Camera*)ptr->id.data; cam->angle= 360.0f * atan(16.0f/cam->lens) / M_PI; diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index 0e298c1f6be..c416db2a21c 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -45,15 +45,15 @@ #include "BKE_context.h" #include "BKE_depsgraph.h" -static void rna_cloth_update(bContext *C, PointerRNA *ptr) +static void rna_cloth_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob); } -static void rna_cloth_reset(bContext *C, PointerRNA *ptr) +static void rna_cloth_reset(Main *bmain, Scene *scene, PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; ClothSimSettings *settings = (ClothSimSettings*)ptr->data; @@ -61,7 +61,7 @@ static void rna_cloth_reset(bContext *C, PointerRNA *ptr) settings->reset = 1; DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob); } diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 226554f9ee6..f9405dec531 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -198,24 +198,24 @@ static char *rna_Constraint_path(PointerRNA *ptr) return BLI_sprintfN("constraints[\"%s\"]", con->name); } -static void rna_Constraint_update(bContext *C, PointerRNA *ptr) +static void rna_Constraint_update(Main *bmain, Scene *scene, PointerRNA *ptr) { ED_object_constraint_update(ptr->id.data); } -static void rna_Constraint_dependency_update(bContext *C, PointerRNA *ptr) +static void rna_Constraint_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - ED_object_constraint_dependency_update(CTX_data_scene(C), ptr->id.data); + ED_object_constraint_dependency_update(scene, ptr->id.data); } -static void rna_Constraint_influence_update(bContext *C, PointerRNA *ptr) +static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Object *ob= ptr->id.data; if(ob->pose) ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); - rna_Constraint_update(C, ptr); + rna_Constraint_update(bmain, scene, ptr); } static void rna_Constraint_ik_type_set(struct PointerRNA *ptr, int value) diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index faef93247d9..d3a56661813 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -215,21 +215,21 @@ static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA rna_iterator_array_begin(iter, (void*)nu->bp, sizeof(BPoint), nu->pntsv>0 ? nu->pntsu*nu->pntsv : nu->pntsu, 0, NULL); } -static void rna_Curve_update_data(bContext *C, PointerRNA *ptr) +static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) { ID *id= ptr->id.data; DAG_id_flush_update(id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, id); + WM_main_add_notifier(NC_GEOM|ND_DATA, id); } -static void rna_Curve_update_deps(bContext *C, PointerRNA *ptr) +static void rna_Curve_update_deps(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_scene_sort(CTX_data_scene(C)); - rna_Curve_update_data(C, ptr); + DAG_scene_sort(scene); + rna_Curve_update_data(bmain, scene, ptr); } -static void rna_Curve_resolution_u_update_data(bContext *C, PointerRNA *ptr) +static void rna_Curve_resolution_u_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) { Curve *cu= (Curve*)ptr->id.data; Nurb *nu=NULL; @@ -242,10 +242,10 @@ static void rna_Curve_resolution_u_update_data(bContext *C, PointerRNA *ptr) nu= nu->next; } - rna_Curve_update_data(C, ptr); + rna_Curve_update_data(bmain, scene, ptr); } -static void rna_Curve_resolution_v_update_data(bContext *C, PointerRNA *ptr) +static void rna_Curve_resolution_v_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) { Curve *cu= (Curve*)ptr->id.data; Nurb *nu=NULL; @@ -258,7 +258,7 @@ static void rna_Curve_resolution_v_update_data(bContext *C, PointerRNA *ptr) nu= nu->next; } - rna_Curve_update_data(C, ptr); + rna_Curve_update_data(bmain, scene, ptr); } /* name functions that ignore the first two ID characters */ @@ -293,34 +293,34 @@ void rna_Curve_body_set(PointerRNA *ptr, const char *value) BLI_strncpy(cu->str, value, len+1); } -static void rna_Nurb_update_handle_data(bContext *C, PointerRNA *ptr) +static void rna_Nurb_update_handle_data(Main *bmain, Scene *scene, PointerRNA *ptr) { Nurb *nu= (Nurb*)ptr->data; if(nu->type == CU_BEZIER) calchandlesNurb(nu); - rna_Curve_update_data(C, ptr); + rna_Curve_update_data(bmain, scene, ptr); } -static void rna_Nurb_update_knot_u(bContext *C, PointerRNA *ptr) +static void rna_Nurb_update_knot_u(Main *bmain, Scene *scene, PointerRNA *ptr) { Nurb *nu= (Nurb*)ptr->data; clamp_nurb_order_u(nu); makeknots(nu, 1); - rna_Curve_update_data(C, ptr); + rna_Curve_update_data(bmain, scene, ptr); } -static void rna_Nurb_update_knot_v(bContext *C, PointerRNA *ptr) +static void rna_Nurb_update_knot_v(Main *bmain, Scene *scene, PointerRNA *ptr) { Nurb *nu= (Nurb*)ptr->data; clamp_nurb_order_v(nu); makeknots(nu, 2); - rna_Curve_update_data(C, ptr); + rna_Curve_update_data(bmain, scene, ptr); } #else diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index fbf4a8b41c5..23cd4b2c892 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -91,7 +91,7 @@ static StructRNA *rna_FModifierType_refine(struct PointerRNA *ptr) #include "BKE_depsgraph.h" #include "BKE_animsys.h" -static void rna_ChannelDriver_update_data(bContext *C, PointerRNA *ptr) +static void rna_ChannelDriver_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) { ID *id= ptr->id.data; ChannelDriver *driver= ptr->data; @@ -99,13 +99,20 @@ static void rna_ChannelDriver_update_data(bContext *C, PointerRNA *ptr) driver->flag &= ~DRIVER_FLAG_INVALID; // TODO: this really needs an update guard... - DAG_scene_sort(CTX_data_scene(C)); + DAG_scene_sort(scene); DAG_id_flush_update(id, OB_RECALC_OB|OB_RECALC_DATA); - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, CTX_data_scene(C)); + WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); } -static void rna_DriverTarget_update_data(bContext *C, PointerRNA *ptr) +static void rna_ChannelDriver_update_expr(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + ChannelDriver *driver= ptr->data; + driver->flag |= DRIVER_FLAG_RECOMPILE; + rna_ChannelDriver_update_data(bmain, scene, ptr); +} + +static void rna_DriverTarget_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) { PointerRNA driverptr; ChannelDriver *driver; @@ -118,7 +125,7 @@ static void rna_DriverTarget_update_data(bContext *C, PointerRNA *ptr) if(driver && BLI_findindex(&driver->targets, ptr->data) != -1) { RNA_pointer_create(ptr->id.data, &RNA_Driver, driver, &driverptr); - rna_ChannelDriver_update_data(C, &driverptr); + rna_ChannelDriver_update_data(bmain, scene, &driverptr); return; } } @@ -260,7 +267,7 @@ static void rna_FModifier_active_set(PointerRNA *ptr, int value) fm->flag |= FMODIFIER_FLAG_ACTIVE; } -static void rna_FModifier_active_update(bContext *C, PointerRNA *ptr) +static void rna_FModifier_active_update(Main *bmain, Scene *scene, PointerRNA *ptr) { FModifier *fm, *fmo= (FModifier*)ptr->data; @@ -789,6 +796,7 @@ static void rna_def_channeldriver(BlenderRNA *brna) static EnumPropertyItem prop_type_items[] = { {DRIVER_TYPE_AVERAGE, "AVERAGE", 0, "Averaged Value", ""}, + {DRIVER_TYPE_SUM, "SUM", 0, "Sum Values", ""}, {DRIVER_TYPE_PYTHON, "SCRIPTED", 0, "Scripted Expression", ""}, {DRIVER_TYPE_ROTDIFF, "ROTDIFF", 0, "Rotational Difference", ""}, {0, NULL, 0, NULL, NULL}}; @@ -806,7 +814,7 @@ static void rna_def_channeldriver(BlenderRNA *brna) /* String values */ prop= RNA_def_property(srna, "expression", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Expression", "Expression to use for Scripted Expression."); - RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); + RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_expr"); /* Collections */ prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index 2517ee5c8ef..682eebddbbe 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -72,17 +72,16 @@ static StructRNA* rna_FluidSettings_refine(struct PointerRNA *ptr) } } -static void rna_fluid_update(bContext *C, PointerRNA *ptr) +static void rna_fluid_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Object *ob= ptr->id.data; DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob); } -static void rna_FluidSettings_update_type(bContext *C, PointerRNA *ptr) +static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA *ptr) { - Main *bmain= CTX_data_main(C); Object *ob= (Object*)ptr->id.data; FluidsimModifierData *fluidmd; ParticleSystemModifierData *psmd; @@ -132,7 +131,7 @@ static void rna_FluidSettings_update_type(bContext *C, PointerRNA *ptr) } } - rna_fluid_update(C, ptr); + rna_fluid_update(bmain, scene, ptr); } static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *value) diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c index f13eb4fedc1..528d2eb0b3d 100644 --- a/source/blender/makesrna/intern/rna_group.c +++ b/source/blender/makesrna/intern/rna_group.c @@ -56,7 +56,7 @@ static void rna_Group_objects_link(Group *group, bContext *C, ReportList *report return; } - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, &object->id); + WM_main_add_notifier(NC_OBJECT|ND_DRAW, &object->id); } static void rna_Group_objects_unlink(Group *group, bContext *C, ReportList *reports, Object *object) @@ -66,7 +66,7 @@ static void rna_Group_objects_unlink(Group *group, bContext *C, ReportList *repo return; } - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, &object->id); + WM_main_add_notifier(NC_OBJECT|ND_DRAW, &object->id); } #else diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 44c55e821a9..e0d8a6950de 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -49,7 +49,7 @@ static EnumPropertyItem image_source_items[]= { #include "IMB_imbuf_types.h" -static void rna_Image_animated_update(bContext *C, PointerRNA *ptr) +static void rna_Image_animated_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Image *ima= (Image*)ptr->data; int nr; @@ -74,13 +74,13 @@ static int rna_Image_dirty_get(PointerRNA *ptr) return 0; } -static void rna_Image_source_update(bContext *C, PointerRNA *ptr) +static void rna_Image_source_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Image *ima= ptr->id.data; BKE_image_signal(ima, NULL, IMA_SIGNAL_SRC_CHANGE); } -static void rna_Image_fields_update(bContext *C, PointerRNA *ptr) +static void rna_Image_fields_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Image *ima= ptr->id.data; ImBuf *ibuf; @@ -101,22 +101,21 @@ static void rna_Image_fields_update(bContext *C, PointerRNA *ptr) BKE_image_release_ibuf(ima, lock); } -static void rna_Image_reload_update(bContext *C, PointerRNA *ptr) +static void rna_Image_reload_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Image *ima= ptr->id.data; BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD); printf("reload %p\n", ima); } -static void rna_Image_generated_update(bContext *C, PointerRNA *ptr) +static void rna_Image_generated_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Image *ima= ptr->id.data; BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE); } -static void rna_ImageUser_update(bContext *C, PointerRNA *ptr) +static void rna_ImageUser_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - Scene *scene= CTX_data_scene(C); ImageUser *iuser= ptr->data; BKE_image_user_calc_imanr(iuser, scene->r.cfra, 0); diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 52945b67275..df1dd249dd1 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -194,10 +194,10 @@ void rna_object_vgroup_name_set(struct PointerRNA *ptr, const char *value, char void rna_object_uvlayer_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen); void rna_object_vcollayer_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen); -void rna_Object_update(struct bContext *C, struct PointerRNA *ptr); -void rna_Object_update_data(struct bContext *C, struct PointerRNA *ptr); -void rna_Mesh_update_draw(struct bContext *C, struct PointerRNA *ptr); -void rna_TextureSlot_update(struct bContext *C, struct PointerRNA *ptr); +void rna_Object_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr); +void rna_Object_update_data(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr); +void rna_Mesh_update_draw(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr); +void rna_TextureSlot_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr); char *rna_TextureSlot_path(struct PointerRNA *ptr); diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index 8a35f831c96..4f05e6132f7 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -38,6 +38,8 @@ struct CollectionPropertyIterator; struct bContext; struct IDProperty; struct GHash; +struct Main; +struct Scene; #ifdef UNIT_TEST #define RNA_MAX_ARRAY_LENGTH 64 @@ -53,7 +55,8 @@ struct GHash; /* Function Callbacks */ -typedef void (*UpdateFunc)(struct bContext *C, struct PointerRNA *ptr); +typedef void (*UpdateFunc)(struct Main *main, struct Scene *scene, struct PointerRNA *ptr); +typedef void (*ContextUpdateFunc)(struct bContext *C, struct PointerRNA *ptr); typedef int (*EditableFunc)(struct PointerRNA *ptr); typedef int (*ItemEditableFunc)(struct PointerRNA *ptr, int index); typedef struct IDProperty* (*IDPropertiesFunc)(struct PointerRNA *ptr, int create); diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index 49dd96241cd..9e560a50af0 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -286,16 +286,15 @@ static char *rna_ShapeKey_path(PointerRNA *ptr) return BLI_sprintfN("keys[\"%s\"]", ((KeyBlock*)ptr->data)->name); } -static void rna_Key_update_data(bContext *C, PointerRNA *ptr) +static void rna_Key_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) { - Main *bmain= CTX_data_main(C); Key *key= ptr->id.data; Object *ob; for(ob=bmain->object.first; ob; ob= ob->id.next) { if(ob_get_key(ob) == key) { DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob); } } } diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index a518bd28d24..5112e68a008 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -100,28 +100,28 @@ static StructRNA* rna_Lamp_refine(struct PointerRNA *ptr) } } -static void rna_Lamp_update(bContext *C, PointerRNA *ptr) +static void rna_Lamp_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Lamp *la= ptr->id.data; DAG_id_flush_update(&la->id, 0); - WM_event_add_notifier(C, NC_LAMP|ND_LIGHTING, la); + WM_main_add_notifier(NC_LAMP|ND_LIGHTING, la); } -static void rna_Lamp_draw_update(bContext *C, PointerRNA *ptr) +static void rna_Lamp_draw_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Lamp *la= ptr->id.data; DAG_id_flush_update(&la->id, 0); - WM_event_add_notifier(C, NC_LAMP|ND_LIGHTING_DRAW, la); + WM_main_add_notifier(NC_LAMP|ND_LIGHTING_DRAW, la); } -static void rna_Lamp_sky_update(bContext *C, PointerRNA *ptr) +static void rna_Lamp_sky_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Lamp *la= ptr->id.data; DAG_id_flush_update(&la->id, 0); - WM_event_add_notifier(C, NC_LAMP|ND_SKY, la); + WM_main_add_notifier(NC_LAMP|ND_SKY, la); } #else diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index aff38ebdd74..f46ea13ba2e 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -87,17 +87,16 @@ static void rna_Lattice_points_begin(CollectionPropertyIterator *iter, PointerRN rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL); } -static void rna_Lattice_update_data(bContext *C, PointerRNA *ptr) +static void rna_Lattice_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) { ID *id= ptr->id.data; DAG_id_flush_update(id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, id); + WM_main_add_notifier(NC_GEOM|ND_DATA, id); } -static void rna_Lattice_update_size(bContext *C, PointerRNA *ptr) +static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr) { - Main *bmain= CTX_data_main(C); Lattice *lt= ptr->id.data; Object *ob; int newu, newv, neww; @@ -124,7 +123,7 @@ static void rna_Lattice_update_size(bContext *C, PointerRNA *ptr) resizelattice(lt->editlatt, newu, newv, neww, NULL); } - rna_Lattice_update_data(C, ptr); + rna_Lattice_update_data(bmain, scene, ptr); } static void rna_Lattice_outside_set(PointerRNA *ptr, int value) diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 70dab957fb9..5069bbd6ae6 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -50,41 +50,41 @@ #include "DNA_mesh_types.h" #include "DNA_object_types.h" -static Mesh *rna_Main_add_mesh(Main *main, char *name) +static Mesh *rna_Main_add_mesh(Main *bmain, char *name) { Mesh *me= add_mesh(name); me->id.us--; return me; } -static void rna_Main_remove_mesh(Main *main, ReportList *reports, Mesh *me) +static void rna_Main_remove_mesh(Main *bmain, ReportList *reports, Mesh *me) { if(me->id.us == 0) - free_libblock(&main->mesh, me); + free_libblock(&bmain->mesh, me); else BKE_report(reports, RPT_ERROR, "Mesh must have zero users to be removed."); /* XXX python now has invalid pointer? */ } -static void rna_Main_remove_armature(Main *main, ReportList *reports, bArmature *arm) +static void rna_Main_remove_armature(Main *bmain, ReportList *reports, bArmature *arm) { if(arm->id.us == 0) - free_libblock(&main->armature, arm); + free_libblock(&bmain->armature, arm); else BKE_report(reports, RPT_ERROR, "Armature must have zero users to be removed."); /* XXX python now has invalid pointer? */ } -static bArmature *rna_Main_add_armature(Main *main, char *name) +static bArmature *rna_Main_add_armature(Main *bmain, char *name) { bArmature *arm= add_armature(name); arm->id.us--; return arm; } -static Lamp *rna_Main_add_lamp(Main *main, char *name) +static Lamp *rna_Main_add_lamp(Main *bmain, char *name) { Lamp *la= add_lamp(name); la->id.us--; @@ -92,7 +92,7 @@ static Lamp *rna_Main_add_lamp(Main *main, char *name) } /* -static void rna_Main_remove_lamp(Main *main, ReportList *reports, Lamp *la) +static void rna_Main_remove_lamp(Main *bmain, ReportList *reports, Lamp *la) { if(la->id.us == 0) free_libblock(&main->lamp, la); @@ -101,7 +101,7 @@ static void rna_Main_remove_lamp(Main *main, ReportList *reports, Lamp *la) } */ -static Object* rna_Main_add_object(Main *main, int type, char *name) +static Object* rna_Main_add_object(Main *bmain, int type, char *name) { Object *ob= add_only_object(type, name); ob->id.us--; @@ -120,29 +120,29 @@ static Object* rna_Main_add_object(Main *main, int type, char *name) # don't do this since ob is already freed! bpy.data.remove_object(ob) */ -static void rna_Main_remove_object(Main *main, ReportList *reports, Object *ob) +static void rna_Main_remove_object(Main *bmain, ReportList *reports, Object *ob) { if(ob->id.us == 0) - free_libblock(&main->object, ob); + free_libblock(&bmain->object, ob); else BKE_report(reports, RPT_ERROR, "Object must have zero users to be removed."); } -static Material *rna_Main_add_material(Main *main, char *name) +static Material *rna_Main_add_material(Main *bmain, char *name) { return add_material(name); } /* TODO: remove material? */ -struct Tex *rna_Main_add_texture(Main *main, char *name) +struct Tex *rna_Main_add_texture(Main *bmain, char *name) { return add_texture(name); } /* TODO: remove texture? */ -struct Image *rna_Main_add_image(Main *main, char *filename) +struct Image *rna_Main_add_image(Main *bmain, char *filename) { return BKE_add_image_file(filename, 0); } diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 85007482dc4..a5c1d8d5f57 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -64,20 +64,20 @@ static EnumPropertyItem prop_texture_coordinates_items[] = { #include "ED_node.h" -static void rna_Material_update(bContext *C, PointerRNA *ptr) +static void rna_Material_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Material *ma= ptr->id.data; DAG_id_flush_update(&ma->id, 0); - WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, ma); + WM_main_add_notifier(NC_MATERIAL|ND_SHADING, ma); } -static void rna_Material_draw_update(bContext *C, PointerRNA *ptr) +static void rna_Material_draw_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Material *ma= ptr->id.data; DAG_id_flush_update(&ma->id, 0); - WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING_DRAW, ma); + WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, ma); } static PointerRNA rna_Material_mirror_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index bacd7fc2b72..355314f5c92 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -50,26 +50,26 @@ #include "WM_api.h" #include "WM_types.h" -static void rna_Mesh_update_data(bContext *C, PointerRNA *ptr) +static void rna_Mesh_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) { ID *id= ptr->id.data; DAG_id_flush_update(id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, id); + WM_main_add_notifier(NC_GEOM|ND_DATA, id); } -static void rna_Mesh_update_select(bContext *C, PointerRNA *ptr) +static void rna_Mesh_update_select(Main *bmain, Scene *scene, PointerRNA *ptr) { ID *id= ptr->id.data; - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, id); + WM_main_add_notifier(NC_GEOM|ND_SELECT, id); } -void rna_Mesh_update_draw(bContext *C, PointerRNA *ptr) +void rna_Mesh_update_draw(Main *bmain, Scene *scene, PointerRNA *ptr) { ID *id= ptr->id.data; - WM_event_add_notifier(C, NC_GEOM|ND_DATA, id); + WM_main_add_notifier(NC_GEOM|ND_DATA, id); } static void rna_MeshVertex_normal_get(PointerRNA *ptr, float *value) diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index 62466047ef4..b7cd40b2efd 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -50,10 +50,8 @@ static int rna_Meta_texspace_editable(PointerRNA *ptr) return (mb->texflag & AUTOSPACE)? 0: PROP_EDITABLE; } -static void rna_MetaBall_update_data(bContext *C, PointerRNA *ptr) +static void rna_MetaBall_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) { - Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); MetaBall *mb= ptr->id.data; Object *ob; @@ -62,11 +60,9 @@ static void rna_MetaBall_update_data(bContext *C, PointerRNA *ptr) copy_mball_properties(scene, ob); DAG_id_flush_update(&mb->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, mb); + WM_main_add_notifier(NC_GEOM|ND_DATA, mb); } - - #else static void rna_def_metaelement(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index cefaf2d7535..ae02489537f 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -193,19 +193,19 @@ static char *rna_Modifier_path(PointerRNA *ptr) return BLI_sprintfN("modifiers[\"%s\"]", ((ModifierData*)ptr->data)->name); } -static void rna_Modifier_update(bContext *C, PointerRNA *ptr) +static void rna_Modifier_update(Main *bmain, Scene *scene, PointerRNA *ptr) { DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ptr->id.data); + WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ptr->id.data); } -static void rna_Modifier_dependency_update(bContext *C, PointerRNA *ptr) +static void rna_Modifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - rna_Modifier_update(C, ptr); - DAG_scene_sort(CTX_data_scene(C)); + rna_Modifier_update(bmain, scene, ptr); + DAG_scene_sort(scene); } -static void rna_Smoke_set_type(bContext *C, PointerRNA *ptr) +static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr) { SmokeModifierData *smd= (SmokeModifierData *)ptr->data; Object *ob= (Object*)ptr->id.data; @@ -230,7 +230,7 @@ static void rna_Smoke_set_type(bContext *C, PointerRNA *ptr) } // update dependancy since a domain - other type switch could have happened - rna_Modifier_dependency_update(C, ptr); + rna_Modifier_dependency_update(bmain, scene, ptr); } static void rna_ExplodeModifier_vgroup_get(PointerRNA *ptr, char *value) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 1aec395b43f..d1e73d6add3 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -149,9 +149,8 @@ static void rna_Matte_t2_set(PointerRNA *ptr, float value) chroma->t2 = value; } -static void node_update(bContext *C, bNodeTree *ntree, bNode *node) +static void node_update(Main *bmain, Scene *scene, bNodeTree *ntree, bNode *node) { - Main *bmain= CTX_data_main(C); Material *ma; Tex *tex; Scene *sce; @@ -170,15 +169,15 @@ static void node_update(bContext *C, bNodeTree *ntree, bNode *node) ED_node_changed_update(&sce->id, node); } -static void rna_Node_update(bContext *C, PointerRNA *ptr) +static void rna_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr) { bNodeTree *ntree= (bNodeTree*)ptr->id.data; bNode *node= (bNode*)ptr->data; - node_update(C, ntree, node); + node_update(bmain, scene, ntree, node); } -static void rna_Node_update_name(bContext *C, PointerRNA *ptr) +static void rna_Node_update_name(Main *bmain, Scene *scene, PointerRNA *ptr) { bNodeTree *ntree= (bNodeTree*)ptr->id.data; bNode *node= (bNode*)ptr->data; @@ -193,12 +192,12 @@ static void rna_Node_update_name(bContext *C, PointerRNA *ptr) /* fix all the animation data which may link to this */ BKE_all_animdata_fix_paths_rename("nodes", oldname, node->name); - node_update(C, ntree, node); + node_update(bmain, scene, ntree, node); } /* this should be done at display time! if no custom names are set */ #if 0 -static void rna_Node_update_username(bContext *C, PointerRNA *ptr) +static void rna_Node_update_username(Main *bmain, Scene *scene, PointerRNA *ptr) { bNode *node= (bNode*)ptr->data; const char *name; @@ -241,18 +240,18 @@ static void rna_Node_update_username(bContext *C, PointerRNA *ptr) } } - rna_Node_update(C, ptr); + rna_Node_update(bmain, scene, ptr); } #endif -static void rna_NodeSocket_update(bContext *C, PointerRNA *ptr) +static void rna_NodeSocket_update(Main *bmain, Scene *scene, PointerRNA *ptr) { bNodeTree *ntree= (bNodeTree*)ptr->id.data; bNodeSocket *sock= (bNodeSocket*)ptr->data; bNode *node; if (nodeFindNode(ntree, sock, &node, NULL)) - node_update(C, ntree, node); + node_update(bmain, scene, ntree, node); } static void rna_NodeSocket_defvalue_range(PointerRNA *ptr, float *min, float *max) @@ -263,16 +262,16 @@ static void rna_NodeSocket_defvalue_range(PointerRNA *ptr, float *min, float *ma *max = sock->ns.max; } -static void rna_Node_mapping_update(bContext *C, PointerRNA *ptr) +static void rna_Node_mapping_update(Main *bmain, Scene *scene, PointerRNA *ptr) { bNode *node= (bNode*)ptr->data; init_mapping((TexMapping *)node->storage); - rna_Node_update(C, ptr); + rna_Node_update(bmain, scene, ptr); } -static void rna_Node_image_layer_update(bContext *C, PointerRNA *ptr) +static void rna_Node_image_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) { bNode *node= (bNode*)ptr->data; Image *ima = (Image *)node->id; @@ -281,7 +280,7 @@ static void rna_Node_image_layer_update(bContext *C, PointerRNA *ptr) BKE_image_multilayer_index(ima->rr, iuser); BKE_image_signal(ima, iuser, IMA_SIGNAL_SRC_CHANGE); - rna_Node_update(C, ptr); + rna_Node_update(bmain, scene, ptr); } static EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index a630e912b1b..31358a38993 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -114,56 +114,56 @@ EnumPropertyItem object_type_items[] = { #include "BLI_editVert.h" /* for EditMesh->mat_nr */ +#include "ED_mesh.h" #include "ED_object.h" #include "ED_particle.h" -void rna_Object_update(bContext *C, PointerRNA *ptr) +void rna_Object_update(Main *bmain, Scene *scene, PointerRNA *ptr) { DAG_id_flush_update(ptr->id.data, OB_RECALC_OB); } -void rna_Object_matrix_update(bContext *C, PointerRNA *ptr) +void rna_Object_matrix_update(Main *bmain, Scene *scene, PointerRNA *ptr) { ED_object_apply_obmat(ptr->id.data); - rna_Object_update(C, ptr); + rna_Object_update(bmain, scene, ptr); } -void rna_Object_update_data(bContext *C, PointerRNA *ptr) +void rna_Object_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) { DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ptr->id.data); + WM_main_add_notifier(NC_OBJECT|ND_DRAW, ptr->id.data); } -void rna_Object_active_shape_update(bContext *C, PointerRNA *ptr) +void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Object *ob= ptr->id.data; - Scene *scene= CTX_data_scene(C); int editmode= (scene->obedit == ob && ob->type == OB_MESH); if(editmode) { /* exit/enter editmode to get new shape */ - ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO); - ED_object_enter_editmode(C, EM_WAITCURSOR); + load_editMesh(scene, ob); + make_editMesh(scene, ob); } - rna_Object_update_data(C, ptr); + rna_Object_update_data(bmain, scene, ptr); } -static void rna_Object_dependency_update(bContext *C, PointerRNA *ptr) +static void rna_Object_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { DAG_id_flush_update(ptr->id.data, OB_RECALC_OB); - DAG_scene_sort(CTX_data_scene(C)); + DAG_scene_sort(scene); } /* when changing the selection flag the scene needs updating */ -static void rna_Object_select_update(bContext *C, PointerRNA *ptr) +static void rna_Object_select_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; short mode = ob->flag & SELECT ? BA_SELECT : BA_DESELECT; - ED_base_object_select(object_in_scene(ob, CTX_data_scene(C)), mode); + ED_base_object_select(object_in_scene(ob, scene), mode); } -static void rna_Base_select_update(bContext *C, PointerRNA *ptr) +static void rna_Base_select_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Base *base= (Base*)ptr->data; short mode = base->flag & BA_SELECT ? BA_SELECT : BA_DESELECT; @@ -182,10 +182,9 @@ static void rna_Object_layer_update__internal(Scene *scene, Base *base, Object * } } -static void rna_Object_layer_update(bContext *C, PointerRNA *ptr) +static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; - Scene *scene= CTX_data_scene(C); Base *base; base= object_in_scene(ob, scene); @@ -196,11 +195,10 @@ static void rna_Object_layer_update(bContext *C, PointerRNA *ptr) rna_Object_layer_update__internal(scene, base, ob); } -static void rna_Base_layer_update(bContext *C, PointerRNA *ptr) +static void rna_Base_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Base *base= (Base*)ptr->id.data; Object *ob= (Object*)base->object; - Scene *scene= CTX_data_scene(C); ob->lay= base->lay; @@ -527,9 +525,8 @@ static void rna_Object_active_particle_system_index_set(PointerRNA *ptr, int val psys_set_current_num(ob, value); } -static void rna_Object_particle_update(bContext *C, PointerRNA *ptr) +static void rna_Object_particle_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - Scene *scene= CTX_data_scene(C); Object *ob= (Object*)ptr->id.data; PE_current_changed(scene, ob); @@ -972,7 +969,7 @@ static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value) static bConstraint *rna_Object_constraint_new(Object *object, bContext *C, int type) { - WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object); + WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object); return add_ob_constraint(object, NULL, type); } @@ -981,7 +978,7 @@ static int rna_Object_constraint_remove(Object *object, bContext *C, int index) int ok = remove_constraint_index(&object->constraints, index); if(ok) { ED_object_constraint_set_active(object, NULL); - WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, object); + WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT, object); } return ok; diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index c601622fcc3..9a57a24e1a7 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -97,9 +97,9 @@ EnumPropertyItem empty_vortex_shape_items[] = { #include "ED_object.h" -static void rna_Cache_change(bContext *C, PointerRNA *ptr) +static void rna_Cache_change(Main *bmain, Scene *scene, PointerRNA *ptr) { - Object *ob = CTX_data_active_object(C); + Object *ob = (Object*)ptr->id.data; PointCache *cache = (PointCache*)ptr->data; PTCacheID *pid = NULL; ListBase pidlist; @@ -124,9 +124,9 @@ static void rna_Cache_change(bContext *C, PointerRNA *ptr) BLI_freelistN(&pidlist); } -static void rna_Cache_toggle_disk_cache(bContext *C, PointerRNA *ptr) +static void rna_Cache_toggle_disk_cache(Main *bmain, Scene *scene, PointerRNA *ptr) { - Object *ob = CTX_data_active_object(C); + Object *ob = (Object*)ptr->id.data; PointCache *cache = (PointCache*)ptr->data; PTCacheID *pid = NULL; ListBase pidlist; @@ -147,9 +147,9 @@ static void rna_Cache_toggle_disk_cache(bContext *C, PointerRNA *ptr) BLI_freelistN(&pidlist); } -static void rna_Cache_idname_change(bContext *C, PointerRNA *ptr) +static void rna_Cache_idname_change(Main *bmain, Scene *scene, PointerRNA *ptr) { - Object *ob = CTX_data_active_object(C); + Object *ob = (Object*)ptr->id.data; PointCache *cache = (PointCache*)ptr->data; PTCacheID *pid = NULL, *pid2= NULL; ListBase pidlist; @@ -440,7 +440,7 @@ static int particle_id_check(PointerRNA *ptr) return (GS(id->name) == ID_PA); } -static void rna_FieldSettings_update(bContext *C, PointerRNA *ptr) +static void rna_FieldSettings_update(Main *bmain, Scene *scene, PointerRNA *ptr) { if(particle_id_check(ptr)) { ParticleSettings *part = (ParticleSettings*)ptr->id.data; @@ -456,7 +456,7 @@ static void rna_FieldSettings_update(bContext *C, PointerRNA *ptr) } DAG_id_flush_update(&part->id, OB_RECALC|PSYS_RECALC_RESET); - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL); + WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL); } else { @@ -468,14 +468,12 @@ static void rna_FieldSettings_update(bContext *C, PointerRNA *ptr) } DAG_id_flush_update(&ob->id, OB_RECALC_OB); - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob); } } -static void rna_FieldSettings_shape_update(bContext *C, PointerRNA *ptr) +static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - Scene *scene= CTX_data_scene(C); - if(!particle_id_check(ptr)) { Object *ob= (Object*)ptr->id.data; PartDeflect *pd= ob->pd; @@ -492,14 +490,12 @@ static void rna_FieldSettings_shape_update(bContext *C, PointerRNA *ptr) ED_object_modifier_remove(NULL, scene, ob, md); } - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob); } } -static void rna_FieldSettings_dependency_update(bContext *C, PointerRNA *ptr) +static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - Scene *scene= CTX_data_scene(C); - if(particle_id_check(ptr)) { DAG_id_flush_update((ID*)ptr->id.data, OB_RECALC|PSYS_RECALC_RESET); } @@ -513,7 +509,7 @@ static void rna_FieldSettings_dependency_update(bContext *C, PointerRNA *ptr) do_curvebuts(B_CU3D); // all curves too }*/ - rna_FieldSettings_shape_update(C, ptr); + rna_FieldSettings_shape_update(bmain, scene, ptr); DAG_scene_sort(scene); @@ -522,7 +518,7 @@ static void rna_FieldSettings_dependency_update(bContext *C, PointerRNA *ptr) else DAG_id_flush_update(&ob->id, OB_RECALC_OB); - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob); } } @@ -550,22 +546,20 @@ static char *rna_FieldSettings_path(PointerRNA *ptr) return NULL; } -static void rna_EffectorWeight_update(bContext *C, PointerRNA *ptr) +static void rna_EffectorWeight_update(Main *bmain, Scene *scene, PointerRNA *ptr) { DAG_id_flush_update((ID*)ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET); - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL); + WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL); } -static void rna_EffectorWeight_dependency_update(bContext *C, PointerRNA *ptr) +static void rna_EffectorWeight_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - Scene *scene= CTX_data_scene(C); - DAG_scene_sort(scene); DAG_id_flush_update((ID*)ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET); - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL); + WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL); } static char *rna_EffectorWeight_path(PointerRNA *ptr) @@ -612,9 +606,8 @@ static char *rna_EffectorWeight_path(PointerRNA *ptr) return NULL; } -static void rna_CollisionSettings_dependency_update(bContext *C, PointerRNA *ptr) +static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - Scene *scene= CTX_data_scene(C); Object *ob= (Object*)ptr->id.data; ModifierData *md= modifiers_findByType(ob, eModifierType_Collision); @@ -624,23 +617,23 @@ static void rna_CollisionSettings_dependency_update(bContext *C, PointerRNA *ptr else if(!ob->pd->deflect && md) ED_object_modifier_remove(NULL, scene, ob, md); - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob); } -static void rna_CollisionSettings_update(bContext *C, PointerRNA *ptr) +static void rna_CollisionSettings_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; DAG_id_flush_update(&ob->id, OB_RECALC); - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob); } -static void rna_softbody_update(bContext *C, PointerRNA *ptr) +static void rna_softbody_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob); } diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 6ddec53c28d..4ff42bbb7c2 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -109,7 +109,7 @@ EnumPropertyItem part_hair_ren_as_items[] = { #include "BLI_listbase.h" /* property update functions */ -static void particle_recalc(bContext *C, PointerRNA *ptr, short flag) +static void particle_recalc(Main *bmain, Scene *scene, PointerRNA *ptr, short flag) { if(ptr->type==&RNA_ParticleSystem) { ParticleSystem *psys = (ParticleSystem*)ptr->data; @@ -121,43 +121,41 @@ static void particle_recalc(bContext *C, PointerRNA *ptr, short flag) else DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA|flag); - WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL); + WM_main_add_notifier(NC_OBJECT|ND_PARTICLE_DATA, NULL); } -static void rna_Particle_redo(bContext *C, PointerRNA *ptr) +static void rna_Particle_redo(Main *bmain, Scene *scene, PointerRNA *ptr) { - particle_recalc(C, ptr, PSYS_RECALC_REDO); + particle_recalc(bmain, scene, ptr, PSYS_RECALC_REDO); } -static void rna_Particle_redo_dependency(bContext *C, PointerRNA *ptr) +static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_scene_sort(CTX_data_scene(C)); - rna_Particle_redo(C, ptr); + DAG_scene_sort(scene); + rna_Particle_redo(bmain, scene, ptr); } -static void rna_Particle_reset(bContext *C, PointerRNA *ptr) +static void rna_Particle_reset(Main *bmain, Scene *scene, PointerRNA *ptr) { - particle_recalc(C, ptr, PSYS_RECALC_RESET); + particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET); } -static void rna_Particle_change_type(bContext *C, PointerRNA *ptr) +static void rna_Particle_change_type(Main *bmain, Scene *scene, PointerRNA *ptr) { - particle_recalc(C, ptr, PSYS_RECALC_RESET|PSYS_RECALC_TYPE); + particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET|PSYS_RECALC_TYPE); } -static void rna_Particle_change_physics(bContext *C, PointerRNA *ptr) +static void rna_Particle_change_physics(Main *bmain, Scene *scene, PointerRNA *ptr) { - particle_recalc(C, ptr, PSYS_RECALC_RESET|PSYS_RECALC_PHYS); + particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET|PSYS_RECALC_PHYS); } -static void rna_Particle_redo_child(bContext *C, PointerRNA *ptr) +static void rna_Particle_redo_child(Main *bmain, Scene *scene, PointerRNA *ptr) { - particle_recalc(C, ptr, PSYS_RECALC_CHILD); + particle_recalc(bmain, scene, ptr, PSYS_RECALC_CHILD); } -static void rna_Particle_target_reset(bContext *C, PointerRNA *ptr) +static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr) { - Scene *scene = CTX_data_scene(C); - if(ptr->type==&RNA_ParticleTarget) { ParticleTarget *pt = (ParticleTarget*)ptr->data; Object *ob = (Object*)ptr->id.data; @@ -187,10 +185,10 @@ static void rna_Particle_target_reset(bContext *C, PointerRNA *ptr) DAG_scene_sort(scene); } - WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL); + WM_main_add_notifier(NC_OBJECT|ND_PARTICLE_DATA, NULL); } -static void rna_Particle_target_redo(bContext *C, PointerRNA *ptr) +static void rna_Particle_target_redo(Main *bmain, Scene *scene, PointerRNA *ptr) { if(ptr->type==&RNA_ParticleTarget) { Object *ob = (Object*)ptr->id.data; @@ -199,13 +197,12 @@ static void rna_Particle_target_redo(bContext *C, PointerRNA *ptr) psys->recalc = PSYS_RECALC_REDO; DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL); + WM_main_add_notifier(NC_OBJECT|ND_PARTICLE_DATA, NULL); } } -static void rna_Particle_hair_dynamics(bContext *C, PointerRNA *ptr) +static void rna_Particle_hair_dynamics(Main *bmain, Scene *scene, PointerRNA *ptr) { - /* Scene *scene = CTX_data_scene(C); */ ParticleSystem *psys = (ParticleSystem*)ptr->data; if(psys && !psys->clmd) { @@ -213,10 +210,10 @@ static void rna_Particle_hair_dynamics(bContext *C, PointerRNA *ptr) psys->clmd->sim_parms->goalspring = 0.0f; psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_GOAL|CLOTH_SIMSETTINGS_FLAG_NO_SPRING_COMPRESS; psys->clmd->coll_parms->flags &= ~CLOTH_COLLSETTINGS_FLAG_SELF; - rna_Particle_redo(C, ptr); + rna_Particle_redo(bmain, scene, ptr); } else - WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL); + WM_main_add_notifier(NC_OBJECT|ND_PARTICLE_DATA, NULL); } static PointerRNA rna_particle_settings_get(PointerRNA *ptr) { @@ -241,7 +238,7 @@ static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value) psys_check_boid_data(psys); } } -static void rna_Particle_abspathtime_update(bContext *C, PointerRNA *ptr) +static void rna_Particle_abspathtime_update(Main *bmain, Scene *scene, PointerRNA *ptr) { ParticleSettings *settings = (ParticleSettings*)ptr->data; float delta = settings->end + settings->lifetime - settings->sta; @@ -253,7 +250,7 @@ static void rna_Particle_abspathtime_update(bContext *C, PointerRNA *ptr) settings->path_start = (settings->path_start - settings->sta)/delta; settings->path_end = (settings->path_end - settings->sta)/delta; } - rna_Particle_redo(C, ptr); + rna_Particle_redo(bmain, scene, ptr); } static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value) { diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 8a4aadcba57..c7aca9c9738 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -58,14 +58,14 @@ #include "MEM_guardedalloc.h" -static void rna_Pose_update(bContext *C, PointerRNA *ptr) +static void rna_Pose_update(Main *bmain, Scene *scene, PointerRNA *ptr) { // XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA); } -static void rna_Pose_IK_update(bContext *C, PointerRNA *ptr) +static void rna_Pose_IK_update(Main *bmain, Scene *scene, PointerRNA *ptr) { // XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); Object *ob= ptr->id.data; @@ -142,11 +142,10 @@ static void rna_Pose_ik_solver_set(struct PointerRNA *ptr, int value) } } -static void rna_Pose_ik_solver_update(bContext *C, PointerRNA *ptr) +static void rna_Pose_ik_solver_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Object *ob= ptr->id.data; bPose *pose = ptr->data; - Scene *scene = CTX_data_scene(C); pose->flag |= POSE_RECALC; // checks & sorts pose channels DAG_scene_sort(scene); @@ -242,7 +241,7 @@ static StructRNA *rna_Pose_ikparam_typef(PointerRNA *ptr) } } -static void rna_Itasc_update(bContext *C, PointerRNA *ptr) +static void rna_Itasc_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Object *ob = ptr->id.data; bItasc *itasc = ptr->data; @@ -267,13 +266,13 @@ static void rna_Itasc_update(bContext *C, PointerRNA *ptr) DAG_id_flush_update(&ob->id, OB_RECALC_DATA); } -static void rna_Itasc_update_rebuild(bContext *C, PointerRNA *ptr) +static void rna_Itasc_update_rebuild(Main *bmain, Scene *scene, PointerRNA *ptr) { Object *ob= ptr->id.data; bPose *pose = ob->pose; pose->flag |= POSE_RECALC; // checks & sorts pose channels - rna_Itasc_update(C, ptr); + rna_Itasc_update(bmain, scene, ptr); } static PointerRNA rna_PoseChannel_bone_group_get(PointerRNA *ptr) @@ -431,7 +430,7 @@ static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr, PointerRNA va static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, bContext *C, int type) { - //WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object); + //WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object); // TODO, pass object also // TODO, new pose bones don't have updated draw flags return add_pose_constraint(NULL, pchan, NULL, type); @@ -441,7 +440,7 @@ static int rna_PoseChannel_constraints_remove(bPoseChannel *pchan, bContext *C, { // TODO //ED_object_constraint_set_active(object, NULL); - //WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, object); + //WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT, object); return remove_constraint_index(&pchan->constraints, index); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 458fdbf2ea9..033a8f45809 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -190,9 +190,8 @@ static void rna_Scene_layer_set(PointerRNA *ptr, const int *values) scene->lay= ED_view3d_scene_layer_set(scene->lay, values); } -static void rna_Scene_layer_update(bContext *C, PointerRNA *ptr) +static void rna_Scene_layer_update(Main *bmain, Scene *unused, PointerRNA *ptr) { - Main *bmain= CTX_data_main(C); Scene *scene= (Scene*)ptr->data; ED_view3d_scene_layers_update(bmain, scene); @@ -269,7 +268,7 @@ static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value) data->r.pefra= value; } -static void rna_Scene_frame_update(bContext *C, PointerRNA *ptr) +static void rna_Scene_frame_update(Main *bmain, Scene *unused, PointerRNA *ptr) { //Scene *scene= ptr->id.data; //ED_update_for_newframe(C); @@ -538,7 +537,7 @@ static void rna_SceneRenderLayer_layer_set(PointerRNA *ptr, const int *values) rl->lay= ED_view3d_scene_layer_set(rl->lay, values); } -static void rna_SceneRenderLayer_pass_update(bContext *C, PointerRNA *ptr) +static void rna_SceneRenderLayer_pass_update(Main *bmain, Scene *unused, PointerRNA *ptr) { Scene *scene= (Scene*)ptr->id.data; @@ -555,7 +554,7 @@ static void rna_Scene_use_nodes_set(PointerRNA *ptr, int value) ED_node_composit_default(scene); } -static void rna_Physics_update(bContext *C, PointerRNA *ptr) +static void rna_Physics_update(Main *bmain, Scene *unused, PointerRNA *ptr) { Scene *scene= (Scene*)ptr->id.data; Base *base; @@ -2453,6 +2452,14 @@ void RNA_def_scene(BlenderRNA *brna) /* Animation Data (for Scene) */ rna_def_animdata_common(srna); + /* Readonly Properties */ + prop= RNA_def_property(srna, "nla_tweakmode_on", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_NLA_EDIT_ON); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* DO NOT MAKE THIS EDITABLE, OR NLA EDITOR BREAKS */ + RNA_def_property_ui_text(prop, "NLA TweakMode", "Indicates whether there is any action referenced by NLA being edited. Strictly read-only."); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL); + + /* Nodes (Compositing) */ prop= RNA_def_property(srna, "nodetree", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "Node Tree", "Compositing node tree."); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 89e9c2ee5ca..4efbed167a6 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -54,7 +54,7 @@ static void rna_Scene_set_frame(Scene *scene, bContext *C, int frame) CLAMP(scene->r.cfra, MINAFRAME, MAXFRAME); scene_update_for_newframe(scene, (1<<20) - 1); - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); } static KeyingSet *rna_Scene_add_keying_set(Scene *sce, ReportList *reports, diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 79a5d3d5cd1..5311c80e45d 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -78,6 +78,12 @@ static int rna_Screen_animation_playing_get(PointerRNA *ptr) return (sc->animtimer != NULL); } +static int rna_Screen_fullscreen_get(PointerRNA *ptr) +{ + bScreen *sc= (bScreen*)ptr->data; + return (sc->full == SCREENFULL); +} + static void rna_Area_type_set(PointerRNA *ptr, int value) { ScrArea *sa= (ScrArea*)ptr->data; @@ -88,10 +94,8 @@ static void rna_Area_type_update(bContext *C, PointerRNA *ptr) { ScrArea *sa= (ScrArea*)ptr->data; - if(sa) { - ED_area_newspace(C, sa, sa->butspacetype); /* XXX - this uses the window */ - ED_area_tag_redraw(sa); - } + ED_area_newspace(C, sa, sa->butspacetype); /* XXX - this uses the window */ + ED_area_tag_redraw(sa); } #else @@ -129,9 +133,9 @@ static void rna_def_area(BlenderRNA *brna) RNA_def_property_enum_items(prop, space_type_items); RNA_def_property_enum_funcs(prop, NULL, "rna_Area_type_set", NULL); RNA_def_property_ui_text(prop, "Type", "Space type."); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_Area_type_update"); - RNA_def_function(srna, "tag_redraw", "ED_area_tag_redraw"); } @@ -174,6 +178,7 @@ static void rna_def_screen(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL); RNA_def_property_pointer_funcs(prop, NULL, "rna_Screen_scene_set", NULL); RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the screen."); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_Screen_scene_update"); prop= RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE); @@ -185,6 +190,11 @@ static void rna_def_screen(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_funcs(prop, "rna_Screen_animation_playing_get", NULL); RNA_def_property_ui_text(prop, "Animation Playing", "Animation playback is active."); + + prop= RNA_def_property(srna, "fullscreen", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Screen_fullscreen_get", NULL); + RNA_def_property_ui_text(prop, "Fullscreen", "An area is maximised, filling this screen."); } void RNA_def_screen(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 8b2b4890e05..c8fb11ced95 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -100,9 +100,10 @@ static void rna_Paint_active_brush_set(PointerRNA *ptr, PointerRNA value) paint_brush_set(ptr->data, value.data); } -static void rna_ParticleEdit_redo(bContext *C, PointerRNA *ptr) +static void rna_ParticleEdit_redo(Main *bmain, Scene *scene, PointerRNA *ptr) { - PTCacheEdit *edit = PE_get_current(CTX_data_scene(C), CTX_data_active_object(C)); + Object *ob= (scene->basact)? scene->basact->object: NULL; + PTCacheEdit *edit = PE_get_current(scene, ob); if(!edit) return; @@ -110,9 +111,9 @@ static void rna_ParticleEdit_redo(bContext *C, PointerRNA *ptr) psys_free_path_cache(edit->psys, edit); } -static void rna_ParticleEdit_update(bContext *C, PointerRNA *ptr) +static void rna_ParticleEdit_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - Object *ob = CTX_data_active_object(C); + Object *ob= (scene->basact)? scene->basact->object: NULL; if(ob) DAG_id_flush_update(&ob->id, OB_RECALC_DATA); } @@ -120,7 +121,8 @@ static void rna_ParticleEdit_update(bContext *C, PointerRNA *ptr) static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *ptr, int *free) { Scene *scene= CTX_data_scene(C); - PTCacheEdit *edit = PE_get_current(scene, CTX_data_active_object(C)); + Object *ob= (scene->basact)? scene->basact->object: NULL; + PTCacheEdit *edit = PE_get_current(scene, ob); if(edit && edit->psys) return particle_edit_hair_brush_items; diff --git a/source/blender/makesrna/intern/rna_sequence.c b/source/blender/makesrna/intern/rna_sequence.c index 2e31facfd19..68bfea7161d 100644 --- a/source/blender/makesrna/intern/rna_sequence.c +++ b/source/blender/makesrna/intern/rna_sequence.c @@ -25,6 +25,7 @@ #include <stdlib.h> #include <limits.h> +#include "RNA_access.h" #include "RNA_define.h" #include "RNA_types.h" @@ -42,7 +43,7 @@ #ifdef RNA_RUNTIME -static void rna_SequenceEditor_start_frame_set(PointerRNA *ptr, int value) +static void rna_Sequence_start_frame_set(PointerRNA *ptr, int value) { Sequence *seq= (Sequence*)ptr->data; Scene *sce= (Scene*)ptr->id.data; @@ -57,7 +58,7 @@ static void rna_SequenceEditor_start_frame_set(PointerRNA *ptr, int value) sort_seq(sce); } -static void rna_SequenceEditor_length_set(PointerRNA *ptr, int value) +static void rna_Sequence_length_set(PointerRNA *ptr, int value) { Sequence *seq= (Sequence*)ptr->data; Scene *sce= (Scene*)ptr->id.data; @@ -72,13 +73,13 @@ static void rna_SequenceEditor_length_set(PointerRNA *ptr, int value) sort_seq(sce); } -static int rna_SequenceEditor_length_get(PointerRNA *ptr) +static int rna_Sequence_length_get(PointerRNA *ptr) { Sequence *seq= (Sequence*)ptr->data; return seq_tx_get_final_right(seq, 0)-seq_tx_get_final_left(seq, 0); } -static void rna_SequenceEditor_channel_set(PointerRNA *ptr, int value) +static void rna_Sequence_channel_set(PointerRNA *ptr, int value) { Sequence *seq= (Sequence*)ptr->data; Scene *sce= (Scene*)ptr->id.data; @@ -93,7 +94,7 @@ static void rna_SequenceEditor_channel_set(PointerRNA *ptr, int value) } /* properties that need to allocate structs */ -static void rna_SequenceEditor_use_color_balance_set(PointerRNA *ptr, int value) +static void rna_Sequence_use_color_balance_set(PointerRNA *ptr, int value) { Sequence *seq= (Sequence*)ptr->data; int c; @@ -113,7 +114,7 @@ static void rna_SequenceEditor_use_color_balance_set(PointerRNA *ptr, int value) } } -static void rna_SequenceEditor_use_proxy_set(PointerRNA *ptr, int value) +static void rna_Sequence_use_proxy_set(PointerRNA *ptr, int value) { Sequence *seq= (Sequence*)ptr->data; if(value) { @@ -126,7 +127,7 @@ static void rna_SequenceEditor_use_proxy_set(PointerRNA *ptr, int value) } } -static void rna_SequenceEditor_use_translation_set(PointerRNA *ptr, int value) +static void rna_Sequence_use_translation_set(PointerRNA *ptr, int value) { Sequence *seq= (Sequence*)ptr->data; if(value) { @@ -139,7 +140,7 @@ static void rna_SequenceEditor_use_translation_set(PointerRNA *ptr, int value) } } -static void rna_SequenceEditor_use_crop_set(PointerRNA *ptr, int value) +static void rna_Sequence_use_crop_set(PointerRNA *ptr, int value) { Sequence *seq= (Sequence*)ptr->data; if(value) { @@ -263,6 +264,24 @@ static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value) BLI_strncpy(elem->name, name, sizeof(elem->name)); } +static void rna_Sequence_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Editing *ed= seq_give_editing(scene, FALSE); + + free_imbuf_seq(scene, &ed->seqbase, FALSE); + + if(RNA_struct_is_a(ptr->type, &RNA_SoundSequence)) + seq_update_sound(ptr->data); +} + +static void rna_Sequence_mute_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Editing *ed= seq_give_editing(scene, FALSE); + + seq_update_muting(ed); + rna_Sequence_update(bmain, scene, ptr); +} + #else static void rna_def_strip_element(BlenderRNA *brna) @@ -278,6 +297,7 @@ static void rna_def_strip_element(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "Filename", ""); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SequenceElement_filename_set"); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); } static void rna_def_strip_crop(BlenderRNA *brna) @@ -292,18 +312,22 @@ static void rna_def_strip_crop(BlenderRNA *brna) prop= RNA_def_property(srna, "top", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(prop, "Top", ""); RNA_def_property_ui_range(prop, 0, 4096, 1, 0); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "bottom", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(prop, "Bottom", ""); RNA_def_property_ui_range(prop, 0, 4096, 1, 0); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "left", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(prop, "Left", ""); RNA_def_property_ui_range(prop, 0, 4096, 1, 0); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "right", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(prop, "Right", ""); RNA_def_property_ui_range(prop, 0, 4096, 1, 0); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); } static void rna_def_strip_transform(BlenderRNA *brna) @@ -319,11 +343,13 @@ static void rna_def_strip_transform(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "xofs"); RNA_def_property_ui_text(prop, "Offset Y", ""); RNA_def_property_ui_range(prop, -4096, 4096, 1, 0); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "offset_y", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "yofs"); RNA_def_property_ui_text(prop, "Offset Y", ""); RNA_def_property_ui_range(prop, -4096, 4096, 1, 0); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); } static void rna_def_strip_proxy(BlenderRNA *brna) @@ -338,10 +364,12 @@ static void rna_def_strip_proxy(BlenderRNA *brna) prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "dir"); RNA_def_property_ui_text(prop, "Directory", "Location to story the proxy file"); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "file", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "file"); RNA_def_property_ui_text(prop, "File", "Proxy file name"); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); } static void rna_def_strip_color_balance(BlenderRNA *brna) @@ -355,33 +383,41 @@ static void rna_def_strip_color_balance(BlenderRNA *brna) prop= RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR); RNA_def_property_ui_text(prop, "Lift", "Color balance lift (shadows)."); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR); RNA_def_property_ui_text(prop, "Gamma", "Color balance gamma (midtones)."); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR); RNA_def_property_ui_text(prop, "Gain", "Color balance gain (highlights)."); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "inverse_gain", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAIN); RNA_def_property_ui_text(prop, "Inverse Gain", ""); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "inverse_gamma", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAMMA); RNA_def_property_ui_text(prop, "Inverse Gamma", ""); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "inverse_lift", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_LIFT); RNA_def_property_ui_text(prop, "Inverse Lift", ""); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); /* not yet used prop= RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Exposure", ""); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Saturation", "");*/ + RNA_def_property_ui_text(prop, "Saturation", ""); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); */ } static void rna_def_sequence(BlenderRNA *brna) @@ -396,7 +432,6 @@ static void rna_def_sequence(BlenderRNA *brna) {SEQ_SCENE, "SCENE", 0, "Scene", ""}, {SEQ_MOVIE, "MOVIE", 0, "Movie", ""}, {SEQ_SOUND, "SOUND", 0, "Sound", ""}, - {SEQ_EFFECT, "REPLACE", 0, "Replace", ""}, {SEQ_CROSS, "CROSS", 0, "Cross", ""}, {SEQ_ADD, "ADD", 0, "Add", ""}, {SEQ_SUB, "SUBTRACT", 0, "Subtract", ""}, @@ -435,11 +470,13 @@ static void rna_def_sequence(BlenderRNA *brna) RNA_def_property_string_maxlength(prop, sizeof(((Sequence*)NULL)->name)-2); RNA_def_property_ui_text(prop, "Name", ""); RNA_def_struct_name_property(srna, prop); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_enum_items(prop, seq_type_items); RNA_def_property_ui_text(prop, "Type", ""); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); //prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE); //RNA_def_property_ui_text(prop, "Ipo Curves", "Ipo curves used by this sequence."); @@ -449,28 +486,32 @@ static void rna_def_sequence(BlenderRNA *brna) prop= RNA_def_property(srna, "selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT); RNA_def_property_ui_text(prop, "Selected", ""); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER_SELECT, NULL); prop= RNA_def_property(srna, "left_handle_selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_LEFTSEL); RNA_def_property_ui_text(prop, "Left Handle Selected", ""); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER_SELECT, NULL); prop= RNA_def_property(srna, "right_handle_selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_RIGHTSEL); RNA_def_property_ui_text(prop, "Right Handle Selected", ""); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER_SELECT, NULL); prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MUTE); RNA_def_property_ui_text(prop, "Mute", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_mute_update"); prop= RNA_def_property(srna, "frame_locked", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_IPO_FRAME_LOCKED); RNA_def_property_ui_text(prop, "Frame Locked", "Lock the animation curve to the global frame counter."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_LOCK); RNA_def_property_ui_text(prop, "Lock", "Lock strip so that it can't be transformed."); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); /* strip positioning */ @@ -478,76 +519,76 @@ static void rna_def_sequence(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "len"); RNA_def_property_range(prop, 1, MAXFRAME); RNA_def_property_ui_text(prop, "Length", "The length of the contents of this strip before the handles are applied"); - RNA_def_property_int_funcs(prop, "rna_SequenceEditor_length_get", "rna_SequenceEditor_length_set",NULL); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_int_funcs(prop, "rna_Sequence_length_get", "rna_Sequence_length_set",NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "start_frame", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "start"); RNA_def_property_ui_text(prop, "Start Frame", ""); - RNA_def_property_int_funcs(prop, NULL, "rna_SequenceEditor_start_frame_set",NULL); // overlap tests and calc_seq_disp - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_set",NULL); // overlap tests and calc_seq_disp + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "start_offset", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "startofs"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); // overlap tests RNA_def_property_ui_text(prop, "Start Offset", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "end_offset", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "endofs"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); // overlap tests RNA_def_property_ui_text(prop, "End offset", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "start_still", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "startstill"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); // overlap tests RNA_def_property_range(prop, 0, MAXFRAME); RNA_def_property_ui_text(prop, "Start Still", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "end_still", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "endstill"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); // overlap tests RNA_def_property_range(prop, 0, MAXFRAME); RNA_def_property_ui_text(prop, "End Still", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "channel", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "machine"); RNA_def_property_range(prop, 0, MAXSEQ-1); RNA_def_property_ui_text(prop, "Channel", "Y position of the sequence strip."); - RNA_def_property_int_funcs(prop, NULL, "rna_SequenceEditor_channel_set",NULL); // overlap test - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_channel_set",NULL); // overlap test + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); /* blending */ prop= RNA_def_property(srna, "blend_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, blend_mode_items); RNA_def_property_ui_text(prop, "Blend Mode", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "blend_opacity", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_text(prop, "Blend Opacity", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "effect_fader", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_float_sdna(prop, NULL, "effect_fader"); RNA_def_property_ui_text(prop, "Effect fader position", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "use_effect_default_fade", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_EFFECT_DEFAULT_FADE); RNA_def_property_ui_text(prop, "Use Default Fade", "Fade effect using the builtin default (usually make transition as long as effect strip)."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "speed_fader", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "speed_fader"); RNA_def_property_ui_text(prop, "Speed effect fader position", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); /* functions */ func= RNA_def_function(srna, "getStripElem", "give_stripelem"); @@ -599,66 +640,63 @@ static void rna_def_filter_video(StructRNA *srna) prop= RNA_def_property(srna, "flip_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FLIPX); RNA_def_property_ui_text(prop, "Flip X", "Flip on the X axis."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "flip_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FLIPY); RNA_def_property_ui_text(prop, "Flip Y", "Flip on the Y axis."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "convert_float", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MAKE_FLOAT); RNA_def_property_ui_text(prop, "Convert Float", "Convert input to float data."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "reverse_frames", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_REVERSE_FRAMES); RNA_def_property_ui_text(prop, "Flip Time", "Reverse frame order."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "multiply_colors", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "mul"); RNA_def_property_range(prop, 0.0f, 20.0f); RNA_def_property_ui_text(prop, "Multiply Colors", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "strobe", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 1.0f, 30.0f); RNA_def_property_ui_text(prop, "Strobe", "Only display every nth frame."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "use_color_balance", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_COLOR_BALANCE); RNA_def_property_ui_text(prop, "Use Color Balance", "(3-Way color correction) on input."); - RNA_def_property_boolean_funcs(prop, NULL, "rna_SequenceEditor_use_color_balance_set"); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_color_balance_set"); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "color_balance", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "strip->color_balance"); RNA_def_property_ui_text(prop, "Color Balance", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); prop= RNA_def_property(srna, "use_translation", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_TRANSFORM); RNA_def_property_ui_text(prop, "Use Translation", "Translate image before processing."); - RNA_def_property_boolean_funcs(prop, NULL, "rna_SequenceEditor_use_translation_set"); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_translation_set"); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "transform", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "strip->transform"); RNA_def_property_ui_text(prop, "Transform", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); prop= RNA_def_property(srna, "use_crop", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_CROP); RNA_def_property_ui_text(prop, "Use Crop", "Crop image before processing."); - RNA_def_property_boolean_funcs(prop, NULL, "rna_SequenceEditor_use_crop_set"); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_crop_set"); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "crop", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "strip->crop"); RNA_def_property_ui_text(prop, "Crop", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); } static void rna_def_proxy(StructRNA *srna) @@ -668,7 +706,7 @@ static void rna_def_proxy(StructRNA *srna) prop= RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY); RNA_def_property_ui_text(prop, "Use Proxy", "Use a preview proxy for this strip."); - RNA_def_property_boolean_funcs(prop, NULL, "rna_SequenceEditor_use_proxy_set"); + RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_proxy_set"); prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "strip->proxy"); @@ -677,6 +715,7 @@ static void rna_def_proxy(StructRNA *srna) prop= RNA_def_property(srna, "proxy_custom_directory", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY_CUSTOM_DIR); RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Use a custom directory to store data."); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); } static void rna_def_input(StructRNA *srna) @@ -687,13 +726,13 @@ static void rna_def_input(StructRNA *srna) RNA_def_property_int_sdna(prop, NULL, "anim_startofs"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); // overlap test RNA_def_property_ui_text(prop, "Animation Start Offset", "Animation start offset (trim start)."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "animation_end_offset", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "anim_endofs"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); // overlap test RNA_def_property_ui_text(prop, "Animation End Offset", "Animation end offset (trim end)."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); } static void rna_def_image(BlenderRNA *brna) @@ -708,13 +747,13 @@ static void rna_def_image(BlenderRNA *brna) prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "strip->dir"); RNA_def_property_ui_text(prop, "Directory", ""); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", "strip->len"); RNA_def_property_struct_type(prop, "SequenceElement"); RNA_def_property_ui_text(prop, "Elements", ""); - rna_def_filter_video(srna); rna_def_proxy(srna); rna_def_input(srna); @@ -751,7 +790,7 @@ static void rna_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Scene", "Scene that this sequence uses."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); rna_def_filter_video(srna); rna_def_proxy(srna); @@ -771,15 +810,18 @@ static void rna_def_movie(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "anim_preseek"); RNA_def_property_range(prop, 0, 50); RNA_def_property_ui_text(prop, "MPEG Preseek", "For MPEG movies, preseek this many frames."); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "strip->stripdata->name"); RNA_def_property_ui_text(prop, "Filename", ""); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MovieSequence_filename_set"); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "strip->dir"); RNA_def_property_ui_text(prop, "Directory", ""); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); rna_def_filter_video(srna); rna_def_proxy(srna); @@ -798,15 +840,18 @@ static void rna_def_sound(BlenderRNA *brna) prop= RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Sound"); RNA_def_property_ui_text(prop, "Sound", "Sound datablock used by this sequence."); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "strip->stripdata->name"); RNA_def_property_ui_text(prop, "Filename", ""); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoundSequence_filename_set"); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "strip->dir"); RNA_def_property_ui_text(prop, "Directory", ""); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); rna_def_input(srna); @@ -816,7 +861,7 @@ static void rna_def_sound(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "volume"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound"); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); } static void rna_def_effect(BlenderRNA *brna) @@ -843,6 +888,7 @@ static void rna_def_plugin(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Filename", ""); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); /* plugin properties need custom wrapping code like ID properties */ } @@ -876,25 +922,25 @@ static void rna_def_wipe(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "edgeWidth"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Blur Width", "Width of the blur edge, in percentage relative to the image size."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "angle"); RNA_def_property_range(prop, -90.0f, 90.0f); RNA_def_property_ui_text(prop, "Angle", "Edge angle."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "forward"); RNA_def_property_enum_items(prop, wipe_direction_items); RNA_def_property_ui_text(prop, "Direction", "Wipe direction."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "transition_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "wipetype"); RNA_def_property_enum_items(prop, wipe_type_items); RNA_def_property_ui_text(prop, "Transition Type", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); } static void rna_def_glow(BlenderRNA *brna) @@ -910,36 +956,36 @@ static void rna_def_glow(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "fMini"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Threshold", "Minimum intensity to trigger a glow"); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "clamp", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "fClamp"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Clamp", "rightness limit of intensity."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "boost_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "fBoost"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Boost Factor", "Brightness multiplier."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "blur_distance", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dDist"); RNA_def_property_range(prop, 0.5f, 20.0f); RNA_def_property_ui_text(prop, "Blur Distance", "Radius of glow effect."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "quality", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dQuality"); RNA_def_property_range(prop, 1, 5); RNA_def_property_ui_text(prop, "Quality", "Accuracy of the blur effect."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "only_boost", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "bNoComp", 0); RNA_def_property_ui_text(prop, "Only Boost", "Show the glow buffer only."); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); } static void rna_def_transform(BlenderRNA *brna) @@ -968,72 +1014,72 @@ static void rna_def_transform(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "ScalexIni"); RNA_def_property_ui_text(prop, "Scale Start X", ""); RNA_def_property_ui_range(prop, 0, 10, 3, 10); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "scale_start_y", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "ScaleyIni"); RNA_def_property_ui_text(prop, "Scale Start Y", ""); RNA_def_property_ui_range(prop, 0, 10, 3, 10); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "scale_end_x", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "ScalexFin"); RNA_def_property_ui_text(prop, "Scale End X", ""); RNA_def_property_ui_range(prop, 0, 10, 3, 10); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "scale_end_y", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "ScaleyFin"); RNA_def_property_ui_text(prop, "Scale End Y", ""); RNA_def_property_ui_range(prop, 0, 10, 3, 10); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "translate_start_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "xIni"); RNA_def_property_ui_text(prop, "Translate Start X", ""); RNA_def_property_ui_range(prop, -500.0f, 500.0f, 3, 10); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "translate_start_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "yIni"); RNA_def_property_ui_text(prop, "Translate Start Y", ""); RNA_def_property_ui_range(prop, -500.0f, 500.0f, 3, 10); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "translate_end_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "xFin"); RNA_def_property_ui_text(prop, "Translate End X", ""); RNA_def_property_ui_range(prop, -500.0f, 500.0f, 3, 10); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "translate_end_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "yFin"); RNA_def_property_ui_text(prop, "Translate End Y", ""); RNA_def_property_ui_range(prop, -500.0f, 500.0f, 3, 10); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "rotation_start", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rotIni"); RNA_def_property_range(prop, 0.0f, 360.0f); RNA_def_property_ui_text(prop, "Rotation Start", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "rotation_end", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rotFin"); RNA_def_property_range(prop, 0.0f, 360.0f); RNA_def_property_ui_text(prop, "Rotation End", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "translation_unit", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "percent"); RNA_def_property_enum_items(prop, translation_unit_items); RNA_def_property_ui_text(prop, "Translation Unit", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, interpolation_items); RNA_def_property_ui_text(prop, "Interpolation", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); } static void rna_def_solid_color(BlenderRNA *brna) @@ -1048,7 +1094,7 @@ static void rna_def_solid_color(BlenderRNA *brna) prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "col"); RNA_def_property_ui_text(prop, "Color", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); } static void rna_def_speed_control(BlenderRNA *brna) @@ -1065,18 +1111,22 @@ static void rna_def_speed_control(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE); /* seq->facf0 is used to animate this */ RNA_def_property_ui_text(prop, "Global Speed", ""); RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 0); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "curve_velocity", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_INTEGRATE); RNA_def_property_ui_text(prop, "F-Curve Velocity", "Interpret the F-Curve value as a velocity instead of a frame number."); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "frame_blending", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_BLEND); RNA_def_property_ui_text(prop, "Frame Blending", "Blend two frames into the target for a smoother result."); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); prop= RNA_def_property(srna, "curve_compress_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_COMPRESS_IPO_Y); RNA_def_property_ui_text(prop, "F-Curve Compress Y", "Scale F-Curve value to get the target frame number, F-Curve value runs from 0.0 to 1.0."); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); } void RNA_def_sequence(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index e302ea90a8a..11b1e80865e 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -49,33 +49,33 @@ #include "ED_object.h" -static void rna_Smoke_update(bContext *C, PointerRNA *ptr) +static void rna_Smoke_update(Main *bmain, Scene *scene, PointerRNA *ptr) { DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA); } -static void rna_Smoke_dependency_update(bContext *C, PointerRNA *ptr) +static void rna_Smoke_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - rna_Smoke_update(C, ptr); - DAG_scene_sort(CTX_data_scene(C)); + rna_Smoke_update(bmain, scene, ptr); + DAG_scene_sort(scene); } -static void rna_Smoke_reset(bContext *C, PointerRNA *ptr) +static void rna_Smoke_reset(Main *bmain, Scene *scene, PointerRNA *ptr) { SmokeDomainSettings *settings = (SmokeDomainSettings*)ptr->data; smokeModifier_reset(settings->smd); - rna_Smoke_update(C, ptr); + rna_Smoke_update(bmain, scene, ptr); } -static void rna_Smoke_reset_dependancy(bContext *C, PointerRNA *ptr) +static void rna_Smoke_reset_dependancy(Main *bmain, Scene *scene, PointerRNA *ptr) { SmokeDomainSettings *settings = (SmokeDomainSettings*)ptr->data; smokeModifier_reset(settings->smd); - rna_Smoke_dependency_update(C, ptr); + rna_Smoke_dependency_update(bmain, scene, ptr); } static char *rna_SmokeDomainSettings_path(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index 38e4d850c68..7fc209bfc5f 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -37,9 +37,9 @@ #include "BKE_sound.h" #include "BKE_context.h" -static void rna_Sound_filename_update(bContext *C, PointerRNA *ptr) +static void rna_Sound_filename_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - sound_load(CTX_data_main(C), (bSound*)ptr->data); + sound_load(bmain, (bSound*)ptr->data); } static int rna_Sound_caching_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index ef5f8ccb87b..ef72b6cbf1f 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -83,6 +83,13 @@ static EnumPropertyItem transform_orientation_items[] = { {V3D_MANIP_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"}, {0, NULL, 0, NULL, NULL}}; +EnumPropertyItem autosnap_items[] = { + {SACTSNAP_OFF, "NONE", 0, "No Auto-Snap", ""}, + {SACTSNAP_STEP, "STEP", 0, "Time Step", "Snap to 1.0 frame/second intervals."}, + {SACTSNAP_FRAME, "FRAME", 0, "Nearest Frame", "Snap to actual frames/seconds (nla-action time)."}, + {SACTSNAP_MARKER, "MARKER", 0, "Nearest Marker", "Snap to nearest marker."}, + {0, NULL, 0, NULL, NULL}}; + #ifdef RNA_RUNTIME #include "DNA_anim_types.h" @@ -242,12 +249,9 @@ static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_SpaceUVEditor, ptr->data); } -static void rna_SpaceImageEditor_paint_update(bContext *C, PointerRNA *ptr) +static void rna_SpaceImageEditor_paint_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - Scene *scene= CTX_data_scene(C); - - if(scene) - paint_init(&scene->toolsettings->imapaint.paint, PAINT_CURSOR_TEXTURE_PAINT); + paint_init(&scene->toolsettings->imapaint.paint, PAINT_CURSOR_TEXTURE_PAINT); } static int rna_SpaceImageEditor_show_render_get(PointerRNA *ptr) @@ -315,7 +319,7 @@ static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *C, P return item; } -static void rna_SpaceImageEditor_curves_update(bContext *C, PointerRNA *ptr) +static void rna_SpaceImageEditor_curves_update(Main *bmain, Scene *scene, PointerRNA *ptr) { SpaceImage *sima= (SpaceImage*)ptr->data; ImBuf *ibuf; @@ -325,7 +329,7 @@ static void rna_SpaceImageEditor_curves_update(bContext *C, PointerRNA *ptr) curvemapping_do_ibuf(sima->cumap, ibuf); ED_space_image_release_buffer(sima, lock); - WM_event_add_notifier(C, NC_IMAGE, sima->image); + WM_main_add_notifier(NC_IMAGE, sima->image); } @@ -425,10 +429,12 @@ static void rna_View3D_display_background_image_set(PointerRNA *ptr, int value) /* Space Time */ -static void rna_SpaceTime_redraw_update(bContext *C, PointerRNA *ptr) +static void rna_SpaceTime_redraw_update(Main *bmain, Scene *scene, PointerRNA *ptr) { SpaceTime *st= (SpaceTime*)ptr->data; - ED_screen_animation_timer_update(C, st->redraws); + bScreen *screen= (bScreen*)ptr->id.data; + + ED_screen_animation_timer_update(screen, st->redraws); } /* Space Dopesheet */ @@ -439,10 +445,10 @@ static void rna_SpaceDopeSheetEditor_action_set(PointerRNA *ptr, PointerRNA valu saction->action= value.data; } -static void rna_SpaceDopeSheetEditor_action_update(bContext *C, PointerRNA *ptr) +static void rna_SpaceDopeSheetEditor_action_update(Main *bmain, Scene *scene, PointerRNA *ptr) { SpaceAction *saction= (SpaceAction*)(ptr->data); - Object *obact= CTX_data_active_object(C); + Object *obact= (scene->basact)? scene->basact->object: NULL; /* we must set this action to be the one used by active object (if not pinned) */ if(obact && saction->pin == 0) { @@ -457,6 +463,25 @@ static void rna_SpaceDopeSheetEditor_action_update(bContext *C, PointerRNA *ptr) } } +static void rna_SpaceDopeSheetEditor_mode_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + SpaceAction *saction= (SpaceAction*)(ptr->data); + + /* special exception for ShapeKey Editor mode: + * enable 'show sliders' by default, since one of the main + * points of the ShapeKey Editor is to provide a one-stop shop + * for controlling the shapekeys, whose main control is the value + */ + if (saction->mode == SACTCONT_SHAPEKEY) + saction->flag |= SACTION_SLIDERS; +} + +static int rna_SpaceGraphEditor_has_ghost_curves_get(PointerRNA *ptr) +{ + SpaceIpo *sipo= (SpaceIpo*)(ptr->data); + return (sipo->ghostCurves.first != NULL); +} + #else static void rna_def_space(BlenderRNA *brna) @@ -1238,7 +1263,7 @@ static void rna_def_space_dopesheet(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "mode"); RNA_def_property_enum_items(prop, mode_items); RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed."); - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, "rna_SpaceDopeSheetEditor_mode_update"); /* display */ prop= RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE); @@ -1262,8 +1287,19 @@ static void rna_def_space_dopesheet(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NOTRANSKEYCULL); RNA_def_property_ui_text(prop, "AutoMerge Keyframes", "Show handles of Bezier control points."); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL); - - // TODO... autosnap, dopesheet? + + /* dopesheet */ + prop= RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "DopeSheet"); + RNA_def_property_pointer_sdna(prop, NULL, "ads"); + RNA_def_property_ui_text(prop, "DopeSheet", "Settings for filtering animation data."); + + /* autosnap */ + prop= RNA_def_property(srna, "autosnap", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "autosnap"); + RNA_def_property_enum_items(prop, autosnap_items); + RNA_def_property_ui_text(prop, "Auto Snap", "Automatic time snapping settings for transformations."); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL); } static void rna_def_space_graph(BlenderRNA *brna) @@ -1272,7 +1308,7 @@ static void rna_def_space_graph(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem mode_items[] = { - {SIPO_MODE_ANIMATION, "FCURVES", 0, "F-Curves", ""}, + {SIPO_MODE_ANIMATION, "FCURVES", 0, "F-Curve Editor", ""}, {SIPO_MODE_DRIVERS, "DRIVERS", 0, "Drivers", ""}, {0, NULL, 0, NULL, NULL}}; @@ -1280,18 +1316,11 @@ static void rna_def_space_graph(BlenderRNA *brna) static EnumPropertyItem gpivot_items[] = { {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""}, {V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""}, - {V3D_LOCAL, "INDIVIDUAL_CENTERS", ICON_ROTATECOLLECTION, "Individual Centers", ""}, + {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Centers", ""}, //{V3D_CENTROID, "MEDIAN_POINT", 0, "Median Point", ""}, //{V3D_ACTIVE, "ACTIVE_ELEMENT", 0, "Active Element", ""}, {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem autosnap_items[] = { - {SACTSNAP_OFF, "NONE", 0, "None", ""}, - {SACTSNAP_STEP, "STEP", 0, "Step", "Snap to 1.0 frame/second intervals."}, - {SACTSNAP_FRAME, "FRAME", 0, "Frame", "Snap to actual frames/seconds (nla-action time)."}, - {SACTSNAP_MARKER, "MARKER", 0, "Marker", "Snap to nearest marker."}, - {0, NULL, 0, NULL, NULL}}; - srna= RNA_def_struct(brna, "SpaceGraphEditor", "Space"); RNA_def_struct_sdna(srna, "SpaceIpo"); @@ -1371,6 +1400,13 @@ static void rna_def_space_graph(BlenderRNA *brna) RNA_def_property_enum_items(prop, autosnap_items); RNA_def_property_ui_text(prop, "Auto Snap", "Automatic time snapping settings for transformations."); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL); + + /* readonly state info */ + prop= RNA_def_property(srna, "has_ghost_curves", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", 0); /* XXX: hack to make this compile, since this property doesn't actually exist*/ + RNA_def_property_boolean_funcs(prop, "rna_SpaceGraphEditor_has_ghost_curves_get", NULL); + RNA_def_property_ui_text(prop, "Has Ghost Curves", "Graph Editor instance has some ghost curves stored."); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL); } static void rna_def_space_nla(BlenderRNA *brna) @@ -1398,9 +1434,19 @@ static void rna_def_space_nla(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOSTRIPCURVES); RNA_def_property_ui_text(prop, "Show Control Curves", "Show influence curves on strips."); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL); - - /* editing */ - // TODO... autosnap, dopesheet? + + /* dopesheet */ + prop= RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "DopeSheet"); + RNA_def_property_pointer_sdna(prop, NULL, "ads"); + RNA_def_property_ui_text(prop, "DopeSheet", "Settings for filtering animation data."); + + /* autosnap */ + prop= RNA_def_property(srna, "autosnap", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "autosnap"); + RNA_def_property_enum_items(prop, autosnap_items); + RNA_def_property_ui_text(prop, "Auto Snap", "Automatic time snapping settings for transformations."); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL); } static void rna_def_space_time(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index be38139ce4e..19d33465ceb 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -106,21 +106,21 @@ static StructRNA *rna_Texture_refine(struct PointerRNA *ptr) } } -static void rna_Texture_update(bContext *C, PointerRNA *ptr) +static void rna_Texture_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Tex *tex= ptr->id.data; DAG_id_flush_update(&tex->id, 0); - WM_event_add_notifier(C, NC_TEXTURE, tex); + WM_main_add_notifier(NC_TEXTURE, tex); } /* Used for Texture Properties, used (also) for/in Nodes */ -static void rna_Texture_nodes_update(bContext *C, PointerRNA *ptr) +static void rna_Texture_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Tex *tex= ptr->id.data; DAG_id_flush_update(&tex->id, 0); - WM_event_add_notifier(C, NC_TEXTURE|ND_NODES, tex); + WM_main_add_notifier(NC_TEXTURE|ND_NODES, tex); } static void rna_Texture_type_set(PointerRNA *ptr, int value) @@ -140,7 +140,7 @@ static void rna_Texture_type_set(PointerRNA *ptr, int value) tex->type = value; } -void rna_TextureSlot_update(bContext *C, PointerRNA *ptr) +void rna_TextureSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr) { ID *id= ptr->id.data; @@ -148,16 +148,16 @@ void rna_TextureSlot_update(bContext *C, PointerRNA *ptr) switch(GS(id->name)) { case ID_MA: - WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, id); + WM_main_add_notifier(NC_MATERIAL|ND_SHADING, id); break; case ID_WO: - WM_event_add_notifier(C, NC_WORLD, id); + WM_main_add_notifier(NC_WORLD, id); break; case ID_LA: - WM_event_add_notifier(C, NC_LAMP|ND_LIGHTING, id); + WM_main_add_notifier(NC_LAMP|ND_LIGHTING, id); break; case ID_BR: - WM_event_add_notifier(C, NC_BRUSH, id); + WM_main_add_notifier(NC_BRUSH, id); break; } } diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 1bb7fe720a6..d33e96df2e6 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -145,7 +145,7 @@ static void rna_Panel_unregister(const bContext *C, StructRNA *type) /* update while blender is running */ if(C) - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); } static StructRNA *rna_Panel_register(const bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) @@ -196,7 +196,7 @@ static StructRNA *rna_Panel_register(const bContext *C, ReportList *reports, voi /* update while blender is running */ if(C) - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); return pt->ext.srna; } @@ -242,7 +242,7 @@ static void rna_Header_unregister(const bContext *C, StructRNA *type) /* update while blender is running */ if(C) - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); } static StructRNA *rna_Header_register(const bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) @@ -289,7 +289,7 @@ static StructRNA *rna_Header_register(const bContext *C, ReportList *reports, vo /* update while blender is running */ if(C) - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); return ht->ext.srna; } @@ -356,7 +356,7 @@ static void rna_Menu_unregister(const bContext *C, StructRNA *type) /* update while blender is running */ if(C) - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); } static StructRNA *rna_Menu_register(const bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) @@ -396,7 +396,7 @@ static StructRNA *rna_Menu_register(const bContext *C, ReportList *reports, void /* update while blender is running */ if(C) - WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); + WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); return mt->ext.srna; } diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 278d7855f3a..2424a72b6a3 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -48,9 +48,9 @@ #include "DNA_object_types.h" // #include "GPU_draw.h" -static void rna_userdef_update(bContext *C, PointerRNA *ptr) +static void rna_userdef_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - WM_event_add_notifier(C, NC_WINDOW, NULL); + WM_main_add_notifier(NC_WINDOW, NULL); } #if 0 @@ -132,14 +132,13 @@ static PointerRNA rna_UserDef_system_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesSystem, ptr->data); } -static void rna_UserDef_audio_update(bContext *C, PointerRNA *ptr) +static void rna_UserDef_audio_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - sound_init(C); + sound_init(); } -static void rna_UserDef_weight_color_update(bContext *C, PointerRNA *ptr) +static void rna_UserDef_weight_color_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - Main *bmain= CTX_data_main(C); Object *ob; vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight):NULL); @@ -149,22 +148,25 @@ static void rna_UserDef_weight_color_update(bContext *C, PointerRNA *ptr) DAG_id_flush_update(&ob->id, OB_RECALC_DATA); } - rna_userdef_update(C, ptr); + rna_userdef_update(bmain, scene, ptr); } // XXX - todo, this is not accessible from here and it only works when the userprefs are in the same window. // extern int GPU_default_lights(void); -static void rna_UserDef_viewport_lights_update(bContext *C, PointerRNA *ptr) +static void rna_UserDef_viewport_lights_update(Main *bmain, Scene *scene, PointerRNA *ptr) { // GPU_default_lights(); - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL); - rna_userdef_update(C, ptr); + WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, NULL); + rna_userdef_update(bmain, scene, ptr); } -static void rna_userdef_autosave_update(bContext *C, PointerRNA *ptr) +static void rna_userdef_autosave_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - WM_autosave_init(C); - rna_userdef_update(C, ptr); + wmWindowManager *wm= bmain->wm.first; + + if(wm) + WM_autosave_init(wm); + rna_userdef_update(bmain, scene, ptr); } #else diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 2e4c0690031..6459e5d7c48 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -226,6 +226,7 @@ EnumPropertyItem event_type_items[] = { {PAGEDOWNKEY, "PAGE_DOWN", 0, "Page Down", ""}, {ENDKEY, "END", 0, "End", ""}, {0, "", 0, NULL, NULL}, + {WINDEACTIVATE, "WINDOW_DEACTIVATE", 0, "Window Deactivate", ""}, {TIMER, "TIMER", 0, "Timer", ""}, {TIMER0, "TIMER0", 0, "Timer 0", ""}, {TIMER1, "TIMER1", 0, "Timer 1", ""}, @@ -771,6 +772,7 @@ static void rna_def_window(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Screen", "Active screen showing in the window."); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_pointer_funcs(prop, NULL, "rna_Window_screen_set", NULL); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_Window_screen_update"); } diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index ce26072e91b..2fbcd2f4ae3 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -52,6 +52,21 @@ static wmKeyMap *rna_keymap_add(wmKeyConfig *keyconf, char *idname, int spaceid, } } +static wmKeyMap *rna_keymap_find(wmKeyConfig *keyconf, char *idname, int spaceid, int regionid) +{ + return WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid); +} + +static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *keyconf, char *idname) +{ + wmOperatorType *ot = WM_operatortype_find(idname, 0); + + if (!ot) + return NULL; + else + return ot->modalkeymap; +} + static wmKeyMap *rna_keymap_active(wmKeyMap *km, bContext *C) { wmWindowManager *wm = CTX_wm_manager(C); @@ -175,6 +190,20 @@ void RNA_api_keyconfig(StructRNA *srna) RNA_def_boolean(func, "modal", 0, "Modal", ""); parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map."); RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "find_keymap", "rna_keymap_find"); + parm= RNA_def_string(func, "name", "", 0, "Name", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", ""); + RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", ""); + parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map."); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "find_keymap_modal", "rna_keymap_find_modal"); + parm= RNA_def_string(func, "name", "", 0, "Operator Name", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map."); + RNA_def_function_return(func, parm); } void RNA_api_keymap(StructRNA *srna) diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 231faffef0f..4046fc266da 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -82,20 +82,20 @@ static void rna_World_active_texture_set(PointerRNA *ptr, PointerRNA value) set_current_world_texture(wo, value.data); } -static void rna_World_update(bContext *C, PointerRNA *ptr) +static void rna_World_update(Main *bmain, Scene *scene, PointerRNA *ptr) { World *wo= ptr->id.data; DAG_id_flush_update(&wo->id, 0); - WM_event_add_notifier(C, NC_WORLD, wo); + WM_main_add_notifier(NC_WORLD, wo); } -static void rna_World_draw_update(bContext *C, PointerRNA *ptr) +static void rna_World_draw_update(Main *bmain, Scene *scene, PointerRNA *ptr) { World *wo= ptr->id.data; DAG_id_flush_update(&wo->id, 0); - WM_event_add_notifier(C, NC_WORLD|ND_WORLD_DRAW, wo); + WM_main_add_notifier(NC_WORLD|ND_WORLD_DRAW, wo); } #else |