//- // ========================================================================== // Copyright (C) 1995 - 2005 Alias Systems Corp. and/or its licensors. All // rights reserved. // // The coded instructions, statements, computer programs, and/or related // material (collectively the "Data") in these files are provided by Alias // Systems Corp. ("Alias") and/or its licensors for the exclusive use of the // Customer (as defined in the Alias Software License Agreement that // accompanies this Alias software). Such Customer has the right to use, // modify, and incorporate the Data into other products and to distribute such // products for use by end-users. // // THE DATA IS PROVIDED "AS IS". ALIAS HEREBY DISCLAIMS ALL WARRANTIES // RELATING TO THE DATA, INCLUDING, WITHOUT LIMITATION, ANY AND ALL EXPRESS OR // IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. IN NO EVENT SHALL ALIAS BE LIABLE FOR ANY DAMAGES // WHATSOEVER, WHETHER DIRECT, INDIRECT, SPECIAL, OR PUNITIVE, WHETHER IN AN // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, OR IN EQUITY, // ARISING OUT OF ACCESS TO, USE OF, OR RELIANCE UPON THE DATA. // ========================================================================== //+ // $RCSfile: apiMeshShape.h $ #ifndef _apiMeshShape #define _apiMeshShape /////////////////////////////////////////////////////////////////////////////// // // apiMeshShape.h // // Implements a new type of shape node in maya called apiMesh. // // INPUTS // inputSurface - input apiMeshData // outputSurface - output apiMeshData // worldSurface - array of world space apiMeshData, each element // represents an istance of the shape // OUTPUTS // mControlPoints - inherited control vertices for the mesh. These values // are tweaks (offsets) that will be applied to the // vertices of the input shape. // bboxCorner1 - bounding box upper left corner // bboxCorner2 - bounding box lower right corner // //////////////////////////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include #include #include #include class MPointArray; class apiMesh : public MPxSurfaceShape { public: apiMesh(); virtual ~apiMesh(); ////////////////////////////////////////////////////////// // // Overrides // ////////////////////////////////////////////////////////// // From MPxNode // virtual void postConstructor(); virtual MStatus compute( const MPlug& plug, MDataBlock& data ); virtual bool getInternalValue( const MPlug&, MDataHandle&); virtual bool setInternalValue( const MPlug&, const MDataHandle&); virtual MStatus connectionMade( const MPlug& plug, const MPlug& otherPlug, bool asSrc ); virtual MStatus connectionBroken( const MPlug& plug, const MPlug& otherPlug, bool asSrc ); virtual MStatus shouldSave( const MPlug& plug, bool& result ); // Attribute to component (components) // virtual void componentToPlugs( MObject &, MSelectionList & ) const; virtual MatchResult matchComponent( const MSelectionList& item, const MAttributeSpecArray& spec, MSelectionList& list ); virtual bool match( const MSelectionMask & mask, const MObjectArray& componentList ) const; // Support deformers (components) // virtual MObject createFullVertexGroup() const; virtual MObject localShapeInAttr() const; virtual MObject localShapeOutAttr() const; virtual MObject worldShapeOutAttr() const; virtual MObject cachedShapeAttr() const; virtual MObject geometryData() const; virtual void closestPoint ( const MPoint & toThisPoint, MPoint & theClosestPoint, double tolerance ) const; // Support the translate/rotate/scale tool (components) // virtual void transformUsing( const MMatrix & mat, const MObjectArray & componentList ); virtual void transformUsing( const MMatrix & mat, const MObjectArray & componentList, MPxSurfaceShape::MVertexCachingMode cachingMode, MPointArray* pointCache); virtual void tweakUsing( const MMatrix & mat, const MObjectArray & componentList, MVertexCachingMode cachingMode, MPointArray* pointCache, MArrayDataHandle& handle ); // Support the move tools normal/u/v mode (components) // virtual bool vertexOffsetDirection( MObject & component, MVectorArray & direction, MVertexOffsetMode mode, bool normalize ); // Bounding box methods // virtual bool isBounded() const; virtual MBoundingBox boundingBox() const; // Associates a user defined iterator with the shape (components) // virtual MPxGeometryIterator* geometryIteratorSetup( MObjectArray&, MObject&, bool forReadOnly = false ); virtual bool acceptsGeometryIterator( bool writeable=true ); virtual bool acceptsGeometryIterator( MObject&, bool writeable=true, bool forReadOnly = false); ////////////////////////////////////////////////////////// // // Helper methods // ////////////////////////////////////////////////////////// bool hasHistory(); MStatus computeInputSurface( const MPlug&, MDataBlock& ); MStatus computeOutputSurface( const MPlug&, MDataBlock& ); MStatus computeWorldSurface( const MPlug&, MDataBlock& ); MStatus computeBoundingBox( MDataBlock& ); MStatus applyTweaks( MDataBlock&, apiMeshGeom* ); bool value( int pntInd, int vlInd, double & val ) const; bool value( int pntInd, MPoint & val ) const; bool setValue( int pntInd, int vlInd, double val ); bool setValue( int pntInd, const MPoint & val ); MObject meshDataRef(); apiMeshGeom* meshGeom(); MObject cachedDataRef(); apiMeshGeom* cachedGeom(); MStatus buildControlPoints( MDataBlock&, int count ); void verticesUpdated(); static void * creator(); static MStatus initialize(); public: ////////////////////////////////////////////////////////// // // Attributes // ////////////////////////////////////////////////////////// static MObject inputSurface; static MObject outputSurface; static MObject worldSurface; // used to support tweaking of points, the inputSurface attribute data is // transferred into the cached surface when it is dirty. The control points // tweaks are added into it there. // static MObject cachedSurface; static MObject bboxCorner1; static MObject bboxCorner2; public: static MTypeId id; bool fHasHistoryOnCreate; }; #endif /* _apiMeshShape */