ClangFormat: format '#if 0' code in intern/

This commit is contained in:
Campbell Barton 2019-04-17 08:16:53 +02:00
parent 3076d95ba4
commit 108045faa0
20 changed files with 121 additions and 71 deletions

View File

@ -495,7 +495,7 @@ static void xml_read_mesh(const XMLReadState &state, xml_node node)
float3 *fdata = attr->data_float3();
#if 0
if(subdivide_uvs) {
if (subdivide_uvs) {
attr->flags |= ATTR_SUBDIVIDED;
}
#endif

View File

@ -307,8 +307,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
/* TODO: don't use lights for excluded layers used as mask layer,
* when dynamic overrides are back. */
#if 0
if(!((layer_flag & view_layer.holdout_layer) &&
(layer_flag & view_layer.exclude_layer)))
if (!((layer_flag & view_layer.holdout_layer) && (layer_flag & view_layer.exclude_layer)))
#endif
{
sync_light(b_parent,
@ -345,7 +344,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
/* TODO: make holdout objects on excluded layer invisible for non-camera rays. */
#if 0
if(use_holdout && (layer_flag & view_layer.exclude_layer)) {
if (use_holdout && (layer_flag & view_layer.exclude_layer)) {
visibility &= ~(PATH_RAY_ALL_VISIBILITY - PATH_RAY_CAMERA);
}
#endif

View File

@ -656,13 +656,12 @@ static ShaderNode *add_node(Scene *scene,
/* TODO: restore */
/* TODO(sergey): Does not work properly when we change builtin type. */
#if 0
if(b_image.is_updated()) {
scene->image_manager->tag_reload_image(
image->filename.string(),
image->builtin_data,
get_image_interpolation(b_image_node),
get_image_extension(b_image_node),
image->use_alpha);
if (b_image.is_updated()) {
scene->image_manager->tag_reload_image(image->filename.string(),
image->builtin_data,
get_image_interpolation(b_image_node),
get_image_extension(b_image_node),
image->use_alpha);
}
#endif
}
@ -702,13 +701,12 @@ static ShaderNode *add_node(Scene *scene,
/* TODO: restore */
/* TODO(sergey): Does not work properly when we change builtin type. */
#if 0
if(b_image.is_updated()) {
scene->image_manager->tag_reload_image(
env->filename.string(),
env->builtin_data,
get_image_interpolation(b_env_node),
EXTENSION_REPEAT,
env->use_alpha);
if (b_image.is_updated()) {
scene->image_manager->tag_reload_image(env->filename.string(),
env->builtin_data,
get_image_interpolation(b_env_node),
EXTENSION_REPEAT,
env->use_alpha);
}
#endif
}

View File

@ -54,8 +54,8 @@ static inline BL::Mesh object_to_mesh(BL::BlendData &data,
bool subsurf_mod_show_render = false;
bool subsurf_mod_show_viewport = false;
if(subdivision_type != Mesh::SUBDIVISION_NONE) {
BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1];
if (subdivision_type != Mesh::SUBDIVISION_NONE) {
BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length() - 1];
subsurf_mod_show_render = subsurf_mod.show_render();
subsurf_mod_show_viewport = subsurf_mod.show_viewport();
@ -83,8 +83,8 @@ static inline BL::Mesh object_to_mesh(BL::BlendData &data,
}
#if 0
if(subdivision_type != Mesh::SUBDIVISION_NONE) {
BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1];
if (subdivision_type != Mesh::SUBDIVISION_NONE) {
BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length() - 1];
subsurf_mod.show_render(subsurf_mod_show_render);
subsurf_mod.show_viewport(subsurf_mod_show_viewport);

View File

@ -653,7 +653,7 @@ class CUDADevice : public Device {
/* For testing mapped host memory, fill up device memory. */
const size_t keep_mb = 1024;
while(free_after > keep_mb * 1024 * 1024LL) {
while (free_after > keep_mb * 1024 * 1024LL) {
CUdeviceptr tmp;
cuda_assert(cuMemAlloc(&tmp, 10 * 1024 * 1024LL));
cuMemGetInfo(&free_after, &total);

View File

@ -733,7 +733,7 @@ bool OSLRenderServices::get_object_standard_attribute(
return set_attribute_float3(f, type, derivatives, val);
}
#if 0 /* unsupported */
else if(name == u_particle_rotation) {
else if (name == u_particle_rotation) {
int particle_id = object_particle_id(kg, sd->object);
float4 f = particle_rotation(kg, particle_id);
return set_attribute_float4(f, type, derivatives, val);

View File

@ -235,15 +235,42 @@ int clamp(int x, int minval, int maxval)
return max(min(x, maxval), minval);
}
#if 0
normal mix (normal x, normal y, normal a) { return x*(1-a) + y*a; }
normal mix (normal x, normal y, float a) { return x*(1-a) + y*a; }
vector mix (vector x, vector y, vector a) { return x*(1-a) + y*a; }
vector mix (vector x, vector y, float a) { return x*(1-a) + y*a; }
point mix (point x, point y, point a) { return x*(1-a) + y*a; }
point mix (point x, point y, float a) { return x*(1-a) + y*a; }
color mix (color x, color y, color a) { return x*(1-a) + y*a; }
color mix (color x, color y, float a) { return x*(1-a) + y*a; }
float mix (float x, float y, float a) { return x*(1-a) + y*a; }
normal mix(normal x, normal y, normal a)
{
return x * (1 - a) + y * a;
}
normal mix(normal x, normal y, float a)
{
return x * (1 - a) + y * a;
}
vector mix(vector x, vector y, vector a)
{
return x * (1 - a) + y * a;
}
vector mix(vector x, vector y, float a)
{
return x * (1 - a) + y * a;
}
point mix(point x, point y, point a)
{
return x * (1 - a) + y * a;
}
point mix(point x, point y, float a)
{
return x * (1 - a) + y * a;
}
color mix(color x, color y, color a)
{
return x * (1 - a) + y * a;
}
color mix(color x, color y, float a)
{
return x * (1 - a) + y * a;
}
float mix(float x, float y, float a)
{
return x * (1 - a) + y * a;
}
#else
normal mix(normal x, normal y, normal a) BUILTIN;
normal mix(normal x, normal y, float a) BUILTIN;
@ -369,7 +396,7 @@ point rotate(point p, float angle, point a, point b)
* anisotropic shader where angle is usually constant.
*/
#if 0
sincos (angle, sinang, cosang);
sincos(angle, sinang, cosang);
#else
sinang = sin(angle);
cosang = cos(angle);

View File

@ -716,10 +716,17 @@ float Camera::world_to_raster_size(float3 P)
float3 raster = transform_perspective(&full_cameratoraster, make_float3(dir.x, dir.y, 0.0f));
ray.t = 1.0f;
camera_sample_panorama(&kernel_camera, kernel_camera_motion.data(), raster.x, raster.y, 0.0f, 0.0f, &ray);
if(ray.t == 0.0f) {
camera_sample_panorama(
&kernel_camera, kernel_camera_motion.data(), raster.x, raster.y, 0.0f, 0.0f, &ray);
if (ray.t == 0.0f) {
/* No differentials, just use from directly ahead. */
camera_sample_panorama(&kernel_camera, kernel_camera_motion.data(), 0.5f*full_width, 0.5f*full_height, 0.0f, 0.0f, &ray);
camera_sample_panorama(&kernel_camera,
kernel_camera_motion.data(),
0.5f * full_width,
0.5f * full_height,
0.0f,
0.0f,
&ray);
}
#else
camera_sample_panorama(&kernel_camera,

View File

@ -3888,7 +3888,7 @@ void ParticleInfoNode::attributes(Shader *shader, AttributeRequestSet *attribute
if (!output("Location")->links.empty())
attributes->add(ATTR_STD_PARTICLE);
#if 0 /* not yet supported */
if(!output("Rotation")->links.empty())
if (!output("Rotation")->links.empty())
attributes->add(ATTR_STD_PARTICLE);
#endif
if (!output("Size")->links.empty())
@ -3933,7 +3933,7 @@ void ParticleInfoNode::compile(SVMCompiler &compiler)
/* quaternion data is not yet supported by Cycles */
#if 0
out = output("Rotation");
if(!out->links.empty()) {
if (!out->links.empty()) {
compiler.add_node(NODE_PARTICLE_INFO, NODE_INFO_PAR_ROTATION, compiler.stack_assign(out));
}
#endif

View File

@ -417,12 +417,12 @@ ccl_device_inline float triangle_area(const float3 v1, const float3 v2, const fl
ccl_device_inline void make_orthonormals(const float3 N, float3 *a, float3 *b)
{
#if 0
if(fabsf(N.y) >= 0.999f) {
if (fabsf(N.y) >= 0.999f) {
*a = make_float3(1, 0, 0);
*b = make_float3(0, 0, 1);
return;
}
if(fabsf(N.z) >= 0.999f) {
if (fabsf(N.z) >= 0.999f) {
*a = make_float3(1, 0, 0);
*b = make_float3(0, 1, 0);
return;

View File

@ -328,11 +328,11 @@ ccl_device_inline float4 quat_interpolate(float4 q1, float4 q2, float t)
/* possible optimization: it might be possible to precompute theta/qperp */
if(costheta > 0.9995f) {
if (costheta > 0.9995f) {
/* linear interpolation in degenerate case */
return normalize((1.0f - t)*q1 + t*q2);
return normalize((1.0f - t) * q1 + t * q2);
}
else {
else {
/* slerp */
float theta = acosf(clamp(costheta, -1.0f, 1.0f));
float4 qperp = normalize(q2 - q1 * costheta);

View File

@ -360,8 +360,8 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
GHOST_TInt32 y_root = sdl_sub_evt.y + y_win;
#if 0
if (window->getCursorGrabMode() != GHOST_kGrabDisable && window->getCursorGrabMode() != GHOST_kGrabNormal)
{
if (window->getCursorGrabMode() != GHOST_kGrabDisable &&
window->getCursorGrabMode() != GHOST_kGrabNormal) {
GHOST_TInt32 x_new = x_root;
GHOST_TInt32 y_new = y_root;
GHOST_TInt32 x_accum, y_accum;
@ -390,10 +390,15 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win);
}
g_event = new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, x_new, y_new);
g_event = new GHOST_EventCursor(
getMilliSeconds(), GHOST_kEventCursorMove, window, x_new, y_new);
}
else {
g_event = new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, x_root + x_accum, y_root + y_accum);
g_event = new GHOST_EventCursor(getMilliSeconds(),
GHOST_kEventCursorMove,
window,
x_root + x_accum,
y_root + y_accum);
}
}
else

View File

@ -1160,13 +1160,14 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
if (hwnd) {
#if 0
// Disabled due to bug in Intel drivers, see T51959
if(msg == WM_NCCREATE) {
if (msg == WM_NCCREATE) {
// Tell Windows to automatically handle scaling of non-client areas
// such as the caption bar. EnableNonClientDpiScaling was introduced in Windows 10
HMODULE m_user32 = ::LoadLibrary("User32.dll");
if (m_user32) {
GHOST_WIN32_EnableNonClientDpiScaling fpEnableNonClientDpiScaling =
(GHOST_WIN32_EnableNonClientDpiScaling) ::GetProcAddress(m_user32, "EnableNonClientDpiScaling");
(GHOST_WIN32_EnableNonClientDpiScaling)::GetProcAddress(m_user32,
"EnableNonClientDpiScaling");
if (fpEnableNonClientDpiScaling) {
fpEnableNonClientDpiScaling(hwnd);

View File

@ -479,12 +479,14 @@ bool Application::processEvent(GHOST_IEvent *event)
switch (event->getType()) {
#if 0
case GHOST_kEventUnknown:
break;
case GHOST_kEventCursorButton:
std::cout << "GHOST_kEventCursorButton"; break;
case GHOST_kEventCursorMove:
std::cout << "GHOST_kEventCursorMove"; break;
case GHOST_kEventUnknown:
break;
case GHOST_kEventCursorButton:
std::cout << "GHOST_kEventCursorButton";
break;
case GHOST_kEventCursorMove:
std::cout << "GHOST_kEventCursorMove";
break;
#endif
case GHOST_kEventWheel: {
GHOST_TEventWheelData *wheelData = (GHOST_TEventWheelData *)event->getData();

View File

@ -70,10 +70,10 @@ extern size_t (*MEM_allocN_len)(const void *vmemh) ATTR_WARN_UNUSED_RESULT;
extern void (*MEM_freeN)(void *vmemh);
#if 0 /* UNUSED */
/**
/**
* Return zero if memory is not in allocated list
*/
extern short (*MEM_testN)(void *vmemh);
extern short (*MEM_testN)(void *vmemh);
#endif
/**

View File

@ -907,7 +907,8 @@ short MEM_guarded_testN(void *vmemh)
mem_lock_thread();
membl = membase->first;
if (membl) membl = MEMNEXT(membl);
if (membl)
membl = MEMNEXT(membl);
while (membl) {
if (vmemh == membl + 1) {
@ -917,7 +918,8 @@ short MEM_guarded_testN(void *vmemh)
if (membl->next)
membl = MEMNEXT(membl->next);
else break;
else
break;
}
mem_unlock_thread();
@ -1013,8 +1015,10 @@ static void addtail(volatile localListBase *listbase, void *vlink)
/* for a generic API error checks here is fine but
* the limited use here they will never be NULL */
#if 0
if (link == NULL) return;
if (listbase == NULL) return;
if (link == NULL)
return;
if (listbase == NULL)
return;
#endif
link->next = NULL;
@ -1034,8 +1038,10 @@ static void remlink(volatile localListBase *listbase, void *vlink)
/* for a generic API error checks here is fine but
* the limited use here they will never be NULL */
#if 0
if (link == NULL) return;
if (listbase == NULL) return;
if (link == NULL)
return;
if (listbase == NULL)
return;
#endif
if (link->next)

View File

@ -379,7 +379,10 @@ float IK_SolverGetPoleAngle(IK_Solver *solver)
}
#if 0
static void IK_SolverAddCenterOfMass(IK_Solver *solver, IK_Segment *root, float goal[3], float weight)
static void IK_SolverAddCenterOfMass(IK_Solver *solver,
IK_Segment *root,
float goal[3],
float weight)
{
if (solver == NULL || root == NULL)
return;

View File

@ -99,7 +99,7 @@ MIKK_INLINE float Length(const SVec3 v)
}
#if 0 // UNUSED
MIKK_INLINE SVec3 Normalize( const SVec3 v )
MIKK_INLINE SVec3 Normalize(const SVec3 v)
{
return vscale(1.0f / Length(v), v);
}

View File

@ -615,15 +615,15 @@ std::vector<STR_String> STR_String::Explode(char c) const
#if 0
int STR_String::Serialize(pCStream stream)
int STR_String::Serialize(pCStream stream)
{
if (stream->GetAccess() == CStream::Access_Read) {
int ln;
stream->Read(&ln, sizeof(ln));
AllocBuffer(ln, false);
stream->Read(this->m_data, ln);
this->m_data[ln] = '\0';
this->m_len = ln;
this->m_data[ln] = '\0';
this->m_len = ln;
}
else {
stream->Write(&this->m_len, sizeof(this->m_len));

View File

@ -265,7 +265,8 @@ int conv_utf_8_to_16(const char *in8, wchar_t *out16, size_t size16)
static int is_ascii(const char *in8)
{
for (; *in8; in8++)
if (0x80 & *in8) return 0;
if (0x80 & *in8)
return 0;
return 1;
}
@ -274,7 +275,8 @@ static void utf_8_cut_end(char *inout8, size_t maxcutpoint)
{
char *cur = inout8 + maxcutpoint;
char cc;
if (!inout8) return;
if (!inout8)
return;
cc = *cur;
}