From 23bb101d5c728b2378bdb6e816d400e88d6b3372 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Mon, 2 Jan 2017 19:31:26 +0100 Subject: Initial --- DefCore.txt | 4 ++++ Graphics.png | Bin 0 -> 167 bytes Script.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 DefCore.txt create mode 100644 Graphics.png create mode 100644 Script.c diff --git a/DefCore.txt b/DefCore.txt new file mode 100644 index 0000000..22fbfd6 --- /dev/null +++ b/DefCore.txt @@ -0,0 +1,4 @@ +[DefCore] +id=CM7I +Name=ContextmenuEntryHelper +Category=C4D_StaticBack diff --git a/Graphics.png b/Graphics.png new file mode 100644 index 0000000..94ed211 Binary files /dev/null and b/Graphics.png differ diff --git a/Script.c b/Script.c new file mode 100644 index 0000000..3d4acf7 --- /dev/null +++ b/Script.c @@ -0,0 +1,35 @@ +#strict 2 + +static ContextMenuEntry_Helper; +static const DT_EffectContext_Helper = CM7I; + +global func AddContextMenuEntry(callback, condition, object target) +{ + ContextMenuEntry_Helper = ContextMenuEntry_Helper || CreateObject(CM7I); + return AddEffect("IntCtxMenuEntry" , target || this, 1, 0, ContextMenuEntry_Helper, 0, callback, condition); +} + +global func RemoveContextMenuEntry(int id, object target) +{ + return RemoveEffect(0, target || this, id); +} + +func FxIntCtxMenuEntryStart(object target, int effectNumber, int temp, callback, condition) +{ + if(!temp) + { + EffectVar(0, target, effectNumber) = callback; + EffectVar(1, target, effectNumber) = condition; + } +} + +func FxIntCtxMenuEntryConditionContext(object target, int effectNumber, object menuObject, id image) +{ + return !EffectVar(1, target, effectNumber) || Call(EffectVar(1, target, effectNumber), [target, effectNumber, menuObject, image]); +} + +func FxIntCtxMenuEntryContext(object target, int effectNumber, object menuObject, id image) +{ + [Dynamischer Eintrag|Condition=FxIntCtxMenuEntryConditionContext|Image=FLNT] + return EffectVar(0, target, effectNumber) && target->Call(EffectVar(0, target, effectNumber), [target, effectNumber, menuObject, image]); +} -- cgit v1.2.3-54-g00ecf