svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r17405:HEAD
This commit is contained in:
commit
bb6d39687a
524
SConstruct
524
SConstruct
@ -57,8 +57,8 @@ nsis_build = None
|
|||||||
##### BEGIN SETUP #####
|
##### BEGIN SETUP #####
|
||||||
|
|
||||||
B.possible_types = ['core', 'common', 'blender', 'intern',
|
B.possible_types = ['core', 'common', 'blender', 'intern',
|
||||||
'international', 'game', 'game2',
|
'international', 'game', 'game2',
|
||||||
'player', 'player2', 'system']
|
'player', 'player2', 'system']
|
||||||
|
|
||||||
B.binarykind = ['blender' , 'blenderplayer']
|
B.binarykind = ['blender' , 'blenderplayer']
|
||||||
##################################
|
##################################
|
||||||
@ -67,15 +67,15 @@ B.binarykind = ['blender' , 'blenderplayer']
|
|||||||
# XX cheating for BF_FANCY, we check for BF_FANCY before args are validated
|
# XX cheating for BF_FANCY, we check for BF_FANCY before args are validated
|
||||||
use_color = ARGUMENTS.get('BF_FANCY', '1')
|
use_color = ARGUMENTS.get('BF_FANCY', '1')
|
||||||
if platform=='win32':
|
if platform=='win32':
|
||||||
use_color = None
|
use_color = None
|
||||||
|
|
||||||
if not use_color=='1':
|
if not use_color=='1':
|
||||||
B.bc.disable()
|
B.bc.disable()
|
||||||
|
|
||||||
#on defaut white Os X terminal, some colors are totally unlegible
|
#on defaut white Os X terminal, some colors are totally unlegible
|
||||||
if platform=='darwin':
|
if platform=='darwin':
|
||||||
B.bc.OKGREEN = '\033[34m'
|
B.bc.OKGREEN = '\033[34m'
|
||||||
B.bc.WARNING = '\033[36m'
|
B.bc.WARNING = '\033[36m'
|
||||||
|
|
||||||
# arguments
|
# arguments
|
||||||
print B.bc.HEADER+'Command-line arguments'+B.bc.ENDC
|
print B.bc.HEADER+'Command-line arguments'+B.bc.ENDC
|
||||||
@ -98,247 +98,247 @@ quickie = B.arguments.get('BF_QUICK', None)
|
|||||||
quickdebug = B.arguments.get('BF_QUICKDEBUG', None)
|
quickdebug = B.arguments.get('BF_QUICKDEBUG', None)
|
||||||
|
|
||||||
if quickdebug:
|
if quickdebug:
|
||||||
B.quickdebug=string.split(quickdebug, ',')
|
B.quickdebug=string.split(quickdebug, ',')
|
||||||
else:
|
else:
|
||||||
B.quickdebug=[]
|
B.quickdebug=[]
|
||||||
|
|
||||||
if quickie:
|
if quickie:
|
||||||
B.quickie=string.split(quickie,',')
|
B.quickie=string.split(quickie,',')
|
||||||
else:
|
else:
|
||||||
B.quickie=[]
|
B.quickie=[]
|
||||||
|
|
||||||
toolset = B.arguments.get('BF_TOOLSET', None)
|
toolset = B.arguments.get('BF_TOOLSET', None)
|
||||||
if toolset:
|
if toolset:
|
||||||
print "Using " + toolset
|
print "Using " + toolset
|
||||||
if toolset=='mstoolkit':
|
if toolset=='mstoolkit':
|
||||||
env = BlenderEnvironment(ENV = os.environ)
|
env = BlenderEnvironment(ENV = os.environ)
|
||||||
env.Tool('mstoolkit', ['tools'])
|
env.Tool('mstoolkit', ['tools'])
|
||||||
else:
|
else:
|
||||||
env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
|
env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
|
||||||
if env:
|
if env:
|
||||||
btools.SetupSpawn(env)
|
btools.SetupSpawn(env)
|
||||||
else:
|
else:
|
||||||
env = BlenderEnvironment(ENV = os.environ)
|
env = BlenderEnvironment(ENV = os.environ)
|
||||||
|
|
||||||
if not env:
|
if not env:
|
||||||
print "Could not create a build environment"
|
print "Could not create a build environment"
|
||||||
Exit()
|
Exit()
|
||||||
|
|
||||||
|
|
||||||
cc = B.arguments.get('CC', None)
|
cc = B.arguments.get('CC', None)
|
||||||
cxx = B.arguments.get('CXX', None)
|
cxx = B.arguments.get('CXX', None)
|
||||||
if cc:
|
if cc:
|
||||||
env['CC'] = cc
|
env['CC'] = cc
|
||||||
if cxx:
|
if cxx:
|
||||||
env['CXX'] = cxx
|
env['CXX'] = cxx
|
||||||
|
|
||||||
if env['CC'] in ['cl', 'cl.exe'] and sys.platform=='win32':
|
if env['CC'] in ['cl', 'cl.exe'] and sys.platform=='win32':
|
||||||
platform = 'win32-vc'
|
platform = 'win32-vc'
|
||||||
elif env['CC'] in ['gcc'] and sys.platform=='win32':
|
elif env['CC'] in ['gcc'] and sys.platform=='win32':
|
||||||
platform = 'win32-mingw'
|
platform = 'win32-mingw'
|
||||||
|
|
||||||
env.SConscriptChdir(0)
|
env.SConscriptChdir(0)
|
||||||
|
|
||||||
crossbuild = B.arguments.get('BF_CROSS', None)
|
crossbuild = B.arguments.get('BF_CROSS', None)
|
||||||
if crossbuild and platform!='win32':
|
if crossbuild and platform!='win32':
|
||||||
platform = 'linuxcross'
|
platform = 'linuxcross'
|
||||||
|
|
||||||
env['OURPLATFORM'] = platform
|
env['OURPLATFORM'] = platform
|
||||||
|
|
||||||
configfile = 'config'+os.sep+platform+'-config.py'
|
configfile = 'config'+os.sep+platform+'-config.py'
|
||||||
|
|
||||||
if os.path.exists(configfile):
|
if os.path.exists(configfile):
|
||||||
print B.bc.OKGREEN + "Using config file: " + B.bc.ENDC + configfile
|
print B.bc.OKGREEN + "Using config file: " + B.bc.ENDC + configfile
|
||||||
else:
|
else:
|
||||||
print B.bc.FAIL + configfile + " doesn't exist" + B.bc.ENDC
|
print B.bc.FAIL + configfile + " doesn't exist" + B.bc.ENDC
|
||||||
|
|
||||||
if crossbuild and env['PLATFORM'] != 'win32':
|
if crossbuild and env['PLATFORM'] != 'win32':
|
||||||
print B.bc.HEADER+"Preparing for crossbuild"+B.bc.ENDC
|
print B.bc.HEADER+"Preparing for crossbuild"+B.bc.ENDC
|
||||||
env.Tool('crossmingw', ['tools'])
|
env.Tool('crossmingw', ['tools'])
|
||||||
# todo: determine proper libs/includes etc.
|
# todo: determine proper libs/includes etc.
|
||||||
# Needed for gui programs, console programs should do without it
|
# Needed for gui programs, console programs should do without it
|
||||||
env.Append(LINKFLAGS=['-mwindows'])
|
env.Append(LINKFLAGS=['-mwindows'])
|
||||||
|
|
||||||
userconfig = B.arguments.get('BF_CONFIG', 'user-config.py')
|
userconfig = B.arguments.get('BF_CONFIG', 'user-config.py')
|
||||||
# first read platform config. B.arguments will override
|
# first read platform config. B.arguments will override
|
||||||
optfiles = [configfile]
|
optfiles = [configfile]
|
||||||
if os.path.exists(userconfig):
|
if os.path.exists(userconfig):
|
||||||
print B.bc.OKGREEN + "Using user-config file: " + B.bc.ENDC + userconfig
|
print B.bc.OKGREEN + "Using user-config file: " + B.bc.ENDC + userconfig
|
||||||
optfiles += [userconfig]
|
optfiles += [userconfig]
|
||||||
else:
|
else:
|
||||||
print B.bc.WARNING + userconfig + " not found, no user overrides" + B.bc.ENDC
|
print B.bc.WARNING + userconfig + " not found, no user overrides" + B.bc.ENDC
|
||||||
|
|
||||||
opts = btools.read_opts(optfiles, B.arguments)
|
opts = btools.read_opts(optfiles, B.arguments)
|
||||||
opts.Update(env)
|
opts.Update(env)
|
||||||
|
|
||||||
if not env['BF_FANCY']:
|
if not env['BF_FANCY']:
|
||||||
B.bc.disable()
|
B.bc.disable()
|
||||||
|
|
||||||
SetOption('num_jobs', int(env['BF_NUMJOBS']))
|
SetOption('num_jobs', int(env['BF_NUMJOBS']))
|
||||||
print "Build with %d parallel jobs" % (GetOption('num_jobs'))
|
print "Build with %d parallel jobs" % (GetOption('num_jobs'))
|
||||||
|
|
||||||
# disable elbeem (fluidsim) compilation?
|
# disable elbeem (fluidsim) compilation?
|
||||||
if env['BF_NO_ELBEEM'] == 1:
|
if env['BF_NO_ELBEEM'] == 1:
|
||||||
env['CPPFLAGS'].append('-DDISABLE_ELBEEM')
|
env['CPPFLAGS'].append('-DDISABLE_ELBEEM')
|
||||||
env['CXXFLAGS'].append('-DDISABLE_ELBEEM')
|
env['CXXFLAGS'].append('-DDISABLE_ELBEEM')
|
||||||
env['CCFLAGS'].append('-DDISABLE_ELBEEM')
|
env['CCFLAGS'].append('-DDISABLE_ELBEEM')
|
||||||
|
|
||||||
if env['WITH_BF_OPENMP'] == 1:
|
if env['WITH_BF_OPENMP'] == 1:
|
||||||
if env['OURPLATFORM']=='win32-vc':
|
if env['OURPLATFORM']=='win32-vc':
|
||||||
env['CCFLAGS'].append('/openmp')
|
env['CCFLAGS'].append('/openmp')
|
||||||
env['CPPFLAGS'].append('/openmp')
|
env['CPPFLAGS'].append('/openmp')
|
||||||
env['CXXFLAGS'].append('/openmp')
|
env['CXXFLAGS'].append('/openmp')
|
||||||
else:
|
else:
|
||||||
if env['CC'][-3:] == 'icc': # to be able to handle CC=/opt/bla/icc case
|
if env['CC'][-3:] == 'icc': # to be able to handle CC=/opt/bla/icc case
|
||||||
env.Append(LINKFLAGS=['-openmp', '-static-intel'])
|
env.Append(LINKFLAGS=['-openmp', '-static-intel'])
|
||||||
env['CCFLAGS'].append('-openmp')
|
env['CCFLAGS'].append('-openmp')
|
||||||
env['CPPFLAGS'].append('-openmp')
|
env['CPPFLAGS'].append('-openmp')
|
||||||
env['CXXFLAGS'].append('-openmp')
|
env['CXXFLAGS'].append('-openmp')
|
||||||
else:
|
else:
|
||||||
env.Append(CCFLAGS=['-fopenmp'])
|
env.Append(CCFLAGS=['-fopenmp'])
|
||||||
env.Append(CPPFLAGS=['-fopenmp'])
|
env.Append(CPPFLAGS=['-fopenmp'])
|
||||||
env.Append(CXXFLAGS=['-fopenmp'])
|
env.Append(CXXFLAGS=['-fopenmp'])
|
||||||
# env.Append(LINKFLAGS=['-fprofile-generate'])
|
# env.Append(LINKFLAGS=['-fprofile-generate'])
|
||||||
|
|
||||||
#check for additional debug libnames
|
#check for additional debug libnames
|
||||||
|
|
||||||
if env.has_key('BF_DEBUG_LIBS'):
|
if env.has_key('BF_DEBUG_LIBS'):
|
||||||
B.quickdebug += env['BF_DEBUG_LIBS']
|
B.quickdebug += env['BF_DEBUG_LIBS']
|
||||||
|
|
||||||
printdebug = B.arguments.get('BF_LISTDEBUG', 0)
|
printdebug = B.arguments.get('BF_LISTDEBUG', 0)
|
||||||
|
|
||||||
# see if this linux distro has libalut
|
# see if this linux distro has libalut
|
||||||
|
|
||||||
if env['OURPLATFORM'] == 'linux2' :
|
if env['OURPLATFORM'] == 'linux2' :
|
||||||
if env['WITH_BF_OPENAL']:
|
if env['WITH_BF_OPENAL']:
|
||||||
mylib_test_source_file = """
|
mylib_test_source_file = """
|
||||||
#include "AL/alut.h"
|
#include "AL/alut.h"
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
alutGetMajorVersion();
|
alutGetMajorVersion();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def CheckFreeAlut(context,env):
|
def CheckFreeAlut(context,env):
|
||||||
context.Message( B.bc.OKGREEN + "Linux platform detected:\n checking for FreeAlut... " + B.bc.ENDC )
|
context.Message( B.bc.OKGREEN + "Linux platform detected:\n checking for FreeAlut... " + B.bc.ENDC )
|
||||||
env['LIBS'] = 'alut'
|
env['LIBS'] = 'alut'
|
||||||
result = context.TryLink(mylib_test_source_file, '.c')
|
result = context.TryLink(mylib_test_source_file, '.c')
|
||||||
context.Result(result)
|
context.Result(result)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
env2 = env.Clone( LIBPATH = env['BF_OPENAL'] )
|
env2 = env.Clone( LIBPATH = env['BF_OPENAL'] )
|
||||||
sconf_temp = mkdtemp()
|
sconf_temp = mkdtemp()
|
||||||
conf = Configure( env2, {'CheckFreeAlut' : CheckFreeAlut}, sconf_temp, '/dev/null' )
|
conf = Configure( env2, {'CheckFreeAlut' : CheckFreeAlut}, sconf_temp, '/dev/null' )
|
||||||
if conf.CheckFreeAlut( env2 ):
|
if conf.CheckFreeAlut( env2 ):
|
||||||
env['BF_OPENAL_LIB'] += ' alut'
|
env['BF_OPENAL_LIB'] += ' alut'
|
||||||
del env2
|
del env2
|
||||||
root = ''
|
root = ''
|
||||||
for root, dirs, files in os.walk(sconf_temp, topdown=False):
|
for root, dirs, files in os.walk(sconf_temp, topdown=False):
|
||||||
for name in files:
|
for name in files:
|
||||||
os.remove(os.path.join(root, name))
|
os.remove(os.path.join(root, name))
|
||||||
for name in dirs:
|
for name in dirs:
|
||||||
os.rmdir(os.path.join(root, name))
|
os.rmdir(os.path.join(root, name))
|
||||||
if root: os.rmdir(root)
|
if root: os.rmdir(root)
|
||||||
|
|
||||||
if len(B.quickdebug) > 0 and printdebug != 0:
|
if len(B.quickdebug) > 0 and printdebug != 0:
|
||||||
print B.bc.OKGREEN + "Buildings these libs with debug symbols:" + B.bc.ENDC
|
print B.bc.OKGREEN + "Buildings these libs with debug symbols:" + B.bc.ENDC
|
||||||
for l in B.quickdebug:
|
for l in B.quickdebug:
|
||||||
print "\t" + l
|
print "\t" + l
|
||||||
|
|
||||||
# remove stdc++ from LLIBS if we are building a statc linked CXXFLAGS
|
# remove stdc++ from LLIBS if we are building a statc linked CXXFLAGS
|
||||||
if env['WITH_BF_STATICCXX']:
|
if env['WITH_BF_STATICCXX']:
|
||||||
if 'stdc++' in env['LLIBS']:
|
if 'stdc++' in env['LLIBS']:
|
||||||
env['LLIBS'] = env['LLIBS'].replace('stdc++', ' ')
|
env['LLIBS'] = env['LLIBS'].replace('stdc++', ' ')
|
||||||
else:
|
else:
|
||||||
print '\tcould not remove stdc++ library from LLIBS, WITH_BF_STATICCXX may not work for your platform'
|
print '\tcould not remove stdc++ library from LLIBS, WITH_BF_STATICCXX may not work for your platform'
|
||||||
|
|
||||||
# check target for blenderplayer. Set WITH_BF_PLAYER if found on cmdline
|
# check target for blenderplayer. Set WITH_BF_PLAYER if found on cmdline
|
||||||
if 'blenderplayer' in B.targets:
|
if 'blenderplayer' in B.targets:
|
||||||
env['WITH_BF_PLAYER'] = True
|
env['WITH_BF_PLAYER'] = True
|
||||||
|
|
||||||
if 'blendernogame' in B.targets:
|
if 'blendernogame' in B.targets:
|
||||||
env['WITH_BF_GAMEENGINE'] = False
|
env['WITH_BF_GAMEENGINE'] = False
|
||||||
|
|
||||||
if 'blenderlite' in B.targets:
|
if 'blenderlite' in B.targets:
|
||||||
env['WITH_BF_GAMEENGINE'] = False
|
env['WITH_BF_GAMEENGINE'] = False
|
||||||
env['WITH_BF_OPENAL'] = False
|
env['WITH_BF_OPENAL'] = False
|
||||||
env['WITH_BF_OPENEXR'] = False
|
env['WITH_BF_OPENEXR'] = False
|
||||||
env['WITH_BF_ICONV'] = False
|
env['WITH_BF_ICONV'] = False
|
||||||
env['WITH_BF_INTERNATIONAL'] = False
|
env['WITH_BF_INTERNATIONAL'] = False
|
||||||
env['WITH_BF_OPENJPEG'] = False
|
env['WITH_BF_OPENJPEG'] = False
|
||||||
env['WITH_BF_FFMPEG'] = False
|
env['WITH_BF_FFMPEG'] = False
|
||||||
env['WITH_BF_QUICKTIME'] = False
|
env['WITH_BF_QUICKTIME'] = False
|
||||||
env['WITH_BF_YAFRAY'] = False
|
env['WITH_BF_YAFRAY'] = False
|
||||||
env['WITH_BF_REDCODE'] = False
|
env['WITH_BF_REDCODE'] = False
|
||||||
env['WITH_BF_FTGL'] = False
|
env['WITH_BF_FTGL'] = False
|
||||||
env['WITH_BF_DDS'] = False
|
env['WITH_BF_DDS'] = False
|
||||||
env['WITH_BF_ZLIB'] = False
|
env['WITH_BF_ZLIB'] = False
|
||||||
env['WITH_BF_SDL'] = False
|
env['WITH_BF_SDL'] = False
|
||||||
env['WITH_BF_JPEG'] = False
|
env['WITH_BF_JPEG'] = False
|
||||||
env['WITH_BF_PNG'] = False
|
env['WITH_BF_PNG'] = False
|
||||||
env['WITH_BF_ODE'] = False
|
env['WITH_BF_ODE'] = False
|
||||||
env['WITH_BF_BULLET'] = False
|
env['WITH_BF_BULLET'] = False
|
||||||
env['WITH_BF_BINRELOC'] = False
|
env['WITH_BF_BINRELOC'] = False
|
||||||
env['BF_BUILDINFO'] = False
|
env['BF_BUILDINFO'] = False
|
||||||
env['BF_NO_ELBEEM'] = True
|
env['BF_NO_ELBEEM'] = True
|
||||||
env['WITH_BF_PYTHON'] = False
|
env['WITH_BF_PYTHON'] = False
|
||||||
|
|
||||||
# lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
|
# lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
|
||||||
#B.root_build_dir = B.arguments.get('BF_BUILDDIR', '..'+os.sep+'build'+os.sep+platform+os.sep)
|
#B.root_build_dir = B.arguments.get('BF_BUILDDIR', '..'+os.sep+'build'+os.sep+platform+os.sep)
|
||||||
B.root_build_dir = env['BF_BUILDDIR']
|
B.root_build_dir = env['BF_BUILDDIR']
|
||||||
B.doc_build_dir = env['BF_DOCDIR']
|
B.doc_build_dir = env['BF_DOCDIR']
|
||||||
if not B.root_build_dir[-1]==os.sep:
|
if not B.root_build_dir[-1]==os.sep:
|
||||||
B.root_build_dir += os.sep
|
B.root_build_dir += os.sep
|
||||||
if not B.doc_build_dir[-1]==os.sep:
|
if not B.doc_build_dir[-1]==os.sep:
|
||||||
B.doc_build_dir += os.sep
|
B.doc_build_dir += os.sep
|
||||||
|
|
||||||
# We do a shortcut for clean when no quicklist is given: just delete
|
# We do a shortcut for clean when no quicklist is given: just delete
|
||||||
# builddir without reading in SConscripts
|
# builddir without reading in SConscripts
|
||||||
do_clean = None
|
do_clean = None
|
||||||
if 'clean' in B.targets:
|
if 'clean' in B.targets:
|
||||||
do_clean = True
|
do_clean = True
|
||||||
|
|
||||||
if not quickie and do_clean:
|
if not quickie and do_clean:
|
||||||
if os.path.exists(B.doc_build_dir):
|
if os.path.exists(B.doc_build_dir):
|
||||||
print B.bc.HEADER+'Cleaning doc dir...'+B.bc.ENDC
|
print B.bc.HEADER+'Cleaning doc dir...'+B.bc.ENDC
|
||||||
dirs = os.listdir(B.doc_build_dir)
|
dirs = os.listdir(B.doc_build_dir)
|
||||||
for entry in dirs:
|
for entry in dirs:
|
||||||
if os.path.isdir(B.doc_build_dir + entry) == 1:
|
if os.path.isdir(B.doc_build_dir + entry) == 1:
|
||||||
print "clean dir %s"%(B.doc_build_dir+entry)
|
print "clean dir %s"%(B.doc_build_dir+entry)
|
||||||
shutil.rmtree(B.doc_build_dir+entry)
|
shutil.rmtree(B.doc_build_dir+entry)
|
||||||
else: # remove file
|
else: # remove file
|
||||||
print "remove file %s"%(B.doc_build_dir+entry)
|
print "remove file %s"%(B.doc_build_dir+entry)
|
||||||
os.remove(B.root_build_dir+entry)
|
os.remove(B.root_build_dir+entry)
|
||||||
if os.path.exists(B.root_build_dir):
|
if os.path.exists(B.root_build_dir):
|
||||||
print B.bc.HEADER+'Cleaning build dir...'+B.bc.ENDC
|
print B.bc.HEADER+'Cleaning build dir...'+B.bc.ENDC
|
||||||
dirs = os.listdir(B.root_build_dir)
|
dirs = os.listdir(B.root_build_dir)
|
||||||
for entry in dirs:
|
for entry in dirs:
|
||||||
if os.path.isdir(B.root_build_dir + entry) == 1:
|
if os.path.isdir(B.root_build_dir + entry) == 1:
|
||||||
print "clean dir %s"%(B.root_build_dir+entry)
|
print "clean dir %s"%(B.root_build_dir+entry)
|
||||||
shutil.rmtree(B.root_build_dir+entry)
|
shutil.rmtree(B.root_build_dir+entry)
|
||||||
else: # remove file
|
else: # remove file
|
||||||
print "remove file %s"%(B.root_build_dir+entry)
|
print "remove file %s"%(B.root_build_dir+entry)
|
||||||
os.remove(B.root_build_dir+entry)
|
os.remove(B.root_build_dir+entry)
|
||||||
for confile in ['extern/ffmpeg/config.mak', 'extern/x264/config.mak',
|
for confile in ['extern/ffmpeg/config.mak', 'extern/x264/config.mak',
|
||||||
'extern/xvidcore/build/generic/platform.inc']:
|
'extern/xvidcore/build/generic/platform.inc']:
|
||||||
if os.path.exists(confile):
|
if os.path.exists(confile):
|
||||||
print "clean file %s"%confile
|
print "clean file %s"%confile
|
||||||
os.remove(confile)
|
os.remove(confile)
|
||||||
print B.bc.OKGREEN+'...done'+B.bc.ENDC
|
print B.bc.OKGREEN+'...done'+B.bc.ENDC
|
||||||
else:
|
else:
|
||||||
print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC
|
print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC
|
||||||
Exit()
|
Exit()
|
||||||
|
|
||||||
if not os.path.isdir ( B.root_build_dir):
|
if not os.path.isdir ( B.root_build_dir):
|
||||||
os.makedirs ( B.root_build_dir )
|
os.makedirs ( B.root_build_dir )
|
||||||
os.makedirs ( B.root_build_dir + 'source' )
|
os.makedirs ( B.root_build_dir + 'source' )
|
||||||
os.makedirs ( B.root_build_dir + 'intern' )
|
os.makedirs ( B.root_build_dir + 'intern' )
|
||||||
os.makedirs ( B.root_build_dir + 'extern' )
|
os.makedirs ( B.root_build_dir + 'extern' )
|
||||||
os.makedirs ( B.root_build_dir + 'lib' )
|
os.makedirs ( B.root_build_dir + 'lib' )
|
||||||
os.makedirs ( B.root_build_dir + 'bin' )
|
os.makedirs ( B.root_build_dir + 'bin' )
|
||||||
if not os.path.isdir(B.doc_build_dir):
|
if not os.path.isdir(B.doc_build_dir):
|
||||||
os.makedirs ( B.doc_build_dir )
|
os.makedirs ( B.doc_build_dir )
|
||||||
|
|
||||||
Help(opts.GenerateHelpText(env))
|
Help(opts.GenerateHelpText(env))
|
||||||
|
|
||||||
@ -346,10 +346,10 @@ Help(opts.GenerateHelpText(env))
|
|||||||
# commands, do 'scons BF_QUIET=0'
|
# commands, do 'scons BF_QUIET=0'
|
||||||
bf_quietoutput = B.arguments.get('BF_QUIET', '1')
|
bf_quietoutput = B.arguments.get('BF_QUIET', '1')
|
||||||
if env['BF_QUIET']:
|
if env['BF_QUIET']:
|
||||||
B.set_quiet_output(env)
|
B.set_quiet_output(env)
|
||||||
else:
|
else:
|
||||||
if toolset=='msvc':
|
if toolset=='msvc':
|
||||||
B.msvc_hack(env)
|
B.msvc_hack(env)
|
||||||
|
|
||||||
print B.bc.HEADER+'Building in '+B.bc.ENDC+B.root_build_dir
|
print B.bc.HEADER+'Building in '+B.bc.ENDC+B.root_build_dir
|
||||||
env.SConsignFile(B.root_build_dir+'scons-signatures')
|
env.SConsignFile(B.root_build_dir+'scons-signatures')
|
||||||
@ -371,21 +371,21 @@ SConscript(B.root_build_dir+'/source/SConscript')
|
|||||||
# libraries to give as objects to linking phase
|
# libraries to give as objects to linking phase
|
||||||
mainlist = []
|
mainlist = []
|
||||||
for tp in B.possible_types:
|
for tp in B.possible_types:
|
||||||
if not tp == 'player' and not tp == 'player2':
|
if not tp == 'player' and not tp == 'player2':
|
||||||
mainlist += B.create_blender_liblist(env, tp)
|
mainlist += B.create_blender_liblist(env, tp)
|
||||||
|
|
||||||
if B.arguments.get('BF_PRIORITYLIST', '0')=='1':
|
if B.arguments.get('BF_PRIORITYLIST', '0')=='1':
|
||||||
B.propose_priorities()
|
B.propose_priorities()
|
||||||
|
|
||||||
dobj = B.buildinfo(env, "dynamic") + B.resources
|
dobj = B.buildinfo(env, "dynamic") + B.resources
|
||||||
thestatlibs, thelibincs = B.setup_staticlibs(env)
|
thestatlibs, thelibincs = B.setup_staticlibs(env)
|
||||||
thesyslibs = B.setup_syslibs(env)
|
thesyslibs = B.setup_syslibs(env)
|
||||||
|
|
||||||
if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']:
|
if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']:
|
||||||
env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
|
env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
|
||||||
if env['WITH_BF_PLAYER']:
|
if env['WITH_BF_PLAYER']:
|
||||||
playerlist = B.create_blender_liblist(env, 'player')
|
playerlist = B.create_blender_liblist(env, 'player')
|
||||||
env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
|
env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
|
||||||
|
|
||||||
##### Now define some targets
|
##### Now define some targets
|
||||||
|
|
||||||
@ -395,19 +395,19 @@ if env['WITH_BF_PLAYER']:
|
|||||||
#-- binaries
|
#-- binaries
|
||||||
blenderinstall = []
|
blenderinstall = []
|
||||||
if env['OURPLATFORM']=='darwin':
|
if env['OURPLATFORM']=='darwin':
|
||||||
for prg in B.program_list:
|
for prg in B.program_list:
|
||||||
bundle = '%s.app' % prg[0]
|
bundle = '%s.app' % prg[0]
|
||||||
bundledir = os.path.dirname(bundle)
|
bundledir = os.path.dirname(bundle)
|
||||||
for dp, dn, df in os.walk(bundle):
|
for dp, dn, df in os.walk(bundle):
|
||||||
if 'CVS' in dn:
|
if 'CVS' in dn:
|
||||||
dn.remove('CVS')
|
dn.remove('CVS')
|
||||||
if '.svn' in dn:
|
if '.svn' in dn:
|
||||||
dn.remove('.svn')
|
dn.remove('.svn')
|
||||||
dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
|
dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
|
||||||
source=[dp+os.sep+f for f in df]
|
source=[dp+os.sep+f for f in df]
|
||||||
blenderinstall.append(env.Install(dir=dir,source=source))
|
blenderinstall.append(env.Install(dir=dir,source=source))
|
||||||
else:
|
else:
|
||||||
blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
|
blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
|
||||||
|
|
||||||
#-- .blender
|
#-- .blender
|
||||||
#- dont do .blender and scripts for darwin, it is already in the bundle
|
#- dont do .blender and scripts for darwin, it is already in the bundle
|
||||||
@ -416,30 +416,41 @@ dottargetlist = []
|
|||||||
scriptinstall = []
|
scriptinstall = []
|
||||||
|
|
||||||
if env['OURPLATFORM']!='darwin':
|
if env['OURPLATFORM']!='darwin':
|
||||||
for dp, dn, df in os.walk('bin/.blender'):
|
for dp, dn, df in os.walk('bin/.blender'):
|
||||||
if 'CVS' in dn:
|
if 'CVS' in dn:
|
||||||
dn.remove('CVS')
|
dn.remove('CVS')
|
||||||
if '.svn' in dn:
|
if '.svn' in dn:
|
||||||
dn.remove('.svn')
|
dn.remove('.svn')
|
||||||
for f in df:
|
|
||||||
dotblendlist.append(dp+os.sep+f)
|
for f in df:
|
||||||
dottargetlist.append(env['BF_INSTALLDIR']+dp[3:]+os.sep+f)
|
if not env['WITH_BF_INTERNATIONAL']:
|
||||||
|
if 'locale' in dp:
|
||||||
|
continue
|
||||||
|
if f == '.Blanguages':
|
||||||
|
continue
|
||||||
|
if not env['WITH_BF_FREETYPE']:
|
||||||
|
if f.endswith('.ttf'):
|
||||||
|
continue
|
||||||
|
|
||||||
|
dotblendlist.append(os.path.join(dp, f))
|
||||||
|
dottargetlist.append(env['BF_INSTALLDIR']+dp[3:]+os.sep+f)
|
||||||
|
|
||||||
dotblenderinstall = []
|
dotblenderinstall = []
|
||||||
for targetdir,srcfile in zip(dottargetlist, dotblendlist):
|
for targetdir,srcfile in zip(dottargetlist, dotblendlist):
|
||||||
td, tf = os.path.split(targetdir)
|
td, tf = os.path.split(targetdir)
|
||||||
dotblenderinstall.append(env.Install(dir=td, source=srcfile))
|
dotblenderinstall.append(env.Install(dir=td, source=srcfile))
|
||||||
|
|
||||||
#-- .blender/scripts
|
if env['WITH_BF_PYTHON']:
|
||||||
scriptpath='release/scripts'
|
#-- .blender/scripts
|
||||||
for dp, dn, df in os.walk(scriptpath):
|
scriptpath='release/scripts'
|
||||||
if 'CVS' in dn:
|
for dp, dn, df in os.walk(scriptpath):
|
||||||
dn.remove('CVS')
|
if 'CVS' in dn:
|
||||||
if '.svn' in dn:
|
dn.remove('CVS')
|
||||||
dn.remove('.svn')
|
if '.svn' in dn:
|
||||||
dir=env['BF_INSTALLDIR']+'/.blender/scripts'+dp[len(scriptpath):]
|
dn.remove('.svn')
|
||||||
source=[dp+os.sep+f for f in df]
|
dir=env['BF_INSTALLDIR']+'/.blender/scripts'+dp[len(scriptpath):]
|
||||||
scriptinstall.append(env.Install(dir=dir,source=source))
|
source=[dp+os.sep+f for f in df]
|
||||||
|
scriptinstall.append(env.Install(dir=dir,source=source))
|
||||||
|
|
||||||
#-- icons
|
#-- icons
|
||||||
if env['OURPLATFORM']=='linux2':
|
if env['OURPLATFORM']=='linux2':
|
||||||
@ -465,14 +476,14 @@ if env['OURPLATFORM']=='linux2':
|
|||||||
pluglist = []
|
pluglist = []
|
||||||
plugtargetlist = []
|
plugtargetlist = []
|
||||||
for tp, tn, tf in os.walk('release/plugins'):
|
for tp, tn, tf in os.walk('release/plugins'):
|
||||||
if 'CVS' in tn:
|
if 'CVS' in tn:
|
||||||
tn.remove('CVS')
|
tn.remove('CVS')
|
||||||
if '.svn' in tn:
|
if '.svn' in tn:
|
||||||
tn.remove('.svn')
|
tn.remove('.svn')
|
||||||
for f in tf:
|
for f in tf:
|
||||||
print ">>>", env['BF_INSTALLDIR'], tp, f
|
print ">>>", env['BF_INSTALLDIR'], tp, f
|
||||||
pluglist.append(tp+os.sep+f)
|
pluglist.append(tp+os.sep+f)
|
||||||
plugtargetlist.append(env['BF_INSTALLDIR']+tp[7:]+os.sep+f)
|
plugtargetlist.append(env['BF_INSTALLDIR']+tp[7:]+os.sep+f)
|
||||||
|
|
||||||
# header files for plugins
|
# header files for plugins
|
||||||
pluglist.append('source/blender/blenpluginapi/documentation.h')
|
pluglist.append('source/blender/blenpluginapi/documentation.h')
|
||||||
@ -492,59 +503,58 @@ plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'incl
|
|||||||
|
|
||||||
plugininstall = []
|
plugininstall = []
|
||||||
for targetdir,srcfile in zip(plugtargetlist, pluglist):
|
for targetdir,srcfile in zip(plugtargetlist, pluglist):
|
||||||
td, tf = os.path.split(targetdir)
|
td, tf = os.path.split(targetdir)
|
||||||
plugininstall.append(env.Install(dir=td, source=srcfile))
|
plugininstall.append(env.Install(dir=td, source=srcfile))
|
||||||
|
|
||||||
textlist = []
|
textlist = []
|
||||||
texttargetlist = []
|
texttargetlist = []
|
||||||
for tp, tn, tf in os.walk('release/text'):
|
for tp, tn, tf in os.walk('release/text'):
|
||||||
if 'CVS' in tn:
|
if 'CVS' in tn:
|
||||||
tn.remove('CVS')
|
tn.remove('CVS')
|
||||||
if '.svn' in tn:
|
if '.svn' in tn:
|
||||||
tn.remove('.svn')
|
tn.remove('.svn')
|
||||||
for f in tf:
|
for f in tf:
|
||||||
textlist.append(tp+os.sep+f)
|
textlist.append(tp+os.sep+f)
|
||||||
|
|
||||||
textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist)
|
textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist)
|
||||||
|
|
||||||
if env['OURPLATFORM']=='darwin':
|
if env['OURPLATFORM']=='darwin':
|
||||||
allinstall = [blenderinstall, plugininstall, textinstall]
|
allinstall = [blenderinstall, plugininstall, textinstall]
|
||||||
elif env['OURPLATFORM']=='linux2':
|
elif env['OURPLATFORM']=='linux2':
|
||||||
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall, iconinstall]
|
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall, iconinstall]
|
||||||
else:
|
else:
|
||||||
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
|
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
|
||||||
|
|
||||||
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
|
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
|
||||||
dllsources = ['${LCGDIR}/gettext/lib/gnu_gettext.dll',
|
dllsources = ['${LCGDIR}/gettext/lib/gnu_gettext.dll',
|
||||||
'${LCGDIR}/png/lib/libpng.dll',
|
'${BF_PNG_LIBPATH}/libpng.dll',
|
||||||
'#release/windows/extra/python25.zip',
|
'${BF_ZLIB_LIBPATH}/zlib.dll',
|
||||||
'#release/windows/extra/zlib.pyd',
|
'${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
|
||||||
'${LCGDIR}/sdl/lib/SDL.dll',
|
dllsources += ['${BF_PTHREADS_LIBPATH}/${BF_PTHREADS_LIB}.dll']
|
||||||
'${LCGDIR}/zlib/lib/zlib.dll',
|
if env['WITH_BF_SDL']:
|
||||||
'${LCGDIR}/tiff/lib/libtiff.dll']
|
dllsources.append('${BF_SDL_LIBPATH}/SDL.dll')
|
||||||
if env['BF_DEBUG']:
|
if env['WITH_BF_PYTHON']:
|
||||||
dllsources.append('${LCGDIR}/python/lib/${BF_PYTHON_LIB}_d.dll')
|
dllsources.append('#release/windows/extra/python25.zip')
|
||||||
else:
|
dllsources.append('#release/windows/extra/zlib.pyd')
|
||||||
dllsources.append('${LCGDIR}/python/lib/${BF_PYTHON_LIB}.dll')
|
if env['BF_DEBUG']:
|
||||||
if env['OURPLATFORM'] == 'win32-mingw':
|
dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_LIB}_d.dll')
|
||||||
dllsources += ['${LCGDIR}/pthreads/lib/pthreadGC2.dll']
|
else:
|
||||||
else:
|
dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_LIB}.dll')
|
||||||
dllsources += ['${LCGDIR}/pthreads/lib/pthreadVC2.dll']
|
if env['WITH_BF_ICONV']:
|
||||||
if env['WITH_BF_ICONV']:
|
dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll']
|
||||||
dllsources += ['${LCGDIR}/iconv/lib/iconv.dll']
|
if env['WITH_BF_FFMPEG']:
|
||||||
if env['WITH_BF_FFMPEG']:
|
dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-51.dll',
|
||||||
dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-51.dll',
|
'${LCGDIR}/ffmpeg/lib/avformat-52.dll',
|
||||||
'${LCGDIR}/ffmpeg/lib/avformat-52.dll',
|
'${LCGDIR}/ffmpeg/lib/avdevice-52.dll',
|
||||||
'${LCGDIR}/ffmpeg/lib/avdevice-52.dll',
|
'${LCGDIR}/ffmpeg/lib/avutil-49.dll',
|
||||||
'${LCGDIR}/ffmpeg/lib/avutil-49.dll',
|
'${LCGDIR}/ffmpeg/lib/libfaad-0.dll',
|
||||||
'${LCGDIR}/ffmpeg/lib/libfaad-0.dll',
|
'${LCGDIR}/ffmpeg/lib/libfaac-0.dll',
|
||||||
'${LCGDIR}/ffmpeg/lib/libfaac-0.dll',
|
'${LCGDIR}/ffmpeg/lib/libmp3lame-0.dll',
|
||||||
'${LCGDIR}/ffmpeg/lib/libmp3lame-0.dll',
|
'${LCGDIR}/ffmpeg/lib/libx264-59.dll',
|
||||||
'${LCGDIR}/ffmpeg/lib/libx264-59.dll',
|
'${LCGDIR}/ffmpeg/lib/xvidcore.dll',
|
||||||
'${LCGDIR}/ffmpeg/lib/xvidcore.dll',
|
'${LCGDIR}/ffmpeg/lib/swscale-0.dll']
|
||||||
'${LCGDIR}/ffmpeg/lib/swscale-0.dll']
|
windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
|
||||||
windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
|
allinstall += windlls
|
||||||
allinstall += windlls
|
|
||||||
|
|
||||||
installtarget = env.Alias('install', allinstall)
|
installtarget = env.Alias('install', allinstall)
|
||||||
bininstalltarget = env.Alias('install-bin', blenderinstall)
|
bininstalltarget = env.Alias('install-bin', blenderinstall)
|
||||||
@ -558,12 +568,12 @@ if 'blender' in B.targets:
|
|||||||
Depends(blenderexe,installtarget)
|
Depends(blenderexe,installtarget)
|
||||||
|
|
||||||
if env['WITH_BF_PLAYER']:
|
if env['WITH_BF_PLAYER']:
|
||||||
blenderplayer = env.Alias('blenderplayer', B.program_list)
|
blenderplayer = env.Alias('blenderplayer', B.program_list)
|
||||||
Depends(blenderplayer,installtarget)
|
Depends(blenderplayer,installtarget)
|
||||||
|
|
||||||
if not env['WITH_BF_GAMEENGINE']:
|
if not env['WITH_BF_GAMEENGINE']:
|
||||||
blendernogame = env.Alias('blendernogame', B.program_list)
|
blendernogame = env.Alias('blendernogame', B.program_list)
|
||||||
Depends(blendernogame,installtarget)
|
Depends(blendernogame,installtarget)
|
||||||
|
|
||||||
if 'blenderlite' in B.targets:
|
if 'blenderlite' in B.targets:
|
||||||
blenderlite = env.Alias('blenderlite', B.program_list)
|
blenderlite = env.Alias('blenderlite', B.program_list)
|
||||||
@ -574,7 +584,7 @@ Depends(nsiscmd, allinstall)
|
|||||||
Default(B.program_list)
|
Default(B.program_list)
|
||||||
|
|
||||||
if not env['WITHOUT_BF_INSTALL']:
|
if not env['WITHOUT_BF_INSTALL']:
|
||||||
Default(installtarget)
|
Default(installtarget)
|
||||||
|
|
||||||
#------------ RELEASE
|
#------------ RELEASE
|
||||||
# TODO: zipup the installation
|
# TODO: zipup the installation
|
||||||
@ -584,6 +594,6 @@ if not env['WITHOUT_BF_INSTALL']:
|
|||||||
|
|
||||||
#------------ EPYDOC
|
#------------ EPYDOC
|
||||||
if env['WITH_BF_DOCS']:
|
if env['WITH_BF_DOCS']:
|
||||||
SConscript('source/blender/python/api2_2x/doc/SConscript')
|
SConscript('source/blender/python/api2_2x/doc/SConscript')
|
||||||
SConscript('source/gameengine/PyDoc/SConscript')
|
SConscript('source/gameengine/PyDoc/SConscript')
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ BF_PYTHON_VERSION = '2.5'
|
|||||||
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
|
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
|
||||||
BF_PYTHON_BINARY = 'python'
|
BF_PYTHON_BINARY = 'python'
|
||||||
BF_PYTHON_LIB = 'python25'
|
BF_PYTHON_LIB = 'python25'
|
||||||
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
|
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/lib25_vs2005'
|
||||||
|
|
||||||
WITH_BF_OPENAL = True
|
WITH_BF_OPENAL = True
|
||||||
WITH_BF_STATICOPENAL = False
|
WITH_BF_STATICOPENAL = False
|
||||||
@ -64,6 +64,8 @@ BF_PNG_LIBPATH = '${BF_PNG}/lib'
|
|||||||
|
|
||||||
BF_TIFF = LIBDIR + '/tiff'
|
BF_TIFF = LIBDIR + '/tiff'
|
||||||
BF_TIFF_INC = '${BF_TIFF}/include'
|
BF_TIFF_INC = '${BF_TIFF}/include'
|
||||||
|
BF_TIFF_LIB = 'libtiff'
|
||||||
|
BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
|
||||||
|
|
||||||
WITH_BF_ZLIB = True
|
WITH_BF_ZLIB = True
|
||||||
BF_ZLIB = LIBDIR + '/zlib'
|
BF_ZLIB = LIBDIR + '/zlib'
|
||||||
|
@ -77,6 +77,8 @@ BF_PNG_LIBPATH = '${BF_PNG}/lib'
|
|||||||
|
|
||||||
BF_TIFF = LIBDIR + '/tiff'
|
BF_TIFF = LIBDIR + '/tiff'
|
||||||
BF_TIFF_INC = '${BF_TIFF}/include'
|
BF_TIFF_INC = '${BF_TIFF}/include'
|
||||||
|
BF_TIFF_LIB = 'libtiff'
|
||||||
|
BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
|
||||||
|
|
||||||
WITH_BF_ZLIB = True
|
WITH_BF_ZLIB = True
|
||||||
BF_ZLIB = LIBDIR + '/zlib'
|
BF_ZLIB = LIBDIR + '/zlib'
|
||||||
|
@ -12,7 +12,7 @@ if env['WITH_BF_OPENMP']:
|
|||||||
|
|
||||||
if env['OURPLATFORM']=='win32-vc':
|
if env['OURPLATFORM']=='win32-vc':
|
||||||
defs += ' USE_MSVC6FIXES'
|
defs += ' USE_MSVC6FIXES'
|
||||||
incs = env['BF_PNG_INC'] + ' ' + env['BF_ZLIB_INC'] + ' ' +env['BF_SDL_INC']
|
incs = env['BF_PNG_INC'] + ' ' + env['BF_ZLIB_INC']
|
||||||
incs += ' extern '
|
incs += ' extern '
|
||||||
|
|
||||||
env.BlenderLib ('bf_elbeem', sources, Split(incs), Split(defs), libtype='blender', priority=0 )
|
env.BlenderLib ('bf_elbeem', sources, Split(incs), Split(defs), libtype='blender', priority=0 )
|
||||||
|
@ -258,8 +258,16 @@ EndProject
|
|||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_bmfont", "..\..\intern\bmfont\make\msvc_9_0\bmfont.vcproj", "{E784098D-3ED8-433A-9353-9679415DDDC5}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_bmfont", "..\..\intern\bmfont\make\msvc_9_0\bmfont.vcproj", "{E784098D-3ED8-433A-9353-9679415DDDC5}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_boolop", "..\..\intern\boolop\make\msvc_9_0\boolop.vcproj", "{EB75F4D6-2970-4A3A-8D99-2BAD7201C0E9}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_boolop", "..\..\intern\boolop\make\msvc_9_0\boolop.vcproj", "{EB75F4D6-2970-4A3A-8D99-2BAD7201C0E9}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{4B6AFCC5-968C-424A-8F20-76E41B3BEF74} = {4B6AFCC5-968C-424A-8F20-76E41B3BEF74}
|
||||||
|
{E86B7BDE-C33C-4E55-9433-E74C141D7538} = {E86B7BDE-C33C-4E55-9433-E74C141D7538}
|
||||||
|
{1CC733F1-6AB5-4904-8F63-C08C46B79DD9} = {1CC733F1-6AB5-4904-8F63-C08C46B79DD9}
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_bsplib", "..\..\intern\bsp\make\msvc_9_0\bsplib.vcproj", "{B093415D-C0F6-4E76-8F5A-6BC1917BCE9E}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_bsplib", "..\..\intern\bsp\make\msvc_9_0\bsplib.vcproj", "{B093415D-C0F6-4E76-8F5A-6BC1917BCE9E}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{51A348C1-8684-4D67-B980-97B1FC74159B} = {51A348C1-8684-4D67-B980-97B1FC74159B}
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_container", "..\..\intern\container\make\msvc_9_0\container.vcproj", "{51A348C1-8684-4D67-B980-97B1FC74159B}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_container", "..\..\intern\container\make\msvc_9_0\container.vcproj", "{51A348C1-8684-4D67-B980-97B1FC74159B}"
|
||||||
EndProject
|
EndProject
|
||||||
@ -280,10 +288,17 @@ EndProject
|
|||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_MoTo", "..\..\intern\moto\make\msvc_9_0\moto.vcproj", "{4B6AFCC5-968C-424A-8F20-76E41B3BEF74}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_MoTo", "..\..\intern\moto\make\msvc_9_0\moto.vcproj", "{4B6AFCC5-968C-424A-8F20-76E41B3BEF74}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_OpenALSoundSystem", "..\..\intern\SoundSystem\make\msvc_9_0\openal\OpenALSoundSystem.vcproj", "{213356A9-3A1F-41DA-9819-1297BCD17DEE}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_OpenALSoundSystem", "..\..\intern\SoundSystem\make\msvc_9_0\openal\OpenALSoundSystem.vcproj", "{213356A9-3A1F-41DA-9819-1297BCD17DEE}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{98330220-47A6-42E0-9DE4-AD0FF5D204D6} = {98330220-47A6-42E0-9DE4-AD0FF5D204D6}
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_opennl", "..\..\intern\opennl\make\msvc_9_0\opennl.vcproj", "{8B8D4FC3-3234-4E54-8376-5AB83D00D164}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_opennl", "..\..\intern\opennl\make\msvc_9_0\opennl.vcproj", "{8B8D4FC3-3234-4E54-8376-5AB83D00D164}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_SoundSystem", "..\..\intern\SoundSystem\make\msvc_9_0\SoundSystem.vcproj", "{98330220-47A6-42E0-9DE4-AD0FF5D204D6}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_SoundSystem", "..\..\intern\SoundSystem\make\msvc_9_0\SoundSystem.vcproj", "{98330220-47A6-42E0-9DE4-AD0FF5D204D6}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{4B6AFCC5-968C-424A-8F20-76E41B3BEF74} = {4B6AFCC5-968C-424A-8F20-76E41B3BEF74}
|
||||||
|
{B789C2F3-279E-4A85-8F0A-7F7AC068E598} = {B789C2F3-279E-4A85-8F0A-7F7AC068E598}
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_string", "..\..\intern\string\make\msvc_9_0\string.vcproj", "{B789C2F3-279E-4A85-8F0A-7F7AC068E598}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "INT_string", "..\..\intern\string\make\msvc_9_0\string.vcproj", "{B789C2F3-279E-4A85-8F0A-7F7AC068E598}"
|
||||||
EndProject
|
EndProject
|
||||||
@ -693,9 +708,13 @@ Global
|
|||||||
{B093415D-C0F6-4E76-8F5A-6BC1917BCE9E}.BlenderPlayer Debug|Win32.ActiveCfg = Blender Debug|Win32
|
{B093415D-C0F6-4E76-8F5A-6BC1917BCE9E}.BlenderPlayer Debug|Win32.ActiveCfg = Blender Debug|Win32
|
||||||
{B093415D-C0F6-4E76-8F5A-6BC1917BCE9E}.BlenderPlayer Release|Win32.ActiveCfg = Blender Release|Win32
|
{B093415D-C0F6-4E76-8F5A-6BC1917BCE9E}.BlenderPlayer Release|Win32.ActiveCfg = Blender Release|Win32
|
||||||
{51A348C1-8684-4D67-B980-97B1FC74159B}.Blender Debug|Win32.ActiveCfg = Blender Debug|Win32
|
{51A348C1-8684-4D67-B980-97B1FC74159B}.Blender Debug|Win32.ActiveCfg = Blender Debug|Win32
|
||||||
|
{51A348C1-8684-4D67-B980-97B1FC74159B}.Blender Debug|Win32.Build.0 = Blender Debug|Win32
|
||||||
{51A348C1-8684-4D67-B980-97B1FC74159B}.Blender Release|Win32.ActiveCfg = Blender Release|Win32
|
{51A348C1-8684-4D67-B980-97B1FC74159B}.Blender Release|Win32.ActiveCfg = Blender Release|Win32
|
||||||
|
{51A348C1-8684-4D67-B980-97B1FC74159B}.Blender Release|Win32.Build.0 = Blender Release|Win32
|
||||||
{51A348C1-8684-4D67-B980-97B1FC74159B}.BlenderPlayer Debug|Win32.ActiveCfg = Blender Debug|Win32
|
{51A348C1-8684-4D67-B980-97B1FC74159B}.BlenderPlayer Debug|Win32.ActiveCfg = Blender Debug|Win32
|
||||||
|
{51A348C1-8684-4D67-B980-97B1FC74159B}.BlenderPlayer Debug|Win32.Build.0 = Blender Debug|Win32
|
||||||
{51A348C1-8684-4D67-B980-97B1FC74159B}.BlenderPlayer Release|Win32.ActiveCfg = Blender Release|Win32
|
{51A348C1-8684-4D67-B980-97B1FC74159B}.BlenderPlayer Release|Win32.ActiveCfg = Blender Release|Win32
|
||||||
|
{51A348C1-8684-4D67-B980-97B1FC74159B}.BlenderPlayer Release|Win32.Build.0 = Blender Release|Win32
|
||||||
{C66F722C-46BE-40C9-ABAE-2EAC7A697EB8}.Blender Debug|Win32.ActiveCfg = Blender Debug|Win32
|
{C66F722C-46BE-40C9-ABAE-2EAC7A697EB8}.Blender Debug|Win32.ActiveCfg = Blender Debug|Win32
|
||||||
{C66F722C-46BE-40C9-ABAE-2EAC7A697EB8}.Blender Debug|Win32.Build.0 = Blender Debug|Win32
|
{C66F722C-46BE-40C9-ABAE-2EAC7A697EB8}.Blender Debug|Win32.Build.0 = Blender Debug|Win32
|
||||||
{C66F722C-46BE-40C9-ABAE-2EAC7A697EB8}.Blender Release|Win32.ActiveCfg = Blender Release|Win32
|
{C66F722C-46BE-40C9-ABAE-2EAC7A697EB8}.Blender Release|Win32.ActiveCfg = Blender Release|Win32
|
||||||
|
@ -316,6 +316,10 @@
|
|||||||
RelativePath="..\..\..\source\blender\nodes\intern\SHD_util.c"
|
RelativePath="..\..\..\source\blender\nodes\intern\SHD_util.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_util.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<Filter
|
<Filter
|
||||||
Name="CMP_nodes"
|
Name="CMP_nodes"
|
||||||
>
|
>
|
||||||
@ -600,6 +604,70 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="TEX_nodes"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_bricks.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_checker.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_curves.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_hueSatVal.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_image.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_invert.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_math.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_mixRgb.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_output.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_proc.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_rotate.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_texture.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_translate.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_valToRgb.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_viewer.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Header Files"
|
Name="Header Files"
|
||||||
@ -614,6 +682,10 @@
|
|||||||
RelativePath="..\..\..\source\blender\nodes\SHD_node.h"
|
RelativePath="..\..\..\source\blender\nodes\SHD_node.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\TEX_node.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<Filter
|
<Filter
|
||||||
Name="intern"
|
Name="intern"
|
||||||
>
|
>
|
||||||
@ -629,6 +701,10 @@
|
|||||||
RelativePath="..\..\..\source\blender\nodes\intern\SHD_util.h"
|
RelativePath="..\..\..\source\blender\nodes\intern\SHD_util.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\source\blender\nodes\intern\TEX_util.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Files>
|
</Files>
|
||||||
|
@ -97,6 +97,7 @@ COMLIB += $(OCGDIR)/blender/blenloader/$(DEBUG_DIR)libblenloader.a
|
|||||||
COMLIB += $(OCGDIR)/blender/blenpluginapi/$(DEBUG_DIR)libblenpluginapi.a
|
COMLIB += $(OCGDIR)/blender/blenpluginapi/$(DEBUG_DIR)libblenpluginapi.a
|
||||||
COMLIB += $(OCGDIR)/blender/nodes_shd/$(DEBUG_DIR)libnodes_shd.a
|
COMLIB += $(OCGDIR)/blender/nodes_shd/$(DEBUG_DIR)libnodes_shd.a
|
||||||
COMLIB += $(OCGDIR)/blender/nodes_cmp/$(DEBUG_DIR)libnodes_cmp.a
|
COMLIB += $(OCGDIR)/blender/nodes_cmp/$(DEBUG_DIR)libnodes_cmp.a
|
||||||
|
COMLIB += $(OCGDIR)/blender/nodes_tex/$(DEBUG_DIR)libnodes_tex.a
|
||||||
COMLIB += $(OCGDIR)/blender/nodes/$(DEBUG_DIR)libnodes.a
|
COMLIB += $(OCGDIR)/blender/nodes/$(DEBUG_DIR)libnodes.a
|
||||||
COMLIB += $(OCGDIR)/blender/imbuf/$(DEBUG_DIR)libimbuf.a
|
COMLIB += $(OCGDIR)/blender/imbuf/$(DEBUG_DIR)libimbuf.a
|
||||||
COMLIB += $(OCGDIR)/blender/blenlib/$(DEBUG_DIR)libblenlib.a
|
COMLIB += $(OCGDIR)/blender/blenlib/$(DEBUG_DIR)libblenlib.a
|
||||||
|
@ -230,5 +230,12 @@ void PE_free_particle_edit(struct ParticleSystem *psys);
|
|||||||
void PE_get_colors(char sel[4], char nosel[4]);
|
void PE_get_colors(char sel[4], char nosel[4]);
|
||||||
void PE_recalc_world_cos(struct Object *ob, struct ParticleSystem *psys);
|
void PE_recalc_world_cos(struct Object *ob, struct ParticleSystem *psys);
|
||||||
|
|
||||||
|
/* texture.c */
|
||||||
|
struct Tex;
|
||||||
|
struct TexResult;
|
||||||
|
int multitex_thread(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres, short thread, short which_output);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ struct rctf;
|
|||||||
struct ListBase;
|
struct ListBase;
|
||||||
struct RenderData;
|
struct RenderData;
|
||||||
struct Scene;
|
struct Scene;
|
||||||
|
struct Tex;
|
||||||
struct GPUMaterial;
|
struct GPUMaterial;
|
||||||
struct GPUNode;
|
struct GPUNode;
|
||||||
struct GPUNodeStack;
|
struct GPUNodeStack;
|
||||||
@ -118,6 +119,8 @@ typedef struct bNodeType {
|
|||||||
#define NODE_CLASS_MATTE 9
|
#define NODE_CLASS_MATTE 9
|
||||||
#define NODE_CLASS_DISTORT 10
|
#define NODE_CLASS_DISTORT 10
|
||||||
#define NODE_CLASS_OP_DYNAMIC 11
|
#define NODE_CLASS_OP_DYNAMIC 11
|
||||||
|
#define NODE_CLASS_PATTERN 12
|
||||||
|
#define NODE_CLASS_TEXTURE 13
|
||||||
|
|
||||||
/* ************** GENERIC API, TREES *************** */
|
/* ************** GENERIC API, TREES *************** */
|
||||||
|
|
||||||
@ -377,6 +380,45 @@ void ntreeCompositForceHidden(struct bNodeTree *ntree);
|
|||||||
|
|
||||||
void free_compbuf(struct CompBuf *cbuf); /* internal...*/
|
void free_compbuf(struct CompBuf *cbuf); /* internal...*/
|
||||||
|
|
||||||
|
|
||||||
|
/* ************** TEXTURE NODES *************** */
|
||||||
|
|
||||||
|
struct TexResult;
|
||||||
|
|
||||||
|
#define TEX_NODE_OUTPUT 101
|
||||||
|
#define TEX_NODE_CHECKER 102
|
||||||
|
#define TEX_NODE_TEXTURE 103
|
||||||
|
#define TEX_NODE_BRICKS 104
|
||||||
|
#define TEX_NODE_MATH 105
|
||||||
|
#define TEX_NODE_MIX_RGB 106
|
||||||
|
#define TEX_NODE_RGBTOBW 107
|
||||||
|
#define TEX_NODE_VALTORGB 108
|
||||||
|
#define TEX_NODE_IMAGE 109
|
||||||
|
#define TEX_NODE_CURVE_RGB 110
|
||||||
|
#define TEX_NODE_INVERT 111
|
||||||
|
#define TEX_NODE_HUE_SAT 112
|
||||||
|
#define TEX_NODE_CURVE_TIME 113
|
||||||
|
#define TEX_NODE_ROTATE 114
|
||||||
|
#define TEX_NODE_VIEWER 115
|
||||||
|
#define TEX_NODE_TRANSLATE 116
|
||||||
|
|
||||||
|
/* 201-299 reserved. Use like this: TEX_NODE_PROC + TEX_CLOUDS, etc */
|
||||||
|
#define TEX_NODE_PROC 200
|
||||||
|
#define TEX_NODE_PROC_MAX 300
|
||||||
|
|
||||||
|
extern struct ListBase node_all_textures;
|
||||||
|
|
||||||
|
/* API */
|
||||||
|
int ntreeTexTagAnimated(struct bNodeTree *ntree);
|
||||||
|
void ntreeTexUpdatePreviews( struct bNodeTree* nodetree );
|
||||||
|
void ntreeTexExecTree(struct bNodeTree *ntree, struct TexResult *target, float *coord, char do_preview, short thread, struct Tex *tex, short which_output);
|
||||||
|
void ntreeTexCheckCyclics(struct bNodeTree *ntree);
|
||||||
|
void ntreeTexAssignIndex(struct bNodeTree *ntree, struct bNode *node);
|
||||||
|
char* ntreeTexOutputMenu(struct bNodeTree *ntree);
|
||||||
|
|
||||||
|
|
||||||
|
/**/
|
||||||
|
|
||||||
void init_nodesystem(void);
|
void init_nodesystem(void);
|
||||||
void free_nodesystem(void);
|
void free_nodesystem(void);
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ sources = env.Glob('intern/*.c')
|
|||||||
incs = '. #/intern/guardedalloc ../include ../blenlib ../makesdna'
|
incs = '. #/intern/guardedalloc ../include ../blenlib ../makesdna'
|
||||||
incs += ' ../render/extern/include #/intern/decimation/extern'
|
incs += ' ../render/extern/include #/intern/decimation/extern'
|
||||||
incs += ' ../imbuf ../avi #/intern/elbeem/extern ../nodes'
|
incs += ' ../imbuf ../avi #/intern/elbeem/extern ../nodes'
|
||||||
incs += ' #/intern/iksolver/extern ../blenloader ../quicktime'
|
incs += ' #/intern/iksolver/extern ../blenloader'
|
||||||
incs += ' #/extern/bullet2/src'
|
incs += ' #/extern/bullet2/src'
|
||||||
incs += ' #/intern/bmfont'
|
incs += ' #/intern/bmfont'
|
||||||
incs += ' #/intern/opennl/extern'
|
incs += ' #/intern/opennl/extern'
|
||||||
@ -14,7 +14,6 @@ incs += ' ../gpu #/extern/glew/include'
|
|||||||
|
|
||||||
incs += ' ' + env['BF_OPENGL_INC']
|
incs += ' ' + env['BF_OPENGL_INC']
|
||||||
incs += ' ' + env['BF_ZLIB_INC']
|
incs += ' ' + env['BF_ZLIB_INC']
|
||||||
incs += ' ' + env['BF_SDL_INC']
|
|
||||||
|
|
||||||
defs = ''
|
defs = ''
|
||||||
|
|
||||||
@ -24,6 +23,12 @@ else:
|
|||||||
incs += ' ../python'
|
incs += ' ../python'
|
||||||
incs += ' ' + env['BF_PYTHON_INC']
|
incs += ' ' + env['BF_PYTHON_INC']
|
||||||
|
|
||||||
|
if env['WITH_BF_QUICKTIME']:
|
||||||
|
incs += ' ../quicktime'
|
||||||
|
|
||||||
|
if env['WITH_BF_SDL']:
|
||||||
|
incs += ' ' + env['BF_SDL_INC']
|
||||||
|
|
||||||
if env['WITH_BF_INTERNATIONAL']:
|
if env['WITH_BF_INTERNATIONAL']:
|
||||||
defs += ' WITH_FREETYPE2'
|
defs += ' WITH_FREETYPE2'
|
||||||
|
|
||||||
|
@ -347,3 +347,6 @@ void txt_copy_clipboard (struct Text *text){}
|
|||||||
|
|
||||||
char stipple_quarttone[1];
|
char stipple_quarttone[1];
|
||||||
|
|
||||||
|
/* texture.c */
|
||||||
|
int multitex_thread(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres, short thread, short which_output) {return 0;}
|
||||||
|
|
||||||
|
@ -597,6 +597,8 @@ static void get_flags_for_id(ID *id, char *buf)
|
|||||||
|
|
||||||
if(GS(id->name)==ID_MA)
|
if(GS(id->name)==ID_MA)
|
||||||
isnode= ((Material *)id)->use_nodes;
|
isnode= ((Material *)id)->use_nodes;
|
||||||
|
if(GS(id->name)==ID_TE)
|
||||||
|
isnode= ((Tex *)id)->use_nodes;
|
||||||
|
|
||||||
if (id->us<0)
|
if (id->us<0)
|
||||||
sprintf(buf, "-1W ");
|
sprintf(buf, "-1W ");
|
||||||
|
@ -650,7 +650,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
|
|||||||
if(ma->septex & (1<<a)) continue;
|
if(ma->septex & (1<<a)) continue;
|
||||||
|
|
||||||
mtex= ma->mtex[a];
|
mtex= ma->mtex[a];
|
||||||
if(mtex && mtex->tex && mtex->tex->type) {
|
if(mtex && mtex->tex && (mtex->tex->type | (mtex->tex->use_nodes && mtex->tex->nodetree) )) {
|
||||||
|
|
||||||
ma->texco |= mtex->texco;
|
ma->texco |= mtex->texco;
|
||||||
ma->mapto |= mtex->mapto;
|
ma->mapto |= mtex->mapto;
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "DNA_image_types.h"
|
#include "DNA_image_types.h"
|
||||||
#include "DNA_node_types.h"
|
#include "DNA_node_types.h"
|
||||||
#include "DNA_material_types.h"
|
#include "DNA_material_types.h"
|
||||||
|
#include "DNA_texture_types.h"
|
||||||
#include "DNA_text_types.h"
|
#include "DNA_text_types.h"
|
||||||
#include "DNA_scene_types.h"
|
#include "DNA_scene_types.h"
|
||||||
|
|
||||||
@ -70,6 +71,8 @@
|
|||||||
#include "intern/CMP_util.h" /* stupid include path... */
|
#include "intern/CMP_util.h" /* stupid include path... */
|
||||||
|
|
||||||
#include "SHD_node.h"
|
#include "SHD_node.h"
|
||||||
|
#include "TEX_node.h"
|
||||||
|
#include "intern/TEX_util.h"
|
||||||
|
|
||||||
#include "GPU_extensions.h"
|
#include "GPU_extensions.h"
|
||||||
#include "GPU_material.h"
|
#include "GPU_material.h"
|
||||||
@ -77,6 +80,7 @@
|
|||||||
static ListBase empty_list = {NULL, NULL};
|
static ListBase empty_list = {NULL, NULL};
|
||||||
ListBase node_all_composit = {NULL, NULL};
|
ListBase node_all_composit = {NULL, NULL};
|
||||||
ListBase node_all_shaders = {NULL, NULL};
|
ListBase node_all_shaders = {NULL, NULL};
|
||||||
|
ListBase node_all_textures = {NULL, NULL};
|
||||||
|
|
||||||
/* ************** Type stuff ********** */
|
/* ************** Type stuff ********** */
|
||||||
|
|
||||||
@ -106,6 +110,8 @@ void ntreeInitTypes(bNodeTree *ntree)
|
|||||||
ntree->alltypes= node_all_shaders;
|
ntree->alltypes= node_all_shaders;
|
||||||
else if(ntree->type==NTREE_COMPOSIT)
|
else if(ntree->type==NTREE_COMPOSIT)
|
||||||
ntree->alltypes= node_all_composit;
|
ntree->alltypes= node_all_composit;
|
||||||
|
else if(ntree->type==NTREE_TEXTURE)
|
||||||
|
ntree->alltypes= node_all_textures;
|
||||||
else {
|
else {
|
||||||
ntree->alltypes= empty_list;
|
ntree->alltypes= empty_list;
|
||||||
printf("Error: no type definitions for nodes\n");
|
printf("Error: no type definitions for nodes\n");
|
||||||
@ -661,6 +667,28 @@ void nodeVerifyGroup(bNodeTree *ngroup)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(ngroup->type==NTREE_TEXTURE) {
|
||||||
|
Tex *tx;
|
||||||
|
for(tx= G.main->tex.first; tx; tx= tx->id.next) {
|
||||||
|
if(tx->nodetree) {
|
||||||
|
bNode *node;
|
||||||
|
|
||||||
|
/* find if group is in tree */
|
||||||
|
for(node= tx->nodetree->nodes.first; node; node= node->next)
|
||||||
|
if(node->id == (ID *)ngroup)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if(node) {
|
||||||
|
/* set all type pointers OK */
|
||||||
|
ntreeInitTypes(tx->nodetree);
|
||||||
|
|
||||||
|
for(node= tx->nodetree->nodes.first; node; node= node->next)
|
||||||
|
if(node->id == (ID *)ngroup)
|
||||||
|
nodeVerifyType(tx->nodetree, node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* also to check all users of groups. Now only used in editor for hide/unhide */
|
/* also to check all users of groups. Now only used in editor for hide/unhide */
|
||||||
@ -717,6 +745,26 @@ void nodeGroupSocketUseFlags(bNodeTree *ngroup)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(ngroup->type==NTREE_TEXTURE) {
|
||||||
|
Tex *tx;
|
||||||
|
for(tx= G.main->tex.first; tx; tx= tx->id.next) {
|
||||||
|
if(tx->nodetree) {
|
||||||
|
for(node= tx->nodetree->nodes.first; node; node= node->next) {
|
||||||
|
if(node->id==(ID *)ngroup) {
|
||||||
|
for(sock= node->inputs.first; sock; sock= sock->next)
|
||||||
|
if(sock->link)
|
||||||
|
if(sock->tosock)
|
||||||
|
sock->tosock->flag |= SOCK_IN_USE;
|
||||||
|
for(sock= node->outputs.first; sock; sock= sock->next)
|
||||||
|
if(nodeCountSocketLinks(tx->nodetree, sock))
|
||||||
|
if(sock->tosock)
|
||||||
|
sock->tosock->flag |= SOCK_IN_USE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* finds a node based on given socket */
|
/* finds a node based on given socket */
|
||||||
@ -901,9 +949,12 @@ bNode *nodeAddNodeType(bNodeTree *ntree, int type, bNodeTree *ngroup, ID *id)
|
|||||||
/* got it-bob*/
|
/* got it-bob*/
|
||||||
if(ntype->initfunc!=NULL)
|
if(ntype->initfunc!=NULL)
|
||||||
ntype->initfunc(node);
|
ntype->initfunc(node);
|
||||||
|
|
||||||
|
if(type==TEX_NODE_OUTPUT)
|
||||||
|
ntreeTexAssignIndex(ntree, node);
|
||||||
|
|
||||||
nodeAddSockets(node, ntype);
|
nodeAddSockets(node, ntype);
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -970,6 +1021,9 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node, int internal)
|
|||||||
node->new_node= nnode;
|
node->new_node= nnode;
|
||||||
nnode->new_node= NULL;
|
nnode->new_node= NULL;
|
||||||
nnode->preview= NULL;
|
nnode->preview= NULL;
|
||||||
|
|
||||||
|
if(node->type==TEX_NODE_OUTPUT)
|
||||||
|
ntreeTexAssignIndex(ntree, node);
|
||||||
|
|
||||||
return nnode;
|
return nnode;
|
||||||
}
|
}
|
||||||
@ -1260,6 +1314,22 @@ void ntreeMakeLocal(bNodeTree *ntree)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(ntree->type==NTREE_TEXTURE) {
|
||||||
|
Tex *tx;
|
||||||
|
for(tx= G.main->tex.first; tx; tx= tx->id.next) {
|
||||||
|
if(tx->nodetree) {
|
||||||
|
bNode *node;
|
||||||
|
|
||||||
|
/* find if group is in tree */
|
||||||
|
for(node= tx->nodetree->nodes.first; node; node= node->next) {
|
||||||
|
if(node->id == (ID *)ntree) {
|
||||||
|
if(tx->id.lib) lib= 1;
|
||||||
|
else local= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* if all users are local, we simply make tree local */
|
/* if all users are local, we simply make tree local */
|
||||||
if(local && lib==0) {
|
if(local && lib==0) {
|
||||||
@ -1311,6 +1381,25 @@ void ntreeMakeLocal(bNodeTree *ntree)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(ntree->type==NTREE_TEXTURE) {
|
||||||
|
Tex *tx;
|
||||||
|
for(tx= G.main->tex.first; tx; tx= tx->id.next) {
|
||||||
|
if(tx->nodetree) {
|
||||||
|
bNode *node;
|
||||||
|
|
||||||
|
/* find if group is in tree */
|
||||||
|
for(node= tx->nodetree->nodes.first; node; node= node->next) {
|
||||||
|
if(node->id == (ID *)ntree) {
|
||||||
|
if(tx->id.lib==NULL) {
|
||||||
|
node->id= &newtree->id;
|
||||||
|
newtree->id.us++;
|
||||||
|
ntree->id.us--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1575,6 +1664,8 @@ void NodeTagChanged(bNodeTree *ntree, bNode *node)
|
|||||||
}
|
}
|
||||||
node->need_exec= 1;
|
node->need_exec= 1;
|
||||||
}
|
}
|
||||||
|
else if(ntree->type == NTREE_TEXTURE)
|
||||||
|
ntreeTexUpdatePreviews(ntree);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeTagIDChanged(bNodeTree *ntree, ID *id)
|
void NodeTagIDChanged(bNodeTree *ntree, ID *id)
|
||||||
@ -1813,7 +1904,7 @@ static void composit_begin_exec(bNodeTree *ntree, int is_group)
|
|||||||
sock->ns.data= NULL;
|
sock->ns.data= NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* cannot initialize them while using in threads */
|
/* cannot initialize them while using in threads */
|
||||||
if(ELEM3(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB)) {
|
if(ELEM3(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB)) {
|
||||||
curvemapping_initialize(node->storage);
|
curvemapping_initialize(node->storage);
|
||||||
@ -1929,12 +2020,28 @@ static void ntreeReleaseThreadStack(bNodeThreadStack *nts)
|
|||||||
nts->used= 0;
|
nts->used= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* free texture delegates */
|
||||||
|
static void tex_end_exec(bNodeTree *ntree)
|
||||||
|
{
|
||||||
|
bNodeThreadStack *nts;
|
||||||
|
bNodeStack *ns;
|
||||||
|
int th, a;
|
||||||
|
|
||||||
|
if(ntree->threadstack)
|
||||||
|
for(th=0; th<BLENDER_MAX_THREADS; th++)
|
||||||
|
for(nts=ntree->threadstack[th].first; nts; nts=nts->next)
|
||||||
|
for(ns= nts->stack, a=0; a<ntree->stacksize; a++, ns++)
|
||||||
|
if(ns->data)
|
||||||
|
MEM_freeN(ns->data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void ntreeBeginExecTree(bNodeTree *ntree)
|
void ntreeBeginExecTree(bNodeTree *ntree)
|
||||||
{
|
{
|
||||||
/* let's make it sure */
|
/* let's make it sure */
|
||||||
if(ntree->init & NTREE_EXEC_INIT)
|
if(ntree->init & NTREE_EXEC_INIT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* allocate the thread stack listbase array */
|
/* allocate the thread stack listbase array */
|
||||||
if(ntree->type!=NTREE_COMPOSIT)
|
if(ntree->type!=NTREE_COMPOSIT)
|
||||||
ntree->threadstack= MEM_callocN(BLENDER_MAX_THREADS*sizeof(ListBase), "thread stack array");
|
ntree->threadstack= MEM_callocN(BLENDER_MAX_THREADS*sizeof(ListBase), "thread stack array");
|
||||||
@ -1986,6 +2093,8 @@ void ntreeEndExecTree(bNodeTree *ntree)
|
|||||||
/* another callback candidate! */
|
/* another callback candidate! */
|
||||||
if(ntree->type==NTREE_COMPOSIT)
|
if(ntree->type==NTREE_COMPOSIT)
|
||||||
composit_end_exec(ntree, 0);
|
composit_end_exec(ntree, 0);
|
||||||
|
else if(ntree->type==NTREE_TEXTURE)
|
||||||
|
tex_end_exec(ntree);
|
||||||
|
|
||||||
if(ntree->stack) {
|
if(ntree->stack) {
|
||||||
MEM_freeN(ntree->stack);
|
MEM_freeN(ntree->stack);
|
||||||
@ -2622,6 +2731,27 @@ void ntreeCompositTagGenerators(bNodeTree *ntree)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ntreeTexTagAnimated(bNodeTree *ntree)
|
||||||
|
{
|
||||||
|
bNode *node;
|
||||||
|
|
||||||
|
if(ntree==NULL) return 0;
|
||||||
|
|
||||||
|
for(node= ntree->nodes.first; node; node= node->next) {
|
||||||
|
if(node->type==TEX_NODE_CURVE_TIME) {
|
||||||
|
NodeTagChanged(ntree, node);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else if(node->type==NODE_GROUP) {
|
||||||
|
if( ntreeTexTagAnimated((bNodeTree *)node->id) ) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* ************* node definition init ********** */
|
/* ************* node definition init ********** */
|
||||||
|
|
||||||
static bNodeType *is_nodetype_registered(ListBase *typelist, int type, ID *id)
|
static bNodeType *is_nodetype_registered(ListBase *typelist, int type, ID *id)
|
||||||
@ -2745,6 +2875,41 @@ static void registerShaderNodes(ListBase *ntypelist)
|
|||||||
nodeRegisterType(ntypelist, &sh_node_hue_sat);
|
nodeRegisterType(ntypelist, &sh_node_hue_sat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void registerTextureNodes(ListBase *ntypelist)
|
||||||
|
{
|
||||||
|
nodeRegisterType(ntypelist, &node_group_typeinfo);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_math);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_mix_rgb);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_valtorgb);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_rgbtobw);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_curve_rgb);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_curve_time);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_invert);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_hue_sat);
|
||||||
|
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_output);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_viewer);
|
||||||
|
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_checker);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_texture);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_bricks);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_image);
|
||||||
|
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_rotate);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_translate);
|
||||||
|
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_proc_voronoi);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_proc_blend);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_proc_magic);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_proc_marble);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_proc_clouds);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_proc_wood);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_proc_musgrave);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_proc_noise);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_proc_stucci);
|
||||||
|
nodeRegisterType(ntypelist, &tex_node_proc_distnoise);
|
||||||
|
}
|
||||||
|
|
||||||
static void remove_dynamic_typeinfos(ListBase *list)
|
static void remove_dynamic_typeinfos(ListBase *list)
|
||||||
{
|
{
|
||||||
bNodeType *ntype= list->first;
|
bNodeType *ntype= list->first;
|
||||||
@ -2782,6 +2947,7 @@ void init_nodesystem(void)
|
|||||||
{
|
{
|
||||||
registerCompositNodes(&node_all_composit);
|
registerCompositNodes(&node_all_composit);
|
||||||
registerShaderNodes(&node_all_shaders);
|
registerShaderNodes(&node_all_shaders);
|
||||||
|
registerTextureNodes(&node_all_textures);
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_nodesystem(void)
|
void free_nodesystem(void)
|
||||||
@ -2790,4 +2956,5 @@ void free_nodesystem(void)
|
|||||||
BLI_freelistN(&node_all_composit);
|
BLI_freelistN(&node_all_composit);
|
||||||
remove_dynamic_typeinfos(&node_all_shaders);
|
remove_dynamic_typeinfos(&node_all_shaders);
|
||||||
BLI_freelistN(&node_all_shaders);
|
BLI_freelistN(&node_all_shaders);
|
||||||
|
BLI_freelistN(&node_all_textures);
|
||||||
}
|
}
|
||||||
|
@ -421,6 +421,11 @@ void free_texture(Tex *tex)
|
|||||||
BKE_previewimg_free(&tex->preview);
|
BKE_previewimg_free(&tex->preview);
|
||||||
BKE_icon_delete((struct ID*)tex);
|
BKE_icon_delete((struct ID*)tex);
|
||||||
tex->id.icon_id = 0;
|
tex->id.icon_id = 0;
|
||||||
|
|
||||||
|
if(tex->nodetree) {
|
||||||
|
ntreeFreeTree(tex->nodetree);
|
||||||
|
MEM_freeN(tex->nodetree);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
@ -578,6 +583,11 @@ Tex *copy_texture(Tex *tex)
|
|||||||
|
|
||||||
if(tex->preview) texn->preview = BKE_previewimg_copy(tex->preview);
|
if(tex->preview) texn->preview = BKE_previewimg_copy(tex->preview);
|
||||||
|
|
||||||
|
if(tex->nodetree) {
|
||||||
|
ntreeEndExecTree(tex->nodetree);
|
||||||
|
texn->nodetree= ntreeCopyTree(tex->nodetree, 0); /* 0 == full new tree */
|
||||||
|
}
|
||||||
|
|
||||||
return texn;
|
return texn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -728,6 +738,10 @@ void autotexname(Tex *tex)
|
|||||||
char di[FILE_MAXDIR], fi[FILE_MAXFILE];
|
char di[FILE_MAXDIR], fi[FILE_MAXFILE];
|
||||||
|
|
||||||
if(tex) {
|
if(tex) {
|
||||||
|
if(tex->use_nodes) {
|
||||||
|
new_id(&G.main->tex, (ID *)tex, "Noddy");
|
||||||
|
}
|
||||||
|
else
|
||||||
if(tex->type==TEX_IMAGE) {
|
if(tex->type==TEX_IMAGE) {
|
||||||
ima= tex->ima;
|
ima= tex->ima;
|
||||||
if(ima) {
|
if(ima) {
|
||||||
|
@ -45,6 +45,7 @@ typedef struct LinkNode {
|
|||||||
} LinkNode;
|
} LinkNode;
|
||||||
|
|
||||||
int BLI_linklist_length (struct LinkNode *list);
|
int BLI_linklist_length (struct LinkNode *list);
|
||||||
|
int BLI_linklist_index (struct LinkNode *list, void *ptr);
|
||||||
|
|
||||||
void BLI_linklist_reverse (struct LinkNode **listp);
|
void BLI_linklist_reverse (struct LinkNode **listp);
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ typedef struct MemArena MemArena;
|
|||||||
struct MemArena* BLI_memarena_new (int bufsize);
|
struct MemArena* BLI_memarena_new (int bufsize);
|
||||||
void BLI_memarena_free (struct MemArena *ma);
|
void BLI_memarena_free (struct MemArena *ma);
|
||||||
|
|
||||||
|
void BLI_memarena_use_malloc (struct MemArena *ma);
|
||||||
void BLI_memarena_use_calloc (struct MemArena *ma);
|
void BLI_memarena_use_calloc (struct MemArena *ma);
|
||||||
|
|
||||||
void* BLI_memarena_alloc (struct MemArena *ma, int size);
|
void* BLI_memarena_alloc (struct MemArena *ma, int size);
|
||||||
|
@ -7,9 +7,11 @@ cflags=''
|
|||||||
incs = '. ../makesdna ../blenkernel #/intern/guardedalloc ../include'
|
incs = '. ../makesdna ../blenkernel #/intern/guardedalloc ../include'
|
||||||
incs += ' ' + env['BF_FREETYPE_INC']
|
incs += ' ' + env['BF_FREETYPE_INC']
|
||||||
incs += ' ' + env['BF_ZLIB_INC']
|
incs += ' ' + env['BF_ZLIB_INC']
|
||||||
incs += ' ' + env['BF_SDL_INC']
|
|
||||||
defs = ''
|
defs = ''
|
||||||
|
|
||||||
|
if env['WITH_BF_SDL']:
|
||||||
|
incs += ' ' + env['BF_SDL_INC']
|
||||||
|
|
||||||
if env['WITH_BF_INTERNATIONAL']:
|
if env['WITH_BF_INTERNATIONAL']:
|
||||||
defs = 'WITH_FREETYPE2'
|
defs = 'WITH_FREETYPE2'
|
||||||
|
|
||||||
|
@ -50,6 +50,18 @@ int BLI_linklist_length(LinkNode *list) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int BLI_linklist_index(struct LinkNode *list, void *ptr)
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
for (index = 0; list; list= list->next, index++) {
|
||||||
|
if (list->link == ptr)
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void BLI_linklist_reverse(LinkNode **listp) {
|
void BLI_linklist_reverse(LinkNode **listp) {
|
||||||
LinkNode *rhead= NULL, *cur= *listp;
|
LinkNode *rhead= NULL, *cur= *listp;
|
||||||
|
|
||||||
|
@ -60,6 +60,10 @@ void BLI_memarena_use_calloc(MemArena *ma) {
|
|||||||
ma->use_calloc= 1;
|
ma->use_calloc= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BLI_memarena_use_malloc(MemArena *ma) {
|
||||||
|
ma->use_calloc= 0;
|
||||||
|
}
|
||||||
|
|
||||||
void BLI_memarena_free(MemArena *ma) {
|
void BLI_memarena_free(MemArena *ma) {
|
||||||
BLI_linklist_free(ma->bufs, (void(*)(void*)) MEM_freeN);
|
BLI_linklist_free(ma->bufs, (void(*)(void*)) MEM_freeN);
|
||||||
MEM_freeN(ma);
|
MEM_freeN(ma);
|
||||||
|
@ -5,7 +5,6 @@ sources = env.Glob('intern/*.c')
|
|||||||
|
|
||||||
incs = '. #/intern/guardedalloc ../blenlib ../blenkernel'
|
incs = '. #/intern/guardedalloc ../blenlib ../blenkernel'
|
||||||
incs += ' ../makesdna ../readblenfile ../include'
|
incs += ' ../makesdna ../readblenfile ../include'
|
||||||
incs += ' ../python ../../kernel/gen_messaging'
|
|
||||||
incs += ' ../render/extern/include'
|
incs += ' ../render/extern/include'
|
||||||
|
|
||||||
incs += ' ' + env['BF_ZLIB_INC']
|
incs += ' ' + env['BF_ZLIB_INC']
|
||||||
|
@ -1524,6 +1524,7 @@ static void lib_verify_nodetree(Main *main, int open)
|
|||||||
{
|
{
|
||||||
Scene *sce;
|
Scene *sce;
|
||||||
Material *ma;
|
Material *ma;
|
||||||
|
Tex *tx;
|
||||||
bNodeTree *ntree;
|
bNodeTree *ntree;
|
||||||
|
|
||||||
/* this crashes blender on undo/redo
|
/* this crashes blender on undo/redo
|
||||||
@ -1548,6 +1549,11 @@ static void lib_verify_nodetree(Main *main, int open)
|
|||||||
if(sce->nodetree)
|
if(sce->nodetree)
|
||||||
ntreeVerifyTypes(sce->nodetree);
|
ntreeVerifyTypes(sce->nodetree);
|
||||||
}
|
}
|
||||||
|
/* and texture trees */
|
||||||
|
for(tx= main->tex.first; tx; tx= tx->id.next) {
|
||||||
|
if(tx->nodetree)
|
||||||
|
ntreeVerifyTypes(tx->nodetree);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1584,6 +1590,9 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
|
|||||||
else if(ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
|
else if(ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
|
||||||
((ImageUser *)node->storage)->ok= 1;
|
((ImageUser *)node->storage)->ok= 1;
|
||||||
}
|
}
|
||||||
|
else if( ntree->type==NTREE_TEXTURE && (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME) ) {
|
||||||
|
direct_link_curvemapping(fd, node->storage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
link_list(fd, &node->inputs);
|
link_list(fd, &node->inputs);
|
||||||
link_list(fd, &node->outputs);
|
link_list(fd, &node->outputs);
|
||||||
@ -2490,6 +2499,9 @@ static void lib_link_texture(FileData *fd, Main *main)
|
|||||||
tex->ipo= newlibadr_us(fd, tex->id.lib, tex->ipo);
|
tex->ipo= newlibadr_us(fd, tex->id.lib, tex->ipo);
|
||||||
if(tex->env) tex->env->object= newlibadr(fd, tex->id.lib, tex->env->object);
|
if(tex->env) tex->env->object= newlibadr(fd, tex->id.lib, tex->env->object);
|
||||||
|
|
||||||
|
if(tex->nodetree)
|
||||||
|
lib_link_ntree(fd, &tex->id, tex->nodetree);
|
||||||
|
|
||||||
tex->id.flag -= LIB_NEEDLINK;
|
tex->id.flag -= LIB_NEEDLINK;
|
||||||
}
|
}
|
||||||
tex= tex->id.next;
|
tex= tex->id.next;
|
||||||
@ -2515,6 +2527,11 @@ static void direct_link_texture(FileData *fd, Tex *tex)
|
|||||||
memset(tex->env->cube, 0, 6*sizeof(void *));
|
memset(tex->env->cube, 0, 6*sizeof(void *));
|
||||||
tex->env->ok= 0;
|
tex->env->ok= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tex->nodetree= newdataadr(fd, tex->nodetree);
|
||||||
|
if(tex->nodetree)
|
||||||
|
direct_link_nodetree(fd, tex->nodetree);
|
||||||
|
|
||||||
tex->preview = direct_link_preview_image(fd, tex->preview);
|
tex->preview = direct_link_preview_image(fd, tex->preview);
|
||||||
|
|
||||||
tex->iuser.ok= 1;
|
tex->iuser.ok= 1;
|
||||||
@ -8306,11 +8323,23 @@ static void expand_key(FileData *fd, Main *mainvar, Key *key)
|
|||||||
expand_doit(fd, mainvar, key->ipo);
|
expand_doit(fd, mainvar, key->ipo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void expand_nodetree(FileData *fd, Main *mainvar, bNodeTree *ntree)
|
||||||
|
{
|
||||||
|
bNode *node;
|
||||||
|
|
||||||
|
for(node= ntree->nodes.first; node; node= node->next)
|
||||||
|
if(node->id && node->type!=CMP_NODE_R_LAYERS)
|
||||||
|
expand_doit(fd, mainvar, node->id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static void expand_texture(FileData *fd, Main *mainvar, Tex *tex)
|
static void expand_texture(FileData *fd, Main *mainvar, Tex *tex)
|
||||||
{
|
{
|
||||||
expand_doit(fd, mainvar, tex->ima);
|
expand_doit(fd, mainvar, tex->ima);
|
||||||
expand_doit(fd, mainvar, tex->ipo);
|
expand_doit(fd, mainvar, tex->ipo);
|
||||||
|
|
||||||
|
if(tex->nodetree)
|
||||||
|
expand_nodetree(fd, mainvar, tex->nodetree);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void expand_brush(FileData *fd, Main *mainvar, Brush *brush)
|
static void expand_brush(FileData *fd, Main *mainvar, Brush *brush)
|
||||||
@ -8323,16 +8352,6 @@ static void expand_brush(FileData *fd, Main *mainvar, Brush *brush)
|
|||||||
expand_doit(fd, mainvar, brush->clone.image);
|
expand_doit(fd, mainvar, brush->clone.image);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void expand_nodetree(FileData *fd, Main *mainvar, bNodeTree *ntree)
|
|
||||||
{
|
|
||||||
bNode *node;
|
|
||||||
|
|
||||||
for(node= ntree->nodes.first; node; node= node->next)
|
|
||||||
if(node->id && node->type!=CMP_NODE_R_LAYERS)
|
|
||||||
expand_doit(fd, mainvar, node->id);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static void expand_material(FileData *fd, Main *mainvar, Material *ma)
|
static void expand_material(FileData *fd, Main *mainvar, Material *ma)
|
||||||
{
|
{
|
||||||
int a;
|
int a;
|
||||||
|
@ -174,8 +174,6 @@ Important to know is that 'streaming' has been added to files, for Blender Publi
|
|||||||
#include "BIF_verse.h"
|
#include "BIF_verse.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "GEN_messaging.h"
|
|
||||||
|
|
||||||
#include "BLO_writefile.h"
|
#include "BLO_writefile.h"
|
||||||
#include "BLO_readfile.h"
|
#include "BLO_readfile.h"
|
||||||
#include "BLO_undofile.h"
|
#include "BLO_undofile.h"
|
||||||
@ -472,6 +470,8 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree)
|
|||||||
write_curvemapping(wd, node->storage);
|
write_curvemapping(wd, node->storage);
|
||||||
else if(ntree->type==NTREE_COMPOSIT && (node->type==CMP_NODE_TIME || node->type==CMP_NODE_CURVE_VEC || node->type==CMP_NODE_CURVE_RGB))
|
else if(ntree->type==NTREE_COMPOSIT && (node->type==CMP_NODE_TIME || node->type==CMP_NODE_CURVE_VEC || node->type==CMP_NODE_CURVE_RGB))
|
||||||
write_curvemapping(wd, node->storage);
|
write_curvemapping(wd, node->storage);
|
||||||
|
else if(ntree->type==NTREE_TEXTURE && (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME) )
|
||||||
|
write_curvemapping(wd, node->storage);
|
||||||
else
|
else
|
||||||
writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);
|
writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);
|
||||||
}
|
}
|
||||||
@ -1336,6 +1336,12 @@ static void write_textures(WriteData *wd, ListBase *idbase)
|
|||||||
if(tex->coba) writestruct(wd, DATA, "ColorBand", 1, tex->coba);
|
if(tex->coba) writestruct(wd, DATA, "ColorBand", 1, tex->coba);
|
||||||
if(tex->env) writestruct(wd, DATA, "EnvMap", 1, tex->env);
|
if(tex->env) writestruct(wd, DATA, "EnvMap", 1, tex->env);
|
||||||
|
|
||||||
|
/* nodetree is integral part of texture, no libdata */
|
||||||
|
if(tex->nodetree) {
|
||||||
|
writestruct(wd, DATA, "bNodeTree", 1, tex->nodetree);
|
||||||
|
write_nodetree(wd, tex->nodetree);
|
||||||
|
}
|
||||||
|
|
||||||
write_previews(wd, tex->preview);
|
write_previews(wd, tex->preview);
|
||||||
}
|
}
|
||||||
tex= tex->id.next;
|
tex= tex->id.next;
|
||||||
|
@ -4,7 +4,7 @@ Import ('env')
|
|||||||
sources = env.Glob('intern/*.c')
|
sources = env.Glob('intern/*.c')
|
||||||
|
|
||||||
incs = '. ../makesdna #/intern/guardedalloc #/intern/memutil ../blenlib'
|
incs = '. ../makesdna #/intern/guardedalloc #/intern/memutil ../blenlib'
|
||||||
incs += ' ../avi ../quicktime ../blenkernel'
|
incs += ' ../avi ../blenkernel'
|
||||||
|
|
||||||
incs += ' ' + env['BF_JPEG_INC']
|
incs += ' ' + env['BF_JPEG_INC']
|
||||||
incs += ' ' + env['BF_PNG_INC']
|
incs += ' ' + env['BF_PNG_INC']
|
||||||
@ -36,7 +36,7 @@ if env['WITH_BF_REDCODE']:
|
|||||||
incs += ' ' + env['BF_REDCODE_INC']
|
incs += ' ' + env['BF_REDCODE_INC']
|
||||||
|
|
||||||
if env['WITH_BF_QUICKTIME']:
|
if env['WITH_BF_QUICKTIME']:
|
||||||
incs += ' ' + env['BF_QUICKTIME_INC']
|
incs += ' ../quicktime ' + env['BF_QUICKTIME_INC']
|
||||||
defs.append('WITH_QUICKTIME')
|
defs.append('WITH_QUICKTIME')
|
||||||
|
|
||||||
env.BlenderLib ( libname = 'bf_imbuf', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [80, 40] )
|
env.BlenderLib ( libname = 'bf_imbuf', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [80, 40] )
|
||||||
|
@ -81,6 +81,7 @@ void node_active_link_viewer(struct SpaceNode *snode);
|
|||||||
void node_transform_ext(int mode, int unused);
|
void node_transform_ext(int mode, int unused);
|
||||||
void node_shader_default(struct Material *ma);
|
void node_shader_default(struct Material *ma);
|
||||||
void node_composit_default(struct Scene *scene);
|
void node_composit_default(struct Scene *scene);
|
||||||
|
void node_texture_default(struct Tex *tx);
|
||||||
|
|
||||||
int node_has_hidden_sockets(struct bNode *node);
|
int node_has_hidden_sockets(struct bNode *node);
|
||||||
|
|
||||||
|
@ -415,6 +415,7 @@
|
|||||||
/* NODE: 851-900 */
|
/* NODE: 851-900 */
|
||||||
#define B_NODE_USEMAT 851
|
#define B_NODE_USEMAT 851
|
||||||
#define B_NODE_USESCENE 852
|
#define B_NODE_USESCENE 852
|
||||||
|
#define B_NODE_USETEX 853
|
||||||
|
|
||||||
/* FREE 901 - 999 */
|
/* FREE 901 - 999 */
|
||||||
|
|
||||||
|
@ -258,6 +258,7 @@ void curvemap_buttons(struct uiBlock *block, struct CurveMapping *cumap, char la
|
|||||||
#define B_ENV_OB 1354
|
#define B_ENV_OB 1354
|
||||||
|
|
||||||
#define B_ENV_FREE_ALL 1357
|
#define B_ENV_FREE_ALL 1357
|
||||||
|
#define B_TEX_USENODES 1358
|
||||||
|
|
||||||
|
|
||||||
/* **************** animbuts = object buttons ******* */
|
/* **************** animbuts = object buttons ******* */
|
||||||
|
@ -121,6 +121,7 @@ typedef struct bNode {
|
|||||||
float locx, locy; /* root offset for drawing */
|
float locx, locy; /* root offset for drawing */
|
||||||
float width, miniwidth;
|
float width, miniwidth;
|
||||||
short custom1, custom2; /* to be abused for buttons */
|
short custom1, custom2; /* to be abused for buttons */
|
||||||
|
float custom3, custom4;
|
||||||
|
|
||||||
short need_exec, exec; /* need_exec is set as UI execution event, exec is flag during exec */
|
short need_exec, exec; /* need_exec is set as UI execution event, exec is flag during exec */
|
||||||
|
|
||||||
@ -156,7 +157,7 @@ typedef struct bNodeLink {
|
|||||||
} bNodeLink;
|
} bNodeLink;
|
||||||
|
|
||||||
/* the basis for a Node tree, all links and nodes reside internal here */
|
/* the basis for a Node tree, all links and nodes reside internal here */
|
||||||
/* only re-usable node trees are in the library though, materials allocate own tree struct */
|
/* only re-usable node trees are in the library though, materials and textures allocate own tree struct */
|
||||||
typedef struct bNodeTree {
|
typedef struct bNodeTree {
|
||||||
ID id;
|
ID id;
|
||||||
|
|
||||||
@ -185,6 +186,7 @@ typedef struct bNodeTree {
|
|||||||
/* ntree->type, index */
|
/* ntree->type, index */
|
||||||
#define NTREE_SHADER 0
|
#define NTREE_SHADER 0
|
||||||
#define NTREE_COMPOSIT 1
|
#define NTREE_COMPOSIT 1
|
||||||
|
#define NTREE_TEXTURE 2
|
||||||
|
|
||||||
/* ntree->init, flag */
|
/* ntree->init, flag */
|
||||||
#define NTREE_TYPE_INIT 1
|
#define NTREE_TYPE_INIT 1
|
||||||
@ -285,4 +287,9 @@ typedef struct NodeLensDist {
|
|||||||
short jit, proj, fit, pad;
|
short jit, proj, fit, pad;
|
||||||
} NodeLensDist;
|
} NodeLensDist;
|
||||||
|
|
||||||
|
/* TEX_output */
|
||||||
|
typedef struct TexNodeOutput {
|
||||||
|
char name[32];
|
||||||
|
} TexNodeOutput;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -55,13 +55,13 @@ typedef struct MTex {
|
|||||||
float ofs[3], size[3];
|
float ofs[3], size[3];
|
||||||
|
|
||||||
short texflag, colormodel, pmapto, pmaptoneg;
|
short texflag, colormodel, pmapto, pmaptoneg;
|
||||||
short normapspace, pad[3];
|
short normapspace, which_output, pad[2];
|
||||||
float r, g, b, k;
|
float r, g, b, k;
|
||||||
float def_var, rt;
|
float def_var, rt;
|
||||||
|
|
||||||
float colfac, norfac, varfac;
|
float colfac, norfac, varfac;
|
||||||
float dispfac;
|
float dispfac;
|
||||||
float warpfac;
|
float warpfac;
|
||||||
|
|
||||||
} MTex;
|
} MTex;
|
||||||
|
|
||||||
@ -166,6 +166,7 @@ typedef struct Tex {
|
|||||||
|
|
||||||
struct ImageUser iuser;
|
struct ImageUser iuser;
|
||||||
|
|
||||||
|
struct bNodeTree *nodetree;
|
||||||
struct Ipo *ipo;
|
struct Ipo *ipo;
|
||||||
struct Image *ima;
|
struct Image *ima;
|
||||||
struct PluginTex *plugin;
|
struct PluginTex *plugin;
|
||||||
@ -173,6 +174,9 @@ typedef struct Tex {
|
|||||||
struct EnvMap *env;
|
struct EnvMap *env;
|
||||||
struct PreviewImage * preview;
|
struct PreviewImage * preview;
|
||||||
|
|
||||||
|
char use_nodes;
|
||||||
|
char pad[7];
|
||||||
|
|
||||||
} Tex;
|
} Tex;
|
||||||
|
|
||||||
/* used for mapping node. note: rot is in degrees */
|
/* used for mapping node. note: rot is in degrees */
|
||||||
|
@ -15,31 +15,36 @@ dna = env.Clone()
|
|||||||
makesdna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesdna/\\"" ')
|
makesdna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesdna/\\"" ')
|
||||||
|
|
||||||
makesdna_tool.Append (CPPPATH = ['#/intern/guardedalloc',
|
makesdna_tool.Append (CPPPATH = ['#/intern/guardedalloc',
|
||||||
'../../makesdna'])
|
'../../makesdna'])
|
||||||
|
|
||||||
if env['OURPLATFORM'] == 'linuxcross':
|
if env['OURPLATFORM'] == 'linuxcross':
|
||||||
makesdna_tool.Replace(CC='gcc')
|
makesdna_tool.Replace(CC='gcc')
|
||||||
makesdna_tool.Replace(AR='ar')
|
makesdna_tool.Replace(AR='ar')
|
||||||
makesdna_tool.Replace(LINK='gcc')
|
makesdna_tool.Replace(LINK='gcc')
|
||||||
|
|
||||||
if sys.platform != 'cygwin':
|
if sys.platform != 'cygwin':
|
||||||
makesdna_tool.Append (CCFLAGS = cflags)
|
makesdna_tool.Append (CCFLAGS = cflags)
|
||||||
makesdna_tool.Append (CPPDEFINES = defines)
|
makesdna_tool.Append (CPPDEFINES = defines)
|
||||||
makesdna_tool.Append (LIBPATH = '#'+root_build_dir+'/lib')
|
targetdir = root_build_dir+'/lib'
|
||||||
|
if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
|
||||||
|
targetdir = '#'+targetdir
|
||||||
|
makesdna_tool.Append (LIBPATH = targetdir)
|
||||||
if env['BF_PROFILE']:
|
if env['BF_PROFILE']:
|
||||||
makesdna_tool.Append (LINKFLAGS = env['BF_PROFILE_FLAGS'])
|
makesdna_tool.Append (LINKFLAGS = env['BF_PROFILE_FLAGS'])
|
||||||
|
|
||||||
if env['OURPLATFORM'] == 'linux2' and root_build_dir[0]==os.sep:
|
targetdir = root_build_dir + '/makesdna'
|
||||||
makesdna = makesdna_tool.Program (target = root_build_dir+'/makesdna', source = source_files, LIBS=['bf_guardedalloc'])
|
|
||||||
else:
|
if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
|
||||||
makesdna = makesdna_tool.Program (target = '#'+root_build_dir+'/makesdna', source = source_files, LIBS=['bf_guardedalloc'])
|
targetdir = '#' + targetdir
|
||||||
|
|
||||||
|
makesdna = makesdna_tool.Program (target = targetdir, source = source_files, LIBS=['bf_guardedalloc'])
|
||||||
|
|
||||||
dna_dict = dna.Dictionary()
|
dna_dict = dna.Dictionary()
|
||||||
dna.Depends ('dna.c', makesdna)
|
dna.Depends ('dna.c', makesdna)
|
||||||
dna.Depends ('dna.c', header_files)
|
dna.Depends ('dna.c', header_files)
|
||||||
if env['OURPLATFORM'] != 'linuxcross':
|
if env['OURPLATFORM'] != 'linuxcross':
|
||||||
dna.Command ('dna.c', '', root_build_dir+os.sep+"makesdna $TARGET")
|
dna.Command ('dna.c', '', root_build_dir+os.sep+"makesdna $TARGET")
|
||||||
else:
|
else:
|
||||||
dna.Command ('dna.c', '', root_build_dir+os.sep+"makesdna.exe $TARGET")
|
dna.Command ('dna.c', '', root_build_dir+os.sep+"makesdna.exe $TARGET")
|
||||||
obj = 'intern/dna.c'
|
obj = 'intern/dna.c'
|
||||||
Return ('obj')
|
Return ('obj')
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
FILE(GLOB SRC intern/*.c intern/CMP_nodes/*.c intern/SHD_nodes/*.c)
|
FILE(GLOB SRC intern/*.c intern/CMP_nodes/*.c intern/SHD_nodes/*.c intern/TEX_nodes/*.c)
|
||||||
|
|
||||||
SET(INC
|
SET(INC
|
||||||
. ../../../intern/guardedalloc ../include ../blenlib ../makesdna
|
. ../../../intern/guardedalloc ../include ../blenlib ../makesdna
|
||||||
|
@ -29,6 +29,6 @@
|
|||||||
# Bounces make to subdirectories.
|
# Bounces make to subdirectories.
|
||||||
|
|
||||||
SOURCEDIR = source/blender/nodes
|
SOURCEDIR = source/blender/nodes
|
||||||
DIRS = intern intern/CMP_nodes intern/SHD_nodes
|
DIRS = intern intern/CMP_nodes intern/SHD_nodes intern/TEX_nodes
|
||||||
|
|
||||||
include nan_subdirs.mk
|
include nan_subdirs.mk
|
||||||
|
@ -4,24 +4,25 @@ Import ('env')
|
|||||||
sources = env.Glob('intern/*.c')
|
sources = env.Glob('intern/*.c')
|
||||||
sources += env.Glob('intern/CMP_nodes/*.c')
|
sources += env.Glob('intern/CMP_nodes/*.c')
|
||||||
sources += env.Glob('intern/SHD_nodes/*.c')
|
sources += env.Glob('intern/SHD_nodes/*.c')
|
||||||
|
sources += env.Glob('intern/TEX_nodes/*.c')
|
||||||
|
|
||||||
incs = '. ./intern '
|
incs = '. ./intern '
|
||||||
incs += '#/intern/guardedalloc ../include ../blenlib ../makesdna'
|
incs += '#/intern/guardedalloc ../include ../blenlib ../makesdna'
|
||||||
incs += ' ../python ../render/extern/include '
|
incs += ' ../render/extern/include '
|
||||||
incs += ' ../imbuf ../avi '
|
incs += ' ../imbuf ../avi '
|
||||||
incs += ' ../blenloader ../quicktime'
|
incs += ' ../blenloader'
|
||||||
incs += ' ../blenkernel ../renderconverter '
|
incs += ' ../blenkernel ../renderconverter '
|
||||||
incs += ' ../gpu #/extern/glew/include '
|
incs += ' ../gpu #/extern/glew/include '
|
||||||
|
|
||||||
|
|
||||||
incs += ' ' + env['BF_PYTHON_INC']
|
|
||||||
incs += ' ' + env['BF_OPENGL_INC']
|
incs += ' ' + env['BF_OPENGL_INC']
|
||||||
incs += ' ' + env['BF_ZLIB_INC']
|
incs += ' ' + env['BF_ZLIB_INC']
|
||||||
incs += ' ' + env['BF_SDL_INC']
|
|
||||||
|
|
||||||
defs = ''
|
defs = ''
|
||||||
|
|
||||||
if not env['WITH_BF_PYTHON']:
|
if env['WITH_BF_PYTHON']:
|
||||||
|
incs += ' ' + env['BF_PYTHON_INC']
|
||||||
|
incs += ' ../python'
|
||||||
|
else:
|
||||||
defs += 'DISABLE_PYTHON'
|
defs += 'DISABLE_PYTHON'
|
||||||
|
|
||||||
if env['WITH_BF_INTERNATIONAL']:
|
if env['WITH_BF_INTERNATIONAL']:
|
||||||
|
70
source/blender/nodes/TEX_node.h
Normal file
70
source/blender/nodes/TEX_node.h
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/**
|
||||||
|
* $Id: CMP_node.h 12429 2007-10-29 14:37:19Z bebraw $
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version. The Blender
|
||||||
|
* Foundation also sells licenses for use in proprietary software under
|
||||||
|
* the Blender License. See http://www.blender.org/BL/ for information
|
||||||
|
* about this.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TEX_NODE_H
|
||||||
|
#define TEX_NODE_H
|
||||||
|
|
||||||
|
#include "BKE_node.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* ****************** types array for all texture nodes ****************** */
|
||||||
|
|
||||||
|
extern bNodeType tex_node_math;
|
||||||
|
extern bNodeType tex_node_mix_rgb;
|
||||||
|
extern bNodeType tex_node_valtorgb;
|
||||||
|
extern bNodeType tex_node_rgbtobw;
|
||||||
|
extern bNodeType tex_node_output;
|
||||||
|
extern bNodeType tex_node_viewer;
|
||||||
|
extern bNodeType tex_node_checker;
|
||||||
|
extern bNodeType tex_node_texture;
|
||||||
|
extern bNodeType tex_node_bricks;
|
||||||
|
extern bNodeType tex_node_image;
|
||||||
|
extern bNodeType tex_node_curve_rgb;
|
||||||
|
extern bNodeType tex_node_curve_time;
|
||||||
|
extern bNodeType tex_node_invert;
|
||||||
|
extern bNodeType tex_node_hue_sat;
|
||||||
|
|
||||||
|
extern bNodeType tex_node_rotate;
|
||||||
|
extern bNodeType tex_node_translate;
|
||||||
|
|
||||||
|
extern bNodeType tex_node_proc_voronoi;
|
||||||
|
extern bNodeType tex_node_proc_blend;
|
||||||
|
extern bNodeType tex_node_proc_magic;
|
||||||
|
extern bNodeType tex_node_proc_marble;
|
||||||
|
extern bNodeType tex_node_proc_clouds;
|
||||||
|
extern bNodeType tex_node_proc_wood;
|
||||||
|
extern bNodeType tex_node_proc_musgrave;
|
||||||
|
extern bNodeType tex_node_proc_noise;
|
||||||
|
extern bNodeType tex_node_proc_stucci;
|
||||||
|
extern bNodeType tex_node_proc_distnoise;
|
||||||
|
|
||||||
|
#endif
|
@ -50,6 +50,9 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
|
|||||||
TexResult texres;
|
TexResult texres;
|
||||||
float vec[3], nor[3]={0.0f, 0.0f, 0.0f};
|
float vec[3], nor[3]={0.0f, 0.0f, 0.0f};
|
||||||
int retval;
|
int retval;
|
||||||
|
short which_output = node->custom1;
|
||||||
|
|
||||||
|
short thread = shi->thread;
|
||||||
|
|
||||||
/* out: value, color, normal */
|
/* out: value, color, normal */
|
||||||
|
|
||||||
@ -61,7 +64,7 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
|
|||||||
|
|
||||||
if(in[0]->datatype==NS_OSA_VECTORS) {
|
if(in[0]->datatype==NS_OSA_VECTORS) {
|
||||||
float *fp= in[0]->data;
|
float *fp= in[0]->data;
|
||||||
retval= multitex_ext((Tex *)node->id, vec, fp, fp+3, shi->osatex, &texres);
|
retval= multitex_thread((Tex *)node->id, vec, fp, fp+3, shi->osatex, &texres, thread, which_output);
|
||||||
}
|
}
|
||||||
else if(in[0]->datatype==NS_OSA_VALUES) {
|
else if(in[0]->datatype==NS_OSA_VALUES) {
|
||||||
float *fp= in[0]->data;
|
float *fp= in[0]->data;
|
||||||
@ -69,14 +72,14 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
|
|||||||
|
|
||||||
dxt[0]= fp[0]; dxt[1]= dxt[2]= 0.0f;
|
dxt[0]= fp[0]; dxt[1]= dxt[2]= 0.0f;
|
||||||
dyt[0]= fp[1]; dyt[1]= dyt[2]= 0.0f;
|
dyt[0]= fp[1]; dyt[1]= dyt[2]= 0.0f;
|
||||||
retval= multitex_ext((Tex *)node->id, vec, dxt, dyt, shi->osatex, &texres);
|
retval= multitex_thread((Tex *)node->id, vec, dxt, dyt, shi->osatex, &texres, thread, which_output);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
retval= multitex_ext((Tex *)node->id, vec, NULL, NULL, 0, &texres);
|
retval= multitex_thread((Tex *)node->id, vec, NULL, NULL, 0, &texres, thread, which_output);
|
||||||
}
|
}
|
||||||
else { /* only for previewrender, so we see stuff */
|
else {
|
||||||
VECCOPY(vec, shi->lo);
|
VECCOPY(vec, shi->lo);
|
||||||
retval= multitex_ext((Tex *)node->id, vec, NULL, NULL, 0, &texres);
|
retval= multitex_thread((Tex *)node->id, vec, NULL, NULL, 0, &texres, thread, which_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stupid exception */
|
/* stupid exception */
|
||||||
|
@ -82,6 +82,7 @@ void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
|
|||||||
/* convert caller data to struct */
|
/* convert caller data to struct */
|
||||||
scd.shi= shi;
|
scd.shi= shi;
|
||||||
scd.shr= shr;
|
scd.shr= shr;
|
||||||
|
|
||||||
/* each material node has own local shaderesult, with optional copying */
|
/* each material node has own local shaderesult, with optional copying */
|
||||||
memset(shr, 0, sizeof(ShadeResult));
|
memset(shr, 0, sizeof(ShadeResult));
|
||||||
|
|
||||||
|
48
source/blender/nodes/intern/TEX_nodes/Makefile
Normal file
48
source/blender/nodes/intern/TEX_nodes/Makefile
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#
|
||||||
|
# $Id: Makefile 12796 2007-12-05 16:58:52Z sirdude $
|
||||||
|
#
|
||||||
|
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version. The Blender
|
||||||
|
# Foundation also sells licenses for use in proprietary software under
|
||||||
|
# the Blender License. See http://www.blender.org/BL/ for information
|
||||||
|
# about this.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software Foundation,
|
||||||
|
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# The Original Code is: all of this file.
|
||||||
|
#
|
||||||
|
# Contributor(s): none yet.
|
||||||
|
#
|
||||||
|
# ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
LIBNAME = nodes_tex
|
||||||
|
DIR = $(OCGDIR)/blender/$(LIBNAME)
|
||||||
|
|
||||||
|
include nan_compile.mk
|
||||||
|
|
||||||
|
CFLAGS += $(LEVEL_1_C_WARNINGS)
|
||||||
|
|
||||||
|
CPPFLAGS += -I../../../blenkernel
|
||||||
|
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
|
||||||
|
CPPFLAGS += -I../../../makesdna
|
||||||
|
CPPFLAGS += -I../../../blenlib
|
||||||
|
CPPFLAGS += -I../../../include
|
||||||
|
CPPFLAGS += -I../../../imbuf
|
||||||
|
CPPFLAGS += -I../../../render/extern/include
|
||||||
|
CPPFLAGS += -I$(OPENGL_HEADERS)
|
123
source/blender/nodes/intern/TEX_nodes/TEX_bricks.c
Normal file
123
source/blender/nodes/intern/TEX_nodes/TEX_bricks.c
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../TEX_util.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
static bNodeSocketType inputs[]= {
|
||||||
|
{ SOCK_RGBA, 1, "Bricks 1", 0.596f, 0.282f, 0.0f, 1.0f, 0.0f, 1.0f },
|
||||||
|
{ SOCK_RGBA, 1, "Bricks 2", 0.632f, 0.504f, 0.05f, 1.0f, 0.0f, 1.0f },
|
||||||
|
{ SOCK_RGBA, 1, "Mortar", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
|
||||||
|
{ SOCK_VALUE, 1, "Thickness", 0.02f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
|
||||||
|
{ SOCK_VALUE, 1, "Bias", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f },
|
||||||
|
{ SOCK_VALUE, 1, "Brick Width", 0.5f, 0.0f, 0.0f, 0.0f, 0.001f, 99.0f },
|
||||||
|
{ SOCK_VALUE, 1, "Row Height", 0.25f, 0.0f, 0.0f, 0.0f, 0.001f, 99.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
static bNodeSocketType outputs[]= {
|
||||||
|
{ SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void init(bNode *node) {
|
||||||
|
node->custom3 = 0.5; /* offset */
|
||||||
|
node->custom4 = 1.0; /* squash */
|
||||||
|
}
|
||||||
|
|
||||||
|
static void colorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
|
||||||
|
{
|
||||||
|
float x = coord[0];
|
||||||
|
float y = coord[1];
|
||||||
|
|
||||||
|
float bricknum, rownum, offset = 0;
|
||||||
|
float ins_x, ins_y;
|
||||||
|
float tint;
|
||||||
|
|
||||||
|
float bricks1[4];
|
||||||
|
float bricks2[4];
|
||||||
|
float mortar[4];
|
||||||
|
|
||||||
|
float mortar_thickness = tex_input_value(in[3], coord, thread);
|
||||||
|
float bias = tex_input_value(in[4], coord, thread);
|
||||||
|
float brick_width = tex_input_value(in[5], coord, thread);
|
||||||
|
float row_height = tex_input_value(in[6], coord, thread);
|
||||||
|
|
||||||
|
tex_input_rgba(bricks1, in[0], coord, thread);
|
||||||
|
tex_input_rgba(bricks2, in[1], coord, thread);
|
||||||
|
tex_input_rgba(mortar, in[2], coord, thread);
|
||||||
|
|
||||||
|
rownum = floor(y / row_height);
|
||||||
|
|
||||||
|
if( node->custom1 && node->custom2 ) {
|
||||||
|
brick_width *= ((int)(rownum) % node->custom2 ) ? 1.0f : node->custom4; /* squash */
|
||||||
|
offset = ((int)(rownum) % node->custom1 ) ? 0 : (brick_width*node->custom3); /* offset */
|
||||||
|
}
|
||||||
|
|
||||||
|
bricknum = floor((x+offset) / brick_width);
|
||||||
|
|
||||||
|
ins_x = (x+offset) - brick_width*bricknum;
|
||||||
|
ins_y = y - row_height*rownum;
|
||||||
|
|
||||||
|
srand( (123456*rownum) + bricknum );
|
||||||
|
tint = rand() / (float)RAND_MAX + bias;
|
||||||
|
CLAMP(tint,0.0f,1.0f);
|
||||||
|
|
||||||
|
if( ins_x < mortar_thickness || ins_y < mortar_thickness ||
|
||||||
|
ins_x > (brick_width - mortar_thickness) ||
|
||||||
|
ins_y > (row_height - mortar_thickness) ) {
|
||||||
|
QUATCOPY( out, mortar );
|
||||||
|
} else {
|
||||||
|
QUATCOPY( out, bricks1 );
|
||||||
|
ramp_blend( MA_RAMP_BLEND, out, out+1, out+2, tint, bricks2 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||||
|
{
|
||||||
|
tex_output(node, in, out[0], &colorfn);
|
||||||
|
|
||||||
|
tex_do_preview(node, out[0], data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bNodeType tex_node_bricks= {
|
||||||
|
/* *next,*prev */ NULL, NULL,
|
||||||
|
/* type code */ TEX_NODE_BRICKS,
|
||||||
|
/* name */ "Bricks",
|
||||||
|
/* width+range */ 150, 60, 150,
|
||||||
|
/* class+opts */ NODE_CLASS_PATTERN, NODE_OPTIONS | NODE_PREVIEW,
|
||||||
|
/* input sock */ inputs,
|
||||||
|
/* output sock */ outputs,
|
||||||
|
/* storage */ "",
|
||||||
|
/* execfunc */ exec,
|
||||||
|
/* butfunc */ NULL,
|
||||||
|
/* initfunc */ init,
|
||||||
|
/* freestoragefunc */ NULL,
|
||||||
|
/* copystoragefunc */ NULL,
|
||||||
|
/* id */ NULL
|
||||||
|
|
||||||
|
};
|
85
source/blender/nodes/intern/TEX_nodes/TEX_checker.c
Normal file
85
source/blender/nodes/intern/TEX_nodes/TEX_checker.c
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../TEX_util.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
static bNodeSocketType inputs[]= {
|
||||||
|
{ SOCK_RGBA, 1, "Color1", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
|
||||||
|
{ SOCK_RGBA, 1, "Color2", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f },
|
||||||
|
{ SOCK_VALUE, 1, "Size", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 100.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
static bNodeSocketType outputs[]= {
|
||||||
|
{ SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void colorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
|
||||||
|
{
|
||||||
|
float x = coord[0];
|
||||||
|
float y = coord[1];
|
||||||
|
float z = coord[2];
|
||||||
|
float sz = tex_input_value(in[2], coord, thread);
|
||||||
|
|
||||||
|
/* 0.00001 because of unit sized stuff */
|
||||||
|
int xi = (int)fabs(floor(0.00001 + x / sz));
|
||||||
|
int yi = (int)fabs(floor(0.00001 + y / sz));
|
||||||
|
int zi = (int)fabs(floor(0.00001 + z / sz));
|
||||||
|
|
||||||
|
if( (xi % 2 == yi % 2) == (zi % 2) ) {
|
||||||
|
tex_input_rgba(out, in[0], coord, thread);
|
||||||
|
} else {
|
||||||
|
tex_input_rgba(out, in[1], coord, thread);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||||
|
{
|
||||||
|
tex_output(node, in, out[0], &colorfn);
|
||||||
|
|
||||||
|
tex_do_preview(node, out[0], data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bNodeType tex_node_checker= {
|
||||||
|
/* *next,*prev */ NULL, NULL,
|
||||||
|
/* type code */ TEX_NODE_CHECKER,
|
||||||
|
/* name */ "Checker",
|
||||||
|
/* width+range */ 100, 60, 150,
|
||||||
|
/* class+opts */ NODE_CLASS_PATTERN, NODE_OPTIONS | NODE_PREVIEW,
|
||||||
|
/* input sock */ inputs,
|
||||||
|
/* output sock */ outputs,
|
||||||
|
/* storage */ "",
|
||||||
|
/* execfunc */ exec,
|
||||||
|
/* butfunc */ NULL,
|
||||||
|
/* initfunc */ NULL,
|
||||||
|
/* freestoragefunc */ NULL,
|
||||||
|
/* copystoragefunc */ NULL,
|
||||||
|
/* id */ NULL
|
||||||
|
|
||||||
|
};
|
127
source/blender/nodes/intern/TEX_nodes/TEX_curves.c
Normal file
127
source/blender/nodes/intern/TEX_nodes/TEX_curves.c
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../TEX_util.h"
|
||||||
|
|
||||||
|
/* **************** CURVE Time ******************** */
|
||||||
|
|
||||||
|
/* custom1 = sfra, custom2 = efra */
|
||||||
|
static bNodeSocketType time_outputs[]= {
|
||||||
|
{ SOCK_VALUE, 0, "Value", 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void time_colorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
|
||||||
|
{
|
||||||
|
/* stack order output: fac */
|
||||||
|
float fac= 0.0f;
|
||||||
|
|
||||||
|
if(node->custom1 < node->custom2)
|
||||||
|
fac = (G.scene->r.cfra - node->custom1)/(float)(node->custom2-node->custom1);
|
||||||
|
|
||||||
|
fac = curvemapping_evaluateF(node->storage, 0, fac);
|
||||||
|
out[0] = CLAMPIS(fac, 0.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void time_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||||
|
{
|
||||||
|
tex_output(node, in, out[0], &time_colorfn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void time_init(bNode* node)
|
||||||
|
{
|
||||||
|
node->custom1= G.scene->r.sfra;
|
||||||
|
node->custom2= G.scene->r.efra;
|
||||||
|
node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
bNodeType tex_node_curve_time= {
|
||||||
|
/* *next,*prev */ NULL, NULL,
|
||||||
|
/* type code */ TEX_NODE_CURVE_TIME,
|
||||||
|
/* name */ "Time",
|
||||||
|
/* width+range */ 140, 100, 320,
|
||||||
|
/* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS,
|
||||||
|
/* input sock */ NULL,
|
||||||
|
/* output sock */ time_outputs,
|
||||||
|
/* storage */ "CurveMapping",
|
||||||
|
/* execfunc */ time_exec,
|
||||||
|
/* butfunc */ NULL,
|
||||||
|
/* initfunc */ time_init,
|
||||||
|
/* freestoragefunc */ node_free_curves,
|
||||||
|
/* copystoragefunc */ node_copy_curves,
|
||||||
|
/* id */ NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
/* **************** CURVE RGB ******************** */
|
||||||
|
static bNodeSocketType rgb_inputs[]= {
|
||||||
|
{ SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static bNodeSocketType rgb_outputs[]= {
|
||||||
|
{ SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void rgb_colorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
|
||||||
|
{
|
||||||
|
float cin[4];
|
||||||
|
tex_input_rgba(cin, in[0], coord, thread);
|
||||||
|
|
||||||
|
curvemapping_evaluateRGBF(node->storage, out, cin);
|
||||||
|
out[3] = cin[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rgb_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||||
|
{
|
||||||
|
tex_output(node, in, out[0], &rgb_colorfn);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rgb_init(bNode *node)
|
||||||
|
{
|
||||||
|
node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
bNodeType tex_node_curve_rgb= {
|
||||||
|
/* *next,*prev */ NULL, NULL,
|
||||||
|
/* type code */ TEX_NODE_CURVE_RGB,
|
||||||
|
/* name */ "RGB Curves",
|
||||||
|
/* width+range */ 200, 140, 320,
|
||||||
|
/* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
|
||||||
|
/* input sock */ rgb_inputs,
|
||||||
|
/* output sock */ rgb_outputs,
|
||||||
|
/* storage */ "CurveMapping",
|
||||||
|
/* execfunc */ rgb_exec,
|
||||||
|
/* butfunc */ NULL,
|
||||||
|
/* initfunc */ rgb_init,
|
||||||
|
/* freestoragefunc */ node_free_curves,
|
||||||
|
/* copystoragefunc */ node_copy_curves,
|
||||||
|
/* id */ NULL
|
||||||
|
};
|
||||||
|
|
104
source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c
Normal file
104
source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2006 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): Juho Vepsäläinen
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../TEX_util.h"
|
||||||
|
|
||||||
|
|
||||||
|
static bNodeSocketType inputs[]= {
|
||||||
|
{ SOCK_VALUE, 1, "Hue", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||||
|
{ SOCK_VALUE, 1, "Saturation", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f},
|
||||||
|
{ SOCK_VALUE, 1, "Value", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f},
|
||||||
|
{ SOCK_VALUE, 1, "Fac", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||||
|
{ SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
static bNodeSocketType outputs[]= {
|
||||||
|
{ SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void do_hue_sat_fac(bNode *node, float *out, float hue, float sat, float val, float *in, float fac)
|
||||||
|
{
|
||||||
|
if(fac != 0 && (hue != 0.5f || sat != 1 || val != 1)) {
|
||||||
|
float col[3], hsv[3], mfac= 1.0f - fac;
|
||||||
|
|
||||||
|
rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2);
|
||||||
|
hsv[0]+= (hue - 0.5f);
|
||||||
|
if(hsv[0]>1.0) hsv[0]-=1.0; else if(hsv[0]<0.0) hsv[0]+= 1.0;
|
||||||
|
hsv[1]*= sat;
|
||||||
|
if(hsv[1]>1.0) hsv[1]= 1.0; else if(hsv[1]<0.0) hsv[1]= 0.0;
|
||||||
|
hsv[2]*= val;
|
||||||
|
if(hsv[2]>1.0) hsv[2]= 1.0; else if(hsv[2]<0.0) hsv[2]= 0.0;
|
||||||
|
hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
|
||||||
|
|
||||||
|
out[0]= mfac*in[0] + fac*col[0];
|
||||||
|
out[1]= mfac*in[1] + fac*col[1];
|
||||||
|
out[2]= mfac*in[2] + fac*col[2];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QUATCOPY(out, in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void colorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
|
||||||
|
{
|
||||||
|
float in0 = tex_input_value(in[0], coord, thread);
|
||||||
|
float in1 = tex_input_value(in[1], coord, thread);
|
||||||
|
float in2 = tex_input_value(in[2], coord, thread);
|
||||||
|
float in3 = tex_input_value(in[3], coord, thread);
|
||||||
|
|
||||||
|
float in4[4];
|
||||||
|
tex_input_rgba(in4, in[4], coord, thread);
|
||||||
|
|
||||||
|
do_hue_sat_fac(node, out, in0, in1, in2, in4, in3);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||||
|
{
|
||||||
|
tex_output(node, in, out[0], &colorfn);
|
||||||
|
}
|
||||||
|
|
||||||
|
bNodeType tex_node_hue_sat= {
|
||||||
|
/* *next,*prev */ NULL, NULL,
|
||||||
|
/* type code */ TEX_NODE_HUE_SAT,
|
||||||
|
/* name */ "Hue Saturation Value",
|
||||||
|
/* width+range */ 150, 80, 250,
|
||||||
|
/* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
|
||||||
|
/* input sock */ inputs,
|
||||||
|
/* output sock */ outputs,
|
||||||
|
/* storage */ "",
|
||||||
|
/* execfunc */ exec,
|
||||||
|
/* butfunc */ NULL,
|
||||||
|
/* initfunc */ NULL,
|
||||||
|
/* freestoragefunc */ NULL,
|
||||||
|
/* copystoragefunc */ NULL,
|
||||||
|
/* id */ NULL
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
106
source/blender/nodes/intern/TEX_nodes/TEX_image.c
Normal file
106
source/blender/nodes/intern/TEX_nodes/TEX_image.c
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
/**
|
||||||
|
* $Id: TEX_image.c 10456 2007-04-04 13:58:12Z jesterking $
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2006 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../TEX_util.h"
|
||||||
|
|
||||||
|
static bNodeSocketType outputs[]= {
|
||||||
|
{ SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void colorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
|
||||||
|
{
|
||||||
|
float x = coord[0];
|
||||||
|
float y = coord[1];
|
||||||
|
Image *ima= (Image *)node->id;
|
||||||
|
ImageUser *iuser= (ImageUser *)node->storage;
|
||||||
|
|
||||||
|
if( ima ) {
|
||||||
|
ImBuf *ibuf = BKE_image_get_ibuf(ima, iuser);
|
||||||
|
if( ibuf ) {
|
||||||
|
float xsize, ysize;
|
||||||
|
float xoff, yoff;
|
||||||
|
int px, py;
|
||||||
|
|
||||||
|
float *result;
|
||||||
|
|
||||||
|
xsize = ibuf->x / 2;
|
||||||
|
ysize = ibuf->y / 2;
|
||||||
|
xoff = yoff = -1;
|
||||||
|
|
||||||
|
px = (int)( (x-xoff) * xsize );
|
||||||
|
py = (int)( (y-yoff) * ysize );
|
||||||
|
|
||||||
|
if( (!xsize) || (!ysize) ) return;
|
||||||
|
if( !ibuf->rect_float ) IMB_float_from_rect(ibuf);
|
||||||
|
|
||||||
|
while( px < 0 ) px += ibuf->x;
|
||||||
|
while( py < 0 ) py += ibuf->y;
|
||||||
|
while( px >= ibuf->x ) px -= ibuf->x;
|
||||||
|
while( py >= ibuf->y ) py -= ibuf->y;
|
||||||
|
|
||||||
|
result = ibuf->rect_float + py*ibuf->x*4 + px*4;
|
||||||
|
QUATCOPY( out, result );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||||
|
{
|
||||||
|
tex_output(node, in, out[0], &colorfn);
|
||||||
|
|
||||||
|
tex_do_preview(node, out[0], data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void init(bNode* node)
|
||||||
|
{
|
||||||
|
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
|
||||||
|
node->storage= iuser;
|
||||||
|
iuser->sfra= 1;
|
||||||
|
iuser->fie_ima= 2;
|
||||||
|
iuser->ok= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bNodeType tex_node_image= {
|
||||||
|
/* *next,*prev */ NULL, NULL,
|
||||||
|
/* type code */ TEX_NODE_IMAGE,
|
||||||
|
/* name */ "Image",
|
||||||
|
/* width+range */ 120, 80, 300,
|
||||||
|
/* class+opts */ NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
|
||||||
|
/* input sock */ NULL,
|
||||||
|
/* output sock */ outputs,
|
||||||
|
/* storage */ "ImageUser",
|
||||||
|
/* execfunc */ exec,
|
||||||
|
/* butfunc */ NULL,
|
||||||
|
/* initfunc */ init,
|
||||||
|
/* freestoragefunc */ node_free_standard_storage,
|
||||||
|
/* copystoragefunc */ node_copy_standard_storage,
|
||||||
|
/* id */ NULL
|
||||||
|
};
|
||||||
|
|
79
source/blender/nodes/intern/TEX_nodes/TEX_invert.c
Normal file
79
source/blender/nodes/intern/TEX_nodes/TEX_invert.c
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../TEX_util.h"
|
||||||
|
|
||||||
|
/* **************** INVERT ******************** */
|
||||||
|
static bNodeSocketType inputs[]= {
|
||||||
|
{ SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static bNodeSocketType outputs[]= {
|
||||||
|
{ SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void colorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
|
||||||
|
{
|
||||||
|
float col[4];
|
||||||
|
|
||||||
|
tex_input_rgba(col, in[0], coord, thread);
|
||||||
|
|
||||||
|
col[0] = 1.0f - col[0];
|
||||||
|
col[1] = 1.0f - col[1];
|
||||||
|
col[2] = 1.0f - col[2];
|
||||||
|
|
||||||
|
VECCOPY(out, col);
|
||||||
|
out[3] = col[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||||
|
{
|
||||||
|
tex_output(node, in, out[0], &colorfn);
|
||||||
|
|
||||||
|
tex_do_preview(node, out[0], data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bNodeType tex_node_invert= {
|
||||||
|
/* *next,*prev */ NULL, NULL,
|
||||||
|
/* type code */ TEX_NODE_INVERT,
|
||||||
|
/* name */ "Invert",
|
||||||
|
/* width+range */ 90, 80, 100,
|
||||||
|
/* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
|
||||||
|
/* input sock */ inputs,
|
||||||
|
/* output sock */ outputs,
|
||||||
|
/* storage */ "",
|
||||||
|
/* execfunc */ exec,
|
||||||
|
/* butfunc */ NULL,
|
||||||
|
/* initfunc */ NULL,
|
||||||
|
/* freestoragefunc */ NULL,
|
||||||
|
/* copystoragefunc */ NULL,
|
||||||
|
/* id */ NULL
|
||||||
|
};
|
||||||
|
|
172
source/blender/nodes/intern/TEX_nodes/TEX_math.c
Normal file
172
source/blender/nodes/intern/TEX_nodes/TEX_math.c
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../TEX_util.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* **************** SCALAR MATH ******************** */
|
||||||
|
static bNodeSocketType inputs[]= {
|
||||||
|
{ SOCK_VALUE, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f},
|
||||||
|
{ SOCK_VALUE, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static bNodeSocketType outputs[]= {
|
||||||
|
{ SOCK_VALUE, 0, "Value", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void valuefn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
|
||||||
|
{
|
||||||
|
float in0 = tex_input_value(in[0], coord, thread);
|
||||||
|
float in1 = tex_input_value(in[1], coord, thread);
|
||||||
|
|
||||||
|
switch(node->custom1){
|
||||||
|
|
||||||
|
case 0: /* Add */
|
||||||
|
*out= in0 + in1;
|
||||||
|
break;
|
||||||
|
case 1: /* Subtract */
|
||||||
|
*out= in0 - in1;
|
||||||
|
break;
|
||||||
|
case 2: /* Multiply */
|
||||||
|
*out= in0 * in1;
|
||||||
|
break;
|
||||||
|
case 3: /* Divide */
|
||||||
|
{
|
||||||
|
if(in1==0) /* We don't want to divide by zero. */
|
||||||
|
*out= 0.0;
|
||||||
|
else
|
||||||
|
*out= in0 / in1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4: /* Sine */
|
||||||
|
{
|
||||||
|
*out= sin(in0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 5: /* Cosine */
|
||||||
|
{
|
||||||
|
*out= cos(in0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 6: /* Tangent */
|
||||||
|
{
|
||||||
|
*out= tan(in0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 7: /* Arc-Sine */
|
||||||
|
{
|
||||||
|
/* Can't do the impossible... */
|
||||||
|
if( in0 <= 1 && in0 >= -1 )
|
||||||
|
*out= asin(in0);
|
||||||
|
else
|
||||||
|
*out= 0.0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 8: /* Arc-Cosine */
|
||||||
|
{
|
||||||
|
/* Can't do the impossible... */
|
||||||
|
if( in0 <= 1 && in0 >= -1 )
|
||||||
|
*out= acos(in0);
|
||||||
|
else
|
||||||
|
*out= 0.0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 9: /* Arc-Tangent */
|
||||||
|
{
|
||||||
|
*out= atan(in0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 10: /* Power */
|
||||||
|
{
|
||||||
|
/* Don't want any imaginary numbers... */
|
||||||
|
if( in0 >= 0 )
|
||||||
|
*out= pow(in0, in1);
|
||||||
|
else
|
||||||
|
*out= 0.0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 11: /* Logarithm */
|
||||||
|
{
|
||||||
|
/* Don't want any imaginary numbers... */
|
||||||
|
if( in0 > 0 && in1 > 0 )
|
||||||
|
*out= log(in0) / log(in1);
|
||||||
|
else
|
||||||
|
*out= 0.0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 12: /* Minimum */
|
||||||
|
{
|
||||||
|
if( in0 < in1 )
|
||||||
|
*out= in0;
|
||||||
|
else
|
||||||
|
*out= in1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 13: /* Maximum */
|
||||||
|
{
|
||||||
|
if( in0 > in1 )
|
||||||
|
*out= in0;
|
||||||
|
else
|
||||||
|
*out= in1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 14: /* Round */
|
||||||
|
{
|
||||||
|
*out= (int)(in0 + 0.5f);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||||
|
{
|
||||||
|
tex_output(node, in, out[0], &valuefn);
|
||||||
|
|
||||||
|
tex_do_preview(node, out[0], data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bNodeType tex_node_math= {
|
||||||
|
/* *next,*prev */ NULL, NULL,
|
||||||
|
/* type code */ TEX_NODE_MATH,
|
||||||
|
/* name */ "Math",
|
||||||
|
/* width+range */ 120, 110, 160,
|
||||||
|
/* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS,
|
||||||
|
/* input sock */ inputs,
|
||||||
|
/* output sock */ outputs,
|
||||||
|
/* storage */ "node_math",
|
||||||
|
/* execfunc */ exec,
|
||||||
|
/* butfunc */ NULL,
|
||||||
|
/* initfunc */ NULL,
|
||||||
|
/* freestoragefunc */ NULL,
|
||||||
|
/* copystoragefunc */ NULL,
|
||||||
|
/* id */ NULL
|
||||||
|
};
|
||||||
|
|
81
source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c
Normal file
81
source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../TEX_util.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* **************** MIX RGB ******************** */
|
||||||
|
static bNodeSocketType inputs[]= {
|
||||||
|
{ SOCK_VALUE, 1, "Factor", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
|
||||||
|
{ SOCK_RGBA, 1, "Color1", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f },
|
||||||
|
{ SOCK_RGBA , 1, "Color2", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
static bNodeSocketType outputs[]= {
|
||||||
|
{ SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void colorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
|
||||||
|
{
|
||||||
|
float fac = tex_input_value(in[0], coord, thread);
|
||||||
|
float col1[4], col2[4];
|
||||||
|
|
||||||
|
tex_input_rgba(col1, in[1], coord, thread);
|
||||||
|
tex_input_rgba(col2, in[2], coord, thread);
|
||||||
|
|
||||||
|
CLAMP(fac, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
QUATCOPY(out, col1);
|
||||||
|
ramp_blend(node->custom1, out, out+1, out+2, fac, col2);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||||
|
{
|
||||||
|
tex_output(node, in, out[0], &colorfn);
|
||||||
|
|
||||||
|
tex_do_preview(node, out[0], data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bNodeType tex_node_mix_rgb= {
|
||||||
|
/* *next,*prev */ NULL, NULL,
|
||||||
|
/* type code */ TEX_NODE_MIX_RGB,
|
||||||
|
/* name */ "Mix",
|
||||||
|
/* width+range */ 100, 60, 150,
|
||||||
|
/* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
|
||||||
|
/* input sock */ inputs,
|
||||||
|
/* output sock */ outputs,
|
||||||
|
/* storage */ "",
|
||||||
|
/* execfunc */ exec,
|
||||||
|
/* butfunc */ NULL,
|
||||||
|
/* initfunc */ NULL,
|
||||||
|
/* freestoragefunc */ NULL,
|
||||||
|
/* copystoragefunc */ NULL,
|
||||||
|
/* id */ NULL
|
||||||
|
|
||||||
|
};
|
90
source/blender/nodes/intern/TEX_nodes/TEX_output.c
Normal file
90
source/blender/nodes/intern/TEX_nodes/TEX_output.c
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2006 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../TEX_util.h"
|
||||||
|
|
||||||
|
/* **************** COMPOSITE ******************** */
|
||||||
|
static bNodeSocketType inputs[]= {
|
||||||
|
{ SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ SOCK_VECTOR, 1, "Normal", 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
/* applies to render pipeline */
|
||||||
|
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||||
|
{
|
||||||
|
TexCallData *cdata = (TexCallData *)data;
|
||||||
|
TexResult *target = cdata->target;
|
||||||
|
|
||||||
|
if(in[1]->hasinput && !in[0]->hasinput)
|
||||||
|
tex_do_preview(node, in[1], data);
|
||||||
|
else
|
||||||
|
tex_do_preview(node, in[0], data);
|
||||||
|
|
||||||
|
if(!cdata->do_preview) {
|
||||||
|
if(cdata->which_output == node->custom1)
|
||||||
|
{
|
||||||
|
tex_input_rgba(&target->tr, in[0], cdata->coord, cdata->thread);
|
||||||
|
|
||||||
|
target->tin = (target->tr + target->tg + target->tb) / 3.0f;
|
||||||
|
target->talpha = 1.0f;
|
||||||
|
|
||||||
|
if(target->nor) {
|
||||||
|
if(in[1]->hasinput)
|
||||||
|
tex_input_vec(target->nor, in[1], cdata->coord, cdata->thread);
|
||||||
|
else
|
||||||
|
target->nor = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void init(bNode* node)
|
||||||
|
{
|
||||||
|
TexNodeOutput *tno = MEM_callocN(sizeof(TexNodeOutput), "TEX_output");
|
||||||
|
strcpy(tno->name, "Default");
|
||||||
|
node->storage= tno;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bNodeType tex_node_output= {
|
||||||
|
/* *next,*prev */ NULL, NULL,
|
||||||
|
/* type code */ TEX_NODE_OUTPUT,
|
||||||
|
/* name */ "Output",
|
||||||
|
/* width+range */ 150, 60, 200,
|
||||||
|
/* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW | NODE_OPTIONS,
|
||||||
|
/* input sock */ inputs,
|
||||||
|
/* output sock */ NULL,
|
||||||
|
/* storage */ "TexNodeOutput",
|
||||||
|
/* execfunc */ exec,
|
||||||
|
/* butfunc */ NULL,
|
||||||
|
/* initfunc */ init,
|
||||||
|
/* freestoragefunc */ node_free_standard_storage,
|
||||||
|
/* copystoragefunc */ node_copy_standard_storage,
|
||||||
|
/* id */ NULL
|
||||||
|
};
|
310
source/blender/nodes/intern/TEX_nodes/TEX_proc.c
Normal file
310
source/blender/nodes/intern/TEX_nodes/TEX_proc.c
Normal file
@ -0,0 +1,310 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../TEX_util.h"
|
||||||
|
#include "RE_shader_ext.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
In this file: wrappers to use procedural textures as nodes
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
static bNodeSocketType outputs_both[]= {
|
||||||
|
{ SOCK_RGBA, 0, "Color", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
|
||||||
|
{ SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
static bNodeSocketType outputs_color_only[]= {
|
||||||
|
{ SOCK_RGBA, 0, "Color", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Inputs common to all, #defined because nodes will need their own inputs too */
|
||||||
|
#define I 2 /* count */
|
||||||
|
#define COMMON_INPUTS \
|
||||||
|
{ SOCK_RGBA, 1, "Color 1", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f }, \
|
||||||
|
{ SOCK_RGBA, 1, "Color 2", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f }
|
||||||
|
|
||||||
|
/* Calls multitex and copies the result to the outputs. Called by xxx_exec, which handles inputs. */
|
||||||
|
static void do_proc(float *result, float *coord, float *col1, float *col2, char is_normal, Tex *tex, short thread)
|
||||||
|
{
|
||||||
|
TexResult texres;
|
||||||
|
int textype;
|
||||||
|
|
||||||
|
if(is_normal) {
|
||||||
|
texres.nor = result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
texres.nor = NULL;
|
||||||
|
|
||||||
|
textype = multitex_thread(tex, coord, 0, 0, 0, &texres, thread, 0);
|
||||||
|
|
||||||
|
if(is_normal)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(textype & TEX_RGB) {
|
||||||
|
QUATCOPY(result, &texres.tr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QUATCOPY(result, col1);
|
||||||
|
ramp_blend(MA_RAMP_BLEND, result, result+1, result+2, texres.tin, col2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef void (*MapFn) (Tex *tex, bNodeStack **in, float *coord, short thread);
|
||||||
|
|
||||||
|
static void texfn(
|
||||||
|
float *result,
|
||||||
|
float *coord,
|
||||||
|
bNode *node,
|
||||||
|
bNodeStack **in,
|
||||||
|
char is_normal,
|
||||||
|
MapFn map_inputs,
|
||||||
|
short thread)
|
||||||
|
{
|
||||||
|
Tex tex = *((Tex*)(node->storage));
|
||||||
|
float col1[4], col2[4];
|
||||||
|
tex_input_rgba(col1, in[0], coord, thread);
|
||||||
|
tex_input_rgba(col2, in[1], coord, thread);
|
||||||
|
|
||||||
|
map_inputs(&tex, in, coord, thread);
|
||||||
|
|
||||||
|
do_proc(result, coord, col1, col2, is_normal, &tex, thread);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int count_outputs(bNode *node)
|
||||||
|
{
|
||||||
|
bNodeSocket *sock;
|
||||||
|
int num = 0;
|
||||||
|
for(sock= node->outputs.first; sock; sock= sock->next) {
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Boilerplate generators */
|
||||||
|
|
||||||
|
#define ProcNoInputs(name) \
|
||||||
|
static void name##_map_inputs(Tex *tex, bNodeStack **in, float *coord, short thread) \
|
||||||
|
{}
|
||||||
|
|
||||||
|
#define ProcDef(name) \
|
||||||
|
static void name##_colorfn(float *result, float *coord, bNode *node, bNodeStack **in, short thread) \
|
||||||
|
{ \
|
||||||
|
texfn(result, coord, node, in, 0, &name##_map_inputs, thread); \
|
||||||
|
} \
|
||||||
|
static void name##_normalfn(float *result, float *coord, bNode *node, bNodeStack **in, short thread) \
|
||||||
|
{ \
|
||||||
|
texfn(result, coord, node, in, 1, &name##_map_inputs, thread); \
|
||||||
|
} \
|
||||||
|
static void name##_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) \
|
||||||
|
{ \
|
||||||
|
int outs = count_outputs(node); \
|
||||||
|
if(outs >= 1) tex_output(node, in, out[0], &name##_colorfn); \
|
||||||
|
if(outs >= 2) tex_output(node, in, out[1], &name##_normalfn); \
|
||||||
|
if(outs >= 1) tex_do_preview(node, out[0], data); \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* --- VORONOI -- */
|
||||||
|
static bNodeSocketType voronoi_inputs[]= {
|
||||||
|
COMMON_INPUTS,
|
||||||
|
{ SOCK_VALUE, 1, "W1", 1.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f },
|
||||||
|
{ SOCK_VALUE, 1, "W2", 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f },
|
||||||
|
{ SOCK_VALUE, 1, "W3", 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f },
|
||||||
|
{ SOCK_VALUE, 1, "W4", 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f },
|
||||||
|
|
||||||
|
{ SOCK_VALUE, 1, "iScale", 1.0f, 0.0f, 0.0f, 0.0f, 0.01f, 10.0f },
|
||||||
|
{ SOCK_VALUE, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 4.0f },
|
||||||
|
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
static void voronoi_map_inputs(Tex *tex, bNodeStack **in, float *coord, short thread)
|
||||||
|
{
|
||||||
|
tex->vn_w1 = tex_input_value(in[I+0], coord, thread);
|
||||||
|
tex->vn_w2 = tex_input_value(in[I+1], coord, thread);
|
||||||
|
tex->vn_w3 = tex_input_value(in[I+2], coord, thread);
|
||||||
|
tex->vn_w4 = tex_input_value(in[I+3], coord, thread);
|
||||||
|
|
||||||
|
tex->ns_outscale = tex_input_value(in[I+4], coord, thread);
|
||||||
|
tex->noisesize = tex_input_value(in[I+5], coord, thread);
|
||||||
|
}
|
||||||
|
ProcDef(voronoi)
|
||||||
|
|
||||||
|
/* --- BLEND -- */
|
||||||
|
static bNodeSocketType blend_inputs[]= {
|
||||||
|
COMMON_INPUTS,
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
ProcNoInputs(blend)
|
||||||
|
ProcDef(blend)
|
||||||
|
|
||||||
|
/* -- MAGIC -- */
|
||||||
|
static bNodeSocketType magic_inputs[]= {
|
||||||
|
COMMON_INPUTS,
|
||||||
|
{ SOCK_VALUE, 1, "Turbulence", 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
static void magic_map_inputs(Tex *tex, bNodeStack **in, float *coord, short thread)
|
||||||
|
{
|
||||||
|
tex->turbul = tex_input_value(in[I+0], coord, thread);
|
||||||
|
}
|
||||||
|
ProcDef(magic)
|
||||||
|
|
||||||
|
/* --- MARBLE --- */
|
||||||
|
static bNodeSocketType marble_inputs[]= {
|
||||||
|
COMMON_INPUTS,
|
||||||
|
{ SOCK_VALUE, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f },
|
||||||
|
{ SOCK_VALUE, 1, "Turbulence", 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
static void marble_map_inputs(Tex *tex, bNodeStack **in, float *coord, short thread)
|
||||||
|
{
|
||||||
|
tex->noisesize = tex_input_value(in[I+0], coord, thread);
|
||||||
|
tex->turbul = tex_input_value(in[I+1], coord, thread);
|
||||||
|
}
|
||||||
|
ProcDef(marble)
|
||||||
|
|
||||||
|
/* --- CLOUDS --- */
|
||||||
|
static bNodeSocketType clouds_inputs[]= {
|
||||||
|
COMMON_INPUTS,
|
||||||
|
{ SOCK_VALUE, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
static void clouds_map_inputs(Tex *tex, bNodeStack **in, float *coord, short thread)
|
||||||
|
{
|
||||||
|
tex->noisesize = tex_input_value(in[I+0], coord, thread);
|
||||||
|
}
|
||||||
|
ProcDef(clouds)
|
||||||
|
|
||||||
|
/* --- DISTORTED NOISE --- */
|
||||||
|
static bNodeSocketType distnoise_inputs[]= {
|
||||||
|
COMMON_INPUTS,
|
||||||
|
{ SOCK_VALUE, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f },
|
||||||
|
{ SOCK_VALUE, 1, "Distortion", 1.00f, 0.0f, 0.0f, 0.0f, 0.0000f, 10.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
static void distnoise_map_inputs(Tex *tex, bNodeStack **in, float *coord, short thread)
|
||||||
|
{
|
||||||
|
tex->noisesize = tex_input_value(in[I+0], coord, thread);
|
||||||
|
tex->dist_amount = tex_input_value(in[I+1], coord, thread);
|
||||||
|
}
|
||||||
|
ProcDef(distnoise)
|
||||||
|
|
||||||
|
/* --- WOOD --- */
|
||||||
|
static bNodeSocketType wood_inputs[]= {
|
||||||
|
COMMON_INPUTS,
|
||||||
|
{ SOCK_VALUE, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f },
|
||||||
|
{ SOCK_VALUE, 1, "Turbulence", 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
static void wood_map_inputs(Tex *tex, bNodeStack **in, float *coord, short thread)
|
||||||
|
{
|
||||||
|
tex->noisesize = tex_input_value(in[I+0], coord, thread);
|
||||||
|
tex->turbul = tex_input_value(in[I+1], coord, thread);
|
||||||
|
}
|
||||||
|
ProcDef(wood)
|
||||||
|
|
||||||
|
/* --- MUSGRAVE --- */
|
||||||
|
static bNodeSocketType musgrave_inputs[]= {
|
||||||
|
COMMON_INPUTS,
|
||||||
|
{ SOCK_VALUE, 1, "H", 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f },
|
||||||
|
{ SOCK_VALUE, 1, "Lacunarity", 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 6.0f },
|
||||||
|
{ SOCK_VALUE, 1, "Octaves", 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 8.0f },
|
||||||
|
|
||||||
|
{ SOCK_VALUE, 1, "iScale", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f },
|
||||||
|
{ SOCK_VALUE, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
static void musgrave_map_inputs(Tex *tex, bNodeStack **in, float *coord, short thread)
|
||||||
|
{
|
||||||
|
tex->mg_H = tex_input_value(in[I+0], coord, thread);
|
||||||
|
tex->mg_lacunarity = tex_input_value(in[I+1], coord, thread);
|
||||||
|
tex->mg_octaves = tex_input_value(in[I+2], coord, thread);
|
||||||
|
tex->ns_outscale = tex_input_value(in[I+3], coord, thread);
|
||||||
|
tex->noisesize = tex_input_value(in[I+4], coord, thread);
|
||||||
|
}
|
||||||
|
ProcDef(musgrave)
|
||||||
|
|
||||||
|
/* --- NOISE --- */
|
||||||
|
static bNodeSocketType noise_inputs[]= {
|
||||||
|
COMMON_INPUTS,
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
ProcNoInputs(noise)
|
||||||
|
ProcDef(noise)
|
||||||
|
|
||||||
|
/* --- STUCCI --- */
|
||||||
|
static bNodeSocketType stucci_inputs[]= {
|
||||||
|
COMMON_INPUTS,
|
||||||
|
{ SOCK_VALUE, 1, "Size", 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f },
|
||||||
|
{ SOCK_VALUE, 1, "Turbulence", 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
static void stucci_map_inputs(Tex *tex, bNodeStack **in, float *coord, short thread)
|
||||||
|
{
|
||||||
|
tex->noisesize = tex_input_value(in[I+0], coord, thread);
|
||||||
|
tex->turbul = tex_input_value(in[I+1], coord, thread);
|
||||||
|
}
|
||||||
|
ProcDef(stucci)
|
||||||
|
|
||||||
|
/* --- */
|
||||||
|
|
||||||
|
static void init(bNode *node)
|
||||||
|
{
|
||||||
|
Tex *tex = MEM_callocN(sizeof(Tex), "Tex");
|
||||||
|
node->storage= tex;
|
||||||
|
|
||||||
|
default_tex(tex);
|
||||||
|
tex->type = node->type - TEX_NODE_PROC;
|
||||||
|
|
||||||
|
if(tex->type == TEX_WOOD)
|
||||||
|
tex->stype = TEX_BANDNOISE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Node type definitions */
|
||||||
|
#define TexDef(TEXTYPE, outputs, name, Name) \
|
||||||
|
{ NULL, NULL, TEX_NODE_PROC+TEXTYPE, Name, 140,80,140, NODE_CLASS_TEXTURE, \
|
||||||
|
NODE_OPTIONS | NODE_PREVIEW, name##_inputs, outputs, "Tex", name##_exec, NULL, init, \
|
||||||
|
node_free_standard_storage, node_copy_standard_storage, NULL }
|
||||||
|
|
||||||
|
#define C outputs_color_only
|
||||||
|
#define CV outputs_both
|
||||||
|
|
||||||
|
bNodeType tex_node_proc_voronoi = TexDef(TEX_VORONOI, CV, voronoi, "Voronoi" );
|
||||||
|
bNodeType tex_node_proc_blend = TexDef(TEX_BLEND, C, blend, "Blend" );
|
||||||
|
bNodeType tex_node_proc_magic = TexDef(TEX_MAGIC, C, magic, "Magic" );
|
||||||
|
bNodeType tex_node_proc_marble = TexDef(TEX_MARBLE, CV, marble, "Marble" );
|
||||||
|
bNodeType tex_node_proc_clouds = TexDef(TEX_CLOUDS, CV, clouds, "Clouds" );
|
||||||
|
bNodeType tex_node_proc_wood = TexDef(TEX_WOOD, CV, wood, "Wood" );
|
||||||
|
bNodeType tex_node_proc_musgrave = TexDef(TEX_MUSGRAVE, CV, musgrave, "Musgrave" );
|
||||||
|
bNodeType tex_node_proc_noise = TexDef(TEX_NOISE, C, noise, "Noise" );
|
||||||
|
bNodeType tex_node_proc_stucci = TexDef(TEX_STUCCI, CV, stucci, "Stucci" );
|
||||||
|
bNodeType tex_node_proc_distnoise = TexDef(TEX_DISTNOISE, CV, distnoise, "Distorted Noise" );
|
||||||
|
|
114
source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
Normal file
114
source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include "MTC_vectorops.h"
|
||||||
|
#include "../TEX_util.h"
|
||||||
|
|
||||||
|
static bNodeSocketType inputs[]= {
|
||||||
|
{ SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ SOCK_VALUE, 1, "Turns", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f },
|
||||||
|
{ SOCK_VECTOR, 1, "Axis", 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static bNodeSocketType outputs[]= {
|
||||||
|
{ SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void colorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
|
||||||
|
{
|
||||||
|
float new_coord[3];
|
||||||
|
|
||||||
|
float ax[4];
|
||||||
|
float para[3];
|
||||||
|
float perp[3];
|
||||||
|
float cp[3];
|
||||||
|
|
||||||
|
float magsq, ndx;
|
||||||
|
|
||||||
|
float a = tex_input_value(in[1], coord, thread);
|
||||||
|
float cos_a = cos(a * 2 * M_PI);
|
||||||
|
float sin_a = sin(a * 2 * M_PI);
|
||||||
|
|
||||||
|
// x' = xcosa + n(n.x)(1-cosa)+(x*n)sina
|
||||||
|
|
||||||
|
tex_input_vec(ax, in[2], coord, thread);
|
||||||
|
magsq = ax[0]*ax[0] + ax[1]*ax[1] + ax[2]*ax[2];
|
||||||
|
|
||||||
|
if(magsq == 0) magsq = 1;
|
||||||
|
|
||||||
|
ndx = MTC_dot3Float(coord, ax);
|
||||||
|
|
||||||
|
para[0] = ax[0] * ndx * (1 - cos_a);
|
||||||
|
para[1] = ax[1] * ndx * (1 - cos_a);
|
||||||
|
para[2] = ax[2] * ndx * (1 - cos_a);
|
||||||
|
|
||||||
|
MTC_diff3Float(perp, coord, para);
|
||||||
|
|
||||||
|
perp[0] = coord[0] * cos_a;
|
||||||
|
perp[1] = coord[1] * cos_a;
|
||||||
|
perp[2] = coord[2] * cos_a;
|
||||||
|
|
||||||
|
MTC_cross3Float(cp, ax, coord);
|
||||||
|
|
||||||
|
cp[0] = cp[0] * sin_a;
|
||||||
|
cp[1] = cp[1] * sin_a;
|
||||||
|
cp[2] = cp[2] * sin_a;
|
||||||
|
|
||||||
|
new_coord[0] = para[0] + perp[0] + cp[0];
|
||||||
|
new_coord[1] = para[1] + perp[1] + cp[1];
|
||||||
|
new_coord[2] = para[2] + perp[2] + cp[2];
|
||||||
|
|
||||||
|
tex_input_rgba(out, in[0], new_coord, thread);
|
||||||
|
}
|
||||||
|
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||||
|
{
|
||||||
|
tex_output(node, in, out[0], &colorfn);
|
||||||
|
|
||||||
|
tex_do_preview(node, out[0], data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bNodeType tex_node_rotate= {
|
||||||
|
/* *next,*prev */ NULL, NULL,
|
||||||
|
/* type code */ TEX_NODE_ROTATE,
|
||||||
|
/* name */ "Rotate",
|
||||||
|
/* width+range */ 90, 80, 100,
|
||||||
|
/* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS,
|
||||||
|
/* input sock */ inputs,
|
||||||
|
/* output sock */ outputs,
|
||||||
|
/* storage */ "",
|
||||||
|
/* execfunc */ exec,
|
||||||
|
/* butfunc */ NULL,
|
||||||
|
/* initfunc */ NULL,
|
||||||
|
/* freestoragefunc */ NULL,
|
||||||
|
/* copystoragefunc */ NULL,
|
||||||
|
/* id */ NULL
|
||||||
|
};
|
||||||
|
|
103
source/blender/nodes/intern/TEX_nodes/TEX_texture.c
Normal file
103
source/blender/nodes/intern/TEX_nodes/TEX_texture.c
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../TEX_util.h"
|
||||||
|
#include "RE_shader_ext.h"
|
||||||
|
|
||||||
|
static bNodeSocketType inputs[]= {
|
||||||
|
{ SOCK_RGBA, 1, "Color1", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f },
|
||||||
|
{ SOCK_RGBA, 1, "Color2", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static bNodeSocketType outputs[]= {
|
||||||
|
{ SOCK_RGBA, 0, "Color", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void colorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
|
||||||
|
{
|
||||||
|
static float red[] = {1,0,0,1};
|
||||||
|
static float white[] = {1,1,1,1};
|
||||||
|
|
||||||
|
Tex *nodetex = (Tex *)node->id;
|
||||||
|
|
||||||
|
if(node->custom2) {
|
||||||
|
/* this node refers to its own texture tree! */
|
||||||
|
QUATCOPY(
|
||||||
|
out,
|
||||||
|
(fabs(coord[0] - coord[1]) < .01) ? white : red
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if(nodetex) {
|
||||||
|
TexResult texres;
|
||||||
|
int textype;
|
||||||
|
float nor[] = {0,0,0};
|
||||||
|
float col1[4], col2[4];
|
||||||
|
|
||||||
|
tex_input_rgba(col1, in[0], coord, thread);
|
||||||
|
tex_input_rgba(col2, in[1], coord, thread);
|
||||||
|
|
||||||
|
texres.nor = nor;
|
||||||
|
textype = multitex_ext(nodetex, coord, 0, 0, 0, &texres);
|
||||||
|
|
||||||
|
if(textype & TEX_RGB) {
|
||||||
|
QUATCOPY(out, &texres.tr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QUATCOPY(out, col1);
|
||||||
|
ramp_blend(MA_RAMP_BLEND, out, out+1, out+2, texres.tin, col2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||||
|
{
|
||||||
|
tex_output(node, in, out[0], &colorfn);
|
||||||
|
|
||||||
|
tex_do_preview(node, out[0], data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bNodeType tex_node_texture= {
|
||||||
|
/* *next,*prev */ NULL, NULL,
|
||||||
|
/* type code */ TEX_NODE_TEXTURE,
|
||||||
|
/* name */ "Texture",
|
||||||
|
/* width+range */ 120, 80, 240,
|
||||||
|
/* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW,
|
||||||
|
/* input sock */ inputs,
|
||||||
|
/* output sock */ outputs,
|
||||||
|
/* storage */ "",
|
||||||
|
/* execfunc */ exec,
|
||||||
|
/* butfunc */ NULL,
|
||||||
|
/* initfunc */ NULL,
|
||||||
|
/* freestoragefunc */ NULL,
|
||||||
|
/* copystoragefunc */ NULL,
|
||||||
|
/* id */ NULL
|
||||||
|
|
||||||
|
};
|
||||||
|
|
78
source/blender/nodes/intern/TEX_nodes/TEX_translate.c
Normal file
78
source/blender/nodes/intern/TEX_nodes/TEX_translate.c
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include "../TEX_util.h"
|
||||||
|
|
||||||
|
static bNodeSocketType inputs[]= {
|
||||||
|
{ SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ SOCK_VECTOR, 1, "Offset", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static bNodeSocketType outputs[]= {
|
||||||
|
{ SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void colorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
|
||||||
|
{
|
||||||
|
float offset[3], new_coord[3];
|
||||||
|
|
||||||
|
tex_input_vec(offset, in[1], coord, thread);
|
||||||
|
|
||||||
|
new_coord[0] = coord[0] + offset[0];
|
||||||
|
new_coord[1] = coord[1] + offset[1];
|
||||||
|
new_coord[2] = coord[2] + offset[2];
|
||||||
|
|
||||||
|
tex_input_rgba(out, in[0], new_coord, thread);
|
||||||
|
}
|
||||||
|
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||||
|
{
|
||||||
|
tex_output(node, in, out[0], &colorfn);
|
||||||
|
|
||||||
|
tex_do_preview(node, out[0], data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bNodeType tex_node_translate = {
|
||||||
|
/* *next,*prev */ NULL, NULL,
|
||||||
|
/* type code */ TEX_NODE_TRANSLATE,
|
||||||
|
/* name */ "Translate",
|
||||||
|
/* width+range */ 90, 80, 100,
|
||||||
|
/* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS,
|
||||||
|
/* input sock */ inputs,
|
||||||
|
/* output sock */ outputs,
|
||||||
|
/* storage */ "",
|
||||||
|
/* execfunc */ exec,
|
||||||
|
/* butfunc */ NULL,
|
||||||
|
/* initfunc */ NULL,
|
||||||
|
/* freestoragefunc */ NULL,
|
||||||
|
/* copystoragefunc */ NULL,
|
||||||
|
/* id */ NULL
|
||||||
|
};
|
||||||
|
|
122
source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c
Normal file
122
source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
/**
|
||||||
|
* $Id: SHD_valToRgb.c 10456 2007-04-04 13:58:12Z jesterking $
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../TEX_util.h"
|
||||||
|
|
||||||
|
/* **************** VALTORGB ******************** */
|
||||||
|
static bNodeSocketType valtorgb_in[]= {
|
||||||
|
{ SOCK_VALUE, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
static bNodeSocketType valtorgb_out[]= {
|
||||||
|
{ SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void valtorgb_colorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
|
||||||
|
{
|
||||||
|
if(node->storage) {
|
||||||
|
float fac = tex_input_value(in[0], coord, thread);
|
||||||
|
|
||||||
|
do_colorband(node->storage, fac, out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void valtorgb_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||||
|
{
|
||||||
|
tex_output(node, in, out[0], &valtorgb_colorfn);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void valtorgb_init(bNode *node)
|
||||||
|
{
|
||||||
|
node->storage = add_colorband(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
bNodeType tex_node_valtorgb= {
|
||||||
|
/* *next,*prev */ NULL, NULL,
|
||||||
|
/* type code */ TEX_NODE_VALTORGB,
|
||||||
|
/* name */ "ColorRamp",
|
||||||
|
/* width+range */ 240, 200, 300,
|
||||||
|
/* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS,
|
||||||
|
/* input sock */ valtorgb_in,
|
||||||
|
/* output sock */ valtorgb_out,
|
||||||
|
/* storage */ "ColorBand",
|
||||||
|
/* execfunc */ valtorgb_exec,
|
||||||
|
/* butfunc */ NULL,
|
||||||
|
/* initfunc */ valtorgb_init,
|
||||||
|
/* freestoragefunc */ node_free_standard_storage,
|
||||||
|
/* copystoragefunc */ node_copy_standard_storage,
|
||||||
|
/* id */ NULL
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/* **************** RGBTOBW ******************** */
|
||||||
|
static bNodeSocketType rgbtobw_in[]= {
|
||||||
|
{ SOCK_RGBA, 1, "Color", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
static bNodeSocketType rgbtobw_out[]= {
|
||||||
|
{ SOCK_VALUE, 0, "Val", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static void rgbtobw_valuefn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
|
||||||
|
{
|
||||||
|
float cin[4];
|
||||||
|
tex_input_rgba(cin, in[0], coord, thread);
|
||||||
|
|
||||||
|
*out = cin[0] * 0.35f + cin[1] * 0.45f + cin[2] * 0.2f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rgbtobw_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||||
|
{
|
||||||
|
tex_output(node, in, out[0], &rgbtobw_valuefn);
|
||||||
|
|
||||||
|
tex_do_preview(node, out[0], data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bNodeType tex_node_rgbtobw= {
|
||||||
|
/* *next,*prev */ NULL, NULL,
|
||||||
|
/* type code */ TEX_NODE_RGBTOBW,
|
||||||
|
/* name */ "RGB to BW",
|
||||||
|
/* width+range */ 80, 40, 120,
|
||||||
|
/* class+opts */ NODE_CLASS_CONVERTOR, 0,
|
||||||
|
/* input sock */ rgbtobw_in,
|
||||||
|
/* output sock */ rgbtobw_out,
|
||||||
|
/* storage */ "",
|
||||||
|
/* execfunc */ rgbtobw_exec,
|
||||||
|
/* butfunc */ NULL,
|
||||||
|
/* initfunc */ NULL,
|
||||||
|
/* freestoragefunc */ NULL,
|
||||||
|
/* copystoragefunc */ NULL,
|
||||||
|
/* id */ NULL
|
||||||
|
|
||||||
|
};
|
||||||
|
|
61
source/blender/nodes/intern/TEX_nodes/TEX_viewer.c
Normal file
61
source/blender/nodes/intern/TEX_nodes/TEX_viewer.c
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../TEX_util.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
static bNodeSocketType inputs[]= {
|
||||||
|
{ SOCK_RGBA, 1, "Color", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
static bNodeSocketType outputs[]= {
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||||
|
{
|
||||||
|
tex_do_preview(node, in[0], data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bNodeType tex_node_viewer = {
|
||||||
|
/* *next,*prev */ NULL, NULL,
|
||||||
|
/* type code */ TEX_NODE_VIEWER,
|
||||||
|
/* name */ "Viewer",
|
||||||
|
/* width+range */ 100, 60, 150,
|
||||||
|
/* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW,
|
||||||
|
/* input sock */ inputs,
|
||||||
|
/* output sock */ outputs,
|
||||||
|
/* storage */ "",
|
||||||
|
/* execfunc */ exec,
|
||||||
|
/* butfunc */ NULL,
|
||||||
|
/* initfunc */ NULL,
|
||||||
|
/* freestoragefunc */ NULL,
|
||||||
|
/* copystoragefunc */ NULL,
|
||||||
|
/* id */ NULL
|
||||||
|
|
||||||
|
};
|
270
source/blender/nodes/intern/TEX_util.c
Normal file
270
source/blender/nodes/intern/TEX_util.c
Normal file
@ -0,0 +1,270 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
HOW TEXTURE NODES WORK
|
||||||
|
|
||||||
|
In contrast to Shader nodes, which place a colour into the output
|
||||||
|
stack when executed, Texture nodes place a TexDelegate* there. To
|
||||||
|
obtain a colour value from this, a node further up the chain reads
|
||||||
|
the TexDelegate* from its input stack, and uses tex_call_delegate to
|
||||||
|
retrieve the colour from the delegate.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include "TEX_util.h"
|
||||||
|
|
||||||
|
#define PREV_RES 128 /* default preview resolution */
|
||||||
|
|
||||||
|
void tex_call_delegate(TexDelegate *dg, float *out, float *coord, short thread)
|
||||||
|
{
|
||||||
|
dg->fn(out, coord, dg->node, dg->in, thread);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tex_input_vec(float *out, bNodeStack *in, float *coord, short thread)
|
||||||
|
{
|
||||||
|
TexDelegate *dg = in->data;
|
||||||
|
if(dg) {
|
||||||
|
tex_call_delegate(dg, out, coord, thread);
|
||||||
|
|
||||||
|
if(in->hasoutput && in->sockettype == SOCK_VALUE) {
|
||||||
|
out[1] = out[2] = out[0];
|
||||||
|
out[3] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QUATCOPY(out, in->vec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void tex_input_rgba(float *out, bNodeStack *in, float *coord, short thread)
|
||||||
|
{
|
||||||
|
tex_input_vec(out, in, coord, thread);
|
||||||
|
|
||||||
|
if(in->hasoutput && in->sockettype == SOCK_VECTOR) {
|
||||||
|
out[0] = out[0] * .5f + .5f;
|
||||||
|
out[1] = out[1] * .5f + .5f;
|
||||||
|
out[2] = out[2] * .5f + .5f;
|
||||||
|
out[3] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float tex_input_value(bNodeStack *in, float *coord, short thread)
|
||||||
|
{
|
||||||
|
float out[4];
|
||||||
|
tex_input_vec(out, in, coord, thread);
|
||||||
|
return out[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void init_preview(bNode *node)
|
||||||
|
{
|
||||||
|
int xsize = node->prvr.xmax - node->prvr.xmin;
|
||||||
|
int ysize = node->prvr.ymax - node->prvr.ymin;
|
||||||
|
|
||||||
|
if(xsize == 0) {
|
||||||
|
xsize = PREV_RES;
|
||||||
|
ysize = PREV_RES;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(node->preview==NULL)
|
||||||
|
node->preview= MEM_callocN(sizeof(bNodePreview), "node preview");
|
||||||
|
|
||||||
|
if(node->preview->rect)
|
||||||
|
if(node->preview->xsize!=xsize && node->preview->ysize!=ysize) {
|
||||||
|
MEM_freeN(node->preview->rect);
|
||||||
|
node->preview->rect= NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(node->preview->rect==NULL) {
|
||||||
|
node->preview->rect= MEM_callocN(4*xsize + xsize*ysize*sizeof(float)*4, "node preview rect");
|
||||||
|
node->preview->xsize= xsize;
|
||||||
|
node->preview->ysize= ysize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void tex_do_preview(bNode *node, bNodeStack *ns, TexCallData *cdata)
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
float *result;
|
||||||
|
bNodePreview *preview;
|
||||||
|
|
||||||
|
if(!cdata->do_preview)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!(node->typeinfo->flag & NODE_PREVIEW))
|
||||||
|
return;
|
||||||
|
|
||||||
|
init_preview(node);
|
||||||
|
|
||||||
|
preview = node->preview;
|
||||||
|
|
||||||
|
for(x=0; x<preview->xsize; x++)
|
||||||
|
for(y=0; y<preview->ysize; y++)
|
||||||
|
{
|
||||||
|
cdata->coord[0] = ((float) x / preview->xsize) * 2 - 1;
|
||||||
|
cdata->coord[1] = ((float) y / preview->ysize) * 2 - 1;
|
||||||
|
|
||||||
|
result = preview->rect + 4 * (preview->xsize*y + x);
|
||||||
|
|
||||||
|
tex_input_rgba(result, ns, cdata->coord, cdata->thread);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn)
|
||||||
|
{
|
||||||
|
TexDelegate *dg;
|
||||||
|
if(!out->data)
|
||||||
|
/* Freed in tex_end_exec (node.c) */
|
||||||
|
dg = out->data = MEM_mallocN(sizeof(TexDelegate), "tex delegate");
|
||||||
|
else
|
||||||
|
dg = out->data;
|
||||||
|
|
||||||
|
|
||||||
|
dg->fn = texfn;
|
||||||
|
dg->node = node;
|
||||||
|
memcpy(dg->in, in, MAX_SOCKET * sizeof(bNodeStack*));
|
||||||
|
dg->type = out->sockettype;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ntreeTexCheckCyclics(struct bNodeTree *ntree)
|
||||||
|
{
|
||||||
|
bNode *node;
|
||||||
|
for(node= ntree->nodes.first; node; node= node->next) {
|
||||||
|
|
||||||
|
if(node->type == TEX_NODE_TEXTURE && node->id)
|
||||||
|
{
|
||||||
|
/* custom2 stops the node from rendering */
|
||||||
|
if(node->custom1) {
|
||||||
|
node->custom2 = 1;
|
||||||
|
node->custom1 = 0;
|
||||||
|
} else {
|
||||||
|
Tex *tex = (Tex *)node->id;
|
||||||
|
|
||||||
|
node->custom2 = 0;
|
||||||
|
|
||||||
|
node->custom1 = 1;
|
||||||
|
if(tex->use_nodes && tex->nodetree) {
|
||||||
|
ntreeTexCheckCyclics(tex->nodetree);
|
||||||
|
}
|
||||||
|
node->custom1 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ntreeTexExecTree(bNodeTree *nodes, TexResult *texres, float *coord, char do_preview, short thread, Tex *tex, short which_output)
|
||||||
|
{
|
||||||
|
TexResult dummy_texres;
|
||||||
|
TexCallData data;
|
||||||
|
|
||||||
|
if(!texres) texres = &dummy_texres;
|
||||||
|
data.coord = coord;
|
||||||
|
data.target = texres;
|
||||||
|
data.do_preview = do_preview;
|
||||||
|
data.thread = thread;
|
||||||
|
data.which_output = which_output;
|
||||||
|
|
||||||
|
ntreeExecTree(nodes, &data, thread);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ntreeTexUpdatePreviews(bNodeTree* nodetree)
|
||||||
|
{
|
||||||
|
Tex *tex;
|
||||||
|
float coord[] = {0,0,0};
|
||||||
|
TexResult dummy_texres;
|
||||||
|
|
||||||
|
for(tex= G.main->tex.first; tex; tex= tex->id.next)
|
||||||
|
if(tex->nodetree == nodetree) break;
|
||||||
|
if(!tex) return;
|
||||||
|
|
||||||
|
dummy_texres.nor = 0;
|
||||||
|
|
||||||
|
ntreeBeginExecTree(nodetree);
|
||||||
|
ntreeTexExecTree(nodetree, &dummy_texres, coord, 1, 0, tex, 0);
|
||||||
|
ntreeEndExecTree(nodetree);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
char* ntreeTexOutputMenu(bNodeTree *ntree)
|
||||||
|
{
|
||||||
|
bNode *node;
|
||||||
|
int len = 1;
|
||||||
|
char *str;
|
||||||
|
char ctrl[4];
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
for(node= ntree->nodes.first; node; node= node->next)
|
||||||
|
if(node->type == TEX_NODE_OUTPUT) {
|
||||||
|
len += strlen(
|
||||||
|
((TexNodeOutput*)node->storage)->name
|
||||||
|
) + strlen(" %xNNN|");
|
||||||
|
index ++;
|
||||||
|
|
||||||
|
if(node->custom1 > 999) {
|
||||||
|
printf("Error: too many outputs");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
str = malloc(len * sizeof(char));
|
||||||
|
*str = 0;
|
||||||
|
|
||||||
|
for(node= ntree->nodes.first; node; node= node->next)
|
||||||
|
if(node->type == TEX_NODE_OUTPUT) {
|
||||||
|
strcat(str, ((TexNodeOutput*)node->storage)->name);
|
||||||
|
strcat(str, " %x");
|
||||||
|
|
||||||
|
sprintf(ctrl, "%d", node->custom1);
|
||||||
|
strcat(str, ctrl);
|
||||||
|
|
||||||
|
if(--index)
|
||||||
|
strcat(str, "|");
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ntreeTexAssignIndex(struct bNodeTree *ntree, struct bNode *node)
|
||||||
|
{
|
||||||
|
bNode *tnode;
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
check_index:
|
||||||
|
for(tnode= ntree->nodes.first; tnode; tnode= tnode->next)
|
||||||
|
if(tnode->type == TEX_NODE_OUTPUT && tnode != node)
|
||||||
|
if(tnode->custom1 == index) {
|
||||||
|
index ++;
|
||||||
|
goto check_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
node->custom1 = index;
|
||||||
|
}
|
||||||
|
|
104
source/blender/nodes/intern/TEX_util.h
Normal file
104
source/blender/nodes/intern/TEX_util.h
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): none yet.
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TEX_NODE_UTIL_H_
|
||||||
|
#define TEX_NODE_UTIL_H_
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
|
#include "DNA_action_types.h"
|
||||||
|
#include "DNA_color_types.h"
|
||||||
|
#include "DNA_ipo_types.h"
|
||||||
|
#include "DNA_ID.h"
|
||||||
|
#include "DNA_image_types.h"
|
||||||
|
#include "DNA_material_types.h"
|
||||||
|
#include "DNA_node_types.h"
|
||||||
|
#include "DNA_object_types.h"
|
||||||
|
#include "DNA_scene_types.h"
|
||||||
|
#include "DNA_space_types.h"
|
||||||
|
#include "DNA_screen_types.h"
|
||||||
|
#include "DNA_texture_types.h"
|
||||||
|
#include "DNA_userdef_types.h"
|
||||||
|
|
||||||
|
#include "BKE_blender.h"
|
||||||
|
#include "BKE_colortools.h"
|
||||||
|
#include "BKE_global.h"
|
||||||
|
#include "BKE_image.h"
|
||||||
|
#include "BKE_main.h"
|
||||||
|
#include "BKE_material.h"
|
||||||
|
#include "BKE_texture.h"
|
||||||
|
#include "BKE_utildefines.h"
|
||||||
|
#include "BKE_library.h"
|
||||||
|
|
||||||
|
#include "../SHD_node.h"
|
||||||
|
#include "node_util.h"
|
||||||
|
|
||||||
|
#include "BLI_arithb.h"
|
||||||
|
#include "BLI_blenlib.h"
|
||||||
|
#include "BLI_rand.h"
|
||||||
|
#include "BLI_threads.h"
|
||||||
|
|
||||||
|
#include "IMB_imbuf_types.h"
|
||||||
|
#include "IMB_imbuf.h"
|
||||||
|
|
||||||
|
#include "RE_pipeline.h"
|
||||||
|
#include "RE_shader_ext.h"
|
||||||
|
|
||||||
|
typedef struct TexCallData {
|
||||||
|
TexResult *target;
|
||||||
|
float *coord;
|
||||||
|
char do_preview;
|
||||||
|
short thread;
|
||||||
|
short which_output;
|
||||||
|
} TexCallData;
|
||||||
|
|
||||||
|
typedef void(*TexFn) (float *out, float *coord, bNode *node, bNodeStack **in, short thread);
|
||||||
|
|
||||||
|
typedef struct TexDelegate {
|
||||||
|
TexFn fn;
|
||||||
|
bNode *node;
|
||||||
|
bNodeStack *in[MAX_SOCKET];
|
||||||
|
int type;
|
||||||
|
} TexDelegate;
|
||||||
|
|
||||||
|
void tex_call_delegate(TexDelegate*, float *out, float *coord, short thread);
|
||||||
|
|
||||||
|
void tex_input_rgba(float *out, bNodeStack *in, float *coord, short thread);
|
||||||
|
void tex_input_vec(float *out, bNodeStack *in, float *coord, short thread);
|
||||||
|
float tex_input_value(bNodeStack *in, float *coord, short thread);
|
||||||
|
|
||||||
|
void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn);
|
||||||
|
void tex_do_preview(bNode *node, bNodeStack *ns, TexCallData *cdata);
|
||||||
|
|
||||||
|
void ntreeTexUpdatePreviews( bNodeTree* nodetree );
|
||||||
|
void ntreeTexExecTree(bNodeTree *nodes, TexResult *texres, float *coord, char do_preview, short thread, struct Tex *tex, short which_output);
|
||||||
|
|
||||||
|
#endif
|
@ -6,7 +6,7 @@ sources = env.Glob('intern/source/*.c')
|
|||||||
|
|
||||||
incs = 'intern/include #/intern/guardedalloc ../blenlib ../makesdna'
|
incs = 'intern/include #/intern/guardedalloc ../blenlib ../makesdna'
|
||||||
incs += ' extern/include ../blenkernel ../radiosity/extern/include ../imbuf'
|
incs += ' extern/include ../blenkernel ../radiosity/extern/include ../imbuf'
|
||||||
incs += ' ../quicktime ../include ../../kernel/gen_messaging ../blenloader'
|
incs += ' ../include ../blenloader'
|
||||||
|
|
||||||
defs = []
|
defs = []
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ else:
|
|||||||
|
|
||||||
if env['WITH_BF_QUICKTIME']:
|
if env['WITH_BF_QUICKTIME']:
|
||||||
defs.append('WITH_QUICKTIME')
|
defs.append('WITH_QUICKTIME')
|
||||||
incs += ' ' + env['BF_QUICKTIME_INC']
|
incs += ' ../quicktime ' + env['BF_QUICKTIME_INC']
|
||||||
|
|
||||||
if env['WITH_BF_FFMPEG']:
|
if env['WITH_BF_FFMPEG']:
|
||||||
defs.append('WITH_FFMPEG')
|
defs.append('WITH_FFMPEG')
|
||||||
|
@ -183,6 +183,7 @@ typedef struct ShadeInput
|
|||||||
/* node shaders... */
|
/* node shaders... */
|
||||||
struct Tex;
|
struct Tex;
|
||||||
int multitex_ext(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres);
|
int multitex_ext(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres);
|
||||||
|
int multitex_thread(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres, short thread, short which_output);
|
||||||
|
|
||||||
/* shaded view and bake */
|
/* shaded view and bake */
|
||||||
struct Render;
|
struct Render;
|
||||||
|
@ -53,8 +53,8 @@ int shadeHaloFloat(HaloRen *har,
|
|||||||
/**
|
/**
|
||||||
* Render the sky at pixel (x, y).
|
* Render the sky at pixel (x, y).
|
||||||
*/
|
*/
|
||||||
void shadeSkyPixel(float *collector, float fx, float fy);
|
void shadeSkyPixel(float *collector, float fx, float fy, short thread);
|
||||||
void shadeSkyView(float *colf, float *rco, float *view, float *dxyview);
|
void shadeSkyView(float *colf, float *rco, float *view, float *dxyview, short thread);
|
||||||
void shadeAtmPixel(struct SunSky *sunsky, float *collector, float fx, float fy, float distance);
|
void shadeAtmPixel(struct SunSky *sunsky, float *collector, float fx, float fy, float distance);
|
||||||
void shadeSunView(float *colf, float *view);
|
void shadeSunView(float *colf, float *view);
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
@ -53,11 +53,12 @@ struct ImBuf;
|
|||||||
/* texture.h */
|
/* texture.h */
|
||||||
|
|
||||||
void do_halo_tex(struct HaloRen *har, float xn, float yn, float *colf);
|
void do_halo_tex(struct HaloRen *har, float xn, float yn, float *colf);
|
||||||
void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag);
|
void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag, short thread);
|
||||||
void do_material_tex(struct ShadeInput *shi);
|
void do_material_tex(struct ShadeInput *shi);
|
||||||
void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf, int effect);
|
void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf, int effect);
|
||||||
|
|
||||||
void init_render_textures(Render *re);
|
void init_render_textures(Render *re);
|
||||||
|
void end_render_textures(void);
|
||||||
|
|
||||||
void render_realtime_texture(struct ShadeInput *shi, struct Image *ima);
|
void render_realtime_texture(struct ShadeInput *shi, struct Image *ima);
|
||||||
|
|
||||||
|
@ -2272,6 +2272,7 @@ static void displace_render_face(Render *re, ObjectRen *obr, VlakRen *vlr, float
|
|||||||
|
|
||||||
shi.vlr= vlr; /* current render face */
|
shi.vlr= vlr; /* current render face */
|
||||||
shi.mat= vlr->mat; /* current input material */
|
shi.mat= vlr->mat; /* current input material */
|
||||||
|
shi.thread= 0;
|
||||||
|
|
||||||
/* Displace the verts, flag is set when done */
|
/* Displace the verts, flag is set when done */
|
||||||
if (!vlr->v1->flag)
|
if (!vlr->v1->flag)
|
||||||
@ -4407,6 +4408,7 @@ void RE_Database_Free(Render *re)
|
|||||||
|
|
||||||
end_radio_render();
|
end_radio_render();
|
||||||
end_render_materials();
|
end_render_materials();
|
||||||
|
end_render_textures();
|
||||||
|
|
||||||
if(re->wrld.aosphere) {
|
if(re->wrld.aosphere) {
|
||||||
MEM_freeN(re->wrld.aosphere);
|
MEM_freeN(re->wrld.aosphere);
|
||||||
|
@ -511,7 +511,7 @@ static void fillBackgroundImage(float *collector, float fx, float fy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Only view vector is important here. Result goes to colf[3] */
|
/* Only view vector is important here. Result goes to colf[3] */
|
||||||
void shadeSkyView(float *colf, float *rco, float *view, float *dxyview)
|
void shadeSkyView(float *colf, float *rco, float *view, float *dxyview, short thread)
|
||||||
{
|
{
|
||||||
float lo[3], zen[3], hor[3], blend, blendm;
|
float lo[3], zen[3], hor[3], blend, blendm;
|
||||||
int skyflag;
|
int skyflag;
|
||||||
@ -550,7 +550,7 @@ void shadeSkyView(float *colf, float *rco, float *view, float *dxyview)
|
|||||||
SWAP(float, lo[1], lo[2]);
|
SWAP(float, lo[1], lo[2]);
|
||||||
|
|
||||||
}
|
}
|
||||||
do_sky_tex(rco, lo, dxyview, hor, zen, &blend, skyflag);
|
do_sky_tex(rco, lo, dxyview, hor, zen, &blend, skyflag, thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(blend>1.0) blend= 1.0;
|
if(blend>1.0) blend= 1.0;
|
||||||
@ -607,7 +607,7 @@ void shadeSunView(float *colf, float *view)
|
|||||||
/*
|
/*
|
||||||
Stuff the sky color into the collector.
|
Stuff the sky color into the collector.
|
||||||
*/
|
*/
|
||||||
void shadeSkyPixel(float *collector, float fx, float fy)
|
void shadeSkyPixel(float *collector, float fx, float fy, short thread)
|
||||||
{
|
{
|
||||||
float view[3], dxyview[2];
|
float view[3], dxyview[2];
|
||||||
|
|
||||||
@ -653,7 +653,7 @@ void shadeSkyPixel(float *collector, float fx, float fy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* get sky color in the collector */
|
/* get sky color in the collector */
|
||||||
shadeSkyView(collector, NULL, view, dxyview);
|
shadeSkyView(collector, NULL, view, dxyview, thread);
|
||||||
collector[3] = 0.0f;
|
collector[3] = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ static void ray_fadeout_endcolor(float *col, ShadeInput *origshi, ShadeInput *sh
|
|||||||
VECCOPY(shi->view, vec);
|
VECCOPY(shi->view, vec);
|
||||||
Normalize(shi->view);
|
Normalize(shi->view);
|
||||||
|
|
||||||
shadeSkyView(col, isec->start, shi->view, NULL);
|
shadeSkyView(col, isec->start, shi->view, NULL, shi->thread);
|
||||||
shadeSunView(col, shi->view);
|
shadeSunView(col, shi->view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1627,7 +1627,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *shadfac)
|
|||||||
shadfac[2]+= (1.0f-skyfac)*R.wrld.horb + skyfac*R.wrld.zenb;
|
shadfac[2]+= (1.0f-skyfac)*R.wrld.horb + skyfac*R.wrld.zenb;
|
||||||
}
|
}
|
||||||
else { /* WO_AOSKYTEX */
|
else { /* WO_AOSKYTEX */
|
||||||
shadeSkyView(skycol, isec.start, view, dxyview);
|
shadeSkyView(skycol, isec.start, view, dxyview, shi->thread);
|
||||||
shadeSunView(skycol, shi->view);
|
shadeSunView(skycol, shi->view);
|
||||||
shadfac[0]+= skycol[0];
|
shadfac[0]+= skycol[0];
|
||||||
shadfac[1]+= skycol[1];
|
shadfac[1]+= skycol[1];
|
||||||
@ -1752,7 +1752,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *shadfac)
|
|||||||
shadfac[2]+= (1.0f-fac)*R.wrld.horb + fac*R.wrld.zenb;
|
shadfac[2]+= (1.0f-fac)*R.wrld.horb + fac*R.wrld.zenb;
|
||||||
}
|
}
|
||||||
else { /* WO_AOSKYTEX */
|
else { /* WO_AOSKYTEX */
|
||||||
shadeSkyView(skycol, isec.start, view, dxyview);
|
shadeSkyView(skycol, isec.start, view, dxyview, shi->thread);
|
||||||
shadeSunView(skycol, shi->view);
|
shadeSunView(skycol, shi->view);
|
||||||
shadfac[0]+= skycol[0];
|
shadfac[0]+= skycol[0];
|
||||||
shadfac[1]+= skycol[1];
|
shadfac[1]+= skycol[1];
|
||||||
|
@ -647,7 +647,7 @@ static void sky_tile(RenderPart *pa, RenderLayer *rl)
|
|||||||
if(pass[3]<1.0f) {
|
if(pass[3]<1.0f) {
|
||||||
|
|
||||||
if(done==0) {
|
if(done==0) {
|
||||||
shadeSkyPixel(col, x, y);
|
shadeSkyPixel(col, x, y, pa->thread);
|
||||||
done= 1;
|
done= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,11 +43,13 @@
|
|||||||
#include "DNA_meshdata_types.h"
|
#include "DNA_meshdata_types.h"
|
||||||
#include "DNA_material_types.h"
|
#include "DNA_material_types.h"
|
||||||
#include "DNA_image_types.h"
|
#include "DNA_image_types.h"
|
||||||
|
#include "DNA_node_types.h"
|
||||||
|
|
||||||
#include "IMB_imbuf_types.h"
|
#include "IMB_imbuf_types.h"
|
||||||
#include "IMB_imbuf.h"
|
#include "IMB_imbuf.h"
|
||||||
|
|
||||||
#include "BKE_image.h"
|
#include "BKE_image.h"
|
||||||
|
#include "BKE_node.h"
|
||||||
#include "BKE_plugin_types.h"
|
#include "BKE_plugin_types.h"
|
||||||
#include "BKE_utildefines.h"
|
#include "BKE_utildefines.h"
|
||||||
|
|
||||||
@ -114,6 +116,10 @@ void init_render_texture(Render *re, Tex *tex)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(tex->nodetree && tex->use_nodes) {
|
||||||
|
ntreeBeginExecTree(tex->nodetree); /* has internal flag to detect it only does it once */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
@ -129,6 +135,20 @@ void init_render_textures(Render *re)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void end_render_texture(Tex *tex)
|
||||||
|
{
|
||||||
|
if(tex && tex->use_nodes && tex->nodetree)
|
||||||
|
ntreeEndExecTree(tex->nodetree);
|
||||||
|
}
|
||||||
|
|
||||||
|
void end_render_textures(void)
|
||||||
|
{
|
||||||
|
Tex *tex;
|
||||||
|
for(tex= G.main->tex.first; tex; tex= tex->id.next)
|
||||||
|
if(tex->id.us)
|
||||||
|
end_render_texture(tex);
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
@ -691,6 +711,19 @@ static float voronoiTex(Tex *tex, float *texvec, TexResult *texres)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
static int evalnodes(Tex *tex, float *texvec, TexResult *texres, short thread, short which_output)
|
||||||
|
{
|
||||||
|
short rv = TEX_INT;
|
||||||
|
bNodeTree *nodes = tex->nodetree;
|
||||||
|
|
||||||
|
ntreeTexExecTree(nodes, texres, texvec, 0, thread, tex, which_output);
|
||||||
|
|
||||||
|
if(texres->nor) rv |= TEX_NOR;
|
||||||
|
rv |= TEX_RGB;
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
@ -1130,13 +1163,17 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
|
|||||||
|
|
||||||
/* ************************************** */
|
/* ************************************** */
|
||||||
|
|
||||||
static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres)
|
static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres, short thread, short which_output)
|
||||||
{
|
{
|
||||||
float tmpvec[3];
|
float tmpvec[3];
|
||||||
int retval=0; /* return value, int:0, col:1, nor:2, everything:3 */
|
int retval=0; /* return value, int:0, col:1, nor:2, everything:3 */
|
||||||
|
|
||||||
texres->talpha= 0; /* is set when image texture returns alpha (considered premul) */
|
texres->talpha= 0; /* is set when image texture returns alpha (considered premul) */
|
||||||
|
|
||||||
|
if(tex->use_nodes && tex->nodetree) {
|
||||||
|
retval = evalnodes(tex, texvec, texres, thread, which_output);
|
||||||
|
}
|
||||||
|
else
|
||||||
switch(tex->type) {
|
switch(tex->type) {
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
@ -1236,7 +1273,11 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex,
|
|||||||
* the color values are set before using the r/g/b values, otherwise you may use uninitialized values - Campbell */
|
* the color values are set before using the r/g/b values, otherwise you may use uninitialized values - Campbell */
|
||||||
int multitex_ext(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres)
|
int multitex_ext(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres)
|
||||||
{
|
{
|
||||||
|
return multitex_thread(tex, texvec, dxt, dyt, osatex, texres, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int multitex_thread(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres, short thread, short which_output)
|
||||||
|
{
|
||||||
if(tex==NULL) {
|
if(tex==NULL) {
|
||||||
memset(texres, 0, sizeof(TexResult));
|
memset(texres, 0, sizeof(TexResult));
|
||||||
return 0;
|
return 0;
|
||||||
@ -1264,10 +1305,10 @@ int multitex_ext(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, Te
|
|||||||
|
|
||||||
do_2d_mapping(&mtex, texvec_l, NULL, NULL, dxt_l, dyt_l);
|
do_2d_mapping(&mtex, texvec_l, NULL, NULL, dxt_l, dyt_l);
|
||||||
|
|
||||||
return multitex(tex, texvec_l, dxt_l, dyt_l, osatex, texres);
|
return multitex(tex, texvec_l, dxt_l, dyt_l, osatex, texres, thread, which_output);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return multitex(tex, texvec, dxt, dyt, osatex, texres);
|
return multitex(tex, texvec, dxt, dyt, osatex, texres, thread, which_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
@ -1671,7 +1712,7 @@ void do_material_tex(ShadeInput *shi)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rgbnor= multitex(tex, texvec, dxt, dyt, shi->osatex, &texres);
|
rgbnor= multitex(tex, texvec, dxt, dyt, shi->osatex, &texres, shi->thread, mtex->which_output);
|
||||||
|
|
||||||
/* texture output */
|
/* texture output */
|
||||||
|
|
||||||
@ -2055,7 +2096,7 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float *colf)
|
|||||||
|
|
||||||
if(mtex->tex->type==TEX_IMAGE) do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
|
if(mtex->tex->type==TEX_IMAGE) do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
|
||||||
|
|
||||||
rgb= multitex(mtex->tex, texvec, dxt, dyt, osatex, &texres);
|
rgb= multitex(mtex->tex, texvec, dxt, dyt, osatex, &texres, 0, mtex->which_output);
|
||||||
|
|
||||||
/* texture output */
|
/* texture output */
|
||||||
if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
||||||
@ -2126,7 +2167,7 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float *colf)
|
|||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* hor and zen are RGB vectors, blend is 1 float, should all be initialized */
|
/* hor and zen are RGB vectors, blend is 1 float, should all be initialized */
|
||||||
void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag)
|
void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag, short thread)
|
||||||
{
|
{
|
||||||
MTex *mtex;
|
MTex *mtex;
|
||||||
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
|
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
|
||||||
@ -2226,7 +2267,7 @@ void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, f
|
|||||||
/* texture */
|
/* texture */
|
||||||
if(mtex->tex->type==TEX_IMAGE) do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
|
if(mtex->tex->type==TEX_IMAGE) do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
|
||||||
|
|
||||||
rgb= multitex(mtex->tex, texvec, dxt, dyt, R.osa, &texres);
|
rgb= multitex(mtex->tex, texvec, dxt, dyt, R.osa, &texres, thread, mtex->which_output);
|
||||||
|
|
||||||
/* texture output */
|
/* texture output */
|
||||||
if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
||||||
@ -2407,7 +2448,7 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef
|
|||||||
do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
|
do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
|
||||||
}
|
}
|
||||||
|
|
||||||
rgb= multitex(tex, texvec, dxt, dyt, shi->osatex, &texres);
|
rgb= multitex(tex, texvec, dxt, dyt, shi->osatex, &texres, shi->thread, mtex->which_output);
|
||||||
|
|
||||||
/* texture output */
|
/* texture output */
|
||||||
if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
||||||
@ -2492,7 +2533,7 @@ int externtex(MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *t
|
|||||||
do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
|
do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
|
||||||
}
|
}
|
||||||
|
|
||||||
rgb= multitex(tex, texvec, dxt, dyt, 0, &texr);
|
rgb= multitex(tex, texvec, dxt, dyt, 0, &texr, 0, mtex->which_output);
|
||||||
|
|
||||||
if(rgb) {
|
if(rgb) {
|
||||||
texr.tin= (0.35*texr.tr+0.45*texr.tg+0.2*texr.tb);
|
texr.tin= (0.35*texr.tr+0.45*texr.tg+0.2*texr.tb);
|
||||||
|
@ -23,22 +23,22 @@ incs = ' #/intern/guardedalloc #/intern/memutil'
|
|||||||
incs += ' ../blenlib ../makesdna ../blenkernel'
|
incs += ' ../blenlib ../makesdna ../blenkernel'
|
||||||
incs += ' ../include #/intern/bmfont ../imbuf ../render/extern/include'
|
incs += ' ../include #/intern/bmfont ../imbuf ../render/extern/include'
|
||||||
incs += ' #/intern/bsp/extern ../radiosity/extern/include'
|
incs += ' #/intern/bsp/extern ../radiosity/extern/include'
|
||||||
incs += ' #/intern/decimation/extern ../blenloader ../python'
|
incs += ' #/intern/decimation/extern ../blenloader'
|
||||||
incs += ' ../../kernel/gen_system #/intern/SoundSystem ../readstreamglue ../nodes'
|
incs += ' ../../kernel/gen_system #/intern/SoundSystem ../readstreamglue ../nodes'
|
||||||
incs += ' ../quicktime #/intern/elbeem/extern'
|
incs += ' #/intern/elbeem/extern'
|
||||||
incs += ' #/intern/ghost #/intern/opennl/extern'
|
incs += ' #/intern/ghost #/intern/opennl/extern'
|
||||||
incs += ' ../gpu #extern/glew/include'
|
incs += ' ../gpu #extern/glew/include'
|
||||||
|
|
||||||
|
|
||||||
incs += ' ' + env['BF_PYTHON_INC']
|
|
||||||
incs += ' ' + env['BF_SDL_INC']
|
|
||||||
incs += ' ' + env['BF_OPENGL_INC']
|
incs += ' ' + env['BF_OPENGL_INC']
|
||||||
|
|
||||||
defs = []
|
defs = []
|
||||||
|
|
||||||
if not env['WITH_BF_PYTHON']:
|
if env['WITH_BF_PYTHON']:
|
||||||
|
incs += ' ../python ' + env['BF_PYTHON_INC']
|
||||||
|
else:
|
||||||
defs.append('DISABLE_PYTHON')
|
defs.append('DISABLE_PYTHON')
|
||||||
|
|
||||||
|
|
||||||
if env['BF_TWEAK_MODE']:
|
if env['BF_TWEAK_MODE']:
|
||||||
defs.append('TWEAK_MODE')
|
defs.append('TWEAK_MODE')
|
||||||
|
|
||||||
@ -61,9 +61,13 @@ if env['WITH_BF_QUICKTIME']:
|
|||||||
defs.append('WITH_QUICKTIME')
|
defs.append('WITH_QUICKTIME')
|
||||||
|
|
||||||
if env['WITH_BF_ICONV']:
|
if env['WITH_BF_ICONV']:
|
||||||
|
incs += ' ../quicktime'
|
||||||
incs += ' ' + env['BF_ICONV_INC']
|
incs += ' ' + env['BF_ICONV_INC']
|
||||||
defs.append('WITH_ICONV')
|
defs.append('WITH_ICONV')
|
||||||
|
|
||||||
|
if env['WITH_BF_GAMEENGINE']:
|
||||||
|
defs.append('GAMEBLENDER=1')
|
||||||
|
|
||||||
if env['WITH_BF_FFMPEG']:
|
if env['WITH_BF_FFMPEG']:
|
||||||
defs.append('WITH_FFMPEG')
|
defs.append('WITH_FFMPEG')
|
||||||
incs += ' ' + env['BF_FFMPEG_INC']
|
incs += ' ' + env['BF_FFMPEG_INC']
|
||||||
@ -85,7 +89,9 @@ if env['BF_BUILDINFO']:
|
|||||||
if env['BF_NO_ELBEEM']:
|
if env['BF_NO_ELBEEM']:
|
||||||
defs.append('DISABLE_ELBEEM')
|
defs.append('DISABLE_ELBEEM')
|
||||||
|
|
||||||
if not env['WITH_BF_SDL']:
|
if env['WITH_BF_SDL']:
|
||||||
|
incs += ' ' + env['BF_SDL_INC']
|
||||||
|
else:
|
||||||
defs.append('DISABLE_SDL')
|
defs.append('DISABLE_SDL')
|
||||||
|
|
||||||
if env['BF_SPLIT_SRC'] and (env['OURPLATFORM'] == 'win32-mingw'):
|
if env['BF_SPLIT_SRC'] and (env['OURPLATFORM'] == 'win32-mingw'):
|
||||||
|
@ -511,7 +511,8 @@ void curvemap_buttons(uiBlock *block, CurveMapping *cumap, char labeltype, short
|
|||||||
static void do_node_buts(unsigned short event)
|
static void do_node_buts(unsigned short event)
|
||||||
{
|
{
|
||||||
Material *ma;
|
Material *ma;
|
||||||
|
SpaceNode *snode = curarea->spacedata.first;
|
||||||
|
|
||||||
/* all operations default on active material layer here */
|
/* all operations default on active material layer here */
|
||||||
/* but this also gets called for lamp and world... */
|
/* but this also gets called for lamp and world... */
|
||||||
ma= G.buts->lockpoin;
|
ma= G.buts->lockpoin;
|
||||||
@ -523,6 +524,7 @@ static void do_node_buts(unsigned short event)
|
|||||||
if(event>=B_NODE_EXEC) {
|
if(event>=B_NODE_EXEC) {
|
||||||
if(ma) end_render_material(ma); /// temporal... 3d preview
|
if(ma) end_render_material(ma); /// temporal... 3d preview
|
||||||
BIF_preview_changed(ID_MA);
|
BIF_preview_changed(ID_MA);
|
||||||
|
BIF_preview_changed(ID_TE);
|
||||||
allqueue(REDRAWNODE, 0);
|
allqueue(REDRAWNODE, 0);
|
||||||
allqueue(REDRAWBUTSSHADING, 0);
|
allqueue(REDRAWBUTSSHADING, 0);
|
||||||
}
|
}
|
||||||
|
@ -286,6 +286,7 @@ void do_texbuts(unsigned short event)
|
|||||||
scrarea_queue_headredraw(curarea);
|
scrarea_queue_headredraw(curarea);
|
||||||
BIF_preview_changed(ID_TE);
|
BIF_preview_changed(ID_TE);
|
||||||
allqueue(REDRAWBUTSSHADING, 0);
|
allqueue(REDRAWBUTSSHADING, 0);
|
||||||
|
allqueue(REDRAWNODE, 0);
|
||||||
if(G.buts->texfrom == 3) /* brush texture */
|
if(G.buts->texfrom == 3) /* brush texture */
|
||||||
allqueue(REDRAWIMAGE, 0);
|
allqueue(REDRAWIMAGE, 0);
|
||||||
break;
|
break;
|
||||||
@ -414,6 +415,16 @@ void do_texbuts(unsigned short event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case B_TEX_USENODES:
|
||||||
|
if(tex->use_nodes && tex->nodetree==NULL) {
|
||||||
|
node_texture_default(tex);
|
||||||
|
}
|
||||||
|
tex->type = 0;
|
||||||
|
BIF_preview_changed(ID_TE);
|
||||||
|
allqueue(REDRAWNODE, 0);
|
||||||
|
allqueue(REDRAWBUTSSHADING, 0);
|
||||||
|
allqueue(REDRAWIPO, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if(event>=B_PLUGBUT && event<=B_PLUGBUT+23) {
|
if(event>=B_PLUGBUT && event<=B_PLUGBUT+23) {
|
||||||
@ -1687,10 +1698,13 @@ static void texture_panel_texture(MTex *actmtex, Material *ma, World *wrld, Lamp
|
|||||||
|
|
||||||
/* newnoise: all texture types as menu, not enough room for more buttons.
|
/* newnoise: all texture types as menu, not enough room for more buttons.
|
||||||
* Can widen panel, but looks ugly when other panels overlap it */
|
* Can widen panel, but looks ugly when other panels overlap it */
|
||||||
|
if( !tex->use_nodes ) {
|
||||||
|
sprintf(textypes, "Texture Type %%t|None %%x%d|Image %%x%d|EnvMap %%x%d|Clouds %%x%d|Marble %%x%d|Stucci %%x%d|Wood %%x%d|Magic %%x%d|Blend %%x%d|Noise %%x%d|Plugin %%x%d|Musgrave %%x%d|Voronoi %%x%d|DistortedNoise %%x%d", 0, TEX_IMAGE, TEX_ENVMAP, TEX_CLOUDS, TEX_MARBLE, TEX_STUCCI, TEX_WOOD, TEX_MAGIC, TEX_BLEND, TEX_NOISE, TEX_PLUGIN, TEX_MUSGRAVE, TEX_VORONOI, TEX_DISTNOISE);
|
||||||
|
uiDefBut(block, LABEL, 0, "Texture Type", 160, 150, 140, 20, 0, 0.0, 0.0, 0, 0, "");
|
||||||
|
uiDefButS(block, MENU, B_TEXTYPE, textypes, 160, 125, 140, 25, &tex->type, 0,0,0,0, "Select texture type");
|
||||||
|
}
|
||||||
|
|
||||||
sprintf(textypes, "Texture Type %%t|None %%x%d|Image %%x%d|EnvMap %%x%d|Clouds %%x%d|Marble %%x%d|Stucci %%x%d|Wood %%x%d|Magic %%x%d|Blend %%x%d|Noise %%x%d|Plugin %%x%d|Musgrave %%x%d|Voronoi %%x%d|DistortedNoise %%x%d", 0, TEX_IMAGE, TEX_ENVMAP, TEX_CLOUDS, TEX_MARBLE, TEX_STUCCI, TEX_WOOD, TEX_MAGIC, TEX_BLEND, TEX_NOISE, TEX_PLUGIN, TEX_MUSGRAVE, TEX_VORONOI, TEX_DISTNOISE);
|
uiDefButC(block, TOG, B_TEX_USENODES, "Nodes", 160, 100, 140, 25, &tex->use_nodes, 0.0f, 0.0f, 0, 0, "");
|
||||||
uiDefBut(block, LABEL, 0, "Texture Type", 160, 150, 140, 20, 0, 0.0, 0.0, 0, 0, "");
|
|
||||||
uiDefButS(block, MENU, B_TEXTYPE, textypes, 160, 125, 140, 25, &tex->type, 0,0,0,0, "Select texture type");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -3684,6 +3698,12 @@ static void material_panel_texture(Object *ob, Material *ma)
|
|||||||
uiBlockSetCol(block, TH_AUTO);
|
uiBlockSetCol(block, TH_AUTO);
|
||||||
uiDefBut(block, BUT, B_TEXCLEAR, "Clear", 122, 130, 72, 20, 0, 0, 0, 0, 0, "Erases link to texture");
|
uiDefBut(block, BUT, B_TEXCLEAR, "Clear", 122, 130, 72, 20, 0, 0, 0, 0, 0, "Erases link to texture");
|
||||||
|
|
||||||
|
if(mtex->tex->use_nodes) {
|
||||||
|
char *menustr = ntreeTexOutputMenu(mtex->tex->nodetree);
|
||||||
|
uiDefBut(block, LABEL, 0, "Use Output:", 100, 100, 163, 20, 0, 0, 0, 0, 0, "");
|
||||||
|
uiDefButS(block, MENU, B_MATPRV, menustr, 100, 80, 163, 20, &mtex->which_output, 0, 0, 0, 0, "Which output to use, for multi-output textures");
|
||||||
|
free(menustr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
uiDefButS(block, TOG, B_EXTEXBROWSE, "Add New" ,100, 150, 163, 20, &(G.buts->texnr), -1.0, 32767.0, 0, 0, "Adds a new texture datablock");
|
uiDefButS(block, TOG, B_EXTEXBROWSE, "Add New" ,100, 150, 163, 20, &(G.buts->texnr), -1.0, 32767.0, 0, 0, "Adds a new texture datablock");
|
||||||
|
@ -451,6 +451,9 @@ static void node_browse_tex_cb(void *ntree_v, void *node_v)
|
|||||||
|
|
||||||
nodeSetActive(ntree, node);
|
nodeSetActive(ntree, node);
|
||||||
|
|
||||||
|
if( ntree->type == NTREE_TEXTURE )
|
||||||
|
ntreeTexCheckCyclics( ntree );
|
||||||
|
|
||||||
allqueue(REDRAWBUTSSHADING, 0);
|
allqueue(REDRAWBUTSSHADING, 0);
|
||||||
allqueue(REDRAWNODE, 0);
|
allqueue(REDRAWNODE, 0);
|
||||||
NodeTagChanged(ntree, node);
|
NodeTagChanged(ntree, node);
|
||||||
@ -491,29 +494,45 @@ static void node_dynamic_update_cb(void *ntree_v, void *node_v)
|
|||||||
|
|
||||||
static int node_buts_texture(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
|
static int node_buts_texture(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
|
||||||
{
|
{
|
||||||
|
short multi = (
|
||||||
|
node->id &&
|
||||||
|
((Tex*)node->id)->use_nodes &&
|
||||||
|
(node->type != CMP_NODE_TEXTURE) &&
|
||||||
|
(node->type != TEX_NODE_TEXTURE)
|
||||||
|
);
|
||||||
|
|
||||||
if(block) {
|
if(block) {
|
||||||
uiBut *bt;
|
uiBut *bt;
|
||||||
char *strp;
|
char *strp;
|
||||||
|
short width = (short)(butr->xmax - butr->xmin);
|
||||||
|
|
||||||
/* browse button texture */
|
/* browse button texture */
|
||||||
uiBlockBeginAlign(block);
|
uiBlockBeginAlign(block);
|
||||||
IDnames_to_pupstring(&strp, NULL, "", &(G.main->tex), NULL, NULL);
|
IDnames_to_pupstring(&strp, NULL, "", &(G.main->tex), NULL, NULL);
|
||||||
node->menunr= 0;
|
node->menunr= 0;
|
||||||
bt= uiDefButS(block, MENU, B_NODE_EXEC+node->nr, strp,
|
bt= uiDefButS(block, MENU, B_NODE_EXEC+node->nr, strp,
|
||||||
butr->xmin, butr->ymin, 20, 19,
|
butr->xmin, butr->ymin+(multi?30:0), 20, 19,
|
||||||
&node->menunr, 0, 0, 0, 0, "Browse texture");
|
&node->menunr, 0, 0, 0, 0, "Browse texture");
|
||||||
uiButSetFunc(bt, node_browse_tex_cb, ntree, node);
|
uiButSetFunc(bt, node_browse_tex_cb, ntree, node);
|
||||||
if(strp) MEM_freeN(strp);
|
if(strp) MEM_freeN(strp);
|
||||||
|
|
||||||
if(node->id) {
|
if(node->id) {
|
||||||
bt= uiDefBut(block, TEX, B_NOP, "TE:",
|
bt= uiDefBut(block, TEX, B_NOP, "TE:",
|
||||||
butr->xmin+19, butr->ymin, butr->xmax-butr->xmin-19, 19,
|
butr->xmin+19, butr->ymin+(multi?30:0), butr->xmax-butr->xmin-19, 19,
|
||||||
node->id->name+2, 0.0, 19.0, 0, 0, "Texture name");
|
node->id->name+2, 0.0, 19.0, 0, 0, "Texture name");
|
||||||
uiButSetFunc(bt, node_ID_title_cb, node, NULL);
|
uiButSetFunc(bt, node_ID_title_cb, node, NULL);
|
||||||
}
|
}
|
||||||
|
uiBlockEndAlign(block);
|
||||||
|
|
||||||
|
if(multi) {
|
||||||
|
char *menustr = ntreeTexOutputMenu(((Tex*)node->id)->nodetree);
|
||||||
|
uiDefButS(block, MENU, B_MATPRV, menustr, butr->xmin, butr->ymin, width, 19, &node->custom1, 0, 0, 0, 0, "Which output to use, for multi-output textures");
|
||||||
|
free(menustr);
|
||||||
|
return 50;
|
||||||
|
}
|
||||||
|
return 20;
|
||||||
}
|
}
|
||||||
return 19;
|
else return multi? 50: 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int node_buts_math(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
|
static int node_buts_math(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
|
||||||
@ -2183,6 +2202,261 @@ static void node_composit_set_butfunc(bNodeType *ntype)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ****************** BUTTON CALLBACKS FOR TEXTURE NODES ***************** */
|
||||||
|
|
||||||
|
static int node_texture_buts_bricks(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
|
||||||
|
{
|
||||||
|
if(block) {
|
||||||
|
short w = butr->xmax-butr->xmin;
|
||||||
|
short ofw = 32;
|
||||||
|
|
||||||
|
uiBlockBeginAlign(block);
|
||||||
|
|
||||||
|
/* Offset */
|
||||||
|
uiDefButF(
|
||||||
|
block, NUM, B_NODE_EXEC+node->nr, "Offset",
|
||||||
|
butr->xmin, butr->ymin+20, w-ofw, 20,
|
||||||
|
&node->custom3,
|
||||||
|
0, 1, 0.25, 2,
|
||||||
|
"Offset amount" );
|
||||||
|
uiDefButS(
|
||||||
|
block, NUM, B_NODE_EXEC+node->nr, "",
|
||||||
|
butr->xmin+w-ofw, butr->ymin+20, ofw, 20,
|
||||||
|
&node->custom1,
|
||||||
|
2, 99, 0, 0,
|
||||||
|
"Offset every N rows" );
|
||||||
|
|
||||||
|
/* Squash */
|
||||||
|
uiDefButF(
|
||||||
|
block, NUM, B_NODE_EXEC+node->nr, "Squash",
|
||||||
|
butr->xmin, butr->ymin+0, w-ofw, 20,
|
||||||
|
&node->custom4,
|
||||||
|
0, 99, 0.25, 2,
|
||||||
|
"Stretch amount" );
|
||||||
|
uiDefButS(
|
||||||
|
block, NUM, B_NODE_EXEC+node->nr, "",
|
||||||
|
butr->xmin+w-ofw, butr->ymin+0, ofw, 20,
|
||||||
|
&node->custom2,
|
||||||
|
2, 99, 0, 0,
|
||||||
|
"Stretch every N rows" );
|
||||||
|
|
||||||
|
uiBlockEndAlign(block);
|
||||||
|
}
|
||||||
|
return 40;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Copied from buttons_shading.c -- needs unifying */
|
||||||
|
static char* noisebasis_menu()
|
||||||
|
{
|
||||||
|
static char nbmenu[256];
|
||||||
|
sprintf(nbmenu, "Noise Basis %%t|Blender Original %%x%d|Original Perlin %%x%d|Improved Perlin %%x%d|Voronoi F1 %%x%d|Voronoi F2 %%x%d|Voronoi F3 %%x%d|Voronoi F4 %%x%d|Voronoi F2-F1 %%x%d|Voronoi Crackle %%x%d|CellNoise %%x%d", TEX_BLENDER, TEX_STDPERLIN, TEX_NEWPERLIN, TEX_VORONOI_F1, TEX_VORONOI_F2, TEX_VORONOI_F3, TEX_VORONOI_F4, TEX_VORONOI_F2F1, TEX_VORONOI_CRACKLE, TEX_CELLNOISE);
|
||||||
|
return nbmenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int node_texture_buts_proc(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
|
||||||
|
{
|
||||||
|
Tex *tex = (Tex *)node->storage;
|
||||||
|
short x,y,w,h;
|
||||||
|
|
||||||
|
if( block ) {
|
||||||
|
x = butr->xmin;
|
||||||
|
y = butr->ymin;
|
||||||
|
w = butr->xmax - x;
|
||||||
|
h = butr->ymax - y;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch( tex->type ) {
|
||||||
|
case TEX_BLEND:
|
||||||
|
if( block ) {
|
||||||
|
uiBlockBeginAlign( block );
|
||||||
|
uiDefButS( block, MENU, B_NODE_EXEC+node->nr,
|
||||||
|
"Linear %x0|Quad %x1|Ease %x2|Diag %x3|Sphere %x4|Halo %x5|Radial %x6",
|
||||||
|
x, y+20, w, 20, &tex->stype, 0, 1, 0, 0, "Blend Type" );
|
||||||
|
uiDefButBitS(block, TOG, TEX_FLIPBLEND, B_NODE_EXEC+node->nr, "Flip XY", x, y, w, 20,
|
||||||
|
&tex->flag, 0, 0, 0, 0, "Flips the direction of the progression 90 degrees");
|
||||||
|
uiBlockEndAlign( block );
|
||||||
|
}
|
||||||
|
return 40;
|
||||||
|
|
||||||
|
|
||||||
|
case TEX_MARBLE:
|
||||||
|
if( block ) {
|
||||||
|
uiBlockBeginAlign(block);
|
||||||
|
|
||||||
|
uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Soft", 0*w/3+x, 40+y, w/3, 18, &tex->stype, 2.0, (float)TEX_SOFT, 0, 0, "Uses soft marble");
|
||||||
|
uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Sharp", 1*w/3+x, 40+y, w/3, 18, &tex->stype, 2.0, (float)TEX_SHARP, 0, 0, "Uses more clearly defined marble");
|
||||||
|
uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Sharper", 2*w/3+x, 40+y, w/3, 18, &tex->stype, 2.0, (float)TEX_SHARPER, 0, 0, "Uses very clearly defined marble");
|
||||||
|
|
||||||
|
uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Soft noise", 0*w/2+x, 20+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
|
||||||
|
uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Hard noise", 1*w/2+x, 20+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
|
||||||
|
|
||||||
|
uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Sin", 0*w/3+x, 0+y, w/3, 18, &tex->noisebasis2, 8.0, 0.0, 0, 0, "Uses a sine wave to produce bands.");
|
||||||
|
uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Saw", 1*w/3+x, 0+y, w/3, 18, &tex->noisebasis2, 8.0, 1.0, 0, 0, "Uses a saw wave to produce bands");
|
||||||
|
uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Tri", 2*w/3+x, 0+y, w/3, 18, &tex->noisebasis2, 8.0, 2.0, 0, 0, "Uses a triangle wave to produce bands");
|
||||||
|
|
||||||
|
uiBlockEndAlign(block);
|
||||||
|
}
|
||||||
|
return 60;
|
||||||
|
|
||||||
|
case TEX_WOOD:
|
||||||
|
if( block ) {
|
||||||
|
uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), x, y+64, w, 18, &tex->noisebasis, 0,0,0,0, "Sets the noise basis used for turbulence");
|
||||||
|
|
||||||
|
uiBlockBeginAlign(block);
|
||||||
|
uiDefButS(block, ROW, B_TEXPRV, "Bands", x, 40+y, w/2, 18, &tex->stype, 2.0, (float)TEX_BANDNOISE, 0, 0, "Uses standard noise");
|
||||||
|
uiDefButS(block, ROW, B_TEXPRV, "Rings", w/2+x, 40+y, w/2, 18, &tex->stype, 2.0, (float)TEX_RINGNOISE, 0, 0, "Lets Noise return RGB value");
|
||||||
|
|
||||||
|
uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Sin", 0*w/3+x, 20+y, w/3, 18, &tex->noisebasis2, 8.0, (float)TEX_SIN, 0, 0, "Uses a sine wave to produce bands.");
|
||||||
|
uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Saw", 1*w/3+x, 20+y, w/3, 18, &tex->noisebasis2, 8.0, (float)TEX_SAW, 0, 0, "Uses a saw wave to produce bands");
|
||||||
|
uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Tri", 2*w/3+x, 20+y, w/3, 18, &tex->noisebasis2, 8.0, (float)TEX_TRI, 0, 0, "Uses a triangle wave to produce bands");
|
||||||
|
|
||||||
|
uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Soft noise", 0*w/2+x, 0+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
|
||||||
|
uiDefButS(block, ROW, B_NODE_EXEC+node->nr, "Hard noise", 1*w/2+x, 0+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
|
||||||
|
uiBlockEndAlign(block);
|
||||||
|
}
|
||||||
|
return 80;
|
||||||
|
|
||||||
|
case TEX_CLOUDS:
|
||||||
|
if( block ) {
|
||||||
|
uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), x, y+60, w, 18, &tex->noisebasis, 0,0,0,0, "Sets the noise basis used for turbulence");
|
||||||
|
|
||||||
|
uiBlockBeginAlign(block);
|
||||||
|
uiDefButS(block, ROW, B_TEXPRV, "B/W", x, y+38, w/2, 18, &tex->stype, 2.0, (float)TEX_DEFAULT, 0, 0, "Uses standard noise");
|
||||||
|
uiDefButS(block, ROW, B_TEXPRV, "Color", w/2+x, y+38, w/2, 18, &tex->stype, 2.0, (float)TEX_COLOR, 0, 0, "Lets Noise return RGB value");
|
||||||
|
uiDefButS(block, ROW, B_TEXPRV, "Soft", x, y+20, w/2, 18, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
|
||||||
|
uiDefButS(block, ROW, B_TEXPRV, "Hard", w/2+x, y+20, w/2, 18, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
|
||||||
|
uiBlockEndAlign(block);
|
||||||
|
|
||||||
|
uiDefButS(block, NUM, B_TEXPRV, "Depth:", x, y, w, 18, &tex->noisedepth, 0.0, 6.0, 0, 0, "Sets the depth of the cloud calculation");
|
||||||
|
}
|
||||||
|
return 80;
|
||||||
|
|
||||||
|
case TEX_DISTNOISE:
|
||||||
|
if( block ) {
|
||||||
|
uiBlockBeginAlign(block);
|
||||||
|
uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), x, y+18, w, 18, &tex->noisebasis2, 0,0,0,0, "Sets the noise basis to distort");
|
||||||
|
uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), x, y, w, 18, &tex->noisebasis, 0,0,0,0, "Sets the noise basis which does the distortion");
|
||||||
|
uiBlockEndAlign(block);
|
||||||
|
}
|
||||||
|
return 36;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int node_texture_buts_image(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
|
||||||
|
{
|
||||||
|
char *strp;
|
||||||
|
uiBut *bt;
|
||||||
|
|
||||||
|
if( block ) {
|
||||||
|
uiBlockBeginAlign(block);
|
||||||
|
uiBlockSetCol(block, TH_BUT_SETTING2);
|
||||||
|
|
||||||
|
/* browse button */
|
||||||
|
IMAnames_to_pupstring(&strp, NULL, "LOAD NEW %x32767", &(G.main->image), NULL, NULL);
|
||||||
|
node->menunr= 0;
|
||||||
|
bt= uiDefButS(block, MENU, B_NOP, strp,
|
||||||
|
butr->xmin, butr->ymin, 19, 19,
|
||||||
|
&node->menunr, 0, 0, 0, 0, "Browses existing choices");
|
||||||
|
uiButSetFunc(bt, node_browse_image_cb, ntree, node);
|
||||||
|
if(strp) MEM_freeN(strp);
|
||||||
|
|
||||||
|
/* Add New button */
|
||||||
|
if(node->id==NULL) {
|
||||||
|
bt= uiDefBut(block, BUT, B_NODE_LOADIMAGE, "Load New",
|
||||||
|
butr->xmin+19, butr->ymin, (short)(butr->xmax-butr->xmin-19.0f), 19,
|
||||||
|
NULL, 0.0, 0.0, 0, 0, "Add new Image");
|
||||||
|
uiButSetFunc(bt, node_active_cb, ntree, node);
|
||||||
|
uiBlockSetCol(block, TH_AUTO);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* name button */
|
||||||
|
short xmin= (short)butr->xmin, xmax= (short)butr->xmax;
|
||||||
|
short width= xmax - xmin - 19;
|
||||||
|
|
||||||
|
bt= uiDefBut(block, TEX, B_NOP, "IM:",
|
||||||
|
xmin+19, butr->ymin, width, 19,
|
||||||
|
node->id->name+2, 0.0, 19.0, 0, 0, "Image name");
|
||||||
|
uiButSetFunc(bt, node_ID_title_cb, node, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int node_texture_buts_output(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
|
||||||
|
{
|
||||||
|
if( block ) {
|
||||||
|
uiBut *bt;
|
||||||
|
short width;
|
||||||
|
char *name = ((TexNodeOutput*)node->storage)->name;
|
||||||
|
|
||||||
|
uiBlockBeginAlign(block);
|
||||||
|
|
||||||
|
width = (short)(butr->xmax - butr->xmin);
|
||||||
|
|
||||||
|
bt = uiDefBut(
|
||||||
|
block, TEX, B_NOP,
|
||||||
|
"Name:",
|
||||||
|
butr->xmin, butr->ymin,
|
||||||
|
width, 19,
|
||||||
|
name, 0, 31,
|
||||||
|
0, 0,
|
||||||
|
"Name this output"
|
||||||
|
);
|
||||||
|
|
||||||
|
uiBlockEndAlign(block);
|
||||||
|
}
|
||||||
|
return 19;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* only once called */
|
||||||
|
static void node_texture_set_butfunc(bNodeType *ntype)
|
||||||
|
{
|
||||||
|
if( ntype->type >= TEX_NODE_PROC && ntype->type < TEX_NODE_PROC_MAX ) {
|
||||||
|
ntype->butfunc = node_texture_buts_proc;
|
||||||
|
}
|
||||||
|
else switch(ntype->type) {
|
||||||
|
|
||||||
|
case TEX_NODE_MATH:
|
||||||
|
ntype->butfunc = node_buts_math;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TEX_NODE_MIX_RGB:
|
||||||
|
ntype->butfunc = node_buts_mix_rgb;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TEX_NODE_VALTORGB:
|
||||||
|
ntype->butfunc = node_buts_valtorgb;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TEX_NODE_CURVE_RGB:
|
||||||
|
ntype->butfunc= node_buts_curvecol;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TEX_NODE_CURVE_TIME:
|
||||||
|
ntype->butfunc = node_buts_time;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TEX_NODE_TEXTURE:
|
||||||
|
ntype->butfunc = node_buts_texture;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TEX_NODE_BRICKS:
|
||||||
|
ntype->butfunc = node_texture_buts_bricks;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TEX_NODE_IMAGE:
|
||||||
|
ntype->butfunc = node_texture_buts_image;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TEX_NODE_OUTPUT:
|
||||||
|
ntype->butfunc = node_texture_buts_output;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
ntype->butfunc= NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ******* init draw callbacks for all tree types, only called in usiblender.c, once ************* */
|
/* ******* init draw callbacks for all tree types, only called in usiblender.c, once ************* */
|
||||||
|
|
||||||
@ -2202,6 +2476,11 @@ void init_node_butfuncs(void)
|
|||||||
node_composit_set_butfunc(ntype);
|
node_composit_set_butfunc(ntype);
|
||||||
ntype= ntype->next;
|
ntype= ntype->next;
|
||||||
}
|
}
|
||||||
|
ntype = node_all_textures.first;
|
||||||
|
while(ntype) {
|
||||||
|
node_texture_set_butfunc(ntype);
|
||||||
|
ntype= ntype->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************** Generic drawing ************** */
|
/* ************** Generic drawing ************** */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include "DNA_ipo_types.h"
|
#include "DNA_ipo_types.h"
|
||||||
#include "DNA_object_types.h"
|
#include "DNA_object_types.h"
|
||||||
#include "DNA_material_types.h"
|
#include "DNA_material_types.h"
|
||||||
|
#include "DNA_texture_types.h"
|
||||||
#include "DNA_node_types.h"
|
#include "DNA_node_types.h"
|
||||||
#include "DNA_space_types.h"
|
#include "DNA_space_types.h"
|
||||||
#include "DNA_screen_types.h"
|
#include "DNA_screen_types.h"
|
||||||
@ -53,6 +54,7 @@
|
|||||||
#include "BKE_main.h"
|
#include "BKE_main.h"
|
||||||
#include "BKE_node.h"
|
#include "BKE_node.h"
|
||||||
#include "BKE_material.h"
|
#include "BKE_material.h"
|
||||||
|
#include "BKE_texture.h"
|
||||||
#include "BKE_scene.h"
|
#include "BKE_scene.h"
|
||||||
#include "BKE_utildefines.h"
|
#include "BKE_utildefines.h"
|
||||||
|
|
||||||
@ -176,6 +178,10 @@ static void snode_handle_recalc(SpaceNode *snode)
|
|||||||
|
|
||||||
allqueue(REDRAWNODE, 1);
|
allqueue(REDRAWNODE, 1);
|
||||||
}
|
}
|
||||||
|
else if(snode->treetype==NTREE_TEXTURE) {
|
||||||
|
ntreeTexUpdatePreviews(snode->nodetree);
|
||||||
|
BIF_preview_changed(ID_TE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shader_node_event(SpaceNode *snode, short event)
|
static void shader_node_event(SpaceNode *snode, short event)
|
||||||
@ -423,6 +429,36 @@ static void composit_node_event(SpaceNode *snode, short event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void texture_node_event(SpaceNode *snode, short event)
|
||||||
|
{
|
||||||
|
switch(event) {
|
||||||
|
case B_REDR:
|
||||||
|
allqueue(REDRAWNODE, 1);
|
||||||
|
break;
|
||||||
|
case B_NODE_LOADIMAGE:
|
||||||
|
{
|
||||||
|
bNode *node= nodeGetActive(snode->edittree);
|
||||||
|
char name[FILE_MAXDIR+FILE_MAXFILE];
|
||||||
|
|
||||||
|
if(node->id)
|
||||||
|
strcpy(name, ((Image *)node->id)->name);
|
||||||
|
else strcpy(name, U.textudir);
|
||||||
|
if (G.qual & LR_CTRLKEY) {
|
||||||
|
activate_imageselect(FILE_SPECIAL, "SELECT IMAGE", name, load_node_image);
|
||||||
|
} else {
|
||||||
|
activate_fileselect(FILE_SPECIAL, "SELECT IMAGE", name, load_node_image);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
/* B_NODE_EXEC */
|
||||||
|
ntreeTexCheckCyclics( snode->nodetree );
|
||||||
|
snode_handle_recalc(snode);
|
||||||
|
allqueue(REDRAWNODE, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* assumes nothing being done in ntree yet, sets the default in/out node */
|
/* assumes nothing being done in ntree yet, sets the default in/out node */
|
||||||
/* called from shading buttons or header */
|
/* called from shading buttons or header */
|
||||||
@ -486,6 +522,36 @@ void node_composit_default(Scene *sce)
|
|||||||
ntreeCompositForceHidden(sce->nodetree);
|
ntreeCompositForceHidden(sce->nodetree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* assumes nothing being done in ntree yet, sets the default in/out node */
|
||||||
|
/* called from shading buttons or header */
|
||||||
|
void node_texture_default(Tex *tx)
|
||||||
|
{
|
||||||
|
bNode *in, *out;
|
||||||
|
bNodeSocket *fromsock, *tosock;
|
||||||
|
|
||||||
|
/* but lets check it anyway */
|
||||||
|
if(tx->nodetree) {
|
||||||
|
printf("error in texture initialize\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tx->nodetree= ntreeAddTree(NTREE_TEXTURE);
|
||||||
|
|
||||||
|
out= nodeAddNodeType(tx->nodetree, TEX_NODE_OUTPUT, NULL, NULL);
|
||||||
|
out->locx= 300.0f; out->locy= 300.0f;
|
||||||
|
|
||||||
|
in= nodeAddNodeType(tx->nodetree, TEX_NODE_CHECKER, NULL, NULL);
|
||||||
|
in->locx= 10.0f; in->locy= 300.0f;
|
||||||
|
nodeSetActive(tx->nodetree, in);
|
||||||
|
|
||||||
|
fromsock= in->outputs.first;
|
||||||
|
tosock= out->inputs.first;
|
||||||
|
nodeAddLink(tx->nodetree, in, fromsock, out, tosock);
|
||||||
|
|
||||||
|
ntreeSolveOrder(tx->nodetree); /* needed for pointers */
|
||||||
|
ntreeTexUpdatePreviews(tx->nodetree);
|
||||||
|
}
|
||||||
|
|
||||||
/* Here we set the active tree(s), even called for each redraw now, so keep it fast :) */
|
/* Here we set the active tree(s), even called for each redraw now, so keep it fast :) */
|
||||||
void snode_set_context(SpaceNode *snode)
|
void snode_set_context(SpaceNode *snode)
|
||||||
{
|
{
|
||||||
@ -516,6 +582,16 @@ void snode_set_context(SpaceNode *snode)
|
|||||||
|
|
||||||
snode->nodetree= G.scene->nodetree;
|
snode->nodetree= G.scene->nodetree;
|
||||||
}
|
}
|
||||||
|
else if(snode->treetype==NTREE_TEXTURE) {
|
||||||
|
if(ob) {
|
||||||
|
Tex *tx= give_current_texture(ob, ob->actcol);
|
||||||
|
if(tx) {
|
||||||
|
snode->from= (ID*)ob; /* please check this; i have no idea what 'from' is. */
|
||||||
|
snode->id= &tx->id;
|
||||||
|
snode->nodetree= tx->nodetree;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* find editable group */
|
/* find editable group */
|
||||||
if(snode->nodetree)
|
if(snode->nodetree)
|
||||||
@ -608,6 +684,12 @@ static void node_set_active(SpaceNode *snode, bNode *node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(snode->treetype==NTREE_TEXTURE) {
|
||||||
|
if(node->id)
|
||||||
|
BIF_preview_changed(-1);
|
||||||
|
allqueue(REDRAWBUTSSHADING, 1);
|
||||||
|
allqueue(REDRAWIPO, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1188,6 +1270,9 @@ static void scale_node(SpaceNode *snode, bNode *node)
|
|||||||
BIF_undo_push("Scale Node");
|
BIF_undo_push("Scale Node");
|
||||||
|
|
||||||
allqueue(REDRAWNODE, 1);
|
allqueue(REDRAWNODE, 1);
|
||||||
|
|
||||||
|
if(snode->nodetree->type == NTREE_TEXTURE)
|
||||||
|
ntreeTexUpdatePreviews(snode->nodetree);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ******************** rename ******************* */
|
/* ******************** rename ******************* */
|
||||||
@ -1702,6 +1787,12 @@ bNode *node_add_node(SpaceNode *snode, int type, float locx, float locy)
|
|||||||
|
|
||||||
NodeTagChanged(snode->edittree, node);
|
NodeTagChanged(snode->edittree, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(snode->nodetree->type==NTREE_TEXTURE) {
|
||||||
|
ntreeTexCheckCyclics(snode->edittree);
|
||||||
|
ntreeTexUpdatePreviews(snode->edittree);
|
||||||
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2481,6 +2572,8 @@ void winqreadnodespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
|||||||
shader_node_event(snode, val);
|
shader_node_event(snode, val);
|
||||||
else if(snode->treetype==NTREE_COMPOSIT)
|
else if(snode->treetype==NTREE_COMPOSIT)
|
||||||
composit_node_event(snode, val);
|
composit_node_event(snode, val);
|
||||||
|
else if(snode->treetype==NTREE_TEXTURE)
|
||||||
|
texture_node_event(snode, val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RENDERPREVIEW:
|
case RENDERPREVIEW:
|
||||||
|
@ -68,6 +68,7 @@ void do_node_buttons(ScrArea *sa, unsigned short event)
|
|||||||
{
|
{
|
||||||
SpaceNode *snode= sa->spacedata.first;
|
SpaceNode *snode= sa->spacedata.first;
|
||||||
Material *ma;
|
Material *ma;
|
||||||
|
Tex *tx;
|
||||||
|
|
||||||
switch(event) {
|
switch(event) {
|
||||||
case B_NODE_USEMAT:
|
case B_NODE_USEMAT:
|
||||||
@ -93,6 +94,21 @@ void do_node_buttons(ScrArea *sa, unsigned short event)
|
|||||||
snode_set_context(snode);
|
snode_set_context(snode);
|
||||||
allqueue(REDRAWNODE, 0);
|
allqueue(REDRAWNODE, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case B_NODE_USETEX:
|
||||||
|
tx = (Tex *)snode->id;
|
||||||
|
if(tx) {
|
||||||
|
tx->type = 0;
|
||||||
|
if(tx->use_nodes && tx->nodetree==NULL) {
|
||||||
|
node_texture_default(tx);
|
||||||
|
snode_set_context(snode);
|
||||||
|
}
|
||||||
|
BIF_preview_changed(ID_TE);
|
||||||
|
allqueue(REDRAWNODE, 0);
|
||||||
|
allqueue(REDRAWBUTSSHADING, 0);
|
||||||
|
allqueue(REDRAWIPO, 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,6 +440,36 @@ static uiBlock *node_add_distortmenu(void *arg_unused)
|
|||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
static uiBlock *node_add_patternmenu(void *arg_unused)
|
||||||
|
{
|
||||||
|
SpaceNode *snode= curarea->spacedata.first;
|
||||||
|
uiBlock *block;
|
||||||
|
|
||||||
|
block= uiNewBlock(&curarea->uiblocks, "node_add_patternmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
|
||||||
|
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
|
||||||
|
|
||||||
|
node_make_addmenu(snode, NODE_CLASS_PATTERN, block);
|
||||||
|
|
||||||
|
uiBlockSetDirection(block, UI_RIGHT);
|
||||||
|
uiTextBoundsBlock(block, 60);
|
||||||
|
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
static uiBlock *node_add_texturemenu(void *arg_unused)
|
||||||
|
{
|
||||||
|
SpaceNode *snode= curarea->spacedata.first;
|
||||||
|
uiBlock *block;
|
||||||
|
|
||||||
|
block= uiNewBlock(&curarea->uiblocks, "node_add_texturemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
|
||||||
|
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
|
||||||
|
|
||||||
|
node_make_addmenu(snode, NODE_CLASS_TEXTURE, block);
|
||||||
|
|
||||||
|
uiBlockSetDirection(block, UI_RIGHT);
|
||||||
|
uiTextBoundsBlock(block, 60);
|
||||||
|
|
||||||
|
return block;
|
||||||
|
}
|
||||||
static uiBlock *node_add_groupmenu(void *arg_unused)
|
static uiBlock *node_add_groupmenu(void *arg_unused)
|
||||||
{
|
{
|
||||||
SpaceNode *snode= curarea->spacedata.first;
|
SpaceNode *snode= curarea->spacedata.first;
|
||||||
@ -486,7 +532,17 @@ static uiBlock *node_addmenu(void *arg_unused)
|
|||||||
uiDefIconTextBlockBut(block, node_add_distortmenu, NULL, ICON_RIGHTARROW_THIN, "Distort", 0, yco-=20, 120, 19, "");
|
uiDefIconTextBlockBut(block, node_add_distortmenu, NULL, ICON_RIGHTARROW_THIN, "Distort", 0, yco-=20, 120, 19, "");
|
||||||
uiDefIconTextBlockBut(block, node_add_groupmenu, NULL, ICON_RIGHTARROW_THIN, "Group", 0, yco-=20, 120, 19, "");
|
uiDefIconTextBlockBut(block, node_add_groupmenu, NULL, ICON_RIGHTARROW_THIN, "Group", 0, yco-=20, 120, 19, "");
|
||||||
|
|
||||||
} else
|
} else if(snode->treetype==NTREE_TEXTURE) {
|
||||||
|
uiDefIconTextBlockBut(block, node_add_inputmenu, NULL, ICON_RIGHTARROW_THIN, "Input", 0, yco-=20, 120, 19, "");
|
||||||
|
uiDefIconTextBlockBut(block, node_add_outputmenu, NULL, ICON_RIGHTARROW_THIN, "Output", 0, yco-=20, 120, 19, "");
|
||||||
|
uiDefIconTextBlockBut(block, node_add_colormenu, NULL, ICON_RIGHTARROW_THIN, "Color", 0, yco-=20, 120, 19, "");
|
||||||
|
uiDefIconTextBlockBut(block, node_add_patternmenu, NULL, ICON_RIGHTARROW_THIN, "Patterns", 0, yco-=20, 120, 19, "");
|
||||||
|
uiDefIconTextBlockBut(block, node_add_texturemenu, NULL, ICON_RIGHTARROW_THIN, "Textures", 0, yco-=20, 120, 19, "");
|
||||||
|
uiDefIconTextBlockBut(block, node_add_convertermenu, NULL, ICON_RIGHTARROW_THIN, "Convertor", 0, yco-=20, 120, 19, "");
|
||||||
|
uiDefIconTextBlockBut(block, node_add_distortmenu, NULL, ICON_RIGHTARROW_THIN, "Distort", 0, yco-=20, 120, 19, "");
|
||||||
|
uiDefIconTextBlockBut(block, node_add_groupmenu, NULL, ICON_RIGHTARROW_THIN, "Group", 0, yco-=20, 120, 19, "");
|
||||||
|
}
|
||||||
|
else
|
||||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||||
|
|
||||||
if(curarea->headertype==HEADERTOP) {
|
if(curarea->headertype==HEADERTOP) {
|
||||||
@ -696,6 +752,9 @@ void node_buttons(ScrArea *sa)
|
|||||||
xco+= XIC;
|
xco+= XIC;
|
||||||
uiDefIconButI(block, ROW, B_REDR, ICON_IMAGE_DEHLT, xco,2,XIC,YIC-2,
|
uiDefIconButI(block, ROW, B_REDR, ICON_IMAGE_DEHLT, xco,2,XIC,YIC-2,
|
||||||
&(snode->treetype), 2, 1, 0, 0, "Composite Nodes");
|
&(snode->treetype), 2, 1, 0, 0, "Composite Nodes");
|
||||||
|
xco+= XIC;
|
||||||
|
uiDefIconButI(block, ROW, B_REDR, ICON_TEXTURE_DEHLT, xco,2,XIC,YIC-2,
|
||||||
|
&(snode->treetype), 2, 2, 0, 0, "Texture Nodes");
|
||||||
xco+= 2*XIC;
|
xco+= 2*XIC;
|
||||||
uiBlockEndAlign(block);
|
uiBlockEndAlign(block);
|
||||||
|
|
||||||
@ -723,6 +782,19 @@ void node_buttons(ScrArea *sa)
|
|||||||
uiDefButBitS(block, TOG, SNODE_BACKDRAW, REDRAWNODE, "Backdrop", xco+5,0,80,19, &snode->flag, 0.0f, 0.0f, 0, 0, "Use active Viewer Node output as backdrop");
|
uiDefButBitS(block, TOG, SNODE_BACKDRAW, REDRAWNODE, "Backdrop", xco+5,0,80,19, &snode->flag, 0.0f, 0.0f, 0, 0, "Use active Viewer Node output as backdrop");
|
||||||
xco+= 80;
|
xco+= 80;
|
||||||
}
|
}
|
||||||
|
else if(snode->treetype==NTREE_TEXTURE) {
|
||||||
|
if(snode->from) {
|
||||||
|
|
||||||
|
xco= std_libbuttons(block, xco, 0, 0, NULL, B_TEXBROWSE, ID_TE, 1, snode->id, snode->from, &(snode->menunr),
|
||||||
|
B_TEXALONE, B_TEXLOCAL, B_TEXDELETE, B_AUTOTEXNAME, B_KEEPDATA);
|
||||||
|
|
||||||
|
if(snode->id) {
|
||||||
|
Tex *tx= (Tex *)snode->id;
|
||||||
|
uiDefButC(block, TOG, B_NODE_USETEX, "Use Nodes", xco+5,0,70,19, &tx->use_nodes, 0.0f, 0.0f, 0, 0, "");
|
||||||
|
xco+=80;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* always as last */
|
/* always as last */
|
||||||
sa->headbutlen= xco+2*XIC;
|
sa->headbutlen= xco+2*XIC;
|
||||||
|
@ -427,6 +427,15 @@ static void do_update_for_newframe(int mute, int events)
|
|||||||
/* composite */
|
/* composite */
|
||||||
if(G.scene->use_nodes && G.scene->nodetree)
|
if(G.scene->use_nodes && G.scene->nodetree)
|
||||||
ntreeCompositTagAnimated(G.scene->nodetree);
|
ntreeCompositTagAnimated(G.scene->nodetree);
|
||||||
|
|
||||||
|
/* update animated texture nodes */
|
||||||
|
{
|
||||||
|
Tex *tex;
|
||||||
|
for(tex= G.main->tex.first; tex; tex= tex->id.next)
|
||||||
|
if( tex->use_nodes && tex->nodetree ) {
|
||||||
|
ntreeTexTagAnimated( tex->nodetree );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_for_newframe(void)
|
void update_for_newframe(void)
|
||||||
@ -858,10 +867,25 @@ void do_global_buttons(unsigned short event)
|
|||||||
break;
|
break;
|
||||||
case B_EXTEXBROWSE:
|
case B_EXTEXBROWSE:
|
||||||
case B_TEXBROWSE:
|
case B_TEXBROWSE:
|
||||||
|
{
|
||||||
if(G.buts->texnr== -2) {
|
void *lockpoin = NULL;
|
||||||
|
short *menunr = 0;
|
||||||
|
|
||||||
|
/* this is called now from Node editor too, buttons might not exist */
|
||||||
|
if(curarea->spacetype==SPACE_NODE) {
|
||||||
|
SpaceNode *snode = curarea->spacedata.first;
|
||||||
|
menunr = &snode->menunr;
|
||||||
|
lockpoin = snode->id;
|
||||||
|
}
|
||||||
|
else if(G.buts) {
|
||||||
|
menunr = &G.buts->texnr;
|
||||||
|
lockpoin = G.buts->lockpoin;
|
||||||
|
}
|
||||||
|
else return;
|
||||||
|
|
||||||
|
if(*menunr == -2) {
|
||||||
|
|
||||||
id= G.buts->lockpoin;
|
id= lockpoin;
|
||||||
if(event==B_EXTEXBROWSE) {
|
if(event==B_EXTEXBROWSE) {
|
||||||
id= NULL;
|
id= NULL;
|
||||||
ma= give_current_material(ob, ob->actcol);
|
ma= give_current_material(ob, ob->actcol);
|
||||||
@ -872,16 +896,16 @@ void do_global_buttons(unsigned short event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(G.qual & LR_CTRLKEY) {
|
if(G.qual & LR_CTRLKEY) {
|
||||||
activate_databrowse_imasel(id, ID_TE, 0, B_TEXBROWSE, &G.buts->texnr, do_global_buttons);
|
activate_databrowse_imasel((ID*)lockpoin, ID_TE, 0, B_TEXBROWSE, menunr, do_global_buttons);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
activate_databrowse(id, ID_TE, 0, B_TEXBROWSE, &G.buts->texnr, do_global_buttons);
|
activate_databrowse((ID*)lockpoin, ID_TE, 0, B_TEXBROWSE, menunr, do_global_buttons);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(G.buts->texnr < 0) break;
|
if(*menunr < 0) break;
|
||||||
|
|
||||||
if(G.buts->pin) {
|
if(G.buts && G.buts->pin) {
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -896,7 +920,7 @@ void do_global_buttons(unsigned short event)
|
|||||||
|
|
||||||
idtest= G.main->tex.first;
|
idtest= G.main->tex.first;
|
||||||
while(idtest) {
|
while(idtest) {
|
||||||
if(nr==G.buts->texnr) {
|
if(nr==*menunr) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
nr++;
|
nr++;
|
||||||
@ -919,10 +943,12 @@ void do_global_buttons(unsigned short event)
|
|||||||
allqueue(REDRAWBUTSSHADING, 0);
|
allqueue(REDRAWBUTSSHADING, 0);
|
||||||
allqueue(REDRAWIPO, 0);
|
allqueue(REDRAWIPO, 0);
|
||||||
allqueue(REDRAWOOPS, 0);
|
allqueue(REDRAWOOPS, 0);
|
||||||
|
allqueue(REDRAWNODE, 0);
|
||||||
BIF_preview_changed(ID_MA);
|
BIF_preview_changed(ID_MA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case B_ACTIONDELETE:
|
case B_ACTIONDELETE:
|
||||||
/* only available when not pinned */
|
/* only available when not pinned */
|
||||||
if (G.saction->pin == 0) {
|
if (G.saction->pin == 0) {
|
||||||
|
@ -283,19 +283,6 @@ static ListBase undobase = {NULL, NULL};
|
|||||||
static UndoElem *curundo = NULL;
|
static UndoElem *curundo = NULL;
|
||||||
static ImagePaintPartialRedraw imapaintpartial = {0, 0, 0, 0, 0};
|
static ImagePaintPartialRedraw imapaintpartial = {0, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
|
||||||
static int BLI_linklist_index(struct LinkNode *list, void *ptr)
|
|
||||||
{
|
|
||||||
int index;
|
|
||||||
|
|
||||||
for (index = 0; list; list= list->next, index++) {
|
|
||||||
if (list->link == ptr)
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* UNDO */
|
/* UNDO */
|
||||||
|
|
||||||
/* internal functions */
|
/* internal functions */
|
||||||
|
@ -1595,6 +1595,17 @@ static TBitem tb_node_addcomp[]= {
|
|||||||
{ 0, "Group", 9, NULL},
|
{ 0, "Group", 9, NULL},
|
||||||
{ 0, "Dynamic", 10, NULL},
|
{ 0, "Dynamic", 10, NULL},
|
||||||
{ -1, "", 0, NULL}};
|
{ -1, "", 0, NULL}};
|
||||||
|
|
||||||
|
static TBitem tb_node_addtex[]= {
|
||||||
|
{ 0, "Input", 1, NULL},
|
||||||
|
{ 0, "Output", 2, NULL},
|
||||||
|
{ 0, "Color", 3, NULL},
|
||||||
|
{ 0, "Convertor", 4, NULL},
|
||||||
|
{ 0, "Patterns", 5, NULL},
|
||||||
|
{ 0, "Textures", 6, NULL},
|
||||||
|
{ 0, "Distort", 7, NULL},
|
||||||
|
{ 0, "Group", 8, NULL},
|
||||||
|
{ -1, "", 0, NULL}};
|
||||||
|
|
||||||
/* do_node_addmenu() in header_node.c, prototype in BSE_headerbuttons.h */
|
/* do_node_addmenu() in header_node.c, prototype in BSE_headerbuttons.h */
|
||||||
|
|
||||||
@ -2126,7 +2137,7 @@ void toolbox_n(void)
|
|||||||
menu3= tb__select;
|
menu3= tb__select;
|
||||||
menu4= tb_edit;
|
menu4= tb_edit;
|
||||||
menu5= tb_transform_editmode2;
|
menu5= tb_transform_editmode2;
|
||||||
}
|
}
|
||||||
else if(G.obedit->type==OB_LATTICE) {
|
else if(G.obedit->type==OB_LATTICE) {
|
||||||
menu1= tb_empty;str1= "Lattice";
|
menu1= tb_empty;str1= "Lattice";
|
||||||
menu2= tb_empty;
|
menu2= tb_empty;
|
||||||
@ -2145,8 +2156,11 @@ void toolbox_n(void)
|
|||||||
|
|
||||||
if(snode->treetype==NTREE_COMPOSIT)
|
if(snode->treetype==NTREE_COMPOSIT)
|
||||||
menu1= tb_node_addcomp;
|
menu1= tb_node_addcomp;
|
||||||
else
|
else if(snode->treetype==NTREE_SHADER)
|
||||||
menu1= tb_node_addsh;
|
menu1= tb_node_addsh;
|
||||||
|
else if(snode->treetype==NTREE_TEXTURE)
|
||||||
|
menu1= tb_node_addtex;
|
||||||
|
|
||||||
str1= "Add";
|
str1= "Add";
|
||||||
menu2= tb_node_node; str2= "Node";
|
menu2= tb_node_node; str2= "Node";
|
||||||
menu3= tb_node_select; str3= "Select";
|
menu3= tb_node_select; str3= "Select";
|
||||||
@ -2173,8 +2187,17 @@ void toolbox_n(void)
|
|||||||
menu1[7].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_DISTORT);
|
menu1[7].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_DISTORT);
|
||||||
menu1[8].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_GROUP);
|
menu1[8].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_GROUP);
|
||||||
menu1[9].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_OP_DYNAMIC);
|
menu1[9].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_OP_DYNAMIC);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if(snode->treetype==NTREE_TEXTURE) {
|
||||||
|
menu1[0].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_INPUT);
|
||||||
|
menu1[1].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_OUTPUT);
|
||||||
|
menu1[2].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_OP_COLOR);
|
||||||
|
menu1[3].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_CONVERTOR);
|
||||||
|
menu1[4].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_PATTERN);
|
||||||
|
menu1[5].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_TEXTURE);
|
||||||
|
menu1[6].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_DISTORT);
|
||||||
|
menu1[7].poin= node_add_sublevel(&storage, snode->nodetree, NODE_CLASS_GROUP);
|
||||||
|
}
|
||||||
|
|
||||||
dx= 96;
|
dx= 96;
|
||||||
tot= 5;
|
tot= 5;
|
||||||
|
@ -6,7 +6,7 @@ sources = 'creator.c'
|
|||||||
incs = '#/intern/guardedalloc ../blender/blenlib ../blender/blenkernel'
|
incs = '#/intern/guardedalloc ../blender/blenlib ../blender/blenkernel'
|
||||||
incs += ' ../blender/include ../blender/blenloader ../blender/imbuf'
|
incs += ' ../blender/include ../blender/blenloader ../blender/imbuf'
|
||||||
incs += ' ../blender/renderconverter ../blender/render/extern/include'
|
incs += ' ../blender/renderconverter ../blender/render/extern/include'
|
||||||
incs += ' ../blender/python ../blender/makesdna ../kernel/gen_messaging'
|
incs += ' ../blender/makesdna ../kernel/gen_messaging'
|
||||||
incs += ' ../kernel/gen_system #/extern/glew/include ../blender/gpu'
|
incs += ' ../kernel/gen_system #/extern/glew/include ../blender/gpu'
|
||||||
incs += ' ' + env['BF_OPENGL_INC']
|
incs += ' ' + env['BF_OPENGL_INC']
|
||||||
|
|
||||||
@ -25,7 +25,9 @@ if env['WITH_BF_OPENEXR']:
|
|||||||
if not env['WITH_BF_SDL']:
|
if not env['WITH_BF_SDL']:
|
||||||
defs.append('DISABLE_SDL')
|
defs.append('DISABLE_SDL')
|
||||||
|
|
||||||
if not env['WITH_BF_PYTHON']:
|
if env['WITH_BF_PYTHON']:
|
||||||
defs.append('DISABLE_PYTHON')
|
incs += ' ../blender/python'
|
||||||
|
else:
|
||||||
|
defs.append('DISABLE_PYTHON')
|
||||||
|
|
||||||
env.BlenderLib ( libname = 'blender_creator', sources = Split(sources), includes = Split(incs), defines = defs, libtype='core', priority = 1 )
|
env.BlenderLib ( libname = 'blender_creator', sources = Split(sources), includes = Split(incs), defines = defs, libtype='core', priority = 1 )
|
||||||
|
@ -8,11 +8,13 @@ incs += ' #/source/gameengine/Expressions #/intern/moto/include'
|
|||||||
incs += ' #/source/gameengine/Rasterizer'
|
incs += ' #/source/gameengine/Rasterizer'
|
||||||
|
|
||||||
incs += ' ' + env['BF_PYTHON_INC']
|
incs += ' ' + env['BF_PYTHON_INC']
|
||||||
incs += ' ' + env['BF_SDL_INC']
|
|
||||||
|
|
||||||
defs = ''
|
defs = ''
|
||||||
|
|
||||||
if not env['WITH_BF_SDL']:
|
if env['WITH_BF_SDL']:
|
||||||
|
incs += ' ' + env['BF_SDL_INC']
|
||||||
|
else:
|
||||||
defs += ' DISABLE_SDL'
|
defs += ' DISABLE_SDL'
|
||||||
|
|
||||||
env.BlenderLib ( 'bf_logic', sources, Split(incs), Split(defs), libtype=['game','player'], priority=[30, 110] )
|
env.BlenderLib ( 'bf_logic', sources, Split(incs), Split(defs), libtype=['game','player'], priority=[30, 110] )
|
||||||
|
@ -41,8 +41,10 @@ if env['OURPLATFORM'] == 'win32-vc':
|
|||||||
|
|
||||||
incs += ' ' + env['BF_SOLID_INC']
|
incs += ' ' + env['BF_SOLID_INC']
|
||||||
incs += ' ' + env['BF_PYTHON_INC']
|
incs += ' ' + env['BF_PYTHON_INC']
|
||||||
incs += ' ' + env['BF_SDL_INC']
|
|
||||||
incs += ' ' + env['BF_BULLET_INC']
|
incs += ' ' + env['BF_BULLET_INC']
|
||||||
incs += ' ' + env['BF_OPENGL_INC']
|
incs += ' ' + env['BF_OPENGL_INC']
|
||||||
|
|
||||||
|
if env['WITH_BF_SDL']:
|
||||||
|
incs += ' ' + env['BF_SDL_INC']
|
||||||
|
|
||||||
env.BlenderLib ( 'bf_ketsji', sources, Split(incs), [], libtype=['game','player'], priority=[25, 72], compileflags = cflags )
|
env.BlenderLib ( 'bf_ketsji', sources, Split(incs), [], libtype=['game','player'], priority=[25, 72], compileflags = cflags )
|
||||||
|
@ -99,7 +99,10 @@ def create_blender_liblist(lenv = None, libtype = None):
|
|||||||
sortlist.sort()
|
sortlist.sort()
|
||||||
for sk in sortlist:
|
for sk in sortlist:
|
||||||
v = curlib[sk]
|
v = curlib[sk]
|
||||||
lst.append('#' + root_build_dir + 'lib/'+lenv['LIBPREFIX'] + v + lenv['LIBSUFFIX'])
|
target = root_build_dir + 'lib/'+lenv['LIBPREFIX'] + v + lenv['LIBSUFFIX']
|
||||||
|
if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
|
||||||
|
target = '#'+target
|
||||||
|
lst.append(target)
|
||||||
|
|
||||||
return lst
|
return lst
|
||||||
|
|
||||||
@ -324,7 +327,6 @@ def AppIt(target=None, source=None, env=None):
|
|||||||
if b=='verse':
|
if b=='verse':
|
||||||
print bc.OKBLUE+"no bundle for verse"+bc.ENDC
|
print bc.OKBLUE+"no bundle for verse"+bc.ENDC
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
sourcedir = bldroot + '/source/darwin/%s.app'%binary
|
sourcedir = bldroot + '/source/darwin/%s.app'%binary
|
||||||
sourceinfo = bldroot + "/source/darwin/%s.app/Contents/Info.plist"%binary
|
sourceinfo = bldroot + "/source/darwin/%s.app/Contents/Info.plist"%binary
|
||||||
@ -419,10 +421,6 @@ class BlenderEnvironment(SConsEnvironment):
|
|||||||
lenv = self.Clone()
|
lenv = self.Clone()
|
||||||
lenv.Append(CPPPATH=includes)
|
lenv.Append(CPPPATH=includes)
|
||||||
lenv.Append(CPPDEFINES=defines)
|
lenv.Append(CPPDEFINES=defines)
|
||||||
if lenv['WITH_BF_GAMEENGINE']:
|
|
||||||
lenv.Append(CPPDEFINES=['GAMEBLENDER=1'])
|
|
||||||
if lenv['WITH_BF_BULLET']:
|
|
||||||
lenv.Append(CPPDEFINES=['WITH_BULLET=1'])
|
|
||||||
if lenv['BF_DEBUG'] or (libname in quickdebug):
|
if lenv['BF_DEBUG'] or (libname in quickdebug):
|
||||||
lenv.Append(CFLAGS = lenv['BF_DEBUG_CFLAGS'])
|
lenv.Append(CFLAGS = lenv['BF_DEBUG_CFLAGS'])
|
||||||
lenv.Append(CCFLAGS = lenv['BF_DEBUG_CCFLAGS'])
|
lenv.Append(CCFLAGS = lenv['BF_DEBUG_CCFLAGS'])
|
||||||
@ -442,9 +440,13 @@ class BlenderEnvironment(SConsEnvironment):
|
|||||||
if cxx_compileflags:
|
if cxx_compileflags:
|
||||||
lenv.Append(CXXFLAGS = cxx_compileflags)
|
lenv.Append(CXXFLAGS = cxx_compileflags)
|
||||||
lenv.Append(CFLAGS = lenv['C_WARN'])
|
lenv.Append(CFLAGS = lenv['C_WARN'])
|
||||||
lenv.Append(CCLAGS = lenv['CC_WARN'])
|
lenv.Append(CCFLAGS = lenv['CC_WARN'])
|
||||||
lenv.Append(CXXFLAGS = lenv['CXX_WARN'])
|
lenv.Append(CXXFLAGS = lenv['CXX_WARN'])
|
||||||
lib = lenv.Library(target= '#'+root_build_dir+'lib/'+libname, source=sources)
|
|
||||||
|
targetdir = root_build_dir+'lib/' + libname
|
||||||
|
if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
|
||||||
|
targetdir = '#'+targetdir
|
||||||
|
lib = lenv.Library(target= targetdir, source=sources)
|
||||||
SConsEnvironment.Default(self, lib) # we add to default target, because this way we get some kind of progress info during build
|
SConsEnvironment.Default(self, lib) # we add to default target, because this way we get some kind of progress info during build
|
||||||
else:
|
else:
|
||||||
print bc.WARNING+'Not building '+bc.ENDC+bc.OKGREEN+libname+bc.ENDC+' for '+bc.OKBLUE+'BF_QUICK'+bc.ENDC
|
print bc.WARNING+'Not building '+bc.ENDC+bc.OKGREEN+libname+bc.ENDC+' for '+bc.OKBLUE+'BF_QUICK'+bc.ENDC
|
||||||
@ -476,6 +478,8 @@ class BlenderEnvironment(SConsEnvironment):
|
|||||||
if lenv['BF_PROFILE']:
|
if lenv['BF_PROFILE']:
|
||||||
lenv.Append(LINKFLAGS = lenv['BF_PROFILE_FLAGS'])
|
lenv.Append(LINKFLAGS = lenv['BF_PROFILE_FLAGS'])
|
||||||
lenv.Append(CPPPATH=includes)
|
lenv.Append(CPPPATH=includes)
|
||||||
|
if root_build_dir[0]==os.sep or root_build_dir[1]==':':
|
||||||
|
lenv.Append(LIBPATH=root_build_dir + '/lib')
|
||||||
lenv.Append(LIBPATH=libpath)
|
lenv.Append(LIBPATH=libpath)
|
||||||
lenv.Append(LIBS=libs)
|
lenv.Append(LIBS=libs)
|
||||||
if lenv['WITH_BF_QUICKTIME']:
|
if lenv['WITH_BF_QUICKTIME']:
|
||||||
|
890
tools/btools.py
890
tools/btools.py
@ -5,9 +5,9 @@ import SCons.Options
|
|||||||
|
|
||||||
import SCons.Variables
|
import SCons.Variables
|
||||||
try:
|
try:
|
||||||
import subprocess
|
import subprocess
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
import string
|
import string
|
||||||
import glob
|
import glob
|
||||||
import shutil
|
import shutil
|
||||||
@ -17,260 +17,262 @@ Variables = SCons.Variables
|
|||||||
BoolVariable = SCons.Variables.BoolVariable
|
BoolVariable = SCons.Variables.BoolVariable
|
||||||
|
|
||||||
def print_arguments(args, bc):
|
def print_arguments(args, bc):
|
||||||
if len(args):
|
if len(args):
|
||||||
for k,v in args.iteritems():
|
for k,v in args.iteritems():
|
||||||
print '\t'+bc.OKBLUE+k+bc.ENDC+' = '+bc.OKGREEN + v + bc.ENDC
|
print '\t'+bc.OKBLUE+k+bc.ENDC+' = '+bc.OKGREEN + v + bc.ENDC
|
||||||
else:
|
else:
|
||||||
print '\t'+bc.WARNING+'No command-line arguments given'+bc.ENDC
|
print '\t'+bc.WARNING+'No command-line arguments given'+bc.ENDC
|
||||||
|
|
||||||
def validate_arguments(args, bc):
|
def validate_arguments(args, bc):
|
||||||
opts_list = [
|
opts_list = [
|
||||||
'WITH_BF_PYTHON', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'BF_PYTHON_LINKFLAGS', 'WITH_BF_STATICPYTHON', 'BF_PYTHON_LIB_STATIC',
|
'WITH_BF_PYTHON', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'BF_PYTHON_LINKFLAGS', 'WITH_BF_STATICPYTHON', 'BF_PYTHON_LIB_STATIC',
|
||||||
'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC',
|
'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC',
|
||||||
'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH',
|
'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH',
|
||||||
'BF_PTHREADS', 'BF_PTHREADS_INC', 'BF_PTHREADS_LIB', 'BF_PTHREADS_LIBPATH',
|
'BF_PTHREADS', 'BF_PTHREADS_INC', 'BF_PTHREADS_LIB', 'BF_PTHREADS_LIBPATH',
|
||||||
'WITH_BF_FMOD',
|
'WITH_BF_FMOD',
|
||||||
'WITH_BF_OPENEXR', 'BF_OPENEXR', 'BF_OPENEXR_INC', 'BF_OPENEXR_LIB', 'BF_OPENEXR_LIBPATH', 'WITH_BF_STATICOPENEXR', 'BF_OPENEXR_LIB_STATIC',
|
'WITH_BF_OPENEXR', 'BF_OPENEXR', 'BF_OPENEXR_INC', 'BF_OPENEXR_LIB', 'BF_OPENEXR_LIBPATH', 'WITH_BF_STATICOPENEXR', 'BF_OPENEXR_LIB_STATIC',
|
||||||
'WITH_BF_DDS',
|
'WITH_BF_DDS',
|
||||||
'WITH_BF_FFMPEG', 'BF_FFMPEG_LIB','BF_FFMPEG_EXTRA', 'BF_FFMPEG', 'BF_FFMPEG_INC',
|
'WITH_BF_FFMPEG', 'BF_FFMPEG_LIB','BF_FFMPEG_EXTRA', 'BF_FFMPEG', 'BF_FFMPEG_INC',
|
||||||
'WITH_BF_OGG', 'BF_OGG', 'BF_OGG_LIB',
|
'WITH_BF_OGG', 'BF_OGG', 'BF_OGG_LIB',
|
||||||
'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH',
|
'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH',
|
||||||
'WITH_BF_PNG', 'BF_PNG', 'BF_PNG_INC', 'BF_PNG_LIB', 'BF_PNG_LIBPATH',
|
'WITH_BF_PNG', 'BF_PNG', 'BF_PNG_INC', 'BF_PNG_LIB', 'BF_PNG_LIBPATH',
|
||||||
'BF_TIFF', 'BF_TIFF_INC',
|
'BF_TIFF', 'BF_TIFF_INC', 'BF_TIFF_LIB', 'BF_TIFF_LIBPATH',
|
||||||
'WITH_BF_ZLIB', 'BF_ZLIB', 'BF_ZLIB_INC', 'BF_ZLIB_LIB', 'BF_ZLIB_LIBPATH',
|
'WITH_BF_ZLIB', 'BF_ZLIB', 'BF_ZLIB_INC', 'BF_ZLIB_LIB', 'BF_ZLIB_LIBPATH',
|
||||||
'WITH_BF_INTERNATIONAL',
|
'WITH_BF_INTERNATIONAL',
|
||||||
'BF_GETTEXT', 'BF_GETTEXT_INC', 'BF_GETTEXT_LIB', 'BF_GETTEXT_LIBPATH',
|
'BF_GETTEXT', 'BF_GETTEXT_INC', 'BF_GETTEXT_LIB', 'BF_GETTEXT_LIBPATH',
|
||||||
'WITH_BF_ICONV', 'BF_ICONV', 'BF_ICONV_INC', 'BF_ICONV_LIB', 'BF_ICONV_LIBPATH',
|
'WITH_BF_ICONV', 'BF_ICONV', 'BF_ICONV_INC', 'BF_ICONV_LIB', 'BF_ICONV_LIBPATH',
|
||||||
'WITH_BF_ODE', 'BF_ODE', 'BF_ODE_INC', 'BF_ODE_LIB',
|
'WITH_BF_ODE', 'BF_ODE', 'BF_ODE_INC', 'BF_ODE_LIB',
|
||||||
'WITH_BF_GAMEENGINE', 'WITH_BF_BULLET', 'BF_BULLET', 'BF_BULLET_INC', 'BF_BULLET_LIB',
|
'WITH_BF_GAMEENGINE', 'WITH_BF_BULLET', 'BF_BULLET', 'BF_BULLET_INC', 'BF_BULLET_LIB',
|
||||||
'BF_SOLID', 'BF_SOLID_INC', 'BF_WINTAB', 'BF_WINTAB_INC',
|
'BF_SOLID', 'BF_SOLID_INC', 'BF_WINTAB', 'BF_WINTAB_INC',
|
||||||
'WITH_BF_YAFRAY',
|
'WITH_BF_YAFRAY',
|
||||||
'WITH_BF_FREETYPE', 'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH',
|
'WITH_BF_FREETYPE', 'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH',
|
||||||
'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH',
|
'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH',
|
||||||
'WITH_BF_STATICOPENGL', 'BF_OPENGL', 'BF_OPENGL_INC', 'BF_OPENGL_LIB', 'BF_OPENGL_LIBPATH', 'BF_OPENGL_LIB_STATIC', 'BF_OPENGL_LINKFLAGS',
|
'WITH_BF_STATICOPENGL', 'BF_OPENGL', 'BF_OPENGL_INC', 'BF_OPENGL_LIB', 'BF_OPENGL_LIBPATH', 'BF_OPENGL_LIB_STATIC', 'BF_OPENGL_LINKFLAGS',
|
||||||
'WITH_BF_FTGL', 'BF_FTGL', 'BF_FTGL_INC', 'BF_FTGL_LIB',
|
'WITH_BF_FTGL', 'BF_FTGL', 'BF_FTGL_INC', 'BF_FTGL_LIB',
|
||||||
'WITH_BF_PLAYER',
|
'WITH_BF_PLAYER',
|
||||||
'WITH_BF_NOBLENDER',
|
'WITH_BF_NOBLENDER',
|
||||||
'WITH_BF_BINRELOC',
|
'WITH_BF_BINRELOC',
|
||||||
'CFLAGS', 'CCFLAGS', 'CXXFLAGS', 'CPPFLAGS',
|
'CFLAGS', 'CCFLAGS', 'CXXFLAGS', 'CPPFLAGS',
|
||||||
'REL_CFLAGS', 'REL_CCFLAGS', 'REL_CXXFLAGS',
|
'REL_CFLAGS', 'REL_CCFLAGS', 'REL_CXXFLAGS',
|
||||||
'BF_PROFILE_FLAGS', 'BF_PROFILE_FLAGS', 'BF_PROFILE_CXXFLAGS',
|
'BF_PROFILE_FLAGS', 'BF_PROFILE_FLAGS', 'BF_PROFILE_CXXFLAGS',
|
||||||
'BF_DEBUG_CFLAGS', 'BF_DEBUG_CCFLAGS', 'BF_DEBUG_CXXFLAGS',
|
'BF_DEBUG_CFLAGS', 'BF_DEBUG_CCFLAGS', 'BF_DEBUG_CXXFLAGS',
|
||||||
'C_WARN', 'CC_WARN', 'CXX_WARN',
|
'C_WARN', 'CC_WARN', 'CXX_WARN',
|
||||||
'LLIBS', 'PLATFORM_LINKFLAGS',
|
'LLIBS', 'PLATFORM_LINKFLAGS',
|
||||||
'LCGDIR',
|
'LCGDIR',
|
||||||
'BF_CXX', 'WITH_BF_STATICCXX', 'BF_CXX_LIB_STATIC',
|
'BF_CXX', 'WITH_BF_STATICCXX', 'BF_CXX_LIB_STATIC',
|
||||||
'WITH_BF_VERSE', 'BF_VERSE_INCLUDE',
|
'WITH_BF_VERSE', 'BF_VERSE_INCLUDE',
|
||||||
'VERSE_BUILD_BINARY', 'VERSE_BUILD_DIR', 'VERSE_REGEN_PROTO',
|
'VERSE_BUILD_BINARY', 'VERSE_BUILD_DIR', 'VERSE_REGEN_PROTO',
|
||||||
'BF_TWEAK_MODE', 'BF_SPLIT_SRC',
|
'BF_TWEAK_MODE', 'BF_SPLIT_SRC',
|
||||||
'WITHOUT_BF_INSTALL',
|
'WITHOUT_BF_INSTALL',
|
||||||
'WITH_BF_OPENMP',
|
'WITH_BF_OPENMP',
|
||||||
'WITHOUT_BF_INSTALL',
|
'WITHOUT_BF_INSTALL',
|
||||||
'BF_FANCY', 'BF_QUIET',
|
'BF_FANCY', 'BF_QUIET',
|
||||||
'BF_X264_CONFIG',
|
'BF_X264_CONFIG',
|
||||||
'BF_XVIDCORE_CONFIG',
|
'BF_XVIDCORE_CONFIG',
|
||||||
'WITH_BF_DOCS',
|
'WITH_BF_DOCS',
|
||||||
'BF_NUMJOBS',
|
'BF_NUMJOBS',
|
||||||
]
|
]
|
||||||
|
|
||||||
arg_list = ['BF_DEBUG', 'BF_QUIET', 'BF_CROSS', 'BF_UPDATE',
|
arg_list = ['BF_DEBUG', 'BF_QUIET', 'BF_CROSS', 'BF_UPDATE',
|
||||||
'BF_INSTALLDIR', 'BF_TOOLSET', 'BF_BINNAME',
|
'BF_INSTALLDIR', 'BF_TOOLSET', 'BF_BINNAME',
|
||||||
'BF_BUILDDIR', 'BF_FANCY', 'BF_QUICK', 'BF_PROFILE',
|
'BF_BUILDDIR', 'BF_FANCY', 'BF_QUICK', 'BF_PROFILE',
|
||||||
'BF_BSC', 'BF_CONFIG',
|
'BF_BSC', 'BF_CONFIG',
|
||||||
'BF_PRIORITYLIST', 'BF_BUILDINFO','CC', 'CXX', 'BF_QUICKDEBUG',
|
'BF_PRIORITYLIST', 'BF_BUILDINFO','CC', 'CXX', 'BF_QUICKDEBUG',
|
||||||
'BF_LISTDEBUG', 'LCGDIR', 'BF_X264_CONFIG', 'BF_XVIDCORE_CONFIG',
|
'BF_LISTDEBUG', 'LCGDIR', 'BF_X264_CONFIG', 'BF_XVIDCORE_CONFIG',
|
||||||
'BF_DOCDIR']
|
'BF_DOCDIR']
|
||||||
|
|
||||||
all_list = opts_list + arg_list
|
all_list = opts_list + arg_list
|
||||||
okdict = {}
|
okdict = {}
|
||||||
|
|
||||||
for k,v in args.iteritems():
|
for k,v in args.iteritems():
|
||||||
if k in all_list:
|
if k in all_list:
|
||||||
okdict[k] = v
|
okdict[k] = v
|
||||||
else:
|
else:
|
||||||
print '\t'+bc.WARNING+'Invalid argument: '+bc.ENDC+k+'='+v
|
print '\t'+bc.WARNING+'Invalid argument: '+bc.ENDC+k+'='+v
|
||||||
|
|
||||||
return okdict
|
return okdict
|
||||||
|
|
||||||
def print_targets(targs, bc):
|
def print_targets(targs, bc):
|
||||||
if len(targs)>0:
|
if len(targs)>0:
|
||||||
for t in targs:
|
for t in targs:
|
||||||
print '\t'+bc.OKBLUE+t+bc.ENDC
|
print '\t'+bc.OKBLUE+t+bc.ENDC
|
||||||
else:
|
else:
|
||||||
print '\t'+bc.WARNING+'No targets given, using '+bc.ENDC+bc.OKGREEN+'default'+bc.ENDC
|
print '\t'+bc.WARNING+'No targets given, using '+bc.ENDC+bc.OKGREEN+'default'+bc.ENDC
|
||||||
|
|
||||||
def validate_targets(targs, bc):
|
def validate_targets(targs, bc):
|
||||||
valid_list = ['.', 'blender', 'blenderstatic', 'blenderplayer', 'webplugin',
|
valid_list = ['.', 'blender', 'blenderstatic', 'blenderplayer', 'webplugin',
|
||||||
'blendernogame', 'blenderstaticnogame', 'blenderlite', 'release',
|
'blendernogame', 'blenderstaticnogame', 'blenderlite', 'release',
|
||||||
'everything', 'clean', 'install-bin', 'install', 'nsis']
|
'everything', 'clean', 'install-bin', 'install', 'nsis']
|
||||||
oklist = []
|
oklist = []
|
||||||
for t in targs:
|
for t in targs:
|
||||||
if t in valid_list:
|
if t in valid_list:
|
||||||
oklist.append(t)
|
oklist.append(t)
|
||||||
else:
|
else:
|
||||||
print '\t'+bc.WARNING+'Invalid target: '+bc.ENDC+t
|
print '\t'+bc.WARNING+'Invalid target: '+bc.ENDC+t
|
||||||
return oklist
|
return oklist
|
||||||
|
|
||||||
class ourSpawn:
|
class ourSpawn:
|
||||||
def ourspawn(self, sh, escape, cmd, args, env):
|
def ourspawn(self, sh, escape, cmd, args, env):
|
||||||
newargs = string.join(args[1:], ' ')
|
newargs = string.join(args[1:], ' ')
|
||||||
cmdline = cmd + " " + newargs
|
cmdline = cmd + " " + newargs
|
||||||
startupinfo = subprocess.STARTUPINFO()
|
startupinfo = subprocess.STARTUPINFO()
|
||||||
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||||
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False)
|
stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False)
|
||||||
data, err = proc.communicate()
|
data, err = proc.communicate()
|
||||||
rv = proc.wait()
|
rv = proc.wait()
|
||||||
if rv:
|
if rv:
|
||||||
print "====="
|
print "====="
|
||||||
print err
|
print err
|
||||||
print "====="
|
print "====="
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
def SetupSpawn( env ):
|
def SetupSpawn( env ):
|
||||||
buf = ourSpawn()
|
buf = ourSpawn()
|
||||||
buf.ourenv = env
|
buf.ourenv = env
|
||||||
env['SPAWN'] = buf.ourspawn
|
env['SPAWN'] = buf.ourspawn
|
||||||
|
|
||||||
|
|
||||||
def read_opts(cfg, args):
|
def read_opts(cfg, args):
|
||||||
localopts = Variables.Variables(cfg, args)
|
localopts = Variables.Variables(cfg, args)
|
||||||
localopts.AddVariables(
|
localopts.AddVariables(
|
||||||
('VERSE_BUILD_BINARY', 'Build a release or debug binary.', 'release'),
|
('VERSE_BUILD_BINARY', 'Build a release or debug binary.', 'release'),
|
||||||
('VERSE_BUILD_DIR', 'Target directory for intermediate files.', "${BF_BUILDDIR}/extern/verse"),
|
('VERSE_BUILD_DIR', 'Target directory for intermediate files.', "${BF_BUILDDIR}/extern/verse"),
|
||||||
('VERSE_REGEN_PROTO', 'Whether to regenerate the protocol files', 'yes'),
|
('VERSE_REGEN_PROTO', 'Whether to regenerate the protocol files', 'yes'),
|
||||||
(BoolVariable('WITH_BF_VERSE', 'Use VERSE if true', False)),
|
(BoolVariable('WITH_BF_VERSE', 'Use VERSE if true', False)),
|
||||||
('BF_VERSE_INCLUDE', 'verse include dir', '/usr/include'),
|
('BF_VERSE_INCLUDE', 'verse include dir', '/usr/include'),
|
||||||
('LCGDIR', 'location of cvs lib dir'),
|
('LCGDIR', 'location of cvs lib dir'),
|
||||||
('VERSE_BUILD_BINARY', 'Build a release or debug binary.', 'release'),
|
('VERSE_BUILD_BINARY', 'Build a release or debug binary.', 'release'),
|
||||||
('VERSE_BUILD_DIR', 'Target directory for intermediate files.', "${BF_BUILDDIR}/extern/verse"),
|
('VERSE_BUILD_DIR', 'Target directory for intermediate files.', "${BF_BUILDDIR}/extern/verse"),
|
||||||
('VERSE_REGEN_PROTO', 'Whether to regenerate the protocol files', 'yes'),
|
('VERSE_REGEN_PROTO', 'Whether to regenerate the protocol files', 'yes'),
|
||||||
('BF_DEBUG_LIBS', 'list of libraries to build with debug symbols'),
|
('BF_DEBUG_LIBS', 'list of libraries to build with debug symbols'),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_PYTHON', 'Compile with python', True)),
|
(BoolVariable('WITH_BF_PYTHON', 'Compile with python', True)),
|
||||||
('BF_PYTHON', 'base path for python', ''),
|
('BF_PYTHON', 'base path for python', ''),
|
||||||
('BF_PYTHON_VERSION', 'Python version to use', ''),
|
('BF_PYTHON_VERSION', 'Python version to use', ''),
|
||||||
('BF_PYTHON_INC', 'include path for Python headers', ''),
|
('BF_PYTHON_INC', 'include path for Python headers', ''),
|
||||||
('BF_PYTHON_BINARY', 'Path to the Python interpreter', ''),
|
('BF_PYTHON_BINARY', 'Path to the Python interpreter', ''),
|
||||||
('BF_PYTHON_LIB', 'Python library', ''),
|
('BF_PYTHON_LIB', 'Python library', ''),
|
||||||
('BF_PYTHON_LIB_STATIC', 'Python static libraries', ''),
|
('BF_PYTHON_LIB_STATIC', 'Python static libraries', ''),
|
||||||
('BF_PYTHON_LIBPATH', 'Library path', ''),
|
('BF_PYTHON_LIBPATH', 'Library path', ''),
|
||||||
('BF_PYTHON_LINKFLAGS', 'Python link flags', ''),
|
('BF_PYTHON_LINKFLAGS', 'Python link flags', ''),
|
||||||
(BoolVariable('WITH_BF_STATICPYTHON', 'Staticly link to python', False)),
|
(BoolVariable('WITH_BF_STATICPYTHON', 'Staticly link to python', False)),
|
||||||
|
|
||||||
(BoolVariable('BF_NO_ELBEEM', 'Disable Fluid Sim', False)),
|
(BoolVariable('BF_NO_ELBEEM', 'Disable Fluid Sim', False)),
|
||||||
(BoolVariable('WITH_BF_YAFRAY', 'Enable Yafray', True)),
|
(BoolVariable('WITH_BF_YAFRAY', 'Enable Yafray', True)),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_OPENAL', 'Use OpenAL if true', False)),
|
(BoolVariable('WITH_BF_OPENAL', 'Use OpenAL if true', False)),
|
||||||
('BF_OPENAL', 'base path for OpenAL', ''),
|
('BF_OPENAL', 'base path for OpenAL', ''),
|
||||||
('BF_OPENAL_INC', 'include path for python headers', ''),
|
('BF_OPENAL_INC', 'include path for python headers', ''),
|
||||||
('BF_OPENAL_LIB', 'Path to OpenAL library', ''),
|
('BF_OPENAL_LIB', 'Path to OpenAL library', ''),
|
||||||
('BF_OPENAL_LIB_STATIC', 'Path to OpenAL static library', ''),
|
('BF_OPENAL_LIB_STATIC', 'Path to OpenAL static library', ''),
|
||||||
('BF_OPENAL_LIBPATH', 'Path to OpenAL library', ''),
|
('BF_OPENAL_LIBPATH', 'Path to OpenAL library', ''),
|
||||||
(BoolVariable('WITH_BF_STATICOPENAL', 'Staticly link to openal', False)),
|
(BoolVariable('WITH_BF_STATICOPENAL', 'Staticly link to openal', False)),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_SDL', 'Use SDL if true', False)),
|
(BoolVariable('WITH_BF_SDL', 'Use SDL if true', False)),
|
||||||
('BF_SDL', 'SDL base path', ''),
|
('BF_SDL', 'SDL base path', ''),
|
||||||
('BF_SDL_INC', 'SDL include path', ''), #$(shell $(BF_SDL)/bin/sdl-config --cflags)
|
('BF_SDL_INC', 'SDL include path', ''), #$(shell $(BF_SDL)/bin/sdl-config --cflags)
|
||||||
('BF_SDL_LIB', 'SDL library', ''), #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
|
('BF_SDL_LIB', 'SDL library', ''), #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
|
||||||
('BF_SDL_LIBPATH', 'SDL library path', ''),
|
('BF_SDL_LIBPATH', 'SDL library path', ''),
|
||||||
|
|
||||||
('BF_PTHREADS', 'Pthreads base path', ''),
|
('BF_PTHREADS', 'Pthreads base path', ''),
|
||||||
('BF_PTHREADS_INC', 'Pthreads include path', ''),
|
('BF_PTHREADS_INC', 'Pthreads include path', ''),
|
||||||
('BF_PTHREADS_LIB', 'Pthreads library', ''),
|
('BF_PTHREADS_LIB', 'Pthreads library', ''),
|
||||||
('BF_PTHREADS_LIBPATH', 'Pthreads library path', ''),
|
('BF_PTHREADS_LIBPATH', 'Pthreads library path', ''),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_FMOD', 'Use FMOD if true', False)),
|
(BoolVariable('WITH_BF_FMOD', 'Use FMOD if true', False)),
|
||||||
# BF_FMOD = $(LCGDIR)/fmod
|
# BF_FMOD = $(LCGDIR)/fmod
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_OPENEXR', 'Use OPENEXR if true', True)),
|
(BoolVariable('WITH_BF_OPENEXR', 'Use OPENEXR if true', True)),
|
||||||
(BoolVariable('WITH_BF_STATICOPENEXR', 'Staticly link to OpenEXR', False)),
|
(BoolVariable('WITH_BF_STATICOPENEXR', 'Staticly link to OpenEXR', False)),
|
||||||
('BF_OPENEXR', 'OPENEXR base path', ''),
|
('BF_OPENEXR', 'OPENEXR base path', ''),
|
||||||
('BF_OPENEXR_INC', 'OPENEXR include path', ''),
|
('BF_OPENEXR_INC', 'OPENEXR include path', ''),
|
||||||
('BF_OPENEXR_LIB', 'OPENEXR library', ''),
|
('BF_OPENEXR_LIB', 'OPENEXR library', ''),
|
||||||
('BF_OPENEXR_LIBPATH', 'OPENEXR library path', ''),
|
('BF_OPENEXR_LIBPATH', 'OPENEXR library path', ''),
|
||||||
('BF_OPENEXR_LIB_STATIC', 'OPENEXR static library', ''),
|
('BF_OPENEXR_LIB_STATIC', 'OPENEXR static library', ''),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_DDS', 'Use DDS if true', True)),
|
(BoolVariable('WITH_BF_DDS', 'Use DDS if true', True)),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_FFMPEG', 'Use FFMPEG if true', False)),
|
(BoolVariable('WITH_BF_FFMPEG', 'Use FFMPEG if true', False)),
|
||||||
('BF_FFMPEG', 'FFMPEG base path', ''),
|
('BF_FFMPEG', 'FFMPEG base path', ''),
|
||||||
('BF_FFMPEG_LIB', 'FFMPEG library', ''),
|
('BF_FFMPEG_LIB', 'FFMPEG library', ''),
|
||||||
('BF_FFMPEG_EXTRA', 'FFMPEG flags that must be preserved', ''),
|
('BF_FFMPEG_EXTRA', 'FFMPEG flags that must be preserved', ''),
|
||||||
|
|
||||||
('BF_FFMPEG_INC', 'FFMPEG includes', ''),
|
('BF_FFMPEG_INC', 'FFMPEG includes', ''),
|
||||||
('BF_FFMPEG_LIBPATH', 'FFMPEG library path', ''),
|
('BF_FFMPEG_LIBPATH', 'FFMPEG library path', ''),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_OGG', 'Use OGG, THEORA, VORBIS in FFMPEG if true',
|
(BoolVariable('WITH_BF_OGG', 'Use OGG, THEORA, VORBIS in FFMPEG if true',
|
||||||
False)),
|
False)),
|
||||||
('BF_OGG', 'OGG base path', ''),
|
('BF_OGG', 'OGG base path', ''),
|
||||||
('BF_OGG_LIB', 'OGG library', ''),
|
('BF_OGG_LIB', 'OGG library', ''),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_JPEG', 'Use JPEG if true', True)),
|
(BoolVariable('WITH_BF_JPEG', 'Use JPEG if true', True)),
|
||||||
('BF_JPEG', 'JPEG base path', ''),
|
('BF_JPEG', 'JPEG base path', ''),
|
||||||
('BF_JPEG_INC', 'JPEG include path', ''),
|
('BF_JPEG_INC', 'JPEG include path', ''),
|
||||||
('BF_JPEG_LIB', 'JPEG library', ''),
|
('BF_JPEG_LIB', 'JPEG library', ''),
|
||||||
('BF_JPEG_LIBPATH', 'JPEG library path', ''),
|
('BF_JPEG_LIBPATH', 'JPEG library path', ''),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_OPENJPEG', 'Use OPENJPEG if true', False)),
|
(BoolVariable('WITH_BF_OPENJPEG', 'Use OPENJPEG if true', False)),
|
||||||
('BF_OPENJPEG', 'OPENJPEG base path', ''),
|
('BF_OPENJPEG', 'OPENJPEG base path', ''),
|
||||||
('BF_OPENJPEG_INC', 'OPENJPEG include path', ''),
|
('BF_OPENJPEG_INC', 'OPENJPEG include path', ''),
|
||||||
('BF_OPENJPEG_LIB', 'OPENJPEG library', ''),
|
('BF_OPENJPEG_LIB', 'OPENJPEG library', ''),
|
||||||
('BF_OPENJPEG_LIBPATH', 'OPENJPEG library path', ''),
|
('BF_OPENJPEG_LIBPATH', 'OPENJPEG library path', ''),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_REDCODE', 'Use REDCODE if true', False)),
|
(BoolVariable('WITH_BF_REDCODE', 'Use REDCODE if true', False)),
|
||||||
('BF_REDCODE', 'REDCODE base path', ''),
|
('BF_REDCODE', 'REDCODE base path', ''),
|
||||||
('BF_REDCODE_INC', 'REDCODE include path', ''),
|
('BF_REDCODE_INC', 'REDCODE include path', ''),
|
||||||
('BF_REDCODE_LIB', 'REDCODE library', ''),
|
('BF_REDCODE_LIB', 'REDCODE library', ''),
|
||||||
('BF_REDCODE_LIBPATH', 'REDCODE library path', ''),
|
('BF_REDCODE_LIBPATH', 'REDCODE library path', ''),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_PNG', 'Use PNG if true', True)),
|
(BoolVariable('WITH_BF_PNG', 'Use PNG if true', True)),
|
||||||
('BF_PNG', 'PNG base path', ''),
|
('BF_PNG', 'PNG base path', ''),
|
||||||
('BF_PNG_INC', 'PNG include path', ''),
|
('BF_PNG_INC', 'PNG include path', ''),
|
||||||
('BF_PNG_LIB', 'PNG library', ''),
|
('BF_PNG_LIB', 'PNG library', ''),
|
||||||
('BF_PNG_LIBPATH', 'PNG library path', ''),
|
('BF_PNG_LIBPATH', 'PNG library path', ''),
|
||||||
|
|
||||||
('BF_TIFF', 'TIFF base path', ''),
|
('BF_TIFF', 'TIFF base path', ''),
|
||||||
('BF_TIFF_INC', 'TIFF include path', ''),
|
('BF_TIFF_INC', 'TIFF include path', ''),
|
||||||
|
('BF_TIFF_LIB', 'TIFF library', ''),
|
||||||
|
('BF_TIFF_LIBPATH', 'TIFF library path', ''),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_ZLIB', 'Use ZLib if true', True)),
|
(BoolVariable('WITH_BF_ZLIB', 'Use ZLib if true', True)),
|
||||||
('BF_ZLIB', 'ZLib base path', ''),
|
('BF_ZLIB', 'ZLib base path', ''),
|
||||||
('BF_ZLIB_INC', 'ZLib include path', ''),
|
('BF_ZLIB_INC', 'ZLib include path', ''),
|
||||||
('BF_ZLIB_LIB', 'ZLib library', ''),
|
('BF_ZLIB_LIB', 'ZLib library', ''),
|
||||||
('BF_ZLIB_LIBPATH', 'ZLib library path', ''),
|
('BF_ZLIB_LIBPATH', 'ZLib library path', ''),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_INTERNATIONAL', 'Use Gettext and Freetype if true', True)),
|
(BoolVariable('WITH_BF_INTERNATIONAL', 'Use Gettext and Freetype if true', True)),
|
||||||
|
|
||||||
('BF_GETTEXT', 'gettext base path', ''),
|
('BF_GETTEXT', 'gettext base path', ''),
|
||||||
('BF_GETTEXT_INC', 'gettext include path', ''),
|
('BF_GETTEXT_INC', 'gettext include path', ''),
|
||||||
('BF_GETTEXT_LIB', 'gettext library', ''),
|
('BF_GETTEXT_LIB', 'gettext library', ''),
|
||||||
('BF_GETTEXT_LIBPATH', 'gettext library path', ''),
|
('BF_GETTEXT_LIBPATH', 'gettext library path', ''),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_ICONV', 'Use iconv if true', True)),
|
(BoolVariable('WITH_BF_ICONV', 'Use iconv if true', True)),
|
||||||
('BF_ICONV', 'iconv base path', ''),
|
('BF_ICONV', 'iconv base path', ''),
|
||||||
('BF_ICONV_INC', 'iconv include path', ''),
|
('BF_ICONV_INC', 'iconv include path', ''),
|
||||||
('BF_ICONV_LIB', 'iconv library', ''),
|
('BF_ICONV_LIB', 'iconv library', ''),
|
||||||
('BF_ICONV_LIBPATH', 'iconv library path', ''),
|
('BF_ICONV_LIBPATH', 'iconv library path', ''),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_GAMEENGINE', 'Build with gameengine' , True)),
|
(BoolVariable('WITH_BF_GAMEENGINE', 'Build with gameengine' , True)),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_ODE', 'Use ODE if true', True)),
|
(BoolVariable('WITH_BF_ODE', 'Use ODE if true', True)),
|
||||||
('BF_ODE', 'ODE base path', ''),
|
('BF_ODE', 'ODE base path', ''),
|
||||||
('BF_ODE_INC', 'ODE include path' , ''),
|
('BF_ODE_INC', 'ODE include path' , ''),
|
||||||
('BF_ODE_LIB', 'ODE library', ''),
|
('BF_ODE_LIB', 'ODE library', ''),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_BULLET', 'Use Bullet if true', True)),
|
(BoolVariable('WITH_BF_BULLET', 'Use Bullet if true', True)),
|
||||||
('BF_BULLET', 'Bullet base dir', ''),
|
('BF_BULLET', 'Bullet base dir', ''),
|
||||||
('BF_BULLET_INC', 'Bullet include path', ''),
|
('BF_BULLET_INC', 'Bullet include path', ''),
|
||||||
('BF_BULLET_LIB', 'Bullet library', ''),
|
('BF_BULLET_LIB', 'Bullet library', ''),
|
||||||
|
|
||||||
('BF_SOLID', 'Solid base dir', '#/extern/solid'),
|
('BF_SOLID', 'Solid base dir', '#/extern/solid'),
|
||||||
('BF_SOLID_INC', 'Solid include path', ''),
|
('BF_SOLID_INC', 'Solid include path', ''),
|
||||||
('BF_WINTAB', 'WinTab base dir', ''),
|
('BF_WINTAB', 'WinTab base dir', ''),
|
||||||
('BF_WINTAB_INC', 'WinTab include dir', ''),
|
('BF_WINTAB_INC', 'WinTab include dir', ''),
|
||||||
('BF_CXX', 'c++ base path for libstdc++, only used when static linking', ''),
|
('BF_CXX', 'c++ base path for libstdc++, only used when static linking', ''),
|
||||||
(BoolVariable('WITH_BF_STATICCXX', 'static link to stdc++', False)),
|
(BoolVariable('WITH_BF_STATICCXX', 'static link to stdc++', False)),
|
||||||
('BF_CXX_LIB_STATIC', 'static library path for stdc++', ''),
|
('BF_CXX_LIB_STATIC', 'static library path for stdc++', ''),
|
||||||
##
|
##
|
||||||
##WITH_BF_NSPR = True
|
##WITH_BF_NSPR = True
|
||||||
##BF_NSPR = $(LCGDIR)/nspr
|
##BF_NSPR = $(LCGDIR)/nspr
|
||||||
@ -289,273 +291,273 @@ def read_opts(cfg, args):
|
|||||||
##BF_PARANOID = True
|
##BF_PARANOID = True
|
||||||
##
|
##
|
||||||
### enable freetype2 support for text objects
|
### enable freetype2 support for text objects
|
||||||
(BoolVariable('WITH_BF_FREETYPE', 'Use FreeType2 if true', False)),
|
(BoolVariable('WITH_BF_FREETYPE', 'Use FreeType2 if true', False)),
|
||||||
('BF_FREETYPE', 'Freetype base path', ''),
|
('BF_FREETYPE', 'Freetype base path', ''),
|
||||||
('BF_FREETYPE_INC', 'Freetype include path', ''),
|
('BF_FREETYPE_INC', 'Freetype include path', ''),
|
||||||
('BF_FREETYPE_LIB', 'Freetype library', ''),
|
('BF_FREETYPE_LIB', 'Freetype library', ''),
|
||||||
('BF_FREETYPE_LIBPATH', 'Freetype library path', ''),
|
('BF_FREETYPE_LIBPATH', 'Freetype library path', ''),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_OPENMP', 'Use OpenMP if true', False)),
|
(BoolVariable('WITH_BF_OPENMP', 'Use OpenMP if true', False)),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_QUICKTIME', 'Use QuickTime if true', False)),
|
(BoolVariable('WITH_BF_QUICKTIME', 'Use QuickTime if true', False)),
|
||||||
('BF_QUICKTIME', 'QuickTime base path', ''),
|
('BF_QUICKTIME', 'QuickTime base path', ''),
|
||||||
('BF_QUICKTIME_INC', 'QuickTime include path', ''),
|
('BF_QUICKTIME_INC', 'QuickTime include path', ''),
|
||||||
('BF_QUICKTIME_LIB', 'QuickTime library', ''),
|
('BF_QUICKTIME_LIB', 'QuickTime library', ''),
|
||||||
('BF_QUICKTIME_LIBPATH', 'QuickTime library path', ''),
|
('BF_QUICKTIME_LIBPATH', 'QuickTime library path', ''),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_STATICOPENGL', 'Use MESA if true', True)),
|
(BoolVariable('WITH_BF_STATICOPENGL', 'Use MESA if true', True)),
|
||||||
('BF_OPENGL', 'OpenGL base path', ''),
|
('BF_OPENGL', 'OpenGL base path', ''),
|
||||||
('BF_OPENGL_INC', 'OpenGL include path', ''),
|
('BF_OPENGL_INC', 'OpenGL include path', ''),
|
||||||
('BF_OPENGL_LIB', 'OpenGL libraries', ''),
|
('BF_OPENGL_LIB', 'OpenGL libraries', ''),
|
||||||
('BF_OPENGL_LIBPATH', 'OpenGL library path', ''),
|
('BF_OPENGL_LIBPATH', 'OpenGL library path', ''),
|
||||||
('BF_OPENGL_LIB_STATIC', 'OpenGL static libraries', ''),
|
('BF_OPENGL_LIB_STATIC', 'OpenGL static libraries', ''),
|
||||||
('BF_OPENGL_LINKFLAGS', 'OpenGL link flags', ''),
|
('BF_OPENGL_LINKFLAGS', 'OpenGL link flags', ''),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_FTGL', 'Use FTGL if true', True)),
|
(BoolVariable('WITH_BF_FTGL', 'Use FTGL if true', True)),
|
||||||
('BF_FTGL', 'FTGL base path', ''),
|
('BF_FTGL', 'FTGL base path', ''),
|
||||||
('BF_FTGL_INC', 'FTGL include path', ''),
|
('BF_FTGL_INC', 'FTGL include path', ''),
|
||||||
('BF_FTGL_LIB', 'FTGL libraries', ''),
|
('BF_FTGL_LIB', 'FTGL libraries', ''),
|
||||||
|
|
||||||
(BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)),
|
(BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)),
|
||||||
(BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)),
|
(BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)),
|
||||||
|
|
||||||
('CFLAGS', 'C only flags', ''),
|
('CFLAGS', 'C only flags', ''),
|
||||||
('CCFLAGS', 'Generic C and C++ flags', ''),
|
('CCFLAGS', 'Generic C and C++ flags', ''),
|
||||||
('CXXFLAGS', 'C++ only flags', ''),
|
('CXXFLAGS', 'C++ only flags', ''),
|
||||||
('CPPFLAGS', 'Defines', ''),
|
('CPPFLAGS', 'Defines', ''),
|
||||||
('REL_CFLAGS', 'C only release flags', ''),
|
('REL_CFLAGS', 'C only release flags', ''),
|
||||||
('REL_CCFLAGS', 'Generic C and C++ release flags', ''),
|
('REL_CCFLAGS', 'Generic C and C++ release flags', ''),
|
||||||
('REL_CXXFLAGS', 'C++ only release flags', ''),
|
('REL_CXXFLAGS', 'C++ only release flags', ''),
|
||||||
|
|
||||||
('C_WARN', 'C warning flags', ''),
|
('C_WARN', 'C warning flags', ''),
|
||||||
('CC_WARN', 'Generic C and C++ warning flags', ''),
|
('CC_WARN', 'Generic C and C++ warning flags', ''),
|
||||||
('CXX_WARN', 'C++ only warning flags', ''),
|
('CXX_WARN', 'C++ only warning flags', ''),
|
||||||
|
|
||||||
('LLIBS', 'Platform libs', ''),
|
('LLIBS', 'Platform libs', ''),
|
||||||
('PLATFORM_LINKFLAGS', 'Platform linkflags', ''),
|
('PLATFORM_LINKFLAGS', 'Platform linkflags', ''),
|
||||||
|
|
||||||
(BoolVariable('BF_PROFILE', 'Add profiling information if true', False)),
|
(BoolVariable('BF_PROFILE', 'Add profiling information if true', False)),
|
||||||
('BF_PROFILE_CFLAGS', 'C only profiling flags', ''),
|
('BF_PROFILE_CFLAGS', 'C only profiling flags', ''),
|
||||||
('BF_PROFILE_CCFLAGS', 'C and C++ profiling flags', ''),
|
('BF_PROFILE_CCFLAGS', 'C and C++ profiling flags', ''),
|
||||||
('BF_PROFILE_CXXFLAGS', 'C++ only profiling flags', ''),
|
('BF_PROFILE_CXXFLAGS', 'C++ only profiling flags', ''),
|
||||||
|
|
||||||
(BoolVariable('BF_DEBUG', 'Add debug flags if true', False)),
|
(BoolVariable('BF_DEBUG', 'Add debug flags if true', False)),
|
||||||
('BF_DEBUG_CFLAGS', 'C only debug flags', ''),
|
('BF_DEBUG_CFLAGS', 'C only debug flags', ''),
|
||||||
('BF_DEBUG_CCFLAGS', 'C and C++ debug flags', ''),
|
('BF_DEBUG_CCFLAGS', 'C and C++ debug flags', ''),
|
||||||
('BF_DEBUG_CXXFLAGS', 'C++ only debug flags', ''),
|
('BF_DEBUG_CXXFLAGS', 'C++ only debug flags', ''),
|
||||||
|
|
||||||
(BoolVariable('BF_BSC', 'Create .bsc files (msvc only)', True)),
|
(BoolVariable('BF_BSC', 'Create .bsc files (msvc only)', True)),
|
||||||
|
|
||||||
('BF_BUILDDIR', 'Build dir', ''),
|
('BF_BUILDDIR', 'Build dir', ''),
|
||||||
('BF_INSTALLDIR', 'Installation dir', ''),
|
('BF_INSTALLDIR', 'Installation dir', ''),
|
||||||
('BF_DOCDIR', 'Dir where BPy documentation will be created', ''),
|
('BF_DOCDIR', 'Dir where BPy documentation will be created', ''),
|
||||||
|
|
||||||
('CC', 'C compiler to use', ''),
|
('CC', 'C compiler to use', ''),
|
||||||
('CXX', 'C++ compiler to use', ''),
|
('CXX', 'C++ compiler to use', ''),
|
||||||
|
|
||||||
(BoolVariable('BF_BUILDINFO', 'Buildtime in splash if true', True)),
|
(BoolVariable('BF_BUILDINFO', 'Buildtime in splash if true', True)),
|
||||||
|
|
||||||
(BoolVariable('BF_TWEAK_MODE', 'Enable tweak mode if true', False)),
|
(BoolVariable('BF_TWEAK_MODE', 'Enable tweak mode if true', False)),
|
||||||
(BoolVariable('BF_SPLIT_SRC', 'Split src lib into several chunks if true', False)),
|
(BoolVariable('BF_SPLIT_SRC', 'Split src lib into several chunks if true', False)),
|
||||||
(BoolVariable('WITHOUT_BF_INSTALL', 'dont install if true', False)),
|
(BoolVariable('WITHOUT_BF_INSTALL', 'dont install if true', False)),
|
||||||
(BoolVariable('BF_FANCY', 'Enable fancy output if true', True)),
|
(BoolVariable('BF_FANCY', 'Enable fancy output if true', True)),
|
||||||
(BoolVariable('BF_QUIET', 'Enable silent output if true', True)),
|
(BoolVariable('BF_QUIET', 'Enable silent output if true', True)),
|
||||||
(BoolVariable('WITH_BF_BINRELOC', 'Enable relocatable binary (linux only)', False)),
|
(BoolVariable('WITH_BF_BINRELOC', 'Enable relocatable binary (linux only)', False)),
|
||||||
|
|
||||||
('BF_X264_CONFIG', 'configuration flags for x264', ''),
|
('BF_X264_CONFIG', 'configuration flags for x264', ''),
|
||||||
('BF_XVIDCORE_CONFIG', 'configuration flags for xvidcore', ''),
|
('BF_XVIDCORE_CONFIG', 'configuration flags for xvidcore', ''),
|
||||||
(BoolVariable('WITH_BF_DOCS', 'Generate API documentation', False)),
|
(BoolVariable('WITH_BF_DOCS', 'Generate API documentation', False)),
|
||||||
|
|
||||||
('BF_CONFIG', 'SCons python config file used to set default options', 'user_config.py'),
|
('BF_CONFIG', 'SCons python config file used to set default options', 'user_config.py'),
|
||||||
('BF_NUMJOBS', 'Number of build processes to spawn', '1')
|
('BF_NUMJOBS', 'Number of build processes to spawn', '1')
|
||||||
|
|
||||||
) # end of opts.AddOptions()
|
) # end of opts.AddOptions()
|
||||||
|
|
||||||
return localopts
|
return localopts
|
||||||
|
|
||||||
def NSIS_print(target, source, env):
|
def NSIS_print(target, source, env):
|
||||||
return "Creating NSIS installer for Blender 3D"
|
return "Creating NSIS installer for Blender 3D"
|
||||||
|
|
||||||
def NSIS_Installer(target=None, source=None, env=None):
|
def NSIS_Installer(target=None, source=None, env=None):
|
||||||
|
|
||||||
if env['OURPLATFORM'] != 'win32-vc' and env['OURPLATFORM'] != 'win32-mingw':
|
if env['OURPLATFORM'] != 'win32-vc' and env['OURPLATFORM'] != 'win32-mingw':
|
||||||
print "NSIS installer is only available on Windows."
|
print "NSIS installer is only available on Windows."
|
||||||
Exit()
|
Exit()
|
||||||
|
|
||||||
start_dir = os.getcwd()
|
start_dir = os.getcwd()
|
||||||
rel_dir = start_dir + "\\release\\windows\\installer\\"
|
rel_dir = start_dir + "\\release\\windows\\installer\\"
|
||||||
install_base_dir = start_dir + "\\"
|
install_base_dir = start_dir + "\\"
|
||||||
|
|
||||||
if not os.path.exists(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include'):
|
if not os.path.exists(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include'):
|
||||||
os.mkdir(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include')
|
os.mkdir(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include')
|
||||||
|
|
||||||
for f in glob.glob('source/blender/blenpluginapi/*.h'):
|
for f in glob.glob('source/blender/blenpluginapi/*.h'):
|
||||||
shutil.copy(f,install_base_dir+env['BF_INSTALLDIR']+'/plugins/include')
|
shutil.copy(f,install_base_dir+env['BF_INSTALLDIR']+'/plugins/include')
|
||||||
|
|
||||||
shutil.copy('source/blender/blenpluginapi/plugin.def',install_base_dir+env['BF_INSTALLDIR']+'/plugins/include/')
|
shutil.copy('source/blender/blenpluginapi/plugin.def',install_base_dir+env['BF_INSTALLDIR']+'/plugins/include/')
|
||||||
|
|
||||||
os.chdir("release")
|
os.chdir("release")
|
||||||
v = open("VERSION")
|
v = open("VERSION")
|
||||||
version = v.read()[:-1]
|
version = v.read()[:-1]
|
||||||
shortver = version.split('.')[0] + version.split('.')[1]
|
shortver = version.split('.')[0] + version.split('.')[1]
|
||||||
v.close()
|
v.close()
|
||||||
|
|
||||||
#### change to suit install dir ####
|
#### change to suit install dir ####
|
||||||
inst_dir = install_base_dir + env['BF_INSTALLDIR']
|
inst_dir = install_base_dir + env['BF_INSTALLDIR']
|
||||||
|
|
||||||
os.chdir("windows/installer")
|
os.chdir("windows/installer")
|
||||||
|
|
||||||
ns = open("00.sconsblender.nsi","r")
|
ns = open("00.sconsblender.nsi","r")
|
||||||
|
|
||||||
ns_cnt = str(ns.read())
|
ns_cnt = str(ns.read())
|
||||||
ns.close()
|
ns.close()
|
||||||
|
|
||||||
# do root
|
# do root
|
||||||
rootlist = []
|
rootlist = []
|
||||||
rootdir = os.listdir(inst_dir+"\\")
|
rootdir = os.listdir(inst_dir+"\\")
|
||||||
for rootitem in rootdir:
|
for rootitem in rootdir:
|
||||||
if os.path.isdir(inst_dir+"\\"+ rootitem) == 0:
|
if os.path.isdir(inst_dir+"\\"+ rootitem) == 0:
|
||||||
rootlist.append("File \"" + os.path.normpath(inst_dir) + "\\" + rootitem+"\"")
|
rootlist.append("File \"" + os.path.normpath(inst_dir) + "\\" + rootitem+"\"")
|
||||||
rootstring = string.join(rootlist, "\n ")
|
rootstring = string.join(rootlist, "\n ")
|
||||||
rootstring += "\n\n"
|
rootstring += "\n\n"
|
||||||
ns_cnt = string.replace(ns_cnt, "[ROOTDIRCONTS]", rootstring)
|
ns_cnt = string.replace(ns_cnt, "[ROOTDIRCONTS]", rootstring)
|
||||||
|
|
||||||
# do delete items
|
# do delete items
|
||||||
delrootlist = []
|
delrootlist = []
|
||||||
for rootitem in rootdir:
|
for rootitem in rootdir:
|
||||||
if os.path.isdir(inst_dir + rootitem) == 0:
|
if os.path.isdir(inst_dir + rootitem) == 0:
|
||||||
delrootlist.append("Delete $INSTDIR\\" + rootitem)
|
delrootlist.append("Delete $INSTDIR\\" + rootitem)
|
||||||
delrootstring = string.join(delrootlist, "\n ")
|
delrootstring = string.join(delrootlist, "\n ")
|
||||||
delrootstring += "\n"
|
delrootstring += "\n"
|
||||||
ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring)
|
ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring)
|
||||||
|
|
||||||
# do scripts
|
# do scripts
|
||||||
scriptlist = []
|
scriptlist = []
|
||||||
scriptpath = "%s%s" % (inst_dir, "\\.blender\\scripts")
|
scriptpath = "%s%s" % (inst_dir, "\\.blender\\scripts")
|
||||||
scriptdir = os.listdir(scriptpath)
|
scriptdir = os.listdir(scriptpath)
|
||||||
for scriptitem in scriptdir:
|
for scriptitem in scriptdir:
|
||||||
scriptfile = "%s\\%s" % (scriptpath, scriptitem)
|
scriptfile = "%s\\%s" % (scriptpath, scriptitem)
|
||||||
if os.path.isdir(scriptfile) == 0:
|
if os.path.isdir(scriptfile) == 0:
|
||||||
scriptfile = os.path.normpath(scriptfile)
|
scriptfile = os.path.normpath(scriptfile)
|
||||||
scriptlist.append("File \"%s\"" % scriptfile)
|
scriptlist.append("File \"%s\"" % scriptfile)
|
||||||
scriptstring = string.join(scriptlist, "\n ")
|
scriptstring = string.join(scriptlist, "\n ")
|
||||||
scriptstring += "\n\n"
|
scriptstring += "\n\n"
|
||||||
ns_cnt = string.replace(ns_cnt, "[SCRIPTCONTS]", scriptstring)
|
ns_cnt = string.replace(ns_cnt, "[SCRIPTCONTS]", scriptstring)
|
||||||
|
|
||||||
# do scripts\bpymodules
|
# do scripts\bpymodules
|
||||||
bpymodlist = []
|
bpymodlist = []
|
||||||
bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules")
|
bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules")
|
||||||
bpymoddir = os.listdir(bpymodpath)
|
bpymoddir = os.listdir(bpymodpath)
|
||||||
|
|
||||||
for bpymoditem in bpymoddir:
|
for bpymoditem in bpymoddir:
|
||||||
bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
|
bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
|
||||||
if os.path.isdir(bpymodfile) == 0:
|
if os.path.isdir(bpymodfile) == 0:
|
||||||
bpymodfile = os.path.normpath(bpymodfile)
|
bpymodfile = os.path.normpath(bpymodfile)
|
||||||
bpymodlist.append("File \"%s\"" % bpymodfile)
|
bpymodlist.append("File \"%s\"" % bpymodfile)
|
||||||
bpymodstring = string.join(bpymodlist, "\n ")
|
bpymodstring = string.join(bpymodlist, "\n ")
|
||||||
bpymodstring += "\n\n"
|
bpymodstring += "\n\n"
|
||||||
ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCONTS]", bpymodstring)
|
ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCONTS]", bpymodstring)
|
||||||
|
|
||||||
# do scripts\bpymodules\colladaimex
|
# do scripts\bpymodules\colladaimex
|
||||||
colladalist = []
|
colladalist = []
|
||||||
bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules\\ColladaImEx")
|
bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules\\ColladaImEx")
|
||||||
bpymoddir = os.listdir(bpymodpath)
|
bpymoddir = os.listdir(bpymodpath)
|
||||||
|
|
||||||
for bpymoditem in bpymoddir:
|
for bpymoditem in bpymoddir:
|
||||||
bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
|
bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
|
||||||
if os.path.isdir(bpymodfile) == 0:
|
if os.path.isdir(bpymodfile) == 0:
|
||||||
bpymodfile=os.path.normpath(bpymodfile)
|
bpymodfile=os.path.normpath(bpymodfile)
|
||||||
colladalist.append("File \"%s\"" % bpymodfile)
|
colladalist.append("File \"%s\"" % bpymodfile)
|
||||||
bpymodstring = string.join(colladalist, "\n ")
|
bpymodstring = string.join(colladalist, "\n ")
|
||||||
bpymodstring += "\n\n"
|
bpymodstring += "\n\n"
|
||||||
ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCOLLADACONT]", bpymodstring)
|
ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCOLLADACONT]", bpymodstring)
|
||||||
|
|
||||||
# do scripts\bpydata
|
# do scripts\bpydata
|
||||||
bpydatalist = []
|
bpydatalist = []
|
||||||
bpydatapath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata")
|
bpydatapath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata")
|
||||||
bpydatadir = os.listdir(bpydatapath)
|
bpydatadir = os.listdir(bpydatapath)
|
||||||
for bpydataitem in bpydatadir:
|
for bpydataitem in bpydatadir:
|
||||||
bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem)
|
bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem)
|
||||||
if os.path.isdir(bpydatafile) == 0:
|
if os.path.isdir(bpydatafile) == 0:
|
||||||
bpydatalist.append("File \"%s\"" % bpydatafile)
|
bpydatalist.append("File \"%s\"" % bpydatafile)
|
||||||
bpydatastring = string.join(bpydatalist, "\n ")
|
bpydatastring = string.join(bpydatalist, "\n ")
|
||||||
bpydatastring += "\n\n"
|
bpydatastring += "\n\n"
|
||||||
ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACONTS]", bpydatastring)
|
ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACONTS]", bpydatastring)
|
||||||
|
|
||||||
# do plugins\include
|
# do plugins\include
|
||||||
plugincludelist = []
|
plugincludelist = []
|
||||||
plugincludepath = "%s%s" % (inst_dir, "\\plugins\\include")
|
plugincludepath = "%s%s" % (inst_dir, "\\plugins\\include")
|
||||||
plugincludedir = os.listdir(plugincludepath)
|
plugincludedir = os.listdir(plugincludepath)
|
||||||
for plugincludeitem in plugincludedir:
|
for plugincludeitem in plugincludedir:
|
||||||
plugincludefile = "%s\\%s" % (plugincludepath, plugincludeitem)
|
plugincludefile = "%s\\%s" % (plugincludepath, plugincludeitem)
|
||||||
if os.path.isdir(plugincludefile) == 0:
|
if os.path.isdir(plugincludefile) == 0:
|
||||||
if plugincludefile.find('.h') or plugincludefile.find('.DEF'):
|
if plugincludefile.find('.h') or plugincludefile.find('.DEF'):
|
||||||
plugincludefile = os.path.normpath(plugincludefile)
|
plugincludefile = os.path.normpath(plugincludefile)
|
||||||
plugincludelist.append("File \"%s\"" % plugincludefile)
|
plugincludelist.append("File \"%s\"" % plugincludefile)
|
||||||
plugincludestring = string.join(plugincludelist, "\n ")
|
plugincludestring = string.join(plugincludelist, "\n ")
|
||||||
plugincludestring += "\n\n"
|
plugincludestring += "\n\n"
|
||||||
ns_cnt = string.replace(ns_cnt, "[PLUGINCONTS]", plugincludestring)
|
ns_cnt = string.replace(ns_cnt, "[PLUGINCONTS]", plugincludestring)
|
||||||
|
|
||||||
# do scripts\bpydata\config
|
# do scripts\bpydata\config
|
||||||
cfglist = []
|
cfglist = []
|
||||||
cfgpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata\\config")
|
cfgpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata\\config")
|
||||||
cfgdir = os.listdir(cfgpath)
|
cfgdir = os.listdir(cfgpath)
|
||||||
for cfgitem in cfgdir:
|
for cfgitem in cfgdir:
|
||||||
cfgfile = "%s\\%s" % (cfgpath, cfgitem)
|
cfgfile = "%s\\%s" % (cfgpath, cfgitem)
|
||||||
if os.path.isdir(cfgfile) == 0:
|
if os.path.isdir(cfgfile) == 0:
|
||||||
cfglist.append("File \"%s\"" % cfgfile)
|
cfglist.append("File \"%s\"" % cfgfile)
|
||||||
cfgstring = string.join(cfglist, "\n ")
|
cfgstring = string.join(cfglist, "\n ")
|
||||||
cfgstring += "\n\n"
|
cfgstring += "\n\n"
|
||||||
ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACFGCONTS]", cfgstring)
|
ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACFGCONTS]", cfgstring)
|
||||||
|
|
||||||
# do dotblender
|
# do dotblender
|
||||||
dotblendlist = []
|
dotblendlist = []
|
||||||
dotblenddir = os.listdir(inst_dir+"\\.blender")
|
dotblenddir = os.listdir(inst_dir+"\\.blender")
|
||||||
for dotblenditem in dotblenddir:
|
for dotblenditem in dotblenddir:
|
||||||
if os.path.isdir(inst_dir + "\\.blender\\" + dotblenditem) == 0:
|
if os.path.isdir(inst_dir + "\\.blender\\" + dotblenditem) == 0:
|
||||||
dotblendlist.append("File \"" + os.path.normpath(inst_dir) + "\\.blender\\" +
|
dotblendlist.append("File \"" + os.path.normpath(inst_dir) + "\\.blender\\" +
|
||||||
dotblenditem+"\"")
|
dotblenditem+"\"")
|
||||||
dotblendstring = string.join(dotblendlist, "\n ")
|
dotblendstring = string.join(dotblendlist, "\n ")
|
||||||
dotblendstring += "\n\n"
|
dotblendstring += "\n\n"
|
||||||
ns_cnt = string.replace(ns_cnt, "[DOTBLENDERCONTS]", dotblendstring)
|
ns_cnt = string.replace(ns_cnt, "[DOTBLENDERCONTS]", dotblendstring)
|
||||||
|
|
||||||
# do language files
|
# do language files
|
||||||
langlist = []
|
langlist = []
|
||||||
langfiles = []
|
langfiles = []
|
||||||
langdir = os.listdir(inst_dir + "\\.blender\\locale")
|
langdir = os.listdir(inst_dir + "\\.blender\\locale")
|
||||||
for langitem in langdir:
|
for langitem in langdir:
|
||||||
if os.path.isdir(inst_dir + "\\.blender\\locale\\" + langitem) == 1:
|
if os.path.isdir(inst_dir + "\\.blender\\locale\\" + langitem) == 1:
|
||||||
langfiles.append("SetOutPath $BLENDERHOME\\.blender\\locale\\" + langitem + "\\LC_MESSAGES")
|
langfiles.append("SetOutPath $BLENDERHOME\\.blender\\locale\\" + langitem + "\\LC_MESSAGES")
|
||||||
langfiles.append("File \"" + os.path.normpath(inst_dir) + "\\.blender\\locale\\"
|
langfiles.append("File \"" + os.path.normpath(inst_dir) + "\\.blender\\locale\\"
|
||||||
+ langitem + "\\LC_MESSAGES\\blender.mo\"")
|
+ langitem + "\\LC_MESSAGES\\blender.mo\"")
|
||||||
langstring = string.join(langfiles, "\n ")
|
langstring = string.join(langfiles, "\n ")
|
||||||
langstring += "\n\n"
|
langstring += "\n\n"
|
||||||
ns_cnt = string.replace(ns_cnt, "[LANGUAGECONTS]", langstring)
|
ns_cnt = string.replace(ns_cnt, "[LANGUAGECONTS]", langstring)
|
||||||
|
|
||||||
# var replacements
|
# var replacements
|
||||||
ns_cnt = string.replace(ns_cnt, "DISTDIR", os.path.normpath(inst_dir+"\\"))
|
ns_cnt = string.replace(ns_cnt, "DISTDIR", os.path.normpath(inst_dir+"\\"))
|
||||||
ns_cnt = string.replace(ns_cnt, "SHORTVER", shortver)
|
ns_cnt = string.replace(ns_cnt, "SHORTVER", shortver)
|
||||||
ns_cnt = string.replace(ns_cnt, "VERSION", version)
|
ns_cnt = string.replace(ns_cnt, "VERSION", version)
|
||||||
ns_cnt = string.replace(ns_cnt, "RELDIR", os.path.normpath(rel_dir))
|
ns_cnt = string.replace(ns_cnt, "RELDIR", os.path.normpath(rel_dir))
|
||||||
|
|
||||||
tmpnsi = os.path.normpath(install_base_dir+os.sep+env['BF_BUILDDIR']+os.sep+"00.blender_tmp.nsi")
|
tmpnsi = os.path.normpath(install_base_dir+os.sep+env['BF_BUILDDIR']+os.sep+"00.blender_tmp.nsi")
|
||||||
new_nsis = open(tmpnsi, 'w')
|
new_nsis = open(tmpnsi, 'w')
|
||||||
new_nsis.write(ns_cnt)
|
new_nsis.write(ns_cnt)
|
||||||
new_nsis.close()
|
new_nsis.close()
|
||||||
|
|
||||||
os.chdir(start_dir)
|
os.chdir(start_dir)
|
||||||
|
|
||||||
cmdline = "makensis " + "\""+tmpnsi+"\""
|
cmdline = "makensis " + "\""+tmpnsi+"\""
|
||||||
|
|
||||||
startupinfo = subprocess.STARTUPINFO()
|
startupinfo = subprocess.STARTUPINFO()
|
||||||
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||||
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE, startupinfo=startupinfo, shell = True)
|
stderr=subprocess.PIPE, startupinfo=startupinfo, shell = True)
|
||||||
data, err = proc.communicate()
|
data, err = proc.communicate()
|
||||||
rv = proc.wait()
|
rv = proc.wait()
|
||||||
|
|
||||||
if rv != 0:
|
if rv != 0:
|
||||||
print
|
print
|
||||||
print data.strip().split("\n")[-1]
|
print data.strip().split("\n")[-1]
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user