From 87a0f14e924e95d7412f41ba909db85d031899af Mon Sep 17 00:00:00 2001 From: miquelcampos Date: Mon, 7 Nov 2022 10:02:43 +0900 Subject: [PATCH] Shifter: build from selection should try to auto select the guide if nothing is selected closes #170 --- release/scripts/mgear/shifter/__init__.py | 2 +- release/scripts/mgear/shifter/guide.py | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/release/scripts/mgear/shifter/__init__.py b/release/scripts/mgear/shifter/__init__.py index e89501a1..e231a19b 100644 --- a/release/scripts/mgear/shifter/__init__.py +++ b/release/scripts/mgear/shifter/__init__.py @@ -232,7 +232,7 @@ def buildFromSelection(self): selection = pm.ls("guide") if not selection: mgear.log( - "Not guide found or selected.\n " + "Not guide found or selected.\n" + "Select one or more guide root or a guide model", mgear.sev_error, ) diff --git a/release/scripts/mgear/shifter/guide.py b/release/scripts/mgear/shifter/guide.py index 4ff92398..158cbc16 100644 --- a/release/scripts/mgear/shifter/guide.py +++ b/release/scripts/mgear/shifter/guide.py @@ -442,11 +442,16 @@ def setFromSelection(self): """Set the guide hierarchy from selection.""" selection = pm.ls(selection=True) if not selection: - mgear.log( - "Select one or more guide root or a guide model", - mgear.sev_error) - self.valid = False - return False + selection = pm.ls("guide") + if not selection: + mgear.log( + "Not guide found or selected.\n" + + "Select one or more guide root or a guide model", + mgear.sev_error, + ) + return + self.valid = False + return False for node in selection: self.setFromHierarchy(node, node.hasAttr("ismodel"))