How to add an image to a surface on an object upon clicking script?

What code would I have to use in order to add a random texture to a surface on an object upon clicking the script's icon?

Comments

  • With the surface selected or just the object? These show many of the needed methods in action, I think http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/start#materials

  • EightiesIsEnoughEightiesIsEnough Posts: 1,069
    edited April 2020

    Selected surface is what i am referring to.

    There is so much code in the link that you posted, but it's hard for me to pick out what I need.  I do have experience in coding, if for personal projects.

    And to clarify, I am not looking to add a layer image.  I am looking to replace an image on a selected surface.  What code should I use?

    Post edited by EightiesIsEnough on
  • c567591ac567591a Posts: 39

    I am also trying to figure out how to get the currently selected surface so I can make a simple manipulation script.

    I have read the docs and samples, I can't figure out how to get current... I can see how to iterate all of them, but I just want the current one.

    What I am trying to do is set the bump map to the diffuse map if there is no bump assigned currently.  Yeah its a hack but it makes it a bit better in renders lol.  I just want to be able to do it faster/easier than manually.

  • I don't have the DS3 docs isntalled right now, the section on surface groups in the DS 4 sctopting wiki is unavailable (most of the geometry objects are), but I'm pretty sure that there is an isSelected() method so you could iterate over the object's surfaces finding which were selected (remember that there can be more than one object selected, and more than one surface selected on any object).

  • Sorry, looking at one of my old scripts you get a list of materials from the object and yes DzMaterial has an isSelected() method, so somethign like get your selected object list, get the shapes, get the material lists, and check through them for selection adding those that are to an array for adjusting

Sign In or Register to comment.