Ejemplo n.º 1
0
def main () :
  #global root
  app = QtGui.QApplication ( sys.argv )

  app_settings.setValue ( 'version', version )
  app_settings.setValue ( 'root', normPath ( root ) )
  project_filename = setDefaultValue ( 'project_filename', 'meshadered.prj' )

  temp_dir = setDefaultValue ( 'temp', normPath ( os.path.join ( root, 'tmp' ) ) )

  project_dir = setDefaultValue ( 'project', normPath ( os.path.join ( root, 'samples' ) ) )
  project_shaders = setDefaultValue ( 'project_shaders', normPath ( os.path.join ( project_dir,'shaders' ) ) )
  project_textures = setDefaultValue ( 'project_textures',normPath ( os.path.join ( project_dir,'textures' ) ) )

  shader_networks_dir = setDefaultValue ( 'shader_networks', normPath ( os.path.join ( project_shaders,'shn' ) ) )
  shader_sources_dir = setDefaultValue ( 'shader_sources', normPath ( os.path.join ( project_shaders,'src' ) ) )
  shader_output_dir = project_shaders

  lib_dir = setDefaultValue ( 'lib', normPath ( os.path.join ( root, 'lib' ) ) )
  node_dir = setDefaultValue ( 'nodes', normPath ( os.path.join ( lib_dir, 'nodes' ) ) )
  texture_dir = setDefaultValue ( 'texture', normPath ( os.path.join ( lib_dir, 'textures' ) ) )
  shaders_dir = setDefaultValue ( 'shaders', normPath ( os.path.join ( lib_dir, 'shaders' ) ) )
  archive_dir = setDefaultValue ( 'archive', normPath ( os.path.join ( lib_dir, 'archives' ) ) )

  include_dir = setDefaultValue ( 'include', normPath ( os.path.join ( root, 'include' ) ) )

  createMissingDirs ( [ temp_dir, lib_dir, project_dir, project_shaders, project_textures ] )
  createMissingDirs ( [ shader_networks_dir, shader_sources_dir ] )
  createMissingDirs ( [ node_dir, texture_dir, shaders_dir, archive_dir ] ) # include_dir supposed to be a list
  #
  # Recent projects/networks
  #
  setDefaultValue ( 'recent_projects_max', 10 )
  setDefaultValue ( 'recent_networks_max', 10 )
  #
  # setup globals
  #
  app_global_vars [ 'version' ]         = app_settings.value( 'version' ).toString()
  app_global_vars [ 'RootPath' ]        = root
  app_global_vars [ 'TempPath' ]        = temp_dir
  app_global_vars [ 'ProjectPath' ]     = project_dir
  app_global_vars [ 'ProjectShaders' ]  = project_shaders
  app_global_vars [ 'ProjectTextures' ] = project_textures

  app_global_vars [ 'ProjectNetworks' ] = shader_networks_dir
  app_global_vars [ 'ProjectSources' ]  = shader_sources_dir

  app_global_vars [ 'LibPath' ]     = lib_dir
  app_global_vars [ 'NodesPath' ]   = node_dir
  app_global_vars [ 'TexturePath' ] = texture_dir
  app_global_vars [ 'ShaderPath' ]  = shaders_dir
  app_global_vars [ 'IncludePath' ] = include_dir

  app_global_vars [ 'TextureSearchPath' ] = sanitizeSearchPath ( texture_dir )
  app_global_vars [ 'ShaderSearchPath' ]  = sanitizeSearchPath ( shaders_dir )
  app_global_vars [ 'ArchiveSearchPath' ] = sanitizeSearchPath ( archive_dir )

  app_global_vars [ 'ProjectSearchPath' ]     = sanitizeSearchPath ( project_dir )
  app_global_vars [ 'ProjectSearchShaders' ]  = sanitizeSearchPath ( project_shaders )
  app_global_vars [ 'ProjectSearchTextures' ] = sanitizeSearchPath ( project_textures )

  #
  # Setup current renderer preset
  #
  defRenderer = setDefaultValue ( 'defRenderer', '3Delight' )
  preset = meRendererPreset ( os.path.join ( root, 'renderers.xml' ), defRenderer )
  app_global_vars [ 'RendererPreset' ] = preset
  app_global_vars [ 'RendererName' ]   = preset.currentPreset.RendererName
  app_global_vars [ 'RendererFlags' ]  = preset.currentPreset.RendererFlags
  app_global_vars [ 'ShaderCompiler' ] = preset.currentPreset.ShaderCompiler
  app_global_vars [ 'ShaderDefines' ]  = preset.currentPreset.ShaderDefines
  app_global_vars [ 'ShaderInfo' ]     = preset.currentPreset.ShaderInfo
  app_global_vars [ 'SLO' ]            = preset.currentPreset.ShaderExt
  app_global_vars [ 'TextureMake' ]    = preset.currentPreset.TextureMake
  app_global_vars [ 'TextureInfo' ]    = preset.currentPreset.TextureInfo
  app_global_vars [ 'TextureViewer' ]  = preset.currentPreset.TextureViewer
  app_global_vars [ 'TEX' ]            = preset.currentPreset.TextureExt

  createDefaultProject ( app_settings, True ) # check_if_exist = True

  if DEBUG_MODE :
    print 'TextureSearchPath = %s' % app_global_vars [ 'TextureSearchPath' ]
    print 'ShaderSearchPath = %s' % app_global_vars [ 'ShaderSearchPath' ]
    print 'ArchiveSearchPath = %s' % app_global_vars [ 'ArchiveSearchPath' ]
    print 'Renderer = %s' % app_global_vars [ 'RendererName' ]

  #app_global_vars[ 'RibPath' ] = ''
  #app_global_vars[ 'DisplayPath' ] = ''
  app_settings.beginGroup ( 'WorkArea' )
  #grid_enabled = bool( setDefaultValue( 'grid_enabled', True ).toString() )
  grid_enabled   = setDefaultValue ( 'grid_enabled', True )
  grid_size      = int ( setDefaultValue ( 'grid_size', 10 ) )
  grid_snap      = setDefaultValue ( 'grid_snap', True )
  reverse_flow   = setDefaultValue ( 'reverse_flow', False )
  straight_links = setDefaultValue ( 'straight_links', True )

  app_settings.endGroup ()

  app_settings.beginGroup ( 'Colors' )
  app_colors [ 'rsl_node_bg' ] = setDefaultValue ( 'rsl_node_bg', app_colors [ 'rsl_node_bg' ] )
  app_colors [ 'rib_node_bg' ] = setDefaultValue ( 'rib_node_bg', app_colors [ 'rib_node_bg' ] )
  app_colors [ 'image_node_bg' ] = setDefaultValue ( 'image_node_bg', app_colors [ 'image_node_bg' ] )
  app_colors [ 'group_node_bg' ] = setDefaultValue ( 'group_node_bg', app_colors [ 'group_node_bg' ] )
  app_settings.endGroup ()
  from gui.MainWindow import MainWindow

  window = MainWindow () #, rendererPreset )
  window.show ()

  # It's exec_ because exec is a reserved word in Python
  sys.exit ( app.exec_ () )
Ejemplo n.º 2
0
  return value
#
#
def getDefaultValue ( settings, group, key ) :
  if group != '' : settings.beginGroup ( group )
  value = settings.value( key )
  if group != '' : settings.endGroup ( )
  if value.toString() == 'true' : value = True
  elif value.toString() == 'false' : value = False
  else :
    value = str ( value.toString() )
  return value  
#
#  
defRenderer = setDefaultValue ( 'defRenderer','3Delight' )
app_renderer = meRendererPreset ( os.path.join ( root, 'renderers.xml' ), defRenderer )  
#app_renderer.setPresetFile ( os.path.join( root, 'renderers.xml' ), defRenderer ) 
   
#
#
#
def main ():
  
  #global root
  
  app = QtGui.QApplication ( sys.argv )
  
  app_settings.setValue ( 'root', normPath ( root ) )
  
  temp_dir = setDefaultValue ( 'temp', normPath ( os.path.join ( root, 'tmp' ) ) )
  
Ejemplo n.º 3
0
def main():
    #
    app = QtModule.QApplication(sys.argv)

    app_settings.setValue('version', __version__)
    app_settings.setValue('root', normPath(root))
    project_filename = setDefaultValue('project_filename', 'meshadered.prj')

    temp_dir = setDefaultValue('temp', normPath(os.path.join(root, 'tmp')))

    project_dir = setDefaultValue('project',
                                  normPath(os.path.join(root, 'samples')))
    project_shaders = setDefaultValue(
        'project_shaders', normPath(os.path.join(project_dir, 'shaders')))
    project_textures = setDefaultValue(
        'project_textures', normPath(os.path.join(project_dir, 'textures')))

    shader_networks_dir = setDefaultValue(
        'shader_networks', normPath(os.path.join(project_shaders, 'shn')))
    shader_sources_dir = setDefaultValue(
        'shader_sources', normPath(os.path.join(project_shaders, 'src')))
    shader_output_dir = project_shaders

    lib_dir = setDefaultValue('lib', normPath(os.path.join(root, 'lib')))
    node_dir = setDefaultValue('nodes',
                               normPath(os.path.join(lib_dir, 'nodes')))
    texture_dir = setDefaultValue('texture',
                                  normPath(os.path.join(lib_dir, 'textures')))
    shaders_dir = setDefaultValue('shaders',
                                  normPath(os.path.join(lib_dir, 'shaders')))
    archive_dir = setDefaultValue('archive',
                                  normPath(os.path.join(lib_dir, 'archives')))

    include_dir = setDefaultValue('include',
                                  normPath(os.path.join(root, 'include')))

    createMissingDirs(
        [temp_dir, lib_dir, project_dir, project_shaders, project_textures])
    createMissingDirs([shader_networks_dir, shader_sources_dir])
    createMissingDirs([node_dir, texture_dir, shaders_dir,
                       archive_dir])  # include_dir supposed to be a list
    #
    # Recent projects/networks
    #
    setDefaultValue('recent_projects_max', 10)
    setDefaultValue('recent_networks_max', 10)
    #
    # setup globals
    #
    app_global_vars['version'] = getDefaultValue(app_settings, '', 'version')
    app_global_vars['RootPath'] = root
    app_global_vars['TempPath'] = temp_dir
    app_global_vars['ProjectPath'] = project_dir
    app_global_vars['ProjectShaders'] = project_shaders
    app_global_vars['ProjectTextures'] = project_textures

    app_global_vars['ProjectNetworks'] = shader_networks_dir
    app_global_vars['ProjectSources'] = shader_sources_dir

    app_global_vars['LibPath'] = lib_dir
    app_global_vars['NodesPath'] = node_dir
    app_global_vars['TexturePath'] = texture_dir
    app_global_vars['ShaderPath'] = shaders_dir
    app_global_vars['IncludePath'] = include_dir

    app_global_vars['TextureSearchPath'] = sanitizeSearchPath(texture_dir)
    app_global_vars['ShaderSearchPath'] = sanitizeSearchPath(shaders_dir)
    app_global_vars['ArchiveSearchPath'] = sanitizeSearchPath(archive_dir)

    app_global_vars['ProjectSearchPath'] = sanitizeSearchPath(project_dir)
    app_global_vars['ProjectSearchShaders'] = sanitizeSearchPath(
        project_shaders)
    app_global_vars['ProjectSearchTextures'] = sanitizeSearchPath(
        project_textures)

    #
    # Setup current renderer preset
    #
    defRenderer = setDefaultValue('defRenderer', '3Delight')
    preset = meRendererPreset(os.path.join(root, 'renderers.xml'), defRenderer)
    app_global_vars['RendererPreset'] = preset
    app_global_vars['RendererName'] = preset.currentPreset.RendererName
    app_global_vars['RendererFlags'] = preset.currentPreset.RendererFlags
    app_global_vars['ShaderCompiler'] = preset.currentPreset.ShaderCompiler
    app_global_vars['ShaderDefines'] = preset.currentPreset.ShaderDefines
    app_global_vars['ShaderInfo'] = preset.currentPreset.ShaderInfo
    app_global_vars['SLO'] = preset.currentPreset.ShaderExt
    app_global_vars['TextureMake'] = preset.currentPreset.TextureMake
    app_global_vars['TextureInfo'] = preset.currentPreset.TextureInfo
    app_global_vars['TextureViewer'] = preset.currentPreset.TextureViewer
    app_global_vars['TEX'] = preset.currentPreset.TextureExt

    createDefaultProject(app_settings, True)  # check_if_exist = True

    if DEBUG_MODE:
        print 'TextureSearchPath = %s' % app_global_vars['TextureSearchPath']
        print 'ShaderSearchPath = %s' % app_global_vars['ShaderSearchPath']
        print 'ArchiveSearchPath = %s' % app_global_vars['ArchiveSearchPath']
        print 'Renderer = %s' % app_global_vars['RendererName']

    #app_global_vars[ 'RibPath' ] = ''
    #app_global_vars[ 'DisplayPath' ] = ''
    app_settings.beginGroup('WorkArea')
    #grid_enabled = bool( setDefaultValue( 'grid_enabled', True ).toString() )
    grid_enabled = setDefaultValue('grid_enabled', True)
    grid_size = int(setDefaultValue('grid_size', 10))
    grid_snap = setDefaultValue('grid_snap', True)
    reverse_flow = setDefaultValue('reverse_flow', False)
    straight_links = setDefaultValue('straight_links', True)

    app_settings.endGroup()

    app_settings.beginGroup('Colors')
    app_colors['rsl_node_bg'] = setDefaultValue('rsl_node_bg',
                                                app_colors['rsl_node_bg'])
    app_colors['rib_node_bg'] = setDefaultValue('rib_node_bg',
                                                app_colors['rib_node_bg'])
    app_colors['image_node_bg'] = setDefaultValue('image_node_bg',
                                                  app_colors['image_node_bg'])
    app_colors['group_node_bg'] = setDefaultValue('group_node_bg',
                                                  app_colors['group_node_bg'])
    app_settings.endGroup()

    from gui.MainWindow import MainWindow

    window = MainWindow()
    window.show()

    # It's exec_ because exec is a reserved word in Python
    sys.exit(app.exec_())