void VisualDebugger::releasePvdInstance(physx::debugger::comm::PvdDataStream& pvdConnection, const PxConstraint& c, const PxJoint& joint) { if(!pvdConnection.isConnected()) return; //remove from scene and from any attached actors. PxRigidActor* actor0, *actor1; c.getActors( actor0, actor1 ); pvdConnection.removeObjectRef( c.getScene(), "Joints", &joint ); if ( actor0 ) pvdConnection.removeObjectRef( actor0, "Joints", &joint ); if ( actor1 ) pvdConnection.removeObjectRef( actor1, "Joints", &joint ); pvdConnection.destroyInstance(&joint); }
void ModuleClothing::initPvdInstances(physx::debugger::comm::PvdDataStream& pvdStream) { // if there's more than one AOFactory we don't know any more for sure that its a clothing asset factory, so we have to adapt the code below PX_ASSERT(mAssetAuthorableObjectFactories.getSize() == 1 && "Adapt the code below"); PVD::PvdBinding* pvdBinding = NxGetApexSDK()->getPvdBinding(); PX_ASSERT(pvdBinding != NULL); // Module Params pvdStream.createInstance(NamespacedName(APEX_PVD_NAMESPACE, "ClothingModuleParameters"), mModuleParams); pvdStream.setPropertyValue(mApiProxy, "ModuleParams", DataRef<const PxU8>((const PxU8*)&mModuleParams, sizeof(ClothingModuleParameters*)), getPvdNamespacedNameForType<ObjectRef>()); // update module properties (should we do this per frame? if so, how?) pvdBinding->updatePvd(mModuleParams, *mModuleParams); // prepare asset list and forward init calls NiApexAuthorableObject* ao = static_cast<NiApexAuthorableObject*>(mAssetAuthorableObjectFactories.getResource(0)); ao->mAssets.initPvdInstances(pvdStream); }
void ModuleClothing::initPvdClasses(physx::debugger::comm::PvdDataStream& pvdStream) { NamespacedName objRef = getPvdNamespacedNameForType<ObjectRef>(); // --------------------------------------- // Hierarchy // NxModule holds NxClothingAssets pvdStream.createClass(NamespacedName(APEX_PVD_NAMESPACE, "NxClothingAsset")); pvdStream.createProperty(NamespacedName(APEX_PVD_NAMESPACE, getName()), "NxClothingAssets", "children", objRef, PropertyType::Array); // NxClothingAsset holds NxClothingActors pvdStream.createClass(NamespacedName(APEX_PVD_NAMESPACE, "NxClothingActor")); pvdStream.createProperty(NamespacedName(APEX_PVD_NAMESPACE, "NxClothingAsset"), "NxClothingActors", "children", objRef, PropertyType::Array); // --------------------------------------- // NxParameterized PVD::PvdBinding* pvdBinding = NxGetApexSDK()->getPvdBinding(); PX_ASSERT(pvdBinding != NULL); // Module Params INIT_PVD_CLASSES_PARAMETERIZED(ClothingModuleParameters); pvdStream.createProperty(NamespacedName(APEX_PVD_NAMESPACE, getName()), "ModuleParams", "", objRef, PropertyType::Scalar); // Asset Params INIT_PVD_CLASSES_PARAMETERIZED(ClothingPhysicalMeshParameters); INIT_PVD_CLASSES_PARAMETERIZED(ClothingGraphicalLodParameters); INIT_PVD_CLASSES_PARAMETERIZED(ClothingCookedParam); INIT_PVD_CLASSES_PARAMETERIZED(ClothingCookedPhysX3Param); INIT_PVD_CLASSES_PARAMETERIZED(ClothingMaterialLibraryParameters); INIT_PVD_CLASSES_PARAMETERIZED(ClothingAssetParameters); pvdStream.createProperty(NamespacedName(APEX_PVD_NAMESPACE, "NxClothingAsset"), "AssetParams", "", objRef, PropertyType::Scalar); // Actor Params INIT_PVD_CLASSES_PARAMETERIZED(ClothingActorParam); pvdStream.createProperty(NamespacedName(APEX_PVD_NAMESPACE, "NxClothingActor"), "ActorParams", "", objRef, PropertyType::Scalar); // --------------------------------------- // Additional Properties // --------------------------------------- }
void VisualDebugger::setActors( physx::debugger::comm::PvdDataStream& inStream, const PxJoint& inJoint, const PxConstraint& c, const PxActor* newActor0, const PxActor* newActor1 ) { PxRigidActor* actor0, *actor1; c.getActors( actor0, actor1 ); if ( actor0 ) inStream.removeObjectRef( (PxActor*)actor0, "Joints", &inJoint ); if ( actor1 ) inStream.removeObjectRef( (PxActor*)actor1, "Joints", &inJoint ); if ( newActor0 ) inStream.pushBackObjectRef( newActor0, "Joints", &inJoint ); if ( newActor1 ) inStream.pushBackObjectRef( newActor1, "Joints", &inJoint ); inStream.setPropertyValue( &inJoint, "Actors.actor0", (const void*)newActor0 ); inStream.setPropertyValue( &inJoint, "Actors.actor1", (const void*)newActor1 ); const void* parent = newActor0 ? (const void*)newActor0 : (const void*) newActor1; inStream.setPropertyValue( &inJoint, "Parent", parent ); }