Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > Alias software > Re: creating a ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 7 Topic 891 of 912
Post > Topic >>

Re: creating a file node

by pk_pk <aye_hye04@[EMAIL PROTECTED] > Mar 28, 2008 at 11:20 AM

On Mar 26, 6:42 pm, DTrel <DT...@[EMAIL PROTECTED]
> wrote:
> On Wed, 26 Mar 2008 17:05:43 -0700 (PDT), pk_pk <aye_hy...@[EMAIL PROTECTED]
>
wrote:
> >On Mar 25, 5:27 pm, aen <a...@[EMAIL PROTECTED]
> wrote:
> >> Hi Kanita...
> >> Sorry, but its been over a year since I worked directly with the API.
> >> However if you have not looked for it the:
> >> "....\Autodesk\Maya8.5\devkit\plug-ins" directory, there are a
> >> number of examples of creating and connecting shader networks.
> >> cgfxShaderNode.cpp
> >> checkerShader.cpp
>
> >> hth's aen
>
> >> >hi,
>
> >> >how can i create a file node using the maya api?
>
> >> >i would like to create a file node which i can assign to a
> >> >MFnPhongShader object.
>
> >> >does anyone have any ideas?
>
> >> >thanks,
> >> >kanita
>
> >hi aen,
>
> >thanks for that lead. it actually helped out a lot- i was able to make
> >the file texture node and hook it up to the material. all that remains
> >is hooking up the MFnPhongShader material to a phong shading group.
>
> >thanks!
> >kp
>
> Glad to help...
>
> Hooking up a shader network basically amount to the properl
configuration of the
> Dependency Graph (DC) (not the DAG) - dirty node propagation.
> There is a very good video intermediate level video tutorial for this;
> "Learning Autodesk Maya - Understanding the Maya API - The Dependency
Graph"http://www.creationengine.com/html/p.lasso?p=15143
> (copies of this may also be floating around the net?)
> At first it seems to be a very simple tutorial, but at the end they give
some
> practical understanding of API Nodes and Maya Cl***** (which are weird).
>
> Also...www.highend3d.comhas a good API Forum, not very active but they
do have
> good listing of archived postings. And Highend3d also have some plugins
with
> full source code, reverse engineering works great.
>
> luck...aen

Hi Aen,

After I created the shading network, I used the example from here
(http://ewertb.soundlinker.com/api/api.008.htm)
to assign the shading
group to my mesh/components:

MStatus MShadingGroup::AssignToShadingGroup(
  const MObject & shadingGroup,
  const MDagPath & dagPath,
  const MObject & component )
{
  MStatus                     status;
  MFnSet                      fnSG( shadingGroup, &status );

  if ( fnSG.restriction() != MFnSet::kRenderableOnly )
    return MS::kFailure;

  status = fnSG.addMember( dagPath, component );
  if ( status != MS::kSuccess )
  {
    cerr << " ! MShadingGroup::assignToShadingGroup could not add Dag/
Component to SG ! " << endl;
  }

  return status;
}

Although the "addMemeber" line above succeeds, I get the following
error in the script editor window:

// Error: line 5: Cannot add the following items to the set since they
would break the exclusivity constraint: pCube3.f[0] //
// Error: line 5: Cannot add the following items to the set since they
would break the exclusivity constraint: pSphereShape1 //

My parmeters to AssignToShadingGroup are something like (wrote them as
strings for explanation purposes):

shadingGroup: "phong1SG"
dagPath: "pCube3"
component: "pCube3.f[0]"

Do you know why this could be happening? The meshes in my scene
already have some other materials applied so do I need to break the
connection to old materials before assigning new ones?

I thought maybe the way I'm creating my shading engine may be the
problem also. To create the shading group, I had to use the following
mel command (I got this from the script editor when you create a
shading engine using the UI):

MString addShadingEngineToSet = "sets -renderable true -
noSurfaceShader true -empty -name " + phong.name() + "SG";
MGlobal::executeCommand(addShadingEngineToSet, result, false, true);

I'm looking into where I can find the video you suggested.

Thanks for any help!
kanita
 




 7 Posts in Topic:
creating a file node
pk_pk <aye_hye04@[EMAI  2008-03-25 16:26:22 
Re: creating a file node
aen <aen@[EMAIL PROTEC  2008-03-26 00:27:06 
Re: creating a file node
pk_pk <aye_hye04@[EMAI  2008-03-26 17:05:43 
Re: creating a file node
DTrel <DTrel@[EMAIL PR  2008-03-27 01:42:44 
Re: creating a file node
pk_pk <aye_hye04@[EMAI  2008-03-28 11:20:54 
Re: creating a file node
aen <aen@[EMAIL PROTEC  2008-03-29 08:49:35 
Re: creating a file node
pk_pk <aye_hye04@[EMAI  2008-03-31 10:47:31 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Nov 23 1:52:31 CST 2008.