[Bf-blender-cvs] [91877e71dfc] modifier-panels-ui: Merge changes from patch review

Hans Goudey noreply at git.blender.org
Fri May 1 17:09:46 CEST 2020


Commit: 91877e71dfc1a3ef84ec407b9a3eec62e923c916
Author: Hans Goudey
Date:   Thu Apr 30 18:24:04 2020 -0500
Branches: modifier-panels-ui
https://developer.blender.org/rB91877e71dfc1a3ef84ec407b9a3eec62e923c916

Merge changes from patch review

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

M	release/scripts/startup/bl_ui/properties_constraint.py
M	release/scripts/startup/bl_ui/properties_data_shaderfx.py
M	source/blender/blenkernel/BKE_constraint.h
M	source/blender/blenkernel/BKE_gpencil_modifier.h
M	source/blender/blenkernel/BKE_modifier.h
M	source/blender/blenkernel/BKE_screen.h
M	source/blender/blenkernel/BKE_shader_fx.h
M	source/blender/blenkernel/intern/constraint.c
M	source/blender/blenkernel/intern/gpencil_modifier.c
M	source/blender/blenkernel/intern/modifier.c
M	source/blender/blenkernel/intern/shader_fx.c
M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface.c
M	source/blender/editors/interface/interface_panel.c
M	source/blender/editors/interface/interface_region_popup.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/interface/interface_widgets.c
M	source/blender/editors/object/object_shader_fx.c
M	source/blender/editors/screen/area.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
M	source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
M	source/blender/gpencil_modifiers/intern/MOD_gpenciltexture.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
M	source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
M	source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
M	source/blender/gpencil_modifiers/intern/MOD_ui_common.c
M	source/blender/gpencil_modifiers/intern/MOD_ui_common.h
M	source/blender/makesdna/DNA_screen_types.h
M	source/blender/makesrna/intern/rna_ui.c
M	source/blender/modifiers/intern/MOD_armature.c
M	source/blender/modifiers/intern/MOD_array.c
M	source/blender/modifiers/intern/MOD_bevel.c
M	source/blender/modifiers/intern/MOD_boolean.c
M	source/blender/modifiers/intern/MOD_build.c
M	source/blender/modifiers/intern/MOD_cast.c
M	source/blender/modifiers/intern/MOD_cloth.c
M	source/blender/modifiers/intern/MOD_collision.c
M	source/blender/modifiers/intern/MOD_correctivesmooth.c
M	source/blender/modifiers/intern/MOD_curve.c
M	source/blender/modifiers/intern/MOD_datatransfer.c
M	source/blender/modifiers/intern/MOD_decimate.c
M	source/blender/modifiers/intern/MOD_displace.c
M	source/blender/modifiers/intern/MOD_dynamicpaint.c
M	source/blender/modifiers/intern/MOD_edgesplit.c
M	source/blender/modifiers/intern/MOD_explode.c
M	source/blender/modifiers/intern/MOD_fluid.c
M	source/blender/modifiers/intern/MOD_hook.c
M	source/blender/modifiers/intern/MOD_laplaciandeform.c
M	source/blender/modifiers/intern/MOD_laplaciansmooth.c
M	source/blender/modifiers/intern/MOD_lattice.c
M	source/blender/modifiers/intern/MOD_mask.cc
M	source/blender/modifiers/intern/MOD_meshcache.c
M	source/blender/modifiers/intern/MOD_meshdeform.c
M	source/blender/modifiers/intern/MOD_meshsequencecache.c
M	source/blender/modifiers/intern/MOD_mirror.c
M	source/blender/modifiers/intern/MOD_multires.c
M	source/blender/modifiers/intern/MOD_normal_edit.c
M	source/blender/modifiers/intern/MOD_ocean.c
M	source/blender/modifiers/intern/MOD_particleinstance.c
M	source/blender/modifiers/intern/MOD_particlesystem.c
M	source/blender/modifiers/intern/MOD_remesh.c
M	source/blender/modifiers/intern/MOD_screw.c
M	source/blender/modifiers/intern/MOD_shrinkwrap.c
M	source/blender/modifiers/intern/MOD_simpledeform.c
M	source/blender/modifiers/intern/MOD_skin.c
M	source/blender/modifiers/intern/MOD_smooth.c
M	source/blender/modifiers/intern/MOD_softbody.c
M	source/blender/modifiers/intern/MOD_solidify.c
M	source/blender/modifiers/intern/MOD_subsurf.c
M	source/blender/modifiers/intern/MOD_surface.c
M	source/blender/modifiers/intern/MOD_surfacedeform.c
M	source/blender/modifiers/intern/MOD_triangulate.c
M	source/blender/modifiers/intern/MOD_ui_common.c
M	source/blender/modifiers/intern/MOD_ui_common.h
M	source/blender/modifiers/intern/MOD_uvproject.c
M	source/blender/modifiers/intern/MOD_uvwarp.c
M	source/blender/modifiers/intern/MOD_warp.c
M	source/blender/modifiers/intern/MOD_wave.c
M	source/blender/modifiers/intern/MOD_weighted_normal.c
M	source/blender/modifiers/intern/MOD_weightvgedit.c
M	source/blender/modifiers/intern/MOD_weightvgmix.c
M	source/blender/modifiers/intern/MOD_weightvgproximity.c
M	source/blender/modifiers/intern/MOD_weld.c
M	source/blender/modifiers/intern/MOD_wireframe.c
M	source/blender/shader_fx/intern/FX_shader_blur.c
M	source/blender/shader_fx/intern/FX_shader_colorize.c
M	source/blender/shader_fx/intern/FX_shader_flip.c
M	source/blender/shader_fx/intern/FX_shader_glow.c
M	source/blender/shader_fx/intern/FX_shader_pixel.c
M	source/blender/shader_fx/intern/FX_shader_rim.c
M	source/blender/shader_fx/intern/FX_shader_shadow.c
M	source/blender/shader_fx/intern/FX_shader_swirl.c
M	source/blender/shader_fx/intern/FX_shader_wave.c
M	source/blender/shader_fx/intern/FX_ui_common.c
M	source/blender/shader_fx/intern/FX_ui_common.h

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

diff --git a/release/scripts/startup/bl_ui/properties_constraint.py b/release/scripts/startup/bl_ui/properties_constraint.py
index ff1378fc67e..fc3398381aa 100644
--- a/release/scripts/startup/bl_ui/properties_constraint.py
+++ b/release/scripts/startup/bl_ui/properties_constraint.py
@@ -63,7 +63,7 @@ class ConstraintButtonsPanel(Panel):
     bl_region_type = 'WINDOW'
     bl_label = ""
     bl_context = "constraint"
-    bl_options = {'LIST', 'HEADER_LAYOUT_EXPAND'}
+    bl_options = {'INSTANCED', 'HEADER_LAYOUT_EXPAND', 'DRAW_BOX'}
 
     @staticmethod
     def draw_influence(layout, con):
@@ -146,7 +146,7 @@ class ConstraintButtonsSubPanel(Panel):
     bl_region_type = 'WINDOW'
     bl_label = ""
     bl_context = "constraint"
-    bl_options = {'LIST_SUBPANEL'}
+    bl_options = {'INSTANCED_SUBPANEL', 'DRAW_BOX'}
 
     def get_constraint(self, context):
         con = None
diff --git a/release/scripts/startup/bl_ui/properties_data_shaderfx.py b/release/scripts/startup/bl_ui/properties_data_shaderfx.py
index fba5f143494..342a2b04166 100644
--- a/release/scripts/startup/bl_ui/properties_data_shaderfx.py
+++ b/release/scripts/startup/bl_ui/properties_data_shaderfx.py
@@ -39,9 +39,6 @@ class DATA_PT_shader_fx(ShaderFxButtonsPanel, Panel):
 
     def draw(self, context):
         layout = self.layout
-
-        ob = context.object
-
         layout.operator_menu_enum("object.shaderfx_add", "type")
         layout.template_shaderfx()
 
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h
index 8fe3bd77a26..a91dcdfd38d 100644
--- a/source/blender/blenkernel/BKE_constraint.h
+++ b/source/blender/blenkernel/BKE_constraint.h
@@ -38,6 +38,9 @@ struct bPoseChannel;
 extern "C" {
 #endif
 
+/** For building the panel UI for constraints. */
+#define CONSTRAINT_TYPE_PANEL_PREFIX "OBJECT_PT_"
+
 /* special struct for use in constraint evaluation */
 typedef struct bConstraintOb {
   /** to get evaluated armature. */
@@ -136,6 +139,8 @@ typedef struct bConstraintTypeInfo {
 const bConstraintTypeInfo *BKE_constraint_typeinfo_get(struct bConstraint *con);
 const bConstraintTypeInfo *BKE_constraint_typeinfo_from_type(int type);
 
+void BKE_constraint_panelId(int type, char *r_name);
+
 /* ---------------------------------------------------------------------------- */
 
 /* Constraint function prototypes */
diff --git a/source/blender/blenkernel/BKE_gpencil_modifier.h b/source/blender/blenkernel/BKE_gpencil_modifier.h
index 1e919ad5cb0..ee26d996e96 100644
--- a/source/blender/blenkernel/BKE_gpencil_modifier.h
+++ b/source/blender/blenkernel/BKE_gpencil_modifier.h
@@ -268,6 +268,7 @@ typedef struct GpencilModifierTypeInfo {
 void BKE_gpencil_modifier_init(void);
 
 const GpencilModifierTypeInfo *BKE_gpencil_modifierType_getInfo(GpencilModifierType type);
+void BKE_gpencil_modifierType_panelId(GpencilModifierType type, char *r_idname);
 struct GpencilModifierData *BKE_gpencil_modifier_new(int type);
 void BKE_gpencil_modifier_free_ex(struct GpencilModifierData *md, const int flag);
 void BKE_gpencil_modifier_free(struct GpencilModifierData *md);
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 986cb9a51d3..b198e1528a2 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -362,6 +362,9 @@ void BKE_modifier_init(void);
 
 const ModifierTypeInfo *modifierType_getInfo(ModifierType type);
 
+/* For modifier UI panels. */
+void modifierType_panelId(ModifierType type, char *r_idname);
+
 /* Modifier utility calls, do call through type pointer and return
  * default values if pointer is optional.
  */
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 41afa50497d..6e2ccc9c1ec 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -228,20 +228,20 @@ typedef struct PanelType {
   /* draw entirely, view changes should be handled here */
   void (*draw)(const struct bContext *C, struct Panel *panel);
 
-  /* For panels corresponding to a list: */
+  /* For instanced panels corresponding to a list: */
 
   /** Reorder function, called when drag and drop finishes. */
   void (*reorder)(struct bContext *C, struct Panel *pa, int new_index);
   /**
-   * Set the panel and subpanel's expansion state from the corresponding expansion flag. Called
-   * on draw updates.
-   * \note Subpanels are indexed in depth first order, the visual order you would see if all panels
+   * Get the panel and subpanel's expansion state from the expansion flag in the corresponding data
+   * item. Called on draw updates.
+   * \note Subpanels are indexed in depth first order, the visualorder you would see if all panels
    * were expanded.
    */
   short (*get_list_data_expand_flag)(const struct bContext *C, struct Panel *pa);
   /**
-   * Set the expand bitfield from the closed / open state of this panel and its subpanels. Called
-   * when the expansion state of the panel changes by user input.
+   * Set the expansion bitfield from the closed / open state of this panel and its subpanels.
+   * Called when the expansion state of the panel changes with user input.
    * \note Subpanels are indexed in depth first order, the visual order you would see if all panels
    * were expanded.
    */
diff --git a/source/blender/blenkernel/BKE_shader_fx.h b/source/blender/blenkernel/BKE_shader_fx.h
index f49cdf55f6a..df39fcddcf4 100644
--- a/source/blender/blenkernel/BKE_shader_fx.h
+++ b/source/blender/blenkernel/BKE_shader_fx.h
@@ -169,6 +169,7 @@ typedef struct ShaderFxTypeInfo {
 void BKE_shaderfx_init(void);
 
 const ShaderFxTypeInfo *BKE_shaderfxType_getInfo(ShaderFxType type);
+void BKE_shaderfxType_panelId(ShaderFxType type, char *panel_id);
 struct ShaderFxData *BKE_shaderfx_new(int type);
 void BKE_shaderfx_free_ex(struct ShaderFxData *fx, const int flag);
 void BKE_shaderfx_free(struct ShaderFxData *fx);
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 6e3077093fc..e38c0b56ae9 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -5124,6 +5124,20 @@ const bConstraintTypeInfo *BKE_constraint_typeinfo_from_type(int type)
   return NULL;
 }
 
+/**
+ * Get the idname of the constraint type's panel, which was defined elsewhere.
+ *
+ * \note: Constraint panel types are assumed to be named with the struct name field concatenated to
+ * the defined prefix.
+ */
+void BKE_constraint_panelId(int type, char *r_idname)
+{
+  const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_from_type(type);
+
+  strcpy(r_idname, CONSTRAINT_TYPE_PANEL_PREFIX);
+  strcat(r_idname, cti->structName);
+}
+
 /* This function should always be used to get the appropriate type-info, as it
  * has checks which prevent segfaults in some weird cases.
  */
@@ -5249,7 +5263,7 @@ static bConstraint *add_new_constraint_internal(const char *name, short type)
   /* Set up a generic constraint data-block. */
   con->type = type;
   con->flag |= CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
-  con->ui_expand_flag = 1;
+  con->ui_expand_flag = 1; /* Only expand the parent panel by default. */
   con->enforce = 1.0f;
 
   /* Only open the main panel when constraints are created, not the subpanels.
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index c22a0c9c7d3..8f4d6c2e885 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -520,6 +520,17 @@ const GpencilModifierTypeInfo *BKE_gpencil_modifierType_getInfo(GpencilModifierT
   }
 }
 
+/**
+ * Get the idname of the modifier type's panel, which was defined in the #panelRegister callback.
+ */
+void BKE_gpencil_modifierType_panelId(GpencilModifierType type, char *r_idname)
+{
+  const GpencilModifierTypeInfo *mti = BKE_gpencil_modifierType_getInfo(type);
+
+  strcpy(r_idname, GPENCIL_MODIFIER_TYPE_PANEL_PREFIX);
+  strcat(r_idname, mti->name);
+}
+
 void BKE_gpencil_modifier_copyData_generic(const GpencilModifierData *md_src,
                                            GpencilModifierData *md_dst)
 {
@@ -557,7 +568,7 @@ void BKE_gpencil_modifier_copyData_ex(GpencilModifierData *md,
 
   target->mode = md->mode;
   target->flag = md->flag;
-  target->ui_expand_flag = md->ui_expand_flag;
+  target->ui_expand_flag = md->ui_expand_flag; /* Expand the parent panel by default. */
 
   if (mti->copyData) {
     mti->copyData(md, target);
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 8571bf049e8..0a3a8e96c14 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -115,6 +115,17 @@ const ModifierTypeInfo *modifierType_getInfo(ModifierType type)
   }
 }
 
+/**
+ * Get the idname of the modifier type's panel, which was defined in the #panelRegister callback.
+ */
+void modifierType_panelId(ModifierType type, char *r_idname)
+{
+  const ModifierTypeInfo *mti = modifierType_getInfo(type);
+
+  strcpy(r_idname, MODIFIER_TYPE_PANEL_PREFIX);
+  strcat(r_idname, mti->name);
+}
+
 /***/
 
 ModifierData *modifier_new(int type)
diff --git a/source/blender/blenkernel/intern/shader_fx.c b/source/blender/blenkernel/intern/shader_fx.c
index 47b76b7290c..da479d25ce5 100644
--- a/source/blender/blenkernel/intern/shader_fx.c
+++ b/source/blender/blenkernel/intern/shader_fx.c
@@ -165,6 +165,20 @@ const ShaderFxTypeInfo *BKE_shaderfxType_getInfo(ShaderFxType type)
   }
 }
 
+/**
+ * Get an effect's panel type.
+ *
+ * \note: ShaderFx panel types are assumed to be named with the struct name field concatenated to
+ * the defined prefix.
+ */
+void BKE_shaderfxType_panelId(ShaderFxType type, char *r_idname)
+{
+  const ShaderFxTypeInfo *fxi = BKE_shaderfxType_getInfo(type);
+
+  strcpy(r_idname, SHADERFX_TYPE_PANEL_PREFIX);
+  strcat(r_idname, fxi->name);
+}
+
 void BKE_shaderfx_copyData_generic(const ShaderFxData *fx_src, ShaderFxData *fx_dst)
 {
   const ShaderFxTypeInfo *fxi = BKE_shaderfxType_getInfo(fx_src->type);

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list