Показаны сообщения с ярлыком nuke. Показать все сообщения
Показаны сообщения с ярлыком nuke. Показать все сообщения

четверг, 18 мая 2017 г.

Radiola

Now this work in the render.ru gallery:  http://render.ru/gallery/work/114844#work






воскресенье, 11 декабря 2016 г.

CG Event 2016, Материалы к выступлению: GIT


Не большая презентация о GIT
part 2: GIT
пример работы с GIT на примере простых Nuke скриптов
git: video 1
git: video 2

так можно переопределить текстовый редактор Vim при commit 
git config --global core.editor "'D:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin" 
git config -l  

чтобы достучаться через proxy
git config --global http.proxy http://[user]:[password]@[ip adress]:8080 
git config --global --get http.proxy

добавить все файлы 
git add .

исключить некоторые типы файлов из добавления в репозиторий
нужно создать файл .gitignore его содержание:
/.sources 
/docs 
*.bak 
*~ 
*.db 
*.pyc 
файлы из указанных папок и указанных типов не будут добавляться в репозиторий  

среда, 18 мая 2016 г.

How can I see or clear Nuke memory usage

nuke.clearRAMCache()
nuke.clearDiskCache()

def bytesto(bytes, to, bsize=1024):
    """convert bytes to megabytes, etc.
    sample code:
    print('mb= ' + str(bytesto(314575262000000, 'm')))
    sample output:
    mb= 300002347.946
    """
    a = {'k': 1, 'm': 2, 'g': 3, 't': 4, 'p': 5, 'e': 6}
    r = float(bytes)
    # print 'r {}'.format(r)
    for i in range(a[to]):
        r = r / bsize

    return (r)

print nuke.memory("info")
print nuke.memory("info", 'Read1')

print '{} Mb'.format(bytesto(nuke.memory("free"),'m'))
print '{} Mb'.format(bytesto(nuke.memory("usage"),'m'))
print '{} Mb'.format(bytesto(nuke.memory("total_ram"),'m'))
print '{} Gb'.format(bytesto(nuke.memory("total_vm"),'g'))

read about memory options:
print help(nuke.memory)

How do I read menu object in Nuke

inside the menu.py in Nuke, write global variable
n = nuke.menu('Nuke')

I can read the value of this object

print n.items().pop().items()[0].name()
print n.items().pop().items()[0].script()
print n.items().pop().items()[0].shortcut()

for menu_item in n.items():
    print menu_item.name()
    for menu_sub in menu_item.items():
       try:
           print '...{}'.format(menu_sub.name())
           print '...{}'.format(menu_sub.script())
           # print '...{}'.format(menu_sub.shortcut())
       except:
            pass
=========================
# Result: File
...New Comp...
...nuke.scriptNew("")
...Open Comp...
...nuke.scriptOpen("")
...Open Recent Comp
...Close Comp
...nuke.scriptClose()
...
...Save Comp
...nuke.scriptSave("")
...Save Comp As...
...nuke.scriptSaveAs("")
...Save New Comp Version
...nukescripts.script_and_write_nodes_version_up()
...
...Insert Comp Nodes...
...nukescripts.import_script()
...Export Comp Nodes...
...nukescripts.export_nodes_as_script()
...Comp Script Command...
...nukescripts.script_command('')
...Run Script...
...tcl_file()
...@;Next Frame
...frameBackward()
...@;Previous Frame
...frameForward()
...Comp Info
...nukescripts.script_data()
...
...Clear
...nuke.scriptClear()
...&Recent Files
Edit
...Undo
...nuke.undo()
...Redo
...nuke.redo()
...
...Cut
...nuke.nodeCopy(nukescripts.cut_paste_file()); nukescripts.node_delete(popupOnError=True)
...Copy
...nuke.nodeCopy(nukescripts.cut_paste_file())

and so on 

How do I write try...except in one string

1. for nuke:
exec('try:\n    n = nuke.toNode(\'DisableNodeController\'); k = n.knob(\'disable\'); k.setValue(0);\nexcept:\n   nuke.message(\'DisableNodeController is not in scene\')')

2. second variant
def safecall(f, default=None, exception=Exception):
    '''Returns modified f. When the modified f is called and throws an
    exception, the default value is returned'''
    def _safecall(*args,**argv):
        try:
            return f(*args,**argv)
        except exception:
            return default
    return _safecall

[safecall(int)(i) for i in '1 2 x'.split()]   # returns [1, 2, None]

[safecall(int, -1, ValueError)(i) for i in '1 2 x'.split()]    # returns [1, 2, -1]

Постоянные читатели