Merged changes in the trunk up to revision 47056.

Conflicts resolved:
source/blender/bmesh/bmesh_class.h
source/blender/bmesh/intern/bmesh_construct.c
source/blender/editors/interface/resources.c
source/blender/render/intern/source/convertblender.c
This commit is contained in:
2012-05-26 22:22:45 +00:00
606 changed files with 34730 additions and 29015 deletions

View File

@@ -161,8 +161,6 @@ if(UNIX AND NOT APPLE)
option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)" ON)
option(WITH_X11_XF86VMODE "Enable X11 video mode switching" ON)
option(WITH_BUILTIN_GLEW "Use GLEW OpenGL wrapper library bundled with blender" ON)
option(WITH_XDG_USER_DIRS "Build with XDG Base Directory Specification (only config and documents for now)" OFF)
mark_as_advanced(WITH_XDG_USER_DIRS)
# freebsd doesn't seems to support XDND
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
@@ -238,8 +236,14 @@ mark_as_advanced(WITH_MINGW64)
option(WITH_CYCLES "Enable cycles Render Engine" ON)
option(WITH_CYCLES_TEST "Build cycles test application" OFF)
option(WITH_CYCLES_CUDA_BINARIES "Build cycles CUDA binaries" OFF)
set(CYCLES_CUDA_BINARIES_ARCH sm_13 sm_20 sm_21 CACHE STRING "CUDA architectures to build binaries for")
if(WIN32 AND NOT CMAKE_CL_64 AND NOT WITH_MINGW64)
set(PLATFORM_DEFAULT sm_20 sm_21)
else()
set(PLATFORM_DEFAULT sm_13 sm_20 sm_21)
endif()
set(CYCLES_CUDA_BINARIES_ARCH ${PLATFORM_DEFAULT} CACHE STRING "CUDA architectures to build binaries for")
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT)
# disable for now, but plan to support on all platforms eventually
option(WITH_MEM_JEMALLOC "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF)
@@ -1187,13 +1191,13 @@ elseif(APPLE)
endif()
if(${XCODE_VERSION} VERSION_LESS 4.3)
SET(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE ) # use guaranteed existing sdk
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE) # use guaranteed existing sdk
else()
# note: i don't use xcode-select path on purpose, cause also /Applications/Xcode.app would be allowed
# absolute pathes are more foolproof here !
SET(OSX_SYSROOT_PREFIX /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform)
SET(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk
SET(CMAKE_OSX_SYSROOT ${OSX_SYSROOT_PREFIX}/${OSX_DEVELOPER_PREFIX} CACHE PATH "" FORCE)
set(OSX_SYSROOT_PREFIX /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform)
set(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk
set(CMAKE_OSX_SYSROOT ${OSX_SYSROOT_PREFIX}/${OSX_DEVELOPER_PREFIX} CACHE PATH "" FORCE)
endif()
if(WITH_LIBS10.5)

View File

@@ -553,7 +553,7 @@ if env['OURPLATFORM']!='darwin':
source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
# To ensure empty dirs are created too
if len(source)==0:
if len(source)==0 and not os.path.exists(dir):
env.Execute(Mkdir(dir))
scriptinstall.append(env.Install(dir=dir,source=source))
if env['WITH_BF_CYCLES']:

View File

@@ -169,6 +169,11 @@ BF_BOOST_LIBPATH = BF_BOOST + '/lib'
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
#CUDA
WITH_BF_CYCLES_CUDA_BINARIES = False
#BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21'] # don't build sm_13 until the compile can fit in 32bit process again :)
##
CC = 'gcc'
CXX = 'g++'

View File

@@ -869,12 +869,17 @@ class BlenderEnvironment(SConsEnvironment):
lenv.AddPostAction(prog,Action(AppIt,strfunction=my_appit_print))
elif os.sep == '/' and lenv['OURPLATFORM'] != 'linuxcross': # any unix (except cross-compilation)
if lenv['WITH_BF_PYTHON']:
if not lenv['WITHOUT_BF_INSTALL'] and not lenv['WITHOUT_BF_PYTHON_INSTALL'] and not BlenderEnvironment.PyBundleActionAdded:
if (not lenv['WITHOUT_BF_INSTALL'] and
not lenv['WITHOUT_BF_PYTHON_INSTALL'] and
not lenv['WITHOUT_BF_PYTHON_UNPACK'] and
not BlenderEnvironment.PyBundleActionAdded):
lenv.AddPostAction(prog,Action(UnixPyBundle,strfunction=my_unixpybundle_print))
BlenderEnvironment.PyBundleActionAdded = True
elif lenv['OURPLATFORM'].startswith('win') or lenv['OURPLATFORM'] == 'linuxcross': # windows or cross-compilation
if lenv['WITH_BF_PYTHON']:
if not lenv['WITHOUT_BF_PYTHON_INSTALL'] and not BlenderEnvironment.PyBundleActionAdded:
if (not lenv['WITHOUT_BF_PYTHON_INSTALL'] and
not lenv['WITHOUT_BF_PYTHON_UNPACK'] and
not BlenderEnvironment.PyBundleActionAdded):
lenv.AddPostAction(prog,Action(WinPyBundle,strfunction=my_winpybundle_print))
BlenderEnvironment.PyBundleActionAdded = True
return prog

View File

@@ -134,7 +134,7 @@ def validate_arguments(args, bc):
'BF_CXX', 'WITH_BF_STATICCXX', 'BF_CXX_LIB_STATIC',
'BF_TWEAK_MODE', 'BF_SPLIT_SRC',
'WITHOUT_BF_INSTALL',
'WITHOUT_BF_PYTHON_INSTALL',
'WITHOUT_BF_PYTHON_INSTALL', 'WITHOUT_BF_PYTHON_UNPACK',
'WITHOUT_BF_OVERWRITE_INSTALL',
'WITH_BF_OPENMP', 'BF_OPENMP', 'BF_OPENMP_LIBPATH',
'WITH_GHOST_COCOA',
@@ -519,6 +519,7 @@ def read_opts(env, cfg, args):
(BoolVariable('BF_SPLIT_SRC', 'Split src lib into several chunks if true', False)),
(BoolVariable('WITHOUT_BF_INSTALL', 'dont install if true', False)),
(BoolVariable('WITHOUT_BF_PYTHON_INSTALL', 'dont install Python modules if true', False)),
(BoolVariable('WITHOUT_BF_PYTHON_UNPACK', 'dont remove and unpack Python modules everytime if true', False)),
(BoolVariable('WITHOUT_BF_OVERWRITE_INSTALL', 'dont remove existing files before breating the new install directory (set to False when making packages for others)', False)),
(BoolVariable('BF_FANCY', 'Enable fancy output if true', True)),
(BoolVariable('BF_QUIET', 'Enable silent output if true', True)),

View File

@@ -28,7 +28,7 @@ This example script prints the vertices and UV's for each polygon, assumes the a
import bpy
me = bpy.context.object.data
uv_layer = me.uv.layers.active.data
uv_layer = me.uv_layers.active.data
for poly in me.polygons:
print("Polygon index: %d, length: %d" % (poly.index, poly.loop_total))

View File

@@ -13,37 +13,39 @@ Intro
# Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement MouseLook::
# To use a mouse movement sensor "Mouse" and a
# motion actuator to mouse look:
import bge.render
import bge.logic
import bge
# scale sets the speed of motion
scale = 1.0, 0.5
co = bge.logic.getCurrentController()
obj = co.getOwner()
mouse = co.getSensor("Mouse")
lmotion = co.getActuator("LMove")
wmotion = co.getActuator("WMove")
obj = co.owner
mouse = co.sensors["Mouse"]
lmotion = co.actuators["LMove"]
wmotion = co.actuators["WMove"]
# Transform the mouse coordinates to see how far the mouse has moved.
def mousePos():
x = (bge.render.getWindowWidth() / 2 - mouse.getXPosition()) * scale[0]
y = (bge.render.getWindowHeight() / 2 - mouse.getYPosition()) * scale[1]
x = (bge.render.getWindowWidth() / 2 - mouse.position[0]) * scale[0]
y = (bge.render.getWindowHeight() / 2 - mouse.position[1]) * scale[1]
return (x, y)
pos = mousePos()
# Set the amount of motion: X is applied in world coordinates...
lmotion.setTorque(0.0, 0.0, pos[0], False)
wmotion.useLocalTorque = False
wmotion.torque = ((0.0, 0.0, pos[0]))
# ...Y is applied in local coordinates
wmotion.setTorque(-pos[1], 0.0, 0.0, True)
lmotion.useLocalTorque = True
lmotion.torque = ((-pos[1], 0.0, 0.0))
# Activate both actuators
bge.logic.addActiveActuator(lmotion, True)
bge.logic.addActiveActuator(wmotion, True)
co.activate(lmotion)
co.activate(wmotion)
# Centre the mouse
bge.render.setMousePosition(bge.render.getWindowWidth() / 2, bge.render.getWindowHeight() / 2)
bge.render.setMousePosition(int(bge.render.getWindowWidth() / 2), int(bge.render.getWindowHeight() / 2))
*********
Constants

View File

@@ -99,9 +99,11 @@ Here are some examples ...
uv_lay = bm.loops.layers.uv.active
for face in bm.faces:
for loop in f.loops:
uv = loop[uv_lay]
print("Loop UV: %f, %f" % (uv.x, uv.y))
for loop in face.loops:
uv = loop[uv_lay].uv
print("Loop UV: %f, %f" % uv[:])
vert = loop.vert
print("Loop Vert: (%f,%f,%f)" % vert.co[:])
.. code-block:: python

View File

@@ -245,6 +245,7 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
/* object sync */
if(object_updated || (object->mesh && object->mesh->need_update)) {
object->name = b_ob.name().c_str();
object->instance_id = b_index;
object->pass_id = b_ob.pass_index();
object->tfm = tfm;
object->motion.pre = tfm;
@@ -284,8 +285,10 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
/* object loop */
BL::Scene::objects_iterator b_ob;
BL::Scene b_sce = b_scene;
for(b_scene.objects.begin(b_ob); b_ob != b_scene.objects.end(); ++b_ob) {
for(; b_sce; b_sce = b_sce.background_set()) {
for(b_sce.objects.begin(b_ob); b_ob != b_sce.objects.end(); ++b_ob) {
bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render();
uint ob_layer = get_layer(b_ob->layers());
@@ -333,6 +336,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
}
}
}
}
if(!motion) {
sync_background_light();

View File

@@ -334,6 +334,10 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Shader
node = new LightFalloffNode();
break;
}
case BL::ShaderNode::type_OBJECT_INFO: {
node = new ObjectInfoNode();
break;
}
case BL::ShaderNode::type_TEX_IMAGE: {
BL::ShaderNodeTexImage b_image_node(b_node);
BL::Image b_image(b_image_node.image());

View File

@@ -117,6 +117,16 @@ __device_inline void object_dir_transform(KernelGlobals *kg, ShaderData *sd, flo
#endif
}
__device_inline float3 object_location(KernelGlobals *kg, ShaderData *sd)
{
#ifdef __MOTION__
return make_float3(sd->ob_tfm.x.w, sd->ob_tfm.y.w, sd->ob_tfm.z.w);
#else
Transform tfm = object_fetch_transform(kg, sd->object, 0.0f, OBJECT_TRANSFORM);
return make_float3(tfm.x.w, tfm.y.w, tfm.z.w);
#endif
}
__device_inline float object_surface_area(KernelGlobals *kg, int object)
{
int offset = object*OBJECT_SIZE + OBJECT_PROPERTIES;
@@ -134,5 +144,20 @@ __device_inline float object_pass_id(KernelGlobals *kg, int object)
return f.y;
}
__device_inline float object_random_number(KernelGlobals *kg, int object)
{
if(object == ~0)
return 0.0f;
int offset = object*OBJECT_SIZE + OBJECT_PROPERTIES;
float4 f = kernel_tex_fetch(__objects, offset);
return f.z;
}
__device int shader_pass_id(KernelGlobals *kg, ShaderData *sd)
{
return kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2 + 1);
}
CCL_NAMESPACE_END

View File

@@ -679,11 +679,6 @@ __device bool shader_transparent_shadow(KernelGlobals *kg, Intersection *isect)
}
#endif
__device int shader_pass_id(KernelGlobals *kg, ShaderData *sd)
{
return kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2 + 1);
}
/* Free ShaderData */
__device void shader_release(KernelGlobals *kg, ShaderData *sd)

View File

@@ -266,6 +266,9 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT
case NODE_LIGHT_PATH:
svm_node_light_path(sd, stack, node.y, node.z, path_flag);
break;
case NODE_OBJECT_INFO:
svm_node_object_info(kg, sd, stack, node.y, node.z);
break;
#endif
case NODE_CONVERT:
svm_node_convert(sd, stack, node.y, node.z, node.w);

View File

@@ -74,5 +74,25 @@ __device void svm_node_geometry_bump_dy(ShaderData *sd, float *stack, uint type,
#endif
}
/* Object Info */
__device void svm_node_object_info(KernelGlobals *kg, ShaderData *sd, float *stack, uint type, uint out_offset)
{
float data;
switch(type) {
case NODE_INFO_OB_LOCATION: {
stack_store_float3(stack, out_offset, object_location(kg, sd));
return;
}
case NODE_INFO_OB_INDEX: data = object_pass_id(kg, sd->object); break;
case NODE_INFO_MAT_INDEX: data = shader_pass_id(kg, sd); break;
case NODE_INFO_OB_RANDOM: data = object_random_number(kg, sd->object); break;
default: data = 0.0f; break;
}
stack_store_float(stack, out_offset, data);
}
CCL_NAMESPACE_END

View File

@@ -92,7 +92,8 @@ typedef enum NodeType {
NODE_RGB_RAMP = 5900,
NODE_RGB_CURVES = 6000,
NODE_MIN_MAX = 6100,
NODE_LIGHT_FALLOFF = 6200
NODE_LIGHT_FALLOFF = 6200,
NODE_OBJECT_INFO = 6300
} NodeType;
typedef enum NodeAttributeType {
@@ -109,6 +110,13 @@ typedef enum NodeGeometry {
NODE_GEOM_uv
} NodeGeometry;
typedef enum NodeObjectInfo {
NODE_INFO_OB_LOCATION,
NODE_INFO_OB_INDEX,
NODE_INFO_MAT_INDEX,
NODE_INFO_OB_RANDOM
} NodeObjectInfo;
typedef enum NodeLightPath {
NODE_LP_camera = 0,
NODE_LP_shadow,

View File

@@ -325,6 +325,25 @@ void ShaderGraph::remove_proxy_nodes(vector<bool>& removed)
removed[proxy->id] = true;
}
/* remove useless mix closures nodes */
MixClosureNode *mix = dynamic_cast<MixClosureNode*>(node);
if(mix) {
if(mix->outputs[0]->links.size() && mix->inputs[1]->link == mix->inputs[2]->link) {
ShaderOutput *output = mix->inputs[1]->link;
vector<ShaderInput*> inputs = mix->outputs[0]->links;
foreach(ShaderInput *sock, mix->inputs)
if(sock->link)
disconnect(sock);
foreach(ShaderInput *input, inputs) {
disconnect(input);
connect(output, input);
}
}
}
}
}

View File

@@ -1699,7 +1699,7 @@ void LightPathNode::compile(OSLCompiler& compiler)
compiler.add(this, "node_light_path");
}
/* Light Path */
/* Light Falloff */
LightFalloffNode::LightFalloffNode()
: ShaderNode("light_path")
@@ -1746,6 +1746,49 @@ void LightFalloffNode::compile(OSLCompiler& compiler)
compiler.add(this, "node_light_falloff");
}
/* Object Info */
ObjectInfoNode::ObjectInfoNode()
: ShaderNode("object_info")
{
add_output("Location", SHADER_SOCKET_VECTOR);
add_output("Object Index", SHADER_SOCKET_FLOAT);
add_output("Material Index", SHADER_SOCKET_FLOAT);
add_output("Random", SHADER_SOCKET_FLOAT);
}
void ObjectInfoNode::compile(SVMCompiler& compiler)
{
ShaderOutput *out = output("Location");
if(!out->links.empty()) {
compiler.stack_assign(out);
compiler.add_node(NODE_OBJECT_INFO, NODE_INFO_OB_LOCATION, out->stack_offset);
}
out = output("Object Index");
if(!out->links.empty()) {
compiler.stack_assign(out);
compiler.add_node(NODE_OBJECT_INFO, NODE_INFO_OB_INDEX, out->stack_offset);
}
out = output("Material Index");
if(!out->links.empty()) {
compiler.stack_assign(out);
compiler.add_node(NODE_OBJECT_INFO, NODE_INFO_MAT_INDEX, out->stack_offset);
}
out = output("Random");
if(!out->links.empty()) {
compiler.stack_assign(out);
compiler.add_node(NODE_OBJECT_INFO, NODE_INFO_OB_RANDOM, out->stack_offset);
}
}
void ObjectInfoNode::compile(OSLCompiler& compiler)
{
compiler.add(this, "node_object_info");
}
/* Value */
ValueNode::ValueNode()

View File

@@ -285,6 +285,11 @@ public:
SHADER_NODE_CLASS(LightFalloffNode)
};
class ObjectInfoNode : public ShaderNode {
public:
SHADER_NODE_CLASS(ObjectInfoNode)
};
class ValueNode : public ShaderNode {
public:
SHADER_NODE_CLASS(ValueNode)

View File

@@ -23,6 +23,7 @@
#include "scene.h"
#include "util_foreach.h"
#include "util_hash.h"
#include "util_map.h"
#include "util_progress.h"
@@ -36,6 +37,7 @@ Object::Object()
mesh = NULL;
tfm = transform_identity();
visibility = ~0;
instance_id = 0;
pass_id = 0;
bounds = BoundBox::empty;
motion.pre = transform_identity();
@@ -164,6 +166,9 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene
float surface_area = 0.0f;
float pass_id = ob->pass_id;
uint ob_hash = hash_int_2d(hash_string(ob->name.c_str()), ob->instance_id);
float random_number = (float)ob_hash * (1.0f/(float)0xFFFFFFFF);
if(transform_uniform_scale(tfm, uniform_scale)) {
map<Mesh*, float>::iterator it = surface_area_map.find(mesh);
@@ -198,7 +203,7 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene
memcpy(&objects[offset], &tfm, sizeof(float4)*3);
memcpy(&objects[offset+3], &itfm, sizeof(float4)*3);
objects[offset+6] = make_float4(surface_area, pass_id, 0.0f, 0.0f);
objects[offset+6] = make_float4(surface_area, pass_id, random_number, 0.0f);
if(need_motion == Scene::MOTION_PASS) {
/* motion transformations, is world/object space depending if mesh

View File

@@ -41,6 +41,7 @@ public:
Transform tfm;
BoundBox bounds;
ustring name;
int instance_id;
int pass_id;
vector<ParamValue> attributes;
uint visibility;

View File

@@ -19,13 +19,15 @@
#ifndef __UTIL_HASH_H__
#define __UTIL_HASH_H__
#include "util_types.h"
CCL_NAMESPACE_BEGIN
static inline unsigned int hash_int_2d(unsigned int kx, unsigned int ky)
static inline uint hash_int_2d(uint kx, uint ky)
{
#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
unsigned int a, b, c;
uint a, b, c;
a = b = c = 0xdeadbeef + (2 << 2) + 13;
a += kx;
@@ -44,11 +46,21 @@ static inline unsigned int hash_int_2d(unsigned int kx, unsigned int ky)
#undef rot
}
static inline unsigned int hash_int(unsigned int k)
static inline uint hash_int(uint k)
{
return hash_int_2d(k, 0);
}
static inline uint hash_string(const char *str)
{
uint i = 0, c;
while ((c = *str++))
i = i * 37 + c;
return i;
}
CCL_NAMESPACE_END
#endif /* __UTIL_HASH_H__ */

View File

@@ -89,6 +89,9 @@ set(SRC
intern/globals.h
)
# elbeem has some harmless UNUSED warnings
remove_strict_flags()
add_definitions(
-DNOGUI
-DELBEEM_BLENDER=1

View File

@@ -108,10 +108,6 @@ if(WITH_INPUT_NDOF)
)
endif()
if(WITH_XDG_USER_DIRS)
add_definitions(-DWITH_XDG_USER_DIRS)
endif()
if(WITH_HEADLESS OR WITH_GHOST_SDL)
if(WITH_HEADLESS)
list(APPEND SRC

View File

@@ -87,8 +87,12 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_IEvent"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
void *operator new(size_t num_bytes) {
return MEM_mallocN(num_bytes, "GHOST:GHOST_IEvent");
}
void operator delete(void *mem) {
MEM_freeN(mem);
}
#endif
};

View File

@@ -165,13 +165,15 @@ protected:
* Constructor.
* Protected default constructor to force use of static createSystem member.
*/
GHOST_ISystem() {}
GHOST_ISystem() {
}
/**
* Destructor.
* Protected default constructor to force use of static dispose member.
*/
virtual ~GHOST_ISystem() {}
virtual ~GHOST_ISystem() {
}
public:
/***************************************************************************************
@@ -415,8 +417,12 @@ protected:
#ifdef WITH_CXX_GUARDEDALLOC
public:
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_ISystem"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
void *operator new(size_t num_bytes) {
return MEM_mallocN(num_bytes, "GHOST:GHOST_ISystem");
}
void operator delete(void *mem) {
MEM_freeN(mem);
}
#endif
};

View File

@@ -59,28 +59,30 @@ protected:
* Constructor.
* Protected default constructor to force use of static createSystem member.
*/
GHOST_ISystemPaths() {}
GHOST_ISystemPaths() {
}
/**
* Destructor.
* Protected default constructor to force use of static dispose member.
*/
virtual ~GHOST_ISystemPaths() {}
virtual ~GHOST_ISystemPaths() {
}
public:
/**
* Determine the base dir in which shared resources are located. It will first try to use
* "unpack and run" path, then look for properly installed path, not including versioning.
* "unpack and run" path, then look for properly installed path, including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
virtual const GHOST_TUns8* getSystemDir() const = 0;
virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const = 0;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
virtual const GHOST_TUns8* getUserDir() const = 0;
virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const = 0;
/**
* Determine the directory of the current binary

View File

@@ -86,8 +86,12 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_ITimerTask"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
void *operator new(size_t num_bytes) {
return MEM_mallocN(num_bytes, "GHOST:GHOST_ITimerTask");
}
void operator delete(void *mem) {
MEM_freeN(mem);
}
#endif
};

View File

@@ -55,16 +55,16 @@ extern GHOST_TSuccess GHOST_DisposeSystemPaths(void);
/**
* Determine the base dir in which shared resources are located. It will first try to use
* "unpack and run" path, then look for properly installed path, not including versioning.
* "unpack and run" path, then look for properly installed path, including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
extern const GHOST_TUns8* GHOST_getSystemDir(void);
extern const GHOST_TUns8 *GHOST_getSystemDir(int version, const char *versionstr);
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* Determine the base dir in which user configuration is stored, including versioning.
* @return Unsigned char string pointing to user dir (eg ~).
*/
extern const GHOST_TUns8* GHOST_getUserDir(void);
extern const GHOST_TUns8 *GHOST_getUserDir(int version, const char *versionstr);
/**

View File

@@ -56,19 +56,22 @@ public:
* @param b requested bottom coordinate of the rectangle
*/
GHOST_Rect(GHOST_TInt32 l = 0, GHOST_TInt32 t = 0, GHOST_TInt32 r = 0, GHOST_TInt32 b = 0)
: m_l(l), m_t(t), m_r(r), m_b(b) {}
: m_l(l), m_t(t), m_r(r), m_b(b)
{}
/**
* Copy constructor.
* @param r rectangle to copy
*/
GHOST_Rect(const GHOST_Rect& r)
: m_l(r.m_l), m_t(r.m_t), m_r(r.m_r), m_b(r.m_b) {}
: m_l(r.m_l), m_t(r.m_t), m_r(r.m_r), m_b(r.m_b)
{}
/**
* Destructor.
*/
virtual ~GHOST_Rect() {};
virtual ~GHOST_Rect()
{};
/**
* Access to rectangle width.

View File

@@ -75,4 +75,5 @@ void GHOST_Buttons::clear()
m_ButtonRight = false;
}
GHOST_Buttons::~GHOST_Buttons() {}
GHOST_Buttons::~GHOST_Buttons() {
}

View File

@@ -141,7 +141,9 @@ GHOST_DisplayManagerSDL:: setCurrentDisplaySetting(GHOST_TUns8 display,
if (setting.xPixels > mode.w ||
setting.yPixels > mode.h)
{
continue;
}
x = setting.xPixels - mode.w;
y = setting.yPixels - mode.h;

View File

@@ -129,18 +129,19 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(GHOST_TUns8 d
if ((dm.dmBitsPerPel == match.bpp) &&
(dm.dmPelsWidth == match.xPixels) &&
(dm.dmPelsHeight == match.yPixels) &&
(dm.dmDisplayFrequency == match.frequency)) {
(dm.dmDisplayFrequency == match.frequency))
{
break;
}
}
/*
dm.dmBitsPerPel = match.bpp;
dm.dmPelsWidth = match.xPixels;
dm.dmPelsHeight = match.yPixels;
dm.dmDisplayFrequency = match.frequency;
dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
dm.dmSize = sizeof(DEVMODE);
dm.dmDriverExtra = 0;
* dm.dmBitsPerPel = match.bpp;
* dm.dmPelsWidth = match.xPixels;
* dm.dmPelsHeight = match.yPixels;
* dm.dmDisplayFrequency = match.frequency;
* dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
* dm.dmSize = sizeof(DEVMODE);
* dm.dmDriverExtra = 0;
*/
#ifdef GHOST_DEBUG
printf("display change: Requested settings:\n");

View File

@@ -78,8 +78,7 @@ HRESULT __stdcall GHOST_DropTargetWin32::QueryInterface (REFIID riid, void ** pp
*ppvObj = (void *)this;
return S_OK;
}
else
{
else {
*ppvObj = 0;
return E_NOINTERFACE;
}
@@ -107,8 +106,7 @@ ULONG __stdcall GHOST_DropTargetWin32::Release(void)
delete this;
return 0;
}
else
{
else {
return refs;
}
}
@@ -136,8 +134,7 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragOver(DWORD grfKeyState, POINTL pt,
{
*pdwEffect = allowedDropEffect(*pdwEffect);
}
else
{
else {
*pdwEffect = DROPEFFECT_NONE;
//*pdwEffect = DROPEFFECT_COPY; // XXX Uncomment to test drop. Drop will not be called if pdwEffect == DROPEFFECT_NONE.
}
@@ -167,8 +164,7 @@ HRESULT __stdcall GHOST_DropTargetWin32::Drop(IDataObject * pDataObject, DWORD g
*pdwEffect = allowedDropEffect(*pdwEffect);
}
else
{
else {
*pdwEffect = DROPEFFECT_NONE;
}
if (data)

View File

@@ -52,10 +52,10 @@ public:
ULONG __stdcall Release(void);
/* IDropTarget implementation
+ The IDropTarget interface is one of the interfaces you implement to
provide drag-and-drop operations in your application. It contains methods
used in any application that can be a target for data during a
drag-and-drop operation. A drop-target application is responsible for:
* + The IDropTarget interface is one of the interfaces you implement to
* provide drag-and-drop operations in your application. It contains methods
* used in any application that can be a target for data during a
* drag-and-drop operation. A drop-target application is responsible for:
*
* - Determining the effect of the drop on the target application.
* - Incorporating any valid dropped data when the drop occurs.
@@ -152,7 +152,6 @@ private:
GHOST_SystemWin32 *m_system;
/* Data type of the dragged object */
GHOST_TDragnDropTypes m_draggedObjectType;
};
#endif // __GHOST_DROPTARGETWIN32_H__

View File

@@ -52,8 +52,7 @@ GHOST_EventManager::~GHOST_EventManager()
disposeEvents();
TConsumerVector::iterator iter = m_consumers.begin();
while (iter != m_consumers.end())
{
while (iter != m_consumers.end()) {
GHOST_IEventConsumer *consumer = *iter;
delete consumer;
m_consumers.erase(iter);
@@ -213,8 +212,7 @@ void GHOST_EventManager::removeWindowEvents(GHOST_IWindow* window)
m_events.erase(iter);
iter = m_events.begin();
}
else
{
else {
iter++;
}
}
@@ -238,8 +236,7 @@ void GHOST_EventManager::removeTypeEvents(GHOST_TEventType type, GHOST_IWindow*
m_events.erase(iter);
iter = m_events.begin();
}
else
{
else {
iter++;
}
}

View File

@@ -58,5 +58,4 @@ class GHOST_EventNDOFButton : public GHOST_Event
}
};
#endif // __GHOST_EVENTNDOF_H__

View File

@@ -187,19 +187,24 @@ void GHOST_EventPrinter::getKeyString(GHOST_TKey key, char str[32]) const
{
if ((key >= GHOST_kKeyComma) && (key <= GHOST_kKeyRightBracket)) {
sprintf(str, "%c", (char)key);
} else if ((key >= GHOST_kKeyNumpad0) && (key <= GHOST_kKeyNumpad9)) {
}
else if ((key >= GHOST_kKeyNumpad0) && (key <= GHOST_kKeyNumpad9)) {
sprintf(str, "Numpad %d", (key - GHOST_kKeyNumpad0));
#if defined(__sun__) || defined(__sun)
} else if (key == 268828432) { /* solaris keyboards are messed up */
}
else if (key == 268828432) { /* solaris keyboards are messed up */
/* This should really test XK_F11 but that doesn't work */
strcpy(str, "F11");
} else if (key == 268828433) { /* solaris keyboards are messed up */
}
else if (key == 268828433) { /* solaris keyboards are messed up */
/* This should really test XK_F12 but that doesn't work */
strcpy(str, "F12");
#endif
} else if ((key >= GHOST_kKeyF1) && (key <= GHOST_kKeyF24)) {
}
else if ((key >= GHOST_kKeyF1) && (key <= GHOST_kKeyF24)) {
sprintf(str, "F%d", key - GHOST_kKeyF1 + 1);
} else {
}
else {
const char *tstr = NULL;
switch (key) {
case GHOST_kKeyBackSpace:

View File

@@ -52,7 +52,8 @@ public:
* @param data_ptr Pointer to the (unformatted) data associated with the event
*/
GHOST_EventString(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow *window, GHOST_TEventDataPtr data_ptr)
: GHOST_Event(msec, type, window) {
: GHOST_Event(msec, type, window)
{
m_data = data_ptr;
}

View File

@@ -41,8 +41,7 @@
* @author Maarten Gribnau
* @date May 17, 2001
*/
struct GHOST_ModifierKeys
{
struct GHOST_ModifierKeys {
/**
* Constructor.
*/

View File

@@ -45,16 +45,16 @@ GHOST_TSuccess GHOST_DisposeSystemPaths(void)
return GHOST_ISystemPaths::dispose();
}
const GHOST_TUns8* GHOST_getSystemDir()
const GHOST_TUns8 *GHOST_getSystemDir(int version, const char *versionstr)
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
return systemPaths ? systemPaths->getSystemDir() : 0;
return systemPaths ? systemPaths->getSystemDir(version, versionstr) : 0;
}
const GHOST_TUns8* GHOST_getUserDir()
const GHOST_TUns8 *GHOST_getUserDir(int version, const char *versionstr)
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
return systemPaths ? systemPaths->getUserDir() : 0; /* shouldn't be NULL */
return systemPaths ? systemPaths->getUserDir(version, versionstr) : 0; /* shouldn't be NULL */
}
const GHOST_TUns8 *GHOST_getBinaryDir()

View File

@@ -309,7 +309,8 @@ GHOST_TSuccess GHOST_System::init()
if (m_timerManager && m_windowManager && m_eventManager) {
return GHOST_kSuccess;
} else {
}
else {
return GHOST_kFailure;
}
}

View File

@@ -168,9 +168,11 @@ static GHOST_TKey convertKey(int rawCode)
if ((vk >= 'a') && (vk <= 'z')) {
return (GHOST_TKey) (vk - 'a' + GHOST_kKeyA);
} else if ((vk >= '0') && (vk <= '9')) {
}
else if ((vk >= '0') && (vk <= '9')) {
return (GHOST_TKey) (vk - '0' + GHOST_kKey0);
} else if (vk==16) {
}
else if (vk == 16) {
switch (rawCode) {
case 122: return GHOST_kKeyF1;
case 120: return GHOST_kKeyF2;
@@ -185,7 +187,8 @@ static GHOST_TKey convertKey(int rawCode)
case 103: return GHOST_kKeyF11;
case 111: return GHOST_kKeyF12; // Never get, is used for ejecting the CD!
}
} else {
}
else {
switch (vk) {
case kUpArrowCharCode: return GHOST_kKeyUpArrow;
case kDownArrowCharCode: return GHOST_kKeyDownArrow;
@@ -381,7 +384,6 @@ GHOST_TUns64 GHOST_SystemCarbon::getMilliSeconds() const
return (millis / 1000) - m_start_time;
}
GHOST_TUns8 GHOST_SystemCarbon::getNumDisplays() const
{
// We do not support multiple monitors at the moment
@@ -408,8 +410,7 @@ GHOST_IWindow* GHOST_SystemCarbon::createWindow(
GHOST_TDrawingContextType type,
bool stereoVisual,
const GHOST_TUns16 numOfAASamples,
const GHOST_TEmbedderWindowID parentWindow
)
const GHOST_TEmbedderWindowID parentWindow)
{
GHOST_IWindow *window = 0;
@@ -459,8 +460,8 @@ GHOST_TSuccess GHOST_SystemCarbon::endFullScreen(void)
}
/* this is an old style low level event queue.
As we want to handle our own timers, this is ok.
the full screen hack should be removed */
* As we want to handle our own timers, this is ok.
* the full screen hack should be removed */
bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
{
bool anyProcessed = false;
@@ -477,7 +478,8 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
if (next == GHOST_kFireTimeNever) {
timeOut = kEventDurationForever;
} else {
}
else {
timeOut = (double)(next - getMilliSeconds()) / 1000.0;
if (timeOut < 0.0)
timeOut = 0.0;
@@ -504,7 +506,8 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
OSStatus status = ::SendEventToEventTarget(event, ::GetEventDispatcherTarget());
if (status == noErr) {
anyProcessed = true;
} else {
}
else {
UInt32 i = ::GetEventClass(event);
/* Ignore 'cgs ' class, no documentation on what they
@@ -585,7 +588,8 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
strncpy(buf, g_firstFileBuf, FIRSTFILEBUFLG - 1);
buf[FIRSTFILEBUFLG - 1] = '\0';
return 1;
} else {
}
else {
return 0;
}
}
@@ -780,7 +784,8 @@ OSStatus GHOST_SystemCarbon::handleTabletEvent(EventRef event)
ct.Xtilt = tabletPointRecord.tiltX / 32767.0f; /* can be positive or negative */
ct.Ytilt = tabletPointRecord.tiltY / 32767.0f; /* can be positive or negative */
}
} else {
}
else {
//GHOST_PRINT("Embedded proximity event\n");
// Extract the Tablet Proximity record from the event.
@@ -807,7 +812,8 @@ OSStatus GHOST_SystemCarbon::handleTabletEvent(EventRef event)
ct.Active = GHOST_kTabletModeNone;
break;
}
} else {
}
else {
// pointer is leaving - return to mouse
ct.Active = GHOST_kTabletModeNone;
}
@@ -925,9 +931,11 @@ OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event)
GHOST_TEventType type;
if (kind == kEventRawKeyDown) {
type = GHOST_kEventKeyDown;
} else if (kind == kEventRawKeyRepeat) {
}
else if (kind == kEventRawKeyRepeat) {
type = GHOST_kEventKeyDown; /* XXX, fixme */
} else {
}
else {
type = GHOST_kEventKeyUp;
}
pushEvent(new GHOST_EventKey(getMilliSeconds(), type, window, key, ascii, NULL) );
@@ -1009,7 +1017,8 @@ bool GHOST_SystemCarbon::handleMouseDown(EventRef event)
EventMouseButton button;
::GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
pushEvent(new GHOST_EventButton(getMilliSeconds(), GHOST_kEventButtonDown, ghostWindow, convertButton(button)));
} else {
}
else {
handled = false;
}
break;
@@ -1046,7 +1055,8 @@ bool GHOST_SystemCarbon::handleMouseDown(EventRef event)
if (macState == 2) { // always ok
::ZoomWindow(window, part, true);
ghostWindow->setMac_windowState(1);
} else { // need to force size again
}
else { // need to force size again
// GHOST_TUns32 scr_x,scr_y; /*unused*/
Rect outAvailableRect;
@@ -1186,7 +1196,8 @@ GHOST_TUns8* GHOST_SystemCarbon::getClipboard(bool selection) const
if (temp_buff) {
return temp_buff;
} else {
}
else {
return NULL;
}
}

View File

@@ -193,7 +193,9 @@ public:
/**
* @see GHOST_ISystem
*/
int toggleConsole(int action) { return 0; }
int toggleConsole(int action) {
return 0;
}
protected:
/**

View File

@@ -227,7 +227,9 @@ public:
/**
* @see GHOST_ISystem
*/
int toggleConsole(int action) { return 0; }
int toggleConsole(int action) {
return 0;
}
protected:

View File

@@ -76,8 +76,8 @@ public:
GHOST_TDrawingContextType type,
bool stereoVisual,
const GHOST_TUns16 numOfAASamples,
const GHOST_TEmbedderWindowID parentWindow
) {
const GHOST_TEmbedderWindowID parentWindow)
{
return new GHOST_WindowNULL(this, title, left, top, width, height, state, parentWindow, type, stereoVisual, 1);
}
};

View File

@@ -52,17 +52,17 @@ public:
/**
* Determine the base dir in which shared resources are located. It will first try to use
* "unpack and run" path, then look for properly installed path, not including versioning.
* "unpack and run" path, then look for properly installed path, including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
virtual const GHOST_TUns8* getSystemDir() const = 0;
virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const = 0;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
virtual const GHOST_TUns8* getUserDir() const = 0;
virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const = 0;
/**
* Determine the directory of the current binary

View File

@@ -44,20 +44,22 @@ GHOST_SystemPathsCarbon::~GHOST_SystemPathsCarbon()
{
}
const GHOST_TUns8* GHOST_SystemPathsCarbon::getSystemDir() const
const GHOST_TUns8 *GHOST_SystemPathsCarbon::getSystemDir(int, const char *versionstr) const
{
return (GHOST_TUns8*)"/Library/Application Support";
static char systemPath[1024];
snprintf(systemPath, sizeof(systemPath), "/Library/Application Support/Blender/%s", versionstr);
return (GHOST_TUns8*)systemPath;
}
const GHOST_TUns8* GHOST_SystemPathsCarbon::getUserDir() const
const GHOST_TUns8 *GHOST_SystemPathsCarbon::getUserDir(int, const char *versionstr) const
{
static char usrPath[256] = "";
static char usrPath[1024];
char *env = getenv("HOME");
if (env) {
strncpy(usrPath, env, 245);
usrPath[245]=0;
strcat(usrPath, "/Library/Application Support");
snprintf(usrPath, sizeof(usrPath), "%s/Library/Application Support/Blender/%s", env, versionstr);
return (GHOST_TUns8*)usrPath;
}
else

View File

@@ -60,17 +60,17 @@ public:
/**
* Determine the base dir in which shared resources are located. It will first try to use
* "unpack and run" path, then look for properly installed path, not including versioning.
* "unpack and run" path, then look for properly installed path, including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
virtual const GHOST_TUns8* getSystemDir() const;
virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
virtual const GHOST_TUns8* getUserDir() const;
virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const;
/**
* Determine the directory of the current binary

View File

@@ -54,17 +54,17 @@ public:
/**
* Determine the base dir in which shared resources are located. It will first try to use
* "unpack and run" path, then look for properly installed path, not including versioning.
* "unpack and run" path, then look for properly installed path, including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
virtual const GHOST_TUns8* getSystemDir() const;
virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
virtual const GHOST_TUns8* getUserDir() const;
virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const;
/**
* Determine the directory of the current binary

View File

@@ -50,9 +50,9 @@ GHOST_SystemPathsCocoa::~GHOST_SystemPathsCocoa()
#pragma mark Base directories retrieval
const GHOST_TUns8* GHOST_SystemPathsCocoa::getSystemDir() const
const GHOST_TUns8* GHOST_SystemPathsCocoa::getSystemDir(int, const char *versionstr) const
{
static GHOST_TUns8 tempPath[512] = "";
static char tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *basePath;
NSArray *paths;
@@ -66,15 +66,15 @@ const GHOST_TUns8* GHOST_SystemPathsCocoa::getSystemDir() const
return NULL;
}
strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
snprintf(tempPath, sizeof(tempPath), "%s/Blender/%s", [basePath cStringUsingEncoding:NSASCIIStringEncoding], versionstr);
[pool drain];
return tempPath;
return (GHOST_TUns8*)tempPath;
}
const GHOST_TUns8* GHOST_SystemPathsCocoa::getUserDir() const
const GHOST_TUns8* GHOST_SystemPathsCocoa::getUserDir(int, const char *versionstr) const
{
static GHOST_TUns8 tempPath[512] = "";
static char tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *basePath;
NSArray *paths;
@@ -88,10 +88,10 @@ const GHOST_TUns8* GHOST_SystemPathsCocoa::getUserDir() const
return NULL;
}
strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
snprintf(tempPath, sizeof(tempPath), "%s/Blender/%s", [basePath cStringUsingEncoding:NSASCIIStringEncoding], versionstr);
[pool drain];
return tempPath;
return (GHOST_TUns8*)tempPath;
}
const GHOST_TUns8* GHOST_SystemPathsCocoa::getBinaryDir() const

View File

@@ -69,9 +69,9 @@ GHOST_SystemPathsWin32::~GHOST_SystemPathsWin32()
{
}
const GHOST_TUns8* GHOST_SystemPathsWin32::getSystemDir() const
const GHOST_TUns8 *GHOST_SystemPathsWin32::getSystemDir(int, const char *versionstr) const
{
static char knownpath[MAX_PATH*3] = {0}; /* 1 utf-16 might translante into 3 utf-8. 2 utf-16 translates into 4 utf-8*/
static char knownpath[MAX_PATH * 3 + 128] = {0}; /* 1 utf-16 might translante into 3 utf-8. 2 utf-16 translates into 4 utf-8*/
wchar_t knownpath_16[MAX_PATH];
HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16);
@@ -79,15 +79,17 @@ const GHOST_TUns8* GHOST_SystemPathsWin32::getSystemDir() const
if (hResult == S_OK)
{
conv_utf_16_to_8(knownpath_16, knownpath, MAX_PATH * 3);
strcat(knownpath, "\\Blender Foundation\\Blender\\");
strcat(knownpath, versionstr);
return (GHOST_TUns8*)knownpath;
}
return NULL;
}
const GHOST_TUns8* GHOST_SystemPathsWin32::getUserDir() const
const GHOST_TUns8 *GHOST_SystemPathsWin32::getUserDir(int, const char *versionstr) const
{
static char knownpath[MAX_PATH*3] = {0};
static char knownpath[MAX_PATH * 3 + 128] = {0};
wchar_t knownpath_16[MAX_PATH];
HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16);
@@ -95,6 +97,8 @@ const GHOST_TUns8* GHOST_SystemPathsWin32::getUserDir() const
if (hResult == S_OK)
{
conv_utf_16_to_8(knownpath_16, knownpath, MAX_PATH * 3);
strcat(knownpath, "\\Blender Foundation\\Blender\\");
strcat(knownpath, versionstr);
return (GHOST_TUns8*)knownpath;
}

View File

@@ -64,17 +64,17 @@ public:
/**
* Determine the base dir in which shared resources are located. It will first try to use
* "unpack and run" path, then look for properly installed path, not including versioning.
* "unpack and run" path, then look for properly installed path, including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/).
*/
const GHOST_TUns8* getSystemDir() const;
const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/).
*/
const GHOST_TUns8* getUserDir() const;
const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const;
/**
* Determine the directory of the current binary

View File

@@ -41,10 +41,8 @@
#include <stdio.h> // for fprintf only
#include <cstdlib> // for exit
#ifdef WITH_XDG_USER_DIRS
#include <pwd.h> // for get home without use getenv()
#include <limits.h> // for PATH_MAX
#endif
#ifdef PREFIX
static const char *static_path = PREFIX "/share";
@@ -60,35 +58,51 @@ GHOST_SystemPathsX11::~GHOST_SystemPathsX11()
{
}
const GHOST_TUns8 *GHOST_SystemPathsX11::getSystemDir() const
const GHOST_TUns8 *GHOST_SystemPathsX11::getSystemDir(int, const char *versionstr) const
{
/* no prefix assumes a portable build which only uses bundled scripts */
return (const GHOST_TUns8 *)static_path;
if(static_path) {
static char system_path[PATH_MAX];
snprintf(system_path, sizeof(system_path), "%s/blender/%s", static_path, versionstr);
return (GHOST_TUns8*)system_path;
}
const GHOST_TUns8 *GHOST_SystemPathsX11::getUserDir() const
return NULL;
}
const GHOST_TUns8 *GHOST_SystemPathsX11::getUserDir(int version, const char *versionstr) const
{
#ifndef WITH_XDG_USER_DIRS
return (const GHOST_TUns8 *)getenv("HOME");
#else /* WITH_XDG_USER_DIRS */
static char user_path[PATH_MAX];
/* in blender 2.64, we migrate to XDG. to ensure the copy previous settings
* operator works we give a different path depending on the requested version */
if(version < 264) {
const char *home = getenv("HOME");
if(home) {
snprintf(user_path, sizeof(user_path), "%s/.blender/%s", home, versionstr);
return (GHOST_TUns8*)user_path;
}
return NULL;
}
else {
const char *home= getenv("XDG_CONFIG_HOME");
if (home) {
return (const GHOST_TUns8 *)home;
snprintf(user_path, sizeof(user_path), "%s/blender/%s", home, versionstr);
}
else {
static char user_path[PATH_MAX];
home= getenv("HOME");
if (home == NULL) {
if (home == NULL)
home= getpwuid(getuid())->pw_dir;
snprintf(user_path, sizeof(user_path), "%s/.config/blender/%s", home, versionstr);
}
snprintf(user_path, sizeof(user_path), "%s/.config", home);
return (const GHOST_TUns8 *)user_path;
}
#endif /* WITH_XDG_USER_DIRS */
}
const GHOST_TUns8 *GHOST_SystemPathsX11::getBinaryDir() const

View File

@@ -52,17 +52,17 @@ public:
/**
* Determine the base dir in which shared resources are located. It will first try to use
* "unpack and run" path, then look for properly installed path, not including versioning.
* "unpack and run" path, then look for properly installed path, including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
const GHOST_TUns8 *getSystemDir() const;
const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
const GHOST_TUns8 *getUserDir() const;
const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const;
/**
* Determine the directory of the current binary

View File

@@ -146,7 +146,7 @@ GHOST_SystemSDL::getModifierKeys(GHOST_ModifierKeys& keys) const
return GHOST_kSuccess;
}
#define GXMAP(k,x,y) case x: k= y; break;
#define GXMAP(k, x, y) case x: k = y; break
static GHOST_TKey
convertSDLKey(SDL_Scancode key)
@@ -155,13 +155,17 @@ convertSDLKey(SDL_Scancode key)
if ((key >= SDL_SCANCODE_A) && (key <= SDL_SCANCODE_Z)) {
type = GHOST_TKey(key - SDL_SCANCODE_A + int(GHOST_kKeyA));
} else if ((key >= SDL_SCANCODE_1) && (key <= SDL_SCANCODE_0)) {
}
else if ((key >= SDL_SCANCODE_1) && (key <= SDL_SCANCODE_0)) {
type = (key == SDL_SCANCODE_0) ? GHOST_kKey0 : GHOST_TKey(key - SDL_SCANCODE_1 + int(GHOST_kKey1));
} else if ((key >= SDL_SCANCODE_F1) && (key <= SDL_SCANCODE_F12)) {
}
else if ((key >= SDL_SCANCODE_F1) && (key <= SDL_SCANCODE_F12)) {
type = GHOST_TKey(key - SDL_SCANCODE_F1 + int(GHOST_kKeyF1));
} else if ((key >= SDL_SCANCODE_F13) && (key <= SDL_SCANCODE_F24)) {
}
else if ((key >= SDL_SCANCODE_F13) && (key <= SDL_SCANCODE_F24)) {
type = GHOST_TKey(key - SDL_SCANCODE_F13 + int(GHOST_kKeyF13));
} else {
}
else {
switch (key) {
/* TODO SDL_SCANCODE_NONUSBACKSLASH */
@@ -329,7 +333,8 @@ GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win); /* wrap */
window->setCursorGrabAccum(x_accum + (x_root - x_new), y_accum + (y_root - y_new));
// m_last_warp= lastEventTime(xme.time);
} else {
}
else {
// setCursorPosition(x_new, y_new); /* wrap but don't accumulate */
SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win);
}
@@ -535,7 +540,8 @@ GHOST_SystemSDL::processEvents(bool waitForEvent)
if (next == GHOST_kFireTimeNever) {
SDL_WaitEventTimeout(NULL, -1);
//SleepTillEvent(m_display, -1);
} else {
}
else {
GHOST_TInt64 maxSleep = next - getMilliSeconds();
if (maxSleep >= 0) {

View File

@@ -281,7 +281,8 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent)
if (next == GHOST_kFireTimeNever) {
::WaitMessage();
} else if(maxSleep >= 0.0) {
}
else if (maxSleep >= 0.0) {
::SetTimer(NULL, 0, maxSleep, NULL);
::WaitMessage();
::KillTimer(NULL, 0);
@@ -498,8 +499,7 @@ GHOST_TKey GHOST_SystemWin32::hardKey(GHOST_IWindow *window, RAWINPUT const& raw
modifiers.set(modifier, (bool)*keyDown);
system->storeModifierKeys(modifiers);
}
else
{
else {
key = GHOST_kKeyUnknown;
}
}
@@ -674,7 +674,8 @@ GHOST_EventCursor* GHOST_SystemWin32::processCursorEvent(GHOST_TEventType type,
* setCursorPosition call will cause a new event after */
system->setCursorPosition(x_new, y_new); /* wrap */
window->setCursorGrabAccum(x_accum + (x_screen - x_new), y_accum + (y_screen - y_new));
}else{
}
else {
return new GHOST_EventCursor(system->getMilliSeconds(),
GHOST_kEventCursorMove,
window,
@@ -1003,7 +1004,8 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
window->registerMouseClickEvent(0);
if ((short) HIWORD(wParam) == XBUTTON1) {
event = processButtonEvent(GHOST_kEventButtonDown, window, GHOST_kButtonMaskButton4);
}else if((short) HIWORD(wParam) == XBUTTON2){
}
else if ((short) HIWORD(wParam) == XBUTTON2) {
event = processButtonEvent(GHOST_kEventButtonDown, window, GHOST_kButtonMaskButton5);
}
break;
@@ -1023,7 +1025,8 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
window->registerMouseClickEvent(1);
if ((short) HIWORD(wParam) == XBUTTON1) {
event = processButtonEvent(GHOST_kEventButtonUp, window, GHOST_kButtonMaskButton4);
}else if((short) HIWORD(wParam) == XBUTTON2){
}
else if ((short) HIWORD(wParam) == XBUTTON2) {
event = processButtonEvent(GHOST_kEventButtonUp, window, GHOST_kButtonMaskButton5);
}
break;
@@ -1281,7 +1284,8 @@ GHOST_TUns8* GHOST_SystemWin32::getClipboard(bool selection) const
CloseClipboard();
return (GHOST_TUns8 *)temp_buff;
} else if ( IsClipboardFormatAvailable(CF_TEXT) && OpenClipboard(NULL) ) {
}
else if (IsClipboardFormatAvailable(CF_TEXT) && OpenClipboard(NULL) ) {
char *buffer;
size_t len = 0;
HANDLE hData = GetClipboardData(CF_TEXT);
@@ -1306,7 +1310,8 @@ GHOST_TUns8* GHOST_SystemWin32::getClipboard(bool selection) const
CloseClipboard();
return (GHOST_TUns8 *)temp_buff;
} else {
}
else {
return NULL;
}
}
@@ -1332,7 +1337,8 @@ void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
SetClipboardData(CF_UNICODETEXT, clipbuffer);
}
CloseClipboard();
} else {
}
else {
return;
}
}

View File

@@ -148,7 +148,8 @@ bool GHOST_TimerManager::fireTimer(GHOST_TUns64 time, GHOST_TimerTask* task)
task->setNext(next);
return true;
} else {
}
else {
return false;
}
}

View File

@@ -116,7 +116,8 @@ GHOST_TSuccess GHOST_Window::setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_Rec
m_cursorGrabBounds.m_l = m_cursorGrabBounds.m_r = -1;
else if (bounds) {
m_cursorGrabBounds = *bounds;
} else { /* if bounds not defined, use window */
}
else { /* if bounds not defined, use window */
getClientBounds(m_cursorGrabBounds);
}
m_cursorGrab = mode;

View File

@@ -190,12 +190,16 @@ public:
* Sets the progress bar value displayed in the window/application icon
* @param progress The progress % (0.0 to 1.0)
*/
virtual GHOST_TSuccess setProgressBar(float progress) {return GHOST_kFailure;};
virtual GHOST_TSuccess setProgressBar(float progress) {
return GHOST_kFailure;
};
/**
* Hides the progress bar in the icon
*/
virtual GHOST_TSuccess endProgressBar() {return GHOST_kFailure;};
virtual GHOST_TSuccess endProgressBar() {
return GHOST_kFailure;
};
/**
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
@@ -278,7 +282,9 @@ protected:
* Sets the cursor grab on the window using
* native window system calls.
*/
virtual GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) { return GHOST_kSuccess; };
virtual GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) {
return GHOST_kSuccess;
};
/**
* Sets the cursor shape on the window using

View File

@@ -122,7 +122,8 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
// state = state - 8; this was the simple version of above code, doesnt work in gcc 4.0
setMac_windowState(1);
} else
}
else
setMac_windowState(0);
if (state != GHOST_kWindowStateFullScreen) {
@@ -137,14 +138,16 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
if (err != noErr) {
fprintf(stderr, " error creating window %i \n", (int)err);
} else {
}
else {
::SetWRefCon(m_windowRef, (SInt32) this);
setTitle(title);
err = InstallWindowEventHandler(m_windowRef, myWEventHandlerProc, GetEventTypeCount(kWEvents), kWEvents, NULL, NULL);
if (err != noErr) {
fprintf(stderr, " error creating handler %i \n", (int)err);
} else {
}
else {
// ::TransitionWindow (m_windowRef,kWindowZoomTransitionEffect,kWindowShowTransitionAction,NULL);
::ShowWindow(m_windowRef);
::MoveWindow(m_windowRef, left, top, true);
@@ -166,7 +169,7 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
}
}
else {
/*
#if 0
Rect bnds = { top, left, top + height, left + width };
gen2mac("", title255);
m_windowRef = ::NewCWindow(
@@ -178,7 +181,7 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
(WindowRef) - 1L, // Put window before all other windows
0, // Window has minimize box
(SInt32) this); // Store a pointer to the class in the refCon
*/
#endif
//GHOST_PRINT("GHOST_WindowCarbon::GHOST_WindowCarbon(): creating full-screen OpenGL context\n");
setDrawingContextType(GHOST_kDrawingContextTypeOpenGL);; installDrawingContext(GHOST_kDrawingContextTypeOpenGL);
updateDrawingContext();
@@ -265,8 +268,7 @@ void GHOST_WindowCarbon::getClientBounds(GHOST_Rect& bounds) const
{
bounds.m_b -= s_sizeRectSize;
}
else
{
else {
bounds.m_t = bounds.m_b;
}
#endif //GHOST_DRAW_CARBON_GUTTER
@@ -310,7 +312,8 @@ GHOST_TSuccess GHOST_WindowCarbon::setClientSize(GHOST_TUns32 width, GHOST_TUns3
getClientBounds(cBnds);
#ifdef GHOST_DRAW_CARBON_GUTTER
if ((((GHOST_TUns32)cBnds.getWidth()) != width) ||
(((GHOST_TUns32)cBnds.getHeight()) != height+s_sizeRectSize)) {
(((GHOST_TUns32)cBnds.getHeight()) != height + s_sizeRectSize))
{
::SizeWindow(m_windowRef, width, height + s_sizeRectSize, true);
}
#else //GHOST_DRAW_CARBON_GUTTER
@@ -502,14 +505,14 @@ GDHandle device=::GetMainDevice();pixelFormat=::aglChoosePixelFormat(&device,1,s
//GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): created OpenGL context\n");
//::CGGetActiveDisplayList(0, NULL, &m_numDisplays)
success = ::aglSetFullScreen(m_aglCtx, m_fullScreenWidth, m_fullScreenHeight, 75, 0) == GL_TRUE ? GHOST_kSuccess : GHOST_kFailure;
/*
#if 0
if (success == GHOST_kSuccess) {
GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL succeeded\n");
}
else {
GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL failed\n");
}
*/
#endif
}
::aglDestroyPixelFormat(pixelFormat);
}
@@ -608,7 +611,8 @@ void GHOST_WindowCarbon::loadCursor(bool visible, GHOST_TStandardCursor cursor)
if (cursor == GHOST_kStandardCursorCustom && m_customCursor) {
::SetCursor(m_customCursor);
} else {
}
else {
int carbon_cursor;
#define GCMAP(ghostCursor, carbonCursor) case ghostCursor: carbon_cursor = carbonCursor; break

View File

@@ -212,10 +212,14 @@ public:
const GHOST_TabletData *GetTabletData()
{ return &m_tablet; }
{
return &m_tablet;
}
GHOST_TabletData& GetCarbonTabletData()
{ return m_tablet; }
{
return m_tablet;
}
protected:
/**
* Tries to install a rendering context in this window.
@@ -286,14 +290,14 @@ protected:
bool m_fullScreenDirty;
/** specific MacOs X full screen window setting as we use partially system mechanism
values : 0 not maximizable default
1 normal state
2 maximized state
this will be reworked when rebuilding GHOST carbon to use new OS X apis
in order to be unified with GHOST fullscreen/maximised settings
(lukep)
* values : 0 not maximizable default
* 1 normal state
* 2 maximized state
*
* this will be reworked when rebuilding GHOST carbon to use new OS X apis
* in order to be unified with GHOST fullscreen/maximised settings
*
* (lukep)
**/
short mac_windowState;

View File

@@ -243,10 +243,14 @@ public:
const GHOST_TabletData *GetTabletData()
{ return &m_tablet; }
{
return &m_tablet;
}
GHOST_TabletData& GetCocoaTabletData()
{ return m_tablet; }
{
return m_tablet;
}
/**
* Sets the progress bar value displayed in the window/application icon

View File

@@ -54,7 +54,9 @@ private :
public:
const GHOST_TabletData* GetTabletData() { return NULL; }
const GHOST_TabletData *GetTabletData() {
return NULL;
}
GHOST_WindowSDL(GHOST_SystemSDL *system,
const STR_String& title,
@@ -158,7 +160,11 @@ protected:
GHOST_TWindowState
getState() const;
GHOST_TSuccess setOrder(GHOST_TWindowOrder order) { return GHOST_kSuccess; } // TODO
GHOST_TSuccess setOrder(GHOST_TWindowOrder order)
{
// TODO
return GHOST_kSuccess;
}
};

View File

@@ -177,7 +177,8 @@ GHOST_WindowWin32::GHOST_WindowWin32(
hasMinVersionForTaskbar = true;
}
}
} else {
}
else {
if ((versionInfo.dwMajorVersion == 6 && versionInfo.dwMinorVersion >= 1) || versionInfo.dwMajorVersion >= 7) {
hasMinVersionForTaskbar = true;
}
@@ -304,8 +305,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(
// Force an initial paint of the window
::UpdateWindow(m_hWnd);
}
else
{
else {
//invalidate the window
m_hWnd = 0;
}
@@ -480,18 +480,21 @@ void GHOST_WindowWin32::getClientBounds(GHOST_Rect& bounds) const
bounds.m_l = rect.left + sm_cysizeframe;
bounds.m_r = rect.right - sm_cysizeframe;
bounds.m_t = rect.top;
} else if (state == GHOST_kWindowStateEmbedded) {
}
else if (state == GHOST_kWindowStateEmbedded) {
bounds.m_b = rect.bottom;
bounds.m_l = rect.left;
bounds.m_r = rect.right;
bounds.m_t = rect.top;
} else {
}
else {
bounds.m_b = rect.bottom - GetSystemMetrics(SM_CYCAPTION) - sm_cysizeframe * 2;
bounds.m_l = rect.left;
bounds.m_r = rect.right - sm_cysizeframe * 2;
bounds.m_t = rect.top;
}
} else {
}
else {
bounds.m_b = rect.bottom;
bounds.m_l = rect.left;
bounds.m_r = rect.right;
@@ -802,8 +805,7 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp
printf("Failed to get a context....\n");
}
}
else
{
else {
if (m_stereoVisual)
sPreferredFormat.dwFlags |= PFD_STEREO;
@@ -897,7 +899,8 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp
// Return failure so we can trash this window.
success = GHOST_kFailure;
break;
} else {
}
else {
m_multisampleEnabled = GHOST_kSuccess;
printf("Multisample failed to initialized\n");
success = GHOST_kSuccess;
@@ -947,8 +950,7 @@ void GHOST_WindowWin32::lostMouseCapture()
if (m_hasMouseCaptured)
{ m_hasGrabMouse = false;
m_nPressedButtons = 0;
m_hasMouseCaptured = false;
};
m_hasMouseCaptured = false; };
}
void GHOST_WindowWin32::registerMouseClickEvent(int press)
@@ -987,7 +989,8 @@ void GHOST_WindowWin32::loadCursor(bool visible, GHOST_TStandardCursor cursor) c
if (cursor == GHOST_kStandardCursorCustom && m_customCursor) {
::SetCursor(m_customCursor);
} else {
}
else {
// Convert GHOST cursor to Windows OEM cursor
bool success = true;
LPCSTR id;
@@ -1139,7 +1142,8 @@ void GHOST_WindowWin32::processWin32TabletEvent(WPARAM wParam, LPARAM lParam)
}
if (m_maxPressure > 0) {
m_tabletData->Pressure = (float)pkt.pkNormalPressure / (float)m_maxPressure;
} else {
}
else {
m_tabletData->Pressure = 1.0f;
}
@@ -1149,19 +1153,19 @@ void GHOST_WindowWin32::processWin32TabletEvent(WPARAM wParam, LPARAM lParam)
float altRad, azmRad; /* in radians */
/*
from the wintab spec:
orAzimuth Specifies the clockwise rotation of the
cursor about the z axis through a full circular range.
orAltitude Specifies the angle with the x-y plane
through a signed, semicircular range. Positive values
specify an angle upward toward the positive z axis;
negative values specify an angle downward toward the negative z axis.
wintab.h defines .orAltitude as a UINT but documents .orAltitude
as positive for upward angles and negative for downward angles.
WACOM uses negative altitude values to show that the pen is inverted;
therefore we cast .orAltitude as an (int) and then use the absolute value.
* from the wintab spec:
* orAzimuth Specifies the clockwise rotation of the
* cursor about the z axis through a full circular range.
*
* orAltitude Specifies the angle with the x-y plane
* through a signed, semicircular range. Positive values
* specify an angle upward toward the positive z axis;
* negative values specify an angle downward toward the negative z axis.
*
* wintab.h defines .orAltitude as a UINT but documents .orAltitude
* as positive for upward angles and negative for downward angles.
* WACOM uses negative altitude values to show that the pen is inverted;
* therefore we cast .orAltitude as an (int) and then use the absolute value.
*/
/* convert raw fixed point data to radians */
@@ -1175,7 +1179,8 @@ void GHOST_WindowWin32::processWin32TabletEvent(WPARAM wParam, LPARAM lParam)
m_tabletData->Xtilt = sin(azmRad) * vecLen;
m_tabletData->Ytilt = (float)(sin(M_PI / 2.0 - azmRad) * vecLen);
} else {
}
else {
m_tabletData->Xtilt = 0.0f;
m_tabletData->Ytilt = 0.0f;
}
@@ -1290,7 +1295,9 @@ static int WeightPixelFormat(PIXELFORMATDESCRIPTOR& pfd)
!(pfd.dwFlags & PFD_DOUBLEBUFFER) || /* Blender _needs_ this */
(pfd.cDepthBits <= 8) ||
!(pfd.iPixelType == PFD_TYPE_RGBA))
{
return 0;
}
weight = 1; /* it's usable */
@@ -1323,7 +1330,7 @@ static int EnumPixelFormats(HDC hdc)
iPixelFormat = 1; /* careful! PFD numbers are 1 based, not zero based */
/* obtain detailed information about
the device context's first pixel format */
* the device context's first pixel format */
n = 1 + ::DescribePixelFormat(hdc, iPixelFormat,
sizeof(PIXELFORMATDESCRIPTOR), &pfd);

View File

@@ -236,7 +236,9 @@ public:
* Returns the name of the window class.
* @return The name of the window class.
*/
static wchar_t* getWindowClassName() { return s_windowClassName; }
static wchar_t *getWindowClassName() {
return s_windowClassName;
}
/**
* Register a mouse click event (should be called
@@ -265,7 +267,9 @@ public:
void loadCursor(bool visible, GHOST_TStandardCursor cursorShape) const;
const GHOST_TabletData *GetTabletData()
{ return m_tabletData; }
{
return m_tabletData;
}
void processWin32TabletInitEvent();
void processWin32TabletEvent(WPARAM wParam, LPARAM lParam);

View File

@@ -309,8 +309,7 @@ int processEvent(GHOST_EventHandle hEvent, GHOST_TUserDataPtr userData)
{
view_rotz += 5.f;
}
else
{
else {
view_rotz -= 5.f;
}
}
@@ -356,8 +355,7 @@ int processEvent(GHOST_EventHandle hEvent, GHOST_TUserDataPtr userData)
FALSE /* stereo flag */);
}
else
{
else {
GHOST_EndFullScreen(shSystem);
sFullScreenWindow = 0;
}
@@ -380,8 +378,7 @@ int processEvent(GHOST_EventHandle hEvent, GHOST_TUserDataPtr userData)
{
sTestTimer = GHOST_InstallTimer(shSystem, 0, 1000, testTimerProc, NULL);
}
else
{
else {
GHOST_RemoveTimer(shSystem, sTestTimer);
sTestTimer = 0;
}
@@ -414,8 +411,7 @@ int processEvent(GHOST_EventHandle hEvent, GHOST_TUserDataPtr userData)
{
sExitRequested = 1;
}
else
{
else {
if (sGearsTimer)
{
GHOST_RemoveTimer(shSystem, sGearsTimer);
@@ -547,8 +543,7 @@ static void gearsTimerProc(GHOST_TimerTaskHandle hTask, GHOST_TUns64 time)
/* Running full screen */
GHOST_InvalidateWindow(sFullScreenWindow);
}
else
{
else {
if (GHOST_ValidWindow(shSystem, hWindow))
{
GHOST_InvalidateWindow(hWindow);

View File

@@ -278,8 +278,7 @@ static void View(GHOST_IWindow* window, bool stereo, int eye = 0)
// it -is- stereo)
glViewport(0, 0, bnds.getWidth(), bnds.getHeight());
}
else
{ // generic cross platform above-below stereo
else { // generic cross platform above-below stereo
noOfScanlines = (bnds.getHeight() - verticalBlankingInterval) / 2;
switch (eye)
{
@@ -294,8 +293,7 @@ static void View(GHOST_IWindow* window, bool stereo, int eye = 0)
}
}
}
else
{
else {
noOfScanlines = bnds.getHeight();
lowerScanline = 0;
}
@@ -324,8 +322,7 @@ static void View(GHOST_IWindow* window, bool stereo, int eye = 0)
break;
}
}
else
{
else {
// left = -w;
// right = w;
// bottom = -h;
@@ -479,8 +476,7 @@ bool Application::processEvent(GHOST_IEvent* event)
{
view_rotz += 5.f;
}
else
{
else {
view_rotz -= 5.f;
}
}
@@ -542,7 +538,8 @@ bool Application::processEvent(GHOST_IEvent* event)
}
m_system->getModifierKeyState(GHOST_kModifierKeyRightShift, down);
if (down) {
std::cout << "right shift down\n"; }
std::cout << "right shift down\n";
}
m_system->getModifierKeyState(GHOST_kModifierKeyLeftAlt, down);
if (down) {
std::cout << "left Alt down\n";
@@ -649,8 +646,7 @@ bool Application::processEvent(GHOST_IEvent* event)
RenderScene();
glPopMatrix();
}
else
{
else {
View(window2, stereo);
glPushMatrix();
RenderCamera();

View File

@@ -27,37 +27,47 @@
#include "Basic.h"
int min_i(int a, int b) {
int min_i(int a, int b)
{
return (a < b) ? a : b;
}
int max_i(int a, int b) {
int max_i(int a, int b)
{
return (b < a) ? a : b;
}
int clamp_i(int val, int min, int max) {
int clamp_i(int val, int min, int max)
{
return min_i(max_i(val, min), max);
}
float min_f(float a, float b) {
float min_f(float a, float b)
{
return (a < b) ? a : b;
}
float max_f(float a, float b) {
float max_f(float a, float b)
{
return (b < a) ? a : b;
}
float clamp_f(float val, float min, float max) {
float clamp_f(float val, float min, float max)
{
return min_f(max_f(val, min), max);
}
void rect_copy(int dst[2][2], int src[2][2]) {
void rect_copy(int dst[2][2], int src[2][2])
{
dst[0][0] = src[0][0], dst[0][1] = src[0][1];
dst[1][0] = src[1][0], dst[1][1] = src[1][1];
}
int rect_contains_pt(int rect[2][2], int pt[2]){
int rect_contains_pt(int rect[2][2], int pt[2])
{
return ((rect[0][0] <= pt[0] && pt[0] <= rect[1][0]) &&
(rect[0][1] <= pt[1] && pt[1] <= rect[1][1]));
}
int rect_width(int rect[2][2]) {
int rect_width(int rect[2][2])
{
return (rect[1][0] - rect[0][0]);
}
int rect_height(int rect[2][2]) {
int rect_height(int rect[2][2])
{
return (rect[1][1] - rect[0][1]);
}

View File

@@ -152,7 +152,8 @@ static void mainwindow_do_draw(MainWindow *mw) {
if (mw->lmbut[0]) {
glClearColor(0.5, 0.5, 0.5, 1);
} else {
}
else {
glClearColor(1, 1, 1, 1);
}
glClear(GL_COLOR_BUFFER_BIT);
@@ -239,9 +240,11 @@ static void mainwindow_do_button(MainWindow *mw, int which, int press) {
mw->lmbut[0] = press;
mw->tmouse[0] = mw->lmouse[0], mw->tmouse[1] = mw->lmouse[1];
GHOST_InvalidateWindow(mw->win);
} else if (which==GHOST_kButtonMaskLeft) {
}
else if (which == GHOST_kButtonMaskLeft) {
mw->lmbut[1] = press;
} else if (which==GHOST_kButtonMaskLeft) {
}
else if (which == GHOST_kButtonMaskLeft) {
mw->lmbut[2] = press;
}
}
@@ -312,7 +315,8 @@ MainWindow *mainwindow_new(MultiTestApp *app) {
GHOST_InstallTimer(sys, 1000, 10000, mainwindow_timer_proc, mw);
return mw;
} else {
}
else {
return NULL;
}
}
@@ -421,7 +425,8 @@ static void loggerwindow_do_draw(LoggerWindow *lw) {
if (scrollbar_is_scrolling(lw->scroll)) {
glColor3f(0.6, 0.7, 0.5);
} else {
}
else {
glColor3f(0.9, 0.9, 0.92);
}
rect_bevel_smooth(sb_thumb, 1);
@@ -447,7 +452,8 @@ static void loggerwindow_do_draw(LoggerWindow *lw) {
if (lw->fonttexid == -1) {
glRasterPos2i(x_pos, y_pos);
BMF_DrawString(lw->font, line);
} else {
}
else {
BMF_DrawStringTexture(lw->font, line, x_pos, y_pos, 0.0);
}
#else
@@ -485,16 +491,19 @@ static void loggerwindow_do_button(LoggerWindow *lw, int which, int press) {
GHOST_SetCursorShape(lw->win, GHOST_kStandardCursorUpDown);
GHOST_InvalidateWindow(lw->win);
}
} else {
}
else {
if (scrollbar_is_scrolling(lw->scroll)) {
scrollbar_stop_scrolling(lw->scroll);
GHOST_SetCursorShape(lw->win, GHOST_kStandardCursorDefault);
GHOST_InvalidateWindow(lw->win);
}
}
} else if (which==GHOST_kButtonMaskMiddle) {
}
else if (which == GHOST_kButtonMaskMiddle) {
lw->lmbut[1] = press;
} else if (which==GHOST_kButtonMaskRight) {
}
else if (which == GHOST_kButtonMaskRight) {
lw->lmbut[2] = press;
}
}
@@ -582,7 +591,8 @@ LoggerWindow *loggerwindow_new(MultiTestApp *app) {
loggerwindow_do_reshape(lw);
return lw;
} else {
}
else {
return NULL;
}
}
@@ -748,7 +758,8 @@ ExtraWindow *extrawindow_new(MultiTestApp *app) {
GHOST_SetWindowUserData(ew->win, windowdata_new(ew, extrawindow_handle));
return ew;
} else {
}
else {
return NULL;
}
}
@@ -788,7 +799,8 @@ static int multitest_event_handler(GHOST_EventHandle evt, GHOST_TUserDataPtr dat
WindowData *wb = GHOST_GetWindowUserData(win);
windowdata_handle(wb, evt);
} else {
}
else {
GHOST_TEventType type = GHOST_GetEventType(evt);
/* GHOST_kEventQuit are the only 'system' events,
@@ -851,7 +863,8 @@ void multitestapp_free_extrawindow(MultiTestApp *app) {
void multitestapp_toggle_extra_window(MultiTestApp *app) {
if (app->extra) {
multitestapp_free_extrawindow(app);
} else {
}
else {
app->extra = extrawindow_new(app);
}
}

View File

@@ -45,19 +45,23 @@ struct _ScrollBar {
float scrolloffs;
};
static int scrollbar_get_thumbH(ScrollBar *sb) {
static int scrollbar_get_thumbH(ScrollBar *sb)
{
int scrollable_h = rect_height(sb->rect) - 2 * sb->inset;
return clamp_i(sb->thumbpct * scrollable_h, sb->minthumb, scrollable_h);
}
static int scrollbar_get_thumbableH(ScrollBar *sb) {
static int scrollbar_get_thumbableH(ScrollBar *sb)
{
int scrollable_h = rect_height(sb->rect) - 2 * sb->inset;
int thumb_h = scrollbar_get_thumbH(sb);
return scrollable_h - thumb_h;
}
static float scrollbar_co_to_pos(ScrollBar *sb, int yco) {
static float scrollbar_co_to_pos(ScrollBar *sb, int yco)
{
int thumb_h = scrollbar_get_thumbH(sb);
int thumbable_h = scrollbar_get_thumbableH(sb);
int thumbable_y = (sb->rect[0][1] + sb->inset) + thumb_h / 2;
@@ -67,7 +71,8 @@ static float scrollbar_co_to_pos(ScrollBar *sb, int yco) {
/**/
ScrollBar *scrollbar_new(int inset, int minthumb) {
ScrollBar *scrollbar_new(int inset, int minthumb)
{
ScrollBar *sb = MEM_callocN(sizeof(*sb), "scrollbar_new");
sb->inset = inset;
sb->minthumb = minthumb;
@@ -75,7 +80,8 @@ ScrollBar *scrollbar_new(int inset, int minthumb) {
return sb;
}
void scrollbar_get_thumb(ScrollBar *sb, int thumb_r[2][2]) {
void scrollbar_get_thumb(ScrollBar *sb, int thumb_r[2][2])
{
int thumb_h = scrollbar_get_thumbH(sb);
int thumbable_h = scrollbar_get_thumbableH(sb);
@@ -86,14 +92,16 @@ void scrollbar_get_thumb(ScrollBar *sb, int thumb_r[2][2]) {
thumb_r[1][1] = thumb_r[0][1] + thumb_h;
}
int scrollbar_is_scrolling(ScrollBar *sb) {
int scrollbar_is_scrolling(ScrollBar *sb)
{
return sb->scrolling;
}
int scrollbar_contains_pt(ScrollBar *sb, int pt[2]) {
return rect_contains_pt(sb->rect, pt);
}
void scrollbar_start_scrolling(ScrollBar *sb, int yco) {
void scrollbar_start_scrolling(ScrollBar *sb, int yco)
{
int thumb_h_2 = scrollbar_get_thumbH(sb) / 2;
int thumbable_h = scrollbar_get_thumbableH(sb);
float npos = scrollbar_co_to_pos(sb, yco);
@@ -106,36 +114,45 @@ void scrollbar_start_scrolling(ScrollBar *sb, int yco) {
sb->scrolling = 1;
sb->thumbpos = clamp_f(npos + sb->scrolloffs, 0.0, 1.0);
}
void scrollbar_keep_scrolling(ScrollBar *sb, int yco) {
void scrollbar_keep_scrolling(ScrollBar *sb, int yco)
{
float npos = scrollbar_co_to_pos(sb, yco);
sb->thumbpos = clamp_f(npos + sb->scrolloffs, 0.0, 1.0);
}
void scrollbar_stop_scrolling(ScrollBar *sb) {
void scrollbar_stop_scrolling(ScrollBar *sb)
{
sb->scrolling = 0;
sb->scrolloffs = 0.0;
}
void scrollbar_set_thumbpct(ScrollBar *sb, float pct) {
void scrollbar_set_thumbpct(ScrollBar *sb, float pct)
{
sb->thumbpct = pct;
}
void scrollbar_set_thumbpos(ScrollBar *sb, float pos) {
void scrollbar_set_thumbpos(ScrollBar *sb, float pos)
{
sb->thumbpos = clamp_f(pos, 0.0, 1.0);
}
void scrollbar_set_rect(ScrollBar *sb, int rect[2][2]) {
void scrollbar_set_rect(ScrollBar *sb, int rect[2][2])
{
rect_copy(sb->rect, rect);
}
float scrollbar_get_thumbpct(ScrollBar *sb) {
float scrollbar_get_thumbpct(ScrollBar *sb)
{
return sb->thumbpct;
}
float scrollbar_get_thumbpos(ScrollBar *sb) {
float scrollbar_get_thumbpos(ScrollBar *sb)
{
return sb->thumbpos;
}
void scrollbar_get_rect(ScrollBar *sb, int rect_r[2][2]) {
void scrollbar_get_rect(ScrollBar *sb, int rect_r[2][2])
{
rect_copy(rect_r, sb->rect);
}
void scrollbar_free(ScrollBar *sb) {
void scrollbar_free(ScrollBar *sb)
{
MEM_freeN(sb);
}

View File

@@ -35,7 +35,8 @@
#include "Util.h"
void* memdbl(void *mem, int *size_pr, int item_size) {
void *memdbl(void *mem, int *size_pr, int item_size)
{
int cur_size = *size_pr;
int new_size = cur_size ? (cur_size * 2) : 1;
void *nmem = MEM_mallocN(new_size * item_size, "memdbl");
@@ -47,7 +48,8 @@ void* memdbl(void *mem, int *size_pr, int item_size) {
return nmem;
}
char* string_dup(char *str) {
char *string_dup(char *str)
{
int len = strlen(str);
char *nstr = MEM_mallocN(len + 1, "string_dup");
@@ -56,7 +58,8 @@ char* string_dup(char *str) {
return nstr;
}
void fatal(char *fmt, ...) {
void fatal(char *fmt, ...)
{
va_list ap;
fprintf(stderr, "FATAL: ");

View File

@@ -38,7 +38,8 @@ struct _WindowData {
WindowDataHandler handler;
};
WindowData *windowdata_new(void *data, WindowDataHandler handler) {
WindowData *windowdata_new(void *data, WindowDataHandler handler)
{
WindowData *wb = MEM_mallocN(sizeof(*wb), "windowdata_new");
wb->data = data;
wb->handler = handler;
@@ -46,10 +47,12 @@ WindowData *windowdata_new(void *data, WindowDataHandler handler) {
return wb;
}
void windowdata_handle(WindowData *wb, GHOST_EventHandle evt) {
void windowdata_handle(WindowData *wb, GHOST_EventHandle evt)
{
wb->handler(wb->data, evt);
}
void windowdata_free(WindowData *wb) {
void windowdata_free(WindowData *wb)
{
MEM_freeN(wb);
}

View File

@@ -27,12 +27,7 @@
/** \file guardedalloc/intern/mallocn.c
* \ingroup MEM
*/
/**
* Copyright (C) 2001 NaN Technologies B.V.
*
* Guarded memory allocation, and boundary-write detection.
*/
@@ -65,7 +60,8 @@
// #define DEBUG_MEMCOUNTER
#ifdef DEBUG_MEMCOUNTER
#define DEBUG_MEMCOUNTER_ERROR_VAL 0 /* set this to the value that isn't being freed */
/* set this to the value that isn't being freed */
# define DEBUG_MEMCOUNTER_ERROR_VAL 0
static int _mallocn_count = 0;
/* breakpoint here */
@@ -79,13 +75,11 @@ static void memcount_raise(const char *name)
/* Data definition */
/* --------------------------------------------------------------------- */
/* all memory chunks are put in linked lists */
typedef struct localLink
{
typedef struct localLink {
struct localLink *next, *prev;
} localLink;
typedef struct localListBase
{
typedef struct localListBase {
void *first, *last;
} localListBase;
@@ -133,7 +127,8 @@ static const char *check_memlist(MemHead *memh);
#define MEMTAG3 MAKE_ID('O', 'C', 'K', '!')
#define MEMFREE MAKE_ID('F', 'R', 'E', 'E')
#define MEMNEXT(x) ((MemHead *)(((char *) x) - ((char *) & (((MemHead *)0)->next))))
#define MEMNEXT(x) \
((MemHead *)(((char *) x) - ((char *) &(((MemHead *)0)->next))))
/* --------------------------------------------------------------------- */
/* vars */
@@ -231,9 +226,11 @@ size_t MEM_allocN_len(void *vmemh)
memh--;
return memh->len;
} else
}
else {
return 0;
}
}
void *MEM_dupallocN(void *vmemh)
{
@@ -325,7 +322,8 @@ void *MEM_mallocN(size_t len, const char *str)
return (++memh);
}
mem_unlock_thread();
print_error("Malloc returns null: len=" SIZET_FORMAT " in %s, total %u\n", SIZET_ARG(len), str, mem_in_use);
print_error("Malloc returns null: len=" SIZET_FORMAT " in %s, total %u\n",
SIZET_ARG(len), str, mem_in_use);
return NULL;
}
@@ -350,7 +348,8 @@ void *MEM_callocN(size_t len, const char *str)
return (++memh);
}
mem_unlock_thread();
print_error("Calloc returns null: len=" SIZET_FORMAT " in %s, total %u\n", SIZET_ARG(len), str, mem_in_use);
print_error("Calloc returns null: len=" SIZET_FORMAT " in %s, total %u\n",
SIZET_ARG(len), str, mem_in_use);
return NULL;
}
@@ -381,7 +380,9 @@ void *MEM_mapallocN(size_t len, const char *str)
}
else {
mem_unlock_thread();
print_error("Mapalloc returns null, fallback to regular malloc: len=" SIZET_FORMAT " in %s, total %u\n", SIZET_ARG(len), str, mmap_in_use);
print_error("Mapalloc returns null, fallback to regular malloc: "
"len=" SIZET_FORMAT " in %s, total %u\n",
SIZET_ARG(len), str, mmap_in_use);
return MEM_callocN(len, str);
}
}
@@ -463,11 +464,14 @@ void MEM_printmemlist_stats(void)
/* sort by length and print */
qsort(printblock, totpb, sizeof(MemPrintBlock), compare_len);
printf("\ntotal memory len: %.3f MB\n", (double)mem_in_use/(double)(1024*1024));
printf("\ntotal memory len: %.3f MB\n",
(double)mem_in_use / (double)(1024 * 1024));
printf(" ITEMS TOTAL-MiB AVERAGE-KiB TYPE\n");
for (a = 0, pb=printblock; a<totpb; a++, pb++)
printf("%6d (%8.3f %8.3f) %s\n", pb->items, (double)pb->len/(double)(1024*1024), (double)pb->len/1024.0/(double)pb->items, pb->name);
for (a = 0, pb = printblock; a < totpb; a++, pb++) {
printf("%6d (%8.3f %8.3f) %s\n",
pb->items, (double)pb->len / (double)(1024 * 1024),
(double)pb->len / 1024.0 / (double)pb->items, pb->name);
}
free(printblock);
mem_unlock_thread();
@@ -477,6 +481,26 @@ void MEM_printmemlist_stats(void)
#endif
}
static const char mem_printmemlist_pydict_script[] =
"mb_userinfo = {}\n"
"totmem = 0\n"
"for mb_item in membase:\n"
" mb_item_user_size = mb_userinfo.setdefault(mb_item['name'], [0,0])\n"
" mb_item_user_size[0] += 1 # Add a user\n"
" mb_item_user_size[1] += mb_item['len'] # Increment the size\n"
" totmem += mb_item['len']\n"
"print('(membase) items:', len(membase), '| unique-names:',\n"
" len(mb_userinfo), '| total-mem:', totmem)\n"
"mb_userinfo_sort = list(mb_userinfo.items())\n"
"for sort_name, sort_func in (('size', lambda a: -a[1][1]),\n"
" ('users', lambda a: -a[1][0]),\n"
" ('name', lambda a: a[0])):\n"
" print('\\nSorting by:', sort_name)\n"
" mb_userinfo_sort.sort(key = sort_func)\n"
" for item in mb_userinfo_sort:\n"
" print('name:%%s, users:%%i, len:%%i' %%\n"
" (item[0], item[1][0], item[1][1]))\n";
/* Prints in python syntax for easy */
static void MEM_printmemlist_internal(int pydict)
{
@@ -489,16 +513,24 @@ static void MEM_printmemlist_internal( int pydict )
if (pydict) {
print_error("# membase_debug.py\n");
print_error("membase = [\\\n");
print_error("membase = [\n");
}
while (membl) {
if (pydict) {
fprintf(stderr, "{'len':" SIZET_FORMAT ", 'name':'''%s''', 'pointer':'%p'},\\\n", SIZET_ARG(membl->len), membl->name, (void *)(membl+1));
} else {
fprintf(stderr,
" {'len':" SIZET_FORMAT ", "
"'name':'''%s''', "
"'pointer':'%p'},\n",
SIZET_ARG(membl->len), membl->name, (void *)(membl + 1));
}
else {
#ifdef DEBUG_MEMCOUNTER
print_error("%s len: " SIZET_FORMAT " %p, count: %d\n", membl->name, SIZET_ARG(membl->len), membl+1, membl->_count);
print_error("%s len: " SIZET_FORMAT " %p, count: %d\n",
membl->name, SIZET_ARG(membl->len), membl + 1,
membl->_count);
#else
print_error("%s len: " SIZET_FORMAT " %p\n", membl->name, SIZET_ARG(membl->len), membl+1);
print_error("%s len: " SIZET_FORMAT " %p\n",
membl->name, SIZET_ARG(membl->len), membl + 1);
#endif
}
if (membl->next)
@@ -507,22 +539,7 @@ static void MEM_printmemlist_internal( int pydict )
}
if (pydict) {
fprintf(stderr, "]\n\n");
fprintf(stderr,
"mb_userinfo = {}\n"
"totmem = 0\n"
"for mb_item in membase:\n"
"\tmb_item_user_size = mb_userinfo.setdefault(mb_item['name'], [0,0])\n"
"\tmb_item_user_size[0] += 1 # Add a user\n"
"\tmb_item_user_size[1] += mb_item['len'] # Increment the size\n"
"\ttotmem += mb_item['len']\n"
"print '(membase) items:', len(membase), '| unique-names:', len(mb_userinfo), '| total-mem:', totmem\n"
"mb_userinfo_sort = mb_userinfo.items()\n"
"for sort_name, sort_func in (('size', lambda a: -a[1][1]), ('users', lambda a: -a[1][0]), ('name', lambda a: a[0])):\n"
"\tprint '\\nSorting by:', sort_name\n"
"\tmb_userinfo_sort.sort(key = sort_func)\n"
"\tfor item in mb_userinfo_sort:\n"
"\t\tprint 'name:%%s, users:%%i, len:%%i' %% (item[0], item[1][0], item[1][1])\n"
);
fprintf(stderr, mem_printmemlist_pydict_script);
}
mem_unlock_thread();
@@ -611,7 +628,10 @@ short MEM_freeN(void *vmemh) /* anders compileertie niet meer */
}
mem_lock_thread();
if ((memh->tag1 == MEMTAG1) && (memh->tag2 == MEMTAG2) && ((memh->len & 0x3) == 0)) {
if ((memh->tag1 == MEMTAG1) &&
(memh->tag2 == MEMTAG2) &&
((memh->len & 0x3) == 0))
{
memt = (MemTail *)(((char *) memh) + sizeof(MemHead) + memh->len);
if (memt->tag3 == MEMTAG3) {
@@ -631,7 +651,8 @@ short MEM_freeN(void *vmemh) /* anders compileertie niet meer */
if (name != NULL) {
if (name != memh->name) MemorY_ErroR(name, "is also corrupt");
}
} else{
}
else {
error = -1;
name = check_memlist(memh);
if (name == NULL)
@@ -743,7 +764,7 @@ static const char *check_memlist(MemHead *memh)
if (forw != back) return ("MORE THAN 1 MEMORYBLOCK CORRUPT");
if (forw == NULL && back == NULL) {
/* geen foute headers gevonden dan maar op zoek naar memblock*/
/* no wrong headers found then but in search of memblock */
forw = membase->first;
if (forw) forw = MEMNEXT(forw);
@@ -773,26 +794,29 @@ static const char *check_memlist(MemHead *memh)
else name = "No name found";
if (forw == memh) {
/* voor alle zekerheid wordt dit block maar uit de lijst gehaald */
/* to be sure but this block is removed from the list */
if (forwok) {
if (backok) {
forwok->next = (MemHead *)&backok->next;
backok->prev = (MemHead *)&forwok->next;
forwok->nextname = backok->name;
} else{
}
else {
forwok->next = NULL;
membase->last = (struct localLink *) &forwok->next;
/* membase->last = (struct Link *) &forwok->next; */
}
} else{
}
else {
if (backok) {
backok->prev = NULL;
membase->first = &backok->next;
} else{
}
else {
membase->first = membase->last = NULL;
}
}
} else{
}
else {
MemorY_ErroR(name, "Additional error in header");
return("Additional error in header");
}

View File

@@ -29,8 +29,7 @@
* \ingroup MEM
*/
#if defined(WIN32)
#ifdef WIN32
#include <windows.h>
#include <errno.h>
@@ -56,13 +55,11 @@
/* local storage definitions */
/* --------------------------------------------------------------------- */
/* all memory mapped chunks are put in linked lists */
typedef struct mmapLink
{
typedef struct mmapLink {
struct mmapLink *next, *prev;
} mmapLink;
typedef struct mmapListBase
{
typedef struct mmapListBase {
void *first, *last;
} mmapListBase;
@@ -109,12 +106,12 @@ void *mmap(void *UNUSED(start), size_t len, int prot, int flags, int fd, off_t o
return MAP_FAILED;
}
/*
#if 0
if ( fd == -1 ) {
_set_errno( EBADF );
return MAP_FAILED;
}
*/
#endif
if (fd != -1) {
fhandle = (HANDLE) _get_osfhandle(fd);
@@ -124,7 +121,8 @@ void *mmap(void *UNUSED(start), size_t len, int prot, int flags, int fd, off_t o
errno = EBADF;
return MAP_FAILED;
}
} else {
}
else {
if (!DuplicateHandle(GetCurrentProcess(), fhandle, GetCurrentProcess(),
&fhandle, 0, FALSE, DUPLICATE_SAME_ACCESS) ) {
return MAP_FAILED;
@@ -233,12 +231,15 @@ static int mmap_get_prot_flags (int flags)
if ( (flags & PROT_READ) == PROT_READ) {
if ( (flags & PROT_WRITE) == PROT_WRITE) {
prot = (flags & PROT_EXEC) ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
} else {
}
else {
prot = (flags & PROT_EXEC) ? PAGE_EXECUTE_READ : PAGE_READONLY;
}
} else if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
}
else if ( (flags & PROT_WRITE) == PROT_WRITE) {
prot = (flags & PROT_EXEC) ? PAGE_EXECUTE_READ : PAGE_WRITECOPY;
} else if ( ( flags & PROT_EXEC ) == PROT_EXEC ) {
}
else if ( (flags & PROT_EXEC) == PROT_EXEC) {
prot = PAGE_EXECUTE_READ;
}
return prot;
@@ -251,21 +252,18 @@ static int mmap_get_access_flags (int flags)
if ( (flags & PROT_READ) == PROT_READ) {
if ( (flags & PROT_WRITE) == PROT_WRITE) {
access = FILE_MAP_WRITE;
} else {
}
else {
access = (flags & PROT_EXEC) ? FILE_MAP_EXECUTE : FILE_MAP_READ;
}
} else if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
}
else if ( (flags & PROT_WRITE) == PROT_WRITE) {
access = FILE_MAP_COPY;
} else if ( ( flags & PROT_EXEC ) == PROT_EXEC ) {
}
else if ( (flags & PROT_EXEC) == PROT_EXEC) {
access = FILE_MAP_EXECUTE;
}
return access;
}
#endif // WIN32

View File

@@ -153,11 +153,11 @@ void FLUID_3D::setBorderObstacles()
{
// bottom slab
index = x + y * _xRes;
if(_domainBcBottom==1) _obstacles[index] = 1;
if(_domainBcBottom) _obstacles[index] = 1;
// top slab
index += _totalCells - _slabSize;
if(_domainBcTop==1) _obstacles[index] = 1;
if(_domainBcTop) _obstacles[index] = 1;
}
for (int z = 0; z < _zRes; z++)
@@ -165,11 +165,11 @@ void FLUID_3D::setBorderObstacles()
{
// front slab
index = x + z * _slabSize;
if(_domainBcFront==1) _obstacles[index] = 1;
if(_domainBcFront) _obstacles[index] = 1;
// back slab
index += _slabSize - _xRes;
if(_domainBcBack==1) _obstacles[index] = 1;
if(_domainBcBack) _obstacles[index] = 1;
}
for (int z = 0; z < _zRes; z++)
@@ -177,11 +177,11 @@ void FLUID_3D::setBorderObstacles()
{
// left slab
index = y * _xRes + z * _slabSize;
if(_domainBcLeft==1) _obstacles[index] = 1;
if(_domainBcLeft) _obstacles[index] = 1;
// right slab
index += _xRes - 1;
if(_domainBcRight==1) _obstacles[index] = 1;
if(_domainBcRight) _obstacles[index] = 1;
}
}
@@ -249,7 +249,6 @@ void FLUID_3D::step(float dt)
// set vorticity from RNA value
_vorticityEps = (*_vorticityRNA)/_constantScaling;
#if PARALLEL==1
int threadval = 1;
threadval = omp_get_max_threads();
@@ -450,48 +449,7 @@ void FLUID_3D::setBorderCollisions() {
// set side obstacles
int index;
for (int y = 0; y < _yRes; y++)
for (int x = 0; x < _xRes; x++)
{
// front slab
index = x + y * _xRes;
if(_domainBcBottom==1) _obstacles[index] = 1;
else _obstacles[index] = 0;
// back slab
index += _totalCells - _slabSize;
if(_domainBcTop==1) _obstacles[index] = 1;
else _obstacles[index] = 0;
}
for (int z = 0; z < _zRes; z++)
for (int x = 0; x < _xRes; x++)
{
// bottom slab
index = x + z * _slabSize;
if(_domainBcFront==1) _obstacles[index] = 1;
else _obstacles[index] = 0;
// top slab
index += _slabSize - _xRes;
if(_domainBcBack==1) _obstacles[index] = 1;
else _obstacles[index] = 0;
}
for (int z = 0; z < _zRes; z++)
for (int y = 0; y < _yRes; y++)
{
// left slab
index = y * _xRes + z * _slabSize;
if(_domainBcLeft==1) _obstacles[index] = 1;
else _obstacles[index] = 0;
// right slab
index += _xRes - 1;
if(_domainBcRight==1) _obstacles[index] = 1;
else _obstacles[index] = 0;
}
setBorderObstacles();
}
//////////////////////////////////////////////////////////////////////
@@ -814,13 +772,13 @@ void FLUID_3D::project()
setObstacleBoundaries(_pressure, 0, _zRes);
// copy out the boundaries
if(_domainBcLeft == 0) setNeumannX(_xVelocity, _res, 0, _zRes);
if(!_domainBcLeft) setNeumannX(_xVelocity, _res, 0, _zRes);
else setZeroX(_xVelocity, _res, 0, _zRes);
if(_domainBcFront == 0) setNeumannY(_yVelocity, _res, 0, _zRes);
if(!_domainBcFront) setNeumannY(_yVelocity, _res, 0, _zRes);
else setZeroY(_yVelocity, _res, 0, _zRes);
if(_domainBcTop == 0) setNeumannZ(_zVelocity, _res, 0, _zRes);
if(!_domainBcTop) setNeumannZ(_zVelocity, _res, 0, _zRes);
else setZeroZ(_zVelocity, _res, 0, _zRes);
/*
@@ -1370,13 +1328,13 @@ void FLUID_3D::advectMacCormackBegin(int zBegin, int zEnd)
{
Vec3Int res = Vec3Int(_xRes,_yRes,_zRes);
if(_domainBcLeft == 0) copyBorderX(_xVelocityOld, res, zBegin, zEnd);
if(!_domainBcLeft) copyBorderX(_xVelocityOld, res, zBegin, zEnd);
else setZeroX(_xVelocityOld, res, zBegin, zEnd);
if(_domainBcFront == 0) copyBorderY(_yVelocityOld, res, zBegin, zEnd);
if(!_domainBcFront) copyBorderY(_yVelocityOld, res, zBegin, zEnd);
else setZeroY(_yVelocityOld, res, zBegin, zEnd);
if(_domainBcTop == 0) copyBorderZ(_zVelocityOld, res, zBegin, zEnd);
if(!_domainBcTop) copyBorderZ(_zVelocityOld, res, zBegin, zEnd);
else setZeroZ(_zVelocityOld, res, zBegin, zEnd);
}
@@ -1424,13 +1382,13 @@ void FLUID_3D::advectMacCormackEnd2(int zBegin, int zEnd)
advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _yVelocityOld, _yVelocityTemp, _yVelocity, t1, res, _obstacles, zBegin, zEnd);
advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _zVelocityOld, _zVelocityTemp, _zVelocity, t1, res, _obstacles, zBegin, zEnd);
if(_domainBcLeft == 0) copyBorderX(_xVelocityTemp, res, zBegin, zEnd);
if(!_domainBcLeft) copyBorderX(_xVelocityTemp, res, zBegin, zEnd);
else setZeroX(_xVelocityTemp, res, zBegin, zEnd);
if(_domainBcFront == 0) copyBorderY(_yVelocityTemp, res, zBegin, zEnd);
if(!_domainBcFront) copyBorderY(_yVelocityTemp, res, zBegin, zEnd);
else setZeroY(_yVelocityTemp, res, zBegin, zEnd);
if(_domainBcTop == 0) copyBorderZ(_zVelocityTemp, res, zBegin, zEnd);
if(!_domainBcTop) copyBorderZ(_zVelocityTemp, res, zBegin, zEnd);
else setZeroZ(_zVelocityTemp, res, zBegin, zEnd);
setZeroBorder(_density, res, zBegin, zEnd);

View File

@@ -92,19 +92,15 @@ void FLUID_3D::setNeumannX(float* field, Vec3Int res, int zBegin, int zEnd)
// left slab
index = y * res[0] + z * slabSize;
field[index] = field[index + 2];
/* only allow outwards flux */
if(field[index]>0.) field[index] = 0.;
index += 1;
if(field[index]>0.) field[index] = 0.;
// right slab
index += res[0] - 1;
index = y * res[0] + z * slabSize + res[0] - 1;
field[index] = field[index - 2];
}
// fix, force top slab to only allow outwards flux
for (int y = 0; y < res[1]; y++)
for (int z = zBegin; z < zEnd; z++)
{
// top slab
index = y * res[0] + z * slabSize;
index += res[0] - 1;
/* only allow outwards flux */
if(field[index]<0.) field[index] = 0.;
index -= 1;
if(field[index]<0.) field[index] = 0.;
@@ -121,27 +117,22 @@ void FLUID_3D::setNeumannY(float* field, Vec3Int res, int zBegin, int zEnd)
for (int z = zBegin; z < zEnd; z++)
for (int x = 0; x < res[0]; x++)
{
// bottom slab
// front slab
index = x + z * slabSize;
field[index] = field[index + 2 * res[0]];
/* only allow outwards flux */
if(field[index]>0.) field[index] = 0.;
index += res[0];
if(field[index]>0.) field[index] = 0.;
// top slab
index += slabSize - res[0];
// back slab
index = x + z * slabSize + slabSize - res[0];
field[index] = field[index - 2 * res[0]];
}
// fix, force top slab to only allow outwards flux
for (int z = zBegin; z < zEnd; z++)
for (int x = 0; x < res[0]; x++)
{
// top slab
index = x + z * slabSize;
index += slabSize - res[0];
/* only allow outwards flux */
if(field[index]<0.) field[index] = 0.;
index -= res[0];
if(field[index]<0.) field[index] = 0.;
}
}
//////////////////////////////////////////////////////////////////////
@@ -154,43 +145,33 @@ void FLUID_3D::setNeumannZ(float* field, Vec3Int res, int zBegin, int zEnd)
const int cellsslab = totalCells - slabSize;
int index;
index = 0;
if (zBegin == 0)
for (int y = 0; y < res[1]; y++)
for (int x = 0; x < res[0]; x++, index++)
{
// front slab
field[index] = field[index + 2 * slabSize];
}
if (zEnd == res[2])
{
index = 0;
int indexx = 0;
for (int y = 0; y < res[1]; y++)
for (int x = 0; x < res[0]; x++, index++)
{
// back slab
indexx = index + cellsslab;
field[indexx] = field[indexx - 2 * slabSize];
}
// fix, force top slab to only allow outwards flux
if (zBegin == 0) {
for (int y = 0; y < res[1]; y++)
for (int x = 0; x < res[0]; x++)
{
// top slab
// front slab
index = x + y * res[0];
index += cellsslab;
field[index] = field[index + 2 * slabSize];
/* only allow outwards flux */
if(field[index]>0.) field[index] = 0.;
index += slabSize;
if(field[index]>0.) field[index] = 0.;
}
}
if (zEnd == res[2]) {
for (int y = 0; y < res[1]; y++)
for (int x = 0; x < res[0]; x++)
{
// back slab
index = x + y * res[0] + cellsslab;
field[index] = field[index - 2 * slabSize];
/* only allow outwards flux */
if(field[index]<0.) field[index] = 0.;
index -= slabSize;
if(field[index]<0.) field[index] = 0.;
}
} // zEnd == res[2]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 221 KiB

After

Width:  |  Height:  |  Size: 222 KiB

View File

@@ -58,7 +58,10 @@ float cfra;
void plugin_seq_doit(Cast *, float, float, int, int, ImBuf *, ImBuf *, ImBuf *, ImBuf *);
int plugin_seq_getversion(void) { return B_PLUGIN_VERSION;}
int plugin_seq_getversion(void)
{
return B_PLUGIN_VERSION;
}
void plugin_but_changed(int but) {}
void plugin_init() {}
@@ -90,8 +93,7 @@ static void hsv_to_rgb (double h, double s, double v,
*g = v;
*b = v;
}
else
{
else {
if (h == 360.0)
h = 0.0;
h = h / 60.0;
@@ -163,8 +165,7 @@ static void rgb_to_hsv (double r, double g, double b,
if (*s == 0.0)
*h = -1.0;
else
{
else {
delta = max - min;
if (r == max)
@@ -182,7 +183,8 @@ static void rgb_to_hsv (double r, double g, double b,
}
void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
int height, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *out, ImBuf *use) {
int height, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *out, ImBuf *use)
{
char *dest, *src1;
int x, y, c;
double gamma_table[256];
@@ -203,7 +205,8 @@ void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
v = pow(v, cast->gamma_y);
if (v > 1.0) {
v = 1.0;
} else if (v < 0.0) {
}
else if (v < 0.0) {
v = 0.0;
}
gamma_table[y] = v * 255;
@@ -214,9 +217,11 @@ void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
v *= cast->master_sat;
if (y < cast->lo_thres * 255) {
v *= cast->sat_shadows;
} else if (y > cast->hi_thres * 255) {
}
else if (y > cast->hi_thres * 255) {
v *= cast->sat_highlights;
} else {
}
else {
v *= cast->sat_midtones;
}
uv_table[y] = v;
@@ -250,7 +255,8 @@ void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
destf[2] = b;
destf = destf + 4;
src1f += 4;
} else {
}
else {
dest[0] = r * 255.0;
dest[1] = g * 255.0;
dest[2] = b * 255.0;

View File

@@ -132,8 +132,9 @@ void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
d->last_level = cast->level;
}
if (width != d->last_width || height != d->last_height
|| cfra != d->last_cfra + 1) {
if (width != d->last_width || height != d->last_height ||
cfra != d->last_cfra + 1)
{
free(d->last_frame);
d->last_frame = (unsigned char*) calloc(width * height, 4);

View File

@@ -155,7 +155,8 @@ static void rectcpy(ImBuf *dbuf, ImBuf *sbuf,
if (dbuf->rect_float) sfrect += 4 * tmp;
else srect += tmp;
srcx = sbuf->x;
} else{
}
else {
if (dbuf->rect_float) sfrect = dfrect;
else srect = drect;
srcx = destx;
@@ -166,7 +167,8 @@ static void rectcpy(ImBuf *dbuf, ImBuf *sbuf,
memcpy(dfrect, sfrect, 4 * width * sizeof(float));
dfrect += destx;
sfrect += srcx;
} else {
}
else {
memcpy(drect, srect, width * sizeof(int));
drect += destx;
srect += srcx;
@@ -189,7 +191,8 @@ static void fill_out(ImBuf *out, float r, float g, float b, float a)
rectf[3] = a;
rectf += 4;
}
} else {
}
else {
for (x = 0; x < tot; x++) {
rect[0] = (int)(r * 255);
rect[1] = (int)(g * 255);
@@ -230,7 +233,8 @@ void plugin_seq_doit(Cast *cast, float facf0, float facf1, int sx, int sy, ImBuf
if (cast->wrap) f2 += 1.0;
lr = drand48() > 0.5;
t1 = facf0;
} else t1 = facf1;
}
else t1 = facf1;
t2 = 1.0 - t1;
t3 = 3.0 * (f1 * t1 * t1 * t2 + f2 * t1 * t2 * t2);

View File

@@ -0,0 +1,7 @@
import bpy
op = bpy.context.active_operator
op.selected = True
op.apply_modifiers = True
op.include_bone_children = False
op.second_life = True

View File

@@ -223,6 +223,11 @@ class BakeAction(Operator):
return {'FINISHED'}
def invoke(self, context, event):
scene = context.scene
self.frame_start = scene.frame_start
self.frame_end = scene.frame_end
self.bake_types = {'POSE'} if context.mode == 'POSE' else {'OBJECT'}
wm = context.window_manager
return wm.invoke_props_dialog(self)

View File

@@ -35,7 +35,7 @@ class SelectPattern(Operator):
pattern = StringProperty(
name="Pattern",
description="Name filter using '*' and '?' wildcard chars",
maxlen=32,
maxlen=64,
default="*",
)
case_sensitive = BoolProperty(

View File

@@ -452,6 +452,24 @@ class AddPresetTrackingSettings(AddPresetBase, Operator):
preset_subdir = "tracking_settings"
class AddPresetNodeColor(AddPresetBase, Operator):
'''Add a Node Color Preset'''
bl_idname = "node.node_color_preset_add"
bl_label = "Add Node Color Preset"
preset_menu = "NODE_MT_node_color_presets"
preset_defines = [
"node = bpy.context.active_node"
]
preset_values = [
"node.color",
"node.use_custom_color"
]
preset_subdir = "node_color"
class AddPresetInterfaceTheme(AddPresetBase, Operator):
'''Add a theme preset'''
bl_idname = "wm.interface_theme_preset_add"

View File

@@ -1077,7 +1077,7 @@ class WM_OT_properties_context_change(Operator):
context = StringProperty(
name="Context",
maxlen=32,
maxlen=64,
)
def execute(self, context):
@@ -1803,7 +1803,7 @@ class WM_OT_addon_remove(Operator):
path, isdir = WM_OT_addon_remove.path_from_addon(self.module)
if path is None:
self.report('WARNING', "Addon path %r could not be found" % path)
self.report({'WARNING'}, "Addon path %r could not be found" % path)
return {'CANCELLED'}
# in case its enabled

View File

@@ -70,8 +70,12 @@ class MotionPathButtonsPanel():
else:
col.operator("object.paths_update", text="Update Paths", icon='OBJECT_DATA')
else:
col.label(text="Not available yet...", icon='ERROR')
col.label(text="Calculate Paths first", icon='INFO')
sub = col.column(align=True)
sub.label(text="Nothing to show yet...", icon='ERROR')
if bones:
sub.operator("pose.paths_calculate", text="Calculate...", icon='BONE_DATA')
else:
sub.operator("object.paths_calculate", text="Calculate...", icon='OBJECT_DATA')
# Display Settings
split = layout.split()

View File

@@ -262,6 +262,7 @@ class DATA_PT_shape_keys(MeshButtonsPanel, Panel):
col.prop_search(kb, "relative_key", key, "key_blocks", text="")
else:
layout.prop(kb, "interpolation")
row = layout.column()
row.active = enable_edit_value
row.prop(key, "eval_time")

View File

@@ -682,6 +682,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
row = row.row()
row.active = md.use_rim
row.prop(md, "material_offset_rim", text="Rim")
sub.prop(md, "use_flip_normals")
def SUBSURF(self, layout, ob, md):
layout.row().prop(md, "subdivision_type", expand=True)
@@ -959,5 +960,29 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
layout.separator()
self.vertex_weight_mask(layout, ob, md)
def SKIN(self, layout, ob, md):
layout.operator("object.skin_armature_create", text="Create Armature")
layout.separator()
layout.prop(md, "branch_smoothing")
layout.prop(md, "use_smooth_shade")
layout.label(text="Selected Vertices:")
split = layout.split()
col = split.column(align=True)
col.operator("object.skin_loose_mark_clear", text="Mark Loose").action = "MARK"
col.operator("object.skin_loose_mark_clear", text="Clear Loose").action = "CLEAR"
col = split.column()
col.operator("object.skin_root_mark", text="Mark Root")
col.operator("object.skin_radii_equalize", text="Equalize Radii")
layout.label(text="Symmetry Axes:")
col = layout.column()
col.prop(md, "use_x_symmetry")
col.prop(md, "use_y_symmetry")
col.prop(md, "use_z_symmetry")
if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__)

View File

@@ -149,6 +149,7 @@ class DOPESHEET_MT_view(Menu):
layout.prop(st, "use_realtime_update")
layout.prop(st, "show_frame_indicator")
layout.prop(st, "show_sliders")
layout.prop(st, "show_group_colors")
layout.prop(st, "use_auto_merge_keyframes")
layout.prop(st, "use_marker_sync")

View File

@@ -75,6 +75,7 @@ class GRAPH_MT_view(Menu):
layout.prop(st, "show_frame_indicator")
layout.prop(st, "show_cursor")
layout.prop(st, "show_sliders")
layout.prop(st, "show_group_colors")
layout.prop(st, "use_auto_merge_keyframes")
layout.separator()

View File

@@ -156,7 +156,7 @@ class INFO_MT_file_import(Menu):
def draw(self, context):
if hasattr(bpy.types, "WM_OT_collada_import"):
self.layout.operator("wm.collada_import", text="COLLADA (.dae)")
self.layout.operator("wm.collada_import", text="Collada (Default) (.dae)")
class INFO_MT_file_export(Menu):
@@ -165,7 +165,7 @@ class INFO_MT_file_export(Menu):
def draw(self, context):
if hasattr(bpy.types, "WM_OT_collada_export"):
self.layout.operator("wm.collada_export", text="COLLADA (.dae)")
self.layout.operator("wm.collada_export", text="Collada (Default) (.dae)")
class INFO_MT_file_external_data(Menu):

View File

@@ -225,5 +225,23 @@ class NODE_PT_quality(bpy.types.Panel):
layout.prop(tree, "chunksize")
layout.prop(tree, "use_opencl")
class NODE_MT_node_color_presets(Menu):
"""Predefined node color"""
bl_label = "Color Presets"
preset_subdir = "node_color"
preset_operator = "script.execute_preset"
draw = Menu.draw_preset
class NODE_MT_node_color_specials(Menu):
bl_label = "Node Color Specials"
def draw(self, context):
layout = self.layout
layout.operator('node.node_copy_color', icon='COPY_ID')
if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__)

View File

@@ -153,7 +153,7 @@ class SEQUENCER_MT_select(Menu):
layout.operator_menu_enum("sequencer.select_grouped", "type", text="Grouped")
layout.operator("sequencer.select_linked")
layout.operator("sequencer.select_all").action = 'TOGGLE'
layout.operator("sequencer.select_all").action = 'INVERT'
layout.operator("sequencer.select_all", text="Inverse").action = 'INVERT'
class SEQUENCER_MT_marker(Menu):
@@ -346,6 +346,7 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
scene = context.scene
frame_current = scene.frame_current
strip = act_strip(context)
@@ -394,9 +395,9 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
elem = strip.elements[0]
if elem and elem.orig_width > 0 and elem.orig_height > 0:
col.label(text="Orig Dim" + ": %dx%d" % (elem.orig_width, elem.orig_height))
col.label(text="Original Dimension" + ": %dx%d" % (elem.orig_width, elem.orig_height))
else:
col.label(text="Orig Dim: None")
col.label(text="Original Dimension: None")
class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
@@ -413,7 +414,6 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
return strip.type in {'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
'PLUGIN',
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
'MULTICAM', 'ADJUSTMENT'}
@@ -426,14 +426,11 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
col.prop(strip, "input_1")
if strip.input_count > 1:
col.prop(strip, "input_2")
if strip.input_count > 2:
col.prop(strip, "input_3")
if strip.type == 'COLOR':
layout.prop(strip, "color")
elif strip.type == 'WIPE':
col = layout.column()
col.prop(strip, "transition_type")
col.label(text="Direction:")
@@ -469,44 +466,6 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
#layout.prop(strip, "use_frame_blend")
elif strip.type == 'TRANSFORM':
self.draw_panel_transform(strip)
elif strip.type == 'MULTICAM':
layout.prop(strip, "multicam_source")
row = layout.row(align=True)
sub = row.row()
sub.scale_x = 2.0
sub.operator("screen.animation_play", text="", icon='PAUSE' if context.screen.is_animation_playing else 'PLAY')
row.label("Cut To")
for i in range(1, strip.channel):
row.operator("sequencer.cut_multicam", text=str(i)).camera = i
col = layout.column(align=True)
if strip.type == 'SPEED':
col.prop(strip, "multiply_speed")
elif strip.type in {'CROSS', 'GAMMA_CROSS', 'WIPE'}:
col.prop(strip, "use_default_fade", "Default fade")
if not strip.use_default_fade:
col.prop(strip, "effect_fader", text="Effect fader")
layout.prop(strip, "use_translation", text="Image Offset:")
if strip.use_translation:
col = layout.column(align=True)
col.prop(strip.transform, "offset_x", text="X")
col.prop(strip.transform, "offset_y", text="Y")
layout.prop(strip, "use_crop", text="Image Crop:")
if strip.use_crop:
col = layout.column(align=True)
col.prop(strip.crop, "max_y")
col.prop(strip.crop, "min_x")
col.prop(strip.crop, "min_y")
col.prop(strip.crop, "max_x")
def draw_panel_transform(self, strip):
layout = self.layout
col = layout.column()
@@ -536,6 +495,27 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
col.label(text="Rotation:")
col.prop(strip, "rotation_start", text="Rotation")
elif strip.type == 'MULTICAM':
layout.prop(strip, "multicam_source")
row = layout.row(align=True)
sub = row.row()
sub.scale_x = 2.0
sub.operator("screen.animation_play", text="", icon='PAUSE' if context.screen.is_animation_playing else 'PLAY')
row.label("Cut To")
for i in range(1, strip.channel):
row.operator("sequencer.cut_multicam", text=str(i)).camera = i
col = layout.column(align=True)
if strip.type == 'SPEED':
col.prop(strip, "multiply_speed")
elif strip.type in {'CROSS', 'GAMMA_CROSS', 'WIPE'}:
col.prop(strip, "use_default_fade", "Default fade")
if not strip.use_default_fade:
col.prop(strip, "effect_fader", text="Effect fader")
class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
bl_label = "Strip Input"
@@ -552,7 +532,7 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'META',
'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
'WIPE', 'GLOW', 'TRANSFORM',
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
'MULTICAM', 'SPEED', 'ADJUSTMENT'}
def draw(self, context):
@@ -565,43 +545,34 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
# draw a filename if we have one
if seq_type == 'IMAGE':
split = layout.split(percentage=0.2)
col = split.column()
col.label(text="Path:")
col = split.column()
col.prop(strip, "directory", text="")
split.label(text="Path:")
split.prop(strip, "directory", text="")
# Current element for the filename
elem = strip.getStripElem(context.scene.frame_current)
if elem:
split = layout.split(percentage=0.2)
col = split.column()
col.label(text="File:")
col = split.column()
col.prop(elem, "filename", text="") # strip.elements[0] could be a fallback
split.label(text="File:")
split.prop(elem, "filename", text="") # strip.elements[0] could be a fallback
# also accessible from the menu
layout.operator("sequencer.change_path")
elif seq_type == 'MOVIE':
split = layout.split(percentage=0.2)
col = split.column()
col.label(text="Path:")
col = split.column()
col.prop(strip, "filepath", text="")
col.prop(strip, "mpeg_preseek", text="MPEG Preseek")
col.prop(strip, "stream_index", text="Stream Index")
split.label(text="Path:")
split.prop(strip, "filepath", text="")
# TODO, sound???
# end drawing filename
layout.prop(strip, "mpeg_preseek")
layout.prop(strip, "stream_index")
layout.prop(strip, "use_translation", text="Image Offset:")
layout.prop(strip, "use_translation", text="Image Offset")
if strip.use_translation:
col = layout.column(align=True)
col.prop(strip.transform, "offset_x", text="X")
col.prop(strip.transform, "offset_y", text="Y")
layout.prop(strip, "use_crop", text="Image Crop:")
layout.prop(strip, "use_crop", text="Image Crop")
if strip.use_crop:
col = layout.column(align=True)
col.prop(strip.crop, "max_y")
@@ -735,15 +706,17 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
col.label(text="Distortion:")
col.prop(strip, "undistort")
row = layout.row()
row.label(text="Flip:")
row.prop(strip, "use_flip_x", text="X")
row.prop(strip, "use_flip_y", text="Y")
split = layout.split(percentage=0.65)
col = layout.column()
col = split.column()
col.prop(strip, "use_reverse_frames", text="Backwards")
col.prop(strip, "use_deinterlace")
col = split.column()
col.label(text="Flip:")
col.prop(strip, "use_flip_x", text="X")
col.prop(strip, "use_flip_y", text="Y")
col = layout.column()
col.label(text="Colors:")
col.prop(strip, "color_saturation", text="Saturation")
@@ -835,14 +808,6 @@ class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel):
#col.active = render.use_sequencer_gl_preview
col.prop(render, "sequencer_gl_preview", text="")
'''
col = layout.column()
col.prop(render, "use_sequencer_gl_render", text="Open GL Render")
col = layout.column()
col.active = render.use_sequencer_gl_render
col.prop(render, "sequencer_gl_render", text="")
'''
class SEQUENCER_PT_view(SequencerButtonsPanel_Output, Panel):
bl_label = "View Settings"
@@ -854,9 +819,9 @@ class SEQUENCER_PT_view(SequencerButtonsPanel_Output, Panel):
col = layout.column()
if st.display_mode == 'IMAGE':
col.prop(st, "draw_overexposed") # text="Zebra"
col.prop(st, "draw_overexposed")
col.prop(st, "show_safe_margin")
if st.display_mode == 'WAVEFORM':
elif st.display_mode == 'WAVEFORM':
col.prop(st, "show_separate_color")
col.prop(st, "proxy_render_size")

View File

@@ -1916,7 +1916,7 @@ class VIEW3D_MT_edit_mesh_delete(Menu):
layout.operator("mesh.dissolve")
layout.operator("mesh.edge_collapse")
layout.operator("mesh.delete_edgeloop")
layout.operator("mesh.delete_edgeloop", text="Edge Loop")
class VIEW3D_MT_edit_mesh_dissolve(Menu):
@@ -2401,6 +2401,8 @@ class VIEW3D_PT_view3d_display(Panel):
col.prop(gs, "material_mode", text="")
col.prop(view, "show_textured_solid")
col.prop(view, "show_backface_culling")
layout.separator()
region = view.region_quadview

View File

@@ -873,6 +873,8 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
layout.prop(sculpt, "show_brush")
layout.prop(sculpt, "use_deform_only")
layout.prop(sculpt, "input_samples")
self.unified_paint_settings(layout, context)
@@ -984,6 +986,8 @@ class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel):
col.prop(mesh, "use_mirror_x")
col.prop(mesh, "use_mirror_topology")
col.prop(wpaint, "input_samples")
self.unified_paint_settings(col, context)
# Commented out because the Apply button isn't an operator yet, making these settings useless
@@ -1014,6 +1018,8 @@ class VIEW3D_PT_tools_vertexpaint(Panel, View3DPaintPanel):
col.prop(vpaint, "use_normal")
col.prop(vpaint, "use_spray")
col.prop(vpaint, "input_samples")
self.unified_paint_settings(col, context)
# Commented out because the Apply button isn't an operator yet, making these settings useless

View File

@@ -215,7 +215,8 @@ int AVI_is_avi(char *name)
if (GET_FCC(fp) != FCC("RIFF") ||
!GET_FCC(fp) ||
GET_FCC(fp) != FCC("AVI ")) {
GET_FCC(fp) != FCC("AVI "))
{
ret = 0;
}
else {
@@ -245,7 +246,8 @@ int AVI_is_avi(const char *name)
return 0;
if (GET_FCC(movie.fp) != FCC("RIFF") ||
!(movie.size = GET_FCC(movie.fp))) {
!(movie.size = GET_FCC(movie.fp)))
{
fclose(movie.fp);
return 0;
}
@@ -257,7 +259,8 @@ int AVI_is_avi(const char *name)
!GET_FCC(movie.fp) ||
GET_FCC(movie.fp) != FCC("hdrl") ||
(movie.header->fcc = GET_FCC(movie.fp)) != FCC("avih") ||
!(movie.header->size = GET_FCC(movie.fp))) {
!(movie.header->size = GET_FCC(movie.fp)))
{
DEBUG_PRINT("bad initial header info\n");
fclose(movie.fp);
return 0;
@@ -378,8 +381,7 @@ int AVI_is_avi(const char *name)
fcca = bi->Compression;
if (movie.streams[temp].format ==
AVI_FORMAT_AVI_RGB) {
if (movie.streams[temp].format == AVI_FORMAT_AVI_RGB) {
if (fcca == FCC("DIB ") ||
fcca == FCC("RGB ") ||
fcca == FCC("rgb ") ||
@@ -829,8 +831,8 @@ AviError AVI_open_compress(char *name, AviMovie *movie, int streams, ...)
if (movie->streams[i].sh.Type == FCC("vids")) {
#if 0
if (movie->streams[i].format == AVI_FORMAT_MJPEG) {
movie->streams[i].sf = MEM_mallocN(sizeof(AviBitmapInfoHeader)
+ sizeof(AviMJPEGUnknown), "moviestreamformatL");
movie->streams[i].sf = MEM_mallocN(sizeof(AviBitmapInfoHeader) +
sizeof(AviMJPEGUnknown), "moviestreamformatL");
movie->streams[i].sf_size = sizeof(AviBitmapInfoHeader) + sizeof(AviMJPEGUnknown);
}
else {

View File

@@ -42,14 +42,14 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 263
#define BLENDER_SUBVERSION 5
#define BLENDER_SUBVERSION 7
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
/* used by packaging tools */
/* can be left blank, otherwise a,b,c... etc with no quotes */
#define BLENDER_VERSION_CHAR
#define BLENDER_VERSION_CHAR a
/* alpha/beta/rc/release, docs use this */
#define BLENDER_VERSION_CYCLE alpha

View File

@@ -218,7 +218,7 @@ void calc_fcurve_range(struct FCurve *fcu, float *min, float *max,
/* get the bounding-box extents for F-Curve */
void calc_fcurve_bounds(struct FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax,
const short do_sel_only);
const short do_sel_only, const short include_handles);
/* .............. */

View File

@@ -55,9 +55,9 @@ struct Key *copy_key_nolib(struct Key *key);
void BKE_key_make_local(struct Key *key);
void sort_keys(struct Key *key);
void key_curve_position_weights(float t, float *data, int type);
void key_curve_tangent_weights(float t, float *data, int type);
void key_curve_normal_weights(float t, float *data, int type);
void key_curve_position_weights(float t, float data[4], int type);
void key_curve_tangent_weights(float t, float data[4], int type);
void key_curve_normal_weights(float t, float data[4], int type);
float *do_ob_key(struct Scene *scene, struct Object *ob);

View File

@@ -111,6 +111,10 @@ int poly_find_loop_from_vert(const struct MPoly *poly,
int poly_get_adj_loops_from_vert(unsigned adj_r[3], const struct MPoly *poly,
const struct MLoop *mloop, unsigned vert);
/* Return the index of the edge vert that is not equal to 'v'. If
* neither edge vertex is equal to 'v', returns -1. */
int BKE_mesh_edge_other_vert(const struct MEdge *e, int v);
/* update the hide flag for edges and polys from the corresponding
* flag in verts */
void BKE_mesh_flush_hidden_from_verts(const struct MVert *mvert,

Some files were not shown because too many files have changed in this diff Show More