Ray Mairlot - Freelance 3D Artist
  • Gallery
  • Blog
  • Store
  • Contact
  • About

Slider Puzzle Part 2 and more scripting

6/4/2014

Comments

 
Here is the second part of the Slider Puzzle Tutorial, this part focuses on unwrapping and texturing the grid:
I think I just need to confirm that while I said there wouldn't be any more tutorials on a regular basis, that only comes into effect after this tutorial series is over. There are 2 more parts of this current tutorial still to be released, after that, it's a bit less certain.

Anyway, onto more coding...


I've found that since having worked on bigger python projects, smaller scripts are far quicker to write having become far more familiar with the code. I've always found myself writing little mini scripts for things like enabling/disabling Subsurf modifiers for all objects in a scene, so for my current project I decided to create a little toolset that I can eventually develop and use across all my projects.
Currently all it does is the aforementioned Subsurf on and off along with controlling the Shrinkwrap modifier in a similar way. This is quite specific to the project I'm doing where it's really useful to control just these modifiers, but I'd hope in the future to be able to dynamically search the scene for all modifiers so they can all be controlled in this manner for more general projects.
Picture
The layout is a bit of a hack at the minute as I'm kind of forcing a 2 column menu to look like a panel. Eventually as I add more tools I'll probably collapse the modifier tools into proper submenus.

Another cool thing I found was the ability to have an operator set a custom property when it runs. So I can use the same operator to make both the modifiers visible and invisible. On line 7 you can see I define a new property within the operator. To make sure I can access it I pass 'self' and 'context' into both the execute function and the function that has my main code on lines 9 and 10. It's with 'self' that you access the property, so I haven't yet experimented if 'context' is actually needed:
Picture
Then you can access the operator property with '.propName' after the normal operator call and set it's value:
Picture
You can then access the property with 'self.propName':
Picture
Now I just have to work out how to set multiple arguments with an operator call...


Anyway, have to actually do some work now instead of just writing about it. Part 3 of the Slider Puzzle tutorial is out on Tuesday.


Ray.


Ps. I hope to have proper embedded code working soon.
Comments
comments powered by Disqus

    RSS Feed

    Categories

    All
    Animation
    Blender
    Compositing
    Flash
    Geometry Nodes
    Heartbreaker
    Hmhb
    Image
    Macro Maker
    Nodes
    Programming
    Python
    Rollercoaster
    Tutorial
    Unity
    Vfx
    Video


All images and videos copyright © Ray Mairlot, 2022.
None of the content on this site is to be used without my permission.
Powered by Create your own unique website with customizable templates.
  • Gallery
  • Blog
  • Store
  • Contact
  • About