Merged changes in the trunk up to revision 42116.
This commit is contained in:
+21
-1
@@ -92,6 +92,17 @@ CMAKE_CONFIG = cmake $(BUILD_CMAKE_ARGS) \
|
||||
-DCMAKE_BUILD_TYPE:STRING=$(BUILD_TYPE)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Tool for 'make config'
|
||||
|
||||
# X11 spesific
|
||||
ifdef DISPLAY
|
||||
CMAKE_CONFIG_TOOL = cmake-gui
|
||||
else
|
||||
CMAKE_CONFIG_TOOL = ccmake
|
||||
endif
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Build Blender
|
||||
all:
|
||||
@@ -115,8 +126,15 @@ lite: all
|
||||
headless: all
|
||||
bpy: all
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Helo for build targets
|
||||
# Configuration (save some cd'ing around)
|
||||
config:
|
||||
$(CMAKE_CONFIG_TOOL) $(BUILD_DIR)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Help for build targets
|
||||
help:
|
||||
@echo ""
|
||||
@echo "Convenience targets provided for building blender, (multiple at once can be used)"
|
||||
@@ -125,6 +143,8 @@ help:
|
||||
@echo " * headless - build without an interface (renderfarm or server automation)"
|
||||
@echo " * bpy - build as a python module which can be loaded from python directly"
|
||||
@echo ""
|
||||
@echo " * config - run cmake configuration tool to set build options"
|
||||
@echo ""
|
||||
@echo " Note, passing the argument 'BUILD_DIR=path' when calling make will override the default build dir."
|
||||
@echo " Note, passing the argument 'BUILD_CMAKE_ARGS=args' lets you add cmake arguments."
|
||||
@echo ""
|
||||
|
||||
@@ -75,14 +75,14 @@ def svn_step(branch=''):
|
||||
return SVN(baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/blender', mode='update', defaultBranch='trunk', workdir='blender')
|
||||
|
||||
|
||||
def lib_svn_step(dir):
|
||||
return SVN(name='lib svn', baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/lib/' + dir, mode='update', defaultBranch='trunk', workdir='lib/' + dir)
|
||||
def lib_svn_step(libdir):
|
||||
return SVN(name='lib svn', baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/lib/' + libdir, mode='update', defaultBranch='trunk', workdir='lib/' + libdir)
|
||||
|
||||
# generic builder
|
||||
|
||||
|
||||
def generic_builder(id, libdir='', branch=''):
|
||||
filename = 'buildbot_upload_' + id + '.zip'
|
||||
def generic_builder(idname, libdir='', branch=''):
|
||||
filename = 'buildbot_upload_' + idname + '.zip'
|
||||
compile_script = '../blender/build_files/buildbot/slave_compile.py'
|
||||
test_script = '../blender/build_files/buildbot/slave_test.py'
|
||||
pack_script = '../blender/build_files/buildbot/slave_pack.py'
|
||||
@@ -93,10 +93,10 @@ def generic_builder(id, libdir='', branch=''):
|
||||
if libdir != '':
|
||||
f.addStep(lib_svn_step(libdir))
|
||||
|
||||
f.addStep(Compile(command=['python', compile_script, id]))
|
||||
f.addStep(Test(command=['python', test_script, id]))
|
||||
f.addStep(ShellCommand(name='package', command=['python', pack_script, id, branch], description='packaging', descriptionDone='packaged'))
|
||||
if id.find('cmake') != -1:
|
||||
f.addStep(Compile(command=['python', compile_script, idname]))
|
||||
f.addStep(Test(command=['python', test_script, idname]))
|
||||
f.addStep(ShellCommand(name='package', command=['python', pack_script, idname, branch], description='packaging', descriptionDone='packaged'))
|
||||
if 'cmake' in idname:
|
||||
f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100 * 1024 * 1024))
|
||||
else:
|
||||
f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100 * 1024 * 1024, workdir='install'))
|
||||
|
||||
@@ -84,12 +84,12 @@ if builder.find('scons') != -1:
|
||||
sys.exit(retcode)
|
||||
|
||||
# clean release directory if it already exists
|
||||
dir = 'release'
|
||||
release_dir = 'release'
|
||||
|
||||
if os.path.exists(dir):
|
||||
for f in os.listdir(dir):
|
||||
if os.path.isfile(os.path.join(dir, f)):
|
||||
os.remove(os.path.join(dir, f))
|
||||
if os.path.exists(release_dir):
|
||||
for f in os.listdir(release_dir):
|
||||
if os.path.isfile(os.path.join(release_dir, f)):
|
||||
os.remove(os.path.join(release_dir, f))
|
||||
|
||||
# create release package
|
||||
try:
|
||||
@@ -99,16 +99,16 @@ except Exception, ex:
|
||||
sys.exit(1)
|
||||
|
||||
# find release directory, must exist this time
|
||||
if not os.path.exists(dir):
|
||||
sys.stderr.write("Failed to find release directory.\n")
|
||||
if not os.path.exists(release_dir):
|
||||
sys.stderr.write("Failed to find release directory %r.\n" % release_dir)
|
||||
sys.exit(1)
|
||||
|
||||
# find release package
|
||||
file = None
|
||||
filepath = None
|
||||
|
||||
for f in os.listdir(dir):
|
||||
rf = os.path.join(dir, f)
|
||||
for f in os.listdir(release_dir):
|
||||
rf = os.path.join(release_dir, f)
|
||||
if os.path.isfile(rf) and f.startswith('blender'):
|
||||
file = f
|
||||
filepath = rf
|
||||
|
||||
@@ -319,20 +319,11 @@ def creator(env):
|
||||
incs = ['#/intern/guardedalloc', '#/source/blender/blenlib', '#/source/blender/blenkernel', '#/source/blender/editors/include', '#/source/blender/blenloader', '#/source/blender/imbuf', '#/source/blender/renderconverter', '#/source/blender/render/extern/include', '#/source/blender/windowmanager', '#/source/blender/makesdna', '#/source/blender/makesrna', '#/source/gameengine/BlenderRoutines', '#/extern/glew/include', '#/source/blender/gpu', '#/source/blender/freestyle', env['BF_OPENGL_INC']]
|
||||
|
||||
defs = []
|
||||
if env['WITH_BF_QUICKTIME']:
|
||||
incs.append(env['BF_QUICKTIME_INC'])
|
||||
defs.append('WITH_QUICKTIME')
|
||||
|
||||
if env['WITH_BF_BINRELOC']:
|
||||
incs.append('#/extern/binreloc/include')
|
||||
defs.append('WITH_BINRELOC')
|
||||
|
||||
if env['WITH_BF_OPENEXR']:
|
||||
defs.append('WITH_OPENEXR')
|
||||
|
||||
if env['WITH_BF_TIFF']:
|
||||
defs.append('WITH_TIFF')
|
||||
|
||||
if env['WITH_BF_SDL']:
|
||||
defs.append('WITH_SDL')
|
||||
|
||||
|
||||
@@ -544,6 +544,7 @@ def read_opts(env, cfg, args):
|
||||
|
||||
localopts.AddVariables(
|
||||
(BoolVariable('WITH_BF_CYCLES', 'Build with the Cycles engine', True)),
|
||||
(BoolVariable('WITH_BF_CYCLES_BINARIES', 'Build with precompiled CUDA binaries', False)),
|
||||
|
||||
(BoolVariable('WITH_BF_OIIO', 'Build with OpenImageIO', False)),
|
||||
(BoolVariable('WITH_BF_STATICOIIO', 'Staticly link to OpenImageIO', False)),
|
||||
|
||||
@@ -11,13 +11,13 @@ from bge import texture
|
||||
|
||||
def createTexture(cont):
|
||||
"""Create a new Dynamic Texture"""
|
||||
object = cont.owner
|
||||
obj = cont.owner
|
||||
|
||||
# get the reference pointer (ID) of the internal texture
|
||||
ID = texture.materialID(object, 'IMoriginal.png')
|
||||
ID = texture.materialID(obj, 'IMoriginal.png')
|
||||
|
||||
# create a texture object
|
||||
object_texture = texture.Texture(object, ID)
|
||||
object_texture = texture.Texture(obj, ID)
|
||||
|
||||
# create a new source with an external image
|
||||
url = logic.expandPath("//newtexture.jpg")
|
||||
|
||||
@@ -278,7 +278,7 @@ layer that contains the vertex attribute.
|
||||
|
||||
.. data:: CD_MTFACE
|
||||
|
||||
Vertex attribute is a UV layer. Data type is vector of 2 float.
|
||||
Vertex attribute is a UV Map. Data type is vector of 2 float.
|
||||
|
||||
There can be more than one attribute of that type, they are differenciated by name.
|
||||
In blender, you can retrieve the attribute data with:
|
||||
@@ -495,10 +495,10 @@ Functions
|
||||
for uniform in shader['uniforms']:
|
||||
if uniform['type'] == gpu.GPU_DYNAMIC_SAMPLER_2DIMAGE:
|
||||
print("uniform {0} is using image {1}".format(uniform['varname'], uniform['image'].filepath))
|
||||
# scan the attribute list and find the UV layer used in the shader
|
||||
# scan the attribute list and find the UV Map used in the shader
|
||||
for attribute in shader['attributes']:
|
||||
if attribute['type'] == gpu.CD_MTFACE:
|
||||
print("attribute {0} is using UV layer {1}".format(attribute['varname'], attribute['name']))
|
||||
print("attribute {0} is using UV Map {1}".format(attribute['varname'], attribute['name']))
|
||||
|
||||
*****
|
||||
Notes
|
||||
|
||||
@@ -111,6 +111,12 @@ INFO_DOCS = (
|
||||
("info_gotcha.rst", "Gotcha's: some of the problems you may come up against when writing scripts"),
|
||||
)
|
||||
|
||||
# only support for properties atm.
|
||||
RNA_BLACKLIST = {
|
||||
# messes up PDF!, really a bug but for now just workaround.
|
||||
"UserPreferencesSystem": {"language", },
|
||||
}
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# configure compile time options
|
||||
@@ -765,22 +771,23 @@ def pyrna2sphinx(BASEPATH):
|
||||
fw = file.write
|
||||
|
||||
base_id = getattr(struct.base, "identifier", "")
|
||||
struct_id = struct.identifier
|
||||
|
||||
if _BPY_STRUCT_FAKE:
|
||||
if not base_id:
|
||||
base_id = _BPY_STRUCT_FAKE
|
||||
|
||||
if base_id:
|
||||
title = "%s(%s)" % (struct.identifier, base_id)
|
||||
title = "%s(%s)" % (struct_id, base_id)
|
||||
else:
|
||||
title = struct.identifier
|
||||
title = struct_id
|
||||
|
||||
write_title(fw, title, "=")
|
||||
|
||||
fw(".. module:: bpy.types\n\n")
|
||||
|
||||
# docs first?, ok
|
||||
write_example_ref("", fw, "bpy.types.%s" % struct.identifier)
|
||||
write_example_ref("", fw, "bpy.types.%s" % struct_id)
|
||||
|
||||
base_ids = [base.identifier for base in struct.get_bases()]
|
||||
|
||||
@@ -809,9 +816,9 @@ def pyrna2sphinx(BASEPATH):
|
||||
base_id = _BPY_STRUCT_FAKE
|
||||
|
||||
if base_id:
|
||||
fw(".. class:: %s(%s)\n\n" % (struct.identifier, base_id))
|
||||
fw(".. class:: %s(%s)\n\n" % (struct_id, base_id))
|
||||
else:
|
||||
fw(".. class:: %s\n\n" % struct.identifier)
|
||||
fw(".. class:: %s\n\n" % struct_id)
|
||||
|
||||
fw(" %s\n\n" % struct.description)
|
||||
|
||||
@@ -819,7 +826,15 @@ def pyrna2sphinx(BASEPATH):
|
||||
sorted_struct_properties = struct.properties[:]
|
||||
sorted_struct_properties.sort(key=lambda prop: prop.identifier)
|
||||
|
||||
# support blacklisting props
|
||||
struct_blacklist = RNA_BLACKLIST.get(struct_id, ())
|
||||
|
||||
for prop in sorted_struct_properties:
|
||||
|
||||
# support blacklisting props
|
||||
if prop.identifier in struct_blacklist:
|
||||
continue
|
||||
|
||||
type_descr = prop.get_type_description(class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID)
|
||||
# readonly properties use "data" directive, variables properties use "attribute" directive
|
||||
if 'readonly' in type_descr:
|
||||
@@ -868,7 +883,7 @@ def pyrna2sphinx(BASEPATH):
|
||||
descr = prop.name
|
||||
fw(" `%s`, %s, %s\n\n" % (prop.identifier, descr, type_descr))
|
||||
|
||||
write_example_ref(" ", fw, "bpy.types." + struct.identifier + "." + func.identifier)
|
||||
write_example_ref(" ", fw, "bpy.types." + struct_id + "." + func.identifier)
|
||||
|
||||
fw("\n")
|
||||
|
||||
@@ -884,7 +899,7 @@ def pyrna2sphinx(BASEPATH):
|
||||
py_func = None
|
||||
|
||||
for identifier, py_func in py_funcs:
|
||||
py_c_func2sphinx(" ", fw, "bpy.types", struct.identifier, identifier, py_func, is_class=True)
|
||||
py_c_func2sphinx(" ", fw, "bpy.types", struct_id, identifier, py_func, is_class=True)
|
||||
|
||||
lines = []
|
||||
|
||||
@@ -963,7 +978,7 @@ def pyrna2sphinx(BASEPATH):
|
||||
fw("\n")
|
||||
|
||||
# docs last?, disable for now
|
||||
# write_example_ref("", fw, "bpy.types.%s" % struct.identifier)
|
||||
# write_example_ref("", fw, "bpy.types.%s" % struct_id)
|
||||
file.close()
|
||||
|
||||
if "bpy.types" not in EXCLUDE_MODULES:
|
||||
|
||||
Vendored
+6
-6
@@ -46,16 +46,16 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
|
||||
defs.append('NDEBUG')
|
||||
else:
|
||||
if not env['BF_DEBUG']:
|
||||
cflags_libmv = Split(env['REL_CFLAGS'])
|
||||
ccflags_libmv = Split(env['REL_CCFLAGS'])
|
||||
cxxflags_libmv = Split(env['REL_CXXFLAGS'])
|
||||
cflags_libmv += Split(env['REL_CFLAGS'])
|
||||
ccflags_libmv += Split(env['REL_CCFLAGS'])
|
||||
cxxflags_libmv += Split(env['REL_CXXFLAGS'])
|
||||
else:
|
||||
src += env.Glob("third_party/glog/src/*.cc")
|
||||
incs += ' ./third_party/glog/src'
|
||||
if not env['BF_DEBUG']:
|
||||
cflags_libmv = Split(env['REL_CFLAGS'])
|
||||
ccflags_libmv = Split(env['REL_CCFLAGS'])
|
||||
cxxflags_libmv = Split(env['REL_CXXFLAGS'])
|
||||
cflags_libmv += Split(env['REL_CFLAGS'])
|
||||
ccflags_libmv += Split(env['REL_CCFLAGS'])
|
||||
cxxflags_libmv += Split(env['REL_CXXFLAGS'])
|
||||
|
||||
incs += ' ./third_party/ssba ./third_party/ldl/Include ../colamd/Include'
|
||||
|
||||
|
||||
@@ -201,6 +201,8 @@ void CameraIntrinsics::ComputeLookupGrid(Grid* grid, int width, int height, doub
|
||||
warp_y = warp_y*aspy + 0.5 * overscan * h;
|
||||
int ix = int(warp_x), iy = int(warp_y);
|
||||
int fx = round((warp_x-ix)*256), fy = round((warp_y-iy)*256);
|
||||
if(fx == 256) { fx=0; ix++; }
|
||||
if(fy == 256) { fy=0; iy++; }
|
||||
// Use nearest border pixel
|
||||
if( ix < 0 ) { ix = 0, fx = 0; }
|
||||
if( iy < 0 ) { iy = 0, fy = 0; }
|
||||
|
||||
@@ -12,9 +12,9 @@ if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
|
||||
set(WITH_CYCLES_OPTIMIZED_KERNEL ON)
|
||||
|
||||
if(WIN32 AND MSVC)
|
||||
set(CYCLES_OPTIMIZED_KERNEL_FLAGS "/Ox /Ot /arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /EHsc /fp:fast")
|
||||
set(CYCLES_OPTIMIZED_KERNEL_FLAGS "/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCC)
|
||||
set(CYCLES_OPTIMIZED_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -DGOGOGO")
|
||||
set(CYCLES_OPTIMIZED_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ defs.append('WITH_OPENCL')
|
||||
defs.append('WITH_MULTI')
|
||||
defs.append('WITH_CUDA')
|
||||
|
||||
if env['WITH_BF_CYCLES_BINARIES']:
|
||||
defs.append('WITH_CUDA_BINARIES')
|
||||
|
||||
incs.extend('. bvh render device kernel kernel/osl kernel/svm util subd'.split())
|
||||
incs.extend('#intern/guardedalloc #source/blender/makesrna #source/blender/makesdna'.split())
|
||||
incs.extend('#source/blender/blenloader ../../source/blender/makesrna/intern'.split())
|
||||
|
||||
@@ -6,7 +6,7 @@ set(INC
|
||||
../kernel/svm
|
||||
../util
|
||||
../subd
|
||||
../../../intern/guardedalloc
|
||||
../../guardedalloc
|
||||
../../../source/blender/makesdna
|
||||
../../../source/blender/makesrna
|
||||
../../../source/blender/blenloader
|
||||
|
||||
@@ -43,7 +43,7 @@ from cycles import presets
|
||||
|
||||
class CyclesRender(bpy.types.RenderEngine):
|
||||
bl_idname = 'CYCLES'
|
||||
bl_label = "Cycles"
|
||||
bl_label = "Cycles Render"
|
||||
bl_use_shading_nodes = True
|
||||
|
||||
def __init__(self):
|
||||
|
||||
@@ -19,7 +19,11 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.props import (BoolProperty,
|
||||
EnumProperty,
|
||||
FloatProperty,
|
||||
IntProperty,
|
||||
PointerProperty)
|
||||
|
||||
import math
|
||||
|
||||
|
||||
@@ -349,7 +349,7 @@ def find_node(material, nodetype):
|
||||
ntree = material.node_tree
|
||||
|
||||
for node in ntree.nodes:
|
||||
if hasattr(node, 'type') and node.type == nodetype:
|
||||
if getattr(node, "type", None) == nodetype:
|
||||
return node
|
||||
|
||||
return None
|
||||
@@ -363,14 +363,14 @@ def find_node_input(node, name):
|
||||
return None
|
||||
|
||||
|
||||
def panel_node_draw(layout, id, output_type, input_name):
|
||||
if not id.node_tree:
|
||||
layout.prop(id, "use_nodes", icon='NODETREE')
|
||||
def panel_node_draw(layout, id_data, output_type, input_name):
|
||||
if not id_data.node_tree:
|
||||
layout.prop(id_data, "use_nodes", icon='NODETREE')
|
||||
return False
|
||||
|
||||
ntree = id.node_tree
|
||||
ntree = id_data.node_tree
|
||||
|
||||
node = find_node(id, output_type)
|
||||
node = find_node(id_data, output_type)
|
||||
if not node:
|
||||
layout.label(text="No output node.")
|
||||
else:
|
||||
|
||||
@@ -61,12 +61,12 @@ class ExportCyclesXML(bpy.types.Operator, ExportHelper):
|
||||
|
||||
# get mesh
|
||||
scene = context.scene
|
||||
object = context.object
|
||||
obj = context.object
|
||||
|
||||
if not object:
|
||||
if not obj:
|
||||
raise Exception("No active object")
|
||||
|
||||
mesh = object.to_mesh(scene, True, 'PREVIEW')
|
||||
mesh = obj.to_mesh(scene, True, 'PREVIEW')
|
||||
|
||||
if not mesh:
|
||||
raise Exception("No mesh data in active object")
|
||||
|
||||
@@ -144,7 +144,7 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
|
||||
}
|
||||
}
|
||||
|
||||
/* create uv layer attributes */
|
||||
/* create uv map attributes */
|
||||
{
|
||||
BL::Mesh::uv_textures_iterator l;
|
||||
|
||||
|
||||
@@ -99,6 +99,9 @@ static float get_node_output_value(BL::Node b_node, const string& name)
|
||||
|
||||
static void get_tex_mapping(TextureMapping *mapping, BL::TexMapping b_mapping)
|
||||
{
|
||||
if(!b_mapping)
|
||||
return;
|
||||
|
||||
mapping->translation = get_float3(b_mapping.location());
|
||||
mapping->rotation = get_float3(b_mapping.rotation());
|
||||
mapping->scale = get_float3(b_mapping.scale());
|
||||
@@ -110,6 +113,9 @@ static void get_tex_mapping(TextureMapping *mapping, BL::TexMapping b_mapping)
|
||||
|
||||
static void get_tex_mapping(TextureMapping *mapping, BL::ShaderNodeMapping b_mapping)
|
||||
{
|
||||
if(!b_mapping)
|
||||
return;
|
||||
|
||||
mapping->translation = get_float3(b_mapping.location());
|
||||
mapping->rotation = get_float3(b_mapping.rotation());
|
||||
mapping->scale = get_float3(b_mapping.scale());
|
||||
|
||||
@@ -76,6 +76,7 @@ protected:
|
||||
Device() {}
|
||||
|
||||
bool background;
|
||||
string error_msg;
|
||||
|
||||
public:
|
||||
virtual ~Device() {}
|
||||
@@ -84,6 +85,7 @@ public:
|
||||
|
||||
/* info */
|
||||
virtual string description() = 0;
|
||||
const string& error_message() { return error_msg; }
|
||||
|
||||
/* regular memory */
|
||||
virtual void mem_alloc(device_memory& mem, MemoryType type) = 0;
|
||||
|
||||
@@ -122,7 +122,10 @@ public:
|
||||
CUresult result = stmt; \
|
||||
\
|
||||
if(result != CUDA_SUCCESS) { \
|
||||
fprintf(stderr, "CUDA error: %s in %s\n", cuda_error_string(result), #stmt); \
|
||||
string message = string_printf("CUDA error: %s in %s", cuda_error_string(result), #stmt); \
|
||||
if(error_msg == "") \
|
||||
error_msg = message; \
|
||||
fprintf(stderr, "%s\n", message.c_str()); \
|
||||
cuda_abort(); \
|
||||
} \
|
||||
}
|
||||
@@ -132,10 +135,20 @@ public:
|
||||
if(result == CUDA_SUCCESS)
|
||||
return false;
|
||||
|
||||
fprintf(stderr, "CUDA error: %s\n", cuda_error_string(result));
|
||||
string message = string_printf("CUDA error: %s", cuda_error_string(result));
|
||||
if(error_msg == "")
|
||||
error_msg = message;
|
||||
fprintf(stderr, "%s\n", message.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
void cuda_error(const string& message)
|
||||
{
|
||||
if(error_msg == "")
|
||||
error_msg = message;
|
||||
fprintf(stderr, "%s\n", message.c_str());
|
||||
}
|
||||
|
||||
void cuda_push_context()
|
||||
{
|
||||
cuda_assert(cuCtxSetCurrent(cuContext))
|
||||
@@ -224,14 +237,14 @@ public:
|
||||
return cubin;
|
||||
|
||||
#ifdef WITH_CUDA_BINARIES
|
||||
fprintf(stderr, "CUDA binary kernel for this graphics card not found.\n");
|
||||
cuda_error("CUDA binary kernel for this graphics card not found.");
|
||||
return "";
|
||||
#else
|
||||
/* if not, find CUDA compiler */
|
||||
string nvcc = cuCompilerPath();
|
||||
|
||||
if(nvcc == "") {
|
||||
fprintf(stderr, "CUDA nvcc compiler not found. Install CUDA toolkit in default location.\n");
|
||||
cuda_error("CUDA nvcc compiler not found. Install CUDA toolkit in default location.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -251,13 +264,13 @@ public:
|
||||
nvcc.c_str(), major, minor, machine, kernel.c_str(), cubin.c_str(), maxreg, include.c_str());
|
||||
|
||||
if(system(command.c_str()) == -1) {
|
||||
fprintf(stderr, "Failed to execute compilation command.\n");
|
||||
cuda_error("Failed to execute compilation command, see console for details.");
|
||||
return "";
|
||||
}
|
||||
|
||||
/* verify if compilation succeeded */
|
||||
if(!path_exists(cubin)) {
|
||||
fprintf(stderr, "CUDA kernel compilation failed.\n");
|
||||
cuda_error("CUDA kernel compilation failed, see console for details.");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -284,7 +297,7 @@ public:
|
||||
|
||||
CUresult result = cuModuleLoad(&cuModule, cubin.c_str());
|
||||
if(cuda_error(result))
|
||||
fprintf(stderr, "Failed loading CUDA kernel %s.\n", cubin.c_str());
|
||||
cuda_error(string_printf("Failed loading CUDA kernel %s.", cubin.c_str()));
|
||||
|
||||
cuda_pop_context();
|
||||
|
||||
|
||||
@@ -109,17 +109,30 @@ public:
|
||||
bool opencl_error(cl_int err)
|
||||
{
|
||||
if(err != CL_SUCCESS) {
|
||||
fprintf(stderr, "OpenCL error (%d): %s\n", err, opencl_error_string(err));
|
||||
string message = string_printf("OpenCL error (%d): %s", err, opencl_error_string(err));
|
||||
if(error_msg == "")
|
||||
error_msg = message;
|
||||
fprintf(stderr, "%s\n", message.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void opencl_error(const string& message)
|
||||
{
|
||||
if(error_msg == "")
|
||||
error_msg = message;
|
||||
fprintf(stderr, "%s\n", message.c_str());
|
||||
}
|
||||
|
||||
void opencl_assert(cl_int err)
|
||||
{
|
||||
if(err != CL_SUCCESS) {
|
||||
fprintf(stderr, "OpenCL error (%d): %s\n", err, opencl_error_string(err));
|
||||
string message = string_printf("OpenCL error (%d): %s", err, opencl_error_string(err));
|
||||
if(error_msg == "")
|
||||
error_msg = message;
|
||||
fprintf(stderr, "%s\n", message.c_str());
|
||||
#ifndef NDEBUG
|
||||
abort();
|
||||
#endif
|
||||
@@ -147,7 +160,7 @@ public:
|
||||
return;
|
||||
|
||||
if(num_platforms == 0) {
|
||||
fprintf(stderr, "OpenCL: no platforms found.\n");
|
||||
opencl_error("OpenCL: no platforms found.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -183,24 +196,24 @@ public:
|
||||
clGetPlatformInfo(cpPlatform, CL_PLATFORM_VERSION, sizeof(version), &version, NULL);
|
||||
|
||||
if(sscanf(version, "OpenCL %d.%d", &major, &minor) < 2) {
|
||||
fprintf(stderr, "OpenCL: failed to parse platform version string (%s).", version);
|
||||
opencl_error(string_printf("OpenCL: failed to parse platform version string (%s).", version));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!((major == req_major && minor >= req_minor) || (major > req_major))) {
|
||||
fprintf(stderr, "OpenCL: platform version 1.1 or later required, found %d.%d\n", major, minor);
|
||||
opencl_error(string_printf("OpenCL: platform version 1.1 or later required, found %d.%d", major, minor));
|
||||
return false;
|
||||
}
|
||||
|
||||
clGetDeviceInfo(cdDevice, CL_DEVICE_OPENCL_C_VERSION, sizeof(version), &version, NULL);
|
||||
|
||||
if(sscanf(version, "OpenCL C %d.%d", &major, &minor) < 2) {
|
||||
fprintf(stderr, "OpenCL: failed to parse OpenCL C version string (%s).", version);
|
||||
opencl_error(string_printf("OpenCL: failed to parse OpenCL C version string (%s).", version));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!((major == req_major && minor >= req_minor) || (major > req_major))) {
|
||||
fprintf(stderr, "OpenCL: C version 1.1 or later required, found %d.%d\n", major, minor);
|
||||
opencl_error(string_printf("OpenCL: C version 1.1 or later required, found %d.%d", major, minor));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -216,7 +229,7 @@ public:
|
||||
vector<uint8_t> binary;
|
||||
|
||||
if(!path_read_binary(clbin, binary)) {
|
||||
fprintf(stderr, "OpenCL failed to read cached binary %s.\n", clbin.c_str());
|
||||
opencl_error(string_printf("OpenCL failed to read cached binary %s.", clbin.c_str()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -229,7 +242,7 @@ public:
|
||||
&size, &bytes, &status, &ciErr);
|
||||
|
||||
if(opencl_error(status) || opencl_error(ciErr)) {
|
||||
fprintf(stderr, "OpenCL failed create program from cached binary %s.\n", clbin.c_str());
|
||||
opencl_error(string_printf("OpenCL failed create program from cached binary %s.", clbin.c_str()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -253,19 +266,16 @@ public:
|
||||
clGetProgramInfo(cpProgram, CL_PROGRAM_BINARIES, sizeof(uint8_t*), &bytes, NULL);
|
||||
|
||||
if(!path_write_binary(clbin, binary)) {
|
||||
fprintf(stderr, "OpenCL failed to write cached binary %s.\n", clbin.c_str());
|
||||
opencl_error(string_printf("OpenCL failed to write cached binary %s.", clbin.c_str()));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool build_kernel(const string& kernel_path)
|
||||
string kernel_build_options()
|
||||
{
|
||||
string build_options = "";
|
||||
|
||||
build_options += "-I " + kernel_path + ""; /* todo: escape path */
|
||||
build_options += " -cl-fast-relaxed-math ";
|
||||
string build_options = " -cl-fast-relaxed-math ";
|
||||
|
||||
/* Full Shading only on NVIDIA cards at the moment */
|
||||
char vendor[256];
|
||||
@@ -273,14 +283,16 @@ public:
|
||||
clGetPlatformInfo(cpPlatform, CL_PLATFORM_NAME, sizeof(vendor), &vendor, NULL);
|
||||
string name = vendor;
|
||||
|
||||
if (name == "NVIDIA CUDA") {
|
||||
build_options += "-D __SVM__ ";
|
||||
build_options += "-D __EMISSION__ ";
|
||||
build_options += "-D __TEXTURES__ ";
|
||||
build_options += "-D __HOLDOUT__ ";
|
||||
build_options += "-D __MULTI_CLOSURE__ ";
|
||||
}
|
||||
if(name == "NVIDIA CUDA")
|
||||
build_options += "-D__KERNEL_SHADING__ -D__MULTI_CLOSURE__ ";
|
||||
|
||||
return build_options;
|
||||
}
|
||||
|
||||
bool build_kernel(const string& kernel_path)
|
||||
{
|
||||
string build_options = kernel_build_options();
|
||||
|
||||
ciErr = clBuildProgram(cpProgram, 0, NULL, build_options.c_str(), NULL, NULL);
|
||||
|
||||
if(ciErr != CL_SUCCESS) {
|
||||
@@ -294,7 +306,8 @@ public:
|
||||
clGetProgramBuildInfo(cpProgram, cdDevice, CL_PROGRAM_BUILD_LOG, ret_val_size, build_log, NULL);
|
||||
|
||||
build_log[ret_val_size] = '\0';
|
||||
fprintf(stderr, "OpenCL build failed:\n %s\n", build_log);
|
||||
opencl_error("OpenCL build failed: errors in console");
|
||||
fprintf(stderr, "%s\n", build_log);
|
||||
|
||||
delete[] build_log;
|
||||
|
||||
@@ -310,6 +323,8 @@ public:
|
||||
kernel caches do not seem to recognize changes in included files.
|
||||
so we force recompile on changes by adding the md5 hash of all files */
|
||||
string source = "#include \"kernel.cl\" // " + kernel_md5 + "\n";
|
||||
source = path_source_replace_includes(source, kernel_path);
|
||||
|
||||
size_t source_len = source.size();
|
||||
const char *source_str = source.c_str();
|
||||
|
||||
@@ -344,6 +359,9 @@ public:
|
||||
md5.append((uint8_t*)name, strlen(name));
|
||||
md5.append((uint8_t*)driver, strlen(driver));
|
||||
|
||||
string options = kernel_build_options();
|
||||
md5.append((uint8_t*)options.c_str(), options.size());
|
||||
|
||||
return md5.get_hex();
|
||||
}
|
||||
|
||||
@@ -563,24 +581,20 @@ public:
|
||||
cl_int set_kernel_arg_mem(cl_kernel kernel, int *narg, const char *name)
|
||||
{
|
||||
cl_mem ptr;
|
||||
cl_int size, err = 0;
|
||||
cl_int err = 0;
|
||||
|
||||
if(mem_map.find(name) != mem_map.end()) {
|
||||
device_memory *mem = mem_map[name];
|
||||
|
||||
ptr = CL_MEM_PTR(mem->device_pointer);
|
||||
size = mem->data_width;
|
||||
}
|
||||
else {
|
||||
/* work around NULL not working, even though the spec says otherwise */
|
||||
ptr = CL_MEM_PTR(null_mem);
|
||||
size = 1;
|
||||
}
|
||||
|
||||
err |= clSetKernelArg(kernel, (*narg)++, sizeof(ptr), (void*)&ptr);
|
||||
opencl_assert(err);
|
||||
err |= clSetKernelArg(kernel, (*narg)++, sizeof(size), (void*)&size);
|
||||
opencl_assert(err);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "kernel_film.h"
|
||||
#include "kernel_path.h"
|
||||
//#include "kernel_displace.h"
|
||||
|
||||
__kernel void kernel_ocl_path_trace(
|
||||
__constant KernelData *data,
|
||||
@@ -33,8 +32,7 @@ __kernel void kernel_ocl_path_trace(
|
||||
__global uint *rng_state,
|
||||
|
||||
#define KERNEL_TEX(type, ttype, name) \
|
||||
__global type *name, \
|
||||
int name##_width,
|
||||
__global type *name,
|
||||
#include "kernel_textures.h"
|
||||
|
||||
int sample,
|
||||
@@ -45,8 +43,7 @@ __kernel void kernel_ocl_path_trace(
|
||||
kg->data = data;
|
||||
|
||||
#define KERNEL_TEX(type, ttype, name) \
|
||||
kg->name = name; \
|
||||
kg->name##_width = name##_width;
|
||||
kg->name = name;
|
||||
#include "kernel_textures.h"
|
||||
|
||||
int x = sx + get_global_id(0);
|
||||
@@ -62,8 +59,7 @@ __kernel void kernel_ocl_tonemap(
|
||||
__global float4 *buffer,
|
||||
|
||||
#define KERNEL_TEX(type, ttype, name) \
|
||||
__global type *name, \
|
||||
int name##_width,
|
||||
__global type *name,
|
||||
#include "kernel_textures.h"
|
||||
|
||||
int sample, int resolution,
|
||||
@@ -74,8 +70,7 @@ __kernel void kernel_ocl_tonemap(
|
||||
kg->data = data;
|
||||
|
||||
#define KERNEL_TEX(type, ttype, name) \
|
||||
kg->name = name; \
|
||||
kg->name##_width = name##_width;
|
||||
kg->name = name;
|
||||
#include "kernel_textures.h"
|
||||
|
||||
int x = sx + get_global_id(0);
|
||||
|
||||
@@ -97,11 +97,7 @@ __device_inline void bvh_node_intersect(KernelGlobals *kg,
|
||||
float c1loz = nz.z * idir.z - ood.z;
|
||||
float c1hiz = nz.w * idir.z - ood.z;
|
||||
|
||||
float c0min_x = min(c0lox, c0hix);
|
||||
float c0min_y = min(c0loy, c0hiy);
|
||||
float c0min_z = min(c0loz, c0hiz);
|
||||
|
||||
float c0min = max4(c0min_x, c0min_y, c0min_z, 0.0f);
|
||||
float c0min = max4(min(c0lox, c0hix), min(c0loy, c0hiy), min(c0loz, c0hiz), 0.0f);
|
||||
float c0max = min4(max(c0lox, c0hix), max(c0loy, c0hiy), max(c0loz, c0hiz), t);
|
||||
float c1lox = n1xy.x * idir.x - ood.x;
|
||||
float c1hix = n1xy.y * idir.x - ood.x;
|
||||
|
||||
@@ -127,8 +127,8 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
|
||||
__device void camera_sample(KernelGlobals *kg, int x, int y, float filter_u, float filter_v, float lens_u, float lens_v, Ray *ray)
|
||||
{
|
||||
/* pixel filter */
|
||||
float raster_x = x + kernel_tex_interp(__filter_table, filter_u);
|
||||
float raster_y = y + kernel_tex_interp(__filter_table, filter_v);
|
||||
float raster_x = x + kernel_tex_interp(__filter_table, filter_u, FILTER_TABLE_SIZE);
|
||||
float raster_y = y + kernel_tex_interp(__filter_table, filter_v, FILTER_TABLE_SIZE);
|
||||
|
||||
/* motion blur */
|
||||
//ray->time = lerp(time_t, kernel_data.cam.shutter_open, kernel_data.cam.shutter_close);
|
||||
|
||||
@@ -55,8 +55,10 @@ template<typename T> struct texture {
|
||||
return ((__m128i*)data)[index];
|
||||
}*/
|
||||
|
||||
float interp(float x)
|
||||
float interp(float x, int size)
|
||||
{
|
||||
kernel_assert(size == width);
|
||||
|
||||
x = clamp(x, 0.0f, 1.0f)*width;
|
||||
|
||||
int index = min((int)x, width-1);
|
||||
@@ -151,7 +153,7 @@ typedef texture_image<uchar4> texture_image_uchar4;
|
||||
#define kernel_tex_fetch(tex, index) (kg->tex.fetch(index))
|
||||
#define kernel_tex_fetch_m128(tex, index) (kg->tex.fetch_m128(index))
|
||||
#define kernel_tex_fetch_m128i(tex, index) (kg->tex.fetch_m128i(index))
|
||||
#define kernel_tex_interp(tex, t) (kg->tex.interp(t))
|
||||
#define kernel_tex_interp(tex, t, size) (kg->tex.interp(t, size))
|
||||
#define kernel_tex_image_interp(tex, x, y) (kg->tex.interp(x, y))
|
||||
|
||||
#define kernel_data (kg->__data)
|
||||
|
||||
@@ -55,7 +55,7 @@ typedef texture<uchar4, 2, cudaReadModeNormalizedFloat> texture_image_uchar4;
|
||||
/* Macros to handle different memory storage on different devices */
|
||||
|
||||
#define kernel_tex_fetch(t, index) tex1Dfetch(t, index)
|
||||
#define kernel_tex_interp(t, x) tex1D(t, x)
|
||||
#define kernel_tex_interp(t, x, size) tex1D(t, x)
|
||||
#define kernel_tex_image_interp(t, x, y) tex2D(t, x, y)
|
||||
|
||||
#define kernel_data __data
|
||||
|
||||
@@ -100,7 +100,7 @@ __device float kernel_tex_interp_(__global float *data, int width, float x)
|
||||
|
||||
/* data lookup defines */
|
||||
#define kernel_data (*kg->data)
|
||||
#define kernel_tex_interp(t, x) kernel_tex_interp_(kg->t, kg->t##_width, x)
|
||||
#define kernel_tex_interp(t, x, size) kernel_tex_interp_(kg->t, size, x)
|
||||
#define kernel_tex_fetch(t, index) kg->t[index]
|
||||
|
||||
/* define NULL */
|
||||
|
||||
@@ -77,8 +77,7 @@ typedef struct KernelGlobals {
|
||||
__constant KernelData *data;
|
||||
|
||||
#define KERNEL_TEX(type, ttype, name) \
|
||||
__global type *name; \
|
||||
int name##_width;
|
||||
__global type *name;
|
||||
#include "kernel_textures.h"
|
||||
} KernelGlobals;
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ __device void shader_setup_from_displace(KernelGlobals *kg, ShaderData *sd,
|
||||
Ng = triangle_normal_MT(kg, prim, &shader);
|
||||
|
||||
/* force smooth shading for displacement */
|
||||
sd->shader |= SHADER_SMOOTH_NORMAL;
|
||||
shader |= SHADER_SMOOTH_NORMAL;
|
||||
|
||||
/* watch out: no instance transform currently */
|
||||
|
||||
|
||||
@@ -25,9 +25,30 @@
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#define OBJECT_SIZE 16
|
||||
#define LIGHT_SIZE 4
|
||||
/* constants */
|
||||
#define OBJECT_SIZE 16
|
||||
#define LIGHT_SIZE 4
|
||||
#define FILTER_TABLE_SIZE 256
|
||||
|
||||
/* device capabilities */
|
||||
#ifdef __KERNEL_CPU__
|
||||
#define __KERNEL_SHADING__
|
||||
#define __KERNEL_ADV_SHADING__
|
||||
#endif
|
||||
|
||||
#ifdef __KERNEL_CUDA__
|
||||
#define __KERNEL_SHADING__
|
||||
#if __CUDA_ARCH__ >= 200
|
||||
#define __KERNEL_ADV_SHADING__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __KERNEL_OPENCL__
|
||||
//#define __KERNEL_SHADING__
|
||||
//#define __KERNEL_ADV_SHADING__
|
||||
#endif
|
||||
|
||||
/* kernel features */
|
||||
#define __SOBOL__
|
||||
#define __INSTANCING__
|
||||
#define __DPDU__
|
||||
@@ -39,27 +60,20 @@ CCL_NAMESPACE_BEGIN
|
||||
#define __CAMERA_CLIPPING__
|
||||
#define __INTERSECTION_REFINE__
|
||||
|
||||
#ifndef __KERNEL_OPENCL__
|
||||
#ifdef __KERNEL_SHADING__
|
||||
#define __SVM__
|
||||
#define __EMISSION__
|
||||
#define __TEXTURES__
|
||||
#define __HOLDOUT__
|
||||
#endif
|
||||
|
||||
#ifdef __KERNEL_ADV_SHADING__
|
||||
#define __MULTI_CLOSURE__
|
||||
#define __TRANSPARENT_SHADOWS__
|
||||
#endif
|
||||
|
||||
//#define __MULTI_LIGHT__
|
||||
#endif
|
||||
|
||||
#ifdef __KERNEL_CPU__
|
||||
#define __MULTI_CLOSURE__
|
||||
#define __TRANSPARENT_SHADOWS__
|
||||
//#define __OSL__
|
||||
#endif
|
||||
|
||||
#ifdef __KERNEL_CUDA__
|
||||
#if __CUDA_ARCH__ >= 200
|
||||
#define __MULTI_CLOSURE__
|
||||
#define __TRANSPARENT_SHADOWS__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#define __SOBOL_FULL_SCREEN__
|
||||
//#define __MODIFY_TP__
|
||||
//#define __QBVH__
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "filter.h"
|
||||
#include "scene.h"
|
||||
|
||||
#include "kernel_types.h"
|
||||
|
||||
#include "util_algorithm.h"
|
||||
#include "util_debug.h"
|
||||
#include "util_math.h"
|
||||
@@ -51,7 +53,7 @@ static float filter_func_gaussian(float v, float width)
|
||||
|
||||
static vector<float> filter_table(FilterType type, float width)
|
||||
{
|
||||
const int filter_table_size = 256;
|
||||
const int filter_table_size = FILTER_TABLE_SIZE-1;
|
||||
vector<float> filter_table_cdf(filter_table_size+1);
|
||||
vector<float> filter_table(filter_table_size+1);
|
||||
float (*filter_func)(float, float) = NULL;
|
||||
|
||||
@@ -203,6 +203,10 @@ void Session::run_gpu()
|
||||
if(!no_tiles) {
|
||||
/* update scene */
|
||||
update_scene();
|
||||
|
||||
if(device->error_message() != "")
|
||||
progress.set_cancel(device->error_message());
|
||||
|
||||
if(progress.get_cancel())
|
||||
break;
|
||||
}
|
||||
@@ -222,6 +226,9 @@ void Session::run_gpu()
|
||||
|
||||
device->task_wait();
|
||||
|
||||
if(device->error_message() != "")
|
||||
progress.set_cancel(device->error_message());
|
||||
|
||||
if(progress.get_cancel())
|
||||
break;
|
||||
}
|
||||
@@ -243,6 +250,9 @@ void Session::run_gpu()
|
||||
}
|
||||
}
|
||||
|
||||
if(device->error_message() != "")
|
||||
progress.set_cancel(device->error_message());
|
||||
|
||||
if(progress.get_cancel())
|
||||
break;
|
||||
}
|
||||
@@ -345,6 +355,10 @@ void Session::run_cpu()
|
||||
|
||||
/* update scene */
|
||||
update_scene();
|
||||
|
||||
if(device->error_message() != "")
|
||||
progress.set_cancel(device->error_message());
|
||||
|
||||
if(progress.get_cancel())
|
||||
break;
|
||||
|
||||
@@ -360,6 +374,9 @@ void Session::run_cpu()
|
||||
|
||||
if(!params.background)
|
||||
need_tonemap = true;
|
||||
|
||||
if(device->error_message() != "")
|
||||
progress.set_cancel(device->error_message());
|
||||
}
|
||||
|
||||
device->task_wait();
|
||||
@@ -379,6 +396,9 @@ void Session::run_cpu()
|
||||
want to show the result of an incomplete sample*/
|
||||
tonemap();
|
||||
}
|
||||
|
||||
if(device->error_message() != "")
|
||||
progress.set_cancel(device->error_message());
|
||||
}
|
||||
|
||||
progress.set_update();
|
||||
@@ -391,7 +411,11 @@ void Session::run()
|
||||
progress.set_status("Loading render kernels (may take a few minutes the first time)");
|
||||
|
||||
if(!device->load_kernels()) {
|
||||
progress.set_status("Failed loading render kernel, see console for errors");
|
||||
string message = device->error_message();
|
||||
if(message == "")
|
||||
message = "Failed loading render kernel, see console for errors";
|
||||
|
||||
progress.set_status("Error", message);
|
||||
progress.set_update();
|
||||
return;
|
||||
}
|
||||
@@ -409,7 +433,7 @@ void Session::run()
|
||||
|
||||
/* progress update */
|
||||
if(progress.get_cancel())
|
||||
progress.set_status(progress.get_cancel_message());
|
||||
progress.set_status("Cancel", progress.get_cancel_message());
|
||||
else
|
||||
progress.set_update();
|
||||
}
|
||||
|
||||
@@ -115,12 +115,12 @@ __device_inline double min(double a, double b)
|
||||
|
||||
__device_inline float min4(float a, float b, float c, float d)
|
||||
{
|
||||
return min(min(min(a, b), c), d);
|
||||
return min(min(a, b), min(c, d));
|
||||
}
|
||||
|
||||
__device_inline float max4(float a, float b, float c, float d)
|
||||
{
|
||||
return max(max(max(a, b), c), d);
|
||||
return max(max(a, b), max(c, d));
|
||||
}
|
||||
|
||||
#ifndef __KERNEL_OPENCL__
|
||||
|
||||
@@ -162,5 +162,46 @@ bool path_read_binary(const string& path, vector<uint8_t>& binary)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool path_read_text(const string& path, string& text)
|
||||
{
|
||||
vector<uint8_t> binary;
|
||||
|
||||
if(!path_exists(path) || !path_read_binary(path, binary))
|
||||
return false;
|
||||
|
||||
const char *str = (const char*)&binary[0];
|
||||
size_t size = binary.size();
|
||||
text = string(str, size);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
string path_source_replace_includes(const string& source_, const string& path)
|
||||
{
|
||||
/* our own little c preprocessor that replaces #includes with the file
|
||||
contents, to work around issue of opencl drivers not supporting
|
||||
include paths with spaces in them */
|
||||
string source = source_;
|
||||
const string include = "#include \"";
|
||||
size_t n, pos = 0;
|
||||
|
||||
while((n = source.find(include, pos)) != string::npos) {
|
||||
size_t n_start = n + include.size();
|
||||
size_t n_end = source.find("\"", n_start);
|
||||
string filename = source.substr(n_start, n_end - n_start);
|
||||
|
||||
string text, filepath = path_join(path, filename);
|
||||
|
||||
if(path_read_text(filepath, text)) {
|
||||
text = path_source_replace_includes(text, path_dirname(filepath));
|
||||
source.replace(n, n_end + 1 - n, "\n" + text + "\n");
|
||||
}
|
||||
else
|
||||
pos = n_end;
|
||||
}
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ void path_create_directories(const string& path);
|
||||
bool path_write_binary(const string& path, const vector<uint8_t>& binary);
|
||||
bool path_read_binary(const string& path, vector<uint8_t>& binary);
|
||||
|
||||
string path_source_replace_includes(const string& source, const string& path);
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1765,7 +1765,7 @@ GHOST_TUns8* GHOST_SystemCocoa::getClipboard(bool selection) const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pastedTextSize = [textPasted lengthOfBytesUsingEncoding:NSISOLatin1StringEncoding];
|
||||
pastedTextSize = [textPasted lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
temp_buff = (GHOST_TUns8*) malloc(pastedTextSize+1);
|
||||
|
||||
@@ -1774,7 +1774,7 @@ GHOST_TUns8* GHOST_SystemCocoa::getClipboard(bool selection) const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strncpy((char*)temp_buff, [textPasted cStringUsingEncoding:NSISOLatin1StringEncoding], pastedTextSize);
|
||||
strncpy((char*)temp_buff, [textPasted cStringUsingEncoding:NSUTF8StringEncoding], pastedTextSize);
|
||||
|
||||
temp_buff[pastedTextSize] = '\0';
|
||||
|
||||
@@ -1806,7 +1806,7 @@ void GHOST_SystemCocoa::putClipboard(GHOST_TInt8 *buffer, bool selection) const
|
||||
|
||||
[pasteBoard declareTypes:supportedTypes owner:nil];
|
||||
|
||||
textToCopy = [NSString stringWithCString:buffer encoding:NSISOLatin1StringEncoding];
|
||||
textToCopy = [NSString stringWithCString:buffer encoding:NSUTF8StringEncoding];
|
||||
|
||||
[pasteBoard setString:textToCopy forType:NSStringPboardType];
|
||||
|
||||
|
||||
@@ -238,10 +238,13 @@ extern "C" {
|
||||
|
||||
#pragma mark NSOpenGLView subclass
|
||||
//We need to subclass it in order to give Cocoa the feeling key events are trapped
|
||||
@interface CocoaOpenGLView : NSOpenGLView
|
||||
@interface CocoaOpenGLView : NSOpenGLView <NSTextInput>
|
||||
{
|
||||
GHOST_SystemCocoa *systemCocoa;
|
||||
GHOST_WindowCocoa *associatedWindow;
|
||||
|
||||
bool composing;
|
||||
NSString *composing_text;
|
||||
}
|
||||
- (void)setSystemAndWindowCocoa:(GHOST_SystemCocoa *)sysCocoa windowCocoa:(GHOST_WindowCocoa *)winCocoa;
|
||||
@end
|
||||
@@ -251,6 +254,9 @@ extern "C" {
|
||||
{
|
||||
systemCocoa = sysCocoa;
|
||||
associatedWindow = winCocoa;
|
||||
|
||||
composing = false;
|
||||
composing_text = nil;
|
||||
}
|
||||
|
||||
- (BOOL)acceptsFirstResponder
|
||||
@@ -258,9 +264,26 @@ extern "C" {
|
||||
return YES;
|
||||
}
|
||||
|
||||
//The trick to prevent Cocoa from complaining (beeping)
|
||||
- (void)keyDown:(NSEvent *)theEvent
|
||||
{}
|
||||
// The trick to prevent Cocoa from complaining (beeping)
|
||||
- (void)keyDown:(NSEvent *)event
|
||||
{
|
||||
// Start or continue composing?
|
||||
if([[event characters] length] == 0 ||
|
||||
[[event charactersIgnoringModifiers] length] == 0 ||
|
||||
composing) {
|
||||
composing = YES;
|
||||
|
||||
// interpret event to call insertText
|
||||
NSMutableArray *events;
|
||||
events = [[NSMutableArray alloc] initWithCapacity:1];
|
||||
[events addObject:event];
|
||||
[self interpretKeyEvents:events]; // calls insertText
|
||||
[events removeObject:event];
|
||||
[events release];
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
//Cmd+key are handled differently before 10.5
|
||||
@@ -306,8 +329,99 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
// Text input
|
||||
|
||||
- (void)composing_free
|
||||
{
|
||||
composing = NO;
|
||||
|
||||
if(composing_text) {
|
||||
[composing_text release];
|
||||
composing_text = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)insertText:(id)chars
|
||||
{
|
||||
[self composing_free];
|
||||
}
|
||||
|
||||
- (void)setMarkedText:(id)chars selectedRange:(NSRange)range
|
||||
{
|
||||
[self composing_free];
|
||||
if([chars length] == 0)
|
||||
return;
|
||||
|
||||
// start composing
|
||||
composing = YES;
|
||||
composing_text = [chars copy];
|
||||
|
||||
// if empty, cancel
|
||||
if([composing_text length] == 0)
|
||||
[self composing_free];
|
||||
}
|
||||
|
||||
- (void)unmarkText
|
||||
{
|
||||
[self composing_free];
|
||||
}
|
||||
|
||||
- (BOOL)hasMarkedText
|
||||
{
|
||||
return (composing)? YES: NO;
|
||||
}
|
||||
|
||||
- (void)doCommandBySelector:(SEL)selector
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)isComposing
|
||||
{
|
||||
return composing;
|
||||
}
|
||||
|
||||
- (NSInteger)conversationIdentifier
|
||||
{
|
||||
return (NSInteger)self;
|
||||
}
|
||||
|
||||
- (NSAttributedString *)attributedSubstringFromRange:(NSRange)range
|
||||
{
|
||||
return [NSAttributedString new]; // XXX does this leak?
|
||||
}
|
||||
|
||||
- (NSRange)markedRange
|
||||
{
|
||||
unsigned int length = (composing_text)? [composing_text length]: 0;
|
||||
|
||||
if(composing)
|
||||
return NSMakeRange(0, length);
|
||||
|
||||
return NSMakeRange(NSNotFound, 0);
|
||||
}
|
||||
|
||||
- (NSRange)selectedRange
|
||||
{
|
||||
unsigned int length = (composing_text)? [composing_text length]: 0;
|
||||
return NSMakeRange(0, length);
|
||||
}
|
||||
|
||||
- (NSRect)firstRectForCharacterRange:(NSRange)range
|
||||
{
|
||||
return NSZeroRect;
|
||||
}
|
||||
|
||||
- (NSUInteger)characterIndexForPoint:(NSPoint)point
|
||||
{
|
||||
return NSNotFound;
|
||||
}
|
||||
|
||||
- (NSArray*)validAttributesForMarkedText
|
||||
{
|
||||
return [NSArray array]; // XXX does this leak?
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark initialization / finalization
|
||||
|
||||
|
||||
Binary file not shown.
@@ -146,7 +146,10 @@ def modules(module_cache):
|
||||
for path in path_list:
|
||||
|
||||
# force all contrib addons to be 'TESTING'
|
||||
force_support = 'TESTING' if path.endswith("addons_contrib") else None
|
||||
if path.endswith("addons_contrib") or path.endswith("addons_extern"):
|
||||
force_support = 'TESTING'
|
||||
else:
|
||||
force_support = None
|
||||
|
||||
for mod_name, mod_path in _bpy.path.module_names(path):
|
||||
modules_stale -= {mod_name}
|
||||
@@ -168,7 +171,9 @@ def modules(module_cache):
|
||||
mod = None
|
||||
|
||||
if mod is None:
|
||||
mod = fake_module(mod_name, mod_path, force_support=force_support)
|
||||
mod = fake_module(mod_name,
|
||||
mod_path,
|
||||
force_support=force_support)
|
||||
if mod:
|
||||
module_cache[mod_name] = mod
|
||||
|
||||
|
||||
@@ -263,7 +263,7 @@ def user_script_path():
|
||||
return None
|
||||
|
||||
|
||||
def script_paths(subdir=None, user_pref=True, all=False):
|
||||
def script_paths(subdir=None, user_pref=True, check_all=False):
|
||||
"""
|
||||
Returns a list of valid script paths.
|
||||
|
||||
@@ -271,9 +271,9 @@ def script_paths(subdir=None, user_pref=True, all=False):
|
||||
:type subdir: string
|
||||
:arg user_pref: Include the user preference script path.
|
||||
:type user_pref: bool
|
||||
:arg all: Include local, user and system paths rather just the paths
|
||||
:arg check_all: Include local, user and system paths rather just the paths
|
||||
blender uses.
|
||||
:type all: bool
|
||||
:type check_all: bool
|
||||
:return: script paths.
|
||||
:rtype: list
|
||||
"""
|
||||
@@ -286,7 +286,7 @@ def script_paths(subdir=None, user_pref=True, all=False):
|
||||
else:
|
||||
user_script_path = None
|
||||
|
||||
if all:
|
||||
if check_all:
|
||||
# all possible paths
|
||||
base_paths = tuple(_os.path.join(resource_path(res), "scripts")
|
||||
for res in ('LOCAL', 'USER', 'SYSTEM'))
|
||||
@@ -343,7 +343,7 @@ def preset_paths(subdir):
|
||||
:rtype: list
|
||||
"""
|
||||
dirs = []
|
||||
for path in script_paths("presets", all=True):
|
||||
for path in script_paths("presets", check_all=True):
|
||||
directory = _os.path.join(path, subdir)
|
||||
if not directory.startswith(path):
|
||||
raise Exception("invalid subdir given %r" % subdir)
|
||||
@@ -432,9 +432,9 @@ def keyconfig_set(filepath):
|
||||
keyconfigs_old = keyconfigs[:]
|
||||
|
||||
try:
|
||||
file = open(filepath)
|
||||
exec(compile(file.read(), filepath, 'exec'), {"__file__": filepath})
|
||||
file.close()
|
||||
keyfile = open(filepath)
|
||||
exec(compile(keyfile.read(), filepath, 'exec'), {"__file__": filepath})
|
||||
keyfile.close()
|
||||
except:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
@@ -72,7 +72,7 @@ def reduce_spaces(text):
|
||||
return RE_SPACE.sub(' ', text)
|
||||
|
||||
|
||||
def get_doc(object):
|
||||
def get_doc(obj):
|
||||
"""Get the doc string or comments for an object.
|
||||
|
||||
:param object: object
|
||||
@@ -82,7 +82,7 @@ def get_doc(object):
|
||||
>>> get_doc(abs)
|
||||
'abs(number) -> number\\n\\nReturn the absolute value of the argument.'
|
||||
"""
|
||||
result = inspect.getdoc(object) or inspect.getcomments(object)
|
||||
result = inspect.getdoc(obj) or inspect.getcomments(obj)
|
||||
return result and RE_EMPTY_LINE.sub('', result.rstrip()) or ''
|
||||
|
||||
|
||||
|
||||
@@ -19,9 +19,45 @@
|
||||
# <pep8 compliant>
|
||||
import bpy
|
||||
import os
|
||||
import shutil
|
||||
from bpy.types import Operator
|
||||
from bpy_extras.io_utils import unpack_list
|
||||
|
||||
from mathutils import Vector, Matrix
|
||||
|
||||
|
||||
def CLIP_spacees_walk(context, all_screens, tarea, tspace, callback, *args):
|
||||
screens = bpy.data.screens if all_screens else [context.screen]
|
||||
|
||||
for screen in screens:
|
||||
for area in screen.areas:
|
||||
if area.type == tarea:
|
||||
for space in area.spaces:
|
||||
if space.type == tspace:
|
||||
callback(space, *args)
|
||||
|
||||
|
||||
def CLIP_set_viewport_background(context, all_screens, clip, clip_user):
|
||||
def set_background(space_v3d, clip, user):
|
||||
bgpic = None
|
||||
|
||||
for x in space_v3d.background_images:
|
||||
if x.source == 'MOVIE':
|
||||
bgpic = x
|
||||
break
|
||||
|
||||
if not bgpic:
|
||||
bgpic = space_v3d.background_images.new()
|
||||
|
||||
bgpic.source = 'MOVIE'
|
||||
bgpic.clip = clip
|
||||
bgpic.clip_user.proxy_render_size = user.proxy_render_size
|
||||
bgpic.clip_user.use_render_undistorted = True
|
||||
bgpic.use_camera_clip = False
|
||||
bgpic.view_axis = 'CAMERA'
|
||||
|
||||
space_v3d.show_background_images = True
|
||||
|
||||
CLIP_spacees_walk(context, all_screens, 'VIEW_3D', 'VIEW_3D',
|
||||
set_background, clip, clip_user)
|
||||
|
||||
|
||||
def CLIP_track_view_selected(sc, track):
|
||||
@@ -51,8 +87,8 @@ class CLIP_OT_track_to_empty(Operator):
|
||||
|
||||
ob = bpy.data.objects.new(name=track.name, object_data=None)
|
||||
ob.select = True
|
||||
bpy.context.scene.objects.link(ob)
|
||||
bpy.context.scene.objects.active = ob
|
||||
context.scene.objects.link(ob)
|
||||
context.scene.objects.active = ob
|
||||
|
||||
for con in ob.constraints:
|
||||
if con.type == 'FOLLOW_TRACK':
|
||||
@@ -77,11 +113,11 @@ class CLIP_OT_track_to_empty(Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class CLIP_OT_tracks_to_mesh(Operator):
|
||||
"""Create vertex cloud using coordinates of tracks"""
|
||||
class CLIP_OT_bundles_to_mesh(Operator):
|
||||
"""Create vertex cloud using coordinates of reconstructed tracks"""
|
||||
|
||||
bl_idname = "clip.tracks_to_mesh"
|
||||
bl_label = "Tracks to Mesh"
|
||||
bl_idname = "clip.bundles_to_mesh"
|
||||
bl_label = "3D Markers to Mesh"
|
||||
bl_options = {'UNDO', 'REGISTER'}
|
||||
|
||||
@classmethod
|
||||
@@ -90,6 +126,8 @@ class CLIP_OT_tracks_to_mesh(Operator):
|
||||
return (sc.type == 'CLIP_EDITOR') and sc.clip
|
||||
|
||||
def execute(self, context):
|
||||
from bpy_extras.io_utils import unpack_list
|
||||
|
||||
sc = context.space_data
|
||||
clip = sc.clip
|
||||
|
||||
@@ -106,7 +144,7 @@ class CLIP_OT_tracks_to_mesh(Operator):
|
||||
|
||||
ob = bpy.data.objects.new(name="Tracks", object_data=mesh)
|
||||
|
||||
bpy.context.scene.objects.link(ob)
|
||||
context.scene.objects.link(ob)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -133,6 +171,8 @@ class CLIP_OT_delete_proxy(Operator):
|
||||
return wm.invoke_confirm(self, event)
|
||||
|
||||
def _rmproxy(self, abspath):
|
||||
import shutil
|
||||
|
||||
if not os.path.exists(abspath):
|
||||
return
|
||||
|
||||
@@ -202,35 +242,9 @@ class CLIP_OT_set_viewport_background(Operator):
|
||||
|
||||
return sc.clip
|
||||
|
||||
def _set_background(self, space_v3d, clip, user):
|
||||
bgpic = None
|
||||
|
||||
for x in space_v3d.background_images:
|
||||
if x.source == 'MOVIE':
|
||||
bgpic = x
|
||||
break
|
||||
|
||||
if not bgpic:
|
||||
bgpic = space_v3d.background_images.new()
|
||||
|
||||
bgpic.source = 'MOVIE'
|
||||
bgpic.clip = clip
|
||||
bgpic.clip_user.proxy_render_size = user.proxy_render_size
|
||||
bgpic.clip_user.use_render_undistorted = user.use_render_undistorted
|
||||
bgpic.use_camera_clip = False
|
||||
bgpic.view_axis = 'CAMERA'
|
||||
|
||||
space_v3d.show_background_images = True
|
||||
|
||||
def execute(self, context):
|
||||
sc = context.space_data
|
||||
clip = sc.clip
|
||||
|
||||
for area in context.window.screen.areas:
|
||||
if area.type == 'VIEW_3D':
|
||||
for space in area.spaces:
|
||||
if space.type == 'VIEW_3D':
|
||||
self._set_background(space, clip, sc.clip_user)
|
||||
CLIP_set_viewport_background(context, False, sc.clip, sc.clip_user)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -332,3 +346,432 @@ object's movement caused by this constraint"""
|
||||
self._bake_object(scene, ob)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class CLIP_OT_setup_tracking_scene(Operator):
|
||||
"""Prepare scene for compositing 3D objects into this footage"""
|
||||
|
||||
bl_idname = "clip.setup_tracking_scene"
|
||||
bl_label = "Setup Tracking Scene"
|
||||
bl_options = {'UNDO', 'REGISTER'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
sc = context.space_data
|
||||
|
||||
if sc.type != 'CLIP_EDITOR':
|
||||
return False
|
||||
|
||||
clip = sc.clip
|
||||
|
||||
return clip and clip.tracking.reconstruction.is_valid
|
||||
|
||||
@staticmethod
|
||||
def _setupScene(context):
|
||||
scene = context.scene
|
||||
scene.active_clip = context.space_data.clip
|
||||
|
||||
@staticmethod
|
||||
def _setupWorld(context):
|
||||
scene = context.scene
|
||||
world = scene.world
|
||||
|
||||
if not world:
|
||||
world = bpy.data.worlds.new(name="World")
|
||||
scene.world = world
|
||||
|
||||
world.light_settings.use_ambient_occlusion = True
|
||||
world.light_settings.ao_blend_type = 'MULTIPLY'
|
||||
|
||||
world.light_settings.use_environment_light = True
|
||||
world.light_settings.environment_energy = 0.1
|
||||
|
||||
world.light_settings.distance = 1.0
|
||||
world.light_settings.sample_method = 'ADAPTIVE_QMC'
|
||||
world.light_settings.samples = 7
|
||||
world.light_settings.threshold = 0.005
|
||||
|
||||
@staticmethod
|
||||
def _findOrCreateCamera(context):
|
||||
scene = context.scene
|
||||
|
||||
if scene.camera:
|
||||
return scene.camera
|
||||
|
||||
cam = bpy.data.cameras.new(name="Camera")
|
||||
camob = bpy.data.objects.new(name="Camera", object_data=cam)
|
||||
scene.objects.link(camob)
|
||||
|
||||
scene.camera = camob
|
||||
|
||||
camob.matrix_local = (Matrix.Translation((7.481, -6.508, 5.344)) *
|
||||
Matrix.Rotation(0.815, 4, 'Z') *
|
||||
Matrix.Rotation(0.011, 4, 'Y') *
|
||||
Matrix.Rotation(1.109, 4, 'X'))
|
||||
|
||||
return camob
|
||||
|
||||
@staticmethod
|
||||
def _setupCamera(context):
|
||||
camob = CLIP_OT_setup_tracking_scene._findOrCreateCamera(context)
|
||||
|
||||
# Remove all constraints to be sure motion is fine
|
||||
camob.constraints.clear()
|
||||
|
||||
# Append camera solver constraint
|
||||
con = camob.constraints.new(type='CAMERA_SOLVER')
|
||||
con.use_active_clip = True
|
||||
con.influence = 1.0
|
||||
|
||||
@staticmethod
|
||||
def _setupViewport(context):
|
||||
sc = context.space_data
|
||||
CLIP_set_viewport_background(context, True, sc.clip, sc.clip_user)
|
||||
|
||||
@staticmethod
|
||||
def _setupRenderLayers(context):
|
||||
scene = context.scene
|
||||
rlayers = scene.render.layers
|
||||
|
||||
if not scene.render.layers.get("Foreground"):
|
||||
if len(rlayers) == 1:
|
||||
fg = rlayers[0]
|
||||
fg.name = 'Foreground'
|
||||
else:
|
||||
fg = scene.render.layers.new('Foreground')
|
||||
|
||||
fg.use_sky = False
|
||||
fg.layers = [True] + [False] * 19
|
||||
fg.layers_zmask = [False] * 10 + [True] + [False] * 9
|
||||
fg.use_pass_vector = True
|
||||
|
||||
if not scene.render.layers.get("Background"):
|
||||
bg = scene.render.layers.new('Background')
|
||||
bg.use_pass_shadow = True
|
||||
bg.use_pass_ambient_occlusion = True
|
||||
bg.layers = [False] * 10 + [True] + [False] * 9
|
||||
|
||||
@staticmethod
|
||||
def _findNode(tree, type):
|
||||
for node in tree.nodes:
|
||||
if node.type == type:
|
||||
return node
|
||||
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def _findOrCreateNode(tree, type):
|
||||
node = CLIP_OT_setup_tracking_scene._findNode(tree, type)
|
||||
|
||||
if not node:
|
||||
node = tree.nodes.new(type=type)
|
||||
|
||||
return node
|
||||
|
||||
@staticmethod
|
||||
def _needSetupNodes(context):
|
||||
scene = context.scene
|
||||
tree = scene.node_tree
|
||||
|
||||
if not tree:
|
||||
# No compositor node tree found, time to create it!
|
||||
return True
|
||||
|
||||
for node in tree.nodes:
|
||||
if node.type in {'MOVIECLIP', 'MOVIEDISTORTION'}:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def _offsetNodes(tree):
|
||||
for a in tree.nodes:
|
||||
for b in tree.nodes:
|
||||
if a != b and a.location == b.location:
|
||||
b.location += Vector((40.0, 20.0))
|
||||
|
||||
def _setupNodes(self, context):
|
||||
if not self._needSetupNodes(context):
|
||||
# compositor nodes were already setup or even changes already
|
||||
# do nothing to prevent nodes damage
|
||||
return
|
||||
|
||||
# Enable backdrop for all compositor spaces
|
||||
def setup_space(space):
|
||||
space.show_backdrop = True
|
||||
|
||||
CLIP_spacees_walk(context, True, 'NODE_EDITOR', 'NODE_EDITOR',
|
||||
setup_space)
|
||||
|
||||
sc = context.space_data
|
||||
scene = context.scene
|
||||
scene.use_nodes = True
|
||||
tree = scene.node_tree
|
||||
clip = sc.clip
|
||||
|
||||
need_stabilization = False
|
||||
|
||||
# create nodes
|
||||
rlayer_fg = self._findOrCreateNode(tree, 'R_LAYERS')
|
||||
rlayer_bg = tree.nodes.new(type='R_LAYERS')
|
||||
composite = self._findOrCreateNode(tree, 'COMPOSITE')
|
||||
|
||||
movieclip = tree.nodes.new(type='MOVIECLIP')
|
||||
distortion = tree.nodes.new(type='MOVIEDISTORTION')
|
||||
|
||||
if need_stabilization:
|
||||
stabilize = tree.nodes.new(type='STABILIZE2D')
|
||||
|
||||
scale = tree.nodes.new(type='SCALE')
|
||||
invert = tree.nodes.new(type='INVERT')
|
||||
add_ao = tree.nodes.new(type='MIX_RGB')
|
||||
add_shadow = tree.nodes.new(type='MIX_RGB')
|
||||
mul_shadow = tree.nodes.new(type='MIX_RGB')
|
||||
mul_image = tree.nodes.new(type='MIX_RGB')
|
||||
vector_blur = tree.nodes.new(type='VECBLUR')
|
||||
alphaover = tree.nodes.new(type='ALPHAOVER')
|
||||
viewer = tree.nodes.new(type='VIEWER')
|
||||
|
||||
# setup nodes
|
||||
movieclip.clip = clip
|
||||
|
||||
distortion.clip = clip
|
||||
distortion.distortion_type = 'UNDISTORT'
|
||||
|
||||
if need_stabilization:
|
||||
stabilize.clip = clip
|
||||
|
||||
scale.space = 'RENDER_SIZE'
|
||||
|
||||
rlayer_bg.scene = scene
|
||||
rlayer_bg.layer = "Background"
|
||||
|
||||
rlayer_fg.scene = scene
|
||||
rlayer_fg.layer = "Foreground"
|
||||
|
||||
add_ao.blend_type = 'ADD'
|
||||
add_shadow.blend_type = 'ADD'
|
||||
|
||||
mul_shadow.blend_type = 'MULTIPLY'
|
||||
mul_shadow.inputs['Fac'].default_value = 0.8
|
||||
|
||||
mul_image.blend_type = 'MULTIPLY'
|
||||
mul_image.inputs['Fac'].default_value = 0.8
|
||||
|
||||
vector_blur.factor = 0.75
|
||||
|
||||
# create links
|
||||
tree.links.new(movieclip.outputs['Image'], distortion.inputs['Image'])
|
||||
|
||||
if need_stabilization:
|
||||
tree.links.new(distortion.outputs['Image'],
|
||||
stabilize.inputs['Image'])
|
||||
tree.links.new(stabilize.outputs['Image'], scale.inputs['Image'])
|
||||
else:
|
||||
tree.links.new(distortion.outputs['Image'], scale.inputs['Image'])
|
||||
|
||||
tree.links.new(rlayer_bg.outputs['Alpha'], invert.inputs['Color'])
|
||||
|
||||
tree.links.new(invert.outputs['Color'], add_shadow.inputs[1])
|
||||
tree.links.new(rlayer_bg.outputs['Shadow'], add_shadow.inputs[2])
|
||||
|
||||
tree.links.new(invert.outputs['Color'], add_ao.inputs[1])
|
||||
tree.links.new(rlayer_bg.outputs['AO'], add_ao.inputs[2])
|
||||
|
||||
tree.links.new(add_ao.outputs['Image'], mul_shadow.inputs[1])
|
||||
tree.links.new(add_shadow.outputs['Image'], mul_shadow.inputs[2])
|
||||
|
||||
tree.links.new(scale.outputs['Image'], mul_image.inputs[1])
|
||||
tree.links.new(mul_shadow.outputs['Image'], mul_image.inputs[2])
|
||||
|
||||
tree.links.new(rlayer_fg.outputs['Image'], vector_blur.inputs['Image'])
|
||||
tree.links.new(rlayer_fg.outputs['Z'], vector_blur.inputs['Z'])
|
||||
tree.links.new(rlayer_fg.outputs['Speed'], vector_blur.inputs['Speed'])
|
||||
|
||||
tree.links.new(mul_image.outputs['Image'], alphaover.inputs[1])
|
||||
tree.links.new(vector_blur.outputs['Image'], alphaover.inputs[2])
|
||||
|
||||
tree.links.new(alphaover.outputs['Image'], composite.inputs['Image'])
|
||||
tree.links.new(alphaover.outputs['Image'], viewer.inputs['Image'])
|
||||
|
||||
# place nodes
|
||||
movieclip.location = Vector((-300.0, 350.0))
|
||||
|
||||
distortion.location = movieclip.location
|
||||
distortion.location += Vector((200.0, 0.0))
|
||||
|
||||
if need_stabilization:
|
||||
stabilize.location = distortion.location
|
||||
stabilize.location += Vector((200.0, 0.0))
|
||||
|
||||
scale.location = stabilize.location
|
||||
scale.location += Vector((200.0, 0.0))
|
||||
else:
|
||||
scale.location = distortion.location
|
||||
scale.location += Vector((200.0, 0.0))
|
||||
|
||||
rlayer_bg.location = movieclip.location
|
||||
rlayer_bg.location -= Vector((0.0, 350.0))
|
||||
|
||||
invert.location = rlayer_bg.location
|
||||
invert.location += Vector((250.0, 50.0))
|
||||
|
||||
add_ao.location = invert.location
|
||||
add_ao.location[0] += 200
|
||||
add_ao.location[1] = rlayer_bg.location[1]
|
||||
|
||||
add_shadow.location = add_ao.location
|
||||
add_shadow.location -= Vector((0.0, 250.0))
|
||||
|
||||
mul_shadow.location = add_ao.location
|
||||
mul_shadow.location += Vector((200.0, -50.0))
|
||||
|
||||
mul_image.location = mul_shadow.location
|
||||
mul_image.location += Vector((300.0, 200.0))
|
||||
|
||||
rlayer_fg.location = rlayer_bg.location
|
||||
rlayer_fg.location -= Vector((0.0, 500.0))
|
||||
|
||||
vector_blur.location[0] = mul_image.location[0]
|
||||
vector_blur.location[1] = rlayer_fg.location[1]
|
||||
|
||||
alphaover.location[0] = vector_blur.location[0] + 350
|
||||
alphaover.location[1] = \
|
||||
(vector_blur.location[1] + mul_image.location[1]) / 2
|
||||
|
||||
composite.location = alphaover.location
|
||||
composite.location += Vector((200.0, -100.0))
|
||||
|
||||
viewer.location = composite.location
|
||||
composite.location += Vector((0.0, 200.0))
|
||||
|
||||
# ensure no nodes were creates on position of existing node
|
||||
self._offsetNodes(tree)
|
||||
|
||||
@staticmethod
|
||||
def _createMesh(scene, name, vertices, faces):
|
||||
from bpy_extras.io_utils import unpack_list, unpack_face_list
|
||||
|
||||
mesh = bpy.data.meshes.new(name=name)
|
||||
|
||||
mesh.vertices.add(len(vertices))
|
||||
mesh.vertices.foreach_set("co", unpack_list(vertices))
|
||||
|
||||
mesh.faces.add(len(faces))
|
||||
mesh.faces.foreach_set("vertices_raw", unpack_face_list(faces))
|
||||
|
||||
mesh.update(calc_edges=True)
|
||||
|
||||
ob = bpy.data.objects.new(name=name, object_data=mesh)
|
||||
|
||||
scene.objects.link(ob)
|
||||
|
||||
return ob
|
||||
|
||||
@staticmethod
|
||||
def _getPlaneVertices(half_size, z):
|
||||
|
||||
return [(-half_size, -half_size, z),
|
||||
(-half_size, half_size, z),
|
||||
(half_size, half_size, z),
|
||||
(half_size, -half_size, z)]
|
||||
|
||||
def _createGround(self, scene):
|
||||
vertices = self._getPlaneVertices(4.0, 0.0)
|
||||
faces = [(0, 1, 2, 3)]
|
||||
|
||||
ob = self._createMesh(scene, "Ground", vertices, faces)
|
||||
ob["is_ground"] = True
|
||||
|
||||
return ob
|
||||
|
||||
@staticmethod
|
||||
def _findGround(context):
|
||||
scene = context.scene
|
||||
|
||||
for ob in scene.objects:
|
||||
if ob.type == 'MESH' and "is_ground" in ob:
|
||||
return ob
|
||||
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def _mergeLayers(layers_a, layers_b):
|
||||
|
||||
return [(layers_a[i] | layers_b[i]) for i in range(len(layers_a))]
|
||||
|
||||
@staticmethod
|
||||
def _createLamp(scene):
|
||||
lamp = bpy.data.lamps.new(name="Lamp", type='POINT')
|
||||
lampob = bpy.data.objects.new(name="Lamp", object_data=lamp)
|
||||
scene.objects.link(lampob)
|
||||
|
||||
lampob.matrix_local = Matrix.Translation((4.076, 1.005, 5.904))
|
||||
|
||||
lamp.distance = 30
|
||||
lamp.shadow_method = 'RAY_SHADOW'
|
||||
|
||||
return lampob
|
||||
|
||||
def _createSampleObject(self, scene):
|
||||
vertices = self._getPlaneVertices(1.0, -1.0) + \
|
||||
self._getPlaneVertices(1.0, 1.0)
|
||||
faces = ((0, 1, 2, 3),
|
||||
(4, 7, 6, 5),
|
||||
(0, 4, 5, 1),
|
||||
(1, 5, 6, 2),
|
||||
(2, 6, 7, 3),
|
||||
(3, 7, 4, 0))
|
||||
|
||||
return self._createMesh(scene, "Cube", vertices, faces)
|
||||
|
||||
def _setupObjects(self, context):
|
||||
scene = context.scene
|
||||
|
||||
fg = scene.render.layers.get("Foreground")
|
||||
bg = scene.render.layers.get("Background")
|
||||
|
||||
all_layers = self._mergeLayers(fg.layers, bg.layers)
|
||||
|
||||
# enshure all lamps are active on foreground and background
|
||||
has_lamp = False
|
||||
has_mesh = False
|
||||
for ob in scene.objects:
|
||||
if ob.type == 'LAMP':
|
||||
ob.layers = all_layers
|
||||
has_lamp = True
|
||||
elif ob.type == 'MESH' and "is_ground" not in ob:
|
||||
has_mesh = True
|
||||
|
||||
# create sample lamp if there's no lamps in the scene
|
||||
if not has_lamp:
|
||||
lamp = self._createLamp(scene)
|
||||
lamp.layers = all_layers
|
||||
|
||||
# create sample object if there's no meshes in the scene
|
||||
if not has_mesh:
|
||||
ob = self._createSampleObject(scene)
|
||||
ob.layers = fg.layers
|
||||
|
||||
# create ground object if needed
|
||||
ground = self._findGround(context)
|
||||
if not ground:
|
||||
ground = self._createGround(scene)
|
||||
ground.layers = bg.layers
|
||||
else:
|
||||
# make sure ground is available on Background layer
|
||||
ground.layers = self._mergeLayers(ground.layers, bg.layers)
|
||||
|
||||
# layers with background and foreground should be rendered
|
||||
scene.layers = self._mergeLayers(scene.layers, all_layers)
|
||||
|
||||
def execute(self, context):
|
||||
self._setupScene(context)
|
||||
self._setupWorld(context)
|
||||
self._setupCamera(context)
|
||||
self._setupViewport(context)
|
||||
self._setupRenderLayers(context)
|
||||
self._setupNodes(context)
|
||||
self._setupObjects(context)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -566,8 +566,8 @@ class LightMapPack(Operator):
|
||||
default=True,
|
||||
)
|
||||
PREF_NEW_UVLAYER = BoolProperty(
|
||||
name="New UV Layer",
|
||||
description="Create a new UV layer for every mesh packed",
|
||||
name="New UV Map",
|
||||
description="Create a new UV map for every mesh packed",
|
||||
default=False,
|
||||
)
|
||||
PREF_APPLY_IMAGE = BoolProperty(
|
||||
|
||||
@@ -265,7 +265,7 @@ class DATA_PT_shape_keys(MeshButtonsPanel, Panel):
|
||||
|
||||
|
||||
class DATA_PT_uv_texture(MeshButtonsPanel, Panel):
|
||||
bl_label = "UV Texture"
|
||||
bl_label = "UV Maps"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def draw(self, context):
|
||||
|
||||
@@ -454,15 +454,15 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
||||
layout.separator()
|
||||
|
||||
layout.prop(md, "use_normals")
|
||||
|
||||
|
||||
split = layout.split()
|
||||
|
||||
|
||||
col = split.column()
|
||||
col.prop(md, "use_foam")
|
||||
sub = col.row()
|
||||
sub.active = md.use_foam
|
||||
sub.prop(md, "foam_coverage", text="Coverage")
|
||||
|
||||
|
||||
col = split.column()
|
||||
col.active = md.use_foam
|
||||
col.label("Foam Data Layer Name:")
|
||||
@@ -692,7 +692,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
||||
col.prop(md, "image", text="")
|
||||
|
||||
col = split.column()
|
||||
col.label(text="UV Layer:")
|
||||
col.label(text="UV Map:")
|
||||
col.prop_search(md, "uv_layer", ob.data, "uv_textures", text="")
|
||||
|
||||
split = layout.split()
|
||||
|
||||
@@ -408,7 +408,7 @@ class SceneButtonsPanel():
|
||||
|
||||
class SCENE_PT_game_navmesh(SceneButtonsPanel, Panel):
|
||||
bl_label = "Navigation mesh"
|
||||
bl_default_closed = True
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
COMPAT_ENGINES = {'BLENDER_GAME'}
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -242,7 +242,7 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel):
|
||||
# image format outputs
|
||||
if surface.surface_format == 'IMAGE':
|
||||
layout.operator("dpaint.bake", text="Bake Image Sequence", icon='MOD_DYNAMICPAINT')
|
||||
layout.prop_search(surface, "uv_layer", ob.data, "uv_textures", text="UV layer:")
|
||||
layout.prop_search(surface, "uv_layer", ob.data, "uv_textures", text="UV Map:")
|
||||
layout.separator()
|
||||
|
||||
layout.prop(surface, "image_output_path", text="")
|
||||
@@ -300,7 +300,7 @@ class PHYSICS_PT_dp_canvas_initial_color(PhysicButtonsPanel, Panel):
|
||||
|
||||
elif surface.init_color_type == 'TEXTURE':
|
||||
layout.prop(surface, "init_texture")
|
||||
layout.prop_search(surface, "init_layername", ob.data, "uv_textures", text="UV Layer:")
|
||||
layout.prop_search(surface, "init_layername", ob.data, "uv_textures", text="UV Map:")
|
||||
|
||||
elif surface.init_color_type == 'VERTEX_COLOR':
|
||||
layout.prop_search(surface, "init_layername", ob.data, "vertex_colors", text="Color Layer: ")
|
||||
|
||||
@@ -972,66 +972,19 @@ class RENDER_PT_output(RenderButtonsPanel, Panel):
|
||||
layout = self.layout
|
||||
|
||||
rd = context.scene.render
|
||||
file_format = rd.file_format
|
||||
image_settings = rd.image_settings
|
||||
file_format = rd.image_settings.file_format
|
||||
|
||||
layout.prop(rd, "filepath", text="")
|
||||
|
||||
split = layout.split()
|
||||
flow = layout.column_flow()
|
||||
flow.prop(rd, "use_overwrite")
|
||||
flow.prop(rd, "use_placeholder")
|
||||
flow.prop(rd, "use_file_extension")
|
||||
|
||||
col = split.column()
|
||||
col.prop(rd, "file_format", text="")
|
||||
col.row().prop(rd, "color_mode", text="Color", expand=True)
|
||||
layout.template_image_settings(rd.image_settings)
|
||||
|
||||
col = split.column()
|
||||
col.prop(rd, "use_file_extension")
|
||||
col.prop(rd, "use_overwrite")
|
||||
col.prop(rd, "use_placeholder")
|
||||
|
||||
if file_format in {'AVI_JPEG', 'JPEG'}:
|
||||
layout.prop(rd, "file_quality", slider=True)
|
||||
|
||||
if file_format == 'PNG':
|
||||
layout.prop(rd, "file_quality", slider=True, text="Compression")
|
||||
|
||||
if file_format in {'OPEN_EXR', 'MULTILAYER'}:
|
||||
row = layout.row()
|
||||
row.prop(rd, "exr_codec", text="Codec")
|
||||
|
||||
if file_format == 'OPEN_EXR':
|
||||
row = layout.row()
|
||||
row.prop(rd, "use_exr_half")
|
||||
row.prop(rd, "exr_zbuf")
|
||||
row.prop(rd, "exr_preview")
|
||||
|
||||
elif file_format == 'JPEG2000':
|
||||
split = layout.split()
|
||||
col = split.column()
|
||||
col.label(text="Depth:")
|
||||
col.row().prop(rd, "jpeg2k_depth", expand=True)
|
||||
|
||||
col = split.column()
|
||||
col.prop(rd, "jpeg2k_preset", text="")
|
||||
col.prop(rd, "jpeg2k_ycc")
|
||||
|
||||
elif file_format in {'CINEON', 'DPX'}:
|
||||
|
||||
split = layout.split()
|
||||
split.label("FIXME: hard coded Non-Linear, Gamma:1.0")
|
||||
'''
|
||||
col = split.column()
|
||||
col.prop(rd, "use_cineon_log", text="Convert to Log")
|
||||
|
||||
col = split.column(align=True)
|
||||
col.active = rd.use_cineon_log
|
||||
col.prop(rd, "cineon_black", text="Black")
|
||||
col.prop(rd, "cineon_white", text="White")
|
||||
col.prop(rd, "cineon_gamma", text="Gamma")
|
||||
'''
|
||||
|
||||
elif file_format == 'TIFF':
|
||||
layout.prop(rd, "use_tiff_16bit")
|
||||
|
||||
elif file_format == 'QUICKTIME_CARBON':
|
||||
if file_format == 'QUICKTIME_CARBON':
|
||||
layout.operator("scene.render_data_set_quicktime_codec")
|
||||
|
||||
elif file_format == 'QUICKTIME_QTKIT':
|
||||
@@ -1072,7 +1025,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, Panel):
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
rd = context.scene.render
|
||||
return rd.file_format in {'FFMPEG', 'XVID', 'H264', 'THEORA'}
|
||||
return rd.image_settings.file_format in {'FFMPEG', 'XVID', 'H264', 'THEORA'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@@ -831,7 +831,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel, Panel):
|
||||
"""
|
||||
elif tex.texture_coords == 'UV':
|
||||
split = layout.split(percentage=0.3)
|
||||
split.label(text="Layer:")
|
||||
split.label(text="Map:")
|
||||
ob = context.object
|
||||
if ob and ob.type == 'MESH':
|
||||
split.prop_search(tex, "uv_layer", ob.data, "uv_textures", text="")
|
||||
|
||||
@@ -210,7 +210,7 @@ class CLIP_PT_tools_geometry(Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("clip.tracks_to_mesh")
|
||||
layout.operator("clip.bundles_to_mesh")
|
||||
layout.operator("clip.track_to_empty")
|
||||
|
||||
|
||||
@@ -402,15 +402,15 @@ class CLIP_PT_display(Panel):
|
||||
col.prop(sc, "show_marker_search", text="Search")
|
||||
col.prop(sc, "show_pyramid_levels", text="Pyramid")
|
||||
|
||||
col.prop(sc, "show_track_path", text="Track Path")
|
||||
col.prop(sc, "show_track_path", text="Path")
|
||||
row = col.row()
|
||||
row.active = sc.show_track_path
|
||||
row.prop(sc, "path_length", text="Length")
|
||||
|
||||
col.prop(sc, "show_disabled", "Disabled Tracks")
|
||||
col.prop(sc, "show_bundles", text="Bundles")
|
||||
col.prop(sc, "show_bundles", text="3D Markers")
|
||||
|
||||
col.prop(sc, "show_names", text="Track Names and Status")
|
||||
col.prop(sc, "show_names", text="Names and Status")
|
||||
col.prop(sc, "show_tiny_markers", text="Compact Markers")
|
||||
|
||||
col.prop(sc, "show_grease_pencil", text="Grease Pencil")
|
||||
@@ -475,7 +475,7 @@ class CLIP_PT_stabilization(Panel):
|
||||
|
||||
def draw_header(self, context):
|
||||
stab = context.space_data.clip.tracking.stabilization
|
||||
|
||||
|
||||
self.layout.prop(stab, "use_2d_stabilization", text="")
|
||||
|
||||
def draw(self, context):
|
||||
@@ -640,6 +640,7 @@ class CLIP_PT_tools_clip(Panel):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("clip.set_viewport_background")
|
||||
layout.operator("clip.setup_tracking_scene")
|
||||
|
||||
|
||||
class CLIP_MT_view(Menu):
|
||||
|
||||
@@ -262,6 +262,7 @@ class VIEW3D_MT_uv_map(Menu):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator_context = 'EXEC_REGION_WIN'
|
||||
layout.operator("uv.project_from_view")
|
||||
layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
|
||||
|
||||
@@ -1767,7 +1768,7 @@ class VIEW3D_MT_edit_curve_ctrlpoints(Menu):
|
||||
edit_object = context.edit_object
|
||||
|
||||
if edit_object.type == 'CURVE':
|
||||
layout.operator("transform.transform", text="Tilt").mode = 'TILT'
|
||||
layout.operator("transform.tilt")
|
||||
layout.operator("curve.tilt_clear")
|
||||
layout.operator("curve.separate")
|
||||
|
||||
@@ -2213,7 +2214,7 @@ class VIEW3D_PT_view3d_motion_tracking(Panel):
|
||||
|
||||
col = layout.column()
|
||||
col.active = view.show_reconstruction
|
||||
col.prop(view, "show_tracks_name")
|
||||
col.prop(view, "show_bundle_names")
|
||||
col.prop(view, "show_camera_path")
|
||||
col.label(text="Tracks:")
|
||||
col.prop(view, "tracks_draw_type", text="")
|
||||
|
||||
@@ -88,7 +88,7 @@ class VIEW3D_PT_tools_objectmode(View3DPanel, Panel):
|
||||
col.operator("object.join")
|
||||
|
||||
active_object = context.active_object
|
||||
if active_object and active_object.type == 'MESH':
|
||||
if active_object and active_object.type in {'MESH', 'CURVE', 'SURFACE'}:
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Shading:")
|
||||
|
||||
@@ -129,7 +129,7 @@ void BLF_dir_free(char **dirs, int count)
|
||||
char *blf_dir_search(const char *file)
|
||||
{
|
||||
DirBLF *dir;
|
||||
char full_path[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char full_path[FILE_MAX];
|
||||
char *s= NULL;
|
||||
|
||||
for(dir=global_font_dir.first; dir; dir= dir->next) {
|
||||
|
||||
@@ -526,7 +526,7 @@ int editmesh_get_first_deform_matrices(struct Scene *, struct Object *, struct E
|
||||
int sculpt_get_deform_matrices(struct Scene *scene, struct Object *ob,
|
||||
float (**deformmats)[3][3], float (**deformcos)[3]);
|
||||
|
||||
void weight_to_rgb(float input, float *fr, float *fg, float *fb);
|
||||
void weight_to_rgb(float r_rgb[3], const float weight);
|
||||
|
||||
/* convert layers requested by a GLSL material to actually available layers in
|
||||
* the DerivedMesh, with both a pointer for arrays and an offset for editmesh */
|
||||
|
||||
@@ -43,6 +43,7 @@ struct Tex;
|
||||
struct anim;
|
||||
struct Scene;
|
||||
struct Object;
|
||||
struct ImageFormatData;
|
||||
|
||||
/* call from library */
|
||||
void free_image(struct Image *me);
|
||||
@@ -50,13 +51,22 @@ void free_image(struct Image *me);
|
||||
void BKE_stamp_info(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf);
|
||||
void BKE_stamp_buf(struct Scene *scene, struct Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels);
|
||||
int BKE_alphatest_ibuf(struct ImBuf *ibuf);
|
||||
int BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
|
||||
int BKE_write_ibuf(struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
|
||||
void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, int imtype, const short use_ext, const short use_frames);
|
||||
int BKE_add_image_extension(char *string, int imtype);
|
||||
int BKE_ftype_to_imtype(int ftype);
|
||||
int BKE_imtype_to_ftype(int imtype);
|
||||
int BKE_imtype_is_movie(int imtype);
|
||||
int BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
|
||||
int BKE_write_ibuf(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
|
||||
int BKE_write_ibuf_as(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf, const short is_copy);
|
||||
void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, char imtype, const short use_ext, const short use_frames);
|
||||
int BKE_add_image_extension(char *string, const char imtype);
|
||||
char BKE_ftype_to_imtype(const int ftype);
|
||||
int BKE_imtype_to_ftype(char imtype);
|
||||
|
||||
int BKE_imtype_is_movie(const char imtype);
|
||||
int BKE_imtype_supports_zbuf(const char imtype);
|
||||
int BKE_imtype_supports_compress(const char imtype);
|
||||
int BKE_imtype_supports_quality(const char imtype);
|
||||
char BKE_imtype_valid_channels(const char imtype);
|
||||
char BKE_imtype_valid_depths(const char imtype);
|
||||
|
||||
char BKE_imtype_from_arg(const char *arg);
|
||||
|
||||
struct anim *openanim(const char *name, int flags, int streamindex);
|
||||
|
||||
@@ -105,6 +115,10 @@ struct RenderResult;
|
||||
/* image-user gets a new image, check settings */
|
||||
#define IMA_SIGNAL_USER_NEW_IMAGE 6
|
||||
|
||||
#define IMA_CHAN_FLAG_BW 1
|
||||
#define IMA_CHAN_FLAG_RGB 2
|
||||
#define IMA_CHAN_FLAG_ALPHA 4
|
||||
|
||||
/* depending Image type, and (optional) ImageUser setting it returns ibuf */
|
||||
/* always call to make signals work */
|
||||
struct ImBuf *BKE_image_get_ibuf(struct Image *ima, struct ImageUser *iuser);
|
||||
|
||||
@@ -91,7 +91,7 @@ void end_render_materials(struct Main *);
|
||||
|
||||
int material_in_material(struct Material *parmat, struct Material *mat);
|
||||
|
||||
void ramp_blend(int type, float *r, float *g, float *b, float fac, const float col[3]);
|
||||
void ramp_blend(int type, float r_col[3], const float fac, const float col[3]);
|
||||
|
||||
/* copy/paste */
|
||||
void clear_matcopybuf(void);
|
||||
|
||||
@@ -217,7 +217,7 @@ typedef struct ParticleDrawData {
|
||||
float *ndata, *nd; /* normal data */
|
||||
float *cdata, *cd; /* color data */
|
||||
float *vedata, *ved; /* velocity data */
|
||||
float *ma_r, *ma_g, *ma_b;
|
||||
float *ma_col;
|
||||
int tot_vec_size, flag;
|
||||
int totpoint, totve;
|
||||
} ParticleDrawData;
|
||||
|
||||
@@ -127,6 +127,9 @@ typedef struct PTCacheID {
|
||||
unsigned int stack_index;
|
||||
unsigned int flag;
|
||||
|
||||
unsigned int default_step;
|
||||
unsigned int max_step;
|
||||
|
||||
/* flags defined in DNA_object_force.h */
|
||||
unsigned int data_types, info_types;
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ typedef struct bMovieHandle {
|
||||
void (*get_movie_path)(char *string, struct RenderData *rd); /* optional */
|
||||
} bMovieHandle;
|
||||
|
||||
bMovieHandle *BKE_get_movie_handle(int imtype);
|
||||
bMovieHandle *BKE_get_movie_handle(const char imtype);
|
||||
void BKE_makeanimstring(char *string, struct RenderData *rd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -2301,14 +2301,16 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
|
||||
/* zero */
|
||||
for (i=0; i<numEffectedV; i++) {
|
||||
CCGVert *v = effectedV[i];
|
||||
VertDataZero(VERT_getCo(v, lvl));
|
||||
if(v->numFaces)
|
||||
VertDataZero(VERT_getCo(v, lvl));
|
||||
}
|
||||
|
||||
for (i=0; i<numEffectedE; i++) {
|
||||
CCGEdge *e = effectedE[i];
|
||||
|
||||
for (x=0; x<edgeSize; x++)
|
||||
VertDataZero(EDGE_getCo(e, lvl, x));
|
||||
if(e->numFaces)
|
||||
for (x=0; x<edgeSize; x++)
|
||||
VertDataZero(EDGE_getCo(e, lvl, x));
|
||||
}
|
||||
|
||||
/* add */
|
||||
@@ -2349,7 +2351,8 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
|
||||
/* average */
|
||||
for (i=0; i<numEffectedV; i++) {
|
||||
CCGVert *v = effectedV[i];
|
||||
VertDataMulN(VERT_getCo(v, lvl), 1.0f/v->numFaces);
|
||||
if(v->numFaces)
|
||||
VertDataMulN(VERT_getCo(v, lvl), 1.0f/v->numFaces);
|
||||
}
|
||||
|
||||
for (i=0; i<numEffectedE; i++) {
|
||||
@@ -2358,8 +2361,9 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
|
||||
VertDataCopy(EDGE_getCo(e, lvl, 0), VERT_getCo(e->v0, lvl));
|
||||
VertDataCopy(EDGE_getCo(e, lvl, edgeSize-1), VERT_getCo(e->v1, lvl));
|
||||
|
||||
for (x=1; x<edgeSize-1; x++)
|
||||
VertDataMulN(EDGE_getCo(e, lvl, x), 1.0f/e->numFaces);
|
||||
if(e->numFaces)
|
||||
for (x=1; x<edgeSize-1; x++)
|
||||
VertDataMulN(EDGE_getCo(e, lvl, x), 1.0f/e->numFaces);
|
||||
}
|
||||
|
||||
/* copy */
|
||||
|
||||
@@ -1777,31 +1777,29 @@ static void add_orco_dm(Object *ob, EditMesh *em, DerivedMesh *dm, DerivedMesh *
|
||||
* happens on enter/exit wpaint.
|
||||
*/
|
||||
|
||||
void weight_to_rgb(float input, float *fr, float *fg, float *fb)
|
||||
void weight_to_rgb(float r_rgb[3], const float weight)
|
||||
{
|
||||
float blend;
|
||||
|
||||
blend= ((input/2.0f)+0.5f);
|
||||
|
||||
if (input<=0.25f){ // blue->cyan
|
||||
*fr= 0.0f;
|
||||
*fg= blend*input*4.0f;
|
||||
*fb= blend;
|
||||
const float blend= ((weight/2.0f)+0.5f);
|
||||
|
||||
if (weight<=0.25f){ // blue->cyan
|
||||
r_rgb[0]= 0.0f;
|
||||
r_rgb[1]= blend*weight*4.0f;
|
||||
r_rgb[2]= blend;
|
||||
}
|
||||
else if (input<=0.50f){ // cyan->green
|
||||
*fr= 0.0f;
|
||||
*fg= blend;
|
||||
*fb= blend*(1.0f-((input-0.25f)*4.0f));
|
||||
else if (weight<=0.50f){ // cyan->green
|
||||
r_rgb[0]= 0.0f;
|
||||
r_rgb[1]= blend;
|
||||
r_rgb[2]= blend*(1.0f-((weight-0.25f)*4.0f));
|
||||
}
|
||||
else if (input <= 0.75f){ // green->yellow
|
||||
*fr= blend * ((input-0.50f)*4.0f);
|
||||
*fg= blend;
|
||||
*fb= 0.0f;
|
||||
else if (weight <= 0.75f){ // green->yellow
|
||||
r_rgb[0]= blend * ((weight-0.50f)*4.0f);
|
||||
r_rgb[1]= blend;
|
||||
r_rgb[2]= 0.0f;
|
||||
}
|
||||
else if (input <= 1.0f){ // yellow->red
|
||||
*fr= blend;
|
||||
*fg= blend * (1.0f-((input-0.75f)*4.0f));
|
||||
*fb= 0.0f;
|
||||
else if (weight <= 1.0f){ // yellow->red
|
||||
r_rgb[0]= blend;
|
||||
r_rgb[1]= blend * (1.0f-((weight-0.75f)*4.0f));
|
||||
r_rgb[2]= 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1866,7 +1864,7 @@ static void calc_weightpaint_vert_color(Object *ob, ColorBand *coba, int vert, u
|
||||
if(coba)
|
||||
do_colorband(coba, input, colf);
|
||||
else
|
||||
weight_to_rgb(input, colf, colf+1, colf+2);
|
||||
weight_to_rgb(colf, input);
|
||||
|
||||
col[3] = (unsigned char)(colf[0] * 255.0f);
|
||||
col[2] = (unsigned char)(colf[1] * 255.0f);
|
||||
@@ -2131,9 +2129,9 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
||||
DM_add_edge_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
|
||||
DM_add_face_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
|
||||
|
||||
range_vni(DM_get_vert_data_layer(dm, CD_ORIGINDEX), dm->numVertData, 0);
|
||||
range_vni(DM_get_edge_data_layer(dm, CD_ORIGINDEX), dm->numEdgeData, 0);
|
||||
range_vni(DM_get_face_data_layer(dm, CD_ORIGINDEX), dm->numFaceData, 0);
|
||||
range_vn_i(DM_get_vert_data_layer(dm, CD_ORIGINDEX), dm->numVertData, 0);
|
||||
range_vn_i(DM_get_edge_data_layer(dm, CD_ORIGINDEX), dm->numEdgeData, 0);
|
||||
range_vn_i(DM_get_face_data_layer(dm, CD_ORIGINDEX), dm->numFaceData, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -451,7 +451,7 @@ int blender_test_break(void)
|
||||
#define MAXUNDONAME 64
|
||||
typedef struct UndoElem {
|
||||
struct UndoElem *next, *prev;
|
||||
char str[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char str[FILE_MAX];
|
||||
char name[MAXUNDONAME];
|
||||
MemFile memfile;
|
||||
uintptr_t undosize;
|
||||
@@ -536,7 +536,7 @@ void BKE_write_undo(bContext *C, const char *name)
|
||||
/* disk save version */
|
||||
if(UNDO_DISK) {
|
||||
static int counter= 0;
|
||||
char filepath[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char filepath[FILE_MAX];
|
||||
char numstr[32];
|
||||
int fileflags = G.fileflags & ~(G_FILE_HISTORY); /* don't do file history on undo */
|
||||
|
||||
@@ -702,7 +702,7 @@ void BKE_undo_save_quit(void)
|
||||
UndoElem *uel;
|
||||
MemFileChunk *chunk;
|
||||
int file;
|
||||
char str[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char str[FILE_MAX];
|
||||
|
||||
if( (U.uiflag & USER_GLOBALUNDO)==0) return;
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step)
|
||||
ibuf->userdata = bmfont;
|
||||
ibuf->userflags |= IB_BITMAPFONT;
|
||||
|
||||
if (ibuf->depth < 32) {
|
||||
if (ibuf->planes < 32) {
|
||||
// we're going to fake alpha here:
|
||||
calcAlpha(ibuf);
|
||||
}
|
||||
|
||||
@@ -169,6 +169,7 @@ Curve *add_curve(const char *name, int type)
|
||||
cu->texflag= CU_AUTOSPACE;
|
||||
cu->smallcaps_scale= 0.75f;
|
||||
cu->twist_mode= CU_TWIST_MINIMUM; // XXX: this one seems to be the best one in most cases, at least for curve deform...
|
||||
cu->type= type;
|
||||
|
||||
cu->bb= unit_boundbox();
|
||||
|
||||
@@ -303,16 +304,23 @@ ListBase *curve_editnurbs(Curve *cu)
|
||||
short curve_type(Curve *cu)
|
||||
{
|
||||
Nurb *nu;
|
||||
int type= cu->type;
|
||||
|
||||
if(cu->vfont) {
|
||||
return OB_FONT;
|
||||
}
|
||||
for (nu= cu->nurb.first; nu; nu= nu->next) {
|
||||
if(nu->pntsv>1) {
|
||||
return OB_SURF;
|
||||
|
||||
if(!cu->type) {
|
||||
type= OB_CURVE;
|
||||
|
||||
for (nu= cu->nurb.first; nu; nu= nu->next) {
|
||||
if(nu->pntsv>1) {
|
||||
type= OB_SURF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return OB_CURVE;
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
void update_curve_dimension(Curve *cu)
|
||||
|
||||
@@ -818,7 +818,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
|
||||
/* 4: CD_MFACE */
|
||||
{sizeof(MFace), "MFace", 1, NULL, NULL, NULL, NULL, NULL, NULL},
|
||||
/* 5: CD_MTFACE */
|
||||
{sizeof(MTFace), "MTFace", 1, "UVTex", layerCopy_tface, NULL,
|
||||
{sizeof(MTFace), "MTFace", 1, "UVMap", layerCopy_tface, NULL,
|
||||
layerInterp_tface, layerSwap_tface, layerDefault_tface},
|
||||
/* 6: CD_MCOL */
|
||||
/* 4 MCol structs per face */
|
||||
@@ -838,7 +838,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
|
||||
/* 12: CD_PROP_STR */
|
||||
{sizeof(MStringProperty), "MStringProperty",1,"String",NULL,NULL,NULL,NULL},
|
||||
/* 13: CD_ORIGSPACE */
|
||||
{sizeof(OrigSpaceFace), "OrigSpaceFace", 1, "UVTex", layerCopy_origspace_face, NULL,
|
||||
{sizeof(OrigSpaceFace), "OrigSpaceFace", 1, "UVMap", layerCopy_origspace_face, NULL,
|
||||
layerInterp_origspace_face, layerSwap_origspace_face, layerDefault_origspace_face},
|
||||
/* 14: CD_ORCO */
|
||||
{sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
|
||||
|
||||
@@ -976,7 +976,7 @@ struct DynamicPaintSurface *dynamicPaint_createNewSurface(DynamicPaintCanvasSett
|
||||
surface->wave_timescale = 1.0f;
|
||||
surface->wave_spring = 0.20f;
|
||||
|
||||
modifier_path_init(surface->image_output_path, sizeof(surface->image_output_path), "dynamicpaint");
|
||||
modifier_path_init(surface->image_output_path, sizeof(surface->image_output_path), "cache_dynamicpaint");
|
||||
|
||||
dynamicPaintSurface_setUniqueName(surface, "Surface");
|
||||
|
||||
@@ -1307,7 +1307,7 @@ void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
|
||||
|
||||
if (!tex) return;
|
||||
|
||||
/* get uv layer */
|
||||
/* get uv map */
|
||||
CustomData_validate_layer_name(&dm->faceData, CD_MTFACE, surface->init_layername, uvname);
|
||||
tface = CustomData_get_layer_named(&dm->faceData, CD_MTFACE, uvname);
|
||||
if (!tface) return;
|
||||
@@ -1681,7 +1681,7 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
|
||||
for (; j<((mface[i].v4)?4:3); j++) {
|
||||
int index = (j==0)?mface[i].v1: (j==1)?mface[i].v2: (j==2)?mface[i].v3: mface[i].v4;
|
||||
|
||||
weight_to_rgb(weight[index], temp_color, temp_color+1, temp_color+2);
|
||||
weight_to_rgb(temp_color, weight[index]);
|
||||
col[i*4+j].r = FTOCHAR(temp_color[2]);
|
||||
col[i*4+j].g = FTOCHAR(temp_color[1]);
|
||||
col[i*4+j].b = FTOCHAR(temp_color[0]);
|
||||
@@ -2094,7 +2094,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
|
||||
numOfFaces = dm->getNumFaces(dm);
|
||||
mface = dm->getFaceArray(dm);
|
||||
|
||||
/* get uv layer */
|
||||
/* get uv map */
|
||||
CustomData_validate_layer_name(&dm->faceData, CD_MTFACE, surface->uvlayer_name, uvname);
|
||||
tface = CustomData_get_layer_named(&dm->faceData, CD_MTFACE, uvname);
|
||||
|
||||
@@ -2527,13 +2527,13 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char* filenam
|
||||
PaintSurfaceData *sData = surface->data;
|
||||
ImgSeqFormatData *f_data = (ImgSeqFormatData*)sData->format_data;
|
||||
/* OpenEXR or PNG */
|
||||
int format = (surface->image_fileformat & MOD_DPAINT_IMGFORMAT_OPENEXR) ? R_OPENEXR : R_PNG;
|
||||
int format = (surface->image_fileformat & MOD_DPAINT_IMGFORMAT_OPENEXR) ? R_IMF_IMTYPE_OPENEXR : R_IMF_IMTYPE_PNG;
|
||||
char output_file[FILE_MAX];
|
||||
|
||||
if (!sData || !sData->type_data) {setError(surface->canvas, "Image save failed: Invalid surface.");return;}
|
||||
/* if selected format is openexr, but current build doesnt support one */
|
||||
#ifndef WITH_OPENEXR
|
||||
if (format == R_OPENEXR) format = R_PNG;
|
||||
if (format == R_IMF_IMTYPE_OPENEXR) format = R_IMF_IMTYPE_PNG;
|
||||
#endif
|
||||
BLI_strncpy(output_file, filename, sizeof(output_file));
|
||||
BKE_add_image_extension(output_file, format);
|
||||
@@ -2622,7 +2622,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char* filenam
|
||||
/* Set output format, png in case exr isnt supported */
|
||||
ibuf->ftype= PNG|95;
|
||||
#ifdef WITH_OPENEXR
|
||||
if (format == R_OPENEXR) { /* OpenEXR 32-bit float */
|
||||
if (format == R_IMF_IMTYPE_OPENEXR) { /* OpenEXR 32-bit float */
|
||||
ibuf->ftype = OPENEXR | OPENEXR_COMPRESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -556,13 +556,13 @@ Image *BKE_add_image_size(unsigned int width, unsigned int height, const char *n
|
||||
if (ima) {
|
||||
ImBuf *ibuf;
|
||||
|
||||
BLI_strncpy(ima->name, name, FILE_MAX);
|
||||
/* BLI_strncpy(ima->name, name, FILE_MAX); */ /* dont do this, this writes in ain invalid filepath! */
|
||||
ima->gen_x= width;
|
||||
ima->gen_y= height;
|
||||
ima->gen_type= uvtestgrid;
|
||||
ima->gen_flag |= (floatbuf ? IMA_GEN_FLOAT : 0);
|
||||
|
||||
ibuf= add_ibuf_size(width, height, name, depth, floatbuf, uvtestgrid, color);
|
||||
ibuf= add_ibuf_size(width, height, ima->name, depth, floatbuf, uvtestgrid, color);
|
||||
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
|
||||
|
||||
ima->ok= IMA_OK_LOADED;
|
||||
@@ -601,7 +601,7 @@ void BKE_image_memorypack(Image *ima)
|
||||
}
|
||||
|
||||
ibuf->ftype= PNG;
|
||||
ibuf->depth= 32;
|
||||
ibuf->planes= R_IMF_PLANES_RGBA;
|
||||
|
||||
IMB_saveiff(ibuf, ibuf->name, IB_rect | IB_mem);
|
||||
if(ibuf->encodedbuffer==NULL) {
|
||||
@@ -800,175 +800,302 @@ void BKE_image_all_free_anim_ibufs(int cfra)
|
||||
|
||||
/* *********** READ AND WRITE ************** */
|
||||
|
||||
int BKE_imtype_to_ftype(int imtype)
|
||||
int BKE_imtype_to_ftype(const char imtype)
|
||||
{
|
||||
if(imtype==R_TARGA)
|
||||
if(imtype==R_IMF_IMTYPE_TARGA)
|
||||
return TGA;
|
||||
else if(imtype==R_RAWTGA)
|
||||
else if(imtype==R_IMF_IMTYPE_RAWTGA)
|
||||
return RAWTGA;
|
||||
else if(imtype== R_IRIS)
|
||||
else if(imtype== R_IMF_IMTYPE_IRIS)
|
||||
return IMAGIC;
|
||||
#ifdef WITH_HDR
|
||||
else if (imtype==R_RADHDR)
|
||||
else if (imtype==R_IMF_IMTYPE_RADHDR)
|
||||
return RADHDR;
|
||||
#endif
|
||||
else if (imtype==R_PNG)
|
||||
else if (imtype==R_IMF_IMTYPE_PNG)
|
||||
return PNG;
|
||||
#ifdef WITH_DDS
|
||||
else if (imtype==R_DDS)
|
||||
else if (imtype==R_IMF_IMTYPE_DDS)
|
||||
return DDS;
|
||||
#endif
|
||||
else if (imtype==R_BMP)
|
||||
else if (imtype==R_IMF_IMTYPE_BMP)
|
||||
return BMP;
|
||||
#ifdef WITH_TIFF
|
||||
else if (imtype==R_TIFF)
|
||||
else if (imtype==R_IMF_IMTYPE_TIFF)
|
||||
return TIF;
|
||||
#endif
|
||||
else if (imtype==R_OPENEXR || imtype==R_MULTILAYER)
|
||||
else if (imtype==R_IMF_IMTYPE_OPENEXR || imtype==R_IMF_IMTYPE_MULTILAYER)
|
||||
return OPENEXR;
|
||||
#ifdef WITH_CINEON
|
||||
else if (imtype==R_CINEON)
|
||||
else if (imtype==R_IMF_IMTYPE_CINEON)
|
||||
return CINEON;
|
||||
else if (imtype==R_DPX)
|
||||
else if (imtype==R_IMF_IMTYPE_DPX)
|
||||
return DPX;
|
||||
#endif
|
||||
#ifdef WITH_OPENJPEG
|
||||
else if(imtype==R_JP2)
|
||||
else if(imtype==R_IMF_IMTYPE_JP2)
|
||||
return JP2;
|
||||
#endif
|
||||
else
|
||||
return JPG|90;
|
||||
}
|
||||
|
||||
int BKE_ftype_to_imtype(int ftype)
|
||||
char BKE_ftype_to_imtype(const int ftype)
|
||||
{
|
||||
if(ftype==0)
|
||||
return TGA;
|
||||
return R_IMF_IMTYPE_TARGA;
|
||||
else if(ftype == IMAGIC)
|
||||
return R_IRIS;
|
||||
return R_IMF_IMTYPE_IRIS;
|
||||
#ifdef WITH_HDR
|
||||
else if (ftype & RADHDR)
|
||||
return R_RADHDR;
|
||||
return R_IMF_IMTYPE_RADHDR;
|
||||
#endif
|
||||
else if (ftype & PNG)
|
||||
return R_PNG;
|
||||
return R_IMF_IMTYPE_PNG;
|
||||
#ifdef WITH_DDS
|
||||
else if (ftype & DDS)
|
||||
return R_DDS;
|
||||
return R_IMF_IMTYPE_DDS;
|
||||
#endif
|
||||
else if (ftype & BMP)
|
||||
return R_BMP;
|
||||
return R_IMF_IMTYPE_BMP;
|
||||
#ifdef WITH_TIFF
|
||||
else if (ftype & TIF)
|
||||
return R_TIFF;
|
||||
return R_IMF_IMTYPE_TIFF;
|
||||
#endif
|
||||
else if (ftype & OPENEXR)
|
||||
return R_OPENEXR;
|
||||
return R_IMF_IMTYPE_OPENEXR;
|
||||
#ifdef WITH_CINEON
|
||||
else if (ftype & CINEON)
|
||||
return R_CINEON;
|
||||
return R_IMF_IMTYPE_CINEON;
|
||||
else if (ftype & DPX)
|
||||
return R_DPX;
|
||||
return R_IMF_IMTYPE_DPX;
|
||||
#endif
|
||||
else if (ftype & TGA)
|
||||
return R_TARGA;
|
||||
return R_IMF_IMTYPE_TARGA;
|
||||
else if(ftype & RAWTGA)
|
||||
return R_RAWTGA;
|
||||
return R_IMF_IMTYPE_RAWTGA;
|
||||
#ifdef WITH_OPENJPEG
|
||||
else if(ftype & JP2)
|
||||
return R_JP2;
|
||||
return R_IMF_IMTYPE_JP2;
|
||||
#endif
|
||||
else
|
||||
return R_JPEG90;
|
||||
return R_IMF_IMTYPE_JPEG90;
|
||||
}
|
||||
|
||||
|
||||
int BKE_imtype_is_movie(int imtype)
|
||||
int BKE_imtype_is_movie(const char imtype)
|
||||
{
|
||||
switch(imtype) {
|
||||
case R_AVIRAW:
|
||||
case R_AVIJPEG:
|
||||
case R_AVICODEC:
|
||||
case R_QUICKTIME:
|
||||
case R_FFMPEG:
|
||||
case R_H264:
|
||||
case R_THEORA:
|
||||
case R_XVID:
|
||||
case R_FRAMESERVER:
|
||||
case R_IMF_IMTYPE_AVIRAW:
|
||||
case R_IMF_IMTYPE_AVIJPEG:
|
||||
case R_IMF_IMTYPE_AVICODEC:
|
||||
case R_IMF_IMTYPE_QUICKTIME:
|
||||
case R_IMF_IMTYPE_FFMPEG:
|
||||
case R_IMF_IMTYPE_H264:
|
||||
case R_IMF_IMTYPE_THEORA:
|
||||
case R_IMF_IMTYPE_XVID:
|
||||
case R_IMF_IMTYPE_FRAMESERVER:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BKE_add_image_extension(char *string, int imtype)
|
||||
int BKE_imtype_supports_zbuf(const char imtype)
|
||||
{
|
||||
switch(imtype) {
|
||||
case R_IMF_IMTYPE_IRIZ:
|
||||
case R_IMF_IMTYPE_OPENEXR: /* but not R_IMF_IMTYPE_MULTILAYER */
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BKE_imtype_supports_compress(const char imtype)
|
||||
{
|
||||
switch(imtype) {
|
||||
case R_IMF_IMTYPE_PNG:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BKE_imtype_supports_quality(const char imtype)
|
||||
{
|
||||
switch(imtype) {
|
||||
case R_IMF_IMTYPE_JPEG90:
|
||||
case R_IMF_IMTYPE_JP2:
|
||||
case R_IMF_IMTYPE_AVIJPEG:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char BKE_imtype_valid_channels(const char imtype)
|
||||
{
|
||||
char chan_flag= IMA_CHAN_FLAG_RGB; /* assume all support rgb */
|
||||
|
||||
/* alpha */
|
||||
switch(imtype) {
|
||||
case R_IMF_IMTYPE_TARGA:
|
||||
case R_IMF_IMTYPE_IRIS:
|
||||
case R_IMF_IMTYPE_PNG:
|
||||
/* case R_IMF_IMTYPE_BMP: */ /* read but not write */
|
||||
case R_IMF_IMTYPE_RADHDR:
|
||||
case R_IMF_IMTYPE_TIFF:
|
||||
case R_IMF_IMTYPE_OPENEXR:
|
||||
case R_IMF_IMTYPE_MULTILAYER:
|
||||
case R_IMF_IMTYPE_DDS:
|
||||
case R_IMF_IMTYPE_JP2:
|
||||
chan_flag |= IMA_CHAN_FLAG_ALPHA;
|
||||
}
|
||||
|
||||
/* bw */
|
||||
switch(imtype) {
|
||||
case R_IMF_IMTYPE_PNG:
|
||||
case R_IMF_IMTYPE_JPEG90:
|
||||
case R_IMF_IMTYPE_TARGA:
|
||||
case R_IMF_IMTYPE_RAWTGA:
|
||||
case R_IMF_IMTYPE_TIFF:
|
||||
case R_IMF_IMTYPE_IRIS:
|
||||
chan_flag |= IMA_CHAN_FLAG_BW;
|
||||
}
|
||||
|
||||
return chan_flag;
|
||||
}
|
||||
|
||||
char BKE_imtype_valid_depths(const char imtype)
|
||||
{
|
||||
switch (imtype) {
|
||||
case R_IMF_IMTYPE_RADHDR:
|
||||
return R_IMF_CHAN_DEPTH_32;
|
||||
case R_IMF_IMTYPE_TIFF:
|
||||
return R_IMF_CHAN_DEPTH_8 | R_IMF_CHAN_DEPTH_16;
|
||||
case R_IMF_IMTYPE_OPENEXR:
|
||||
return R_IMF_CHAN_DEPTH_16 | R_IMF_CHAN_DEPTH_32;
|
||||
case R_IMF_IMTYPE_MULTILAYER:
|
||||
return R_IMF_CHAN_DEPTH_32;
|
||||
/* eeh, cineone does some strange 10bits per channel */
|
||||
case R_IMF_IMTYPE_DPX:
|
||||
case R_IMF_IMTYPE_CINEON:
|
||||
return R_IMF_CHAN_DEPTH_12;
|
||||
case R_IMF_IMTYPE_JP2:
|
||||
return R_IMF_CHAN_DEPTH_8 | R_IMF_CHAN_DEPTH_12 | R_IMF_CHAN_DEPTH_16;
|
||||
/* most formats are 8bit only */
|
||||
default:
|
||||
return R_IMF_CHAN_DEPTH_8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* string is from command line --render-format arg, keep in sync with
|
||||
* creator.c help info */
|
||||
char BKE_imtype_from_arg(const char *imtype_arg)
|
||||
{
|
||||
if (!strcmp(imtype_arg,"TGA")) return R_IMF_IMTYPE_TARGA;
|
||||
else if (!strcmp(imtype_arg,"IRIS")) return R_IMF_IMTYPE_IRIS;
|
||||
#ifdef WITH_DDS
|
||||
else if (!strcmp(imtype_arg,"DDS")) return R_IMF_IMTYPE_DDS;
|
||||
#endif
|
||||
else if (!strcmp(imtype_arg,"JPEG")) return R_IMF_IMTYPE_JPEG90;
|
||||
else if (!strcmp(imtype_arg,"IRIZ")) return R_IMF_IMTYPE_IRIZ;
|
||||
else if (!strcmp(imtype_arg,"RAWTGA")) return R_IMF_IMTYPE_RAWTGA;
|
||||
else if (!strcmp(imtype_arg,"AVIRAW")) return R_IMF_IMTYPE_AVIRAW;
|
||||
else if (!strcmp(imtype_arg,"AVIJPEG")) return R_IMF_IMTYPE_AVIJPEG;
|
||||
else if (!strcmp(imtype_arg,"PNG")) return R_IMF_IMTYPE_PNG;
|
||||
else if (!strcmp(imtype_arg,"AVICODEC")) return R_IMF_IMTYPE_AVICODEC;
|
||||
else if (!strcmp(imtype_arg,"QUICKTIME")) return R_IMF_IMTYPE_QUICKTIME;
|
||||
else if (!strcmp(imtype_arg,"BMP")) return R_IMF_IMTYPE_BMP;
|
||||
#ifdef WITH_HDR
|
||||
else if (!strcmp(imtype_arg,"HDR")) return R_IMF_IMTYPE_RADHDR;
|
||||
#endif
|
||||
#ifdef WITH_TIFF
|
||||
else if (!strcmp(imtype_arg,"TIFF")) return R_IMF_IMTYPE_TIFF;
|
||||
#endif
|
||||
#ifdef WITH_OPENEXR
|
||||
else if (!strcmp(imtype_arg,"EXR")) return R_IMF_IMTYPE_OPENEXR;
|
||||
else if (!strcmp(imtype_arg,"MULTILAYER")) return R_IMF_IMTYPE_MULTILAYER;
|
||||
#endif
|
||||
else if (!strcmp(imtype_arg,"MPEG")) return R_IMF_IMTYPE_FFMPEG;
|
||||
else if (!strcmp(imtype_arg,"FRAMESERVER")) return R_IMF_IMTYPE_FRAMESERVER;
|
||||
#ifdef WITH_CINEON
|
||||
else if (!strcmp(imtype_arg,"CINEON")) return R_IMF_IMTYPE_CINEON;
|
||||
else if (!strcmp(imtype_arg,"DPX")) return R_IMF_IMTYPE_DPX;
|
||||
#endif
|
||||
#ifdef WITH_OPENJPEG
|
||||
else if (!strcmp(imtype_arg,"JP2")) return R_IMF_IMTYPE_JP2;
|
||||
#endif
|
||||
else return R_IMF_IMTYPE_INVALID;
|
||||
}
|
||||
|
||||
int BKE_add_image_extension(char *string, const char imtype)
|
||||
{
|
||||
const char *extension= NULL;
|
||||
|
||||
if(imtype== R_IRIS) {
|
||||
if(imtype== R_IMF_IMTYPE_IRIS) {
|
||||
if(!BLI_testextensie(string, ".rgb"))
|
||||
extension= ".rgb";
|
||||
}
|
||||
else if(imtype==R_IRIZ) {
|
||||
else if(imtype==R_IMF_IMTYPE_IRIZ) {
|
||||
if(!BLI_testextensie(string, ".rgb"))
|
||||
extension= ".rgb";
|
||||
}
|
||||
#ifdef WITH_HDR
|
||||
else if(imtype==R_RADHDR) {
|
||||
else if(imtype==R_IMF_IMTYPE_RADHDR) {
|
||||
if(!BLI_testextensie(string, ".hdr"))
|
||||
extension= ".hdr";
|
||||
}
|
||||
#endif
|
||||
else if (ELEM5(imtype, R_PNG, R_FFMPEG, R_H264, R_THEORA, R_XVID)) {
|
||||
else if (ELEM5(imtype, R_IMF_IMTYPE_PNG, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_THEORA, R_IMF_IMTYPE_XVID)) {
|
||||
if(!BLI_testextensie(string, ".png"))
|
||||
extension= ".png";
|
||||
}
|
||||
#ifdef WITH_DDS
|
||||
else if(imtype==R_DDS) {
|
||||
else if(imtype==R_IMF_IMTYPE_DDS) {
|
||||
if(!BLI_testextensie(string, ".dds"))
|
||||
extension= ".dds";
|
||||
}
|
||||
#endif
|
||||
else if(imtype==R_RAWTGA) {
|
||||
else if(imtype==R_IMF_IMTYPE_RAWTGA) {
|
||||
if(!BLI_testextensie(string, ".tga"))
|
||||
extension= ".tga";
|
||||
}
|
||||
else if(imtype==R_BMP) {
|
||||
else if(imtype==R_IMF_IMTYPE_BMP) {
|
||||
if(!BLI_testextensie(string, ".bmp"))
|
||||
extension= ".bmp";
|
||||
}
|
||||
#ifdef WITH_TIFF
|
||||
else if(imtype==R_TIFF) {
|
||||
else if(imtype==R_IMF_IMTYPE_TIFF) {
|
||||
if(!BLI_testextensie(string, ".tif") &&
|
||||
!BLI_testextensie(string, ".tiff")) extension= ".tif";
|
||||
}
|
||||
#endif
|
||||
#ifdef WITH_OPENEXR
|
||||
else if( ELEM(imtype, R_OPENEXR, R_MULTILAYER)) {
|
||||
else if( ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
|
||||
if(!BLI_testextensie(string, ".exr"))
|
||||
extension= ".exr";
|
||||
}
|
||||
#endif
|
||||
#ifdef WITH_CINEON
|
||||
else if(imtype==R_CINEON){
|
||||
else if(imtype==R_IMF_IMTYPE_CINEON){
|
||||
if (!BLI_testextensie(string, ".cin"))
|
||||
extension= ".cin";
|
||||
}
|
||||
else if(imtype==R_DPX){
|
||||
else if(imtype==R_IMF_IMTYPE_DPX){
|
||||
if (!BLI_testextensie(string, ".dpx"))
|
||||
extension= ".dpx";
|
||||
}
|
||||
#endif
|
||||
else if(imtype==R_TARGA) {
|
||||
else if(imtype==R_IMF_IMTYPE_TARGA) {
|
||||
if(!BLI_testextensie(string, ".tga"))
|
||||
extension= ".tga";
|
||||
}
|
||||
#ifdef WITH_OPENJPEG
|
||||
else if(imtype==R_JP2) {
|
||||
else if(imtype==R_IMF_IMTYPE_JP2) {
|
||||
if(!BLI_testextensie(string, ".jp2"))
|
||||
extension= ".jp2";
|
||||
}
|
||||
#endif
|
||||
else { // R_AVICODEC, R_AVIRAW, R_AVIJPEG, R_JPEG90, R_QUICKTIME etc
|
||||
else { // R_IMF_IMTYPE_AVICODEC, R_IMF_IMTYPE_AVIRAW, R_IMF_IMTYPE_AVIJPEG, R_IMF_IMTYPE_JPEG90, R_IMF_IMTYPE_QUICKTIME etc
|
||||
if(!( BLI_testextensie(string, ".jpg") || BLI_testextensie(string, ".jpeg")))
|
||||
extension= ".jpg";
|
||||
}
|
||||
@@ -1371,98 +1498,102 @@ int BKE_alphatest_ibuf(ImBuf *ibuf)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
|
||||
/* note: imf->planes is ignored here, its assumed the image channels
|
||||
* are already set */
|
||||
int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
|
||||
{
|
||||
char imtype= imf->imtype;
|
||||
char compress= imf->compress;
|
||||
char quality= imf->quality;
|
||||
|
||||
int ok;
|
||||
(void)subimtype; /* quies unused warnings */
|
||||
|
||||
if(imtype == -1) {
|
||||
/* use whatever existing image type is set by 'ibuf' */
|
||||
}
|
||||
else if(imtype== R_IRIS) {
|
||||
else if(imtype== R_IMF_IMTYPE_IRIS) {
|
||||
ibuf->ftype= IMAGIC;
|
||||
}
|
||||
#ifdef WITH_HDR
|
||||
else if (imtype==R_RADHDR) {
|
||||
else if (imtype==R_IMF_IMTYPE_RADHDR) {
|
||||
ibuf->ftype= RADHDR;
|
||||
}
|
||||
#endif
|
||||
else if (ELEM5(imtype, R_PNG, R_FFMPEG, R_H264, R_THEORA, R_XVID)) {
|
||||
else if (ELEM5(imtype, R_IMF_IMTYPE_PNG, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_THEORA, R_IMF_IMTYPE_XVID)) {
|
||||
ibuf->ftype= PNG;
|
||||
|
||||
if(imtype==R_PNG)
|
||||
ibuf->ftype |= quality; /* quality is actually compression 0-100 --> 0-9 */
|
||||
if(imtype==R_IMF_IMTYPE_PNG)
|
||||
ibuf->ftype |= compress;
|
||||
|
||||
}
|
||||
#ifdef WITH_DDS
|
||||
else if (imtype==R_DDS) {
|
||||
else if (imtype==R_IMF_IMTYPE_DDS) {
|
||||
ibuf->ftype= DDS;
|
||||
}
|
||||
#endif
|
||||
else if (imtype==R_BMP) {
|
||||
else if (imtype==R_IMF_IMTYPE_BMP) {
|
||||
ibuf->ftype= BMP;
|
||||
}
|
||||
#ifdef WITH_TIFF
|
||||
else if (imtype==R_TIFF) {
|
||||
else if (imtype==R_IMF_IMTYPE_TIFF) {
|
||||
ibuf->ftype= TIF;
|
||||
|
||||
if(subimtype & R_TIFF_16BIT)
|
||||
if(imf->depth == R_IMF_CHAN_DEPTH_16)
|
||||
ibuf->ftype |= TIF_16BIT;
|
||||
}
|
||||
#endif
|
||||
#ifdef WITH_OPENEXR
|
||||
else if (imtype==R_OPENEXR || imtype==R_MULTILAYER) {
|
||||
else if (imtype==R_IMF_IMTYPE_OPENEXR || imtype==R_IMF_IMTYPE_MULTILAYER) {
|
||||
ibuf->ftype= OPENEXR;
|
||||
if(subimtype & R_OPENEXR_HALF)
|
||||
if(imf->depth == R_IMF_CHAN_DEPTH_16)
|
||||
ibuf->ftype |= OPENEXR_HALF;
|
||||
ibuf->ftype |= (quality & OPENEXR_COMPRESS);
|
||||
|
||||
if(!(subimtype & R_OPENEXR_ZBUF))
|
||||
if(!(imf->flag & R_IMF_FLAG_ZBUF))
|
||||
ibuf->zbuf_float = NULL; /* signal for exr saving */
|
||||
|
||||
}
|
||||
#endif
|
||||
#ifdef WITH_CINEON
|
||||
else if (imtype==R_CINEON) {
|
||||
else if (imtype==R_IMF_IMTYPE_CINEON) {
|
||||
ibuf->ftype = CINEON;
|
||||
}
|
||||
else if (imtype==R_DPX) {
|
||||
else if (imtype==R_IMF_IMTYPE_DPX) {
|
||||
ibuf->ftype = DPX;
|
||||
}
|
||||
#endif
|
||||
else if (imtype==R_TARGA) {
|
||||
else if (imtype==R_IMF_IMTYPE_TARGA) {
|
||||
ibuf->ftype= TGA;
|
||||
}
|
||||
else if(imtype==R_RAWTGA) {
|
||||
else if(imtype==R_IMF_IMTYPE_RAWTGA) {
|
||||
ibuf->ftype= RAWTGA;
|
||||
}
|
||||
#ifdef WITH_OPENJPEG
|
||||
else if(imtype==R_JP2) {
|
||||
else if(imtype==R_IMF_IMTYPE_JP2) {
|
||||
if(quality < 10) quality= 90;
|
||||
ibuf->ftype= JP2|quality;
|
||||
|
||||
if (subimtype & R_JPEG2K_16BIT) {
|
||||
if (imf->depth == R_IMF_CHAN_DEPTH_16) {
|
||||
ibuf->ftype |= JP2_16BIT;
|
||||
} else if (subimtype & R_JPEG2K_12BIT) {
|
||||
} else if (imf->depth == R_IMF_CHAN_DEPTH_12) {
|
||||
ibuf->ftype |= JP2_12BIT;
|
||||
}
|
||||
|
||||
if (subimtype & R_JPEG2K_YCC) {
|
||||
if (imf->jp2_flag & R_IMF_JP2_FLAG_YCC) {
|
||||
ibuf->ftype |= JP2_YCC;
|
||||
}
|
||||
|
||||
if (subimtype & R_JPEG2K_CINE_PRESET) {
|
||||
|
||||
if (imf->jp2_flag & R_IMF_JP2_FLAG_CINE_PRESET) {
|
||||
ibuf->ftype |= JP2_CINE;
|
||||
if (subimtype & R_JPEG2K_CINE_48FPS)
|
||||
if (imf->jp2_flag & R_IMF_JP2_FLAG_CINE_48)
|
||||
ibuf->ftype |= JP2_CINE_48FPS;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
/* R_JPEG90, etc. default we save jpegs */
|
||||
/* R_IMF_IMTYPE_JPEG90, etc. default we save jpegs */
|
||||
if(quality < 10) quality= 90;
|
||||
ibuf->ftype= JPG|quality;
|
||||
if(ibuf->depth==32) ibuf->depth= 24; /* unsupported feature only confuses other s/w */
|
||||
}
|
||||
|
||||
BLI_make_existing_file(name);
|
||||
@@ -1475,16 +1606,39 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int
|
||||
return(ok);
|
||||
}
|
||||
|
||||
int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
|
||||
/* same as BKE_write_ibuf_as but crappy workaround not to perminantly modify
|
||||
* _some_, values in the imbuf */
|
||||
int BKE_write_ibuf_as(ImBuf *ibuf, const char *name, ImageFormatData *imf,
|
||||
const short save_copy)
|
||||
{
|
||||
ImBuf ibuf_back= *ibuf;
|
||||
int ok;
|
||||
|
||||
/* all data is rgba anyway,
|
||||
* this just controls how to save for some formats */
|
||||
ibuf->planes= imf->planes;
|
||||
|
||||
ok= BKE_write_ibuf(ibuf, name, imf);
|
||||
|
||||
if (save_copy) {
|
||||
/* note that we are not restoring _all_ settings */
|
||||
ibuf->planes= ibuf_back.planes;
|
||||
ibuf->ftype= ibuf_back.ftype;
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, struct ImageFormatData *imf)
|
||||
{
|
||||
if(scene && scene->r.stamp & R_STAMP_ALL)
|
||||
BKE_stamp_info(scene, camera, ibuf);
|
||||
|
||||
return BKE_write_ibuf(ibuf, name, imtype, subimtype, quality);
|
||||
return BKE_write_ibuf(ibuf, name, imf);
|
||||
}
|
||||
|
||||
|
||||
void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, int imtype, const short use_ext, const short use_frames)
|
||||
void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, const char imtype, const short use_ext, const short use_frames)
|
||||
{
|
||||
if (string==NULL) return;
|
||||
BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */
|
||||
@@ -2414,13 +2568,13 @@ int BKE_image_has_alpha(struct Image *image)
|
||||
{
|
||||
ImBuf *ibuf;
|
||||
void *lock;
|
||||
int depth;
|
||||
int planes;
|
||||
|
||||
ibuf= BKE_image_acquire_ibuf(image, NULL, &lock);
|
||||
depth = (ibuf?ibuf->depth:0);
|
||||
planes = (ibuf?ibuf->planes:0);
|
||||
BKE_image_release_ibuf(image, lock);
|
||||
|
||||
if (depth == 32)
|
||||
if (planes == 32)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
@@ -1181,129 +1181,129 @@ int object_remove_material_slot(Object *ob)
|
||||
|
||||
/* r g b = current value, col = new value, fac==0 is no change */
|
||||
/* if g==NULL, it only does r channel */
|
||||
void ramp_blend(int type, float *r, float *g, float *b, float fac, const float col[3])
|
||||
void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
|
||||
{
|
||||
float tmp, facm= 1.0f-fac;
|
||||
|
||||
switch (type) {
|
||||
case MA_RAMP_BLEND:
|
||||
*r = facm*(*r) + fac*col[0];
|
||||
if(g) {
|
||||
*g = facm*(*g) + fac*col[1];
|
||||
*b = facm*(*b) + fac*col[2];
|
||||
r_col[0] = facm*(r_col[0]) + fac*col[0];
|
||||
if(r_col[1]) {
|
||||
r_col[1] = facm*(r_col[1]) + fac*col[1];
|
||||
r_col[2] = facm*(r_col[2]) + fac*col[2];
|
||||
}
|
||||
break;
|
||||
case MA_RAMP_ADD:
|
||||
*r += fac*col[0];
|
||||
if(g) {
|
||||
*g += fac*col[1];
|
||||
*b += fac*col[2];
|
||||
r_col[0] += fac*col[0];
|
||||
if(r_col[1]) {
|
||||
r_col[1] += fac*col[1];
|
||||
r_col[2] += fac*col[2];
|
||||
}
|
||||
break;
|
||||
case MA_RAMP_MULT:
|
||||
*r *= (facm + fac*col[0]);
|
||||
if(g) {
|
||||
*g *= (facm + fac*col[1]);
|
||||
*b *= (facm + fac*col[2]);
|
||||
r_col[0] *= (facm + fac*col[0]);
|
||||
if(r_col[1]) {
|
||||
r_col[1] *= (facm + fac*col[1]);
|
||||
r_col[2] *= (facm + fac*col[2]);
|
||||
}
|
||||
break;
|
||||
case MA_RAMP_SCREEN:
|
||||
*r = 1.0f - (facm + fac*(1.0f - col[0])) * (1.0f - *r);
|
||||
if(g) {
|
||||
*g = 1.0f - (facm + fac*(1.0f - col[1])) * (1.0f - *g);
|
||||
*b = 1.0f - (facm + fac*(1.0f - col[2])) * (1.0f - *b);
|
||||
r_col[0] = 1.0f - (facm + fac*(1.0f - col[0])) * (1.0f - r_col[0]);
|
||||
if(r_col[1]) {
|
||||
r_col[1] = 1.0f - (facm + fac*(1.0f - col[1])) * (1.0f - r_col[1]);
|
||||
r_col[2] = 1.0f - (facm + fac*(1.0f - col[2])) * (1.0f - r_col[2]);
|
||||
}
|
||||
break;
|
||||
case MA_RAMP_OVERLAY:
|
||||
if(*r < 0.5f)
|
||||
*r *= (facm + 2.0f*fac*col[0]);
|
||||
if(r_col[0] < 0.5f)
|
||||
r_col[0] *= (facm + 2.0f*fac*col[0]);
|
||||
else
|
||||
*r = 1.0f - (facm + 2.0f*fac*(1.0f - col[0])) * (1.0f - *r);
|
||||
if(g) {
|
||||
if(*g < 0.5f)
|
||||
*g *= (facm + 2.0f*fac*col[1]);
|
||||
r_col[0] = 1.0f - (facm + 2.0f*fac*(1.0f - col[0])) * (1.0f - r_col[0]);
|
||||
if(r_col[1]) {
|
||||
if(r_col[1] < 0.5f)
|
||||
r_col[1] *= (facm + 2.0f*fac*col[1]);
|
||||
else
|
||||
*g = 1.0f - (facm + 2.0f*fac*(1.0f - col[1])) * (1.0f - *g);
|
||||
if(*b < 0.5f)
|
||||
*b *= (facm + 2.0f*fac*col[2]);
|
||||
r_col[1] = 1.0f - (facm + 2.0f*fac*(1.0f - col[1])) * (1.0f - r_col[1]);
|
||||
if(r_col[2] < 0.5f)
|
||||
r_col[2] *= (facm + 2.0f*fac*col[2]);
|
||||
else
|
||||
*b = 1.0f - (facm + 2.0f*fac*(1.0f - col[2])) * (1.0f - *b);
|
||||
r_col[2] = 1.0f - (facm + 2.0f*fac*(1.0f - col[2])) * (1.0f - r_col[2]);
|
||||
}
|
||||
break;
|
||||
case MA_RAMP_SUB:
|
||||
*r -= fac*col[0];
|
||||
if(g) {
|
||||
*g -= fac*col[1];
|
||||
*b -= fac*col[2];
|
||||
r_col[0] -= fac*col[0];
|
||||
if(r_col[1]) {
|
||||
r_col[1] -= fac*col[1];
|
||||
r_col[2] -= fac*col[2];
|
||||
}
|
||||
break;
|
||||
case MA_RAMP_DIV:
|
||||
if(col[0]!=0.0f)
|
||||
*r = facm*(*r) + fac*(*r)/col[0];
|
||||
if(g) {
|
||||
r_col[0] = facm*(r_col[0]) + fac*(r_col[0])/col[0];
|
||||
if(r_col[1]) {
|
||||
if(col[1]!=0.0f)
|
||||
*g = facm*(*g) + fac*(*g)/col[1];
|
||||
r_col[1] = facm*(r_col[1]) + fac*(r_col[1])/col[1];
|
||||
if(col[2]!=0.0f)
|
||||
*b = facm*(*b) + fac*(*b)/col[2];
|
||||
r_col[2] = facm*(r_col[2]) + fac*(r_col[2])/col[2];
|
||||
}
|
||||
break;
|
||||
case MA_RAMP_DIFF:
|
||||
*r = facm*(*r) + fac*fabsf(*r-col[0]);
|
||||
if(g) {
|
||||
*g = facm*(*g) + fac*fabsf(*g-col[1]);
|
||||
*b = facm*(*b) + fac*fabsf(*b-col[2]);
|
||||
r_col[0] = facm*(r_col[0]) + fac*fabsf(r_col[0]-col[0]);
|
||||
if(r_col[1]) {
|
||||
r_col[1] = facm*(r_col[1]) + fac*fabsf(r_col[1]-col[1]);
|
||||
r_col[2] = facm*(r_col[2]) + fac*fabsf(r_col[2]-col[2]);
|
||||
}
|
||||
break;
|
||||
case MA_RAMP_DARK:
|
||||
tmp=col[0]+((1-col[0])*facm);
|
||||
if(tmp < *r) *r= tmp;
|
||||
if(g) {
|
||||
if(tmp < r_col[0]) r_col[0]= tmp;
|
||||
if(r_col[1]) {
|
||||
tmp=col[1]+((1-col[1])*facm);
|
||||
if(tmp < *g) *g= tmp;
|
||||
if(tmp < r_col[1]) r_col[1]= tmp;
|
||||
tmp=col[2]+((1-col[2])*facm);
|
||||
if(tmp < *b) *b= tmp;
|
||||
if(tmp < r_col[2]) r_col[2]= tmp;
|
||||
}
|
||||
break;
|
||||
case MA_RAMP_LIGHT:
|
||||
tmp= fac*col[0];
|
||||
if(tmp > *r) *r= tmp;
|
||||
if(g) {
|
||||
if(tmp > r_col[0]) r_col[0]= tmp;
|
||||
if(r_col[1]) {
|
||||
tmp= fac*col[1];
|
||||
if(tmp > *g) *g= tmp;
|
||||
if(tmp > r_col[1]) r_col[1]= tmp;
|
||||
tmp= fac*col[2];
|
||||
if(tmp > *b) *b= tmp;
|
||||
if(tmp > r_col[2]) r_col[2]= tmp;
|
||||
}
|
||||
break;
|
||||
case MA_RAMP_DODGE:
|
||||
|
||||
|
||||
if(*r !=0.0f){
|
||||
if(r_col[0] !=0.0f){
|
||||
tmp = 1.0f - fac*col[0];
|
||||
if(tmp <= 0.0f)
|
||||
*r = 1.0f;
|
||||
else if ((tmp = (*r) / tmp)> 1.0f)
|
||||
*r = 1.0f;
|
||||
r_col[0] = 1.0f;
|
||||
else if ((tmp = (r_col[0]) / tmp)> 1.0f)
|
||||
r_col[0] = 1.0f;
|
||||
else
|
||||
*r = tmp;
|
||||
r_col[0] = tmp;
|
||||
}
|
||||
if(g) {
|
||||
if(*g !=0.0f){
|
||||
if(r_col[1]) {
|
||||
if(r_col[1] !=0.0f){
|
||||
tmp = 1.0f - fac*col[1];
|
||||
if(tmp <= 0.0f )
|
||||
*g = 1.0f;
|
||||
else if ((tmp = (*g) / tmp) > 1.0f )
|
||||
*g = 1.0f;
|
||||
r_col[1] = 1.0f;
|
||||
else if ((tmp = (r_col[1]) / tmp) > 1.0f )
|
||||
r_col[1] = 1.0f;
|
||||
else
|
||||
*g = tmp;
|
||||
r_col[1] = tmp;
|
||||
}
|
||||
if(*b !=0.0f){
|
||||
if(r_col[2] !=0.0f){
|
||||
tmp = 1.0f - fac*col[2];
|
||||
if(tmp <= 0.0f)
|
||||
*b = 1.0f;
|
||||
else if ((tmp = (*b) / tmp) > 1.0f )
|
||||
*b = 1.0f;
|
||||
r_col[2] = 1.0f;
|
||||
else if ((tmp = (r_col[2]) / tmp) > 1.0f )
|
||||
r_col[2] = 1.0f;
|
||||
else
|
||||
*b = tmp;
|
||||
r_col[2] = tmp;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1313,114 +1313,114 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, const float c
|
||||
tmp = facm + fac*col[0];
|
||||
|
||||
if(tmp <= 0.0f)
|
||||
*r = 0.0f;
|
||||
else if (( tmp = (1.0f - (1.0f - (*r)) / tmp )) < 0.0f)
|
||||
*r = 0.0f;
|
||||
r_col[0] = 0.0f;
|
||||
else if (( tmp = (1.0f - (1.0f - (r_col[0])) / tmp )) < 0.0f)
|
||||
r_col[0] = 0.0f;
|
||||
else if (tmp > 1.0f)
|
||||
*r=1.0f;
|
||||
r_col[0]=1.0f;
|
||||
else
|
||||
*r = tmp;
|
||||
r_col[0] = tmp;
|
||||
|
||||
if(g) {
|
||||
if(r_col[1]) {
|
||||
tmp = facm + fac*col[1];
|
||||
if(tmp <= 0.0f)
|
||||
*g = 0.0f;
|
||||
else if (( tmp = (1.0f - (1.0f - (*g)) / tmp )) < 0.0f )
|
||||
*g = 0.0f;
|
||||
r_col[1] = 0.0f;
|
||||
else if (( tmp = (1.0f - (1.0f - (r_col[1])) / tmp )) < 0.0f )
|
||||
r_col[1] = 0.0f;
|
||||
else if(tmp >1.0f)
|
||||
*g=1.0f;
|
||||
r_col[1]=1.0f;
|
||||
else
|
||||
*g = tmp;
|
||||
r_col[1] = tmp;
|
||||
|
||||
tmp = facm + fac*col[2];
|
||||
if(tmp <= 0.0f)
|
||||
*b = 0.0f;
|
||||
else if (( tmp = (1.0f - (1.0f - (*b)) / tmp )) < 0.0f )
|
||||
*b = 0.0f;
|
||||
r_col[2] = 0.0f;
|
||||
else if (( tmp = (1.0f - (1.0f - (r_col[2])) / tmp )) < 0.0f )
|
||||
r_col[2] = 0.0f;
|
||||
else if(tmp >1.0f)
|
||||
*b= 1.0f;
|
||||
r_col[2]= 1.0f;
|
||||
else
|
||||
*b = tmp;
|
||||
r_col[2] = tmp;
|
||||
}
|
||||
break;
|
||||
case MA_RAMP_HUE:
|
||||
if(g){
|
||||
if(r_col[1]){
|
||||
float rH,rS,rV;
|
||||
float colH,colS,colV;
|
||||
float tmpr,tmpg,tmpb;
|
||||
rgb_to_hsv(col[0],col[1],col[2],&colH,&colS,&colV);
|
||||
if(colS!=0 ){
|
||||
rgb_to_hsv(*r,*g,*b,&rH,&rS,&rV);
|
||||
rgb_to_hsv(r_col[0],r_col[1],r_col[2],&rH,&rS,&rV);
|
||||
hsv_to_rgb( colH , rS, rV, &tmpr, &tmpg, &tmpb);
|
||||
*r = facm*(*r) + fac*tmpr;
|
||||
*g = facm*(*g) + fac*tmpg;
|
||||
*b = facm*(*b) + fac*tmpb;
|
||||
r_col[0] = facm*(r_col[0]) + fac*tmpr;
|
||||
r_col[1] = facm*(r_col[1]) + fac*tmpg;
|
||||
r_col[2] = facm*(r_col[2]) + fac*tmpb;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MA_RAMP_SAT:
|
||||
if(g){
|
||||
if(r_col[1]){
|
||||
float rH,rS,rV;
|
||||
float colH,colS,colV;
|
||||
rgb_to_hsv(*r,*g,*b,&rH,&rS,&rV);
|
||||
rgb_to_hsv(r_col[0],r_col[1],r_col[2],&rH,&rS,&rV);
|
||||
if(rS!=0){
|
||||
rgb_to_hsv(col[0],col[1],col[2],&colH,&colS,&colV);
|
||||
hsv_to_rgb( rH, (facm*rS +fac*colS), rV, r, g, b);
|
||||
hsv_to_rgb( rH, (facm*rS +fac*colS), rV, r_col+0, r_col+1, r_col+2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MA_RAMP_VAL:
|
||||
if(g){
|
||||
if(r_col[1]){
|
||||
float rH,rS,rV;
|
||||
float colH,colS,colV;
|
||||
rgb_to_hsv(*r,*g,*b,&rH,&rS,&rV);
|
||||
rgb_to_hsv(r_col[0],r_col[1],r_col[2],&rH,&rS,&rV);
|
||||
rgb_to_hsv(col[0],col[1],col[2],&colH,&colS,&colV);
|
||||
hsv_to_rgb( rH, rS, (facm*rV +fac*colV), r, g, b);
|
||||
hsv_to_rgb( rH, rS, (facm*rV +fac*colV), r_col+0, r_col+1, r_col+2);
|
||||
}
|
||||
break;
|
||||
case MA_RAMP_COLOR:
|
||||
if(g){
|
||||
if(r_col[1]){
|
||||
float rH,rS,rV;
|
||||
float colH,colS,colV;
|
||||
float tmpr,tmpg,tmpb;
|
||||
rgb_to_hsv(col[0],col[1],col[2],&colH,&colS,&colV);
|
||||
if(colS!=0){
|
||||
rgb_to_hsv(*r,*g,*b,&rH,&rS,&rV);
|
||||
rgb_to_hsv(r_col[0],r_col[1],r_col[2],&rH,&rS,&rV);
|
||||
hsv_to_rgb( colH, colS, rV, &tmpr, &tmpg, &tmpb);
|
||||
*r = facm*(*r) + fac*tmpr;
|
||||
*g = facm*(*g) + fac*tmpg;
|
||||
*b = facm*(*b) + fac*tmpb;
|
||||
r_col[0] = facm*(r_col[0]) + fac*tmpr;
|
||||
r_col[1] = facm*(r_col[1]) + fac*tmpg;
|
||||
r_col[2] = facm*(r_col[2]) + fac*tmpb;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MA_RAMP_SOFT:
|
||||
if (g){
|
||||
if (r_col[1]){
|
||||
float scr, scg, scb;
|
||||
|
||||
/* first calculate non-fac based Screen mix */
|
||||
scr = 1.0f - (1.0f - col[0]) * (1.0f - *r);
|
||||
scg = 1.0f - (1.0f - col[1]) * (1.0f - *g);
|
||||
scb = 1.0f - (1.0f - col[2]) * (1.0f - *b);
|
||||
scr = 1.0f - (1.0f - col[0]) * (1.0f - r_col[0]);
|
||||
scg = 1.0f - (1.0f - col[1]) * (1.0f - r_col[1]);
|
||||
scb = 1.0f - (1.0f - col[2]) * (1.0f - r_col[2]);
|
||||
|
||||
*r = facm*(*r) + fac*(((1.0f - *r) * col[0] * (*r)) + (*r * scr));
|
||||
*g = facm*(*g) + fac*(((1.0f - *g) * col[1] * (*g)) + (*g * scg));
|
||||
*b = facm*(*b) + fac*(((1.0f - *b) * col[2] * (*b)) + (*b * scb));
|
||||
r_col[0] = facm*(r_col[0]) + fac*(((1.0f - r_col[0]) * col[0] * (r_col[0])) + (r_col[0] * scr));
|
||||
r_col[1] = facm*(r_col[1]) + fac*(((1.0f - r_col[1]) * col[1] * (r_col[1])) + (r_col[1] * scg));
|
||||
r_col[2] = facm*(r_col[2]) + fac*(((1.0f - r_col[2]) * col[2] * (r_col[2])) + (r_col[2] * scb));
|
||||
}
|
||||
break;
|
||||
case MA_RAMP_LINEAR:
|
||||
if (col[0] > 0.5f)
|
||||
*r = *r + fac*(2.0f*(col[0]-0.5f));
|
||||
r_col[0] = r_col[0] + fac*(2.0f*(col[0]-0.5f));
|
||||
else
|
||||
*r = *r + fac*(2.0f*(col[0]) - 1.0f);
|
||||
if (g){
|
||||
r_col[0] = r_col[0] + fac*(2.0f*(col[0]) - 1.0f);
|
||||
if (r_col[1]){
|
||||
if (col[1] > 0.5f)
|
||||
*g = *g + fac*(2.0f*(col[1]-0.5f));
|
||||
r_col[1] = r_col[1] + fac*(2.0f*(col[1]-0.5f));
|
||||
else
|
||||
*g = *g + fac*(2.0f*(col[1]) -1.0f);
|
||||
r_col[1] = r_col[1] + fac*(2.0f*(col[1]) -1.0f);
|
||||
if (col[2] > 0.5f)
|
||||
*b = *b + fac*(2.0f*(col[2]-0.5f));
|
||||
r_col[2] = r_col[2] + fac*(2.0f*(col[2]-0.5f));
|
||||
else
|
||||
*b = *b + fac*(2.0f*(col[2]) - 1.0f);
|
||||
r_col[2] = r_col[2] + fac*(2.0f*(col[2]) - 1.0f);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -895,7 +895,7 @@ void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClip
|
||||
|
||||
static void movieclip_build_proxy_ibuf(MovieClip *clip, ImBuf *ibuf, int cfra, int proxy_render_size, int undistorted)
|
||||
{
|
||||
char name[FILE_MAXFILE+FILE_MAXDIR];
|
||||
char name[FILE_MAX];
|
||||
int quality, rectx, recty;
|
||||
int size= size= rendersize_to_number(proxy_render_size);
|
||||
ImBuf *scaleibuf;
|
||||
@@ -913,8 +913,8 @@ static void movieclip_build_proxy_ibuf(MovieClip *clip, ImBuf *ibuf, int cfra, i
|
||||
scaleibuf->ftype= JPG | quality;
|
||||
|
||||
/* unsupported feature only confuses other s/w */
|
||||
if(scaleibuf->depth==32)
|
||||
scaleibuf->depth= 24;
|
||||
if(scaleibuf->planes==32)
|
||||
scaleibuf->planes= 24;
|
||||
|
||||
BLI_lock_thread(LOCK_MOVIECLIP);
|
||||
|
||||
|
||||
@@ -1795,6 +1795,7 @@ static void give_parvert(Object *par, int nr, float *vec)
|
||||
dm->getVertCo(dm, 0, vec);
|
||||
}
|
||||
}
|
||||
else fprintf(stderr, "%s: DerivedMesh is needed to solve parenting, object position can be wrong now\n", __func__);
|
||||
|
||||
if(em)
|
||||
BKE_mesh_end_editmesh(me, em);
|
||||
|
||||
@@ -313,8 +313,8 @@ void BKE_ocean_eval_uv(struct Ocean *oc, struct OceanResult *ocr, float u,float
|
||||
float uu,vv;
|
||||
|
||||
// first wrap the texture so 0 <= (u,v) < 1
|
||||
u = fmod(u,1.0f);
|
||||
v = fmod(v,1.0f);
|
||||
u = fmodf(u,1.0f);
|
||||
v = fmodf(v,1.0f);
|
||||
|
||||
if (u < 0) u += 1.0f;
|
||||
if (v < 0) v += 1.0f;
|
||||
@@ -1018,7 +1018,23 @@ static void cache_filename(char *string, const char *path, const char *relbase,
|
||||
|
||||
BLI_join_dirfile(cachepath, sizeof(cachepath), path, fname);
|
||||
|
||||
BKE_makepicstring(string, cachepath, relbase, frame, R_OPENEXR, 1, TRUE);
|
||||
BKE_makepicstring(string, cachepath, relbase, frame, R_IMF_IMTYPE_OPENEXR, 1, TRUE);
|
||||
}
|
||||
|
||||
/* silly functions but useful to inline when the args do a lot of indirections */
|
||||
MINLINE void rgb_to_rgba_unit_alpha(float r_rgba[4], const float rgb[3])
|
||||
{
|
||||
r_rgba[0]= rgb[0];
|
||||
r_rgba[1]= rgb[1];
|
||||
r_rgba[2]= rgb[2];
|
||||
r_rgba[3]= 1.0f;
|
||||
}
|
||||
MINLINE void value_to_rgba_unit_alpha(float r_rgba[4], const float value)
|
||||
{
|
||||
r_rgba[0]= value;
|
||||
r_rgba[1]= value;
|
||||
r_rgba[2]= value;
|
||||
r_rgba[3]= 1.0f;
|
||||
}
|
||||
|
||||
void BKE_free_ocean_cache(struct OceanCache *och)
|
||||
@@ -1076,9 +1092,7 @@ void BKE_ocean_cache_eval_uv(struct OceanCache *och, struct OceanResult *ocr, in
|
||||
|
||||
if (och->ibufs_disp[f]) {
|
||||
ibuf_sample(och->ibufs_disp[f], u, v, (1.0f/(float)res_x), (1.0f/(float)res_y), result);
|
||||
ocr->disp[0] = result[0];
|
||||
ocr->disp[1] = result[1];
|
||||
ocr->disp[2] = result[2];
|
||||
copy_v3_v3(ocr->disp, result);
|
||||
}
|
||||
|
||||
if (och->ibufs_foam[f]) {
|
||||
@@ -1088,34 +1102,31 @@ void BKE_ocean_cache_eval_uv(struct OceanCache *och, struct OceanResult *ocr, in
|
||||
|
||||
if (och->ibufs_norm[f]) {
|
||||
ibuf_sample(och->ibufs_norm[f], u, v, (1.0f/(float)res_x), (1.0f/(float)res_y), result);
|
||||
ocr->normal[0] = result[0];
|
||||
ocr->normal[1] = result[1];
|
||||
ocr->normal[2] = result[2];
|
||||
copy_v3_v3(ocr->normal, result);
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_ocean_cache_eval_ij(struct OceanCache *och, struct OceanResult *ocr, int f, int i, int j)
|
||||
{
|
||||
int res_x = och->resolution_x;
|
||||
int res_y = och->resolution_y;
|
||||
const int res_x = och->resolution_x;
|
||||
const int res_y = och->resolution_y;
|
||||
|
||||
i = abs(i) % res_x;
|
||||
j = abs(j) % res_y;
|
||||
if (i < 0) i= -i;
|
||||
if (j < 0) j= -j;
|
||||
|
||||
i = i % res_x;
|
||||
j = j % res_y;
|
||||
|
||||
if (och->ibufs_disp[f]) {
|
||||
ocr->disp[0] = och->ibufs_disp[f]->rect_float[4*(res_x*j + i) + 0];
|
||||
ocr->disp[1] = och->ibufs_disp[f]->rect_float[4*(res_x*j + i) + 1];
|
||||
ocr->disp[2] = och->ibufs_disp[f]->rect_float[4*(res_x*j + i) + 2];
|
||||
copy_v3_v3(ocr->disp, &och->ibufs_disp[f]->rect_float[4*(res_x*j + i)]);
|
||||
}
|
||||
|
||||
if (och->ibufs_foam[f]) {
|
||||
ocr->foam = och->ibufs_foam[f]->rect_float[4*(res_x*j + i) + 0];
|
||||
ocr->foam = och->ibufs_foam[f]->rect_float[4*(res_x*j + i)];
|
||||
}
|
||||
|
||||
if (och->ibufs_norm[f]) {
|
||||
ocr->normal[0] = och->ibufs_norm[f]->rect_float[4*(res_x*j + i) + 0];
|
||||
ocr->normal[1] = och->ibufs_norm[f]->rect_float[4*(res_x*j + i) + 1];
|
||||
ocr->normal[2] = och->ibufs_norm[f]->rect_float[4*(res_x*j + i) + 2];
|
||||
copy_v3_v3(ocr->normal, &och->ibufs_norm[f]->rect_float[4*(res_x*j + i)]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1185,6 +1196,8 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
|
||||
* before use - campbell */
|
||||
OceanResult ocr;
|
||||
|
||||
ImageFormatData imf= {0};
|
||||
|
||||
int f, i=0, x, y, cancel=0;
|
||||
float progress;
|
||||
|
||||
@@ -1201,6 +1214,11 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
|
||||
|
||||
BLI_srand(0);
|
||||
|
||||
/* setup image format */
|
||||
imf.imtype= R_IMF_IMTYPE_OPENEXR;
|
||||
imf.depth= R_IMF_CHAN_DEPTH_16;
|
||||
imf.exr_codec= R_IMF_EXR_CODEC_ZIP;
|
||||
|
||||
for (f=och->start, i=0; f<=och->end; f++, i++) {
|
||||
|
||||
/* create a new imbuf to store image for this frame */
|
||||
@@ -1219,10 +1237,7 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
|
||||
BKE_ocean_eval_ij(o, &ocr, x, y);
|
||||
|
||||
/* add to the image */
|
||||
ibuf_disp->rect_float[4*(res_x*y + x) + 0] = ocr.disp[0];
|
||||
ibuf_disp->rect_float[4*(res_x*y + x) + 1] = ocr.disp[1];
|
||||
ibuf_disp->rect_float[4*(res_x*y + x) + 2] = ocr.disp[2];
|
||||
ibuf_disp->rect_float[4*(res_x*y + x) + 3] = 1.0f;
|
||||
rgb_to_rgba_unit_alpha(&ibuf_disp->rect_float[4*(res_x*y + x)], ocr.disp);
|
||||
|
||||
if (o->_do_jacobian) {
|
||||
/* TODO, cleanup unused code - campbell */
|
||||
@@ -1275,35 +1290,29 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
|
||||
|
||||
prev_foam[res_x*y + x] = foam_result;
|
||||
|
||||
ibuf_foam->rect_float[4*(res_x*y + x) + 0] = foam_result;
|
||||
ibuf_foam->rect_float[4*(res_x*y + x) + 1] = foam_result;
|
||||
ibuf_foam->rect_float[4*(res_x*y + x) + 2] = foam_result;
|
||||
ibuf_foam->rect_float[4*(res_x*y + x) + 3] = 1.0;
|
||||
value_to_rgba_unit_alpha(&ibuf_foam->rect_float[4*(res_x*y + x)], foam_result);
|
||||
}
|
||||
|
||||
if (o->_do_normals) {
|
||||
ibuf_normal->rect_float[4*(res_x*y + x) + 0] = ocr.normal[0];
|
||||
ibuf_normal->rect_float[4*(res_x*y + x) + 1] = ocr.normal[1];
|
||||
ibuf_normal->rect_float[4*(res_x*y + x) + 2] = ocr.normal[2];
|
||||
ibuf_normal->rect_float[4*(res_x*y + x) + 3] = 1.0;
|
||||
rgb_to_rgba_unit_alpha(&ibuf_normal->rect_float[4*(res_x*y + x)], ocr.normal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* write the images */
|
||||
cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_DISPLACE);
|
||||
if(0 == BKE_write_ibuf(ibuf_disp, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec
|
||||
if(0 == BKE_write_ibuf(ibuf_disp, string, &imf))
|
||||
printf("Cannot save Displacement File Output to %s\n", string);
|
||||
|
||||
if (o->_do_jacobian) {
|
||||
cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_FOAM);
|
||||
if(0 == BKE_write_ibuf(ibuf_foam, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec
|
||||
if(0 == BKE_write_ibuf(ibuf_foam, string, &imf))
|
||||
printf("Cannot save Foam File Output to %s\n", string);
|
||||
}
|
||||
|
||||
if (o->_do_normals) {
|
||||
cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_NORMAL);
|
||||
if(0 == BKE_write_ibuf(ibuf_normal, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec
|
||||
if(0 == BKE_write_ibuf(ibuf_normal, string, &imf))
|
||||
printf("Cannot save Normal File Output to %s\n", string);
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char
|
||||
{
|
||||
PackedFile *pf = NULL;
|
||||
int file, filelen;
|
||||
char name[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char name[FILE_MAX];
|
||||
void *data;
|
||||
|
||||
/* render result has no filename and can be ignored
|
||||
@@ -245,7 +245,7 @@ void packAll(Main *bmain, ReportList *reports)
|
||||
|
||||
static char *find_new_name(char *name)
|
||||
{
|
||||
char tempname[FILE_MAXDIR + FILE_MAXFILE];
|
||||
char tempname[FILE_MAX];
|
||||
char *newname;
|
||||
size_t len;
|
||||
|
||||
@@ -268,8 +268,8 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i
|
||||
{
|
||||
int file, number, remove_tmp = FALSE;
|
||||
int ret_value = RET_OK;
|
||||
char name[FILE_MAXDIR + FILE_MAXFILE];
|
||||
char tempname[FILE_MAXDIR + FILE_MAXFILE];
|
||||
char name[FILE_MAX];
|
||||
char tempname[FILE_MAX];
|
||||
/* void *data; */
|
||||
|
||||
if (guimode) {} //XXX waitcursor(1);
|
||||
@@ -337,7 +337,7 @@ int checkPackedFile(const char *filename, PackedFile *pf)
|
||||
struct stat st;
|
||||
int ret_val, i, len, file;
|
||||
char buf[4096];
|
||||
char name[FILE_MAXDIR + FILE_MAXFILE];
|
||||
char name[FILE_MAX];
|
||||
|
||||
BLI_strncpy(name, filename, sizeof(name));
|
||||
BLI_path_abs(name, G.main->name);
|
||||
@@ -394,8 +394,8 @@ char *unpackFile(ReportList *reports, const char *abs_name, const char *local_na
|
||||
char *newname = NULL;
|
||||
const char *temp = NULL;
|
||||
|
||||
// char newabs[FILE_MAXDIR + FILE_MAXFILE];
|
||||
// char newlocal[FILE_MAXDIR + FILE_MAXFILE];
|
||||
// char newabs[FILE_MAX];
|
||||
// char newlocal[FILE_MAX];
|
||||
|
||||
if (pf != NULL) {
|
||||
switch (how) {
|
||||
@@ -445,7 +445,7 @@ char *unpackFile(ReportList *reports, const char *abs_name, const char *local_na
|
||||
|
||||
int unpackVFont(ReportList *reports, VFont *vfont, int how)
|
||||
{
|
||||
char localname[FILE_MAXDIR + FILE_MAXFILE], fi[FILE_MAXFILE];
|
||||
char localname[FILE_MAX], fi[FILE_MAXFILE];
|
||||
char *newname;
|
||||
int ret_value = RET_ERROR;
|
||||
|
||||
|
||||
@@ -3170,13 +3170,13 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
|
||||
float t2;
|
||||
|
||||
if(k==0) {
|
||||
weight_to_rgb(pind.hkey[1]->weight, ca->col, ca->col+1, ca->col+2);
|
||||
weight_to_rgb(ca->col, pind.hkey[1]->weight);
|
||||
} else {
|
||||
float w1[3], w2[3];
|
||||
keytime = (t - (*pind.ekey[0]->time))/((*pind.ekey[1]->time) - (*pind.ekey[0]->time));
|
||||
|
||||
weight_to_rgb(pind.hkey[0]->weight, w1, w1+1, w1+2);
|
||||
weight_to_rgb(pind.hkey[1]->weight, w2, w2+1, w2+2);
|
||||
weight_to_rgb(w1, pind.hkey[0]->weight);
|
||||
weight_to_rgb(w2, pind.hkey[1]->weight);
|
||||
|
||||
interp_v3_v3v3(ca->col, w1, w2, keytime);
|
||||
}
|
||||
|
||||
@@ -770,6 +770,9 @@ void BKE_ptcache_id_from_softbody(PTCacheID *pid, Object *ob, SoftBody *sb)
|
||||
pid->info_types= 0;
|
||||
|
||||
pid->stack_index = pid->cache->index;
|
||||
|
||||
pid->default_step = 10;
|
||||
pid->max_step = 20;
|
||||
}
|
||||
void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *psys)
|
||||
{
|
||||
@@ -820,6 +823,9 @@ void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *p
|
||||
pid->data_types|= (1<<BPHYS_DATA_ROTATION);
|
||||
|
||||
pid->info_types= (1<<BPHYS_DATA_TIMES);
|
||||
|
||||
pid->default_step = 10;
|
||||
pid->max_step = 20;
|
||||
}
|
||||
void BKE_ptcache_id_from_cloth(PTCacheID *pid, Object *ob, ClothModifierData *clmd)
|
||||
{
|
||||
@@ -850,6 +856,9 @@ void BKE_ptcache_id_from_cloth(PTCacheID *pid, Object *ob, ClothModifierData *cl
|
||||
|
||||
pid->data_types= (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_VELOCITY) | (1<<BPHYS_DATA_XCONST);
|
||||
pid->info_types= 0;
|
||||
|
||||
pid->default_step = 1;
|
||||
pid->max_step = 1;
|
||||
}
|
||||
void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeModifierData *smd)
|
||||
{
|
||||
@@ -890,6 +899,9 @@ void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeMo
|
||||
pid->data_types |= (1<<BPHYS_DATA_SMOKE_LOW);
|
||||
if(sds->wt)
|
||||
pid->data_types |= (1<<BPHYS_DATA_SMOKE_HIGH);
|
||||
|
||||
pid->default_step = 1;
|
||||
pid->max_step = 1;
|
||||
}
|
||||
|
||||
void BKE_ptcache_id_from_dynamicpaint(PTCacheID *pid, Object *ob, DynamicPaintSurface *surface)
|
||||
@@ -923,6 +935,9 @@ void BKE_ptcache_id_from_dynamicpaint(PTCacheID *pid, Object *ob, DynamicPaintSu
|
||||
pid->info_types= 0;
|
||||
|
||||
pid->stack_index = pid->cache->index;
|
||||
|
||||
pid->default_step = 1;
|
||||
pid->max_step = 1;
|
||||
}
|
||||
|
||||
void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int duplis)
|
||||
@@ -1018,7 +1033,7 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
|
||||
*/
|
||||
|
||||
#define MAX_PTCACHE_PATH FILE_MAX
|
||||
#define MAX_PTCACHE_FILE ((FILE_MAXDIR+FILE_MAXFILE)*2)
|
||||
#define MAX_PTCACHE_FILE ((FILE_MAX)*2)
|
||||
|
||||
static int ptcache_path(PTCacheID *pid, char *filename)
|
||||
{
|
||||
@@ -1112,7 +1127,7 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra)
|
||||
{
|
||||
PTCacheFile *pf;
|
||||
FILE *fp = NULL;
|
||||
char filename[(FILE_MAXDIR+FILE_MAXFILE)*2];
|
||||
char filename[(FILE_MAX)*2];
|
||||
|
||||
#ifndef DURIAN_POINTCACHE_LIB_OK
|
||||
/* don't allow writing for linked objects */
|
||||
|
||||
@@ -354,9 +354,11 @@ Scene *add_scene(const char *name)
|
||||
sce->r.mblur_samples= 1;
|
||||
sce->r.filtertype= R_FILTER_MITCH;
|
||||
sce->r.size= 50;
|
||||
sce->r.planes= 24;
|
||||
sce->r.imtype= R_PNG;
|
||||
sce->r.quality= 90;
|
||||
|
||||
sce->r.im_format.planes= R_IMF_PLANES_RGB;
|
||||
sce->r.im_format.imtype= R_IMF_IMTYPE_PNG;
|
||||
sce->r.im_format.quality= 90;
|
||||
|
||||
sce->r.displaymode= R_OUTPUT_AREA;
|
||||
sce->r.framapto= 100;
|
||||
sce->r.images= 100;
|
||||
|
||||
@@ -652,7 +652,7 @@ void calc_sequence(Scene *scene, Sequence *seq)
|
||||
/* note: caller should run calc_sequence(scene, seq) after */
|
||||
void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
|
||||
{
|
||||
char str[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char str[FILE_MAX];
|
||||
int prev_startdisp=0, prev_enddisp=0;
|
||||
/* note: dont rename the strip, will break animation curves */
|
||||
|
||||
@@ -1156,7 +1156,7 @@ static IMB_Proxy_Size seq_rendersize_to_proxysize(int size)
|
||||
|
||||
static void seq_open_anim_file(Sequence * seq)
|
||||
{
|
||||
char name[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char name[FILE_MAX];
|
||||
StripProxy * proxy;
|
||||
|
||||
if(seq->anim != NULL) {
|
||||
@@ -1327,8 +1327,8 @@ static void seq_proxy_build_frame(SeqRenderData context,
|
||||
ibuf->ftype= JPG | quality;
|
||||
|
||||
/* unsupported feature only confuses other s/w */
|
||||
if(ibuf->depth==32)
|
||||
ibuf->depth= 24;
|
||||
if(ibuf->planes==32)
|
||||
ibuf->planes= 24;
|
||||
|
||||
BLI_make_existing_file(name);
|
||||
|
||||
@@ -1729,7 +1729,7 @@ static ImBuf * input_preprocess(
|
||||
}
|
||||
|
||||
if(seq->flag & SEQ_MAKE_PREMUL) {
|
||||
if(ibuf->depth == 32 && ibuf->zbuf == NULL) {
|
||||
if(ibuf->planes == 32 && ibuf->zbuf == NULL) {
|
||||
IMB_premultiply_alpha(ibuf);
|
||||
}
|
||||
}
|
||||
@@ -2057,7 +2057,7 @@ static ImBuf * seq_render_scene_strip_impl(
|
||||
static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfra)
|
||||
{
|
||||
ImBuf * ibuf = NULL;
|
||||
char name[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char name[FILE_MAX];
|
||||
int use_preprocess = input_have_to_preprocess(context, seq, cfra);
|
||||
float nr = give_stripelem_index(seq, cfra);
|
||||
/* all effects are handled similarly with the exception of speed effect */
|
||||
|
||||
@@ -1173,8 +1173,6 @@ static void ccgdm_pbvh_update(CCGDerivedMesh *ccgdm)
|
||||
static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(drawAllEdges)) {
|
||||
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
|
||||
CCGSubSurf *ss = ccgdm->ss;
|
||||
CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss);
|
||||
CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss);
|
||||
int i, j, edgeSize = ccgSubSurf_getEdgeSize(ss);
|
||||
int totedge = ccgSubSurf_getNumEdges(ss);
|
||||
int gridSize = ccgSubSurf_getGridSize(ss);
|
||||
@@ -1212,8 +1210,10 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(draw
|
||||
}
|
||||
|
||||
if (ccgdm->drawInteriorEdges) {
|
||||
for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
|
||||
CCGFace *f = ccgFaceIterator_getCurrent(fi);
|
||||
int totface = ccgSubSurf_getNumFaces(ss);
|
||||
|
||||
for(j = 0; j < totface; j++) {
|
||||
CCGFace *f = ccgdm->faceMap[j].face;
|
||||
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
|
||||
|
||||
for (S=0; S<numVerts; S++) {
|
||||
@@ -1238,18 +1238,15 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(draw
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ccgFaceIterator_free(fi);
|
||||
ccgEdgeIterator_free(ei);
|
||||
}
|
||||
static void ccgDM_drawLooseEdges(DerivedMesh *dm) {
|
||||
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
|
||||
CCGSubSurf *ss = ccgdm->ss;
|
||||
CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss);
|
||||
int i, edgeSize = ccgSubSurf_getEdgeSize(ss);
|
||||
int totedge = ccgSubSurf_getNumEdges(ss);
|
||||
int i, j, edgeSize = ccgSubSurf_getEdgeSize(ss);
|
||||
|
||||
for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
|
||||
CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
|
||||
for (j=0; j< totedge; j++) {
|
||||
CCGEdge *e = ccgdm->edgeMap[j].edge;
|
||||
DMGridData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
|
||||
|
||||
if (!ccgSubSurf_getEdgeNumFaces(e)) {
|
||||
@@ -1261,8 +1258,6 @@ static void ccgDM_drawLooseEdges(DerivedMesh *dm) {
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
|
||||
ccgEdgeIterator_free(ei);
|
||||
}
|
||||
|
||||
static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d)
|
||||
@@ -1283,10 +1278,11 @@ static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d)
|
||||
static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)[4], int fast, int (*setMaterial)(int, void *attribs)) {
|
||||
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
|
||||
CCGSubSurf *ss = ccgdm->ss;
|
||||
CCGFaceIterator *fi;
|
||||
int gridSize = ccgSubSurf_getGridSize(ss);
|
||||
char *faceFlags = ccgdm->faceFlags;
|
||||
int step = (fast)? gridSize-1: 1;
|
||||
int i, totface = ccgSubSurf_getNumFaces(ss);
|
||||
int drawcurrent = 0, matnr = -1, shademodel = -1;
|
||||
|
||||
ccgdm_pbvh_update(ccgdm);
|
||||
|
||||
@@ -1304,30 +1300,37 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
|
||||
return;
|
||||
}
|
||||
|
||||
fi = ccgSubSurf_getFaceIterator(ss);
|
||||
for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
|
||||
CCGFace *f = ccgFaceIterator_getCurrent(fi);
|
||||
for(i = 0; i < totface; i++) {
|
||||
CCGFace *f = ccgdm->faceMap[i].face;
|
||||
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
|
||||
int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f));
|
||||
int drawSmooth, mat_nr;
|
||||
int new_matnr, new_shademodel;
|
||||
|
||||
if(faceFlags) {
|
||||
drawSmooth = (faceFlags[index*2] & ME_SMOOTH);
|
||||
mat_nr= faceFlags[index*2 + 1];
|
||||
new_shademodel = (faceFlags[index*2] & ME_SMOOTH)? GL_SMOOTH: GL_FLAT;
|
||||
new_matnr= faceFlags[index*2 + 1];
|
||||
}
|
||||
else {
|
||||
drawSmooth = 1;
|
||||
mat_nr= 0;
|
||||
new_shademodel = GL_SMOOTH;
|
||||
new_matnr= 0;
|
||||
}
|
||||
|
||||
if (!setMaterial(mat_nr+1, NULL))
|
||||
if(shademodel != new_shademodel || matnr != new_matnr) {
|
||||
matnr= new_matnr;
|
||||
shademodel= new_shademodel;
|
||||
|
||||
drawcurrent= setMaterial(matnr+1, NULL);
|
||||
|
||||
glShadeModel(shademodel);
|
||||
}
|
||||
|
||||
if(!drawcurrent)
|
||||
continue;
|
||||
|
||||
glShadeModel(drawSmooth? GL_SMOOTH: GL_FLAT);
|
||||
for (S=0; S<numVerts; S++) {
|
||||
DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
|
||||
|
||||
if (drawSmooth) {
|
||||
if (shademodel == GL_SMOOTH) {
|
||||
for (y=0; y<gridSize-1; y+=step) {
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
for (x=0; x<gridSize; x+=step) {
|
||||
@@ -1362,15 +1365,12 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ccgFaceIterator_free(fi);
|
||||
}
|
||||
|
||||
/* Only used by non-editmesh types */
|
||||
static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs), int (*setDrawOptions)(void *userData, int index), void *userData) {
|
||||
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
|
||||
CCGSubSurf *ss = ccgdm->ss;
|
||||
CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss);
|
||||
GPUVertexAttribs gattribs;
|
||||
DMVertexAttribs attribs= {{{NULL}}};
|
||||
/* MTFace *tf = dm->getFaceDataArray(dm, CD_MTFACE); */ /* UNUSED */
|
||||
@@ -1503,8 +1503,6 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, v
|
||||
}
|
||||
|
||||
#undef PASSATTRIB
|
||||
|
||||
ccgFaceIterator_free(fi);
|
||||
}
|
||||
|
||||
static void ccgDM_drawFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs)) {
|
||||
@@ -1515,7 +1513,6 @@ static void ccgDM_drawFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *a
|
||||
static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *userData, int, void *attribs), int (*setFace)(void *userData, int index), void *userData) {
|
||||
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
|
||||
CCGSubSurf *ss = ccgdm->ss;
|
||||
CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss);
|
||||
GPUVertexAttribs gattribs;
|
||||
DMVertexAttribs attribs= {{{NULL}}};
|
||||
int gridSize = ccgSubSurf_getGridSize(ss);
|
||||
@@ -1655,18 +1652,15 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *
|
||||
}
|
||||
|
||||
#undef PASSATTRIB
|
||||
|
||||
ccgFaceIterator_free(fi);
|
||||
}
|
||||
|
||||
|
||||
static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), unsigned char *col1, unsigned char *col2) {
|
||||
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
|
||||
CCGSubSurf *ss = ccgdm->ss;
|
||||
CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss);
|
||||
int gridSize = ccgSubSurf_getGridSize(ss);
|
||||
unsigned char *cp1, *cp2;
|
||||
int useTwoSide=1;
|
||||
int useTwoSide=1, i, totface;
|
||||
|
||||
ccgdm_pbvh_update(ccgdm);
|
||||
|
||||
@@ -1685,8 +1679,9 @@ static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), uns
|
||||
}
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
|
||||
CCGFace *f = ccgFaceIterator_getCurrent(fi);
|
||||
totface = ccgSubSurf_getNumFaces(ss);
|
||||
for(i = 0; i < totface; i++) {
|
||||
CCGFace *f = ccgdm->faceMap[i].face;
|
||||
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
|
||||
|
||||
for (S=0; S<numVerts; S++) {
|
||||
@@ -1725,8 +1720,6 @@ static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), uns
|
||||
}
|
||||
}
|
||||
glEnd();
|
||||
|
||||
ccgFaceIterator_free(fi);
|
||||
}
|
||||
|
||||
static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
|
||||
|
||||
@@ -237,12 +237,12 @@ int reopen_text(Text *text)
|
||||
int i, llen, len;
|
||||
unsigned char *buffer;
|
||||
TextLine *tmp;
|
||||
char str[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char str[FILE_MAX];
|
||||
struct stat st;
|
||||
|
||||
if (!text || !text->name) return 0;
|
||||
|
||||
BLI_strncpy(str, text->name, FILE_MAXDIR+FILE_MAXFILE);
|
||||
BLI_strncpy(str, text->name, FILE_MAX);
|
||||
BLI_path_abs(str, G.main->name);
|
||||
|
||||
fp= fopen(str, "r");
|
||||
@@ -334,10 +334,10 @@ Text *add_text(const char *file, const char *relpath)
|
||||
unsigned char *buffer;
|
||||
TextLine *tmp;
|
||||
Text *ta;
|
||||
char str[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char str[FILE_MAX];
|
||||
struct stat st;
|
||||
|
||||
BLI_strncpy(str, file, FILE_MAXDIR+FILE_MAXFILE);
|
||||
BLI_strncpy(str, file, FILE_MAX);
|
||||
if (relpath) /* can be NULL (bg mode) */
|
||||
BLI_path_abs(str, relpath);
|
||||
|
||||
|
||||
@@ -231,9 +231,12 @@ MovieTrackingTrack *BKE_tracking_add_track(MovieTracking *tracking, float x, flo
|
||||
|
||||
void BKE_tracking_insert_marker(MovieTrackingTrack *track, MovieTrackingMarker *marker)
|
||||
{
|
||||
MovieTrackingMarker *old_marker= BKE_tracking_get_marker(track, marker->framenr);
|
||||
MovieTrackingMarker *old_marker= NULL;
|
||||
|
||||
if(old_marker && old_marker->framenr==marker->framenr) {
|
||||
if(track->markersnr)
|
||||
old_marker= BKE_tracking_exact_marker(track, marker->framenr);
|
||||
|
||||
if(old_marker) {
|
||||
*old_marker= *marker;
|
||||
} else {
|
||||
int a= track->markersnr;
|
||||
@@ -324,7 +327,7 @@ MovieTrackingMarker *BKE_tracking_ensure_marker(MovieTrackingTrack *track, int f
|
||||
{
|
||||
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, framenr);
|
||||
|
||||
if(marker && marker->framenr!=framenr) {
|
||||
if(marker->framenr!=framenr) {
|
||||
MovieTrackingMarker marker_new;
|
||||
|
||||
marker_new= *marker;
|
||||
@@ -341,7 +344,7 @@ MovieTrackingMarker *BKE_tracking_exact_marker(MovieTrackingTrack *track, int fr
|
||||
{
|
||||
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, framenr);
|
||||
|
||||
if(marker && marker->framenr!=framenr)
|
||||
if(marker->framenr!=framenr)
|
||||
return NULL;
|
||||
|
||||
return marker;
|
||||
@@ -440,7 +443,6 @@ void BKE_tracking_clear_path(MovieTrackingTrack *track, int ref_frame, int actio
|
||||
int BKE_tracking_test_join_tracks(MovieTrackingTrack *dst_track, MovieTrackingTrack *src_track)
|
||||
{
|
||||
int a= 0, b= 0;
|
||||
/* int tot= dst_track->markersnr+src_track->markersnr; */ /* UNUSED */
|
||||
int count= 0;
|
||||
|
||||
while(a<src_track->markersnr || b<dst_track->markersnr) {
|
||||
@@ -858,13 +860,11 @@ static unsigned char *get_search_bytebuf(ImBuf *ibuf, MovieTrackingTrack *track,
|
||||
static ImBuf *get_frame_ibuf(MovieTrackingContext *context, int framenr)
|
||||
{
|
||||
ImBuf *ibuf;
|
||||
int framenr_old= context->user.framenr;
|
||||
MovieClipUser user= context->user;
|
||||
|
||||
context->user.framenr= framenr;
|
||||
user.framenr= framenr;
|
||||
|
||||
ibuf= BKE_movieclip_get_ibuf_flag(context->clip, &context->user, 0);
|
||||
|
||||
context->user.framenr= framenr_old;
|
||||
ibuf= BKE_movieclip_get_ibuf_flag(context->clip, &user, 0);
|
||||
|
||||
return ibuf;
|
||||
}
|
||||
@@ -1050,9 +1050,9 @@ int BKE_tracking_next(MovieTrackingContext *context)
|
||||
for(a= 0; a<context->num_tracks; a++) {
|
||||
TrackContext *track_context= &context->track_context[a];
|
||||
MovieTrackingTrack *track= track_context->track;
|
||||
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, curfra);
|
||||
MovieTrackingMarker *marker= BKE_tracking_exact_marker(track, curfra);
|
||||
|
||||
if(marker && (marker->flag&MARKER_DISABLED)==0 && marker->framenr==curfra) {
|
||||
if(marker && (marker->flag&MARKER_DISABLED)==0) {
|
||||
#ifdef WITH_LIBMV
|
||||
int width, height, origin[2], tracked= 0, need_readjust= 0;
|
||||
float pos[2], margin[2];
|
||||
@@ -1921,10 +1921,8 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width,
|
||||
while(track) {
|
||||
if(track->flag&TRACK_USE_2D_STAB ||
|
||||
((stab->flag&TRACKING_STABILIZE_ROTATION) && track==stab->rot_track)) {
|
||||
if(track->markersnr) {
|
||||
sfra= MIN2(sfra, track->markers[0].framenr);
|
||||
efra= MAX2(efra, track->markers[track->markersnr-1].framenr);
|
||||
}
|
||||
sfra= MIN2(sfra, track->markers[0].framenr);
|
||||
efra= MAX2(efra, track->markers[track->markersnr-1].framenr);
|
||||
}
|
||||
|
||||
track= track->next;
|
||||
@@ -2024,7 +2022,7 @@ static ImBuf* stabilize_alloc_ibuf(ImBuf *cacheibuf, ImBuf *srcibuf, int fill)
|
||||
}
|
||||
}
|
||||
else {
|
||||
cacheibuf= IMB_allocImBuf(srcibuf->x, srcibuf->y, srcibuf->depth, flags);
|
||||
cacheibuf= IMB_allocImBuf(srcibuf->x, srcibuf->y, srcibuf->planes, flags);
|
||||
cacheibuf->profile= srcibuf->profile;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ static void filepath_avi(char *string, RenderData *rd);
|
||||
|
||||
#include "BKE_writeframeserver.h"
|
||||
|
||||
bMovieHandle *BKE_get_movie_handle(int imtype)
|
||||
bMovieHandle *BKE_get_movie_handle(const char imtype)
|
||||
{
|
||||
static bMovieHandle mh;
|
||||
|
||||
@@ -80,14 +80,14 @@ bMovieHandle *BKE_get_movie_handle(int imtype)
|
||||
|
||||
/* do the platform specific handles */
|
||||
#if defined(_WIN32) && !defined(FREE_WINDOWS)
|
||||
if (imtype == R_AVICODEC) {
|
||||
if (imtype == R_IMF_IMTYPE_AVICODEC) {
|
||||
//XXX mh.start_movie= start_avi_codec;
|
||||
//XXX mh.append_movie= append_avi_codec;
|
||||
//XXX mh.end_movie= end_avi_codec;
|
||||
}
|
||||
#endif
|
||||
#ifdef WITH_QUICKTIME
|
||||
if (imtype == R_QUICKTIME) {
|
||||
if (imtype == R_IMF_IMTYPE_QUICKTIME) {
|
||||
mh.start_movie= start_qt;
|
||||
mh.append_movie= append_qt;
|
||||
mh.end_movie= end_qt;
|
||||
@@ -95,7 +95,7 @@ bMovieHandle *BKE_get_movie_handle(int imtype)
|
||||
}
|
||||
#endif
|
||||
#ifdef WITH_FFMPEG
|
||||
if (ELEM4(imtype, R_FFMPEG, R_H264, R_XVID, R_THEORA)) {
|
||||
if (ELEM4(imtype, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_XVID, R_IMF_IMTYPE_THEORA)) {
|
||||
mh.start_movie = start_ffmpeg;
|
||||
mh.append_movie = append_ffmpeg;
|
||||
mh.end_movie = end_ffmpeg;
|
||||
@@ -103,7 +103,7 @@ bMovieHandle *BKE_get_movie_handle(int imtype)
|
||||
}
|
||||
#endif
|
||||
#ifdef WITH_FRAMESERVER
|
||||
if (imtype == R_FRAMESERVER) {
|
||||
if (imtype == R_IMF_IMTYPE_FRAMESERVER) {
|
||||
mh.start_movie = start_frameserver;
|
||||
mh.append_movie = append_frameserver;
|
||||
mh.end_movie = end_frameserver;
|
||||
@@ -154,7 +154,7 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL
|
||||
x = rectx;
|
||||
y = recty;
|
||||
|
||||
quality= rd->quality;
|
||||
quality= rd->im_format.quality;
|
||||
framerate= (double) rd->frs_sec / (double) rd->frs_sec_base;
|
||||
|
||||
avi = MEM_mallocN (sizeof(AviMovie), "avimovie");
|
||||
@@ -162,7 +162,7 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL
|
||||
/* RPW 11-21-2002
|
||||
if (rd->imtype != AVI_FORMAT_MJPEG) format = AVI_FORMAT_AVI_RGB;
|
||||
*/
|
||||
if (rd->imtype != R_AVIJPEG ) format = AVI_FORMAT_AVI_RGB;
|
||||
if (rd->im_format.imtype != R_IMF_IMTYPE_AVIJPEG ) format = AVI_FORMAT_AVI_RGB;
|
||||
else format = AVI_FORMAT_MJPEG;
|
||||
|
||||
if (AVI_open_compress (name, avi, 1, format) != AVI_ERROR_NONE) {
|
||||
@@ -233,7 +233,7 @@ static void end_avi(void)
|
||||
/* similar to BKE_makepicstring() */
|
||||
void BKE_makeanimstring(char *string, RenderData *rd)
|
||||
{
|
||||
bMovieHandle *mh= BKE_get_movie_handle(rd->imtype);
|
||||
bMovieHandle *mh= BKE_get_movie_handle(rd->im_format.imtype);
|
||||
if(mh->get_movie_path)
|
||||
mh->get_movie_path(string, rd);
|
||||
else
|
||||
|
||||
@@ -1337,7 +1337,7 @@ void ffmpeg_verify_image_type(RenderData *rd)
|
||||
{
|
||||
int audio= 0;
|
||||
|
||||
if(rd->imtype == R_FFMPEG) {
|
||||
if(rd->imtype == R_IMF_IMTYPE_FFMPEG) {
|
||||
if(rd->ffcodecdata.type <= 0 ||
|
||||
rd->ffcodecdata.codec <= 0 ||
|
||||
rd->ffcodecdata.audio_codec <= 0 ||
|
||||
@@ -1353,19 +1353,19 @@ void ffmpeg_verify_image_type(RenderData *rd)
|
||||
|
||||
audio= 1;
|
||||
}
|
||||
else if(rd->imtype == R_H264) {
|
||||
else if(rd->imtype == R_IMF_IMTYPE_H264) {
|
||||
if(rd->ffcodecdata.codec != CODEC_ID_H264) {
|
||||
ffmpeg_set_preset(rd, FFMPEG_PRESET_H264);
|
||||
audio= 1;
|
||||
}
|
||||
}
|
||||
else if(rd->imtype == R_XVID) {
|
||||
else if(rd->imtype == R_IMF_IMTYPE_XVID) {
|
||||
if(rd->ffcodecdata.codec != CODEC_ID_MPEG4) {
|
||||
ffmpeg_set_preset(rd, FFMPEG_PRESET_XVID);
|
||||
audio= 1;
|
||||
}
|
||||
}
|
||||
else if(rd->imtype == R_THEORA) {
|
||||
else if(rd->imtype == R_IMF_IMTYPE_THEORA) {
|
||||
if(rd->ffcodecdata.codec != CODEC_ID_THEORA) {
|
||||
ffmpeg_set_preset(rd, FFMPEG_PRESET_THEORA);
|
||||
audio= 1;
|
||||
|
||||
@@ -194,17 +194,20 @@ void minmax_v3v3_v3(float min[3], float max[3], const float vec[3]);
|
||||
|
||||
/***************************** Array Functions *******************************/
|
||||
/* attempted to follow fixed length vertex functions. names could be improved*/
|
||||
void range_vni(int *array, const int size, const int start);
|
||||
double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int size);
|
||||
float normalize_vn_vn(float *array_tar, const float *array_src, const int size);
|
||||
float normalize_vn(float *array_tar, const int size);
|
||||
void range_vn_i(int *array_tar, const int size, const int start);
|
||||
void negate_vn(float *array_tar, const int size);
|
||||
void negate_vn_vn(float *array_tar, const float *array_src, const int size);
|
||||
void mul_vn_fl(float *array, const int size, const float f);
|
||||
void mul_vn_fl(float *array_tar, const int size, const float f);
|
||||
void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f);
|
||||
void add_vn_vn(float *array_tar, const float *array_src, const int size);
|
||||
void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size);
|
||||
void sub_vn_vn(float *array_tar, const float *array_src, const int size);
|
||||
void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size);
|
||||
void fill_vni(int *array_tar, const int size, const int val);
|
||||
void fill_vn(float *array_tar, const int size, const float val);
|
||||
void fill_vn_i(int *array_tar, const int size, const int val);
|
||||
void fill_vn_fl(float *array_tar, const int size, const float val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy);
|
||||
char *BLI_strncat_utf8(char *dst, const char *src, size_t maxncpy);
|
||||
int BLI_utf8_invalid_byte(const char *str, int length);
|
||||
int BLI_utf8_invalid_strip(char *str, int length);
|
||||
|
||||
|
||||
@@ -287,20 +287,28 @@ static DLRBT_Node *get_grandparent (DLRBT_Node *node)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* get the sibling node (e.g. if node is left child of parent, return right child of parent) */
|
||||
static DLRBT_Node *get_sibling(DLRBT_Node *node)
|
||||
{
|
||||
if (node && node->parent) {
|
||||
if (node == node->parent->left)
|
||||
return node->parent->right;
|
||||
else
|
||||
return node->parent->left;
|
||||
}
|
||||
|
||||
/* sibling not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* get the 'uncle' - the sibling of the parent - of the given node */
|
||||
static DLRBT_Node *get_uncle (DLRBT_Node *node)
|
||||
{
|
||||
DLRBT_Node *gpn= get_grandparent(node);
|
||||
if (node)
|
||||
/* return the child of the grandparent which isn't the node's parent */
|
||||
return get_sibling(node->parent);
|
||||
|
||||
/* return the child of the grandparent which isn't the node's parent */
|
||||
if (gpn) {
|
||||
if (gpn->left == node->parent)
|
||||
return gpn->right;
|
||||
else
|
||||
return gpn->left;
|
||||
}
|
||||
|
||||
/* not found */
|
||||
/* uncle not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -378,7 +378,37 @@ void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
|
||||
|
||||
/***************************** Array Functions *******************************/
|
||||
|
||||
void range_vni(int *array_tar, const int size, const int start)
|
||||
double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int size)
|
||||
{
|
||||
double d= 0.0f;
|
||||
const float *array_pt_a= array_src_a + (size-1);
|
||||
const float *array_pt_b= array_src_b + (size-1);
|
||||
int i= size;
|
||||
while(i--) { d += *(array_pt_a--) * *(array_pt_b--); }
|
||||
return d;
|
||||
}
|
||||
|
||||
float normalize_vn_vn(float *array_tar, const float *array_src, const int size)
|
||||
{
|
||||
double d= dot_vn_vn(array_tar, array_src, size);
|
||||
float d_sqrt;
|
||||
if (d > 1.0e-35) {
|
||||
d_sqrt= (float)sqrt(d);
|
||||
mul_vn_vn_fl(array_tar, array_src, size, 1.0f/d_sqrt);
|
||||
}
|
||||
else {
|
||||
fill_vn_fl(array_tar, size, 0.0f);
|
||||
d_sqrt= 0.0f;
|
||||
}
|
||||
return d_sqrt;
|
||||
}
|
||||
|
||||
float normalize_vn(float *array_tar, const int size)
|
||||
{
|
||||
return normalize_vn_vn(array_tar, array_tar, size);
|
||||
}
|
||||
|
||||
void range_vn_i(int *array_tar, const int size, const int start)
|
||||
{
|
||||
int *array_pt= array_tar + (size-1);
|
||||
int j= start + (size-1);
|
||||
@@ -450,14 +480,14 @@ void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_
|
||||
while(i--) { *(tar--) = *(src_a--) - *(src_b--); }
|
||||
}
|
||||
|
||||
void fill_vni(int *array_tar, const int size, const int val)
|
||||
void fill_vn_i(int *array_tar, const int size, const int val)
|
||||
{
|
||||
int *tar= array_tar + (size-1);
|
||||
int i= size;
|
||||
while(i--) { *(tar--) = val; }
|
||||
}
|
||||
|
||||
void fill_vn(float *array_tar, const int size, const float val)
|
||||
void fill_vn_fl(float *array_tar, const int size, const float val)
|
||||
{
|
||||
float *tar= array_tar + (size-1);
|
||||
int i= size;
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_string_utf8.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_utildefines.h"
|
||||
@@ -220,16 +221,25 @@ int BLI_uniquename_cb(int (*unique_check)(void *, const char *), void *arg, cons
|
||||
}
|
||||
|
||||
if(unique_check(arg, name)) {
|
||||
char numstr[16];
|
||||
char tempname[UNIQUE_NAME_MAX];
|
||||
char left[UNIQUE_NAME_MAX];
|
||||
int number;
|
||||
int len= BLI_split_name_num(left, &number, name, delim);
|
||||
do {
|
||||
int newlen= BLI_snprintf(tempname, name_len, "%s%c%03d", left, delim, ++number);
|
||||
if(newlen >= name_len) {
|
||||
len -= ((newlen + 1) - name_len);
|
||||
if(len < 0) len= number= 0;
|
||||
left[len]= '\0';
|
||||
int numlen= BLI_snprintf(numstr, sizeof(numstr), "%c%03d", delim, ++number);
|
||||
|
||||
/* highly unlikely the string only has enough room for the number
|
||||
* but support anyway */
|
||||
if ((len == 0) || (numlen >= name_len)) {
|
||||
/* number is know not to be utf-8 */
|
||||
BLI_strncpy(tempname, numstr, name_len);
|
||||
}
|
||||
else {
|
||||
char *tempname_buf;
|
||||
tempname[0]= '\0';
|
||||
tempname_buf =BLI_strncat_utf8(tempname, left, name_len - numlen);
|
||||
memcpy(tempname_buf, numstr, numlen + 1);
|
||||
}
|
||||
} while(unique_check(arg, tempname));
|
||||
|
||||
@@ -416,8 +426,8 @@ void BLI_cleanup_file(const char *relabase, char *dir)
|
||||
void BLI_path_rel(char *file, const char *relfile)
|
||||
{
|
||||
char * lslash;
|
||||
char temp[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char res[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char temp[FILE_MAX];
|
||||
char res[FILE_MAX];
|
||||
|
||||
/* if file is already relative, bail out */
|
||||
if(file[0]=='/' && file[1]=='/') return;
|
||||
@@ -435,9 +445,9 @@ void BLI_path_rel(char *file, const char *relfile)
|
||||
if (relfile[0] != '\\' && relfile[0] != '/') {
|
||||
ptemp++;
|
||||
}
|
||||
BLI_strncpy(ptemp, relfile, FILE_MAXDIR + FILE_MAXFILE-3);
|
||||
BLI_strncpy(ptemp, relfile, FILE_MAX-3);
|
||||
} else {
|
||||
BLI_strncpy(temp, relfile, FILE_MAXDIR + FILE_MAXFILE);
|
||||
BLI_strncpy(temp, relfile, FILE_MAX);
|
||||
}
|
||||
|
||||
if (BLI_strnlen(file, 3) > 2) {
|
||||
@@ -529,7 +539,7 @@ int BLI_has_parent(char *path)
|
||||
int BLI_parent_dir(char *path)
|
||||
{
|
||||
static char parent_dir[]= {'.', '.', SEP, '\0'}; /* "../" or "..\\" */
|
||||
char tmp[FILE_MAXDIR+FILE_MAXFILE+4];
|
||||
char tmp[FILE_MAX+4];
|
||||
BLI_strncpy(tmp, path, sizeof(tmp)-4);
|
||||
BLI_add_slash(tmp);
|
||||
strcat(tmp, parent_dir);
|
||||
@@ -734,7 +744,7 @@ int BLI_path_cwd(char *path)
|
||||
#endif
|
||||
|
||||
if (wasrelative==1) {
|
||||
char cwd[FILE_MAXDIR + FILE_MAXFILE]= "";
|
||||
char cwd[FILE_MAX]= "";
|
||||
BLI_current_working_dir(cwd, sizeof(cwd)); /* incase the full path to the blend isnt used */
|
||||
|
||||
if (cwd[0] == '\0') {
|
||||
@@ -747,8 +757,8 @@ int BLI_path_cwd(char *path)
|
||||
* blend file which isnt a feature we want to use in this case since were dealing
|
||||
* with a path from the command line, rather than from inside Blender */
|
||||
|
||||
char origpath[FILE_MAXDIR + FILE_MAXFILE];
|
||||
BLI_strncpy(origpath, path, FILE_MAXDIR + FILE_MAXFILE);
|
||||
char origpath[FILE_MAX];
|
||||
BLI_strncpy(origpath, path, FILE_MAX);
|
||||
|
||||
BLI_make_file_string(NULL, path, cwd, origpath);
|
||||
}
|
||||
@@ -1246,7 +1256,7 @@ void BLI_make_exist(char *dir)
|
||||
|
||||
void BLI_make_existing_file(const char *name)
|
||||
{
|
||||
char di[FILE_MAXDIR+FILE_MAXFILE], fi[FILE_MAXFILE];
|
||||
char di[FILE_MAX], fi[FILE_MAXFILE];
|
||||
|
||||
BLI_strncpy(di, name, sizeof(di));
|
||||
BLI_splitdirstring(di, fi);
|
||||
@@ -1695,8 +1705,8 @@ static int add_win32_extension(char *name)
|
||||
type = BLI_exists(name);
|
||||
if ((type == 0) || S_ISDIR(type)) {
|
||||
#ifdef _WIN32
|
||||
char filename[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char ext[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char filename[FILE_MAX];
|
||||
char ext[FILE_MAX];
|
||||
const char *extensions = getenv("PATHEXT");
|
||||
if (extensions) {
|
||||
char *temp;
|
||||
@@ -1742,7 +1752,7 @@ static int add_win32_extension(char *name)
|
||||
*/
|
||||
static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name)
|
||||
{
|
||||
char filename[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char filename[FILE_MAX];
|
||||
const char *path = NULL, *temp;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -656,12 +656,17 @@ void BLI_pbvh_free(PBVH *bvh)
|
||||
/* if pbvh was deformed, new memory was allocated for verts/faces -- free it */
|
||||
|
||||
MEM_freeN(bvh->verts);
|
||||
MEM_freeN(bvh->faces);
|
||||
if(bvh->faces)
|
||||
MEM_freeN(bvh->faces);
|
||||
}
|
||||
}
|
||||
|
||||
MEM_freeN(bvh->nodes);
|
||||
MEM_freeN(bvh->prim_indices);
|
||||
if(bvh->nodes)
|
||||
MEM_freeN(bvh->nodes);
|
||||
|
||||
if(bvh->prim_indices)
|
||||
MEM_freeN(bvh->prim_indices);
|
||||
|
||||
MEM_freeN(bvh);
|
||||
}
|
||||
|
||||
@@ -1127,6 +1132,9 @@ void BLI_pbvh_update(PBVH *bvh, int flag, float (*face_nors)[3])
|
||||
PBVHNode **nodes;
|
||||
int totnode;
|
||||
|
||||
if(!bvh->nodes)
|
||||
return;
|
||||
|
||||
BLI_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(flag),
|
||||
&nodes, &totnode);
|
||||
|
||||
|
||||
@@ -442,18 +442,18 @@ int BLI_exists(const char *name)
|
||||
/* in Windows stat doesn't recognize dir ending on a slash
|
||||
To not break code where the ending slash is expected we
|
||||
don't mess with the argument name directly here - elubie */
|
||||
char tmp[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char tmp[FILE_MAX];
|
||||
int len, res;
|
||||
BLI_strncpy(tmp, name, FILE_MAXDIR+FILE_MAXFILE);
|
||||
BLI_strncpy(tmp, name, FILE_MAX);
|
||||
len = strlen(tmp);
|
||||
if (len > 3 && ( tmp[len-1]=='\\' || tmp[len-1]=='/') ) tmp[len-1] = '\0';
|
||||
res = _stat(tmp, &st);
|
||||
if (res == -1) return(0);
|
||||
#elif defined(__MINGW32__)
|
||||
struct _stati64 st;
|
||||
char tmp[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char tmp[FILE_MAX];
|
||||
int len, res;
|
||||
BLI_strncpy(tmp, name, FILE_MAXDIR+FILE_MAXFILE);
|
||||
BLI_strncpy(tmp, name, FILE_MAX);
|
||||
len = strlen(tmp);
|
||||
if (len > 3 && ( tmp[len-1]=='\\' || tmp[len-1]=='/') ) tmp[len-1] = '\0';
|
||||
res = _stati64(tmp, &st);
|
||||
|
||||
@@ -163,28 +163,46 @@ static const size_t utf8_skip_data[256] = {
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
|
||||
};
|
||||
|
||||
#define BLI_STR_UTF8_CPY(dst, src, maxncpy) \
|
||||
{ \
|
||||
size_t utf8_size; \
|
||||
while(*src != '\0' && (utf8_size= utf8_skip_data[*src]) < maxncpy) { \
|
||||
maxncpy -= utf8_size; \
|
||||
switch(utf8_size) { \
|
||||
case 6: *dst ++ = *src ++; \
|
||||
case 5: *dst ++ = *src ++; \
|
||||
case 4: *dst ++ = *src ++; \
|
||||
case 3: *dst ++ = *src ++; \
|
||||
case 2: *dst ++ = *src ++; \
|
||||
case 1: *dst ++ = *src ++; \
|
||||
} \
|
||||
} \
|
||||
*dst= '\0'; \
|
||||
}
|
||||
|
||||
char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy)
|
||||
{
|
||||
char *dst_r= dst;
|
||||
size_t utf8_size;
|
||||
|
||||
/* note: currently we dont attempt to deal with invalid utf8 chars */
|
||||
BLI_STR_UTF8_CPY(dst, src, maxncpy)
|
||||
|
||||
while(*src != '\0' && (utf8_size= utf8_skip_data[*src]) < maxncpy) {
|
||||
maxncpy -= utf8_size;
|
||||
switch(utf8_size) {
|
||||
case 6: *dst ++ = *src ++;
|
||||
case 5: *dst ++ = *src ++;
|
||||
case 4: *dst ++ = *src ++;
|
||||
case 3: *dst ++ = *src ++;
|
||||
case 2: *dst ++ = *src ++;
|
||||
case 1: *dst ++ = *src ++;
|
||||
}
|
||||
}
|
||||
*dst= '\0';
|
||||
return dst_r;
|
||||
}
|
||||
|
||||
char *BLI_strncat_utf8(char *dst, const char *src, size_t maxncpy)
|
||||
{
|
||||
while (*dst && maxncpy > 0) {
|
||||
dst++;
|
||||
maxncpy--;
|
||||
}
|
||||
|
||||
BLI_STR_UTF8_CPY(dst, src, maxncpy)
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
#undef BLI_STR_UTF8_CPY
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/* wchar_t / utf8 functions */
|
||||
|
||||
@@ -47,13 +47,13 @@
|
||||
#define WIN32_SKIP_HKEY_PROTECTION // need to use HKEY
|
||||
#include "BLI_winstuff.h"
|
||||
|
||||
/* FILE_MAXDIR + FILE_MAXFILE */
|
||||
/* FILE_MAX */
|
||||
|
||||
int BLI_getInstallationDir( char * str ) {
|
||||
char dir[FILE_MAXDIR];
|
||||
int a;
|
||||
|
||||
GetModuleFileName(NULL,str,FILE_MAXDIR+FILE_MAXFILE);
|
||||
GetModuleFileName(NULL,str,FILE_MAX);
|
||||
BLI_split_dir_part(str, dir, sizeof(dir)); /* shouldn't be relative */
|
||||
a = strlen(dir);
|
||||
if(dir[a-1] == '\\') dir[a-1]=0;
|
||||
|
||||
@@ -501,7 +501,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepat
|
||||
{
|
||||
Main *m;
|
||||
Library *lib;
|
||||
char name1[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char name1[FILE_MAX];
|
||||
|
||||
BLI_strncpy(name1, filepath, sizeof(name1));
|
||||
cleanup_path(relabase, name1);
|
||||
@@ -6668,8 +6668,8 @@ static void customdata_version_242(Mesh *me)
|
||||
|
||||
if (layer->type == CD_MTFACE) {
|
||||
if (layer->name[0] == 0) {
|
||||
if (mtfacen == 0) strcpy(layer->name, "UVTex");
|
||||
else sprintf(layer->name, "UVTex.%.3d", mtfacen);
|
||||
if (mtfacen == 0) strcpy(layer->name, "UVMap");
|
||||
else sprintf(layer->name, "UVMap.%.3d", mtfacen);
|
||||
}
|
||||
mtfacen++;
|
||||
}
|
||||
@@ -7537,6 +7537,67 @@ static void do_versions_nodetree_convert_angle(bNodeTree *ntree)
|
||||
}
|
||||
}
|
||||
|
||||
void do_versions_image_settings_2_60(Scene *sce)
|
||||
{
|
||||
/* note: rd->subimtype is moved into indervidual settings now and no longer
|
||||
* exists */
|
||||
RenderData *rd= &sce->r;
|
||||
ImageFormatData *imf= &sce->r.im_format;
|
||||
|
||||
imf->imtype= rd->imtype;
|
||||
imf->planes= rd->planes;
|
||||
imf->compress= rd->quality;
|
||||
imf->quality= rd->quality;
|
||||
|
||||
/* default, was stored in multiple places, may override later */
|
||||
imf->depth= R_IMF_CHAN_DEPTH_8;
|
||||
|
||||
/* openexr */
|
||||
imf->exr_codec = rd->quality & 7; /* strange but true! 0-4 are valid values, OPENEXR_COMPRESS */
|
||||
|
||||
switch (imf->imtype) {
|
||||
case R_IMF_IMTYPE_OPENEXR:
|
||||
imf->depth= (rd->subimtype & R_OPENEXR_HALF) ? R_IMF_CHAN_DEPTH_16 : R_IMF_CHAN_DEPTH_32;
|
||||
if (rd->subimtype & R_PREVIEW_JPG) {
|
||||
imf->flag |= R_IMF_FLAG_PREVIEW_JPG;
|
||||
}
|
||||
if (rd->subimtype & R_OPENEXR_ZBUF) {
|
||||
imf->flag |= R_IMF_FLAG_ZBUF;
|
||||
}
|
||||
break;
|
||||
case R_IMF_IMTYPE_TIFF:
|
||||
if (rd->subimtype & R_TIFF_16BIT) {
|
||||
imf->depth= R_IMF_CHAN_DEPTH_16;
|
||||
}
|
||||
break;
|
||||
case R_IMF_IMTYPE_JP2:
|
||||
if (rd->subimtype & R_JPEG2K_16BIT) {
|
||||
imf->depth= R_IMF_CHAN_DEPTH_16;
|
||||
}
|
||||
else if (rd->subimtype & R_JPEG2K_12BIT) {
|
||||
imf->depth= R_IMF_CHAN_DEPTH_12;
|
||||
}
|
||||
|
||||
if (rd->subimtype & R_JPEG2K_YCC) {
|
||||
imf->jp2_flag |= R_IMF_JP2_FLAG_YCC;
|
||||
}
|
||||
if (rd->subimtype & R_JPEG2K_CINE_PRESET) {
|
||||
imf->jp2_flag |= R_IMF_JP2_FLAG_CINE_PRESET;
|
||||
}
|
||||
if (rd->subimtype & R_JPEG2K_CINE_48FPS) {
|
||||
imf->jp2_flag |= R_IMF_JP2_FLAG_CINE_48;
|
||||
}
|
||||
break;
|
||||
case R_IMF_IMTYPE_CINEON:
|
||||
case R_IMF_IMTYPE_DPX:
|
||||
if (rd->subimtype & R_CINEON_LOG) {
|
||||
imf->cineon_flag |= R_IMF_CINEON_FLAG_LOG;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
{
|
||||
/* WATCH IT!!!: pointers from libdata have not been converted */
|
||||
@@ -12733,6 +12794,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
|
||||
/* put compatibility code here until next subversion bump */
|
||||
{
|
||||
Scene *sce;
|
||||
for(sce = main->scene.first; sce; sce = sce->id.next) {
|
||||
if (sce->r.im_format.depth == 0) {
|
||||
do_versions_image_settings_2_60(sce);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* default values in Freestyle settings */
|
||||
|
||||
@@ -59,7 +59,7 @@ typedef struct FileData {
|
||||
gzFile gzfiledes;
|
||||
|
||||
// now only in use for library appending
|
||||
char relabase[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char relabase[FILE_MAX];
|
||||
|
||||
// variables needed for reading from stream
|
||||
char headerdone;
|
||||
|
||||
@@ -1667,7 +1667,8 @@ static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data,
|
||||
writestruct(wd, DATA, structname, datasize, layer->data);
|
||||
}
|
||||
else
|
||||
printf("error: this CustomDataLayer must not be written to file\n");
|
||||
printf("%s error: layer '%s':%d - can't be written to file\n",
|
||||
__func__, structname, layer->type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2903,7 +2904,7 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil
|
||||
/* return: success(0), failure(1) */
|
||||
static int do_history(const char *name, ReportList *reports)
|
||||
{
|
||||
char tempname1[FILE_MAXDIR+FILE_MAXFILE], tempname2[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char tempname1[FILE_MAX], tempname2[FILE_MAX];
|
||||
int hisnr= U.versions;
|
||||
|
||||
if(U.versions==0) return 0;
|
||||
@@ -2937,8 +2938,8 @@ static int do_history(const char *name, ReportList *reports)
|
||||
/* return: success (1) */
|
||||
int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportList *reports, int *thumb)
|
||||
{
|
||||
char userfilename[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char tempname[FILE_MAXDIR+FILE_MAXFILE+1];
|
||||
char userfilename[FILE_MAX];
|
||||
char tempname[FILE_MAX+1];
|
||||
int file, err, write_user_block;
|
||||
|
||||
/* open temporary file, so we preserve the original in case we crash */
|
||||
@@ -2952,8 +2953,8 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
|
||||
|
||||
/* remapping of relative paths to new file location */
|
||||
if(write_flags & G_FILE_RELATIVE_REMAP) {
|
||||
char dir1[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char dir2[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char dir1[FILE_MAX];
|
||||
char dir2[FILE_MAX];
|
||||
BLI_split_dir_part(filepath, dir1, sizeof(dir1));
|
||||
BLI_split_dir_part(mainvar->name, dir2, sizeof(dir2));
|
||||
|
||||
@@ -3004,7 +3005,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
|
||||
|
||||
if(write_flags & G_FILE_COMPRESS) {
|
||||
/* compressed files have the same ending as regular files... only from 2.4!!! */
|
||||
char gzname[FILE_MAXDIR+FILE_MAXFILE+4];
|
||||
char gzname[FILE_MAX+4];
|
||||
int ret;
|
||||
|
||||
/* first write compressed to separate @.gz */
|
||||
|
||||
@@ -196,7 +196,7 @@ void GeometryExporter::createPolylist(short material_index,
|
||||
COLLADASW::Input input3(COLLADASW::InputSemantic::TEXCOORD,
|
||||
makeUrl(makeTexcoordSourceId(geom_id, i)),
|
||||
2, // offset always 2, this is only until we have optimized UV sets
|
||||
i // set number equals UV layer index
|
||||
i // set number equals UV map index
|
||||
);
|
||||
til.push_back(input3);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_materia
|
||||
ostr << translate_id(id_name(ma)) << a+1;
|
||||
COLLADASW::InstanceMaterial im(ostr.str(), COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, matid));
|
||||
|
||||
// create <bind_vertex_input> for each uv layer
|
||||
// create <bind_vertex_input> for each uv map
|
||||
Mesh *me = (Mesh*)ob->data;
|
||||
int totlayer = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
|
||||
|
||||
|
||||
@@ -417,7 +417,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T
|
||||
me->totface = mesh->getFacesCount() + new_tris;
|
||||
me->mface = (MFace*)CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, me->totface);
|
||||
|
||||
// allocate UV layers
|
||||
// allocate UV Maps
|
||||
unsigned int totuvset = mesh->getUVCoords().getInputInfosArray().getCount();
|
||||
|
||||
for (i = 0; i < totuvset; i++) {
|
||||
@@ -433,7 +433,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T
|
||||
//this->set_layername_map[i] = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i);
|
||||
}
|
||||
|
||||
// activate the first uv layer
|
||||
// activate the first uv map
|
||||
if (totuvset) me->mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, 0);
|
||||
|
||||
UVDataWrapper uvs(mesh->getUVCoords());
|
||||
|
||||
@@ -569,7 +569,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor
|
||||
/* draw settings for stepped interpolation modifier */
|
||||
static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
|
||||
{
|
||||
uiLayout *col, *subcol;
|
||||
uiLayout *col, *sub;
|
||||
PointerRNA ptr;
|
||||
|
||||
/* init the RNA-pointer */
|
||||
@@ -584,17 +584,17 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho
|
||||
col= uiLayoutColumn(layout, 1);
|
||||
uiItemR(col, &ptr, "use_frame_start", 0, NULL, ICON_NONE);
|
||||
|
||||
subcol = uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_frame_start"));
|
||||
uiItemR(subcol, &ptr, "frame_start", 0, NULL, ICON_NONE);
|
||||
sub = uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_start"));
|
||||
uiItemR(sub, &ptr, "frame_start", 0, NULL, ICON_NONE);
|
||||
|
||||
/* block 3: end range settings */
|
||||
col= uiLayoutColumn(layout, 1);
|
||||
uiItemR(col, &ptr, "use_frame_end", 0, NULL, ICON_NONE);
|
||||
|
||||
subcol = uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_frame_end"));
|
||||
uiItemR(subcol, &ptr, "frame_end", 0, NULL, ICON_NONE);
|
||||
sub = uiLayoutColumn(col, 1);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_end"));
|
||||
uiItemR(sub, &ptr, "frame_end", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
/* --------------- */
|
||||
@@ -602,7 +602,7 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho
|
||||
void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm)
|
||||
{
|
||||
FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm);
|
||||
uiLayout *box, *row, *subrow, *col;
|
||||
uiLayout *box, *row, *sub, *col;
|
||||
uiBlock *block;
|
||||
uiBut *but;
|
||||
short width= 314;
|
||||
@@ -620,30 +620,30 @@ void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifie
|
||||
block= uiLayoutGetBlock(row); // err...
|
||||
|
||||
/* left-align -------------------------------------------- */
|
||||
subrow= uiLayoutRow(row, 1);
|
||||
uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_LEFT);
|
||||
sub= uiLayoutRow(row, 1);
|
||||
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
|
||||
/* expand */
|
||||
uiItemR(subrow, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||
uiItemR(sub, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||
|
||||
/* checkbox for 'active' status (for now) */
|
||||
uiItemR(subrow, &ptr, "active", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||
uiItemR(sub, &ptr, "active", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||
|
||||
/* name */
|
||||
if (fmi)
|
||||
uiItemL(subrow, fmi->name, ICON_NONE);
|
||||
uiItemL(sub, fmi->name, ICON_NONE);
|
||||
else
|
||||
uiItemL(subrow, "<Unknown Modifier>", ICON_NONE);
|
||||
uiItemL(sub, "<Unknown Modifier>", ICON_NONE);
|
||||
|
||||
/* right-align ------------------------------------------- */
|
||||
subrow= uiLayoutRow(row, 1);
|
||||
uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT);
|
||||
sub= uiLayoutRow(row, 1);
|
||||
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT);
|
||||
|
||||
|
||||
/* 'mute' button */
|
||||
uiItemR(subrow, &ptr, "mute", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||
uiItemR(sub, &ptr, "mute", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thick
|
||||
if (totpoints == 1) {
|
||||
/* draw point */
|
||||
glBegin(GL_POINTS);
|
||||
glVertex2f(points->x, points->y);
|
||||
glVertex2iv(&points->x);
|
||||
glEnd();
|
||||
}
|
||||
else if (sflag & GP_STROKE_ERASER) {
|
||||
@@ -132,18 +132,15 @@ static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thick
|
||||
glBegin(GL_LINE_STRIP);
|
||||
|
||||
/* need to roll-back one point to ensure that there are no gaps in the stroke */
|
||||
if (i != 0) {
|
||||
pt--;
|
||||
glVertex2f(pt->x, pt->y);
|
||||
pt++;
|
||||
}
|
||||
if (i != 0) glVertex2iv(&(pt - 1)->x);
|
||||
|
||||
/* now the point we want... */
|
||||
glVertex2f(pt->x, pt->y);
|
||||
glVertex2iv(&pt->x);
|
||||
|
||||
oldpressure = pt->pressure;
|
||||
}
|
||||
else
|
||||
glVertex2f(pt->x, pt->y);
|
||||
glVertex2iv(&pt->x);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
@@ -162,7 +159,7 @@ static void gp_draw_stroke_point (bGPDspoint *points, short thickness, short dfl
|
||||
/* draw point */
|
||||
if (sflag & GP_STROKE_3DSPACE) {
|
||||
glBegin(GL_POINTS);
|
||||
glVertex3f(points->x, points->y, points->z);
|
||||
glVertex3fv(&points->x);
|
||||
glEnd();
|
||||
}
|
||||
else {
|
||||
@@ -228,18 +225,16 @@ static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thicknes
|
||||
glBegin(GL_LINE_STRIP);
|
||||
|
||||
/* need to roll-back one point to ensure that there are no gaps in the stroke */
|
||||
if (i != 0) {
|
||||
pt--;
|
||||
glVertex3f(pt->x, pt->y, pt->z);
|
||||
pt++;
|
||||
}
|
||||
if (i != 0) glVertex3fv(&(pt - 1)->x);
|
||||
|
||||
/* now the point we want... */
|
||||
glVertex3f(pt->x, pt->y, pt->z);
|
||||
glVertex3fv(&pt->x);
|
||||
|
||||
oldpressure = pt->pressure;
|
||||
}
|
||||
else
|
||||
glVertex3f(pt->x, pt->y, pt->z);
|
||||
else {
|
||||
glVertex3fv(&pt->x);
|
||||
}
|
||||
}
|
||||
glEnd();
|
||||
|
||||
@@ -247,7 +242,7 @@ static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thicknes
|
||||
if (debug) {
|
||||
glBegin(GL_POINTS);
|
||||
for (i=0, pt=points; i < totpoints && pt; i++, pt++)
|
||||
glVertex3f(pt->x, pt->y, pt->z);
|
||||
glVertex3fv(&pt->x);
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
@@ -461,7 +456,7 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness_s
|
||||
glBegin(GL_POINTS);
|
||||
for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
|
||||
if (sflag & GP_STROKE_2DSPACE) {
|
||||
glVertex2f(pt->x, pt->y);
|
||||
glVertex2fv(&pt->x);
|
||||
}
|
||||
else if (sflag & GP_STROKE_2DIMAGE) {
|
||||
const float x= (float)((pt->x * winx) + offsx);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user