Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Fri, 11 Aug 2017 14:23:49 +0000 (00:23 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 11 Aug 2017 14:23:49 +0000 (00:23 +1000)
25 files changed:
1  2 
source/blender/blenkernel/BKE_curve.h
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/mball.c
source/blender/blenkernel/intern/node.c
source/blender/blenlib/BLI_ghash.h
source/blender/editors/animation/keyframing.c
source/blender/editors/include/ED_armature.h
source/blender/editors/interface/interface_layout.c
source/blender/editors/object/object_transform.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/RNA_define.h
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_armature.c
source/blender/makesrna/intern/rna_curve_api.c
source/blender/makesrna/intern/rna_internal_types.h
source/blender/makesrna/intern/rna_meta_api.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_render.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/makesrna/intern/rna_wm.c
source/blender/python/intern/bpy_manipulator_wrap.c
source/blender/windowmanager/intern/wm_operators.c
source/blender/windowmanager/manipulators/intern/wm_manipulator_type.c
source/blenderplayer/bad_level_call_stubs/stubs.c

Simple merge
Simple merge
Simple merge
index 4da262daf8dae9b648615ae9fdd456abd682bc87,be6808567bbe9ae7ad16e513a5bd411547e8675a..b518b0cb5b03aa9e5392aa6e3ff1b6a2b9f408ac
  #ifdef RNA_RUNTIME
  static void rna_Curve_transform(Curve *cu, float *mat, int shape_keys)
  {
-       BKE_curve_transform(cu, (float (*)[4])mat, shape_keys);
+       BKE_curve_transform(cu, (float (*)[4])mat, shape_keys, true);
  
 -      DAG_id_tag_update(&cu->id, 0);
 +      DEG_id_tag_update(&cu->id, 0);
  }
 +
 +static void rna_Curve_update_gpu_tag(Curve *cu)
 +{
 +      BKE_curve_batch_cache_dirty(cu, BKE_CURVE_BATCH_DIRTY_ALL);
 +}
 +
  #else
  
  void RNA_api_curve(StructRNA *srna)
index 117162babd5171470a670118ec08de96aa98e404,4c3fa787b94419cd3dd50d1298a393bf4d72fd62..46547677dfd9fdcfa92484120857d8a9d21e5948
@@@ -45,9 -45,9 +45,9 @@@
  #ifdef RNA_RUNTIME
  static void rna_Meta_transform(struct MetaBall *mb, float *mat)
  {
-       BKE_mball_transform(mb, (float (*)[4])mat);
+       BKE_mball_transform(mb, (float (*)[4])mat, true);
  
 -      DAG_id_tag_update(&mb->id, 0);
 +      DEG_id_tag_update(&mb->id, 0);
  }
  #else
  
index db9fcdb377a052f34a29755920482261d13ac37f,0000000000000000000000000000000000000000..3aca0cda224a0a58cec2f259f075559ef659f352
mode 100644,000000..100644
--- /dev/null
@@@ -1,247 -1,0 +1,247 @@@
-       RNA_def_struct_identifier(wt->srna, wt->idname);
 +/*
 + * ***** BEGIN GPL LICENSE BLOCK *****
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
 + * as published by the Free Software Foundation; either version 2
 + * of the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software Foundation,
 + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 + *
 + * ***** END GPL LICENSE BLOCK *****
 + */
 +
 +/** \file blender/python/intern/bpy_manipulator_wrap.c
 + *  \ingroup pythonintern
 + *
 + * This file is so Python can define widget-group's that C can call into.
 + * The generic callback functions for Python widget-group are defines in
 + * 'rna_wm.c', some calling into functions here to do python specific
 + * functionality.
 + *
 + * \note This follows 'bpy_operator_wrap.c' very closely.
 + * Keep in sync unless there is good reason not to!
 + */
 +
 +#include <Python.h>
 +
 +#include "BLI_utildefines.h"
 +
 +#include "WM_api.h"
 +#include "WM_types.h"
 +
 +#include "RNA_access.h"
 +#include "RNA_define.h"
 +#include "RNA_enum_types.h"
 +
 +#include "bpy_rna.h"
 +#include "bpy_intern_string.h"
 +#include "bpy_manipulator_wrap.h"  /* own include */
 +
 +/* we may want to add, but not now */
 +
 +/* -------------------------------------------------------------------- */
 +
 +/** \name Manipulator
 + * \{ */
 +
 +
 +static bool bpy_manipulatortype_target_property_def(
 +        wmManipulatorType *wt, PyObject *item)
 +{
 +      /* Note: names based on 'rna_rna.c' */
 +      PyObject *empty_tuple = PyTuple_New(0);
 +
 +      struct {
 +              char *id;
 +              char *type_id; int type;
 +              int array_length;
 +      } params = {
 +              .id = NULL, /* not optional */
 +              .type = PROP_FLOAT,
 +              .type_id = NULL,
 +              .array_length = 1,
 +      };
 +
 +      static const char * const _keywords[] = {"id", "type", "array_length", NULL};
 +#define KW_FMT "|$ssi:register_class"
 +#if PY_VERSION_HEX >= 0x03060000
 +      static _PyArg_Parser _parser = {KW_FMT, _keywords, 0};
 +      if (!_PyArg_ParseTupleAndKeywordsFast(
 +              empty_tuple, item,
 +              &_parser,
 +              &params.id,
 +              &params.type_id,
 +              &params.array_length))
 +#else
 +      if (!PyArg_ParseTupleAndKeywords(
 +              empty_tuple, item,
 +              KW_FMT, (char **)_keywords,
 +              &params.id,
 +              &params.type_id,
 +              &params.array_length))
 +#endif
 +      {
 +              goto fail;
 +      }
 +#undef KW_FMT
 +
 +      if (params.id == NULL) {
 +              PyErr_SetString(PyExc_ValueError, "'id' argument not given");
 +              goto fail;
 +      }
 +
 +      if ((params.type_id != NULL) &&
 +          pyrna_enum_value_from_id(
 +              rna_enum_property_type_items, params.type_id, &params.type, "'type' enum value") == -1)
 +      {
 +              goto fail;
 +      }
 +      else {
 +              params.type = rna_enum_property_type_items[params.type].value;
 +      }
 +
 +      if ((params.array_length < 1 || params.array_length > RNA_MAX_ARRAY_LENGTH)) {
 +              PyErr_SetString(PyExc_ValueError, "'array_length' out of range");
 +              goto fail;
 +      }
 +
 +      WM_manipulatortype_target_property_def(wt, params.id, params.type, params.array_length);
 +      Py_DECREF(empty_tuple);
 +      return true;
 +
 +fail:
 +      Py_DECREF(empty_tuple);
 +      return false;
 +}
 +
 +static void manipulator_properties_init(wmManipulatorType *wt)
 +{
 +      PyTypeObject *py_class = wt->ext.data;
 +      RNA_struct_blender_type_set(wt->ext.srna, wt);
 +
 +      /* only call this so pyrna_deferred_register_class gives a useful error
 +       * WM_operatortype_append_ptr will call RNA_def_struct_identifier
 +       * later */
++      RNA_def_struct_identifier(&BLENDER_RNA, wt->srna, wt->idname);
 +
 +      if (pyrna_deferred_register_class(wt->srna, py_class) != 0) {
 +              PyErr_Print(); /* failed to register operator props */
 +              PyErr_Clear();
 +      }
 +
 +      /* Extract target property definitions from 'bl_target_properties' */
 +      {
 +              /* picky developers will notice that 'bl_targets' won't work with inheritance
 +               * get direct from the dict to avoid raising a load of attribute errors (yes this isnt ideal) - campbell */
 +              PyObject *py_class_dict = py_class->tp_dict;
 +              PyObject *bl_target_properties = PyDict_GetItem(py_class_dict, bpy_intern_str_bl_target_properties);
 +
 +              /* Some widgets may only exist to activate operators. */
 +              if (bl_target_properties != NULL) {
 +                      PyObject *bl_target_properties_fast;
 +                      if (!(bl_target_properties_fast = PySequence_Fast(
 +                                bl_target_properties, "bl_target_properties sequence")))
 +                      {
 +                              /* PySequence_Fast sets the error */
 +                              PyErr_Print();
 +                              PyErr_Clear();
 +                              return;
 +                      }
 +
 +                      const uint items_len = PySequence_Fast_GET_SIZE(bl_target_properties_fast);
 +                      PyObject **items = PySequence_Fast_ITEMS(bl_target_properties_fast);
 +
 +                      for (uint i = 0; i < items_len; i++) {
 +                              if (!bpy_manipulatortype_target_property_def(wt, items[i])) {
 +                                      PyErr_Print();
 +                                      PyErr_Clear();
 +                                      break;
 +                              }
 +                      }
 +
 +                      Py_DECREF(bl_target_properties_fast);
 +              }
 +      }
 +}
 +
 +void BPY_RNA_manipulator_wrapper(wmManipulatorType *wt, void *userdata)
 +{
 +      /* take care not to overwrite anything set in
 +       * WM_manipulatormaptype_group_link_ptr before opfunc() is called */
 +      StructRNA *srna = wt->srna;
 +      *wt = *((wmManipulatorType *)userdata);
 +      wt->srna = srna; /* restore */
 +
 +      /* don't do translations here yet */
 +#if 0
 +      /* Use i18n context from ext.srna if possible (py manipulatorgroups). */
 +      if (wt->ext.srna) {
 +              RNA_def_struct_translation_context(wt->srna, RNA_struct_translation_context(wt->ext.srna));
 +      }
 +#endif
 +
 +      wt->struct_size = sizeof(wmManipulator);
 +
 +      manipulator_properties_init(wt);
 +}
 +
 +/** \} */
 +
 +
 +/* -------------------------------------------------------------------- */
 +
 +/** \name Manipulator Group
 + * \{ */
 +
 +static void manipulatorgroup_properties_init(wmManipulatorGroupType *wgt)
 +{
 +#ifdef USE_SRNA
 +      PyTypeObject *py_class = wgt->ext.data;
 +#endif
 +      RNA_struct_blender_type_set(wgt->ext.srna, wgt);
 +
 +#ifdef USE_SRNA
 +      /* only call this so pyrna_deferred_register_class gives a useful error
 +       * WM_operatortype_append_ptr will call RNA_def_struct_identifier
 +       * later */
 +      RNA_def_struct_identifier(wgt->srna, wgt->idname);
 +
 +      if (pyrna_deferred_register_class(wgt->srna, py_class) != 0) {
 +              PyErr_Print(); /* failed to register operator props */
 +              PyErr_Clear();
 +      }
 +#endif
 +}
 +
 +void BPY_RNA_manipulatorgroup_wrapper(wmManipulatorGroupType *wgt, void *userdata)
 +{
 +      /* take care not to overwrite anything set in
 +       * WM_manipulatormaptype_group_link_ptr before opfunc() is called */
 +#ifdef USE_SRNA
 +      StructRNA *srna = wgt->srna;
 +#endif
 +      *wgt = *((wmManipulatorGroupType *)userdata);
 +#ifdef USE_SRNA
 +      wgt->srna = srna; /* restore */
 +#endif
 +
 +#ifdef USE_SRNA
 +      /* Use i18n context from ext.srna if possible (py manipulatorgroups). */
 +      if (wgt->ext.srna) {
 +              RNA_def_struct_translation_context(wgt->srna, RNA_struct_translation_context(wgt->ext.srna));
 +      }
 +#endif
 +
 +      manipulatorgroup_properties_init(wgt);
 +}
 +
 +/** \} */
 +
index 18265319024c2859c14db2356bcb47dee6a223d0,0000000000000000000000000000000000000000..b2f6a251d1f3b285174286a1502d7d18a34dc739
mode 100644,000000..100644
--- /dev/null
@@@ -1,207 -1,0 +1,207 @@@
-       RNA_def_struct_identifier(wt->srna, wt->idname);
 +/*
 + * ***** BEGIN GPL LICENSE BLOCK *****
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
 + * as published by the Free Software Foundation; either version 2
 + * of the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software Foundation,
 + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 + *
 + * ***** END GPL LICENSE BLOCK *****
 + */
 +
 +/** \file blender/windowmanager/manipulators/intern/wm_manipulator_type.c
 + *  \ingroup wm
 + */
 +
 +#include "BKE_context.h"
 +
 +#include "BLI_ghash.h"
 +#include "BLI_string.h"
 +#include "BLI_string_utils.h"
 +
 +#include "BKE_main.h"
 +
 +#include "DNA_screen_types.h"
 +#include "DNA_space_types.h"
 +
 +#include "MEM_guardedalloc.h"
 +
 +#include "RNA_access.h"
 +#include "RNA_define.h"
 +
 +#include "WM_api.h"
 +#include "WM_types.h"
 +
 +#include "ED_screen.h"
 +
 +/* only for own init/exit calls (wm_manipulatortype_init/wm_manipulatortype_free) */
 +#include "wm.h"
 +
 +/* own includes */
 +#include "wm_manipulator_wmapi.h"
 +#include "wm_manipulator_intern.h"
 +
 +
 +/** \name Manipulator Type Append
 + *
 + * \note This follows conventions from #WM_operatortype_find #WM_operatortype_append & friends.
 + * \{ */
 +
 +static GHash *global_manipulatortype_hash = NULL;
 +
 +const wmManipulatorType *WM_manipulatortype_find(const char *idname, bool quiet)
 +{
 +      if (idname[0]) {
 +              wmManipulatorType *wt;
 +
 +              wt = BLI_ghash_lookup(global_manipulatortype_hash, idname);
 +              if (wt) {
 +                      return wt;
 +              }
 +
 +              if (!quiet) {
 +                      printf("search for unknown manipulator '%s'\n", idname);
 +              }
 +      }
 +      else {
 +              if (!quiet) {
 +                      printf("search for empty manipulator\n");
 +              }
 +      }
 +
 +      return NULL;
 +}
 +
 +/* caller must free */
 +void WM_manipulatortype_iter(GHashIterator *ghi)
 +{
 +      BLI_ghashIterator_init(ghi, global_manipulatortype_hash);
 +}
 +
 +static wmManipulatorType *wm_manipulatortype_append__begin(void)
 +{
 +      wmManipulatorType *wt = MEM_callocN(sizeof(wmManipulatorType), "manipulatortype");
 +      wt->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_ManipulatorProperties);
 +#if 0
 +      /* Set the default i18n context now, so that opfunc can redefine it if needed! */
 +      RNA_def_struct_translation_context(ot->srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
 +      ot->translation_context = BLT_I18NCONTEXT_OPERATOR_DEFAULT;
 +#endif
 +      return wt;
 +}
 +static void wm_manipulatortype_append__end(wmManipulatorType *wt)
 +{
 +      BLI_assert(wt->struct_size >= sizeof(wmManipulator));
 +
++      RNA_def_struct_identifier(&BLENDER_RNA, wt->srna, wt->idname);
 +
 +      BLI_ghash_insert(global_manipulatortype_hash, (void *)wt->idname, wt);
 +}
 +
 +void WM_manipulatortype_append(void (*wtfunc)(struct wmManipulatorType *))
 +{
 +      wmManipulatorType *wt = wm_manipulatortype_append__begin();
 +      wtfunc(wt);
 +      wm_manipulatortype_append__end(wt);
 +}
 +
 +void WM_manipulatortype_append_ptr(void (*wtfunc)(struct wmManipulatorType *, void *), void *userdata)
 +{
 +      wmManipulatorType *mt = wm_manipulatortype_append__begin();
 +      wtfunc(mt, userdata);
 +      wm_manipulatortype_append__end(mt);
 +}
 +
 +/**
 + * Free but don't remove from ghash.
 + */
 +static void manipulatortype_free(wmManipulatorType *wt)
 +{
 +      BLI_freelistN(&wt->target_property_defs);
 +      MEM_freeN(wt);
 +}
 +
 +/**
 + * \param C: May be NULL.
 + */
 +static void manipulatortype_unlink(
 +        bContext *C, Main *bmain, wmManipulatorType *wt)
 +{
 +      /* Free instances. */
 +      for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
 +              for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
 +                      for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
 +                              ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
 +                              for (ARegion *ar = lb->first; ar; ar = ar->next) {
 +                                      wmManipulatorMap *mmap = ar->manipulator_map;
 +                                      if (mmap) {
 +                                              wmManipulatorGroup *mgroup;
 +                                              for (mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) {
 +                                                      for (wmManipulator *mpr = mgroup->manipulators.first, *mpr_next;  mpr; mpr = mpr_next) {
 +                                                              mpr_next = mpr->next;
 +                                                              BLI_assert(mgroup->parent_mmap == mmap);
 +                                                              if (mpr->type == wt) {
 +                                                                      WM_manipulator_unlink(&mgroup->manipulators, mgroup->parent_mmap, mpr, C);
 +                                                                      ED_region_tag_redraw(ar);
 +                                                              }
 +                                                      }
 +                                              }
 +                                      }
 +                              }
 +                      }
 +              }
 +      }
 +}
 +
 +void WM_manipulatortype_remove_ptr(bContext *C, Main *bmain, wmManipulatorType *wt)
 +{
 +      BLI_assert(wt == WM_manipulatortype_find(wt->idname, false));
 +
 +      BLI_ghash_remove(global_manipulatortype_hash, wt->idname, NULL, NULL);
 +
 +      manipulatortype_unlink(C, bmain, wt);
 +
 +      manipulatortype_free(wt);
 +}
 +
 +bool WM_manipulatortype_remove(bContext *C, Main *bmain, const char *idname)
 +{
 +      wmManipulatorType *wt = BLI_ghash_lookup(global_manipulatortype_hash, idname);
 +
 +      if (wt == NULL) {
 +              return false;
 +      }
 +
 +      WM_manipulatortype_remove_ptr(C, bmain, wt);
 +
 +      return true;
 +}
 +
 +static void wm_manipulatortype_ghash_free_cb(wmManipulatorType *mt)
 +{
 +      manipulatortype_free(mt);
 +}
 +
 +void wm_manipulatortype_free(void)
 +{
 +      BLI_ghash_free(global_manipulatortype_hash, NULL, (GHashValFreeFP)wm_manipulatortype_ghash_free_cb);
 +      global_manipulatortype_hash = NULL;
 +}
 +
 +/* called on initialize WM_init() */
 +void wm_manipulatortype_init(void)
 +{
 +      /* reserve size is set based on blender default setup */
 +      global_manipulatortype_hash = BLI_ghash_str_new_ex("wm_manipulatortype_init gh", 128);
 +}
 +
 +/** \} */