From 6ee37e4bb6f62b60dccd6cba3fa7700f3be1d607 Mon Sep 17 00:00:00 2001 From: John Haddon Date: Wed, 22 Apr 2015 11:57:10 +0100 Subject: [PATCH] Used ScenePathPlugValueWidget for all appropriate plugs. --- python/GafferSceneUI/DuplicateUI.py | 6 ++---- python/GafferSceneUI/IsolateUI.py | 6 ++---- python/GafferSceneUI/MapProjectionUI.py | 20 ++++++++++++++++---- python/GafferSceneUI/SceneNodeUI.py | 10 ++-------- python/GafferSceneUI/StandardOptionsUI.py | 20 ++++++++++++++++---- python/GafferSceneUI/SubTreeUI.py | 5 +---- 6 files changed, 39 insertions(+), 28 deletions(-) diff --git a/python/GafferSceneUI/DuplicateUI.py b/python/GafferSceneUI/DuplicateUI.py index 2ae276aeba3..2cb25f91f82 100644 --- a/python/GafferSceneUI/DuplicateUI.py +++ b/python/GafferSceneUI/DuplicateUI.py @@ -38,6 +38,7 @@ import GafferUI import GafferScene +import GafferSceneUI ########################################################################## # Metadata @@ -115,10 +116,7 @@ GafferUI.PlugValueWidget.registerCreator( GafferScene.Duplicate, "target", - lambda plug : GafferUI.PathPlugValueWidget( - plug, - path = GafferScene.ScenePath( plug.node()["in"], plug.node().scriptNode().context(), "/" ), - ), + GafferSceneUI.ScenePathPlugValueWidget ) GafferUI.PlugValueWidget.registerCreator( GafferScene.Duplicate, "transform", GafferUI.TransformPlugValueWidget, collapsed=None ) diff --git a/python/GafferSceneUI/IsolateUI.py b/python/GafferSceneUI/IsolateUI.py index 5c6dd127f57..f8d2f8bf2ce 100644 --- a/python/GafferSceneUI/IsolateUI.py +++ b/python/GafferSceneUI/IsolateUI.py @@ -38,6 +38,7 @@ import GafferUI import GafferScene +import GafferSceneUI ########################################################################## # Metadata @@ -61,8 +62,5 @@ GafferUI.PlugValueWidget.registerCreator( GafferScene.Isolate, "from", - lambda plug : GafferUI.PathPlugValueWidget( - plug, - path = GafferScene.ScenePath( plug.node()["in"], plug.node().scriptNode().context(), "/" ), - ), + GafferSceneUI.ScenePathPlugValueWidget ) diff --git a/python/GafferSceneUI/MapProjectionUI.py b/python/GafferSceneUI/MapProjectionUI.py index d0957e7c1dd..461de283979 100644 --- a/python/GafferSceneUI/MapProjectionUI.py +++ b/python/GafferSceneUI/MapProjectionUI.py @@ -34,15 +34,27 @@ # ########################################################################## +import IECore + import Gaffer import GafferUI import GafferScene +import GafferSceneUI GafferUI.PlugValueWidget.registerCreator( GafferScene.MapProjection, "camera", - lambda plug : GafferUI.PathPlugValueWidget( - plug, - path = GafferScene.ScenePath( plug.node()["in"], plug.node().scriptNode().context(), "/" ), - ), + GafferSceneUI.ScenePathPlugValueWidget +) + +Gaffer.Metadata.registerPlugValue( + GafferScene.MapProjection, + "camera", + "scenePathPlugValueWidget:setNames", IECore.StringVectorData( [ "__cameras" ] ) ) + +Gaffer.Metadata.registerPlugValue( + GafferScene.MapProjection, + "camera", + "scenePathPlugValueWidget:setsLabel", "Show only cameras" +) \ No newline at end of file diff --git a/python/GafferSceneUI/SceneNodeUI.py b/python/GafferSceneUI/SceneNodeUI.py index a5e5c909241..6772dd16e7c 100644 --- a/python/GafferSceneUI/SceneNodeUI.py +++ b/python/GafferSceneUI/SceneNodeUI.py @@ -108,10 +108,7 @@ def __noduleCreator( plug ) : GafferUI.PlugValueWidget.registerCreator( GafferScene.BranchCreator, "parent", - lambda plug : GafferUI.PathPlugValueWidget( - plug, - path = GafferScene.ScenePath( plug.node()["in"], plug.node().scriptNode().context(), "/" ), - ), + GafferSceneUI.ScenePathPlugValueWidget ) # Group @@ -124,10 +121,7 @@ def __noduleCreator( plug ) : GafferUI.PlugValueWidget.registerCreator( GafferScene.Constraint, "target", - lambda plug : GafferUI.PathPlugValueWidget( - plug, - path = GafferScene.ScenePath( plug.node()["in"], plug.node().scriptNode().context(), "/" ), - ), + GafferSceneUI.ScenePathPlugValueWidget ) GafferUI.PlugValueWidget.registerCreator( diff --git a/python/GafferSceneUI/StandardOptionsUI.py b/python/GafferSceneUI/StandardOptionsUI.py index 8ce376de28a..2f1a558b7ad 100644 --- a/python/GafferSceneUI/StandardOptionsUI.py +++ b/python/GafferSceneUI/StandardOptionsUI.py @@ -34,9 +34,12 @@ # ########################################################################## +import IECore + import Gaffer import GafferUI import GafferScene +import GafferSceneUI ## \todo This is getting used in a few places now - maybe put it in one # place? Maybe a static method on NumericWidget? @@ -122,8 +125,17 @@ def __motionBlurSummary( plug ) : GafferUI.PlugValueWidget.registerCreator( GafferScene.StandardOptions, "options.renderCamera.value", - lambda plug : GafferUI.PathPlugValueWidget( - plug, - path = GafferScene.ScenePath( plug.node()["in"], plug.node().scriptNode().context(), "/" ), - ), + GafferSceneUI.ScenePathPlugValueWidget ) + +Gaffer.Metadata.registerPlugValue( + GafferScene.StandardOptions, + "options.renderCamera.value", + "scenePathPlugValueWidget:setNames", IECore.StringVectorData( [ "__cameras" ] ) +) + +Gaffer.Metadata.registerPlugValue( + GafferScene.StandardOptions, + "options.renderCamera.value", + "scenePathPlugValueWidget:setsLabel", "Show only cameras" +) \ No newline at end of file diff --git a/python/GafferSceneUI/SubTreeUI.py b/python/GafferSceneUI/SubTreeUI.py index 6fdf6f15756..94a7a3d4b71 100644 --- a/python/GafferSceneUI/SubTreeUI.py +++ b/python/GafferSceneUI/SubTreeUI.py @@ -62,8 +62,5 @@ GafferUI.PlugValueWidget.registerCreator( GafferScene.SubTree, "root", - lambda plug : GafferUI.PathPlugValueWidget( - plug, - path = GafferScene.ScenePath( plug.node()["in"], plug.node().scriptNode().context(), "/" ), - ), + GafferSceneUI.ScenePathPlugValueWidget )