Introduction to Maya презентация

Содержание


Biography          Dependency GraphAgenda
 What is Dependency Graph (DG)? 
 Concepts/Elements of DG Nodes
Maya Hypergraph
 Menu: “Window”– “Hypergraph:Connections”What is the Dependency Graph?
 Control system of Maya
 Patented technology:Dependency Graph
 Everything in Maya 3D space maps to DG Nodes
Dependency GraphWhat does a node do?
 Know its own attributes
 Store dataDifferent elements of a NodeAttributes
 Describe data that belongs to nodes of a given type
Attributes
 Define the interface of the node type including
 Names
 DataAPI Classes for Attributes
 Base Class: MFnAttribute 
 Takes care ofDifferent elements of a NodePlugs
 Pointer to an attribute on a specific node (ie. aPlugs
 Plugs can be used to:
 query / set a value
Different elements of a NodeDatablock 
 Node stores data for every attributeDatablocks
 Datablock is the actual storage for the input and outputAPI Classes for datablock
 MDatablock
 Only valid during compute()
 Pointers toCustom Node Plug-in ImplementationCustom DG Node in Maya
 Entirely new operations
 MPxNode: base classCustom Node Code Skeleton
 class myNode : public MPxNode
 {
 Custom Node Registration
  Every node type requires a unique identifier
Custom Node Registration
 initializePlugin() and uninitializePlugin() are entry point and exitCustom Node Registration
 To register your node with Maya:
 To deregisterCustom Node Code Skeleton
 MPxNode::creator()
 The creator method is called toCustom Node Code Skeleton
 MPxNode::initialize()
 Override this method to define theAttribute Dependency
 Attributes can affect other attributes
 MEL command: affects
 	sphereCustom Node Code SkeletonCustom Node Code Skeleton
 MPxNode::compute()
 called when the node is askedExamples
 Devkit Plug-in Examples:
 C:\Program Files\Autodesk\Maya2011\devkit\plug-ins
 The Maya API Documentation containsHow does Dependency Graph work?
 Control system for Maya
 Glue thatHow does Dependency Graph Work?
 Two step Push-Pull mechanism:
 Dirty Propagation
Dirty Propagation
 Maya DG caches values
 Uses dirty system to denoteData Flow Example
 KeyThe Dirty Process
 Initiated by value changesThe Dirty Process
 Dirty message propagates forwardThe Dirty Process
 No evaluation has been requested. Data remains dirty.The Dirty Process
 Now an input on A changesThe Dirty Process
 Dirty propagates out all outgoing connectionsThe Dirty Process
 B and D propagate dirty to affected attributes
The Evaluation Process
 Lazy Evaluation: On demand
 Evaluation is trigged whenThe Evaluation Process
 Example: getAttr C.outputThe Evaluation Process
 C computes: requests input value from connectionThe Evaluation Process
 D computes.
 D requests input value from connectionThe Evaluation Process
 A computes requested outputThe Evaluation Process
 Value copied forward to D’s inputThe Evaluation Process
 D computes requested result.
 D sets value inThe Evaluation Process
 Value is copied forward to CThe Evaluation Process
 C computes requested output.
 B remains dirty.The Evaluation Process
 Only requested outputs are computed, unless node’s computeCorrect Coding with DGCorrect Coding with DG 
 Common misuse:
 put command-type tasks intoBlack Box Rule
 Black-box operation of node is what makes itA Closer Look at MPxNode::compute()
 You can not control when compute()A Closer Look at MPxNode::compute()
 Inside compute(): avoid sending dirty messages
Learning Resources
 Maya Developer Center:
 		http://www.autodesk.com/developmaya
 Questions and Problems: ADN
 		http://www.autodesk.com/adn
Q & AThank you!



Слайды и текст этой презентации
Слайд 1
Описание слайда:


Слайд 2
Описание слайда:
Biography Naiqi Weng -- Autodesk Developer Network Education Bachelor of Computer Science Master of Computer Science Working experience Supporting software: Maya API, MotionBuilder SDK and 3dsMax SDK

Слайд 3
Описание слайда:
Dependency Graph

Слайд 4
Описание слайда:
Agenda What is Dependency Graph (DG)? Concepts/Elements of DG Nodes Custom plug-in DG node with Maya API DG’s push-pull mechanism Correct coding with DG

Слайд 5
Описание слайда:
Maya Hypergraph Menu: “Window”– “Hypergraph:Connections”

Слайд 6
Описание слайда:
What is the Dependency Graph? Control system of Maya Patented technology: US Patent #5,808,625 US Patent #5,929,864 A collection of nodes that transmit data through connected attributes

Слайд 7
Описание слайда:
Dependency Graph Everything in Maya 3D space maps to DG Nodes Anything you do in the UI will affect DG

Слайд 8
Описание слайда:
Dependency Graph

Слайд 9
Описание слайда:

Слайд 10
Описание слайда:
What does a node do? Know its own attributes Store data efficiently in “datablocks” Accept input data, compute, generate output data Connect with other nodes through connections

Слайд 11
Описание слайда:
Different elements of a Node

Слайд 12
Описание слайда:
Attributes Describe data that belongs to nodes of a given type Attributes are shared among nodes of the same type and all derived node types

Слайд 13
Описание слайда:
Attributes Define the interface of the node type including Names Data Type Basic: numeric (float, int32 etc…), string, matrix, etc.. Complex: mesh, nurbsSurface, generic, etc… Custom data Structure Properties readable, writable, storable, keyable, etc…

Слайд 14
Описание слайда:
API Classes for Attributes Base Class: MFnAttribute Takes care of all the common aspect of an attribute on node readable/writable, connectable, storable, keyable Most Common Used Classes MFnNumericAttribute MFnCompoundAttribute MFnTypedAttribute MFnMatrixAttribute MFnGenericAttribute

Слайд 15
Описание слайда:
Different elements of a Node

Слайд 16
Описание слайда:
Plugs Pointer to an attribute on a specific node (ie. a specific instance of an attribute)

Слайд 17
Описание слайда:
Plugs Plugs can be used to: query / set a value create / remove /query a connection Does not store attribute data API class: MPlug MPlug::MPlug (const MObject &node, const MObject &attribute) MObject MPlug::attribute ( MStatus *  ReturnStatus)  MObject MPlug::node ( MStatus *  ReturnStatus)  MStatus MPlug::getValue ( double &  val, MDGContext &  ctx ) MStatus MPlug::setValue ( double  val  ) 

Слайд 18
Описание слайда:
Different elements of a Node

Слайд 19
Описание слайда:
Datablock Node stores data for every attribute

Слайд 20
Описание слайда:
Datablocks Datablock is the actual storage for the input and output data of a node For every non-array attribute, datablock stores: Data Dirty/clean status Data handles are lightweight pointers into the data in the datablock

Слайд 21
Описание слайда:
API Classes for datablock MDatablock Only valid during compute() Pointers to data block should not be retained after compute() MStatus MPxNode::compute(const MPlug& plug, MDataBlock& dataBlock) MDataHandle MDataBlock::inputValue(const MObject& attribute, MStatus *  ReturnStatus) MDataHandle MDataBlock::outputValue ( const MObject & attribute, MStatus *  ReturnStatus) MDataHandle a smart pointer for information contained in data block double & MDataHandle::asDouble (  )  void MDataHandle::set( double  val  ) 

Слайд 22
Описание слайда:

Слайд 23
Описание слайда:
Custom Node Plug-in Implementation

Слайд 24
Описание слайда:
Custom DG Node in Maya Entirely new operations MPxNode: base class for custom node implementation Extend existing Maya nodes MPxDeformerNode MPxFieldNode MPxEmitterNode MPxSpringNode MPxIkSolverNode MPxHwShaderNode

Слайд 25
Описание слайда:
Custom Node Code Skeleton class myNode : public MPxNode { public: myNode(); virtual ~myNode(); static void* creator(); static MStatus initialize(); virtual MStatus compute( const MPlug& plug, MDataBlock& data ); private: static MTypeId id; static MObject myInputAttr; //input attribute static MObject myOutputAttr; //output attribute static MObject myOutputAttrTwo; //second output attribute };

Слайд 26
Описание слайда:
Custom Node Registration Every node type requires a unique identifier MTypeId myNode::id( 0x80000 ); For plug-ins that you intend to share between sites Will require a globally unique ID issued to you by Autodesk. IDs are allocated in blocks of 64/128/256/512. Contact ADN M&E for unique global IDs.

Слайд 27
Описание слайда:
Custom Node Registration initializePlugin() and uninitializePlugin() are entry point and exit point of custom plug-in node

Слайд 28
Описание слайда:
Custom Node Registration To register your node with Maya: To deregister your node

Слайд 29
Описание слайда:
Custom Node Code Skeleton MPxNode::creator() The creator method is called to return a new instance of the node In the Maya UI MEL: createNode myNode;

Слайд 30
Описание слайда:
Custom Node Code Skeleton MPxNode::initialize() Override this method to define the attribute interface for your node. create attributes set the attribute’s properties add the attribute to the node Inherit attributes if necessary define attribute relationships

Слайд 31
Описание слайда:
Attribute Dependency Attributes can affect other attributes MEL command: affects sphere -n sphere; affects tx sphere; MPxNode::attributeAffects() Once created on a node, an “attributeAffects” relationship can be setup to denote a dependency

Слайд 32
Описание слайда:
Custom Node Code Skeleton

Слайд 33
Описание слайда:
Custom Node Code Skeleton MPxNode::compute() called when the node is asked to evaluate an output

Слайд 34
Описание слайда:
Examples Devkit Plug-in Examples: C:\Program Files\Autodesk\Maya2011\devkit\plug-ins The Maya API Documentation contains a wealth of information on all aspects of the API.

Слайд 35
Описание слайда:
How does Dependency Graph work? Control system for Maya Glue that holds together disparate operations and lets them work together seamlessly DG is not a usual dataflow system….

Слайд 36
Описание слайда:
How does Dependency Graph Work? Two step Push-Pull mechanism: Dirty Propagation Evaluation

Слайд 37
Описание слайда:
Dirty Propagation Maya DG caches values Uses dirty system to denote elements that require updating: Attributes Connections MEL Commands: dgdirty isDirty

Слайд 38
Описание слайда:
Data Flow Example Key

Слайд 39
Описание слайда:
The Dirty Process Initiated by value changes

Слайд 40
Описание слайда:
The Dirty Process Dirty message propagates forward

Слайд 41
Описание слайда:
The Dirty Process No evaluation has been requested. Data remains dirty.

Слайд 42
Описание слайда:
The Dirty Process Now an input on A changes

Слайд 43
Описание слайда:
The Dirty Process Dirty propagates out all outgoing connections

Слайд 44
Описание слайда:
The Dirty Process B and D propagate dirty to affected attributes C will not receive dirty message Connection to C is already dirty Helps performance

Слайд 45
Описание слайда:
The Evaluation Process Lazy Evaluation: On demand Evaluation is trigged when values are requested: Viewport refresh Attribute editor Channel box Rendering getAttr command Etc… Evaluation is minimal Only requested values are computed Non-requested values are left dirty

Слайд 46
Описание слайда:
The Evaluation Process Example: getAttr C.output

Слайд 47
Описание слайда:
The Evaluation Process C computes: requests input value from connection

Слайд 48
Описание слайда:
The Evaluation Process D computes. D requests input value from connection

Слайд 49
Описание слайда:
The Evaluation Process A computes requested output

Слайд 50
Описание слайда:
The Evaluation Process Value copied forward to D’s input

Слайд 51
Описание слайда:
The Evaluation Process D computes requested result. D sets value in output.

Слайд 52
Описание слайда:
The Evaluation Process Value is copied forward to C

Слайд 53
Описание слайда:
The Evaluation Process C computes requested output. B remains dirty.

Слайд 54
Описание слайда:
The Evaluation Process Only requested outputs are computed, unless node’s compute method does more than requested

Слайд 55
Описание слайда:
Correct Coding with DG

Слайд 56
Описание слайда:
Correct Coding with DG Common misuse: put command-type tasks into a custom node implementation execute commands to change the status of current DG get or set values on other nodes Black Box Rule

Слайд 57
Описание слайда:
Black Box Rule Black-box operation of node is what makes it all work.

Слайд 58
Описание слайда:
A Closer Look at MPxNode::compute() You can not control when compute() is getting called, Maya control when it gets called Compute() is called in Evaluation phase Inside compute(): avoid sending dirty messages Don’t execute commands Don’t get or set values on other nodes

Слайд 59
Описание слайда:
A Closer Look at MPxNode::compute() Inside compute(): avoid sending dirty messages Get/set data only through datablock using data handles, don’t set data via plugs (i.e. MPlug::setValue) setting data via plug propagates dirty, datahandle does not datahandle set/get methods are more efficient

Слайд 60
Описание слайда:
Learning Resources Maya Developer Center: http://www.autodesk.com/developmaya Questions and Problems: ADN http://www.autodesk.com/adn Maya API White Paper, DevTV, Webcast training Discussion Forum: The AREA http://area.autodesk.com/forum/autodesk-maya/sdk/

Слайд 61
Описание слайда:
Q & A

Слайд 62
Описание слайда:
Thank you!


Скачать презентацию на тему Introduction to Maya можно ниже:

Похожие презентации