Last active
July 8, 2016 15:38
-
-
Save tokejepsen/8f2a7d9807bcbbbb1ac0969a654a6b81 to your computer and use it in GitHub Desktop.
Nuke: related code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# limited random scaling | |
import nuke | |
import random | |
min_scale = 800 | |
max_scale = 1600 | |
for node in nuke.selectedNodes("Card2"): | |
scale = random.uniform(min_scale, max_scale) | |
node['uniform_scale'].setValue(scale) | |
# random image in folder | |
import nuke | |
import random | |
import os | |
for node in nuke.selectedNodes("Read"): | |
path = node['file'].getValue() | |
root = os.path.dirname(path) | |
images = [] | |
for f in os.listdir(root): | |
images.append(f) | |
f = random.choice(images) | |
new_path = os.path.join(root, f).replace('\\', '/') | |
node['file'].setValue(new_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment