Tag Archives: Python

LemonRender – Batch Renderer

As a Softimage user, I’m not given any kind of render manager software like the straight forward but useful application that is backburner. I’ve worked at many studios and used many render farms (including backburner) but some of the main ones are Royal Render, Deadline . Anyway these ones are can be quite complex, and if you start beta testing a renderer like VRay in Softimage, you can come up against issues. I’ve now found that while I wait for a new version of Deadline, Softimage 2013 isn’t supported either….. So I’ve gone back to using this wee batch rendering system I made last year.

It involves only a few elements:

  • a plugin/submitter for Softimage
  • a batch file that runs…..
  • the main Lemon Render Python script
  • a simple web interface (run by a simple web server)
From this though, I can print logs of my renders to see how long they have been taking, and queue up jobs. These are all just stored (from the submitter) in simple text files which I can later alter/delete etc.
At the moment there is no priority,  the only thing a user can do is pause jobs in the queue.
I’m sure I could easily write plugins for Maya/Max/Nuke too but have never gotten around to it.
If there is any interest in it then I may do so!

lightbox

Python Scripting in Softimage XSI: Selection

I was originally planning to post purely about the incredibly useful simple task of making a loop to do repetitive tasks for you. You don’t need to be a TD for this to make things easier day to day, modelling, texturing, lighting, scene organising etc. You could use this in any situation.
ANYWAY as I wrote it I realised I was getting deep into some fundamentals whilst I was explaining how to access the object selection. So For this post I’ll just stick to selection and then advance that in the loop later.

    • Using this command, you can access the objects that are currently selected:

      This is a collection, so if you were to ‘print’ that command, you wouldn’t get great feedback about what it contains.
      In the following code examples, the lines that begin with # hashes show the results of the previous line of code when they are run.

      Note: if you ‘comment’ out a line in a script with the # it will be ignored when run – thus you can use it for commenting your code)

      See! Not so helpful. But as a collection, you can iterate through it using a ‘for loop’. Good old loop.

      Here there are a couple of important things to note in the loop.
      The indent is used by python instead of {} or things like that in other code. So after the loop begins, the next line that is INSIDE that loop, is in the indent, when lines stop being indented, the loop is over – it should be clear to read.
      “oObject” is a variable being declared at this point to be used in the loop. So you can name this whatever you like it is not in relation to anything previously (this is something that confused me to begin with so I’ll try and make that clear)
      I prefix the variables with ‘o’ to make it clear what they are, I picked this up from somewhere..

      So that’s the way to access each object in a loop. I’ll write up why that’s useful in the next post about loops specifically.

    • If you want to specifically pick the first, last, or any other object by index you can do that too.
      Note here I will create variables and then print whatever they contain, instead of printing the full command, this is a main principle while scripting, for tidiness, clarity of reading, organising, swapping data in and out.. And other great mysterious reasons I don’t understand.

      So that’s getting the first object (or ONLY object if there’s only one selected)
      Arrays/indices always start from 0 in scripting, so the FIRST index is always 0. Keeping that in mind, how to get the last object…

      To do that you need to get the length of the selection – the number of objects selected.
      For instance if you have 4 selected, the indices would be 0,1,2,3. So after getting the length (4) you need to subtract 1 to get the last index in the list. To get the length, use this command:

      Then you can use it like so, subtracting 1:

I guess that is about that for accessing the selection! I’ll write about what to do with the selection with loop later.