Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support for isinstance(). It will work as in Nuke. The only dif…

…ference is that it will also return True for isinstance(<anything>, nukeExternalControl.client.NukeObject)
  • Loading branch information...
commit 8586c460f0f1d9ecb7bc5df3b13308be686237b9 1 parent 8921981
Hugh Macdonald HughMacdonald authored
Showing with 8 additions and 13 deletions.
  1. +7 −12 nukeExternalControl/client.py
  2. +1 −1  nukeExternalControl/server.py
19 nukeExternalControl/client.py
View
@@ -414,18 +414,13 @@ def __del__(self):
'''
return self._connection.delete_object(self._id)
- #def __instancecheck__(self, cls):
- # '''
- # Check whether the object is an instance of a specific class
- #
- # result = isinstance(object, cls)
- # '''
- # print "Checking isinstance"
- # print self._id
- # return self._connection.get_object_isinstance(self._id, cls)
- #
- #def __instancechecksafe__(self, instance):
- # return object.__instancecheck__(self, instance)
+ def __instancecheck__(cls, inst):
+ '''
+ Check whether the object is an instance of a specific class
+
+ result = isinstance(inst, cls)
+ '''
+ return cls._connection.get_object_isinstance(cls._id, inst)
def __subclasscheck__(self, subclass):
'''
2  nukeExternalControl/server.py
View
@@ -203,7 +203,7 @@ def get(self, data):
elif data['action'] == "del":
del obj
elif data['action'] == "isinstance":
- result = isinstance(obj, params)
+ result = obj.__instancecheck__(params)
elif data['action'] == "issubclass":
result = issubclass(params, obj)
elif action == "import":
Please sign in to comment.
Something went wrong with that request. Please try again.