Skip to content

Commit

Permalink
rules: some paths
Browse files Browse the repository at this point in the history
  • Loading branch information
timurhai committed Oct 4, 2016
1 parent 821ac06 commit c9b5ce6
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 30 deletions.
26 changes: 19 additions & 7 deletions rules/assets/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ function prj_ShotsDeploy()
wnd.elContent.classList.add('deploy_shots');

var params = {};
params.sources = g_CurPath() + '/deploy/src';
params.sources = cgru_PM('/' + RULES.root + g_CurPath() + '/IN');
// params.references = g_CurPath() + '/deploy/ref';
params.template = RULES.assets.shot.template;
params.template = cgru_PM( RULES.assets.shot.template);

//console.log( JSON.stringify( g_elCurFolder.m_dir));
params.destination = RULES.assets.scenes.seek[0];
Expand All @@ -43,6 +43,7 @@ function prj_ShotsDeploy()
if( RULES.assets.scenes.seek[s].indexOf( g_elCurFolder.m_dir.folders[f]) != -1 )
params.destination = RULES.assets.scenes.seek[s];
params.destination = params.destination.replace('[project]', ASSETS.project.path) + '/deploy';
params.destination = cgru_PM('/' + RULES.root + params.destination);

gui_Create( wnd.elContent, prj_deploy_shots_params, [params]);

Expand Down Expand Up @@ -100,11 +101,11 @@ function prj_ShotsDeployDo( i_wnd, i_args)
var cmd = 'rules/bin/deploy_shots.sh';
var params = gui_GetParams( i_wnd.elContent, prj_deploy_shots_params);

cmd += ' -s "' + cgru_PM('/' + RULES.root + params.sources, true) + '"';
cmd += ' -s "' + cgru_PM( params.sources, true) + '"';
if( params.references.length )
cmd += ' -r "' + cgru_PM('/' + RULES.root + params.references, true) + '"';
cmd += ' -t "' + params.template + '"';
cmd += ' -d "' + cgru_PM('/' + RULES.root + params.destination, true) + '"';
cmd += ' -r "' + cgru_PM( params.references, true) + '"';
cmd += ' -t "' + cgru_PM( params.template, true) + '"';
cmd += ' -d "' + cgru_PM( params.destination, true) + '"';
cmd += ' --shot_src "' + RULES.assets.shot.source.path[0] + '"'
cmd += ' --shot_ref "' + RULES.assets.shot.references.path[0] + '"'
if( params.sameshot ) cmd += ' --sameshot';
Expand Down Expand Up @@ -151,7 +152,7 @@ function prj_ShotsDeployFinished( i_data, i_args)

var el = document.createElement('div');
elResults.appendChild( el);
el.textContent = deploy.length + ' shots founded:';
el.textContent = deploy.length + ' shots founded in "' + deploy.sources + '":';

var elTable = document.createElement('table');
elResults.appendChild( elTable);
Expand Down Expand Up @@ -237,6 +238,8 @@ function prj_ShotsDeployFinished( i_data, i_args)
//console.log( JSON.stringify( shot));
break;
}
else if( key == 'sources' || key == 'template' || key == 'dest')
continue;
else
{
var el = document.createElement('td');
Expand All @@ -245,5 +248,14 @@ function prj_ShotsDeployFinished( i_data, i_args)
}
}
}

var el = document.createElement('div');
elResults.appendChild( el);
el.textContent = 'Destination: ' + deploy.dest;

var el = document.createElement('div');
elResults.appendChild( el);
el.textContent = 'Template: ' + deploy.template;

}

37 changes: 19 additions & 18 deletions rules/bin/deploy_shots.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import json
import os
import re
import shutil
import signal
import re
import json
import sys

import af

Expand All @@ -17,10 +17,10 @@
version="%prog 1.0"
)

Parser.add_option('-s', '--sources', dest='sources', type ='string', default='', help='Sources')
Parser.add_option('-d', '--dest', dest='dest', type ='string', default='', help='Destination')
Parser.add_option('-r', '--refs', dest='refs', type ='string', default='', help='References')
Parser.add_option('-t', '--template', dest='template', type ='string', default='', help='Shot template')
Parser.add_option('-s', '--sources', dest='sources', type ='string', default=None, help='Sources')
Parser.add_option('-d', '--dest', dest='dest', type ='string', default=None, help='Destination')
Parser.add_option('-r', '--refs', dest='refs', type ='string', default=None, help='References')
Parser.add_option('-t', '--template', dest='template', type ='string', default=None, help='Shot template')
Parser.add_option( '--prefix', dest='prefix', type ='string', default=None, help='Shot renaming prefix')
Parser.add_option( '--regexp', dest='regexp', type ='string', default=None, help='Shot renaming regexp')
Parser.add_option( '--substr', dest='substr', type ='string', default='', help='Shot renaming substr')
Expand Down Expand Up @@ -73,29 +73,30 @@ def isSameShot(i_shot, i_name):

(Options, args) = Parser.parse_args()

if Options.sources == '':
if Options.sources is None:
errExit('Sources are not specified')

if not os.path.isdir(Options.sources):
errExit('Sources folder does not exist')
errExit('Sources folder does not exist: ' + Options.sources)
Out.append({'sources': Options.sources})

if Options.template == '':
if Options.template is None:
errExit('Shot template is not specified')

if not os.path.isdir(Options.template):
errExit('Shot template folder does not exist')
errExit('Shot template folder does not exist: ' + Options.template)
Out.append({'template': Options.template})

if Options.dest == '':
if Options.dest is None:
errExit('Destination is not specified')

if not os.path.isdir(Options.dest):
errExit('Destination folder does not exist')
errExit('Destination folder does not exist: ' + Options.dest)
Out.append({'dest': Options.dest})

ExistingShots = os.listdir( Options.dest)

References = []
if Options.refs != '' and os.path.isdir(Options.refs):
References = os.listdir(Options.refs)
if Options.refs is not None:
if os.path.isdir(Options.refs):
References = os.listdir(Options.refs)
# References.sort()

RegExp = None
Expand Down
2 changes: 1 addition & 1 deletion rules/bin/find_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def interrupt(signum, frame):
Out['dest'] = Options.dest
if not Options.skipcheck:
if not os.path.isdir( Options.dest):
errExit('Destination folder does not exist.')
errExit('Destination folder does not exist: ' + Options.dest)
DestFiles = os.listdir( Options.dest)

ResPaths = Options.respaths.split(',')
Expand Down
2 changes: 1 addition & 1 deletion rules/dailies.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ function d_Convert( i_args)
{
if( RULES.put.dest.indexOf('/') !== 0 )
if( ASSETS.project )
params.dest = cgru_PM('/' + RULES.root + ASSETS.project.path + '/' + RULES.put.dest, true);
params.dest = cgru_PM('/' + RULES.root + ASSETS.project.path + '/' + RULES.put.dest);
gui_Create( wnd.elContent, d_cvtmulti_params, [RULES.put,params]);
}

Expand Down
2 changes: 1 addition & 1 deletion rules/filesutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ function fu_PutMultiDialog( i_args)

if( RULES.put.dest.indexOf('/') !== 0 )
if( ASSETS.project )
params.dest = cgru_PM('/' + RULES.root + ASSETS.project.path + '/' + RULES.put.dest, true);
params.dest = cgru_PM('/' + RULES.root + ASSETS.project.path + '/' + RULES.put.dest);

gui_Create( wnd.elContent, fu_putmulti_params, [RULES.put, params]);
if( RULES.put.ftp )
Expand Down
2 changes: 1 addition & 1 deletion rules/rules.00_general.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@

"put":{
"input":"RESULT/PNG,RESULT/TIF,RESULT/DPX",
"dest":"FINAL",
"dest":"OUT",
"-dest":"/incoming",
"cmd":"python /cgru/utilities/put.py",
"-ftp":{
Expand Down
2 changes: 1 addition & 1 deletion rules_root/CG_PROJECT/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
deploy
IN
RESULT
WORK
COMMON

0 comments on commit c9b5ce6

Please sign in to comment.