Skip to content

Commit

Permalink
Revert "Merge pull request #4064 from Bforartists/issue#4063"
Browse files Browse the repository at this point in the history
This reverts commit f321673, reversing
changes made to ab65a7c.
  • Loading branch information
Draise14 authored and esnosy committed Feb 6, 2024
1 parent b130058 commit ddfc2d0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 133 deletions.
1 change: 0 additions & 1 deletion scripts/startup/bl_ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"properties_world",
"properties_collection",
"generic_ui_list",
"generic_column_menu",

# Generic Space Modules
#
Expand Down
74 changes: 6 additions & 68 deletions scripts/startup/bl_ui/properties_constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later

from bpy.types import Panel, Menu, Operator
from bpy.types import Panel
from bpy.app.translations import contexts as i18n_contexts
from bl_ui.generic_column_menu import GenericColumnMenu, fetch_op_data, InvokeMenuOperator


class ObjectConstraintPanel:
bl_context = "constraint"
Expand All @@ -30,39 +30,10 @@ class OBJECT_PT_constraints(ObjectConstraintPanel, Panel):

def draw(self, _context):
layout = self.layout
layout.operator("object.add_constraints_menu", icon='ADD')

layout.template_constraints(use_bone_constraints=False)

layout.operator_menu_enum("object.constraint_add", "type", text="Add Object Constraint")

class OBJECT_MT_constraint_add(GenericColumnMenu, Menu):
bl_description = "Add a constraint to the active object"

op_id = "object.constraint_add"
OPERATOR_DATA, TRANSLATION_CONTEXT = fetch_op_data(class_name="Constraint")
search_header = "Object Constraint"

def draw(self, _context):
layout = self.layout.row()

self.draw_operator_column(layout, header="Motion Tracking",
types=('CAMERA_SOLVER', 'FOLLOW_TRACK', 'OBJECT_SOLVER'))
self.draw_operator_column(layout, header="Transform",
types=('COPY_LOCATION', 'COPY_ROTATION', 'COPY_SCALE', 'COPY_TRANSFORMS', 'LIMIT_DISTANCE', 'LIMIT_LOCATION', 'LIMIT_ROTATION', 'LIMIT_SCALE', 'MAINTAIN_VOLUME', 'TRANSFORM', 'TRANSFORM_CACHE'))
self.draw_operator_column(layout, header="Tracking",
types=('CLAMP_TO', 'DAMPED_TRACK', 'LOCKED_TRACK', 'STRETCH_TO', 'TRACK_TO'))
self.draw_operator_column(layout, header="Relationship",
types=('ACTION', 'ARMATURE', 'CHILD_OF', 'FLOOR', 'FOLLOW_PATH', 'PIVOT', 'SHRINKWRAP'))


class OBJECT_OT_add_constraints_menu(InvokeMenuOperator, Operator):
bl_idname = "object.add_constraints_menu"
bl_label = "Add Object Constraint"
bl_description = "Add a constraint to the active object"

menu_id = "OBJECT_MT_constraint_add"
space_type = 'PROPERTIES'
space_context = 'CONSTRAINT'
layout.template_constraints(use_bone_constraints=False)


class BONE_PT_constraints(BoneConstraintPanel, Panel):
Expand All @@ -73,39 +44,10 @@ class BONE_PT_constraints(BoneConstraintPanel, Panel):

def draw(self, _context):
layout = self.layout
layout.operator("bone.add_constraints_menu", icon='ADD')

layout.template_constraints(use_bone_constraints=True)


class BONE_MT_constraint_add(GenericColumnMenu, Menu):
bl_description = "Add a constraint to the active bone"

op_id = "pose.constraint_add"
OPERATOR_DATA, TRANSLATION_CONTEXT = fetch_op_data(class_name="Constraint")
search_header = "Bone Constraint"

def draw(self, _context):
layout = self.layout.row()

self.draw_operator_column(layout, header="Motion Tracking",
types=('CAMERA_SOLVER', 'FOLLOW_TRACK', 'OBJECT_SOLVER'))
self.draw_operator_column(layout, header="Transform",
types=('COPY_LOCATION', 'COPY_ROTATION', 'COPY_SCALE', 'COPY_TRANSFORMS', 'LIMIT_DISTANCE', 'LIMIT_LOCATION', 'LIMIT_ROTATION', 'LIMIT_SCALE', 'MAINTAIN_VOLUME', 'TRANSFORM', 'TRANSFORM_CACHE'))
self.draw_operator_column(layout, header="Tracking",
types=('CLAMP_TO', 'DAMPED_TRACK', 'IK', 'LOCKED_TRACK', 'SPLINE_IK', 'STRETCH_TO', 'TRACK_TO'))
self.draw_operator_column(layout, header="Relationship",
types=('ACTION', 'ARMATURE', 'CHILD_OF', 'FLOOR', 'FOLLOW_PATH', 'PIVOT', 'SHRINKWRAP'))

layout.operator_menu_enum("pose.constraint_add", "type", text="Add Bone Constraint")

class BONE_OT_add_constraints_menu(InvokeMenuOperator, Operator):
bl_idname = "bone.add_constraints_menu"
bl_label = "Add Bone Constraint"
bl_description = "Add a constraint to the active bone"

menu_id = "BONE_MT_constraint_add"
space_type = 'PROPERTIES'
space_context = 'BONE_CONSTRAINT'
layout.template_constraints(use_bone_constraints=True)


# Parent class for constraint panels, with templates and drawing methods
Expand Down Expand Up @@ -1926,11 +1868,7 @@ def draw(self, context):
classes = (
# Object Panels
OBJECT_PT_constraints,
OBJECT_MT_constraint_add,
OBJECT_OT_add_constraints_menu,
BONE_PT_constraints,
BONE_MT_constraint_add,
BONE_OT_add_constraints_menu,
OBJECT_PT_bChildOfConstraint,
OBJECT_PT_bTrackToConstraint,
OBJECT_PT_bKinematicConstraint,
Expand Down
59 changes: 29 additions & 30 deletions scripts/startup/bl_ui/properties_data_modifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import bpy
from bpy.types import Panel, Menu, Operator
from bl_ui.generic_column_menu import GenericColumnMenu, fetch_op_data, InvokeMenuOperator


class ModifierButtonsPanel:
Expand Down Expand Up @@ -45,17 +44,30 @@ def poll(cls, context):
ob = context.object
return ob and ob.type != 'GPENCIL'

def draw(self, _context):
layout = self.layout
layout.operator("wm.call_menu", text="Add Modifier", icon='ADD').name = "OBJECT_MT_modifier_add"
layout.template_modifiers()


class OBJECT_MT_modifier_add(ModifierAddMenu, Menu):
bl_label = "Add Modifier"
bl_options = {'SEARCH_ON_KEY_PRESS'}

def draw(self, context):
layout = self.layout
ob_type = context.object.type
geometry_nodes_supported = ob_type in {'MESH', 'CURVE', 'CURVES',
'FONT', 'VOLUME', 'POINTCLOUD', 'GREASEPENCIL'}

flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False)
col1 = flow.column()
col2 = flow.column()
if layout.operator_context == 'EXEC_REGION_WIN':
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("WM_OT_search_single_menu", text="Search...",
icon='VIEWZOOM').menu_idname = "OBJECT_MT_modifier_add"
layout.separator()

layout.operator_context = 'EXEC_REGION_WIN'

col1.operator("object.add_modifier_menu", icon='ADD')
if geometry_nodes_supported:
col2.operator("object.add_asset_modifier_menu", icon='ADD')

Expand Down Expand Up @@ -87,19 +99,18 @@ def draw(self, context):
layout.label(text=self.search_header)

if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}:
self.draw_menu_column(layout, menu=OBJECT_MT_modifier_add_edit)

layout.menu("OBJECT_MT_modifier_add_edit")
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'VOLUME', 'GREASEPENCIL'}:
self.draw_menu_column(layout, menu=OBJECT_MT_modifier_add_generate)

layout.menu("OBJECT_MT_modifier_add_generate")
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE', 'VOLUME', 'GREASEPENCIL'}:
self.draw_menu_column(layout, menu=OBJECT_MT_modifier_add_deform)

layout.menu("OBJECT_MT_modifier_add_deform")
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}:
self.draw_menu_column(layout, menu=OBJECT_MT_modifier_add_physics)

layout.menu("OBJECT_MT_modifier_add_physics")
if ob_type in {'GREASEPENCIL'}:
self.draw_menu_column(layout, menu=OBJECT_MT_modifier_add_color)
layout.menu("OBJECT_MT_modifier_add_color")

if geometry_nodes_supported:
layout.menu_contents("OBJECT_MT_modifier_add_root_catalogs")


class OBJECT_MT_modifier_add_edit(ModifierAddMenu, Menu):
Expand All @@ -123,6 +134,7 @@ def draw(self, context):
self.operator_modifier_add(layout, 'VERTEX_WEIGHT_EDIT')
self.operator_modifier_add(layout, 'VERTEX_WEIGHT_MIX')
self.operator_modifier_add(layout, 'VERTEX_WEIGHT_PROXIMITY')
layout.template_modifier_asset_menu_items(catalog_path=self.bl_label)


class OBJECT_MT_modifier_add_generate(ModifierAddMenu, Menu):
Expand All @@ -132,9 +144,6 @@ class OBJECT_MT_modifier_add_generate(ModifierAddMenu, Menu):
def draw(self, context):
layout = self.layout
ob_type = context.object.type
geometry_nodes_supported = ob_type in {'MESH', 'CURVE', 'CURVES',
'FONT', 'VOLUME', 'POINTCLOUD', 'GREASEPENCIL'}

if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}:
self.operator_modifier_add(layout, 'ARRAY')
self.operator_modifier_add(layout, 'BEVEL')
Expand All @@ -144,8 +153,6 @@ def draw(self, context):
self.operator_modifier_add(layout, 'BUILD')
self.operator_modifier_add(layout, 'DECIMATE')
self.operator_modifier_add(layout, 'EDGE_SPLIT')
if geometry_nodes_supported:
self.operator_modifier_add(layout, 'NODES')
if ob_type == 'MESH':
self.operator_modifier_add(layout, 'MASK')
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}:
Expand All @@ -172,6 +179,7 @@ def draw(self, context):
if ob_type == 'GREASEPENCIL':
self.operator_modifier_add(layout, 'GREASE_PENCIL_MIRROR')
self.operator_modifier_add(layout, 'GREASE_PENCIL_SUBDIV')
layout.template_modifier_asset_menu_items(catalog_path=self.bl_label)


class OBJECT_MT_modifier_add_deform(ModifierAddMenu, Menu):
Expand Down Expand Up @@ -232,6 +240,7 @@ def draw(self, context):
self.operator_modifier_add(layout, 'PARTICLE_SYSTEM')
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}:
self.operator_modifier_add(layout, 'SOFT_BODY')
layout.template_modifier_asset_menu_items(catalog_path=self.bl_label)


class OBJECT_MT_modifier_add_color(ModifierAddMenu, Menu):
Expand Down Expand Up @@ -330,7 +339,7 @@ def poll(cls, context):

def draw(self, _context):
layout = self.layout
layout.operator("object.add_gpencil_modifier_menu", text="Add Modifier", icon='ADD')
layout.operator_menu_enum("object.gpencil_modifier_add", "type")
layout.template_grease_pencil_modifiers()


Expand Down Expand Up @@ -372,7 +381,6 @@ class OBJECT_OT_add_gpencil_modifier_menu(InvokeMenuOperator, Operator):
class AddModifierMenu(Operator):
bl_idname = "object.add_modifier_menu"
bl_label = "Add Modifier"
bl_description = "Add a procedural operation/effect to the active object"

@classmethod
def poll(cls, context):
Expand All @@ -395,16 +403,7 @@ def invoke(self, context, event):
OBJECT_MT_modifier_add_deform,
OBJECT_MT_modifier_add_physics,
OBJECT_MT_modifier_add_color,
OBJECT_MT_modifier_add_assets,
OBJECT_MT_modifier_add_edit_assets,
OBJECT_MT_modifier_add_generate_assets,
OBJECT_MT_modifier_add_deform_assets,
OBJECT_MT_modifier_add_physics_assets,
OBJECT_MT_modifier_add_color_assets,
OBJECT_OT_add_asset_modifier_menu,
DATA_PT_gpencil_modifiers,
OBJECT_MT_gpencil_modifier_add,
OBJECT_OT_add_gpencil_modifier_menu,
AddModifierMenu,
)

Expand Down
36 changes: 2 additions & 34 deletions scripts/startup/bl_ui/properties_data_shaderfx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later

from bpy.types import Panel, Menu, Operator
from bl_ui.generic_column_menu import GenericColumnMenu, fetch_op_data, InvokeMenuOperator
from bpy.types import Panel


class ShaderFxButtonsPanel:
Expand All @@ -25,43 +24,12 @@ class DATA_PT_shader_fx(ShaderFxButtonsPanel, Panel):

def draw(self, _context):
layout = self.layout
layout.operator("object.add_gpencil_shaderfx_menu", text="Add Effect", icon='ADD')
layout.operator_menu_enum("object.shaderfx_add", "type")
layout.template_shaderfx()


class OBJECT_MT_gpencil_shaderfx_add(GenericColumnMenu, Menu):
bl_description = "Add a visual effect to the active grease pencil object"

op_id = "object.shaderfx_add"
OPERATOR_DATA, TRANSLATION_CONTEXT = fetch_op_data(class_name="ShaderFx")
search_header = "Effect"

@classmethod
def poll(cls, context):
ob = context.object
return ob and ob.type == 'GPENCIL'

def draw(self, _context):
layout = self.layout.row()

self.draw_operator_column(layout, header="Add Effect",
types=('FX_BLUR', 'FX_COLORIZE', 'FX_FLIP', 'FX_GLOW', 'FX_PIXEL', 'FX_RIM', 'FX_SHADOW', 'FX_SWIRL', 'FX_WAVE'))


class OBJECT_OT_add_gpencil_shaderfx_menu(InvokeMenuOperator, Operator):
bl_idname = "object.add_gpencil_shaderfx_menu"
bl_label = "Add Grease Pencil Effect"
bl_description = "Add a visual effect to the active grease pencil object"

menu_id = "OBJECT_MT_gpencil_shaderfx_add"
space_type = 'PROPERTIES'
space_context = 'SHADERFX'


classes = (
DATA_PT_shader_fx,
OBJECT_MT_gpencil_shaderfx_add,
OBJECT_OT_add_gpencil_shaderfx_menu,
)

if __name__ == "__main__": # only for live edit.
Expand Down

0 comments on commit ddfc2d0

Please sign in to comment.