Commit: 323a7ab944132335f27ba21519df161d7a3351c9
Author: Campbell Barton
Date:   Thu Aug 31 21:57:14 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB323a7ab944132335f27ba21519df161d7a3351c9

Merge branch 'master' into blender2.8

===================================================================



===================================================================

diff --cc source/blender/makesrna/intern/rna_wm_manipulator.c
index 8b1e681f227,00000000000..3e04a0a8233
mode 100644,000000..100644
--- a/source/blender/makesrna/intern/rna_wm_manipulator.c
+++ b/source/blender/makesrna/intern/rna_wm_manipulator.c
@@@ -1,1309 -1,0 +1,1309 @@@
 +/*
 + * ***** 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/makesrna/intern/rna_wm_manipulator.c
 + *  \ingroup RNA
 + */
 +
 +#include <stdlib.h>
 +
 +#include "DNA_screen_types.h"
 +#include "DNA_space_types.h"
 +#include "DNA_userdef_types.h"
 +#include "DNA_view3d_types.h"
 +#include "DNA_windowmanager_types.h"
 +
 +#include "BLI_utildefines.h"
 +#include "BLI_string_utils.h"
 +
 +#include "BLT_translation.h"
 +
 +#include "RNA_access.h"
 +#include "RNA_define.h"
 +#include "RNA_enum_types.h"
 +
 +#include "rna_internal.h"
 +
 +#include "WM_api.h"
 +#include "WM_types.h"
 +
 +#ifdef RNA_RUNTIME
 +/* enum definitions */
 +#endif /* RNA_RUNTIME */
 +
 +#ifdef RNA_RUNTIME
 +
 +#include <assert.h>
 +
 +#include "WM_api.h"
 +#include "WM_types.h"
 +
 +#include "DNA_workspace_types.h"
 +
 +#include "ED_screen.h"
 +
 +#include "UI_interface.h"
 +
 +#include "BKE_global.h"
 +#include "BKE_idprop.h"
 +#include "BKE_workspace.h"
 +#include "BKE_utildefines.h"
 +
 +#include "MEM_guardedalloc.h"
 +
 +#ifdef WITH_PYTHON
 +#  include "BPY_extern.h"
 +#endif
 +
 +/* -------------------------------------------------------------------- */
 +
 +/** \name Manipulator API
 + * \{ */
 +
 +static void rna_manipulator_draw_cb(
 +        const struct bContext *C, struct wmManipulator *mpr)
 +{
 +      extern FunctionRNA rna_Manipulator_draw_func;
 +      wmManipulatorGroup *mgroup = mpr->parent_mgroup;
 +      PointerRNA mpr_ptr;
 +      ParameterList list;
 +      FunctionRNA *func;
 +      RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr);
 +      /* RNA_struct_find_function(&mpr_ptr, "draw"); */
 +      func = &rna_Manipulator_draw_func;
 +      RNA_parameter_list_create(&list, &mpr_ptr, func);
 +      RNA_parameter_set_lookup(&list, "context", &C);
 +      mgroup->type->ext.call((bContext *)C, &mpr_ptr, func, &list);
 +      RNA_parameter_list_free(&list);
 +}
 +
 +static void rna_manipulator_draw_select_cb(
 +        const struct bContext *C, struct wmManipulator *mpr, int select_id)
 +{
 +      extern FunctionRNA rna_Manipulator_draw_select_func;
 +      wmManipulatorGroup *mgroup = mpr->parent_mgroup;
 +      PointerRNA mpr_ptr;
 +      ParameterList list;
 +      FunctionRNA *func;
 +      RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr);
 +      /* RNA_struct_find_function(&mpr_ptr, "draw_select"); */
 +      func = &rna_Manipulator_draw_select_func;
 +      RNA_parameter_list_create(&list, &mpr_ptr, func);
 +      RNA_parameter_set_lookup(&list, "context", &C);
 +      RNA_parameter_set_lookup(&list, "select_id", &select_id);
 +      mgroup->type->ext.call((bContext *)C, &mpr_ptr, func, &list);
 +      RNA_parameter_list_free(&list);
 +}
 +
 +static int rna_manipulator_test_select_cb(
 +        struct bContext *C, struct wmManipulator *mpr, const struct wmEvent 
*event)
 +{
 +      extern FunctionRNA rna_Manipulator_test_select_func;
 +      wmManipulatorGroup *mgroup = mpr->parent_mgroup;
 +      PointerRNA mpr_ptr;
 +      ParameterList list;
 +      FunctionRNA *func;
 +      RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr);
 +      /* RNA_struct_find_function(&mpr_ptr, "test_select"); */
 +      func = &rna_Manipulator_test_select_func;
 +      RNA_parameter_list_create(&list, &mpr_ptr, func);
 +      RNA_parameter_set_lookup(&list, "context", &C);
 +      RNA_parameter_set_lookup(&list, "event", &event);
 +      mgroup->type->ext.call((bContext *)C, &mpr_ptr, func, &list);
 +
 +      void *ret;
 +      RNA_parameter_get_lookup(&list, "intersect_id", &ret);
 +      int intersect_id = *(int *)ret;
 +
 +      RNA_parameter_list_free(&list);
 +      return intersect_id;
 +}
 +
 +static int rna_manipulator_modal_cb(
 +        struct bContext *C, struct wmManipulator *mpr, const struct wmEvent 
*event,
 +        eWM_ManipulatorTweak tweak_flag)
 +{
 +      extern FunctionRNA rna_Manipulator_modal_func;
 +      wmManipulatorGroup *mgroup = mpr->parent_mgroup;
 +      PointerRNA mpr_ptr;
 +      ParameterList list;
 +      FunctionRNA *func;
 +      const int tweak_flag_int = tweak_flag;
 +      RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr);
 +      /* RNA_struct_find_function(&mpr_ptr, "modal"); */
 +      func = &rna_Manipulator_modal_func;
 +      RNA_parameter_list_create(&list, &mpr_ptr, func);
 +      RNA_parameter_set_lookup(&list, "context", &C);
 +      RNA_parameter_set_lookup(&list, "event", &event);
 +      RNA_parameter_set_lookup(&list, "tweak", &tweak_flag_int);
 +      mgroup->type->ext.call((bContext *)C, &mpr_ptr, func, &list);
 +
 +      void *ret;
 +      RNA_parameter_get_lookup(&list, "result", &ret);
 +      int ret_enum = *(int *)ret;
 +
 +      RNA_parameter_list_free(&list);
 +      return ret_enum;
 +}
 +
 +static void rna_manipulator_setup_cb(
 +        struct wmManipulator *mpr)
 +{
 +      extern FunctionRNA rna_Manipulator_setup_func;
 +      wmManipulatorGroup *mgroup = mpr->parent_mgroup;
 +      PointerRNA mpr_ptr;
 +      ParameterList list;
 +      FunctionRNA *func;
 +      RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr);
 +      /* RNA_struct_find_function(&mpr_ptr, "setup"); */
 +      func = &rna_Manipulator_setup_func;
 +      RNA_parameter_list_create(&list, &mpr_ptr, func);
 +      mgroup->type->ext.call((bContext *)NULL, &mpr_ptr, func, &list);
 +      RNA_parameter_list_free(&list);
 +}
 +
 +
 +static int rna_manipulator_invoke_cb(
 +        struct bContext *C, struct wmManipulator *mpr, const struct wmEvent 
*event)
 +{
 +      extern FunctionRNA rna_Manipulator_invoke_func;
 +      wmManipulatorGroup *mgroup = mpr->parent_mgroup;
 +      PointerRNA mpr_ptr;
 +      ParameterList list;
 +      FunctionRNA *func;
 +      RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr);
 +      /* RNA_struct_find_function(&mpr_ptr, "invoke"); */
 +      func = &rna_Manipulator_invoke_func;
 +      RNA_parameter_list_create(&list, &mpr_ptr, func);
 +      RNA_parameter_set_lookup(&list, "context", &C);
 +      RNA_parameter_set_lookup(&list, "event", &event);
 +      mgroup->type->ext.call((bContext *)C, &mpr_ptr, func, &list);
 +
 +      void *ret;
 +      RNA_parameter_get_lookup(&list, "result", &ret);
 +      int ret_enum = *(int *)ret;
 +
 +      RNA_parameter_list_free(&list);
 +      return ret_enum;
 +}
 +
 +static void rna_manipulator_exit_cb(
 +        struct bContext *C, struct wmManipulator *mpr, bool cancel)
 +{
 +      extern FunctionRNA rna_Manipulator_exit_func;
 +      wmManipulatorGroup *mgroup = mpr->parent_mgroup;
 +      PointerRNA mpr_ptr;
 +      ParameterList list;
 +      FunctionRNA *func;
 +      RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr);
 +      /* RNA_struct_find_function(&mpr_ptr, "exit"); */
 +      func = &rna_Manipulator_exit_func;
 +      RNA_parameter_list_create(&list, &mpr_ptr, func);
 +      RNA_parameter_set_lookup(&list, "context", &C);
 +      {
 +              int cancel_i = cancel;
 +              RNA_parameter_set_lookup(&list, "cancel", &cancel_i);
 +      }
 +      mgroup->type->ext.call((bContext *)C, &mpr_ptr, func, &list);
 +      RNA_parameter_list_free(&list);
 +}
 +
 +static void rna_manipulator_select_refresh_cb(
 +        struct wmManipulator *mpr)
 +{
 +      extern FunctionRNA rna_Manipulator_select_refresh_func;
 +      wmManipulatorGroup *mgroup = mpr->parent_mgroup;
 +      PointerRNA mpr_ptr;
 +      ParameterList list;
 +      FunctionRNA *func;
 +      RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr);
 +      /* RNA_struct_find_function(&mpr_ptr, "select_refresh"); */
 +      func = &rna_Manipulator_select_refresh_func;
 +      RNA_parameter_list_create(&list, &mpr_ptr, func);
 +      mgroup->type->ext.call((bContext *)NULL, &mpr_ptr, func, &list);
 +      RNA_parameter_list_free(&list);
 +}
 +
 +/* just to work around 'const char *' warning and to ensure this is a python 
op */
 +static void rna_Manipulator_bl_idname_set(PointerRNA *ptr, const char *value)
 +{
 +      wmManipulator *data = ptr->data;
 +      char *str = (char *)data->type->idname;
 +      if (!str[0]) {
 +              BLI_strncpy(str, value, MAX_NAME);    /* utf8 already ensured */
 +      }
 +      else {
 +              assert(!"setting the bl_idname on a non-builtin operator");
 +      }
 +}
 +
 +static wmManipulator *rna_ManipulatorProperties_find_operator(PointerRNA *ptr)
 +{
 +#if 0
 +      wmWindowManager *wm = ptr->id.data;
 +#endif
 +
 +      /* We could try workaruond this lookup, but not trivial. */
 +      for (bScreen *screen = G.main->screen.first; screen; screen = 
screen->id.next) {
 +              IDProperty *properties = ptr->data;
 +              for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
 +                      for (ARegion *ar = sa->regionbase.first; ar; ar = 
ar->next) {
 +                              if (ar->manipulator_map) {
 +                                      wmManipulatorMap *mmap = 
ar->manipulator_map;
 +                                      for (wmManipulatorGroup *mgroup = 
WM_manipulatormap_group_list(mmap)->first;
 +                                           mgroup;
 +                                           mgroup = mgroup->next)
 +                                      {
 +                                              for (wmManipulator *mpr = 
mgroup->manipulators.first; mpr; mpr = mpr->next) {
 +                                                      if (mpr->properties == 
properties) {
 +                                                              return mpr;
 +                                                      }
 +                                              }
 +                                      }
 +                              }
 +                      }
 +              }
 +      }
 +      return NULL;
 +}
 +
 +static StructRNA *rna_ManipulatorProperties_refine(PointerRNA *ptr)
 +{
 +      wmManipulator *mpr = rna_ManipulatorProperties_find_operator(ptr);
 +
 +      if (mpr)
 +              return mpr->type->srna;
 +      else
 +              return ptr->type;
 +}
 +
 +static IDProperty *rna_ManipulatorProperties_idprops(PointerRNA *ptr, bool 
create)
 +{
 +      if (create && !ptr->data) {
 +              IDPropertyTemplate val = {0};
 +              ptr->data = IDP_New(IDP_GROUP, &val, "RNA_ManipulatorProperties 
group");
 +      }
 +
 +      return ptr->data;
 +}
 +
 +static PointerRNA rna_Manipulator_properties_get(PointerRNA *ptr)
 +{
 +      wmMan

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to