[Bf-blender-cvs] [c4cbb499d5d] modifier-panels-ui: Pre-review cleanup - Remove the idea of "active modifier" - Remove UIList. This can always be added later easily - Cleanup various comments, unused headers, and unrelated changes
Hans Goudey
noreply at git.blender.org
Wed Apr 22 22:20:56 CEST 2020
Commit: c4cbb499d5d3ecc66cef32177913786ac39dbe51
Author: Hans Goudey
Date: Wed Apr 22 15:14:47 2020 -0500
Branches: modifier-panels-ui
https://developer.blender.org/rBc4cbb499d5d3ecc66cef32177913786ac39dbe51
Pre-review cleanup
- Remove the idea of "active modifier"
- Remove UIList. This can always be added later easily
- Cleanup various comments, unused headers, and unrelated changes
===================================================================
M release/scripts/startup/bl_ui/properties_data_modifier.py
M source/blender/blenkernel/BKE_modifier.h
M source/blender/editors/object/object_intern.h
M source/blender/editors/object/object_modifier.c
M source/blender/editors/object/object_ops.c
M source/blender/editors/screen/area.c
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesdna/DNA_object_types.h
M source/blender/makesrna/intern/rna_boid.c
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/makesrna/intern/rna_object.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 01b668375a5..997c841dca2 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -18,7 +18,7 @@
# <pep8 compliant>
import bpy
-from bpy.types import Panel, UIList
+from bpy.types import Panel
from bpy.app.translations import pgettext_iface as iface_
@@ -39,46 +39,8 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
- ob = context.object
-
layout.operator_menu_enum("object.modifier_add", "type")
-
- # row = layout.row()
- # row.template_list(
- # "DATA_UL_modifiers", "Modifiers", ob, 'modifiers', ob.modifiers, 'active_index')
-
- # col = row.column(align=True)
- # col.operator("object.modifier_active_remove", icon='X', text="")
- # col.separator()
- # col.operator("object.modifier_active_move", icon='TRIA_UP', text="").direction = 'UP'
- # col.operator("object.modifier_active_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
-
layout.template_modifiers()
-
-class DATA_UL_modifiers(UIList):
- def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
- ob = data
- md = item
- md_type = md.type
- icon = bpy.types.Modifier.bl_rna.properties['type'].enum_items[md_type].icon
-
- if self.layout_type in {'DEFAULT', 'COMPACT'}:
- layout.prop(md, 'name', text="", emboss=False, icon_value=1, icon=icon)
- layout.prop(md, 'show_viewport', text="", emboss=False, icon_only=True)
- layout.prop(md, 'show_render', text="", emboss=False, icon_only=True)
- elif self.layout_type == 'GRID':
- layout.alignment = 'CENTER'
- layout.label(text="", icon_value=icon)
-
- def draw_filter(self, context, layout):
- row = layout.row()
-
- subrow = row.row(align=True)
- subrow.prop(self, "filter_name", text="")
- icon = 'ZOOM_OUT' if self.use_filter_invert else 'ZOOM_IN'
- subrow.prop(self, "use_filter_invert", text="",toggle=True, icon_only=True, icon=icon)
-
-
class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
bl_label = "Modifiers"
@@ -564,7 +526,6 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
classes = (
DATA_PT_modifiers,
- DATA_UL_modifiers,
DATA_PT_gpencil_modifiers,
)
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 4773e9b1d17..df70fbb22ac 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -29,7 +29,6 @@ extern "C" {
#endif
struct ARegionType;
-struct bContext;
struct BMEditMesh;
struct CustomData_MeshMasks;
struct DepsNodeHandle;
@@ -40,10 +39,8 @@ struct Main;
struct Mesh;
struct ModifierData;
struct Object;
-struct PointerRNA;
struct Scene;
struct bArmature;
-struct uiLayout;
typedef enum {
/* Should not be used, only for None modifier type */
@@ -347,6 +344,7 @@ typedef struct ModifierTypeInfo {
void (*panelRegister)(struct ARegionType *region_type);
} ModifierTypeInfo;
+/* Used to find a modifier's panel type. */
#define MODIFIER_TYPE_PANEL_PREFIX "MOD_PT_"
/* Initialize modifier's global data (type info and some common global storages). */
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index f04291939e8..7582d5b4fe2 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -151,7 +151,6 @@ bool edit_modifier_poll_generic(struct bContext *C,
struct StructRNA *rna_type,
int obtype_flag,
const bool is_editmode_allowed);
-bool edit_active_modifier_poll_generic(bContext *C, const bool is_editmode_allowed);
bool edit_modifier_poll(struct bContext *C);
void edit_modifier_properties(struct wmOperatorType *ot);
int edit_modifier_invoke_properties(struct bContext *C, struct wmOperator *op);
@@ -161,10 +160,8 @@ struct ModifierData *edit_modifier_property_get(struct wmOperator *op,
void OBJECT_OT_modifier_add(struct wmOperatorType *ot);
void OBJECT_OT_modifier_remove(struct wmOperatorType *ot);
-void OBJECT_OT_modifier_active_remove(struct wmOperatorType *ot);
void OBJECT_OT_modifier_move_up(struct wmOperatorType *ot);
void OBJECT_OT_modifier_move_down(struct wmOperatorType *ot);
-void OBJECT_OT_modifier_active_move(struct wmOperatorType *ot);
void OBJECT_OT_modifier_move_to_index(struct wmOperatorType *ot);
void OBJECT_OT_modifier_apply(struct wmOperatorType *ot);
void OBJECT_OT_modifier_convert(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 23795c780fb..b32ed390723 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -401,10 +401,6 @@ bool ED_object_modifier_remove(ReportList *reports, Main *bmain, Object *ob, Mod
return 0;
}
- /* Lower the active index so it isn't out of bounds. */
- int modifiers_len = BLI_listbase_count(&ob->modifiers);
- ob->active_mod_index = (modifiers_len > 0) ? min_ii(ob->active_mod_index, modifiers_len - 1) : 0;
-
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
DEG_relations_tag_update(bmain);
@@ -1029,39 +1025,6 @@ bool edit_modifier_poll_generic(bContext *C,
return true;
}
-bool edit_active_modifier_poll_generic(bContext *C, const bool is_editmode_allowed)
-{
- Object *ob = CTX_data_active_object(C);
-
- if (!ob || ID_IS_LINKED(ob)) {
- return false;
- }
-
- int modifiers_len = BLI_listbase_count(&ob->modifiers);
- ModifierData *md = BLI_findlink(&ob->modifiers, ob->active_mod_index);
-
- if (ob->active_mod_index >= modifiers_len) {
- return false;
- }
- if (md == NULL) {
- return false;
- }
-
- if (ID_IS_OVERRIDE_LIBRARY(ob)) {
- if ((md->flag & eModifierFlag_OverrideLibrary_Local) == 0) {
- CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from library override");
- return false;
- }
- }
-
- if (!is_editmode_allowed && CTX_data_edit_object(C) != NULL) {
- CTX_wm_operator_poll_msg_set(C, "This modifier operation is not allowed from Edit mode");
- return false;
- }
-
- return true;
-}
-
bool edit_modifier_poll(bContext *C)
{
return edit_modifier_poll_generic(C, &RNA_Modifier, 0, true);
@@ -1093,24 +1056,6 @@ int edit_modifier_invoke_properties(bContext *C, wmOperator *op)
return false;
}
-static int edit_modifier_active_invoke_properties(bContext *C, wmOperator *op)
-{
- if (RNA_struct_property_is_set(op->ptr, "modifier")) {
- return true;
- }
- else {
- PointerRNA obj_ptr = CTX_data_pointer_get_type(C, "object", &RNA_Object);
- if (!RNA_pointer_is_null(&obj_ptr)) {
- Object *obj = (Object *)obj_ptr.data;
- ModifierData *md = BLI_findlink(&obj->modifiers, obj->active_mod_index);
- RNA_string_set(op->ptr, "modifier", md->name);
- return true;
- }
- }
-
- return false;
-}
-
ModifierData *edit_modifier_property_get(wmOperator *op, Object *ob, int type)
{
char modifier_name[MAX_NAME];
@@ -1184,42 +1129,6 @@ void OBJECT_OT_modifier_remove(wmOperatorType *ot)
/** \} */
-/* ------------------------------------------------------------------- */
-/** \name Remove Active Modifier Operator
- * \{ */
-
-static bool modifier_active_remove_poll(bContext *C)
-{
- return edit_active_modifier_poll_generic(C, true);
-}
-
-static int modifier_active_remove_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
-{
- if (edit_modifier_active_invoke_properties(C, op)) {
- return modifier_remove_exec(C, op);
- }
- else {
- return OPERATOR_CANCELLED;
- }
-}
-
-void OBJECT_OT_modifier_active_remove(wmOperatorType *ot)
-{
- ot->name = "Remove Active Modifier";
- ot->description = "Remove the active modifier from the active object";
- ot->idname = "OBJECT_OT_modifier_active_remove";
-
- ot->invoke = modifier_active_remove_invoke;
- ot->exec = modifier_remove_exec;
- ot->poll = modifier_active_remove_poll;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
- edit_modifier_properties(ot);
-}
-
-/** \} */
-
/* ------------------------------------------------------------------- */
/** \name Move Up Modifier Operator
* \{ */
@@ -1312,87 +1221,13 @@ void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
/** \} */
-/* ------------------------------------------------------------------- */
-/** \name Move Active Modifier Operator
- * \{ */
-
-static bool modifier_active_move_poll(bContext *C)
-{
- return edit_active_modifier_poll_generic(C, true);
-}
-
-static int modifier_active_move_exec(bContext *C, wmOperator *op)
-{
- Object *ob = ED_object_active_context(C);
- ModifierData *md = edit_modifier_property_get(op, ob, 0);
- int dir = RNA_enum_get(op->ptr, "direction");
-
- if (dir == 1) {
- if (!md || !ED_object_modifier_move_down(op->reports, ob, md)) {
- return OPERATOR_CANCELLED;
- }
- }
- if (dir == -1) {
- if (!md || !ED_object_modifier_move_up(op->reports, ob, md)) {
- return OPERATOR_CANCELLED;
- }
- }
-
- ob->active_mod_index += dir;
-
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
-
- return OPERATOR_FINISHED;
-}
-
-static int modifier_active_move_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
-{
- if (edit_modifier_active_invoke_properties(C, op)) {
- return modifier_active_move_exec(C, op);
- }
- else {
- return OPERATOR_CANCELLED;
- }
-}
-
-void OBJECT_OT_modifier_active_move(wmOperatorType *ot)
-{
-
- static const EnumPropertyItem modifier_active_move[] = {
- {-1, "UP", 0, "Up", ""},
- {1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- ot->name = "Move Modifier Active Modifier";
- ot->
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list