Skip to content

Commit

Permalink
IECoreHoudini : Remove SOP_ProceduralHolder
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhaddon committed Dec 6, 2017
1 parent 010ab09 commit 896b644
Show file tree
Hide file tree
Showing 32 changed files with 3 additions and 2,606 deletions.
1 change: 0 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -2445,7 +2445,6 @@ if doConfigure :
houdiniTestEnv["ENV"]["HOUDINI_OTLSCAN_PATH"] = "./plugins/houdini:&"

houdiniTestEnv["ENV"]["IECORE_OP_PATHS"] = "./test/IECoreHoudini/ops"
houdiniTestEnv["ENV"]["IECORE_PROCEDURAL_PATHS"] = "./test/IECoreHoudini/procedurals"

houdiniPythonExecutable = "hython"

Expand Down
3 changes: 1 addition & 2 deletions include/IECoreHoudini/GEO_CortexPrimitive.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ class GEO_CortexPrimitive : public GEO_Primitive
virtual int intersectRay( const UT_Vector3 &o, const UT_Vector3 &d, float tmax=1E17F, float tol=1E-12F, float *distance=0, UT_Vector3 *pos=0, UT_Vector3 *nml=0, int accurate=0, float *u=0, float *v=0, int ignoretrim=1 ) const;

/// Set the IECore::Object contained by this GEO_Primitive. Note that in most situations
/// this method takes a copy of the object. However, for ParameterisedProcedurals it does
/// not, and it is the users responsibility to treat the contained object as const.
/// this method takes a copy of the object.
void setObject( const IECore::Object *object );
/// Get the IECore::Object contained by this GEO_Primitive
const IECore::Object *getObject() const;
Expand Down
87 changes: 0 additions & 87 deletions include/IECoreHoudini/SOP_ProceduralHolder.h

This file was deleted.

10 changes: 0 additions & 10 deletions menus/IECoreHoudini/cortex.shelf
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@
soptoolutils.genericTool(kwargs, 'ieOpHolder')]]></script>
</tool>

<!-- Cortex Procedural Holder -->
<tool name="cortex_procedural_holder" label="Cortex Procedural" icon="SOP_ieProceduralHolder">
<toolMenuContext name="network">
<contextNetType>SOP</contextNetType>
</toolMenuContext>
<toolSubmenu>Cortex</toolSubmenu>
<script scriptType="python"><![CDATA[import soptoolutils
soptoolutils.genericTool(kwargs, 'ieProceduralHolder')]]></script>
</tool>

<!-- Cortex To Houdini Converter -->
<tool name="cortex_converter" label="Cortex Convert" icon="SOP_ieToHoudiniConverter">
<toolMenuContext name="network">
Expand Down
61 changes: 0 additions & 61 deletions python/IECoreHoudini/FnProceduralHolder.py

This file was deleted.

41 changes: 0 additions & 41 deletions python/IECoreHoudini/Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
python module.
'''

# returns an instance of a procedural loaded using the defaultProceduralLoader
def proc(type, ver):
return IECore.ClassLoader.defaultProceduralLoader().load(type,ver)()

# returns an instance of an op loaded using the defaultOpLoader
def op(type, ver):
return IECore.ClassLoader.defaultOpLoader().load(type,ver)()
Expand Down Expand Up @@ -126,51 +122,14 @@ def setHoudiniParm( node, p ):
if p.typeId()==IECore.TypeId.Box3dParameter:
node.parmTuple( "parm_%s" % p.name ).set( list(value) )

# updates all the houdini parameters based on an Op/Procedural's parameter values
def syncSopParametersWithProcedural(n):
fn = IECoreHoudini.FnProceduralHolder( n )
parms = fn.getParameterised().parameters().values()
for p in parms:
if n.parm("parm_%s"%p.name):
setHoudiniParm( n, p )

def syncSopParametersWithOp(n):
fn = IECoreHoudini.FnOpHolder( n )
parms = fn.getParameterised().parameters().values()
for p in parms:
if n.parm("parm_%s"%p.name):
setHoudiniParm( n, p )

# reloads a procedural based on the values of the type/version parameters
# \todo: this can be combined with the reloadOp code
def reloadProcedural():
n = hou.node(".")
type = n.evalParm("__opType")
ver = n.evalParm("__opVersion")
if type=="" or ver=="":
return
ver = int(ver)
fn = IECoreHoudini.FnProceduralHolder(n)
IECore.ClassLoader.defaultProceduralLoader().refresh()
cl = IECoreHoudini.proc( type, ver )

# cache our existing parameters
parms = fn.getParameterised().parameters().values()
saved_parms = {}
for p in parms:
saved_parms[p.name] = p.getValue().value

# reload parameter interface
fn.setParameterised(cl)

# restore parameter values
for p in saved_parms.keys():
hparm = n.parm("parm_%s" % p)
if hparm:
hparm.set( saved_parms[p] )

# reloads an op based on the values of the type/version parameters
# \todo: this can be combined with the reloadProc code
def reloadOp():
n = hou.node(".")
type = n.evalParm("__opType")
Expand Down
1 change: 0 additions & 1 deletion python/IECoreHoudini/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
# function sets
from FnParameterisedHolder import FnParameterisedHolder
from FnOpHolder import FnOpHolder
from FnProceduralHolder import FnProceduralHolder

# misc utility methods
from TestCase import TestCase
Expand Down
6 changes: 0 additions & 6 deletions src/IECoreHoudini/FromHoudiniCortexObjectConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "boost/python.hpp"

#include "IECore/CompoundObject.h"
#include "IECoreScene/ParameterisedProcedural.h"

#include "IECoreHoudini/FromHoudiniCortexObjectConverter.h"
#include "IECoreHoudini/GEO_CortexPrimitive.h"
Expand Down Expand Up @@ -111,11 +110,6 @@ ObjectPtr FromHoudiniCortexObjectConverter::doDetailConversion( const GU_Detail

if ( object )
{
if ( object->isInstanceOf( IECoreScene::ParameterisedProcedural::staticTypeId() ) )
{
return boost::const_pointer_cast<IECore::Object>( object );
}

return object->copy();
}

Expand Down
12 changes: 2 additions & 10 deletions src/IECoreHoudini/GEO_CortexPrimitive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
#include "IECoreScene/CoordinateSystem.h"
#include "IECoreScene/Group.h"
#include "IECoreScene/MatrixTransform.h"
#include "IECoreScene/ParameterisedProcedural.h"
#include "IECoreScene/Primitive.h"
#include "IECoreScene/TransformOp.h"
#include "IECoreScene/VisibleRenderable.h"
Expand Down Expand Up @@ -400,15 +399,8 @@ const IECore::Object *GEO_CortexPrimitive::getObject() const

void GEO_CortexPrimitive::setObject( const IECore::Object *object )
{
if ( object->isInstanceOf( IECoreScene::ParameterisedProcedural::staticTypeId() ) )
{
m_object = const_cast<IECore::Object *>( object );
}
else
{
/// \todo: should this be a deep copy?
m_object = object->copy();
}
/// \todo: should this be a deep copy?
m_object = object->copy();
}

const char *GEO_CortexPrimitive::typeName = "CortexObject";
Expand Down
20 changes: 0 additions & 20 deletions src/IECoreHoudini/SOP_CortexConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@

#include "IECoreScene/CapturingRenderer.h"
#include "IECoreScene/Group.h"
#include "IECoreScene/ParameterisedProcedural.h"
#include "IECoreScene/WorldBlock.h"
#include "IECorePython/ScopedGILLock.h"
#include "IECorePython/ScopedGILRelease.h"
Expand Down Expand Up @@ -189,25 +188,6 @@ void SOP_CortexConverter::doConvert( const GU_DetailHandle &handle, const std::s
return;
}

if ( IECoreScene::ParameterisedProcedural *procedural = IECore::runTimeCast<IECoreScene::ParameterisedProcedural>( result.get() ) )
{
IECoreScene::CapturingRendererPtr renderer = new IECoreScene::CapturingRenderer();
// We are acquiring and releasing the GIL here to ensure that it is released when we render. This has
// to be done because a procedural might jump between c++ and python a few times (i.e. if it spawns
// subprocedurals that are implemented in python). In a normal call to cookMySop, this wouldn't be an
// issue, but if cookMySop was called from HOM, hou.Node.cook appears to be holding onto the GIL.
IECorePython::ScopedGILLock gilLock;
{
IECorePython::ScopedGILRelease gilRelease;
{
IECoreScene::WorldBlock worldBlock( renderer );
procedural->render( renderer.get() );
}
}

result = boost::const_pointer_cast<IECore::Object>( IECore::runTimeCast<const IECore::Object>( renderer->world() ) );
}

ToHoudiniGeometryConverterPtr converter = ( type == Cortex ) ? new ToHoudiniCortexObjectConverter( result.get() ) : ToHoudiniGeometryConverter::create( result.get() );
converter->nameParameter()->setTypedValue( name );
converter->attributeFilterParameter()->setTypedValue( attributeFilter );
Expand Down
21 changes: 0 additions & 21 deletions src/IECoreHoudini/SOP_ParameterisedHolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include "IECore/Op.h"
#include "IECoreScene/CapturingRenderer.h"
#include "IECoreScene/Group.h"
#include "IECoreScene/ParameterisedProcedural.h"
#include "IECoreScene/WorldBlock.h"

#include "IECorePython/ScopedGILLock.h"
Expand Down Expand Up @@ -184,26 +183,6 @@ void SOP_ParameterisedHolder::setInputParameterValue( IECore::Parameter *paramet
{
return;
}

if ( IECoreScene::ParameterisedProcedural *procedural = IECore::runTimeCast<IECoreScene::ParameterisedProcedural>( result.get() ) )
{
IECoreScene::CapturingRendererPtr renderer = new IECoreScene::CapturingRenderer();
// We are acquiring and releasing the GIL here to ensure that it is released when we render. This has
// to be done because a procedural might jump between c++ and python a few times (i.e. if it spawns
// subprocedurals that are implemented in python). In a normal call to cookMySop, this wouldn't be an
// issue, but if cookMySop was called from HOM, hou.Node.cook appears to be holding onto the GIL.
IECorePython::ScopedGILLock gilLock;
{
IECorePython::ScopedGILRelease gilRelease;
{
IECoreScene::WorldBlock worldBlock( renderer );
procedural->render( renderer.get() );
}
}

result = boost::const_pointer_cast<IECore::Object>( IECore::runTimeCast<const IECore::Object>( renderer->world() ) );
}

parameter->setValidatedValue( result );
}
catch ( const IECore::Exception &e )
Expand Down
Loading

0 comments on commit 896b644

Please sign in to comment.