Mailing List
Home
Forum Home
Softimage
Carrara
trueSpace
Dir3d-l
Maya - a powerful 3D animation and visual effects software
Macromedia Flash Development
Subjects
Cameras
scaleDown command
black out solved
Aircraft Tutorial
Mathematical XYZ ?
Its done This vs That
Its done first week
recommendations for screen video captures?
3DExplorer "Oddity "
New Director
ProTeam renewals
Fuel 's new websites (X post)
Blue peter create a make toy
targeting groups question
XPost: Shockwave 3D game ( sort of )
RES: RES: RES: Fish Modeling
Emitting particles from object intersection
Fuel 's new websites (X post)
Texturing
Big Break Contest Videos
New Plugins
Models and Texture on my updated site
Error Installing Patch tS6 6
Plasma?
Looking for Inspiration
Weird EMail Q
It 's done first week ?
Cherry not cranberry
New game
Camera Animation Problem
Particle plugins?
 
avoiding using get value with python

avoiding using get value with python

2005-03-25       - By Bernard Lebel

 Back
Reply:     1     2     3     4     5     6     7     8     9  

Thanks a bunch Jerry for this precious info. Hope it gets put in the skd
docs :-)


Bernard



Jerry Gamache wrote:
> XSI sometimes return objects with an incorrectly set (as per PythonWin
standards) multi-dispatch interface.
>
> The way to work around that is to re-wrap the object in a dynamic dispatch.
This allows you to skip the Application.GetValue:
>
> def dispFix( badDispatch ):
>   import win32com.client.dynamic
>   # Re-Wraps a bad dispatch into a working one:
>   return win32com.client.dynamic.Dispatch(badDispatch)
>
> # Let's see if this works:
> Application.CreatePrim("Sphere", "MeshSurface", "", "")
> Application.ApplyHairOp("sphere", "")
> oHair = Application.GetValue("hair").ActivePrimitive.ConstructionHistory.Find
("HairGenOp")
> try:
>   Application.LogMessage(oHair.Parameters['EmitterMeshSubdlevel'].Value)
> except:
>   Application.LogMessage("Incorrect dispatch pointer")
> oHair = dispFix(oHair)
> Application.LogMessage(oHair.Parameters['EmitterMeshSubdlevel'].Value)
>
> # or, as a single long line:
>
> dispFix(Application.GetValue("hair")  
>     .ActivePrimitive.ConstructionHistory
>     .Find("HairGenOp")
>   ).Parameters['EmitterMeshSubdlevel'].Value = 1
>
> If that really really annoys you and you don't want to dispFix at all, there
is a way to make sure everything works, but you need to modify a Python file to
always return dynamic dispatches:
>
> Change %PYTHONPATH%\Lib\site-packages\win32com\client\__init__.py
>
> Look for the function called __WrapDispatch
>
> And comment all lines except the last one that begins with "return dynamic
.Dispatch( ... "
>
> Of course it is always a good idea to backup files you are about to modify.


---
Unsubscribe? Mail Majordomo@(protected) with the following text in body:
unsubscribe xsi