Listing the codecs intalled on the machine

Often an application requires to list all the Audio/Video compressors installed on the machine. We can achieve this easily with the ICreateDevEnum interface available from DirectShow. ICreateDevEnum exposes a method named CreateClassEnumerator that allows us to create enumerators for different categories of devices, such as audio/video codecs, Directx Media Objects (DMO) etc. The typical usage…

2

Displaying the currently selected components with MSelectionList

The MGlobal::getActiveSelectionList() offers a convenient way of accessing the currently selected objects in the view. However, if you wish to find the selected components then you need to use the MSelectionList’s getDagPath() method. It returns the dagPath of the seleted object and also the selected components of it. Once we have the dagPath of the…

1

How to find the Shading Groups for a Shape node in Maya API?

Given the DagPath for any Mesh object, listing the Shading Groups connected to it is easy. The MFnMesh::getConnectedSetsAndMembers() will do the trick as shown below: MStatus ListShadingGroups(const MDagPath& inputShapeDagPath){ if(inputShapeDagPath.hasFn(MFn::kMesh)) { // Find the Shading Engines Connected to the SourceNode MFnMesh fnMesh(inputShapeDagPath.node()); // A ShadingGroup will have a MFnSet MObjectArray sets, comps; fnMesh.getConnectedSetsAndMembers(inputShapeDagPath.instanceNumber(), sets, comps,…

0

Tracking C++ variable state changes

Tracking class variables’ state changes can be tricky, especially if we are using too many asynchronous constructs. This is especially true for game and graphic application scenarios where hundreds and perhaps even thousands of object fly around changing their values in who knows which thread. (Who is forcing that character position into that map corner…

0

Having trouble with PoserFusion Shelf in Maya?

If you are encountering errors with Poser Fusion shelf buttons in Maya such as “Error: No Selection, or the Currently Selected object is not linked to a Poser file”, then try the below steps and see if its helps. First of all ensure that your POSER_LOCATION environment variable is set correctly. It should read something…

15

How to create and manipulate Terabyte size Arrays with Win32API

If you are looking for a way of creating and accessing very large arrays, arrays that can handle content in the order of Tera Bytes, then probably you might find the File Mapping techniques useful for that purpose. File mapping is the association of a file’s contents with a portion of the virtual address space…

1

Multiplication Circuit for Prime Factorization

Deriving a multiplication circuit for the Prime Factorization problem is trivial if you know how to convert the arithmetic and relational expressions into propositional logic. Below I will show few expressions and their corresponding CNF formulation. Converting Arithmetic and Relational expressions to Propositional Logic Here symbols such as x, y, z, a, b, c etc……

1

How to check if my code is executing inside a Managed App or Native App?

If you check the CRT source code (inside VC\crt\src\crt0.c) you can find an interesting function check_managed_app() that returns 1 if managed app, 0 if not based on the COM Runtime Descriptor in the Image Data Directory of the PE or PE+ header. You can generalize it to test if you are running as part of…

1

Well-designed libraries

It is very rare that we come across a well-designed library every day, and even rare that we get a chance to work on them on daily basis. While it is hard to define what makes any given library “well-designed”, it is rather easy to identify what is not. However, there are few exceptionally good…

1

Populating a tree control with Maya DAG Nodes

MItDag offers a convenient way to iterate over the DAG nodes in any Maya scene, but not in a way that is useful for populating the visited nodes in a Windows tree control. This is because MItDag gives a linear list of nodes that make it a little bit difficult to get back the parent-child…

1