本文整理汇总了Python中GafferScene.registerAdaptor方法的典型用法代码示例。如果您正苦于以下问题:Python GafferScene.registerAdaptor方法的具体用法?Python GafferScene.registerAdaptor怎么用?Python GafferScene.registerAdaptor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GafferScene
的用法示例。
在下文中一共展示了GafferScene.registerAdaptor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testAdaptors
# 需要导入模块: import GafferScene [as 别名]
# 或者: from GafferScene import registerAdaptor [as 别名]
def testAdaptors( self ) :
sphere = GafferScene.Sphere()
def a() :
result = GafferArnold.ArnoldAttributes()
result["attributes"]["matte"]["enabled"].setValue( True )
result["attributes"]["matte"]["value"].setValue( True )
return result
GafferScene.registerAdaptor( "Test", a )
sphere = GafferScene.Sphere()
render = GafferArnold.ArnoldRender()
render["in"].setInput( sphere["out"] )
render["mode"].setValue( render.Mode.SceneDescriptionMode )
render["fileName"].setValue( self.temporaryDirectory() + "/test.ass" )
render["task"].execute()
with IECoreArnold.UniverseBlock( writable = True ) :
arnold.AiASSLoad( self.temporaryDirectory() + "/test.ass" )
node = arnold.AiNodeLookUpByName( "/sphere" )
self.assertEqual( arnold.AiNodeGetBool( node, "matte" ), True )
示例2: test
# 需要导入模块: import GafferScene [as 别名]
# 或者: from GafferScene import registerAdaptor [as 别名]
def test( self ) :
sphere = GafferScene.Sphere()
adaptors = GafferScene.createAdaptors()
adaptors["in"].setInput( sphere["out"] )
self.assertScenesEqual( sphere["out"], adaptors["out"] )
self.assertSceneHashesEqual( sphere["out"], adaptors["out"] )
def a() :
r = GafferScene.StandardAttributes()
r["attributes"]["doubleSided"]["enabled"].setValue( True )
r["attributes"]["doubleSided"]["value"].setValue( False )
return r
GafferScene.registerAdaptor( "Test", a )
adaptors = GafferScene.createAdaptors()
adaptors["in"].setInput( sphere["out"] )
self.assertFalse( "doubleSided" in sphere["out"].attributes( "/sphere" ) )
self.assertTrue( "doubleSided" in adaptors["out"].attributes( "/sphere" ) )
self.assertEqual( adaptors["out"].attributes( "/sphere" )["doubleSided"].value, False )
GafferScene.deregisterAdaptor( "Test" )
adaptors = GafferScene.createAdaptors()
adaptors["in"].setInput( sphere["out"] )
self.assertScenesEqual( sphere["out"], adaptors["out"] )
self.assertSceneHashesEqual( sphere["out"], adaptors["out"] )
示例3: testAdaptors
# 需要导入模块: import GafferScene [as 别名]
# 或者: from GafferScene import registerAdaptor [as 别名]
def testAdaptors( self ) :
s = Gaffer.ScriptNode()
s["s"] = GafferScene.Sphere()
def a() :
result = GafferScene.SceneProcessor()
result["__shader"], colorPlug = self._createConstantShader()
colorPlug.setValue( imath.Color3f( 1, 0, 0 ) )
result["__assignment"] = GafferScene.ShaderAssignment()
result["__assignment"]["in"].setInput( result["in"] )
result["__assignment"]["shader"].setInput( result["__shader"]["out"] )
result["out"].setInput( result["__assignment"]["out"] )
return result
GafferScene.registerAdaptor( "Test", a )
s["o"] = GafferScene.Outputs()
s["o"].addOutput(
"beauty",
IECoreScene.Display(
"test",
"ieDisplay",
"rgba",
{
"driverType" : "ImageDisplayDriver",
"handle" : "myLovelySphere",
}
)
)
s["o"]["in"].setInput( s["s"]["out"] )
s["r"] = self._createInteractiveRender()
s["r"]["in"].setInput( s["o"]["out"] )
s["r"]["state"].setValue( s["r"].State.Running )
time.sleep( 0.5 )
# Render red sphere
image = IECoreImage.ImageDisplayDriver.storedImage( "myLovelySphere" )
self.__assertColorsAlmostEqual( self.__color4fAtUV( image, imath.V2f( 0.5 ) ), imath.Color4f( 1, 0, 0, 1 ), delta = 0.01 )
示例4: DAMAGES
# 需要导入模块: import GafferScene [as 别名]
# 或者: from GafferScene import registerAdaptor [as 别名]
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided with
# the distribution.
#
# * Neither the name of John Haddon nor the names of
# any other contributors to this software may be used to endorse or
# promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
##########################################################################
import GafferScene
# Registering an adaptor by providing a callable that returns a SceneProcessor.
# If it's necessary to set attributes on the node, provide a function object
# that wraps a call to the class object.
GafferScene.registerAdaptor( "LightLinking", GafferScene.EvaluateLightLinks )