How to Determine if an Object Supports Effectors?
-
On 01/08/2016 at 11:37, xxxxxxxx wrote:
Hi,
What is the best practice to check to see if an object is a MoGraph object and supports effectors? I'm currently manually building a list of object ID's and checking against that.
def is_cloner(obj) : CLONER_IDS = [ 1018544, # Cloner 1018545, # Matrix 1018791, # Fracture 1018957, # MoInstance 1019268, # MoText 1018655, # Tracer 440000054 # MoSpline ] if obj.GetType() in CLONER_IDS: return True return False
This works fine until a new cloner object is introduced (like the new Voronoi Fracture), at which point my plugin doesn't behave as expected and I have to add the new ID and push out an update to all users. Is there a method in the mograph module for checking this?
Thanks,Donovan
-
On 02/08/2016 at 02:26, xxxxxxxx wrote:
Hi Donovan,
all these objects are an instance of Obasemogen. Just note, this is also true for the PolyFX, but as it takes effectors as well, it's probably even a desired side effect.
-
On 02/08/2016 at 14:38, xxxxxxxx wrote:
Perfect. Thank you!
"""Is it a MoGraph Generator? """ import c4d from c4d import gui #Welcome to the world of Python def main() : if not op: return if op.IsInstanceOf(c4d.Obasemogen) : print op.GetName() + " is a MoGraph Generator!" else: print op.GetName() + "is not a MoGraph Generator." if __name__=='__main__': main()
It seems like "Obasemogen" isn't documented in the Python SDK, so I'd suggest adding it.
Thanks!Donovan