Advertisement
Guest User

bpy.types.UILayout.template_list.patch Blender 3D

a guest
May 23rd, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 9.65 KB | None | 0 0
  1. diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
  2. index 7b21e879729..89d68adf757 100644
  3. --- a/source/blender/CMakeLists.txt
  4. +++ b/source/blender/CMakeLists.txt
  5. @@ -65,6 +65,7 @@ set(SRC_DNA_INC
  6.     ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_object_fluidsim_types.h
  7.     ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_object_force_types.h
  8.     ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_object_types.h
  9. +   ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_outliner_filter_types.h
  10.     ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_outliner_types.h
  11.     ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_packedFile_types.h
  12.     ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_particle_types.h
  13. diff --git a/source/blender/makesdna/DNA_outliner_filter_types.h b/source/blender/makesdna/DNA_outliner_filter_types.h
  14. new file mode 100644
  15. index 00000000000..089e7f1f96a
  16. --- /dev/null
  17. +++ b/source/blender/makesdna/DNA_outliner_filter_types.h
  18. @@ -0,0 +1,161 @@
  19. +/*
  20. + * This program is free software; you can redistribute it and/or
  21. + * modify it under the terms of the GNU General Public License
  22. + * as published by the Free Software Foundation; either version 2
  23. + * of the License, or (at your option) any later version.
  24. + *
  25. + * This program is distributed in the hope that it will be useful,
  26. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  27. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  28. + * GNU General Public License for more details.
  29. + *
  30. + * You should have received a copy of the GNU General Public License
  31. + * along with this program; if not, write to the Free Software Foundation,
  32. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  33. + *
  34. + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  35. + * All rights reserved.
  36. + */
  37. +
  38. +/** \file
  39. + * \ingroup DNA
  40. + */
  41. +
  42. +#ifndef __DNA_OUTLINER_FILTER_TYPES_H__
  43. +#define __DNA_OUTLINER_FILTER_TYPES_H__
  44. +
  45. +#include "DNA_defs.h"
  46. +
  47. +
  48. +typedef enum DeleteSwitchType {
  49. +   TFE_NONE_EXCEPT = 0,  /* Delete none except...*/
  50. +   TFE_ALL_EXCEPT = 1,   /* Delete all except...*/
  51. +} DeleteSwitchType;
  52. +
  53. +/* TreeFilterElement::fot      These are different filter methods for property values TreeFilterElement::prop_val_comparator_min and TreeFilterElement::prop_val_comparator_max  */
  54. +typedef enum FilterOperationType {
  55. +   TFE_RELATION = 0,     /* <, <=, >, >=, ==, != --- only for numeric values*/
  56. +   TFE_ARITHMETIC = 1,   /* */
  57. +   TFE_REG_EXPRESSION = 2,
  58. +   TFE_ALPHABETIC = 3,    /* Search string property value*/
  59. +   TFE_RANGE = 4, /* TreeFilterListElement::prop_val_comparator_min and TreeFilterElement::prop_val_comparator_max   */
  60. +} FilterOperationType;
  61. +
  62. +/* TreeFilterElement::op_min and TreeFilterListElement::op_max.  Used when TreeFilterElement::fot is set to TFE_RELATION */
  63. +typedef enum RelationalOperaterType {
  64. +   TFE_EQUALS = 0,
  65. +   TFE_NOT_EQUALS = 1,
  66. +   TFE_LESS_THAN = 2,
  67. +   TFE_LESS_THAN_EQUALS = 3,
  68. +   TFE_GREATER_THAN = 4,
  69. +   TFE_GREATER_THAN_EQUALS = 5,
  70. +} RelationalOperaterType;
  71. +
  72. +/* TreeFilterElement::proptype_comparator */
  73. +typedef enum TFE_PropertyType {
  74. +   TFE_BOOLEAN = (1 << 0),
  75. +   TFE_INT = (1 << 1),
  76. +   TFE_FLOAT = (1 << 2),
  77. +   TFE_STRING = (1 << 3),
  78. +   TFE_ENUM = (1 << 4),
  79. +   TFE_POINTER = (1 << 5),
  80. +   TFE_COLLECTION = (1 << 6),
  81. +} TFE_PropertyType;
  82. +
  83. +
  84. +
  85. +/* TreeFilterElement is supposed to work in a linear layered tree - which is unlike TreeElement */
  86. +/* Link this within SpaceOutliner::tree_filter_list */
  87. +typedef struct TreeFilterElement {
  88. +   struct TreeFilterElement *next, *prev;
  89. +   ListBase *superlist, *sublist, *list;
  90. +
  91. +   int apply_num_subtrees;   /* -1 = all subtrees, 0 = this subtree only. This, as a convenience, applies this TreeFilterElement as a filter for num sublist s */
  92. +
  93. +   short struct_delete_switch;
  94. +   char struct_name_comparator[64];                          /* filter by struct name. NULL signifies no struct_name search*/
  95. +   short prop_name_delete_switch;
  96. +   char prop_name_comparator[64];                            /* filter by struct property name/indentifier. NULL signifies no prop_name search */
  97. +
  98. +   /* property value filter operation stuff */
  99. +   short prop_val_delete_switch;
  100. +   short fot;
  101. +   short op_min;   /* Only used if fot is set to TFE_RELATION or TFE_RANGE */
  102. +   void* prop_val_comparator_min;       /* Used for all FilterOperationType values.  Set to NULL to signify no property value search  */
  103. +   short op_max;  /* Only used if fot is set to RANGE */
  104. +   void* prop_val_comparator_max;       /* Only used if fot is set to RANGE */
  105. +
  106. +   short elem_name_comparator_delete_switch;
  107. +   char elem_name_comparator[64];
  108. +
  109. +   short proptype_delete_switch;
  110. +   short proptype_comparator;     /* Filter tree via PropertyType . -1 signifies no proptype value search*/
  111. +
  112. +} TreeFilterElement;
  113. +
  114. +
  115. +
  116. +
  117. +#endif  /* __DNA_OUTLINER_FILTER_TYPES_H__ */
  118. +
  119. +
  120. diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
  121. index 21e945a084a..7c464e192ad 100644
  122. --- a/source/blender/makesdna/DNA_space_types.h
  123. +++ b/source/blender/makesdna/DNA_space_types.h
  124. @@ -30,6 +30,7 @@
  125.  #include "DNA_color_types.h"        /* for Histogram */
  126.  #include "DNA_vec_types.h"
  127.  #include "DNA_outliner_types.h"     /* for TreeStoreElem */
  128. +#include "DNA_outliner_filter_types.h"
  129.  #include "DNA_image_types.h"        /* ImageUser */
  130.  #include "DNA_movieclip_types.h"    /* MovieClipUser */
  131.  #include "DNA_sequence_types.h"     /* SequencerScopes */
  132. @@ -231,7 +232,8 @@ typedef struct SpaceOutliner {
  133.     /** Deprecated, copied to region. */
  134.     View2D v2d DNA_DEPRECATED;
  135.  
  136. -   ListBase tree;
  137. +   ListBase original_tree;
  138. +   ListBase derived_tree;
  139.  
  140.     /* treestore is an ordered list of TreeStoreElem's from outliner tree;
  141.      * Note that treestore may contain duplicate elements if element
  142. @@ -250,6 +252,20 @@ typedef struct SpaceOutliner {
  143.     char filter_state;
  144.     char _pad;
  145.     short filter_id_type;
  146. +   ListBase *tree_filter_tree;
  147. +
  148. +
  149. +   /* Current TreeFilterElement list and current tfe*/
  150. +   short active_tfe_list_index;
  151. +   short active_tfe_index;
  152. +   char name[32];
  153. +   char _pad2[4];
  154.  
  155.     /**
  156.      * Pointers to treestore elements, grouped by (id, type, nr)
  157. diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
  158. index edf15c5fe39..bf26eb9ebf4 100644
  159. --- a/source/blender/makesdna/intern/makesdna.c
  160. +++ b/source/blender/makesdna/intern/makesdna.c
  161. @@ -98,6 +98,7 @@ static const char *includefiles[] = {
  162.     "DNA_fileglobal_types.h",
  163.     "DNA_sequence_types.h",
  164.     "DNA_effect_types.h",
  165. +   "DNA_outliner_filter_types.h",
  166.     "DNA_outliner_types.h",
  167.     "DNA_sound_types.h",
  168.     "DNA_collection_types.h",
  169. @@ -1487,6 +1488,7 @@ int main(int argc, char **argv)
  170.  #include "DNA_fileglobal_types.h"
  171.  #include "DNA_sequence_types.h"
  172.  #include "DNA_effect_types.h"
  173. +#include "DNA_outliner_filter_types.h"
  174.  #include "DNA_outliner_types.h"
  175.  #include "DNA_sound_types.h"
  176.  #include "DNA_collection_types.h"
  177. diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
  178. index 5866302a852..0bb20383147 100644
  179. --- a/source/blender/makesrna/RNA_access.h
  180. +++ b/source/blender/makesrna/RNA_access.h
  181. @@ -703,6 +703,7 @@ extern StructRNA RNA_TrackToConstraint;
  182.  extern StructRNA RNA_TransformConstraint;
  183.  extern StructRNA RNA_TransformOrientationSlot;
  184.  extern StructRNA RNA_TransformSequence;
  185. +extern StructRNA RNA_TreeFilterElement;
  186.  extern StructRNA RNA_UILayout;
  187.  extern StructRNA RNA_UIList;
  188.  extern StructRNA RNA_UIPieMenu;
  189. diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
  190. index f827615ab03..a26f2f7f82e 100644
  191. --- a/source/blender/makesrna/intern/rna_space.c
  192. +++ b/source/blender/makesrna/intern/rna_space.c
  193. @@ -1190,6 +1190,27 @@ static const EnumPropertyItem *rna_SpaceImageEditor_pivot_itemf(
  194.         return pivot_items;
  195.  }
  196.  
  197. +
  198. +/* Outliner */
  199. +
  200. +static int rna_SpaceOutliner_active_tfe_list_index_get(PointerRNA *ptr)
  201. +{
  202. +   SpaceOutliner *soops = (SpaceOutliner *)ptr->id.data;
  203. +
  204. +   return MAX2(soops->active_tfe_list_index - 1, 0);
  205. +}
  206. +
  207. +static void rna_SpaceOutliner_active_tfe_list_index_set(PointerRNA *ptr, int value)
  208. +{
  209. +   SpaceOutliner *soops = (SpaceOutliner *)ptr->id.data;
  210. +
  211. +   soops->active_tfe_list_index = value + 1;
  212. +}
  213. +
  214. +
  215. +
  216. +
  217. +
  218.  /* Space Text Editor */
  219.  
  220.  static void rna_SpaceTextEditor_word_wrap_set(PointerRNA *ptr, bool value)
  221. @@ -2405,6 +2429,56 @@ static void rna_def_space_outliner(BlenderRNA *brna)
  222.     RNA_def_property_enum_items(prop, rna_enum_id_type_items);
  223.     RNA_def_property_ui_text(prop, "Filter ID Type", "Data-block type to show");
  224.     RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
  225. +
  226. +
  227. +   prop = RNA_def_property(srna, "active_tfe_list_index", PROP_INT, PROP_NONE);
  228. +   RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
  229. +   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* XXX this is really unpredictable... */
  230. +   RNA_def_property_int_funcs(prop, "rna_SpaceOutliner_active_tfe_list_index_get", "rna_SpaceOutliner_active_tfe_list_index_set",
  231. +       NULL);//NOTE: THIS parameter is modeled after active_shape_key_index in rna_object.c - probably not supposed to be NULL
  232. +   RNA_def_property_ui_text(prop, "Active Filter List Index", "Current tree filter index");
  233. +   RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL /*"rna_Object_active_shape_update"*/);
  234. +
  235. +
  236. +
  237. +   prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
  238. +   RNA_def_property_ui_text(prop, "Name", "Tree filter name");
  239. +   RNA_def_struct_name_property(srna, prop);
  240. +
  241. +
  242. +   prop = RNA_def_property(srna, "tree_filter_tree", PROP_COLLECTION, PROP_NONE);
  243. +   RNA_def_property_struct_type(prop, "TreeFilterElement");
  244. +   RNA_def_property_ui_text(prop, "Boid Rules", "");
  245. +
  246. +
  247.  }
  248.  
  249.  static void rna_def_space_view3d_shading(BlenderRNA *brna)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement