Graphics

 View Only
Expand all | Collapse all

Scripting: copy/duplicate a material?

  • 1.  Scripting: copy/duplicate a material?

    Posted 09-08-2016 23:06
    There's a method to copy scene objects, but materials are part of the project, not specific scene - is there a way to duplicate a material?


  • 2.  RE: Scripting: copy/duplicate a material?

    Posted 09-12-2016 13:38
    Hmmm, doesn't look like. You could create a new material and copy the shaders of another into it though.
    #XPression


  • 3.  RE: Scripting: copy/duplicate a material?

    Posted 09-14-2016 03:34
    Thanks for the suggestion. I'm not actively working right now, but I'm looking at the documentation... it doesn't seem like there's a way to copy/duplicate shaders. I know that doesn't mean it can't be done (I guess I could copy property by property, but often they are objects as well) , it just seems like if there's a UI option to duplicate a material, there should be a corresponding API function.
    #XPression


  • 4.  RE: Scripting: copy/duplicate a material?

    Posted 09-22-2016 22:09
    So, this is not working for me, let me expand on what I need to do.

    I have a template scene; the project has a number of materials that have RenderView shaders on them. A user copies the template scene, but needs "local" copies of these materials to reference the new scene and the cameras within that scene. In other words, each copy of the template scene needs it's own set of materials with RenderViews.

    There is no functionality to duplicate materials through the API (I have a bone to pick with your developers over not allowing API access to a ton of functionality you get in the Xpression UI... why?), but it's simple enough that I can create a new material, and a new XpBaseShader. I assign the shader to the material as a "RenderView." I can set the scene for the RenderView.

    How can I set the camera for the RenderView? There's no method for it that I can find anywhere.
    #XPression


  • 5.  RE: Scripting: copy/duplicate a material?

    Posted 09-22-2016 22:21
    ... and I can't set colors because they're read only? But there's no methods to set them.... in fact, I can't set a layer, either?
    #XPression


  • 6.  RE: Scripting: copy/duplicate a material?

    Posted 09-23-2016 00:04

    xpRenderViewShader.SetCamera()


    #XPression


  • 7.  RE: Scripting: copy/duplicate a material?

    Posted 09-23-2016 00:06

    The .ColorDiffuse property returns an xpColor object which has methods to set the color.


    #XPression


  • 8.  RE: Scripting: copy/duplicate a material?

    Posted 09-23-2016 00:13
    Have you seen the new feature in 6.7 that allows a Renderview to point to the scene that contains it? Essentially the renderview will point to itself.
    This works even when the scene is put online in the sequencer and the sequencer is using scene copies.
    Not sure if this helps you or not, but I figured it was worth mentioning.
    #XPression


  • 9.  RE: Scripting: copy/duplicate a material?

    Posted 09-23-2016 15:55
    Thanks; any additions are helpful - unfortunately we have too many Xpressions for me to have any idea when they might be updated. That feature would eliminate the need for this whole endeavor.

    And thanks for the programming notes - I didn't see that information in the help file, I guess I was not looking in the right places.
    #XPression


  • 10.  RE: Scripting: copy/duplicate a material?

    Posted 10-24-2016 08:23
    Where can I find XPressiaon API reference? Gimme link please
    #XPression


  • 11.  RE: Scripting: copy/duplicate a material?

    Posted 10-24-2016 08:27
    In help folder of your Xpression folder (generally : C:\Program Files (x86)\XPressionStudio\Help)
    #XPression


  • 12.  RE: Scripting: copy/duplicate a material?

    Posted 10-24-2016 08:35
    Thanks ))
    #XPression