Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the cycloneslider domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home2/wacggq0abkde/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the cartel domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home2/wacggq0abkde/public_html/wp-includes/functions.php on line 6114

Warning: Cannot modify header information - headers already sent by (output started at /home2/wacggq0abkde/public_html/wp-includes/functions.php:6114) in /home2/wacggq0abkde/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home2/wacggq0abkde/public_html/wp-includes/functions.php:6114) in /home2/wacggq0abkde/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home2/wacggq0abkde/public_html/wp-includes/functions.php:6114) in /home2/wacggq0abkde/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home2/wacggq0abkde/public_html/wp-includes/functions.php:6114) in /home2/wacggq0abkde/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home2/wacggq0abkde/public_html/wp-includes/functions.php:6114) in /home2/wacggq0abkde/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home2/wacggq0abkde/public_html/wp-includes/functions.php:6114) in /home2/wacggq0abkde/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home2/wacggq0abkde/public_html/wp-includes/functions.php:6114) in /home2/wacggq0abkde/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home2/wacggq0abkde/public_html/wp-includes/functions.php:6114) in /home2/wacggq0abkde/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1893
{"id":2153,"date":"2017-05-07T23:24:39","date_gmt":"2017-05-07T22:24:39","guid":{"rendered":"http:\/\/boris-mc.com\/?p=2153"},"modified":"2019-04-25T17:20:30","modified_gmt":"2019-04-25T16:20:30","slug":"batch-gizmo-2-grizmo-creator","status":"publish","type":"post","link":"https:\/\/boris-mc.com\/?p=2153","title":{"rendered":"BATCH GIZMO TO GRIZMO"},"content":{"rendered":"
\n
\n

tl;dr: <\/strong>Batch convert your favourite Nuke Gizmos into “Grizmos”.<\/p>\n<\/div><\/div>\n

\n
\n
Hi folks,<\/div>\n
\u00a0
<\/div><\/div>\n
So here I have a new little Python script for those who find a little boring\u00a0<\/strong>converting Gizmos into “Grizmos” manually.<\/strong>\u00a0Just in case, I\u00b4ll remind you that one of the best ways to make sure all your fancy Gizmos are going to render in the farm, or that a user that does not have a particular Gizmo can still open a comp that has it and work on it, is simply converting that Gizmo into a Group, thus getting the so-called\u00a0 “Grizmo” (as Hugo L\u00e9v\u00e9ille would call\u00b4em).<\/div>\n
<\/div><\/div>\n
<\/div>\n
What this script does, in its first version, is basically creating a Grizmo per each Gizmo found in a passed directory. AKA a batch Gizmo-to-Group converter, or a batch\u00a0Grizmo\u00a0Creator… And only for Windows users, at the moment.<\/div>\n
<\/div><\/div>\n
<\/div>\n
How to use it?<\/strong><\/div>\n
<\/div><\/div>\n
<\/div>\n
1 – Store and name the Python script<\/strong>\u00a0in a folder that Nuke is going to look at when it comes to importing Python scripts. Try the command “print nuke.pluginPath()<\/span>” in the script editor if you are not sure where your Nuke installation is looking for Plugins, Python Scripts and such.<\/div>\n
2 – Import the script<\/strong> you have just saved from Nuke\u00b4s script editor like “import module_name<\/span>“.<\/div>\n
3 – Call the main()<\/span> \u00a0function<\/strong> from the imported script like “module_name.main()<\/span>“.<\/div>\n
4 – If everything goes ok, you should immediately see a pop-up window asking for you to select the “Gizmos Path” directory. Navigate to the folder<\/strong> where you store all your fancy Gizmos and click ok.<\/div>\n
5 – Now you should have as many <\/strong>Grizmos as Gizmos<\/strong> you had in the former directory, with the “_grizmed” extension added to the original name. For instance:<\/div>\n
\u00a0 \u00a0 – Cryptomatte.gizmo (original Gizmo)<\/div>\n
\u00a0 \u00a0 – Cryptomatte_grizmed.gizmo (Grizmed\u00a0Gizmo)<\/div>\n
6 – Enjoy<\/strong> your brand new fancy Grizmos :D<\/div>\n<\/div>\n
<\/div>\n
\n
\n
<\/div><\/div>\n<\/div>\n
\n
\n

important<\/strong>: If you find this usefull, it\u00b4s always better to create a Nuke menu from where to call the function.<\/p>\n<\/div>\n

<\/div><\/div><\/div>\n
\n<\/div>\n
<\/div>\n
<\/div>\n<\/div>\n<\/div>\n<\/div>\n
\n
snippet<\/strong><\/h6>\n<\/div>\n
import nuke\r\nimport os\r\nimport nukescripts\r\n\r\ndef transform_line(line):\r\n    """ basic character replacement function.\r\n    :param line: a string to be passed to perform character replacement.\r\n    :return: the line mutated with the new replaced character.\r\n    """\r\n    word_replacements = {'Gizmo': 'Group'}\r\n    for key, value in word_replacements.iteritems():\r\n        line = line.replace(key, value)\r\n    return line\r\n\r\n\r\ndef gizmo_to_grizmo(i):\r\n    """ this function creates a "grouped" .gizmo file.\r\n    :param i: input file to open\r\n    :return: None\r\n    """\r\n    o = str.split(i,".")[0] + "_grizmed" + "." + str.split(i,".")[-1]\r\n    with open(o, "w") as output_file, open(i) as input_file:\r\n        for line in input_file:\r\n            output_file.write(transform_line(line))\r\n    return None\r\n\r\n\r\ndef grizmo_my_folder(dir):\r\n    """ this fuction parses a directory and applies the gizmo_to_grizmo to its files, if convenient.\r\n       :param dir: directory to be parsed.\r\n       :return: None\r\n       """\r\n    for subdir, dirs, files in os.walk(dir):\r\n        for file in files:\r\n            # print os.path.join(subdir, file)\r\n            filepath = subdir + os.sep + file\r\n            if "grizmed" in filepath:\r\n                print "already grizmed"\r\n                return\r\n            elif filepath.endswith(".gizmo") and "grizmed" not in filepath:\r\n                gizmo_to_grizmo(filepath)\r\n                print "gizmos grizmed succesfully"\r\n            else:\r\n                print "no valid file found, bruh"\r\n                return\r\n            \r\n\r\nclass Panel(nukescripts.PythonPanel):\r\n    def __init__(self, name):\r\n        super(Panel, self).__init__(name)\r\n        # self.setMinimumSize(500,500)\r\n        self.path = nuke.File_Knob('gizmos_path', 'Gizmos Path')\r\n\r\n        self.addKnob(self.path)\r\n\r\n    def show_modal_dialog(self):\r\n        nukescripts.PythonPanel.showModalDialog(self)\r\n\r\n\r\ndef main():\r\n    """\r\n    wrapper function. From here we open the Nuke Panel to find the Gizmo Directory and launch the rest of the program\r\n    :return: None\r\n    """\r\n    p = Panel("Grizmo Maker")\r\n    p.show_modal_dialog()\r\n    path = p.path.getValue()\r\n    grizmo_my_folder(path)\r\n\r\n    if path:\r\n        panel = nuke.message("Grizmification completed")\r\n        print "Grizmification completed"\r\n    else:\r\n        panel = nuke.message("Grizmification aborted")\r\n        print "Grizmification aborted"\r\n    return\r\n\r\n\r\nif __name__ == '__main__':\r\n    main()<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"

snippet<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47,48,49,1],"tags":[],"class_list":["post-2153","post","type-post","status-publish","format-standard","hentry","category-nuke","category-python","category-scripting","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/boris-mc.com\/index.php?rest_route=\/wp\/v2\/posts\/2153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/boris-mc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/boris-mc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/boris-mc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/boris-mc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2153"}],"version-history":[{"count":15,"href":"https:\/\/boris-mc.com\/index.php?rest_route=\/wp\/v2\/posts\/2153\/revisions"}],"predecessor-version":[{"id":2547,"href":"https:\/\/boris-mc.com\/index.php?rest_route=\/wp\/v2\/posts\/2153\/revisions\/2547"}],"wp:attachment":[{"href":"https:\/\/boris-mc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/boris-mc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/boris-mc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}