humm no that callback is because of attribute editor though it is not displayed... ...but outliner update lag is still there if there is no 3d view for LOD. Wondering what else can be possible so LOD node can listen to world matrix change?
On Aug 16, 8:01 pm, susanta <susant...@gmail.com> wrote: > You are right with all of these. But I'm more expermenting with it ... > I'm speculating even not camera shape or any node's world matrix, LOD > visibility trigger mechanism actually > driven by some other kind of callback mechanism or somthing else? Ok > let me tell you my observation... > > when you change camera distance by changing camera position you can > see on outliner, node's under LOD group grayed out or > highlighted based on current distance immidiately after distance > change. In my test I'm using a locator, whose worldmatrix connected > with LOD group node's > camera matrix...so by changing locator's location I can change LOD > visibility. changes are very quick and works for othographic or > perspective view. But if I now turn off all 3d view...(i have a single > viewport and now I'm displaying timeline in that area) If I change > locator's position through channel editor...from outliner I can see > LOD Group not immdiately changing LOD visibility for chilld > nodes....untill i change my selection state or back to 3d view. Even > if i move my time slider or manually call dgeval on locator node still > no feeback for LOD visibility change on outliner. Is it some kind of > viewport refresh or selection change or etc callback driving it > instead of DAG tree evalution? > > Another observation, if my locator's is not connected with > loadgroup...it does not print this after changing its transform > through channel editor but it does when connected to a LOD group > > AEupdateWorldPivots locator1; > AEupdateLocalPivots locator1; > AEupdateLocalPivots locator1; > > ...so I'm assuming this is the function they are using as > callback...i.e. external querry to noode's world matrix via MEL? I > hope I'm wrong. > > global proc AEupdateWorldPivots ( string $nodeName ) > { > float $worldRotatePivot[] = `xform -ws -q -rp $nodeName`; > float $worldScalePivot[] = `xform -ws -q -sp $nodeName`; > > floatField -e -v $worldRotatePivot[0] wrpX; > floatField -e -v $worldRotatePivot[1] wrpY; > floatField -e -v $worldRotatePivot[2] wrpZ; > > floatField -e -v $worldScalePivot[0] wspX; > floatField -e -v $worldScalePivot[1] wspY; > floatField -e -v $worldScalePivot[2] wspZ; > > } > > On Aug 16, 6:10 pm, John Creson <johncre...@gmail.com> wrote: > > > LOD global world space attribute gives the LOD group node the ability > > to be driven by changes to its parents' transforms. > > > Before, or when the world space attribute is unchecked, the parent > > transformations did not affect the visibility of the LOD group > > children. Now that it is there and checked on, changes to its parent > > nodes cause updates to the distance attribute which is calculated > > between the LOD node and the camera. (it acts as you would expect it > > to act, and more importantly, the transformations of its parents > > (which could be joints, why not?) trigger the update to its distance > > attribute) > > > On Mon, Aug 16, 2010 at 6:36 AM, susanta <susant...@gmail.com> wrote: > > > "Have you set up the node's attribute dependencies?" > > > > ...are you talking about overriding setDependentsDirty function? > > > > "...but the LOD group node has a global world space attribute..." > > > Seems like in case of LOD group node driving force is camera shape > > > node's worldMatrix (connected to cameraMatrix of LOD group node)...as > > > you said global world space attribute is telling how to calculate > > > node's LOD feature and affects child node's visibility...so in this > > > case really transform nodes's world matrix (in my case Bone) is not > > > the driving force for DAG evalution. It is interesting though..thanks. > > > > On Aug 14, 9:08 am, John Creson <johncre...@gmail.com> wrote: > > >> I'm not sure if this might help, but the LOD group node has a global > > >> world space attribute, that when checked on allows the distance to the > > >> connected camera to be calculated correctly even if the LOD group node > > >> is parented to other transformed transforms. > > > >> On Fri, Aug 13, 2010 at 6:43 PM, Judah Baron <judah.ba...@gmail.com> > > >> wrote: > > >> > Have you set up the node's attribute dependencies? > > > >> > On Fri, Aug 13, 2010 at 9:04 AM, susanta <susant...@gmail.com> wrote: > > > >> >> No luck :(. tried to connect currentChainLength (which is the output > > >> >> of my node) to another locator's tx plug....only get evalution once > > >> >> (opening file, or selecting my node in Attribute editor....i.e. > > >> >> external querry to worldMatrix plug)...here is the rough test code... > > > >> >> class ChainLengthCalc(omx.MPxNode): > > >> >> kPluginNodeTypeName = "ChainLengthCalc" > > >> >> kPluginNodeTypeId = om.MTypeId(0xd1a9257) > > >> >> evalIndex = 0 > > >> >> def __init__(self): > > >> >> omx.MPxNode.__init__(self) > > > >> >> def compute(self,plug,dataBlock): > > >> >> if plug == self.currentChainLength: > > >> >> print "hello" > > >> >> ChainLengthCalc.evalIndex+=1 > > >> >> currentLength = ChainLengthCalc.evalIndex > > >> >> ##self._getChainLength() > > >> >> outHandle = > > >> >> dataBlock.outputValue(self.currentChainLength) > > >> >> > > >> >> outHandle.setMDistance(om.MDistance(currentLength)) > > >> >> dataBlock.setClean(self.currentChainLength) > > >> >> return om.MStatus.kSuccess > > >> >> return m.MStatus.kUnknownParameter > > > >> >> �...@classmethod > > >> >> def creator(cls): > > >> >> return omx.asMPxPtr( cls() ) > > > >> >> �...@classmethod > > >> >> def initialize(cls): > > >> >> unitAttr = om.MFnUnitAttribute() > > >> >> cls.currentChainLength = \ > > >> >> unitAttr.create("currentChainLength", "ccl", > > >> >> om.MFnUnitAttribute.kDistance, 0) > > >> >> unitAttr.setKeyable(False) > > >> >> unitAttr.setWritable(True) > > >> >> cls.addAttribute(cls.currentChainLength) > > > >> >> mAttr = om.MFnMatrixAttribute() > > >> >> cls.drivingBoneMatrixAttr = mAttr.create( > > >> >> "drivingBoneMatrix", > > >> >> "dbm") > > >> >> mAttr.setStorable(True) > > >> >> mAttr.setWritable(True) > > >> >> cls.addAttribute(cls.drivingBoneMatrixAttr) > > >> >> cls.attributeAffects(cls.drivingBoneMatrixAttr, > > >> >> cls.currentChainLength) > > > >> >> On Aug 13, 4:20 pm, Chad Vernon <chadver...@gmail.com> wrote: > > >> >> > You need to have the output connected to something or else Maya will > > >> >> > never > > >> >> > request a node compute. It only calculates nodes when it needs to. > > >> >> > You > > >> >> > should be able to just use the worldMatrix just fine. > > > >> >> > Chad > > > >> >> > On Fri, Aug 13, 2010 at 8:11 AM, susanta <susant...@gmail.com> > > >> >> > wrote: > > >> >> > > "worldmatrix is only updated on demand.." > > > >> >> > > Yea, That also I have speculated... > > > >> >> > > "Try instead hooking up to matrix and parentmatrix plugs of the > > >> >> > > node > > >> >> > > whose worldmatrix you want. They should get pushed to your node > > >> >> > > and > > >> >> > > then you can just concatenate them in compute() to get the world > > >> >> > > matrix." > > > >> >> > > My problem is little bit typical :). this is not about computing > > >> >> > > world > > >> >> > > matrix...say like, my node is connected in this order: NodeA -> > > >> >> > > NodeB- > > >> >> > > > NodeC->.......-> NodeD->MyNode. Now what I want to achieve, > > >> >> > > > instaed > > >> >> > > of using any callback system use DAG system, to evalute myNode's > > >> >> > > compute block while any of the node in the hierarchy is changing > > >> >> > > trasform matrix. Now if I plugin parentmatrix / matrix from > > >> >> > > nodeD, I > > >> >> > > think if nodeD is affected then only it will evalute > > >> >> > > mynode....but not > > >> >> > > for other nodes up in the hierarchy. So to find a clean way I have > > >> >> > > tried to use worldMatrix of NodeD (as worldMatrix change is true > > >> >> > > for > > >> >> > > change in any depth) as I not want to plug with all other node's > > >> >> > > matrix in the hierarchy. But seems like I'm wrong :(...need to > > >> >> > > find a > > >> >> > > better solution. Any way thanks man. > > > >> >> > > On Aug 13, 3:10 pm, Adam Mechtley <adam.mecht...@gmail.com> wrote: > > >> >> > > > Iirc, worldmatrix is only updated on demand (eg, you getAttr on > > >> >> > > > it > > >> >> > > > or on > > >> >> > > a plug that depends on it). Try instead hooking up to matrix and > > >> >> > > parentmatrix plugs of the node whose worldmatrix you want. They > > >> >> > > should > > >> >> > > get > > >> >> > > pushed to your node and then you can just concatenate them in > > >> >> > > compute() to > > >> >> > > get the world matrix. > > > >> >> > > > Sent from my iPhone > > > >> >> > > > On Aug 13, 2010, at 6:44, susanta <susant...@gmail.com> wrote: > > > >> >> > > > > Hi Guys, > > > >> >> > > > > I'm trying to create a custom MPX node, which is doing some > > >> >> > > > > calculation based on a bone's scale in a hierarchy. So far my > > >> >> > > > > compute > > >> >> > > > > code is working properly. I want to run the compute block > > >> >> > > > > always > > >> >> > > > > if > > >> >> > > > > the any bone in the hierarchy got new world matrix (either by > > >> >> > > > > pos, > > >> >> > > > > rot > > >> >> > > > > or scale change). But what I'm getting here, worldmatrix > > >> >> > > > > attribute > > >> >> > > > > of > > >> >> > > > > a node not getting changed always untill you querry from > > >> >> > > > > outside > > >> >> > > > > (eg. > > >> >> > > > > through MEL). Below is my test code....I have a input matrix > > >> >> > > > > plug > > >> >> > > > > which connected to worlMatrix of a tranformNode. I expect > > >> >> > > > > when I'm > > >> >> > > > > scaling or moving position of the transform node...compute > > >> >> > > > > block > > >> >> > > > > of my > > >> >> > > > > node should > > ... > > read more » -- http://groups.google.com/group/python_inside_maya