Commit: 4705682151b19fbaa5cccd85cbc8b0d00f743e30
Author: Campbell Barton
Date:   Fri Jul 13 12:52:10 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB4705682151b19fbaa5cccd85cbc8b0d00f743e30

Merge branch 'master' into blender2.8

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



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

diff --cc source/blender/windowmanager/WM_api.h
index ccbed11e6e8,2ae2a65e2c9..68cbc3828fc
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@@ -424,9 -353,22 +403,30 @@@ char             *WM_prop_pystring_assign(struct 
b
  void          WM_operator_bl_idname(char *to, const char *from);
  void          WM_operator_py_idname(char *to, const char *from);
  bool        WM_operator_py_idname_ok_or_report(struct ReportList *reports, 
const char *classname, const char *idname);
 -
 +const char *WM_context_member_from_ptr(struct bContext *C, const struct 
PointerRNA *ptr);
  
- /* *************** uilist types ******************** */
+ /* wm_operator_type.c */
+ struct wmOperatorType *WM_operatortype_find(const char *idname, bool quiet);
+ void WM_operatortype_iter(struct GHashIterator *ghi);
+ void WM_operatortype_append(void (*opfunc)(struct wmOperatorType *));
+ void WM_operatortype_append_ptr(void (*opfunc)(struct wmOperatorType *, void 
*), void *userdata);
+ void WM_operatortype_append_macro_ptr(void (*opfunc)(struct wmOperatorType *, 
void *), void *userdata);
+ void WM_operatortype_remove_ptr(struct wmOperatorType *ot);
+ bool WM_operatortype_remove(const char *idname);
+ void WM_operatortype_last_properties_clear_all(void);
++void WM_operatortype_props_advanced_begin(struct wmOperatorType *ot);
++void WM_operatortype_props_advanced_end(struct wmOperatorType *ot);
++
++#define WM_operatortype_prop_tag(property, tags) \
++      { \
++              CHECK_TYPE(tags, eOperatorPropTags); \
++              RNA_def_property_tags(prop, tags); \
++      } (void)0
+ 
+ struct wmOperatorType *WM_operatortype_append_macro(const char *idname, const 
char *name, const char *description, int flag);
+ struct wmOperatorTypeMacro *WM_operatortype_macro_define(struct 
wmOperatorType *ot, const char *idname);
+ 
+ /* wm_uilist_type.c */
  void                WM_uilisttype_init(void);
  struct uiListType  *WM_uilisttype_find(const char *idname, bool quiet);
  bool                WM_uilisttype_add(struct uiListType *ult);
diff --cc source/blender/windowmanager/intern/wm_operator_type.c
index e0d3c4a6727,62b378e0866..89421ac0ab0
--- a/source/blender/windowmanager/intern/wm_operator_type.c
+++ b/source/blender/windowmanager/intern/wm_operator_type.c
@@@ -213,55 -199,27 +213,76 @@@ void wm_operatortype_free(void
        global_ops_hash = NULL;
  }
  
 +/**
 + * Tag all operator-properties of \a ot defined after calling this, until
 + * the next #WM_operatortype_props_advanced_end call (if available), with
 + * #OP_PROP_TAG_ADVANCED. Previously defined ones properties not touched.
 + *
 + * Calling this multiple times without a call to 
#WM_operatortype_props_advanced_end,
 + * all calls after the first one are ignored. Meaning all propereties defined 
after the
 + * first call are tagged as advanced.
 + *
 + * This doesn't do the actual tagging, #WM_operatortype_props_advanced_end 
does which is
 + * called for all operators during registration (see 
#wm_operatortype_append__end).
 + */
 +void WM_operatortype_props_advanced_begin(wmOperatorType *ot)
 +{
 +      if (ot_prop_basic_count == -1) { /* Don't do anything if _begin was 
called before, but not _end  */
 +              ot_prop_basic_count = RNA_struct_count_properties(ot->srna);
 +      }
 +}
 +
 +/**
 + * Tags all operator-properties of \ot defined since the first 
#WM_operatortype_props_advanced_begin
 + * call, or the last #WM_operatortype_props_advanced_end call, with 
#OP_PROP_TAG_ADVANCED.
 + * Note that this is called for all operators during registration (see 
#wm_operatortype_append__end).
 + * So it does not need to be explicitly called in operator-type definition.
 + */
 +void WM_operatortype_props_advanced_end(wmOperatorType *ot)
 +{
 +      PointerRNA struct_ptr;
 +      int counter = 0;
 +
 +      if (ot_prop_basic_count == -1) {
 +              /* WM_operatortype_props_advanced_begin was not called. Don't 
do anything. */
 +              return;
 +      }
 +
 +      RNA_pointer_create(NULL, ot->srna, NULL, &struct_ptr);
 +
 +      RNA_STRUCT_BEGIN (&struct_ptr, prop)
 +      {
 +              counter++;
 +              if (counter > ot_prop_basic_count) {
 +                      WM_operatortype_prop_tag(prop, OP_PROP_TAG_ADVANCED);
 +              }
 +      }
 +      RNA_STRUCT_END;
 +
 +      ot_prop_basic_count = -1;
 +}
 +
+ /**
+  * Remove memory of all previously executed tools.
+  */
+ void WM_operatortype_last_properties_clear_all(void)
+ {
+       GHashIterator iter;
+ 
+       for (WM_operatortype_iter(&iter);
+            (!BLI_ghashIterator_done(&iter));
+            (BLI_ghashIterator_step(&iter)))
+       {
+               wmOperatorType *ot = BLI_ghashIterator_getValue(&iter);
+ 
+               if (ot->last_properties) {
+                       IDP_FreeProperty(ot->last_properties);
+                       MEM_freeN(ot->last_properties);
+                       ot->last_properties = NULL;
+               }
+       }
+ }
+ 
  /** \} */
  
  /* -------------------------------------------------------------------- */

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

Reply via email to