[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33524] trunk/blender/source/blender: pass along the context to extension functions, this was already being done in all cases except for the render engine.

Doug Hammond doughammond at hamsterfight.co.uk
Tue Dec 7 20:36:32 CET 2010


The LuxRender addon is broken after this commit. When starting the render,
blender fails with:
"Python context called with a NULL Context. this should not happen!"


Cheers,
Doug.


On 7 December 2010 04:12, Campbell Barton <ideasman42 at gmail.com> wrote:

> Revision: 33524
>
> http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33524
> Author:   campbellbarton
> Date:     2010-12-07 05:12:15 +0100 (Tue, 07 Dec 2010)
>
> Log Message:
> -----------
> pass along the context to extension functions, this was already being done
> in all cases except for the render engine.
>
> this allows python to NULL its internal context while scripts are not
> running.
>
> Modified Paths:
> --------------
>    trunk/blender/source/blender/blenkernel/BKE_context.h
>    trunk/blender/source/blender/blenkernel/intern/context.c
>    trunk/blender/source/blender/makesrna/RNA_types.h
>    trunk/blender/source/blender/makesrna/intern/rna_animation.c
>    trunk/blender/source/blender/makesrna/intern/rna_render.c
>    trunk/blender/source/blender/makesrna/intern/rna_ui.c
>    trunk/blender/source/blender/makesrna/intern/rna_wm.c
>    trunk/blender/source/blender/python/intern/bpy.c
>    trunk/blender/source/blender/python/intern/bpy_operator.c
>    trunk/blender/source/blender/python/intern/bpy_rna.c
>
> Modified: trunk/blender/source/blender/blenkernel/BKE_context.h
> ===================================================================
> --- trunk/blender/source/blender/blenkernel/BKE_context.h       2010-12-07
> 01:56:32 UTC (rev 33523)
> +++ trunk/blender/source/blender/blenkernel/BKE_context.h       2010-12-07
> 04:12:15 UTC (rev 33524)
> @@ -124,7 +124,7 @@
>  int CTX_py_init_get(bContext *C);
>  void CTX_py_init_set(bContext *C, int value);
>
> -void *CTX_py_dict_get(bContext *C);
> +void *CTX_py_dict_get(const bContext *C);
>  void CTX_py_dict_set(bContext *C, void *value);
>
>  /* Window Manager Context */
>
> Modified: trunk/blender/source/blender/blenkernel/intern/context.c
> ===================================================================
> --- trunk/blender/source/blender/blenkernel/intern/context.c    2010-12-07
> 01:56:32 UTC (rev 33523)
> +++ trunk/blender/source/blender/blenkernel/intern/context.c    2010-12-07
> 04:12:15 UTC (rev 33524)
> @@ -179,7 +179,7 @@
>        C->data.py_init= value;
>  }
>
> -void *CTX_py_dict_get(bContext *C)
> +void *CTX_py_dict_get(const bContext *C)
>  {
>        return C->data.py_context;
>  }
>
> Modified: trunk/blender/source/blender/makesrna/RNA_types.h
> ===================================================================
> --- trunk/blender/source/blender/makesrna/RNA_types.h   2010-12-07 01:56:32
> UTC (rev 33523)
> +++ trunk/blender/source/blender/makesrna/RNA_types.h   2010-12-07 04:12:15
> UTC (rev 33524)
> @@ -311,9 +311,9 @@
>  } StructFlag;
>
>  typedef int (*StructValidateFunc)(struct PointerRNA *ptr, void *data, int
> *have_function);
> -typedef int (*StructCallbackFunc)(struct PointerRNA *ptr, struct
> FunctionRNA *func, ParameterList *list);
> +typedef int (*StructCallbackFunc)(struct bContext *C, struct PointerRNA
> *ptr, struct FunctionRNA *func, ParameterList *list);
>  typedef void (*StructFreeFunc)(void *data);
> -typedef struct StructRNA *(*StructRegisterFunc)(const struct bContext *C,
> struct ReportList *reports, void *data,
> +typedef struct StructRNA *(*StructRegisterFunc)(struct bContext *C, struct
> ReportList *reports, void *data,
>        const char *identifier, StructValidateFunc validate,
> StructCallbackFunc call, StructFreeFunc free);
>  typedef void (*StructUnregisterFunc)(const struct bContext *C, struct
> StructRNA *type);
>
> @@ -333,9 +333,9 @@
>  typedef struct ExtensionRNA {
>        void *data;
>        StructRNA *srna;
> -
> -       int (*call)(PointerRNA *, FunctionRNA *, ParameterList *);
> -       void (*free)(void *data);
> +       StructCallbackFunc call;
> +       StructFreeFunc free;
> +
>  } ExtensionRNA;
>
>  /* fake struct definitions, needed otherwise collections end up owning the
> C
>
> Modified: trunk/blender/source/blender/makesrna/intern/rna_animation.c
> ===================================================================
> --- trunk/blender/source/blender/makesrna/intern/rna_animation.c
>  2010-12-07 01:56:32 UTC (rev 33523)
> +++ trunk/blender/source/blender/makesrna/intern/rna_animation.c
>  2010-12-07 04:12:15 UTC (rev 33524)
> @@ -80,7 +80,7 @@
>                RNA_parameter_set_lookup(&list, "context", &C);
>
>                /* execute the function */
> -               ksi->ext.call(&ptr, func, &list);
> +               ksi->ext.call(C, &ptr, func, &list);
>
>                /* read the result */
>                RNA_parameter_get_lookup(&list, "ok", &ret);
> @@ -107,7 +107,7 @@
>                RNA_parameter_set_lookup(&list, "ks", &ks);
>
>                /* execute the function */
> -               ksi->ext.call(&ptr, func, &list);
> +               ksi->ext.call(C, &ptr, func, &list);
>        RNA_parameter_list_free(&list);
>  }
>
> @@ -129,7 +129,7 @@
>                RNA_parameter_set_lookup(&list, "data", data);
>
>                /* execute the function */
> -               ksi->ext.call(&ptr, func, &list);
> +               ksi->ext.call(C, &ptr, func, &list);
>        RNA_parameter_list_free(&list);
>  }
>
>
> Modified: trunk/blender/source/blender/makesrna/intern/rna_render.c
> ===================================================================
> --- trunk/blender/source/blender/makesrna/intern/rna_render.c   2010-12-07
> 01:56:32 UTC (rev 33523)
> +++ trunk/blender/source/blender/makesrna/intern/rna_render.c   2010-12-07
> 04:12:15 UTC (rev 33524)
> @@ -91,7 +91,7 @@
>
>        RNA_parameter_list_create(&list, &ptr, func);
>        RNA_parameter_set_lookup(&list, "scene", &scene);
> -       engine->type->ext.call(&ptr, func, &list);
> +       engine->type->ext.call(NULL, &ptr, func, &list);
>
>        RNA_parameter_list_free(&list);
>  }
>
> Modified: trunk/blender/source/blender/makesrna/intern/rna_ui.c
> ===================================================================
> --- trunk/blender/source/blender/makesrna/intern/rna_ui.c       2010-12-07
> 01:56:32 UTC (rev 33523)
> +++ trunk/blender/source/blender/makesrna/intern/rna_ui.c       2010-12-07
> 04:12:15 UTC (rev 33524)
> @@ -101,7 +101,7 @@
>
>        RNA_parameter_list_create(&list, &ptr, func);
>        RNA_parameter_set_lookup(&list, "context", &C);
> -       pt->ext.call(&ptr, func, &list);
> +       pt->ext.call((bContext *)C, &ptr, func, &list);
>
>        RNA_parameter_get_lookup(&list, "visible", &ret);
>        visible= *(int*)ret;
> @@ -122,7 +122,7 @@
>
>        RNA_parameter_list_create(&list, &ptr, func);
>        RNA_parameter_set_lookup(&list, "context", &C);
> -       pnl->type->ext.call(&ptr, func, &list);
> +       pnl->type->ext.call((bContext *)C, &ptr, func, &list);
>
>        RNA_parameter_list_free(&list);
>  }
> @@ -138,7 +138,7 @@
>
>        RNA_parameter_list_create(&list, &ptr, func);
>        RNA_parameter_set_lookup(&list, "context", &C);
> -       pnl->type->ext.call(&ptr, func, &list);
> +       pnl->type->ext.call((bContext *)C, &ptr, func, &list);
>
>        RNA_parameter_list_free(&list);
>  }
> @@ -163,7 +163,7 @@
>                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)
> +static StructRNA *rna_Panel_register(bContext *C, ReportList *reports,
> void *data, const char *identifier, StructValidateFunc validate,
> StructCallbackFunc call, StructFreeFunc free)
>  {
>        ARegionType *art;
>        PanelType *pt, dummypt = {0};
> @@ -241,7 +241,7 @@
>
>        RNA_parameter_list_create(&list, &htr, func);
>        RNA_parameter_set_lookup(&list, "context", &C);
> -       hdr->type->ext.call(&htr, func, &list);
> +       hdr->type->ext.call((bContext *)C, &htr, func, &list);
>
>        RNA_parameter_list_free(&list);
>  }
> @@ -266,7 +266,7 @@
>                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)
> +static StructRNA *rna_Header_register(bContext *C, ReportList *reports,
> void *data, const char *identifier, StructValidateFunc validate,
> StructCallbackFunc call, StructFreeFunc free)
>  {
>        ARegionType *art;
>        HeaderType *ht, dummyht = {0};
> @@ -341,7 +341,7 @@
>
>        RNA_parameter_list_create(&list, &ptr, func);
>        RNA_parameter_set_lookup(&list, "context", &C);
> -       pt->ext.call(&ptr, func, &list);
> +       pt->ext.call((bContext *)C, &ptr, func, &list);
>
>        RNA_parameter_get_lookup(&list, "visible", &ret);
>        visible= *(int*)ret;
> @@ -362,7 +362,7 @@
>
>        RNA_parameter_list_create(&list, &mtr, func);
>        RNA_parameter_set_lookup(&list, "context", &C);
> -       hdr->type->ext.call(&mtr, func, &list);
> +       hdr->type->ext.call((bContext *)C, &mtr, func, &list);
>
>        RNA_parameter_list_free(&list);
>  }
> @@ -385,7 +385,7 @@
>                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)
> +static StructRNA *rna_Menu_register(bContext *C, ReportList *reports, void
> *data, const char *identifier, StructValidateFunc validate,
> StructCallbackFunc call, StructFreeFunc free)
>  {
>        MenuType *mt, dummymt = {0};
>        Menu dummymenu= {0};
>
> Modified: trunk/blender/source/blender/makesrna/intern/rna_wm.c
> ===================================================================
> --- trunk/blender/source/blender/makesrna/intern/rna_wm.c       2010-12-07
> 01:56:32 UTC (rev 33523)
> +++ trunk/blender/source/blender/makesrna/intern/rna_wm.c       2010-12-07
> 04:12:15 UTC (rev 33524)
> @@ -693,7 +693,7 @@
>
>        RNA_parameter_list_create(&list, &ptr, func);
>        RNA_parameter_set_lookup(&list, "context", &C);
> -       ot->ext.call(&ptr, func, &list);
> +       ot->ext.call(C, &ptr, func, &list);
>
>        RNA_parameter_get_lookup(&list, "visible", &ret);
>        visible= *(int*)ret;
> @@ -716,7 +716,7 @@
>
>        RNA_parameter_list_create(&list, &opr, func);
>        RNA_parameter_set_lookup(&list, "context", &C);
> -       op->type->ext.call(&opr, func, &list);
> +       op->type->ext.call(C, &opr, func, &list);
>
>        RNA_parameter_get_lookup(&list, "result", &ret);
>        result= *(int*)ret;
> @@ -740,7 +740,7 @@
>
>        RNA_parameter_list_create(&list, &opr, func);
>        RNA_parameter_set_lookup(&list, "context", &C);
> -       op->type->ext.call(&opr, func, &list);
> +       op->type->ext.call(C, &opr, func, &list);
>
>        RNA_parameter_get_lookup(&list, "result", &ret);
>        result= *(int*)ret;
> @@ -764,7 +764,7 @@
>        RNA_parameter_list_create(&list, &opr, func);
>        RNA_parameter_set_lookup(&list, "context", &C);
>        RNA_parameter_set_lookup(&list, "event", &event);
> -       op->type->ext.call(&opr, func, &list);
> +       op->type->ext.call(C, &opr, func, &list);
>
>        RNA_parameter_get_lookup(&list, "result", &ret);
>        result= *(int*)ret;
> @@ -789,7 +789,7 @@
>        RNA_parameter_list_create(&list, &opr, func);
>        RNA_parameter_set_lookup(&list, "context", &C);
>        RNA_parameter_set_lookup(&list, "event", &event);
> -       op->type->ext.call(&opr, func, &list);
> +       op->type->ext.call(C, &opr, func, &list);
>
>        RNA_parameter_get_lookup(&list, "result", &ret);
>        result= *(int*)ret;
> @@ -810,7 +810,7 @@
>
>        RNA_parameter_list_create(&list, &opr, func);
>        RNA_parameter_set_lookup(&list, "context", &C);
> -       op->type->ext.call(&opr, func, &list);
> +       op->type->ext.call(C, &opr, func, &list);
>
>        RNA_parameter_list_free(&list);
>  }
> @@ -894,7 +894,7 @@
>  }
>
>
> -static StructRNA *rna_MacroOperator_register(const bContext *C, ReportList
> *reports, void *data, const char *identifier, StructValidateFunc validate,
> StructCallbackFunc call, StructFreeFunc free)
> +static StructRNA *rna_MacroOperator_register(bContext *C, ReportList
> *reports, void *data, const char *identifier, StructValidateFunc validate,
> StructCallbackFunc call, StructFreeFunc free)
>  {
>        wmOperatorType dummyot = {0};
>        wmOperator dummyop= {0};
>
> Modified: trunk/blender/source/blender/python/intern/bpy.c
> ===================================================================
> --- trunk/blender/source/blender/python/intern/bpy.c    2010-12-07 01:56:32
> UTC (rev 33523)
> +++ trunk/blender/source/blender/python/intern/bpy.c    2010-12-07 04:12:15
> UTC (rev 33524)
> @@ -223,7 +223,7 @@
>
> @@ Diff output truncated at 10240 characters. @@
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>


More information about the Bf-committers mailing list