Ejemplo n.º 1
0
void GraphicsLayerUpdater::updateRecursive(RenderLayer& layer, UpdateType updateType, const UpdateContext& context, Vector<RenderLayer*>& layersNeedingPaintInvalidation)
{
    if (layer.hasCompositedLayerMapping()) {
        CompositedLayerMapping* mapping = layer.compositedLayerMapping();

        if (updateType == ForceUpdate || mapping->needsGraphicsLayerUpdate()) {
            const RenderLayer* compositingContainer = context.compositingContainer(layer);
            ASSERT(compositingContainer == layer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf));

            if (mapping->updateGraphicsLayerConfiguration())
                m_needsRebuildTree = true;

            mapping->updateGraphicsLayerGeometry(compositingContainer, context.compositingStackingContext(), layersNeedingPaintInvalidation);

            if (mapping->hasUnpositionedOverflowControlsLayers())
                layer.scrollableArea()->positionOverflowControls(IntSize());

            updateType = mapping->updateTypeForChildren(updateType);
            mapping->clearNeedsGraphicsLayerUpdate();
        }
    }

    UpdateContext childContext(context, layer);
    for (RenderLayer* child = layer.firstChild(); child; child = child->nextSibling())
        updateRecursive(*child, updateType, childContext, layersNeedingPaintInvalidation);
}
Ejemplo n.º 2
0
int DocumentDatabase::removeContentAndIndex(const Document &document,
					    UpdateContext &context,
					    KeyStash &stash,
					    bool updateStats)
{
	Indexer &indexer = context.getIndexer();
	OperationContext &oc = context.getOperationContext();

	// Index the document
	IndexSpecification &index = context.getIndexSpecification();
	index.set(Index::INDEXER_DELETE);

	indexer.indexMetaData(index, document, stash, /*checkModified*/false);
	ScopedPtr<NsPushEventSource>
		source(document.getContentAsEventSource(
			       oc.txn(), /*needsValidation*/false,
			       indexer.getContainer()->nodesIndexed()));
	if (source.get()) {
		indexer.initIndexContent(index, document.getID(),
					 source.get(), stash, updateStats,
					 false, /*isDelete*/true);
		source.get()->start();
	}

	// Delete the content
	deleteID(oc, document.getID()); // a no-op
	document.getID().setDbtFromThis(oc.key());
	int err = content_.del(oc.txn(), &oc.key(), 0);
	if (err == DB_NOTFOUND)
		err = 0; // no-content doc
	
	return err;
}
Ejemplo n.º 3
0
int DocumentDatabase::reindex(const IndexSpecification &is, const Document &document,
	UpdateContext &context, KeyStash &stash, bool updateStats)
{
	Indexer &indexer = context.getIndexer();
	OperationContext &oc = context.getOperationContext();

	// Index the document
	indexer.indexMetaData(is, document, stash, /*checkModified*/false);
	ScopedPtr<NsPushEventSource> source(document.
		getContentAsEventSource(oc.txn(), /*needsValidation*/false,
					indexer.getContainer()->nodesIndexed()));
	if (source.get()) {
		indexer.initIndexContent(is, document.getID(), source.get(),
			stash, updateStats, false, /*isDelete*/false);
		source.get()->start();
	}

	return 0;
}
Ejemplo n.º 4
0
 UpdateContext(const UpdateContext& other, const RenderLayer& layer)
     : m_compositingStackingContext(other.m_compositingStackingContext)
     , m_compositingAncestor(other.compositingContainer(layer))
 {
     CompositingState compositingState = layer.compositingState();
     if (compositingState != NotComposited && compositingState != PaintsIntoGroupedBacking) {
         m_compositingAncestor = &layer;
         if (layer.stackingNode()->isStackingContext())
             m_compositingStackingContext = &layer;
     }
 }
Ejemplo n.º 5
0
XSIPLUGINCALLBACK XSI::CStatus CppAxisInterpOp_Init
(
	UpdateContext&	ctx,
	long mode
)
{
	CAxisInterpOp* pThis = new CAxisInterpOp();	
	ctx.PutUserData( (CValue::siPtrType)pThis );

	return pThis->Init(ctx,mode);
}
Ejemplo n.º 6
0
XSIPLUGINCALLBACK XSI::CStatus CppAxisInterpOp_Update
(
	UpdateContext&	ctx,
	OutputPort&	output
)
{
	CValue::siPtrType pUserData = ctx.GetUserData();
	CAxisInterpOp* pThis = (CAxisInterpOp*)pUserData;	

	return pThis->Update(ctx,output);
}
Ejemplo n.º 7
0
int DocumentDatabase::addContent(Document &document, UpdateContext &context)
{
	OperationContext &oc = context.getOperationContext();

	DbXmlDbt *dbt = (DbXmlDbt*) document.getContentAsDbt();
	// Allow no-content documents
	int err = 0;
	if (dbt && (dbt->size != 0)) {
		document.getID().setDbtFromThis(oc.key());
		return addContent(oc.txn(), oc.key(), dbt, 0);
	}
	return err;
}
Ejemplo n.º 8
0
XSIPLUGINCALLBACK XSI::CStatus CppAxisInterpOp_Term
(
	UpdateContext&	ctx,
	long 		mode
)
{
	CValue::siPtrType pUserData = ctx.GetUserData();
	CAxisInterpOp* pThis = (CAxisInterpOp*)pUserData;

	CStatus st = pThis->Term(ctx,mode);
	delete pThis;

	return st;
}
Ejemplo n.º 9
0
void GraphicsLayerUpdater::update(RenderLayer& layer, UpdateType updateType, const UpdateContext& context)
{
    if (layer.hasCompositedLayerMapping()) {
        CompositedLayerMappingPtr mapping = layer.compositedLayerMapping();

        const RenderLayer* compositingContainer = context.compositingContainer(layer);
        ASSERT(compositingContainer == layer.ancestorCompositingLayer());
        if (mapping->updateRequiresOwnBackingStoreForAncestorReasons(compositingContainer))
            updateType = ForceUpdate;

        // Note carefully: here we assume that the compositing state of all descendants have been updated already,
        // so it is legitimate to compute and cache the composited bounds for this layer.
        mapping->updateCompositedBounds(updateType);

        if (RenderLayerReflectionInfo* reflection = layer.reflectionInfo()) {
            if (reflection->reflectionLayer()->hasCompositedLayerMapping())
                reflection->reflectionLayer()->compositedLayerMapping()->updateCompositedBounds(ForceUpdate);
        }

        if (mapping->updateGraphicsLayerConfiguration(updateType))
            m_needsRebuildTree = true;

        mapping->updateGraphicsLayerGeometry(updateType, compositingContainer);

        updateType = mapping->updateTypeForChildren(updateType);
        mapping->clearNeedsGraphicsLayerUpdate();

        if (!layer.parent())
            layer.compositor()->updateRootLayerPosition();

        if (mapping->hasUnpositionedOverflowControlsLayers())
            layer.scrollableArea()->positionOverflowControls();
    }

    UpdateContext childContext(context, layer);
    for (RenderLayer* child = layer.firstChild(); child; child = child->nextSibling())
        update(*child, updateType, childContext);
}
Ejemplo n.º 10
0
int DocumentDatabase::updateContentAndIndex(Document &new_document,
					    UpdateContext &context,
					    KeyStash &stash, bool validate,
					    bool updateStats)
{
	OperationContext &oc = context.getOperationContext();
	DocID id = new_document.getID();
	Indexer &indexer = context.getIndexer();
	IndexSpecification &index = context.getIndexSpecification();
	int err = 0;
	bool resetId = false;

	// Add DB_RMW if transacted to reduce deadlocks
	u_int32_t flags =  ((oc.txn() && !content_.isCDBEnv()) ? DB_RMW : 0);
	
	// Check to see if the old document exists, first
	// If ID is non-zero, let's trust it.  If not, get by name.
	// Retrieve the old document
	XmlDocument old_document;
	if (id == 0) {
		// will throw if name is bad or doc doesn't exist
		err = indexer.getContainer()->getDocument(
			oc, new_document.getName(), old_document, flags);
		if (err == 0) {
			id = ((Document&)old_document).getID();
			new_document.getIDToSet() = id;
			resetId = true;
		}
	} else {
		err = indexer.getContainer()->getDocument(
			oc, id, old_document, flags);
	}
	if(err != 0) return err;
	
	// Index the new document
	indexer.indexMetaData(index, new_document, stash, true);
	if(new_document.isContentModified()) {
		// Will need the Dbt later, so get it now.  This also
		// allows the content to be used more than once in case
		// definitiveContent_ is INPUTSTREAM
		(void) new_document.getContentAsDbt();
		// use private method that explicitly assumes Dbt content
		ScopedPtr<NsPushEventSource>
			source(new_document.dbt2events(
				       oc.txn(), /*needsValidation*/validate,
				       indexer.getContainer()->nodesIndexed()));
		if (source.get()) {
			indexer.initIndexContent(index, id,
				source.get(), stash, updateStats,
				true, /*isDelete*/false);
			source.get()->start();
		}
	}

	// Set the modified flags of the old document to the same as the
	// new document, so that when we index, we only generate keys for
	// things that have actually changed.
	MetaData::const_iterator end = new_document.metaDataEnd();
	for(MetaData::const_iterator i = new_document.metaDataBegin();
	    i != end; ++i) {
		if((*i)->isModified()) {
			const MetaDatum *md = ((Document&)old_document)
				.getMetaDataPtr((*i)->getName());
			if(md != 0) const_cast<MetaDatum*>(md)->setModified(true);
		}
	}

	// Remove the index keys for the old document
	IndexSpecification delete_index(index);
	delete_index.set(Index::INDEXER_DELETE);
	indexer.indexMetaData(delete_index, old_document, stash, true);
	if(new_document.isContentModified()) {
		ScopedPtr<NsPushEventSource>
			source(((Document&)old_document).
			       getContentAsEventSource(
				       oc.txn(),
				       /*needsValidation*/false,
				       indexer.getContainer()->nodesIndexed()));
		if (source.get()) {
			indexer.initIndexContent(delete_index, id,
				source.get(), stash, updateStats,
				false, /*isDelete*/true);
			source.get()->start();
		}
	}

	// Update the content
	if(new_document.isContentModified()) {
		OperationContext &oc = context.getOperationContext();
		id.setDbtFromThis(oc.key());
		DbXmlDbt *dbt = (DbXmlDbt*)new_document.getContentAsDbt();
		err = addContent(oc.txn(), oc.key(),dbt, 0);
	}

	if(err == 0) new_document.setContentModified(false);
	if (resetId)
		new_document.getIDToSet() = 0;
	return err;
}
Ejemplo n.º 11
0
XSI::CStatus CAxisInterpOp::Update
(
	UpdateContext&	ctx,
	OutputPort&	output
)
{
	Operator op(ctx.GetOperator());

	///////////////////////////////////////////////////////////////
	// get operator parameters
	///////////////////////////////////////////////////////////////

	XSI::CString triggers(op.GetParameterValue(L"Triggers"));

	// triggers changed
	if ( m_csTriggers != triggers )
	{
		m_csTriggers = triggers;

		Init( ctx, 0 );
	}

	double boneperc = op.GetParameterValue(L"BoneDist");

	///////////////////////////////////////////////////////////////
	// get objects connected to input & output ports
	///////////////////////////////////////////////////////////////
 
	InputPort rootboneport(op.GetPort(L"globalkineport",L"RootBoneGroup",0));
	InputPort parentboneport(op.GetPort(L"globalkineport",L"ParentBoneGroup",0));
	InputPort parentbonelenport(op.GetPort(L"bonelengthport",L"ParentBoneGroup",0));
	InputPort childboneport(op.GetPort(L"globalkineport",L"ChildBoneGroup",0));

	KinematicState gkRoot(rootboneport.GetValue());
	KinematicState gkParent(parentboneport.GetValue());
	double parentbonelen(parentbonelenport.GetValue());
	KinematicState gkChild(childboneport.GetValue());
	KinematicState gkHelper(output.GetValue());

	// GET TRANSFORMATIONS OF ROOT, PARENT & CHILD
	CTransformation tGRoot = gkRoot.GetTransform();
	CTransformation tGBone1 = gkParent.GetTransform();
	CTransformation tGBone2 = gkChild.GetTransform();

#ifdef _DEBUG_UPDATE
	{
		Application app;
		wchar_t wszBuf[256]; 

		XSI::MATH::CQuaternion q = tGBone1.GetRotationQuaternion();

		double x, y, z;
		
		q.GetXYZAnglesValues(x,y,z);

		swprintf( wszBuf, L"parent R(%f,%f,%f)]",  r2d(x),r2d(y),r2d(z) );
		app.LogMessage( (const wchar_t*)wszBuf ); 
	}
#endif
#ifdef _DEBUG_UPDATE
	{
		Application app;
		wchar_t wszBuf[256]; 

		XSI::MATH::CQuaternion q = tGBone2.GetRotationQuaternion();

		double x, y, z;
		
		q.GetXYZAnglesValues(x,y,z);

		swprintf( wszBuf, L"child R(%f,%f,%f)]",  r2d(x),r2d(y),r2d(z) );
		app.LogMessage( (const wchar_t*)wszBuf ); 
	}
#endif

	///////////////////////////////////////////////////////////////
	// perform update function
	///////////////////////////////////////////////////////////////
 
	// GET LOCAL TRANSFORM OF CHILD RELATIVE TO PARENT
	XSI::MATH::CMatrix3 mBone1( tGBone1.GetRotationMatrix3() );
	XSI::MATH::CMatrix3 mBone2( tGBone2.GetRotationMatrix3() );

#ifdef _DEBUG_UPDATE
	{
		Application app;
		wchar_t wszBuf[256]; 

		double m0, m1, m2, m3, m4, m5, m6, m7, m8;
		
		mBone1.Get(m0, m1, m2, m3, m4, m5, m6, m7, m8);

		swprintf( wszBuf, L"mBone1->\n%.2f,%.2f,%.2f\n%.2f,%.2f,%.2f\n%.2f,%.2f,%.2f", m0, m1, m2, m3, m4, m5, m6, m7, m8 );
			
		app.LogMessage( (const wchar_t*)wszBuf ); 
	}
#endif
#ifdef _DEBUG_UPDATE
	{
		Application app;
		wchar_t wszBuf[256]; 

		double m0, m1, m2, m3, m4, m5, m6, m7, m8;
		
		mBone2.Get(m0, m1, m2, m3, m4, m5, m6, m7, m8);

		swprintf( wszBuf, L"mBone2->\n%.2f,%.2f,%.2f\n%.2f,%.2f,%.2f\n%.2f,%.2f,%.2f", m0, m1, m2, m3, m4, m5, m6, m7, m8 );
			
		app.LogMessage( (const wchar_t*)wszBuf ); 
	}
#endif
	mBone1.TransposeInPlace();
#ifdef _DEBUG_UPDATE
	{
		Application app;
		wchar_t wszBuf[256]; 

		double m0, m1, m2, m3, m4, m5, m6, m7, m8;
		
		mBone1.Get(m0, m1, m2, m3, m4, m5, m6, m7, m8);

		swprintf( wszBuf, L"mBone1.TransposeInPlace->\n%.2f,%.2f,%.2f\n%.2f,%.2f,%.2f\n%.2f,%.2f,%.2f", m0, m1, m2, m3, m4, m5, m6, m7, m8 );
			
		app.LogMessage( (const wchar_t*)wszBuf ); 
	}
#endif

	XSI::MATH::CMatrix3  tmpMat3;

	for(int nR=0; nR<3; nR++)
		for(int nC=0; nC<3; nC++)
		{
			tmpMat3.SetValue(nR,nC , 
				mBone2.GetValue(nR,0) * mBone1.GetValue(0,nC) +
				mBone2.GetValue(nR,1) * mBone1.GetValue(1,nC) +
				mBone2.GetValue(nR,2) * mBone1.GetValue(2,nC) );
		}
	
	mBone2 = tmpMat3;

	// bug #90494
	// mBone2.MulInPlace( mBone1 );
#ifdef _DEBUG_UPDATE
	{
		Application app;
		wchar_t wszBuf[256]; 

		double m0, m1, m2, m3, m4, m5, m6, m7, m8;
		
		mBone2.Get(m0, m1, m2, m3, m4, m5, m6, m7, m8);

		swprintf( wszBuf, L"mBone2.MulInPlace( mBone1 )->\n%.2f,%.2f,%.2f\n%.2f,%.2f,%.2f\n%.2f,%.2f,%.2f", m0, m1, m2, m3, m4, m5, m6, m7, m8 );
			
		app.LogMessage( (const wchar_t*)wszBuf ); 
	}
#endif

	// GET ORIENTATION OF BONE2 RELATIVE TO BONE1 AS A QUATERNION
	XSI::MATH::CQuaternion qBone2 = mBone2.GetQuaternion();

	// MATCH QUATERNIONS
	XSI::MATH::CVector3 vBasePos(
		op.GetParameterValue(L"BasePoseX"), 
		op.GetParameterValue(L"BasePoseY"), 
		op.GetParameterValue(L"BasePoseZ") );
	
#ifdef _DEBUG_UPDATE
	{
		Application app;
		wchar_t wszBuf[256]; 

		double x, y, z;
		
		qBone2.GetXYZAnglesValues(x,y,z);

		swprintf( wszBuf, L"child2parent R(%f,%f,%f)]",  r2d(x),r2d(y),r2d(z) );
		app.LogMessage( (const wchar_t*)wszBuf ); 
	}
#endif

	ComputeBaseOffset(vBasePos, boneperc, parentbonelen );

	ComputeWeights( qBone2, m_cTriggers, m_aWeights, m_aTriggerOri, m_aTriggerTol );

	// SUM TARGET ORIENTATIONS & POSITIONS
	XSI::MATH::CQuaternion qNewOri;

	SumTargets( qNewOri, vBasePos, m_cTriggers, m_aWeights, m_aTargetOri, m_aTargetPos );	

#ifdef _DEBUG_UPDATE
	Application app;
	wchar_t wszBuf[256]; 

	double x, y, z;
	
	qNewOri.GetXYZAnglesValues(x,y,z);

	swprintf( wszBuf, L"qNewOri->R(%f,%f,%f)]",  r2d(x),r2d(y),r2d(z) );
	app.LogMessage( (const wchar_t*)wszBuf ); 
#endif

	// UPDATE TRANSFORMATION
	XSI::MATH::CTransformation tNewPose;

	tNewPose.SetRotationFromQuaternion( qNewOri );
	tNewPose.SetTranslation( vBasePos );
	tNewPose.MulInPlace( tGRoot );

	///////////////////////////////////////////////////////////////
	// update output port
	///////////////////////////////////////////////////////////////

	gkHelper.PutTransform( tNewPose );

	return CStatus::OK;
}
Ejemplo n.º 12
0
CStatus CHelperBoneOp::Update
(
	UpdateContext&	ctx,
	OutputPort&	output
)
{
	///////////////////////////////////////////////////////////////
	// get operator
	///////////////////////////////////////////////////////////////
	Operator op(ctx.GetOperator());

	///////////////////////////////////////////////////////////////
	// get output port
	///////////////////////////////////////////////////////////////
 
	KinematicState gkHelper(output.GetValue());

	///////////////////////////////////////////////////////////////
	// get helper bone data
	///////////////////////////////////////////////////////////////

	InputPort bonedataport(op.GetPort(L"bonedataport",L"HelperBoneGroup",0));
	Property  HelperBoneData(bonedataport.GetValue());

	bool enabled = HelperBoneData.GetParameterValue(L"Enabled");

	// not enabled: do nothing
	if (!enabled) 
		return CStatus::OK;

	///////////////////////////////////////////////////////////////
	// evaluate new transformation for helperbone
	///////////////////////////////////////////////////////////////
	XSI::MATH::CTransformation tNewPose;

	bool bComputeInWorldSpace = (0!=(long)HelperBoneData.GetParameterValue(L"ComputationSpace"));

	///////////////////////////////////////////////////////////////
	// get objects connected to input & output ports
	///////////////////////////////////////////////////////////////

	InputPort rootboneport(op.GetPort(L"globalkineport",L"RootBoneGroup",0));
	InputPort parentboneport(op.GetPort(L"globalkineport",L"ParentBoneGroup",0));
	InputPort childboneport(op.GetPort(L"globalkineport",L"ChildBoneGroup",0));

	KinematicState gkRoot(rootboneport.GetValue());
	KinematicState gkParent(parentboneport.GetValue());
	KinematicState gkChild(childboneport.GetValue());

	// get helperbonedata values
	XSI::MATH::CVector3 vBasePos(
		HelperBoneData.GetParameterValue(L"BoneOffsetX"), 
		HelperBoneData.GetParameterValue(L"BoneOffsetY"), 
		HelperBoneData.GetParameterValue(L"BoneOffsetZ") );

	double perc_along_root = (double)HelperBoneData.GetParameterValue(L"BoneDistance") / 100.0;
	double root_bone_length = (double)HelperBoneData.GetParameterValue(L"RootBoneLength");

	XSI::GridData griddata(HelperBoneData.GetParameterValue(L"Triggers"));

	// read triggers
	ReadTriggerData(griddata);

	// GET TRANSFORMATIONS OF ROOT, PARENT & CHILD
	CTransformation tGRoot = gkRoot.GetTransform();
	CTransformation tGParent = gkParent.GetTransform();
	CTransformation tGChild = gkChild.GetTransform();

	///////////////////////////////////////////////////////////////
	// compute new orientation and position based on triggers
	///////////////////////////////////////////////////////////////
	DebugPrint( L"parent", tGParent.GetRotationQuaternion() );
	DebugPrint( L"child", tGChild.GetRotationQuaternion() );

	// GET LOCAL TRANSFORM OF CHILD RELATIVE TO PARENT
	XSI::MATH::CMatrix3 m3Parent( tGParent.GetRotationMatrix3() );
	DebugPrint(L"m3Parent->", m3Parent);

	XSI::MATH::CMatrix3 m3Child( tGChild.GetRotationMatrix3() );
	DebugPrint(L"m3Parent->", m3Child);

	m3Parent.TransposeInPlace();
	DebugPrint(L"m3Parent.TransposeInPlace->", m3Parent);

	// bug #90494
	// m3Child.MulInPlace( m3Parent );
	MulInPlace( m3Child, m3Parent );
	DebugPrint(L"m3Child.MulInPlace->", m3Child);

	// GET ORIENTATION OF BONE2 RELATIVE TO BONE1 AS A QUATERNION
	XSI::MATH::CQuaternion qBone2 = m3Child.GetQuaternion();
	DebugPrint( L"child2parent", qBone2 );

	// MATCH QUATERNIONS
	ComputeWeights( qBone2, m_cTriggers, m_aEnabled, m_aWeights, m_aTriggerOri, m_aTriggerTol );

	// SUM TARGET ORIENTATIONS & POSITIONS
	XSI::MATH::CQuaternion qNewOri;
	XSI::MATH::CVector3 vNewPos;

	SumTargets( qNewOri, vNewPos, m_cTriggers, m_aWeights, m_aTargetOri, m_aTargetPos );	
	DebugPrint( L"qNewPos->", qNewPos );
	DebugPrint( L"vNewOri->", qNewOri );

	// UPDATE TRANSFORMATION
	if (bComputeInWorldSpace)
	{
		// not implemented
	}
	else // Root object space
	{
		// compute initial helperbone position
		vBasePos.PutX( vBasePos.GetX() + (root_bone_length * perc_along_root) );
		vNewPos.AddInPlace(vBasePos);

		// apply changes from triggers
		tNewPose.SetRotationFromQuaternion( qNewOri );
		tNewPose.SetTranslation( vNewPos );

		// map root object space to worldspace
		tNewPose.MulInPlace( tGRoot );
	}

	///////////////////////////////////////////////////////////////
	// update output port
	///////////////////////////////////////////////////////////////

	gkHelper.PutTransform( tNewPose );


	return CStatus::OK;
}