From 690bd70360e710f121ffa8edc83908ca95fc5528 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 5 Jul 2015 21:44:51 -0400 Subject: [PATCH] Add modifier dependencies These are hints that will auto-enable certain modifiers. It makes no sense to have an Animation Loop modifier with no Animation modifier... --- korman/operators/op_modifier.py | 7 +++++++ korman/properties/modifiers/anim.py | 1 + 2 files changed, 8 insertions(+) diff --git a/korman/operators/op_modifier.py b/korman/operators/op_modifier.py index bd774f7..d0cfd59 100644 --- a/korman/operators/op_modifier.py +++ b/korman/operators/op_modifier.py @@ -52,6 +52,13 @@ class ModifierAddOperator(ModifierOperator, bpy.types.Operator): theMod.display_order = plmods.determine_next_id() theMod.created(context.object) + + # Determine if this modifier has any dependencies and make sure they're enabled + deps = getattr(theMod, "pl_depends", set()) + for dep in deps: + depMod = getattr(plmods, dep) + if not depMod.enabled: + bpy.ops.object.plasma_modifier_add(types=dep) return {"FINISHED"} diff --git a/korman/properties/modifiers/anim.py b/korman/properties/modifiers/anim.py index 8475085..328ec0c 100644 --- a/korman/properties/modifiers/anim.py +++ b/korman/properties/modifiers/anim.py @@ -140,6 +140,7 @@ class LoopMarker(bpy.types.PropertyGroup): class PlasmaAnimationLoopModifier(PlasmaModifierProperties): pl_id = "animation_loop" + pl_depends = {"animation"} bl_category = "Animation" bl_label = "Loop Markers"