svn merge ^/trunk/blender -r46380:46390
This commit is contained in:
@@ -278,6 +278,25 @@ class CyclesCameraSettings(bpy.types.PropertyGroup):
|
||||
subtype='ANGLE',
|
||||
default=0,
|
||||
)
|
||||
cls.panorama_type = EnumProperty(
|
||||
name="Panorama Type",
|
||||
description="Distortion to use for the calculation",
|
||||
items=enums.panorama_types,
|
||||
default='FISHEYE_EQUISOLID',
|
||||
)
|
||||
cls.fisheye_fov = FloatProperty(
|
||||
name="Field of View",
|
||||
description="Field of view for the fisheye lens",
|
||||
min=0.1745, soft_max=2*math.pi, max=10.0*math.pi,
|
||||
subtype='ANGLE',
|
||||
default=math.pi,
|
||||
)
|
||||
cls.fisheye_lens = FloatProperty(
|
||||
name="Fisheye Lens",
|
||||
description="Lens focal length (mm)",
|
||||
min=0.01, soft_max=15.0, max=100.0,
|
||||
default=10.5,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def unregister(cls):
|
||||
|
||||
@@ -134,19 +134,6 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
|
||||
|
||||
/* Environment Camera */
|
||||
|
||||
__device float3 panorama_to_direction(KernelGlobals *kg, float u, float v)
|
||||
{
|
||||
switch(kernel_data.cam.panorama_type) {
|
||||
case PANORAMA_EQUIRECTANGULAR:
|
||||
return equirectangular_to_direction(u, v);
|
||||
case PANORAMA_FISHEYE_EQUIDISTANT:
|
||||
return fisheye_to_direction(u, v, kernel_data.cam.fisheye_fov);
|
||||
case PANORAMA_FISHEYE_EQUISOLID:
|
||||
default:
|
||||
return fisheye_equisolid_to_direction(u, v, kernel_data.cam.fisheye_lens, kernel_data.cam.fisheye_fov, kernel_data.cam.sensorwidth, kernel_data.cam.sensorheight);
|
||||
}
|
||||
}
|
||||
|
||||
__device void camera_sample_panorama(KernelGlobals *kg, float raster_x, float raster_y, Ray *ray)
|
||||
{
|
||||
Transform rastertocamera = kernel_data.cam.rastertocamera;
|
||||
|
||||
@@ -185,124 +185,6 @@ __device float2 regular_polygon_sample(float corners, float rotation, float u, f
|
||||
return make_float2(cr*p.x - sr*p.y, sr*p.x + cr*p.y);
|
||||
}
|
||||
|
||||
/* Spherical coordinates <-> Cartesian direction */
|
||||
|
||||
__device float2 direction_to_spherical(float3 dir)
|
||||
{
|
||||
float theta = acosf(dir.z);
|
||||
float phi = atan2f(dir.x, dir.y);
|
||||
|
||||
return make_float2(theta, phi);
|
||||
}
|
||||
|
||||
__device float3 spherical_to_direction(float theta, float phi)
|
||||
{
|
||||
return make_float3(
|
||||
sinf(theta)*cosf(phi),
|
||||
sinf(theta)*sinf(phi),
|
||||
cosf(theta));
|
||||
}
|
||||
|
||||
/* Equirectangular coordinates <-> Cartesian direction */
|
||||
|
||||
__device float2 direction_to_equirectangular(float3 dir)
|
||||
{
|
||||
float u = -atan2f(dir.y, dir.x)/(2.0f*M_PI_F) + 0.5f;
|
||||
float v = atan2f(dir.z, hypotf(dir.x, dir.y))/M_PI_F + 0.5f;
|
||||
|
||||
return make_float2(u, v);
|
||||
}
|
||||
|
||||
__device float3 equirectangular_to_direction(float u, float v)
|
||||
{
|
||||
float phi = M_PI_F*(1.0f - 2.0f*u);
|
||||
float theta = M_PI_F*(1.0f - v);
|
||||
|
||||
return make_float3(
|
||||
sin(theta)*cos(phi),
|
||||
sin(theta)*sin(phi),
|
||||
cos(theta));
|
||||
}
|
||||
|
||||
/* Fisheye <- Cartesian direction */
|
||||
|
||||
__device float3 fisheye_to_direction(float u, float v, float fov)
|
||||
{
|
||||
u = (u - 0.5f) * 2.0f;
|
||||
v = (v - 0.5f) * 2.0f;
|
||||
|
||||
float r = sqrt(u*u + v*v);
|
||||
|
||||
if(r > 1.0f)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
float phi = acosf((r != 0.0f)? u/r: 0.0f);
|
||||
float theta = asinf(r) * (fov / M_PI_F);
|
||||
|
||||
if(v < 0.0f) phi = -phi;
|
||||
|
||||
return make_float3(
|
||||
cosf(theta),
|
||||
-cosf(phi)*sinf(theta),
|
||||
sinf(phi)*sinf(theta)
|
||||
);
|
||||
}
|
||||
|
||||
__device float3 fisheye_equisolid_to_direction(float u, float v, float lens, float fov, float width, float height)
|
||||
{
|
||||
u = (u - 0.5f) * width;
|
||||
v = (v - 0.5f) * height;
|
||||
|
||||
float rmax = 2.0f * lens * sinf(fov * 0.25f);
|
||||
float r = sqrt(u*u + v*v);
|
||||
|
||||
if(r > rmax)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
float phi = acosf((r != 0.0f)? u/r: 0.0f);
|
||||
float theta = 2.0f * asinf(r/(2.0f * lens));
|
||||
|
||||
if(v < 0.0f) phi = -phi;
|
||||
|
||||
return make_float3(
|
||||
cosf(theta),
|
||||
-cosf(phi)*sinf(theta),
|
||||
sinf(phi)*sinf(theta)
|
||||
);
|
||||
}
|
||||
|
||||
/* Mirror Ball <-> Cartesion direction */
|
||||
|
||||
__device float3 mirrorball_to_direction(float u, float v)
|
||||
{
|
||||
/* point on sphere */
|
||||
float3 dir;
|
||||
|
||||
dir.x = 2.0f*u - 1.0f;
|
||||
dir.z = 2.0f*v - 1.0f;
|
||||
dir.y = -sqrt(max(1.0f - dir.x*dir.x - dir.z*dir.z, 0.0f));
|
||||
|
||||
/* reflection */
|
||||
float3 I = make_float3(0.0f, -1.0f, 0.0f);
|
||||
|
||||
return 2.0f*dot(dir, I)*dir - I;
|
||||
}
|
||||
|
||||
__device float2 direction_to_mirrorball(float3 dir)
|
||||
{
|
||||
/* inverse of mirrorball_to_direction */
|
||||
dir.y -= 1.0f;
|
||||
|
||||
float div = 2.0f*sqrt(max(-0.5f*dir.y, 0.0f));
|
||||
if(div > 0.0f)
|
||||
dir /= div;
|
||||
|
||||
float u = 0.5f*(dir.x + 1.0f);
|
||||
float v = 0.5f*(dir.z + 1.0f);
|
||||
|
||||
return make_float2(u, v);
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __KERNEL_MONTECARLO_CL__ */
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "kernel_differential.h"
|
||||
#include "kernel_montecarlo.h"
|
||||
#include "kernel_projection.h"
|
||||
#include "kernel_object.h"
|
||||
#include "kernel_triangle.h"
|
||||
#ifdef __QBVH__
|
||||
|
||||
@@ -217,15 +217,42 @@ __device float4 triangle_motion_vector(KernelGlobals *kg, ShaderData *sd)
|
||||
tfm = object_fetch_transform(kg, sd->object, TIME_INVALID, OBJECT_TRANSFORM_MOTION_POST);
|
||||
motion_post = transform_point(&tfm, motion_post);
|
||||
|
||||
/* camera motion */
|
||||
tfm = kernel_data.cam.worldtoraster;
|
||||
float3 P = transform_perspective(&tfm, sd->P);
|
||||
float3 P;
|
||||
|
||||
tfm = kernel_data.cam.motion.pre;
|
||||
motion_pre = transform_perspective(&tfm, motion_pre) - P;
|
||||
/* camera motion, for perspective/orthographic motion.pre/post will be a
|
||||
world-to-raster matrix, for panorama it's world-to-camera */
|
||||
if (kernel_data.cam.type != CAMERA_PANORAMA) {
|
||||
tfm = kernel_data.cam.worldtoraster;
|
||||
P = transform_perspective(&tfm, sd->P);
|
||||
|
||||
tfm = kernel_data.cam.motion.post;
|
||||
motion_post = P - transform_perspective(&tfm, motion_post);
|
||||
tfm = kernel_data.cam.motion.pre;
|
||||
motion_pre = transform_perspective(&tfm, motion_pre);
|
||||
|
||||
tfm = kernel_data.cam.motion.post;
|
||||
motion_post = transform_perspective(&tfm, motion_post);
|
||||
}
|
||||
else {
|
||||
tfm = kernel_data.cam.worldtocamera;
|
||||
P = normalize(transform_point(&tfm, sd->P));
|
||||
P = float2_to_float3(direction_to_panorama(kg, P));
|
||||
P.x *= kernel_data.cam.width;
|
||||
P.y *= kernel_data.cam.height;
|
||||
|
||||
tfm = kernel_data.cam.motion.pre;
|
||||
motion_pre = normalize(transform_point(&tfm, motion_pre));
|
||||
motion_pre = float2_to_float3(direction_to_panorama(kg, motion_pre));
|
||||
motion_pre.x *= kernel_data.cam.width;
|
||||
motion_pre.y *= kernel_data.cam.height;
|
||||
|
||||
tfm = kernel_data.cam.motion.post;
|
||||
motion_post = normalize(transform_point(&tfm, motion_post));
|
||||
motion_post = float2_to_float3(direction_to_panorama(kg, motion_post));
|
||||
motion_post.x *= kernel_data.cam.width;
|
||||
motion_post.y *= kernel_data.cam.height;
|
||||
}
|
||||
|
||||
motion_pre = motion_pre - P;
|
||||
motion_post = P - motion_post;
|
||||
|
||||
return make_float4(motion_pre.x, motion_pre.y, motion_post.x, motion_post.y);
|
||||
}
|
||||
|
||||
@@ -476,6 +476,13 @@ typedef struct KernelCamera {
|
||||
float nearclip;
|
||||
float cliplength;
|
||||
|
||||
/* sensor size */
|
||||
float sensorwidth;
|
||||
float sensorheight;
|
||||
|
||||
/* render size */
|
||||
float width, height;
|
||||
|
||||
/* more matrices */
|
||||
Transform screentoworld;
|
||||
Transform rastertoworld;
|
||||
|
||||
@@ -20,12 +20,35 @@ CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* Texture Coordinate Node */
|
||||
|
||||
__device float3 svm_background_offset(KernelGlobals *kg)
|
||||
__device_inline float3 svm_background_offset(KernelGlobals *kg)
|
||||
{
|
||||
Transform cameratoworld = kernel_data.cam.cameratoworld;
|
||||
return make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w);
|
||||
}
|
||||
|
||||
__device_inline float3 svm_world_to_ndc(KernelGlobals *kg, ShaderData *sd, float3 P)
|
||||
{
|
||||
if(kernel_data.cam.type != CAMERA_PANORAMA) {
|
||||
if(sd->object != ~0)
|
||||
P += svm_background_offset(kg);
|
||||
|
||||
Transform tfm = kernel_data.cam.worldtondc;
|
||||
return transform_perspective(&tfm, P);
|
||||
}
|
||||
else {
|
||||
Transform tfm = kernel_data.cam.worldtocamera;
|
||||
|
||||
if(sd->object != ~0)
|
||||
P = normalize(transform_point(&tfm, P));
|
||||
else
|
||||
P = normalize(transform_direction(&tfm, P));
|
||||
|
||||
float2 uv = direction_to_panorama(kg, P);;
|
||||
|
||||
return make_float3(uv.x, uv.y, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
__device void svm_node_tex_coord(KernelGlobals *kg, ShaderData *sd, float *stack, uint type, uint out_offset)
|
||||
{
|
||||
float3 data;
|
||||
@@ -59,12 +82,7 @@ __device void svm_node_tex_coord(KernelGlobals *kg, ShaderData *sd, float *stack
|
||||
break;
|
||||
}
|
||||
case NODE_TEXCO_WINDOW: {
|
||||
Transform tfm = kernel_data.cam.worldtondc;
|
||||
|
||||
if(sd->object != ~0)
|
||||
data = transform_perspective(&tfm, sd->P);
|
||||
else
|
||||
data = transform_perspective(&tfm, sd->P + svm_background_offset(kg));
|
||||
data = svm_world_to_ndc(kg, sd, sd->P);
|
||||
break;
|
||||
}
|
||||
case NODE_TEXCO_REFLECTION: {
|
||||
@@ -113,12 +131,7 @@ __device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, ShaderData *sd, floa
|
||||
break;
|
||||
}
|
||||
case NODE_TEXCO_WINDOW: {
|
||||
Transform tfm = kernel_data.cam.worldtondc;
|
||||
|
||||
if(sd->object != ~0)
|
||||
data = transform_perspective(&tfm, sd->P + sd->dP.dx);
|
||||
else
|
||||
data = transform_perspective(&tfm, sd->P + sd->dP.dx + svm_background_offset(kg));
|
||||
data = svm_world_to_ndc(kg, sd, sd->P + sd->dP.dx);
|
||||
break;
|
||||
}
|
||||
case NODE_TEXCO_REFLECTION: {
|
||||
@@ -170,12 +183,7 @@ __device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, floa
|
||||
break;
|
||||
}
|
||||
case NODE_TEXCO_WINDOW: {
|
||||
Transform tfm = kernel_data.cam.worldtondc;
|
||||
|
||||
if(sd->object != ~0)
|
||||
data = transform_perspective(&tfm, sd->P + sd->dP.dy);
|
||||
else
|
||||
data = transform_perspective(&tfm, sd->P + sd->dP.dy + svm_background_offset(kg));
|
||||
data = svm_world_to_ndc(kg, sd, sd->P + sd->dP.dy);
|
||||
break;
|
||||
}
|
||||
case NODE_TEXCO_REFLECTION: {
|
||||
|
||||
@@ -152,13 +152,25 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
|
||||
kcam->have_motion = 0;
|
||||
|
||||
if(need_motion == Scene::MOTION_PASS) {
|
||||
if(use_motion) {
|
||||
kcam->motion.pre = transform_inverse(motion.pre * rastertocamera);
|
||||
kcam->motion.post = transform_inverse(motion.post * rastertocamera);
|
||||
if(type == CAMERA_PANORAMA) {
|
||||
if(use_motion) {
|
||||
kcam->motion.pre = transform_inverse(motion.pre);
|
||||
kcam->motion.post = transform_inverse(motion.post);
|
||||
}
|
||||
else {
|
||||
kcam->motion.pre = kcam->worldtocamera;
|
||||
kcam->motion.post = kcam->worldtocamera;
|
||||
}
|
||||
}
|
||||
else {
|
||||
kcam->motion.pre = worldtoraster;
|
||||
kcam->motion.post = worldtoraster;
|
||||
if(use_motion) {
|
||||
kcam->motion.pre = transform_inverse(motion.pre * rastertocamera);
|
||||
kcam->motion.post = transform_inverse(motion.post * rastertocamera);
|
||||
}
|
||||
else {
|
||||
kcam->motion.pre = worldtoraster;
|
||||
kcam->motion.post = worldtoraster;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(need_motion == Scene::MOTION_BLUR) {
|
||||
@@ -181,6 +193,10 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
|
||||
/* type */
|
||||
kcam->type = type;
|
||||
|
||||
/* render size */
|
||||
kcam->width = width;
|
||||
kcam->height = height;
|
||||
|
||||
/* store differentials */
|
||||
kcam->dx = float3_to_float4(dx);
|
||||
kcam->dy = float3_to_float4(dy);
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
#include "util_foreach.h"
|
||||
#include "util_progress.h"
|
||||
|
||||
#include "kernel_montecarlo.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
static void dump_background_pixels(Device *device, DeviceScene *dscene, int res, vector<float3>& pixels)
|
||||
|
||||
@@ -507,6 +507,11 @@ __device_inline float3 fabs(float3 a)
|
||||
|
||||
#endif
|
||||
|
||||
__device_inline float3 float2_to_float3(const float2 a)
|
||||
{
|
||||
return make_float3(a.x, a.y, 0.0f);
|
||||
}
|
||||
|
||||
__device_inline float3 float4_to_float3(const float4 a)
|
||||
{
|
||||
return make_float3(a.x, a.y, a.z);
|
||||
|
||||
@@ -253,7 +253,7 @@ __device_inline bool transform_uniform_scale(const Transform& tfm, float& scale)
|
||||
/* the epsilon here is quite arbitrary, but this function is only used for
|
||||
surface area and bump, where we except it to not be so sensitive */
|
||||
Transform ttfm = transform_transpose(tfm);
|
||||
float eps = 1e-7f;
|
||||
float eps = 1e-6f;
|
||||
|
||||
float sx = len_squared(float4_to_float3(tfm.x));
|
||||
float sy = len_squared(float4_to_float3(tfm.y));
|
||||
@@ -261,7 +261,7 @@ __device_inline bool transform_uniform_scale(const Transform& tfm, float& scale)
|
||||
float stx = len_squared(float4_to_float3(ttfm.x));
|
||||
float sty = len_squared(float4_to_float3(ttfm.y));
|
||||
float stz = len_squared(float4_to_float3(ttfm.z));
|
||||
|
||||
|
||||
if(fabsf(sx - sy) < eps && fabsf(sx - sz) < eps &&
|
||||
fabsf(sx - stx) < eps && fabsf(sx - sty) < eps &&
|
||||
fabsf(sx - stz) < eps) {
|
||||
|
||||
@@ -247,6 +247,7 @@ protected:
|
||||
* @return Indication whether the event was handled.
|
||||
*/
|
||||
GHOST_TSuccess handleTabletEvent(void *eventPtr, short eventType);
|
||||
bool handleTabletEvent(void *eventPtr);
|
||||
|
||||
/**
|
||||
* Handles a mouse event.
|
||||
|
||||
@@ -1421,6 +1421,23 @@ GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventT
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
bool GHOST_SystemCocoa::handleTabletEvent(void *eventPtr)
|
||||
{
|
||||
NSEvent *event = (NSEvent *)eventPtr;
|
||||
|
||||
switch ([event subtype]) {
|
||||
case NX_SUBTYPE_TABLET_POINT:
|
||||
handleTabletEvent(eventPtr, NSTabletPoint);
|
||||
return true;
|
||||
case NX_SUBTYPE_TABLET_PROXIMITY:
|
||||
handleTabletEvent(eventPtr, NSTabletProximity);
|
||||
return true;
|
||||
default:
|
||||
//No tablet event included : do nothing
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
{
|
||||
@@ -1432,7 +1449,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
//printf("\nW failure for event 0x%x",[event type]);
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
|
||||
switch ([event type])
|
||||
{
|
||||
case NSLeftMouseDown:
|
||||
@@ -1440,17 +1457,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
case NSOtherMouseDown:
|
||||
pushEvent(new GHOST_EventButton([event timestamp]*1000, GHOST_kEventButtonDown, window, convertButton([event buttonNumber])));
|
||||
//Handle tablet events combined with mouse events
|
||||
switch ([event subtype]) {
|
||||
case NX_SUBTYPE_TABLET_POINT:
|
||||
handleTabletEvent(eventPtr, NSTabletPoint);
|
||||
break;
|
||||
case NX_SUBTYPE_TABLET_PROXIMITY:
|
||||
handleTabletEvent(eventPtr, NSTabletProximity);
|
||||
break;
|
||||
default:
|
||||
//No tablet event included : do nothing
|
||||
break;
|
||||
}
|
||||
handleTabletEvent(event);
|
||||
break;
|
||||
|
||||
case NSLeftMouseUp:
|
||||
@@ -1458,34 +1465,14 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
case NSOtherMouseUp:
|
||||
pushEvent(new GHOST_EventButton([event timestamp]*1000, GHOST_kEventButtonUp, window, convertButton([event buttonNumber])));
|
||||
//Handle tablet events combined with mouse events
|
||||
switch ([event subtype]) {
|
||||
case NX_SUBTYPE_TABLET_POINT:
|
||||
handleTabletEvent(eventPtr, NSTabletPoint);
|
||||
break;
|
||||
case NX_SUBTYPE_TABLET_PROXIMITY:
|
||||
handleTabletEvent(eventPtr, NSTabletProximity);
|
||||
break;
|
||||
default:
|
||||
//No tablet event included : do nothing
|
||||
break;
|
||||
}
|
||||
handleTabletEvent(event);
|
||||
break;
|
||||
|
||||
case NSLeftMouseDragged:
|
||||
case NSRightMouseDragged:
|
||||
case NSOtherMouseDragged:
|
||||
//Handle tablet events combined with mouse events
|
||||
switch ([event subtype]) {
|
||||
case NX_SUBTYPE_TABLET_POINT:
|
||||
handleTabletEvent(eventPtr, NSTabletPoint);
|
||||
break;
|
||||
case NX_SUBTYPE_TABLET_PROXIMITY:
|
||||
handleTabletEvent(eventPtr, NSTabletProximity);
|
||||
break;
|
||||
default:
|
||||
//No tablet event included : do nothing
|
||||
break;
|
||||
}
|
||||
handleTabletEvent(event);
|
||||
|
||||
case NSMouseMoved:
|
||||
{
|
||||
|
||||
@@ -51,8 +51,8 @@ typedef struct bMovieHandle {
|
||||
void (*get_movie_path)(char *string, struct RenderData *rd); /* optional */
|
||||
} bMovieHandle;
|
||||
|
||||
bMovieHandle *BKE_get_movie_handle(const char imtype);
|
||||
void BKE_makeanimstring(char *string, struct RenderData *rd);
|
||||
bMovieHandle *BKE_movie_handle_get(const char imtype);
|
||||
void BKE_movie_filepath_get(char *string, struct RenderData *rd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -66,20 +66,20 @@ struct RenderData;
|
||||
struct ReportList;
|
||||
struct Scene;
|
||||
|
||||
extern int start_ffmpeg(struct Scene *scene, struct RenderData *rd, int rectx, int recty, struct ReportList *reports);
|
||||
extern void end_ffmpeg(void);
|
||||
extern int append_ffmpeg(struct RenderData *rd, int start_frame, int frame, int *pixels,
|
||||
int rectx, int recty, struct ReportList *reports);
|
||||
void filepath_ffmpeg(char* string, struct RenderData* rd);
|
||||
int BKE_ffmpeg_start(struct Scene *scene, struct RenderData *rd, int rectx, int recty, struct ReportList *reports);
|
||||
void BKE_ffmpeg_end(void);
|
||||
int BKE_ffmpeg_append(struct RenderData *rd, int start_frame, int frame, int *pixels,
|
||||
int rectx, int recty, struct ReportList *reports);
|
||||
void BKE_ffmpeg_filepath_get(char* string, struct RenderData* rd);
|
||||
|
||||
extern void ffmpeg_set_preset(struct RenderData *rd, int preset);
|
||||
extern void ffmpeg_verify_image_type(struct RenderData *rd, struct ImageFormatData *imf);
|
||||
extern void ffmpeg_verify_codec_settings(struct RenderData *rd);
|
||||
extern int ffmpeg_alpha_channel_supported(struct RenderData *rd);
|
||||
void BKE_ffmpeg_preset_set(struct RenderData *rd, int preset);
|
||||
void BKE_ffmpeg_image_type_verify(struct RenderData *rd, struct ImageFormatData *imf);
|
||||
void BKE_ffmpeg_codec_settings_verify(struct RenderData *rd);
|
||||
int BKE_ffmpeg_alpha_channel_is_supported(struct RenderData *rd);
|
||||
|
||||
extern struct IDProperty *ffmpeg_property_add(struct RenderData *Rd, const char *type, int opt_index, int parent_index);
|
||||
extern int ffmpeg_property_add_string(struct RenderData *rd, const char *type, const char *str);
|
||||
extern void ffmpeg_property_del(struct RenderData *rd, void *type, void *prop_);
|
||||
struct IDProperty *BKE_ffmpeg_property_add(struct RenderData *Rd, const char *type, int opt_index, int parent_index);
|
||||
int BKE_ffmpeg_property_add_string(struct RenderData *rd, const char *type, const char *str);
|
||||
void BKE_ffmpeg_property_del(struct RenderData *rd, void *type, void *prop_);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -40,11 +40,11 @@ struct RenderData;
|
||||
struct ReportList;
|
||||
struct Scene;
|
||||
|
||||
extern int start_frameserver(struct Scene *scene, struct RenderData *rd, int rectx, int recty, struct ReportList *reports);
|
||||
extern void end_frameserver(void);
|
||||
extern int append_frameserver(struct RenderData *rd, int start_frame, int frame, int *pixels,
|
||||
int rectx, int recty, struct ReportList *reports);
|
||||
extern int frameserver_loop(struct RenderData *rd, struct ReportList *reports);
|
||||
int BKE_frameserver_start(struct Scene *scene, struct RenderData *rd, int rectx, int recty, struct ReportList *reports);
|
||||
void BKE_frameserver_end(void);
|
||||
int BKE_frameserver_append(struct RenderData *rd, int start_frame, int frame, int *pixels,
|
||||
int rectx, int recty, struct ReportList *reports);
|
||||
int BKE_frameserver_loop(struct RenderData *rd, struct ReportList *reports);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ static void filepath_avi(char *string, RenderData *rd);
|
||||
|
||||
#include "BKE_writeframeserver.h"
|
||||
|
||||
bMovieHandle *BKE_get_movie_handle(const char imtype)
|
||||
bMovieHandle *BKE_movie_handle_get(const char imtype)
|
||||
{
|
||||
static bMovieHandle mh;
|
||||
|
||||
@@ -97,18 +97,18 @@ bMovieHandle *BKE_get_movie_handle(const char imtype)
|
||||
#endif
|
||||
#ifdef WITH_FFMPEG
|
||||
if (ELEM4(imtype, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_XVID, R_IMF_IMTYPE_THEORA)) {
|
||||
mh.start_movie = start_ffmpeg;
|
||||
mh.append_movie = append_ffmpeg;
|
||||
mh.end_movie = end_ffmpeg;
|
||||
mh.get_movie_path = filepath_ffmpeg;
|
||||
mh.start_movie = BKE_ffmpeg_start;
|
||||
mh.append_movie = BKE_ffmpeg_append;
|
||||
mh.end_movie = BKE_ffmpeg_end;
|
||||
mh.get_movie_path = BKE_ffmpeg_filepath_get;
|
||||
}
|
||||
#endif
|
||||
#ifdef WITH_FRAMESERVER
|
||||
if (imtype == R_IMF_IMTYPE_FRAMESERVER) {
|
||||
mh.start_movie = start_frameserver;
|
||||
mh.append_movie = append_frameserver;
|
||||
mh.end_movie = end_frameserver;
|
||||
mh.get_next_frame = frameserver_loop;
|
||||
mh.start_movie = BKE_frameserver_start;
|
||||
mh.append_movie = BKE_frameserver_append;
|
||||
mh.end_movie = BKE_frameserver_end;
|
||||
mh.get_next_frame = BKE_frameserver_loop;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -228,9 +228,9 @@ static void end_avi(void)
|
||||
}
|
||||
|
||||
/* similar to BKE_makepicstring() */
|
||||
void BKE_makeanimstring(char *string, RenderData *rd)
|
||||
void BKE_movie_filepath_get(char *string, RenderData *rd)
|
||||
{
|
||||
bMovieHandle *mh= BKE_get_movie_handle(rd->im_format.imtype);
|
||||
bMovieHandle *mh= BKE_movie_handle_get(rd->im_format.imtype);
|
||||
if (mh->get_movie_path)
|
||||
mh->get_movie_path(string, rd);
|
||||
else
|
||||
|
||||
@@ -678,7 +678,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
|
||||
do_init_ffmpeg();
|
||||
|
||||
/* Determine the correct filename */
|
||||
filepath_ffmpeg(name, rd);
|
||||
BKE_ffmpeg_filepath_get(name, rd);
|
||||
fprintf(stderr, "Starting output to %s(ffmpeg)...\n"
|
||||
" Using type=%d, codec=%d, audio_codec=%d,\n"
|
||||
" video_bitrate=%d, audio_bitrate=%d,\n"
|
||||
@@ -884,7 +884,7 @@ void flush_ffmpeg(void)
|
||||
* ********************************************************************** */
|
||||
|
||||
/* Get the output filename-- similar to the other output formats */
|
||||
void filepath_ffmpeg(char* string, RenderData* rd)
|
||||
void BKE_ffmpeg_filepath_get(char* string, RenderData* rd)
|
||||
{
|
||||
char autosplit[20];
|
||||
|
||||
@@ -925,7 +925,7 @@ void filepath_ffmpeg(char* string, RenderData* rd)
|
||||
}
|
||||
}
|
||||
|
||||
int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports)
|
||||
int BKE_ffmpeg_start(struct Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports)
|
||||
{
|
||||
int success;
|
||||
|
||||
@@ -949,7 +949,7 @@ int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, Repo
|
||||
return success;
|
||||
}
|
||||
|
||||
void end_ffmpeg(void);
|
||||
void BKE_ffmpeg_end(void);
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
static void write_audio_frames(double to_pts)
|
||||
@@ -965,7 +965,7 @@ static void write_audio_frames(double to_pts)
|
||||
}
|
||||
#endif
|
||||
|
||||
int append_ffmpeg(RenderData *rd, int start_frame, int frame, int *pixels, int rectx, int recty, ReportList *reports)
|
||||
int BKE_ffmpeg_append(RenderData *rd, int start_frame, int frame, int *pixels, int rectx, int recty, ReportList *reports)
|
||||
{
|
||||
AVFrame* avframe;
|
||||
int success = 1;
|
||||
@@ -983,7 +983,7 @@ int append_ffmpeg(RenderData *rd, int start_frame, int frame, int *pixels, int r
|
||||
|
||||
if (ffmpeg_autosplit) {
|
||||
if (avio_tell(outfile->pb) > FFMPEG_AUTOSPLIT_SIZE) {
|
||||
end_ffmpeg();
|
||||
BKE_ffmpeg_end();
|
||||
ffmpeg_autosplit_count++;
|
||||
success &= start_ffmpeg_impl(rd, rectx, recty, reports);
|
||||
}
|
||||
@@ -996,7 +996,7 @@ int append_ffmpeg(RenderData *rd, int start_frame, int frame, int *pixels, int r
|
||||
return success;
|
||||
}
|
||||
|
||||
void end_ffmpeg(void)
|
||||
void BKE_ffmpeg_end(void)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
@@ -1074,7 +1074,7 @@ void end_ffmpeg(void)
|
||||
|
||||
/* properties */
|
||||
|
||||
void ffmpeg_property_del(RenderData *rd, void *type, void *prop_)
|
||||
void BKE_ffmpeg_property_del(RenderData *rd, void *type, void *prop_)
|
||||
{
|
||||
struct IDProperty *prop = (struct IDProperty *) prop_;
|
||||
IDProperty * group;
|
||||
@@ -1091,7 +1091,7 @@ void ffmpeg_property_del(RenderData *rd, void *type, void *prop_)
|
||||
}
|
||||
}
|
||||
|
||||
IDProperty *ffmpeg_property_add(RenderData *rd, const char *type, int opt_index, int parent_index)
|
||||
IDProperty *BKE_ffmpeg_property_add(RenderData *rd, const char *type, int opt_index, int parent_index)
|
||||
{
|
||||
AVCodecContext c;
|
||||
const AVOption * o;
|
||||
@@ -1184,7 +1184,7 @@ static const AVOption *my_av_find_opt(void *v, const char *name,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int ffmpeg_property_add_string(RenderData *rd, const char * type, const char * str)
|
||||
int BKE_ffmpeg_property_add_string(RenderData *rd, const char * type, const char * str)
|
||||
{
|
||||
AVCodecContext c;
|
||||
const AVOption * o = 0;
|
||||
@@ -1220,12 +1220,12 @@ int ffmpeg_property_add_string(RenderData *rd, const char * type, const char * s
|
||||
}
|
||||
if (param && o->type != FF_OPT_TYPE_CONST && o->unit) {
|
||||
p = my_av_find_opt(&c, param, o->unit, 0, 0);
|
||||
prop = ffmpeg_property_add(rd,
|
||||
prop = BKE_ffmpeg_property_add(rd,
|
||||
(char*) type, p - c.av_class->option,
|
||||
o - c.av_class->option);
|
||||
}
|
||||
else {
|
||||
prop = ffmpeg_property_add(rd,
|
||||
prop = BKE_ffmpeg_property_add(rd,
|
||||
(char*) type, o - c.av_class->option, 0);
|
||||
}
|
||||
|
||||
@@ -1268,37 +1268,37 @@ static void ffmpeg_set_expert_options(RenderData *rd)
|
||||
* Use CABAC coder. Using "coder:1", which should be equivalent,
|
||||
* crashes Blender for some reason. Either way - this is no big deal.
|
||||
*/
|
||||
ffmpeg_property_add_string(rd, "video", "coder:vlc");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "coder:vlc");
|
||||
|
||||
/*
|
||||
* The other options were taken from the libx264-default.preset
|
||||
* included in the ffmpeg distribution.
|
||||
*/
|
||||
// ffmpeg_property_add_string(rd, "video", "flags:loop"); // this breaks compatibility for QT
|
||||
ffmpeg_property_add_string(rd, "video", "cmp:chroma");
|
||||
ffmpeg_property_add_string(rd, "video", "partitions:parti4x4");
|
||||
ffmpeg_property_add_string(rd, "video", "partitions:partp8x8");
|
||||
ffmpeg_property_add_string(rd, "video", "partitions:partb8x8");
|
||||
ffmpeg_property_add_string(rd, "video", "me:hex");
|
||||
ffmpeg_property_add_string(rd, "video", "subq:6");
|
||||
ffmpeg_property_add_string(rd, "video", "me_range:16");
|
||||
ffmpeg_property_add_string(rd, "video", "qdiff:4");
|
||||
ffmpeg_property_add_string(rd, "video", "keyint_min:25");
|
||||
ffmpeg_property_add_string(rd, "video", "sc_threshold:40");
|
||||
ffmpeg_property_add_string(rd, "video", "i_qfactor:0.71");
|
||||
ffmpeg_property_add_string(rd, "video", "b_strategy:1");
|
||||
ffmpeg_property_add_string(rd, "video", "bf:3");
|
||||
ffmpeg_property_add_string(rd, "video", "refs:2");
|
||||
ffmpeg_property_add_string(rd, "video", "qcomp:0.6");
|
||||
ffmpeg_property_add_string(rd, "video", "directpred:3");
|
||||
ffmpeg_property_add_string(rd, "video", "trellis:0");
|
||||
ffmpeg_property_add_string(rd, "video", "flags2:wpred");
|
||||
ffmpeg_property_add_string(rd, "video", "flags2:dct8x8");
|
||||
ffmpeg_property_add_string(rd, "video", "flags2:fastpskip");
|
||||
ffmpeg_property_add_string(rd, "video", "wpredp:2");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "cmp:chroma");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "partitions:parti4x4");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "partitions:partp8x8");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "partitions:partb8x8");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "me:hex");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "subq:6");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "me_range:16");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "qdiff:4");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "keyint_min:25");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "sc_threshold:40");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "i_qfactor:0.71");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "b_strategy:1");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "bf:3");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "refs:2");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "qcomp:0.6");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "directpred:3");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "trellis:0");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "flags2:wpred");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "flags2:dct8x8");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "flags2:fastpskip");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "wpredp:2");
|
||||
|
||||
if (rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT)
|
||||
ffmpeg_property_add_string(rd, "video", "cqp:0");
|
||||
BKE_ffmpeg_property_add_string(rd, "video", "cqp:0");
|
||||
}
|
||||
#if 0 /* disabled for after release */
|
||||
else if (codec_id == CODEC_ID_DNXHD) {
|
||||
@@ -1308,7 +1308,7 @@ static void ffmpeg_set_expert_options(RenderData *rd)
|
||||
#endif
|
||||
}
|
||||
|
||||
void ffmpeg_set_preset(RenderData *rd, int preset)
|
||||
void BKE_ffmpeg_preset_set(RenderData *rd, int preset)
|
||||
{
|
||||
int isntsc = (rd->frs_sec != 25);
|
||||
|
||||
@@ -1402,7 +1402,7 @@ void ffmpeg_set_preset(RenderData *rd, int preset)
|
||||
ffmpeg_set_expert_options(rd);
|
||||
}
|
||||
|
||||
void ffmpeg_verify_image_type(RenderData *rd, ImageFormatData *imf)
|
||||
void BKE_ffmpeg_image_type_verify(RenderData *rd, ImageFormatData *imf)
|
||||
{
|
||||
int audio= 0;
|
||||
|
||||
@@ -1414,7 +1414,7 @@ void ffmpeg_verify_image_type(RenderData *rd, ImageFormatData *imf)
|
||||
|
||||
rd->ffcodecdata.codec = CODEC_ID_MPEG2VIDEO;
|
||||
|
||||
ffmpeg_set_preset(rd, FFMPEG_PRESET_DVD);
|
||||
BKE_ffmpeg_preset_set(rd, FFMPEG_PRESET_DVD);
|
||||
}
|
||||
if (rd->ffcodecdata.type == FFMPEG_OGG) {
|
||||
rd->ffcodecdata.type = FFMPEG_MPEG2;
|
||||
@@ -1424,19 +1424,19 @@ void ffmpeg_verify_image_type(RenderData *rd, ImageFormatData *imf)
|
||||
}
|
||||
else if (imf->imtype == R_IMF_IMTYPE_H264) {
|
||||
if (rd->ffcodecdata.codec != CODEC_ID_H264) {
|
||||
ffmpeg_set_preset(rd, FFMPEG_PRESET_H264);
|
||||
BKE_ffmpeg_preset_set(rd, FFMPEG_PRESET_H264);
|
||||
audio= 1;
|
||||
}
|
||||
}
|
||||
else if (imf->imtype == R_IMF_IMTYPE_XVID) {
|
||||
if (rd->ffcodecdata.codec != CODEC_ID_MPEG4) {
|
||||
ffmpeg_set_preset(rd, FFMPEG_PRESET_XVID);
|
||||
BKE_ffmpeg_preset_set(rd, FFMPEG_PRESET_XVID);
|
||||
audio= 1;
|
||||
}
|
||||
}
|
||||
else if (imf->imtype == R_IMF_IMTYPE_THEORA) {
|
||||
if (rd->ffcodecdata.codec != CODEC_ID_THEORA) {
|
||||
ffmpeg_set_preset(rd, FFMPEG_PRESET_THEORA);
|
||||
BKE_ffmpeg_preset_set(rd, FFMPEG_PRESET_THEORA);
|
||||
audio= 1;
|
||||
}
|
||||
}
|
||||
@@ -1447,12 +1447,12 @@ void ffmpeg_verify_image_type(RenderData *rd, ImageFormatData *imf)
|
||||
}
|
||||
}
|
||||
|
||||
void ffmpeg_verify_codec_settings(RenderData *rd)
|
||||
void BKE_ffmpeg_codec_settings_verify(RenderData *rd)
|
||||
{
|
||||
ffmpeg_set_expert_options(rd);
|
||||
}
|
||||
|
||||
int ffmpeg_alpha_channel_supported(RenderData *rd)
|
||||
int BKE_ffmpeg_alpha_channel_is_supported(RenderData *rd)
|
||||
{
|
||||
int codec = rd->ffcodecdata.codec;
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ static int closesocket(int fd)
|
||||
}
|
||||
#endif
|
||||
|
||||
int start_frameserver(struct Scene *scene, RenderData *UNUSED(rd), int rectx, int recty, ReportList *reports)
|
||||
int BKE_frameserver_start(struct Scene *scene, RenderData *UNUSED(rd), int rectx, int recty, ReportList *reports)
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
int arg = 1;
|
||||
@@ -258,7 +258,7 @@ static int handle_request(RenderData *rd, char * req)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int frameserver_loop(RenderData *rd, ReportList *UNUSED(reports))
|
||||
int BKE_frameserver_loop(RenderData *rd, ReportList *UNUSED(reports))
|
||||
{
|
||||
fd_set readfds;
|
||||
struct timeval tv;
|
||||
@@ -371,7 +371,7 @@ static void serve_ppm(int *pixels, int rectx, int recty)
|
||||
connsock = -1;
|
||||
}
|
||||
|
||||
int append_frameserver(RenderData *UNUSED(rd), int UNUSED(start_frame), int frame, int *pixels,
|
||||
int BKE_frameserver_append(RenderData *UNUSED(rd), int UNUSED(start_frame), int frame, int *pixels,
|
||||
int rectx, int recty, ReportList *UNUSED(reports))
|
||||
{
|
||||
fprintf(stderr, "Serving frame: %d\n", frame);
|
||||
@@ -386,7 +386,7 @@ int append_frameserver(RenderData *UNUSED(rd), int UNUSED(start_frame), int fram
|
||||
return 0;
|
||||
}
|
||||
|
||||
void end_frameserver(void)
|
||||
void BKE_frameserver_end(void)
|
||||
{
|
||||
if (connsock != -1) {
|
||||
closesocket(connsock);
|
||||
|
||||
@@ -5219,6 +5219,7 @@ void CURVE_OT_select_more(wmOperatorType *ot)
|
||||
/* identifiers */
|
||||
ot->name = "Select More";
|
||||
ot->idname = "CURVE_OT_select_more";
|
||||
ot->description = "Select control points directly linked to already selected ones";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = select_more_exec;
|
||||
|
||||
@@ -444,7 +444,7 @@ static int screen_opengl_render_anim_initialize(bContext *C, wmOperator *op)
|
||||
scene = oglrender->scene;
|
||||
|
||||
oglrender->reports = op->reports;
|
||||
oglrender->mh = BKE_get_movie_handle(scene->r.im_format.imtype);
|
||||
oglrender->mh = BKE_movie_handle_get(scene->r.im_format.imtype);
|
||||
if (BKE_imtype_is_movie(scene->r.im_format.imtype)) {
|
||||
if (!oglrender->mh->start_movie(scene, &scene->r, oglrender->sizex, oglrender->sizey, oglrender->reports)) {
|
||||
screen_opengl_render_end(C, oglrender);
|
||||
|
||||
@@ -315,7 +315,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
|
||||
{
|
||||
ScreenshotJob *sj= sjv;
|
||||
RenderData rd= sj->scene->r;
|
||||
bMovieHandle *mh= BKE_get_movie_handle(sj->scene->r.im_format.imtype);
|
||||
bMovieHandle *mh= BKE_movie_handle_get(sj->scene->r.im_format.imtype);
|
||||
|
||||
/* we need this as local variables for renderdata */
|
||||
rd.frs_sec= U.scrcastfps;
|
||||
|
||||
@@ -530,6 +530,7 @@ void CLIP_OT_view_zoom(wmOperatorType *ot)
|
||||
/* identifiers */
|
||||
ot->name = "View Zoom";
|
||||
ot->idname = "CLIP_OT_view_zoom";
|
||||
ot->description = "Zoom in/out the view";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = view_zoom_exec;
|
||||
|
||||
@@ -2157,6 +2157,7 @@ void IMAGE_OT_curves_point_set(wmOperatorType *ot)
|
||||
/* identifiers */
|
||||
ot->name = "Set Curves Point";
|
||||
ot->idname = "IMAGE_OT_curves_point_set";
|
||||
ot->description = "Set black point or white point for curves";
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
@@ -74,20 +74,20 @@
|
||||
|
||||
static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
|
||||
{
|
||||
TreeElement *te= lb->first;
|
||||
TreeElement *te = lb->first;
|
||||
while (te) {
|
||||
TreeStoreElem *tselem= TREESTORE(te);
|
||||
TreeStoreElem *tselem = TREESTORE(te);
|
||||
if (TSELEM_OPEN(tselem, soops))
|
||||
outliner_height(soops, &te->subtree, h);
|
||||
(*h) += UI_UNIT_Y;
|
||||
te= te->next;
|
||||
te = te->next;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 // XXX this is currently disabled until te->xend is set correctly
|
||||
static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
|
||||
{
|
||||
TreeElement *te= lb->first;
|
||||
TreeElement *te = lb->first;
|
||||
while (te) {
|
||||
// TreeStoreElem *tselem= TREESTORE(te);
|
||||
|
||||
@@ -97,16 +97,16 @@ static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
|
||||
*w = te->xend;
|
||||
}
|
||||
outliner_width(soops, &te->subtree, w);
|
||||
te= te->next;
|
||||
te = te->next;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void outliner_rna_width(SpaceOops *soops, ListBase *lb, int *w, int startx)
|
||||
{
|
||||
TreeElement *te= lb->first;
|
||||
TreeElement *te = lb->first;
|
||||
while (te) {
|
||||
TreeStoreElem *tselem= TREESTORE(te);
|
||||
TreeStoreElem *tselem = TREESTORE(te);
|
||||
// XXX fixme... (currently, we're using a fixed length of 100)!
|
||||
#if 0
|
||||
if (te->xend) {
|
||||
@@ -114,12 +114,12 @@ static void outliner_rna_width(SpaceOops *soops, ListBase *lb, int *w, int start
|
||||
*w = te->xend;
|
||||
}
|
||||
#endif
|
||||
if (startx+100 > *w)
|
||||
*w = startx+100;
|
||||
if (startx + 100 > *w)
|
||||
*w = startx + 100;
|
||||
|
||||
if (TSELEM_OPEN(tselem, soops))
|
||||
outliner_rna_width(soops, &te->subtree, w, startx+UI_UNIT_X);
|
||||
te= te->next;
|
||||
outliner_rna_width(soops, &te->subtree, w, startx + UI_UNIT_X);
|
||||
te = te->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2)
|
||||
* so have to do loop to find it. */
|
||||
ED_base_object_select(BKE_scene_base_find(scene, ob), BA_DESELECT);
|
||||
}
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
|
||||
}
|
||||
|
||||
@@ -155,18 +155,18 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2)
|
||||
* so have to do loop to find it. */
|
||||
ED_base_object_select(BKE_scene_base_find(scene, ob), BA_DESELECT);
|
||||
}
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
|
||||
}
|
||||
|
||||
static void restrictbutton_rend_cb(bContext *C, void *poin, void *UNUSED(poin2))
|
||||
{
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, poin);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_RENDER, poin);
|
||||
}
|
||||
|
||||
static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *UNUSED(poin2))
|
||||
{
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, poin);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, poin);
|
||||
}
|
||||
|
||||
static void restrictbutton_modifier_cb(bContext *C, void *UNUSED(poin), void *poin2)
|
||||
@@ -175,31 +175,31 @@ static void restrictbutton_modifier_cb(bContext *C, void *UNUSED(poin), void *po
|
||||
|
||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
|
||||
}
|
||||
|
||||
static void restrictbutton_bone_cb(bContext *C, void *UNUSED(poin), void *poin2)
|
||||
{
|
||||
Bone *bone= (Bone *)poin2;
|
||||
Bone *bone = (Bone *)poin2;
|
||||
if (bone && (bone->flag & BONE_HIDDEN_P))
|
||||
bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
|
||||
}
|
||||
|
||||
static void restrictbutton_ebone_cb(bContext *C, void *UNUSED(poin), void *poin2)
|
||||
{
|
||||
EditBone *ebone= (EditBone *)poin2;
|
||||
EditBone *ebone = (EditBone *)poin2;
|
||||
if (ebone && (ebone->flag & BONE_HIDDEN_A))
|
||||
ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
|
||||
}
|
||||
|
||||
static int group_restrict_flag(Group *gr, int flag)
|
||||
{
|
||||
GroupObject *gob;
|
||||
|
||||
for (gob= gr->gobject.first; gob; gob= gob->next) {
|
||||
for (gob = gr->gobject.first; gob; gob = gob->next) {
|
||||
if ((gob->ob->restrictflag & flag) == 0)
|
||||
return 0;
|
||||
}
|
||||
@@ -211,7 +211,7 @@ static int group_select_flag(Group *gr)
|
||||
{
|
||||
GroupObject *gob;
|
||||
|
||||
for (gob= gr->gobject.first; gob; gob= gob->next)
|
||||
for (gob = gr->gobject.first; gob; gob = gob->next)
|
||||
if ((gob->ob->flag & SELECT))
|
||||
return 1;
|
||||
|
||||
@@ -225,21 +225,21 @@ void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag)
|
||||
Group *gr = (Group *)poin2;
|
||||
|
||||
if (group_restrict_flag(gr, flag)) {
|
||||
for (gob= gr->gobject.first; gob; gob= gob->next) {
|
||||
for (gob = gr->gobject.first; gob; gob = gob->next) {
|
||||
gob->ob->restrictflag &= ~flag;
|
||||
|
||||
if (flag==OB_RESTRICT_VIEW)
|
||||
if (flag == OB_RESTRICT_VIEW)
|
||||
if (gob->ob->flag & SELECT)
|
||||
ED_base_object_select(BKE_scene_base_find(scene, gob->ob), BA_DESELECT);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (gob= gr->gobject.first; gob; gob= gob->next) {
|
||||
for (gob = gr->gobject.first; gob; gob = gob->next) {
|
||||
/* not in editmode */
|
||||
if (scene->obedit!=gob->ob) {
|
||||
if (scene->obedit != gob->ob) {
|
||||
gob->ob->restrictflag |= flag;
|
||||
|
||||
if (flag==OB_RESTRICT_VIEW)
|
||||
if (flag == OB_RESTRICT_VIEW)
|
||||
if ((gob->ob->flag & SELECT) == 0)
|
||||
ED_base_object_select(BKE_scene_base_find(scene, gob->ob), BA_SELECT);
|
||||
}
|
||||
@@ -266,17 +266,17 @@ static void restrictbutton_gr_restrict_render(bContext *C, void *poin, void *poi
|
||||
|
||||
static void namebutton_cb(bContext *C, void *tsep, char *oldname)
|
||||
{
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
TreeStore *ts= soops->treestore;
|
||||
TreeStoreElem *tselem= tsep;
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
TreeStore *ts = soops->treestore;
|
||||
TreeStoreElem *tselem = tsep;
|
||||
|
||||
if (ts && tselem) {
|
||||
TreeElement *te= outliner_find_tse(soops, tselem);
|
||||
TreeElement *te = outliner_find_tse(soops, tselem);
|
||||
|
||||
if (tselem->type==0) {
|
||||
test_idbutton(tselem->id->name+2); // library.c, unique name and alpha sort
|
||||
if (tselem->type == 0) {
|
||||
test_idbutton(tselem->id->name + 2); // library.c, unique name and alpha sort
|
||||
|
||||
switch (GS(tselem->id->name)) {
|
||||
case ID_MA:
|
||||
@@ -288,11 +288,11 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
|
||||
case ID_SCE:
|
||||
WM_event_add_notifier(C, NC_SCENE, NULL); break;
|
||||
default:
|
||||
WM_event_add_notifier(C, NC_ID|NA_RENAME, NULL); break;
|
||||
WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL); break;
|
||||
}
|
||||
/* Check the library target exists */
|
||||
if (te->idcode == ID_LI) {
|
||||
Library *lib= (Library *)tselem->id;
|
||||
Library *lib = (Library *)tselem->id;
|
||||
char expanded[FILE_MAX];
|
||||
|
||||
BKE_library_filepath_set(lib, lib->name);
|
||||
@@ -306,73 +306,73 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
|
||||
}
|
||||
else {
|
||||
switch (tselem->type) {
|
||||
case TSE_DEFGROUP:
|
||||
defgroup_unique_name(te->directdata, (Object *)tselem->id); // id = object
|
||||
break;
|
||||
case TSE_NLA_ACTION:
|
||||
test_idbutton(tselem->id->name+2);
|
||||
break;
|
||||
case TSE_EBONE:
|
||||
{
|
||||
bArmature *arm= (bArmature *)tselem->id;
|
||||
if (arm->edbo) {
|
||||
EditBone *ebone= te->directdata;
|
||||
char newname[sizeof(ebone->name)];
|
||||
|
||||
/* restore bone name */
|
||||
BLI_strncpy(newname, ebone->name, sizeof(ebone->name));
|
||||
BLI_strncpy(ebone->name, oldname, sizeof(ebone->name));
|
||||
ED_armature_bone_rename(obedit->data, oldname, newname);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, OBACT);
|
||||
case TSE_DEFGROUP:
|
||||
defgroup_unique_name(te->directdata, (Object *)tselem->id); // id = object
|
||||
break;
|
||||
case TSE_NLA_ACTION:
|
||||
test_idbutton(tselem->id->name + 2);
|
||||
break;
|
||||
case TSE_EBONE:
|
||||
{
|
||||
bArmature *arm = (bArmature *)tselem->id;
|
||||
if (arm->edbo) {
|
||||
EditBone *ebone = te->directdata;
|
||||
char newname[sizeof(ebone->name)];
|
||||
|
||||
/* restore bone name */
|
||||
BLI_strncpy(newname, ebone->name, sizeof(ebone->name));
|
||||
BLI_strncpy(ebone->name, oldname, sizeof(ebone->name));
|
||||
ED_armature_bone_rename(obedit->data, oldname, newname);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, OBACT);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TSE_BONE:
|
||||
case TSE_BONE:
|
||||
{
|
||||
Bone *bone= te->directdata;
|
||||
Bone *bone = te->directdata;
|
||||
Object *ob;
|
||||
char newname[sizeof(bone->name)];
|
||||
|
||||
// always make current object active
|
||||
tree_element_active(C, scene, soops, te, 1); // was set_active_object()
|
||||
ob= OBACT;
|
||||
ob = OBACT;
|
||||
|
||||
/* restore bone name */
|
||||
BLI_strncpy(newname, bone->name, sizeof(bone->name));
|
||||
BLI_strncpy(bone->name, oldname, sizeof(bone->name));
|
||||
ED_armature_bone_rename(ob->data, oldname, newname);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
|
||||
}
|
||||
break;
|
||||
case TSE_POSE_CHANNEL:
|
||||
case TSE_POSE_CHANNEL:
|
||||
{
|
||||
bPoseChannel *pchan= te->directdata;
|
||||
bPoseChannel *pchan = te->directdata;
|
||||
Object *ob;
|
||||
char newname[sizeof(pchan->name)];
|
||||
|
||||
// always make current object active
|
||||
tree_element_active(C, scene, soops, te, 1); // was set_active_object()
|
||||
ob= OBACT;
|
||||
ob = OBACT;
|
||||
|
||||
/* restore bone name */
|
||||
BLI_strncpy(newname, pchan->name, sizeof(pchan->name));
|
||||
BLI_strncpy(pchan->name, oldname, sizeof(pchan->name));
|
||||
ED_armature_bone_rename(ob->data, oldname, newname);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
|
||||
}
|
||||
break;
|
||||
case TSE_POSEGRP:
|
||||
case TSE_POSEGRP:
|
||||
{
|
||||
Object *ob= (Object *)tselem->id; // id = object
|
||||
bActionGroup *grp= te->directdata;
|
||||
Object *ob = (Object *)tselem->id; // id = object
|
||||
bActionGroup *grp = te->directdata;
|
||||
|
||||
BLI_uniquename(&ob->pose->agroups, grp, "Group", '.', offsetof(bActionGroup, name), sizeof(grp->name));
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
|
||||
}
|
||||
break;
|
||||
case TSE_R_LAYER:
|
||||
break;
|
||||
case TSE_R_LAYER:
|
||||
break;
|
||||
}
|
||||
}
|
||||
tselem->flag &= ~TSE_TEXTBUT;
|
||||
@@ -387,120 +387,120 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
|
||||
Object *ob = NULL;
|
||||
Group *gr = NULL;
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
if (te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
|
||||
/* objects have toggle-able restriction flags */
|
||||
if (tselem->type==0 && te->idcode==ID_OB) {
|
||||
if (tselem->type == 0 && te->idcode == ID_OB) {
|
||||
PointerRNA ptr;
|
||||
|
||||
ob = (Object *)tselem->id;
|
||||
RNA_pointer_create((ID *)ob, &RNA_Object, ob, &ptr);
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
bt= uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_VIEW_OFF,
|
||||
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1,
|
||||
&ptr, "hide", -1, 0, 0, -1, -1, NULL);
|
||||
bt = uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_VIEW_OFF,
|
||||
(int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1,
|
||||
&ptr, "hide", -1, 0, 0, -1, -1, NULL);
|
||||
uiButSetFunc(bt, restrictbutton_view_cb, scene, ob);
|
||||
|
||||
bt= uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_SELECT_OFF,
|
||||
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1,
|
||||
&ptr, "hide_select", -1, 0, 0, -1, -1, NULL);
|
||||
bt = uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_SELECT_OFF,
|
||||
(int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1,
|
||||
&ptr, "hide_select", -1, 0, 0, -1, -1, NULL);
|
||||
uiButSetFunc(bt, restrictbutton_sel_cb, scene, ob);
|
||||
|
||||
bt= uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_RENDER_OFF,
|
||||
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1,
|
||||
&ptr, "hide_render", -1, 0, 0, -1, -1, NULL);
|
||||
bt = uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_RENDER_OFF,
|
||||
(int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1,
|
||||
&ptr, "hide_render", -1, 0, 0, -1, -1, NULL);
|
||||
uiButSetFunc(bt, restrictbutton_rend_cb, scene, ob);
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
|
||||
}
|
||||
if (tselem->type==0 && te->idcode==ID_GR) {
|
||||
if (tselem->type == 0 && te->idcode == ID_GR) {
|
||||
int restrict_bool;
|
||||
gr = (Group *)tselem->id;
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
|
||||
restrict_bool= group_restrict_flag(gr, OB_RESTRICT_VIEW);
|
||||
bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, NULL, 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
|
||||
restrict_bool = group_restrict_flag(gr, OB_RESTRICT_VIEW);
|
||||
bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF, (int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, NULL, 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
|
||||
uiButSetFunc(bt, restrictbutton_gr_restrict_view, scene, gr);
|
||||
|
||||
restrict_bool= group_restrict_flag(gr, OB_RESTRICT_SELECT);
|
||||
bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_SELECT_ON : ICON_RESTRICT_SELECT_OFF, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, NULL, 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
|
||||
restrict_bool = group_restrict_flag(gr, OB_RESTRICT_SELECT);
|
||||
bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_SELECT_ON : ICON_RESTRICT_SELECT_OFF, (int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, NULL, 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
|
||||
uiButSetFunc(bt, restrictbutton_gr_restrict_select, scene, gr);
|
||||
|
||||
restrict_bool= group_restrict_flag(gr, OB_RESTRICT_RENDER);
|
||||
bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_RENDER_ON : ICON_RESTRICT_RENDER_OFF, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, NULL, 0, 0, 0, 0, "Restrict/Allow renderability");
|
||||
restrict_bool = group_restrict_flag(gr, OB_RESTRICT_RENDER);
|
||||
bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_RENDER_ON : ICON_RESTRICT_RENDER_OFF, (int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, NULL, 0, 0, 0, 0, "Restrict/Allow renderability");
|
||||
uiButSetFunc(bt, restrictbutton_gr_restrict_render, scene, gr);
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
}
|
||||
/* scene render layers and passes have toggle-able flags too! */
|
||||
else if (tselem->type==TSE_R_LAYER) {
|
||||
else if (tselem->type == TSE_R_LAYER) {
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
|
||||
bt= uiDefIconButBitI(block, ICONTOGN, SCE_LAY_DISABLE, 0, ICON_CHECKBOX_HLT-1,
|
||||
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, te->directdata, 0, 0, 0, 0, "Render this RenderLayer");
|
||||
bt = uiDefIconButBitI(block, ICONTOGN, SCE_LAY_DISABLE, 0, ICON_CHECKBOX_HLT - 1,
|
||||
(int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, te->directdata, 0, 0, 0, 0, "Render this RenderLayer");
|
||||
uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
}
|
||||
else if (tselem->type==TSE_R_PASS) {
|
||||
int *layflag= te->directdata;
|
||||
int passflag= 1<<tselem->nr;
|
||||
else if (tselem->type == TSE_R_PASS) {
|
||||
int *layflag = te->directdata;
|
||||
int passflag = 1 << tselem->nr;
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
|
||||
|
||||
bt= uiDefIconButBitI(block, ICONTOG, passflag, 0, ICON_CHECKBOX_HLT-1,
|
||||
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, layflag, 0, 0, 0, 0, "Render this Pass");
|
||||
bt = uiDefIconButBitI(block, ICONTOG, passflag, 0, ICON_CHECKBOX_HLT - 1,
|
||||
(int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, layflag, 0, 0, 0, 0, "Render this Pass");
|
||||
uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
|
||||
|
||||
layflag++; /* is lay_xor */
|
||||
layflag++; /* is lay_xor */
|
||||
if (ELEM8(passflag, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT))
|
||||
bt= uiDefIconButBitI(block, TOG, passflag, 0, (*layflag & passflag)?ICON_DOT:ICON_BLANK1,
|
||||
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, layflag, 0, 0, 0, 0, "Exclude this Pass from Combined");
|
||||
bt = uiDefIconButBitI(block, TOG, passflag, 0, (*layflag & passflag) ? ICON_DOT : ICON_BLANK1,
|
||||
(int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, layflag, 0, 0, 0, 0, "Exclude this Pass from Combined");
|
||||
uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
}
|
||||
else if (tselem->type==TSE_MODIFIER) {
|
||||
ModifierData *md= (ModifierData *)te->directdata;
|
||||
else if (tselem->type == TSE_MODIFIER) {
|
||||
ModifierData *md = (ModifierData *)te->directdata;
|
||||
ob = (Object *)tselem->id;
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
bt= uiDefIconButBitI(block, ICONTOGN, eModifierMode_Realtime, 0, ICON_RESTRICT_VIEW_OFF,
|
||||
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
|
||||
bt = uiDefIconButBitI(block, ICONTOGN, eModifierMode_Realtime, 0, ICON_RESTRICT_VIEW_OFF,
|
||||
(int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
|
||||
uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob);
|
||||
|
||||
bt= uiDefIconButBitI(block, ICONTOGN, eModifierMode_Render, 0, ICON_RESTRICT_RENDER_OFF,
|
||||
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow renderability");
|
||||
bt = uiDefIconButBitI(block, ICONTOGN, eModifierMode_Render, 0, ICON_RESTRICT_RENDER_OFF,
|
||||
(int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow renderability");
|
||||
uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob);
|
||||
}
|
||||
else if (tselem->type==TSE_POSE_CHANNEL) {
|
||||
bPoseChannel *pchan= (bPoseChannel *)te->directdata;
|
||||
else if (tselem->type == TSE_POSE_CHANNEL) {
|
||||
bPoseChannel *pchan = (bPoseChannel *)te->directdata;
|
||||
Bone *bone = pchan->bone;
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
bt= uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_P, 0, ICON_RESTRICT_VIEW_OFF,
|
||||
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
|
||||
bt = uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_P, 0, ICON_RESTRICT_VIEW_OFF,
|
||||
(int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
|
||||
uiButSetFunc(bt, restrictbutton_bone_cb, NULL, bone);
|
||||
|
||||
bt= uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF,
|
||||
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
|
||||
bt = uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF,
|
||||
(int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
|
||||
uiButSetFunc(bt, restrictbutton_bone_cb, NULL, NULL);
|
||||
}
|
||||
else if (tselem->type==TSE_EBONE) {
|
||||
EditBone *ebone= (EditBone *)te->directdata;
|
||||
else if (tselem->type == TSE_EBONE) {
|
||||
EditBone *ebone = (EditBone *)te->directdata;
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
bt= uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_A, 0, ICON_RESTRICT_VIEW_OFF,
|
||||
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(ebone->flag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
|
||||
bt = uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_A, 0, ICON_RESTRICT_VIEW_OFF,
|
||||
(int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, &(ebone->flag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
|
||||
uiButSetFunc(bt, restrictbutton_ebone_cb, NULL, ebone);
|
||||
|
||||
bt= uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF,
|
||||
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(ebone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
|
||||
bt = uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF,
|
||||
(int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, &(ebone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
|
||||
uiButSetFunc(bt, restrictbutton_ebone_cb, NULL, NULL);
|
||||
}
|
||||
}
|
||||
@@ -511,23 +511,23 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
|
||||
|
||||
static void outliner_draw_rnacols(ARegion *ar, int sizex)
|
||||
{
|
||||
View2D *v2d= &ar->v2d;
|
||||
View2D *v2d = &ar->v2d;
|
||||
|
||||
float miny = v2d->cur.ymin-V2D_SCROLL_HEIGHT;
|
||||
if (miny<v2d->tot.ymin) miny = v2d->tot.ymin;
|
||||
float miny = v2d->cur.ymin - V2D_SCROLL_HEIGHT;
|
||||
if (miny < v2d->tot.ymin) miny = v2d->tot.ymin;
|
||||
|
||||
UI_ThemeColorShadeAlpha(TH_BACK, -15, -200);
|
||||
|
||||
/* draw column separator lines */
|
||||
fdrawline((float)sizex,
|
||||
v2d->cur.ymax,
|
||||
(float)sizex,
|
||||
miny);
|
||||
v2d->cur.ymax,
|
||||
(float)sizex,
|
||||
miny);
|
||||
|
||||
fdrawline((float)sizex+OL_RNA_COL_SIZEX,
|
||||
v2d->cur.ymax,
|
||||
(float)sizex+OL_RNA_COL_SIZEX,
|
||||
miny);
|
||||
fdrawline((float)sizex + OL_RNA_COL_SIZEX,
|
||||
v2d->cur.ymax,
|
||||
(float)sizex + OL_RNA_COL_SIZEX,
|
||||
miny);
|
||||
}
|
||||
|
||||
static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, SpaceOops *soops, int sizex, ListBase *lb)
|
||||
@@ -539,21 +539,21 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSST);
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
if (te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
|
||||
if (tselem->type == TSE_RNA_PROPERTY) {
|
||||
ptr= &te->rnaptr;
|
||||
prop= te->directdata;
|
||||
ptr = &te->rnaptr;
|
||||
prop = te->directdata;
|
||||
|
||||
if (!(RNA_property_type(prop) == PROP_POINTER && (TSELEM_OPEN(tselem, soops))) )
|
||||
uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y-1);
|
||||
uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y - 1);
|
||||
}
|
||||
else if (tselem->type == TSE_RNA_ARRAY_ELEM) {
|
||||
ptr= &te->rnaptr;
|
||||
prop= te->directdata;
|
||||
ptr = &te->rnaptr;
|
||||
prop = te->directdata;
|
||||
|
||||
uiDefAutoButR(block, ptr, prop, te->index, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y-1);
|
||||
uiDefAutoButR(block, ptr, prop, te->index, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
|
||||
|
||||
static void operator_call_cb(struct bContext *UNUSED(C), void *arg_kmi, void *arg2)
|
||||
{
|
||||
wmOperatorType *ot= arg2;
|
||||
wmOperatorType *ot = arg2;
|
||||
wmKeyMapItem *kmi = arg_kmi;
|
||||
|
||||
if (ot)
|
||||
@@ -572,10 +572,10 @@ static void operator_call_cb(struct bContext *UNUSED(C), void *arg_kmi, void *ar
|
||||
|
||||
static void operator_search_cb(const struct bContext *UNUSED(C), void *UNUSED(arg_kmi), const char *str, uiSearchItems *items)
|
||||
{
|
||||
GHashIterator *iter= WM_operatortype_iter();
|
||||
GHashIterator *iter = WM_operatortype_iter();
|
||||
|
||||
for ( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
|
||||
wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
|
||||
for (; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
|
||||
wmOperatorType *ot = BLI_ghashIterator_getValue(iter);
|
||||
|
||||
if (BLI_strcasestr(ot->idname, str)) {
|
||||
char name[OP_MAX_TYPENAME];
|
||||
@@ -583,7 +583,7 @@ static void operator_search_cb(const struct bContext *UNUSED(C), void *UNUSED(ar
|
||||
/* display name for menu */
|
||||
WM_operator_py_idname(name, ot->idname);
|
||||
|
||||
if (0==uiSearchItemAdd(items, name, ot, 0))
|
||||
if (0 == uiSearchItemAdd(items, name, ot, 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -595,17 +595,17 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi)
|
||||
{
|
||||
static char search[OP_MAX_TYPENAME];
|
||||
wmEvent event;
|
||||
wmWindow *win= CTX_wm_window(C);
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
wmKeyMapItem *kmi = arg_kmi;
|
||||
wmOperatorType *ot= WM_operatortype_find(kmi->idname, 0);
|
||||
wmOperatorType *ot = WM_operatortype_find(kmi->idname, 0);
|
||||
uiBlock *block;
|
||||
uiBut *but;
|
||||
|
||||
/* clear initial search string, then all items show */
|
||||
search[0]= 0;
|
||||
search[0] = 0;
|
||||
|
||||
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
|
||||
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1);
|
||||
block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
|
||||
uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_RET_1);
|
||||
|
||||
/* fake button, it holds space for search items */
|
||||
uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
|
||||
@@ -617,20 +617,20 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi)
|
||||
uiBlockSetDirection(block, UI_DOWN);
|
||||
uiEndBlock(C, block);
|
||||
|
||||
event= *(win->eventstate); /* XXX huh huh? make api call */
|
||||
event.type= EVT_BUT_OPEN;
|
||||
event.val= KM_PRESS;
|
||||
event.customdata= but;
|
||||
event.customdatafree= FALSE;
|
||||
event = *(win->eventstate); /* XXX huh huh? make api call */
|
||||
event.type = EVT_BUT_OPEN;
|
||||
event.val = KM_PRESS;
|
||||
event.customdata = but;
|
||||
event.customdatafree = FALSE;
|
||||
wm_event_add(win, &event);
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
#define OL_KM_KEYBOARD 0
|
||||
#define OL_KM_MOUSE 1
|
||||
#define OL_KM_TWEAK 2
|
||||
#define OL_KM_SPECIALS 3
|
||||
#define OL_KM_KEYBOARD 0
|
||||
#define OL_KM_MOUSE 1
|
||||
#define OL_KM_TWEAK 2
|
||||
#define OL_KM_SPECIALS 3
|
||||
|
||||
static short keymap_menu_type(short type)
|
||||
{
|
||||
@@ -643,11 +643,11 @@ static short keymap_menu_type(short type)
|
||||
|
||||
static const char *keymap_type_menu(void)
|
||||
{
|
||||
static const char string[]=
|
||||
"Event Type%t"
|
||||
"|Keyboard%x" STRINGIFY(OL_KM_KEYBOARD)
|
||||
"|Mouse%x" STRINGIFY(OL_KM_MOUSE)
|
||||
"|Tweak%x" STRINGIFY(OL_KM_TWEAK)
|
||||
static const char string[] =
|
||||
"Event Type%t"
|
||||
"|Keyboard%x" STRINGIFY(OL_KM_KEYBOARD)
|
||||
"|Mouse%x" STRINGIFY(OL_KM_MOUSE)
|
||||
"|Tweak%x" STRINGIFY(OL_KM_TWEAK)
|
||||
// "|Specials%x" STRINGIFY(OL_KM_SPECIALS)
|
||||
;
|
||||
|
||||
@@ -656,25 +656,25 @@ static const char *keymap_type_menu(void)
|
||||
|
||||
static const char *keymap_mouse_menu(void)
|
||||
{
|
||||
static const char string[]=
|
||||
"Mouse Event%t"
|
||||
"|Left Mouse%x" STRINGIFY(LEFTMOUSE)
|
||||
"|Middle Mouse%x" STRINGIFY(MIDDLEMOUSE)
|
||||
"|Right Mouse%x" STRINGIFY(RIGHTMOUSE)
|
||||
"|Middle Mouse%x" STRINGIFY(MIDDLEMOUSE)
|
||||
"|Right Mouse%x" STRINGIFY(RIGHTMOUSE)
|
||||
"|Button4 Mouse%x" STRINGIFY(BUTTON4MOUSE)
|
||||
"|Button5 Mouse%x" STRINGIFY(BUTTON5MOUSE)
|
||||
"|Action Mouse%x" STRINGIFY(ACTIONMOUSE)
|
||||
"|Select Mouse%x" STRINGIFY(SELECTMOUSE)
|
||||
"|Mouse Move%x" STRINGIFY(MOUSEMOVE)
|
||||
"|Wheel Up%x" STRINGIFY(WHEELUPMOUSE)
|
||||
"|Wheel Down%x" STRINGIFY(WHEELDOWNMOUSE)
|
||||
"|Wheel In%x" STRINGIFY(WHEELINMOUSE)
|
||||
"|Wheel Out%x" STRINGIFY(WHEELOUTMOUSE)
|
||||
"|Mouse/Trackpad Pan%x" STRINGIFY(MOUSEPAN)
|
||||
"|Mouse/Trackpad Zoom%x" STRINGIFY(MOUSEZOOM)
|
||||
"|Mouse/Trackpad Rotate%x" STRINGIFY(MOUSEROTATE)
|
||||
static const char string[] =
|
||||
"Mouse Event%t"
|
||||
"|Left Mouse%x" STRINGIFY(LEFTMOUSE)
|
||||
"|Middle Mouse%x" STRINGIFY(MIDDLEMOUSE)
|
||||
"|Right Mouse%x" STRINGIFY(RIGHTMOUSE)
|
||||
"|Middle Mouse%x" STRINGIFY(MIDDLEMOUSE)
|
||||
"|Right Mouse%x" STRINGIFY(RIGHTMOUSE)
|
||||
"|Button4 Mouse%x" STRINGIFY(BUTTON4MOUSE)
|
||||
"|Button5 Mouse%x" STRINGIFY(BUTTON5MOUSE)
|
||||
"|Action Mouse%x" STRINGIFY(ACTIONMOUSE)
|
||||
"|Select Mouse%x" STRINGIFY(SELECTMOUSE)
|
||||
"|Mouse Move%x" STRINGIFY(MOUSEMOVE)
|
||||
"|Wheel Up%x" STRINGIFY(WHEELUPMOUSE)
|
||||
"|Wheel Down%x" STRINGIFY(WHEELDOWNMOUSE)
|
||||
"|Wheel In%x" STRINGIFY(WHEELINMOUSE)
|
||||
"|Wheel Out%x" STRINGIFY(WHEELOUTMOUSE)
|
||||
"|Mouse/Trackpad Pan%x" STRINGIFY(MOUSEPAN)
|
||||
"|Mouse/Trackpad Zoom%x" STRINGIFY(MOUSEZOOM)
|
||||
"|Mouse/Trackpad Rotate%x" STRINGIFY(MOUSEROTATE)
|
||||
;
|
||||
|
||||
return string;
|
||||
@@ -682,13 +682,13 @@ static const char *keymap_mouse_menu(void)
|
||||
|
||||
static const char *keymap_tweak_menu(void)
|
||||
{
|
||||
static const char string[]=
|
||||
"Tweak Event%t"
|
||||
"|Left Mouse%x" STRINGIFY(EVT_TWEAK_L)
|
||||
"|Middle Mouse%x" STRINGIFY(EVT_TWEAK_M)
|
||||
"|Right Mouse%x" STRINGIFY(EVT_TWEAK_R)
|
||||
"|Action Mouse%x" STRINGIFY(EVT_TWEAK_A)
|
||||
"|Select Mouse%x" STRINGIFY(EVT_TWEAK_S)
|
||||
static const char string[] =
|
||||
"Tweak Event%t"
|
||||
"|Left Mouse%x" STRINGIFY(EVT_TWEAK_L)
|
||||
"|Middle Mouse%x" STRINGIFY(EVT_TWEAK_M)
|
||||
"|Right Mouse%x" STRINGIFY(EVT_TWEAK_R)
|
||||
"|Action Mouse%x" STRINGIFY(EVT_TWEAK_A)
|
||||
"|Select Mouse%x" STRINGIFY(EVT_TWEAK_S)
|
||||
;
|
||||
|
||||
return string;
|
||||
@@ -696,17 +696,17 @@ static const char *keymap_tweak_menu(void)
|
||||
|
||||
static const char *keymap_tweak_dir_menu(void)
|
||||
{
|
||||
static const char string[]=
|
||||
"Tweak Direction%t"
|
||||
"|Any%x" STRINGIFY(KM_ANY)
|
||||
"|North%x" STRINGIFY(EVT_GESTURE_N)
|
||||
"|North-East%x" STRINGIFY(EVT_GESTURE_NE)
|
||||
"|East%x" STRINGIFY(EVT_GESTURE_E)
|
||||
"|Sout-East%x" STRINGIFY(EVT_GESTURE_SE)
|
||||
"|South%x" STRINGIFY(EVT_GESTURE_S)
|
||||
"|South-West%x" STRINGIFY(EVT_GESTURE_SW)
|
||||
"|West%x" STRINGIFY(EVT_GESTURE_W)
|
||||
"|North-West%x" STRINGIFY(EVT_GESTURE_NW)
|
||||
static const char string[] =
|
||||
"Tweak Direction%t"
|
||||
"|Any%x" STRINGIFY(KM_ANY)
|
||||
"|North%x" STRINGIFY(EVT_GESTURE_N)
|
||||
"|North-East%x" STRINGIFY(EVT_GESTURE_NE)
|
||||
"|East%x" STRINGIFY(EVT_GESTURE_E)
|
||||
"|Sout-East%x" STRINGIFY(EVT_GESTURE_SE)
|
||||
"|South%x" STRINGIFY(EVT_GESTURE_S)
|
||||
"|South-West%x" STRINGIFY(EVT_GESTURE_SW)
|
||||
"|West%x" STRINGIFY(EVT_GESTURE_W)
|
||||
"|North-West%x" STRINGIFY(EVT_GESTURE_NW)
|
||||
;
|
||||
|
||||
return string;
|
||||
@@ -716,25 +716,25 @@ static const char *keymap_tweak_dir_menu(void)
|
||||
static void keymap_type_cb(bContext *C, void *kmi_v, void *UNUSED(arg_v))
|
||||
{
|
||||
wmKeyMapItem *kmi = kmi_v;
|
||||
short maptype= keymap_menu_type(kmi->type);
|
||||
short maptype = keymap_menu_type(kmi->type);
|
||||
|
||||
if (maptype!=kmi->maptype) {
|
||||
if (maptype != kmi->maptype) {
|
||||
switch (kmi->maptype) {
|
||||
case OL_KM_KEYBOARD:
|
||||
kmi->type= AKEY;
|
||||
kmi->val= KM_PRESS;
|
||||
kmi->type = AKEY;
|
||||
kmi->val = KM_PRESS;
|
||||
break;
|
||||
case OL_KM_MOUSE:
|
||||
kmi->type= LEFTMOUSE;
|
||||
kmi->val= KM_PRESS;
|
||||
kmi->type = LEFTMOUSE;
|
||||
kmi->val = KM_PRESS;
|
||||
break;
|
||||
case OL_KM_TWEAK:
|
||||
kmi->type= EVT_TWEAK_L;
|
||||
kmi->val= KM_ANY;
|
||||
kmi->type = EVT_TWEAK_L;
|
||||
kmi->val = KM_ANY;
|
||||
break;
|
||||
case OL_KM_SPECIALS:
|
||||
kmi->type= AKEY;
|
||||
kmi->val= KM_PRESS;
|
||||
kmi->type = AKEY;
|
||||
kmi->val = KM_PRESS;
|
||||
}
|
||||
ED_region_tag_redraw(CTX_wm_region(C));
|
||||
}
|
||||
@@ -747,67 +747,67 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSST);
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
if (te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
|
||||
uiBut *but;
|
||||
const char *str;
|
||||
int xstart= 240;
|
||||
int butw1= UI_UNIT_X; /* operator */
|
||||
int butw2= 90; /* event type, menus */
|
||||
int butw3= 43; /* modifiers */
|
||||
int xstart = 240;
|
||||
int butw1 = UI_UNIT_X; /* operator */
|
||||
int butw2 = 90; /* event type, menus */
|
||||
int butw3 = 43; /* modifiers */
|
||||
|
||||
if (tselem->type == TSE_KEYMAP_ITEM) {
|
||||
wmKeyMapItem *kmi = te->directdata;
|
||||
|
||||
/* modal map? */
|
||||
if (kmi->propvalue);
|
||||
if (kmi->propvalue) ;
|
||||
else {
|
||||
uiDefBlockBut(block, operator_search_menu, kmi, "", xstart, (int)te->ys+1, butw1, UI_UNIT_Y-1, "Assign new Operator");
|
||||
uiDefBlockBut(block, operator_search_menu, kmi, "", xstart, (int)te->ys + 1, butw1, UI_UNIT_Y - 1, "Assign new Operator");
|
||||
}
|
||||
xstart+= butw1+10;
|
||||
xstart += butw1 + 10;
|
||||
|
||||
/* map type button */
|
||||
kmi->maptype= keymap_menu_type(kmi->type);
|
||||
kmi->maptype = keymap_menu_type(kmi->type);
|
||||
|
||||
str= keymap_type_menu();
|
||||
but = uiDefButS(block, MENU, 0, str, xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->maptype, 0, 0, 0, 0, "Event type");
|
||||
str = keymap_type_menu();
|
||||
but = uiDefButS(block, MENU, 0, str, xstart, (int)te->ys + 1, butw2, UI_UNIT_Y - 1, &kmi->maptype, 0, 0, 0, 0, "Event type");
|
||||
uiButSetFunc(but, keymap_type_cb, kmi, NULL);
|
||||
xstart+= butw2+5;
|
||||
xstart += butw2 + 5;
|
||||
|
||||
/* edit actual event */
|
||||
switch (kmi->maptype) {
|
||||
case OL_KM_KEYBOARD:
|
||||
uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->type, "Key code");
|
||||
xstart+= butw2+5;
|
||||
uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys + 1, butw2, UI_UNIT_Y - 1, &kmi->type, "Key code");
|
||||
xstart += butw2 + 5;
|
||||
break;
|
||||
case OL_KM_MOUSE:
|
||||
str= keymap_mouse_menu();
|
||||
uiDefButS(block, MENU, 0, str, xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->type, 0, 0, 0, 0, "Mouse button");
|
||||
xstart+= butw2+5;
|
||||
str = keymap_mouse_menu();
|
||||
uiDefButS(block, MENU, 0, str, xstart, (int)te->ys + 1, butw2, UI_UNIT_Y - 1, &kmi->type, 0, 0, 0, 0, "Mouse button");
|
||||
xstart += butw2 + 5;
|
||||
break;
|
||||
case OL_KM_TWEAK:
|
||||
str= keymap_tweak_menu();
|
||||
uiDefButS(block, MENU, 0, str, xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->type, 0, 0, 0, 0, "Tweak gesture");
|
||||
xstart+= butw2+5;
|
||||
str= keymap_tweak_dir_menu();
|
||||
uiDefButS(block, MENU, 0, str, xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->val, 0, 0, 0, 0, "Tweak gesture direction");
|
||||
xstart+= butw2+5;
|
||||
str = keymap_tweak_menu();
|
||||
uiDefButS(block, MENU, 0, str, xstart, (int)te->ys + 1, butw2, UI_UNIT_Y - 1, &kmi->type, 0, 0, 0, 0, "Tweak gesture");
|
||||
xstart += butw2 + 5;
|
||||
str = keymap_tweak_dir_menu();
|
||||
uiDefButS(block, MENU, 0, str, xstart, (int)te->ys + 1, butw2, UI_UNIT_Y - 1, &kmi->val, 0, 0, 0, 0, "Tweak gesture direction");
|
||||
xstart += butw2 + 5;
|
||||
break;
|
||||
}
|
||||
|
||||
/* modifiers */
|
||||
uiDefButS(block, OPTION, 0, "Shift", xstart, (int)te->ys+1, butw3+5, UI_UNIT_Y-1, &kmi->shift, 0, 0, 0, 0, "Modifier"); xstart+= butw3+5;
|
||||
uiDefButS(block, OPTION, 0, "Ctrl", xstart, (int)te->ys+1, butw3, UI_UNIT_Y-1, &kmi->ctrl, 0, 0, 0, 0, "Modifier"); xstart+= butw3;
|
||||
uiDefButS(block, OPTION, 0, "Alt", xstart, (int)te->ys+1, butw3, UI_UNIT_Y-1, &kmi->alt, 0, 0, 0, 0, "Modifier"); xstart+= butw3;
|
||||
uiDefButS(block, OPTION, 0, "OS", xstart, (int)te->ys+1, butw3, UI_UNIT_Y-1, &kmi->oskey, 0, 0, 0, 0, "Modifier"); xstart+= butw3;
|
||||
xstart+= 5;
|
||||
uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys+1, butw3, UI_UNIT_Y-1, &kmi->keymodifier, "Key Modifier code");
|
||||
xstart+= butw3+5;
|
||||
uiDefButS(block, OPTION, 0, "Shift", xstart, (int)te->ys + 1, butw3 + 5, UI_UNIT_Y - 1, &kmi->shift, 0, 0, 0, 0, "Modifier"); xstart += butw3 + 5;
|
||||
uiDefButS(block, OPTION, 0, "Ctrl", xstart, (int)te->ys + 1, butw3, UI_UNIT_Y - 1, &kmi->ctrl, 0, 0, 0, 0, "Modifier"); xstart += butw3;
|
||||
uiDefButS(block, OPTION, 0, "Alt", xstart, (int)te->ys + 1, butw3, UI_UNIT_Y - 1, &kmi->alt, 0, 0, 0, 0, "Modifier"); xstart += butw3;
|
||||
uiDefButS(block, OPTION, 0, "OS", xstart, (int)te->ys + 1, butw3, UI_UNIT_Y - 1, &kmi->oskey, 0, 0, 0, 0, "Modifier"); xstart += butw3;
|
||||
xstart += 5;
|
||||
uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys + 1, butw3, UI_UNIT_Y - 1, &kmi->keymodifier, "Key Modifier code");
|
||||
xstart += butw3 + 5;
|
||||
|
||||
/* rna property */
|
||||
if (kmi->ptr && kmi->ptr->data) {
|
||||
uiDefBut(block, LABEL, 0, "(RNA property)", xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->oskey, 0, 0, 0, 0, ""); xstart+= butw2;
|
||||
uiDefBut(block, LABEL, 0, "(RNA property)", xstart, (int)te->ys + 1, butw2, UI_UNIT_Y - 1, &kmi->oskey, 0, 0, 0, 0, ""); xstart += butw2;
|
||||
}
|
||||
|
||||
(void)xstart;
|
||||
@@ -826,33 +826,33 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa
|
||||
TreeStoreElem *tselem;
|
||||
int spx, dx, len;
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
if (te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
|
||||
|
||||
if (tselem->flag & TSE_TEXTBUT) {
|
||||
|
||||
/* If we add support to rename Sequence.
|
||||
* need change this.
|
||||
*/
|
||||
if (tselem->type == TSE_POSE_BASE) continue; // prevent crash when trying to rename 'pose' entry of armature
|
||||
if (tselem->type == TSE_POSE_BASE) continue; // prevent crash when trying to rename 'pose' entry of armature
|
||||
|
||||
if (tselem->type==TSE_EBONE) len = sizeof(((EditBone*) 0)->name);
|
||||
else if (tselem->type==TSE_MODIFIER) len = sizeof(((ModifierData*) 0)->name);
|
||||
else if (tselem->id && GS(tselem->id->name)==ID_LI) len = sizeof(((Library*) 0)->name);
|
||||
else len= MAX_ID_NAME-2;
|
||||
if (tselem->type == TSE_EBONE) len = sizeof(((EditBone *) 0)->name);
|
||||
else if (tselem->type == TSE_MODIFIER) len = sizeof(((ModifierData *) 0)->name);
|
||||
else if (tselem->id && GS(tselem->id->name) == ID_LI) len = sizeof(((Library *) 0)->name);
|
||||
else len = MAX_ID_NAME - 2;
|
||||
|
||||
|
||||
dx= (int)UI_GetStringWidth(te->name);
|
||||
if (dx<100) dx= 100;
|
||||
spx=te->xs+2*UI_UNIT_X-4;
|
||||
if (spx+dx+10>ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax-spx-10;
|
||||
dx = (int)UI_GetStringWidth(te->name);
|
||||
if (dx < 100) dx = 100;
|
||||
spx = te->xs + 2 * UI_UNIT_X - 4;
|
||||
if (spx + dx + 10 > ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax - spx - 10;
|
||||
|
||||
bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, (int)te->ys, dx+10, UI_UNIT_Y-1, (void *)te->name, 1.0, (float)len, 0, 0, "");
|
||||
bt = uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, (int)te->ys, dx + 10, UI_UNIT_Y - 1, (void *)te->name, 1.0, (float)len, 0, 0, "");
|
||||
uiButSetRenameFunc(bt, namebutton_cb, tselem);
|
||||
|
||||
/* returns false if button got removed */
|
||||
if ( 0 == uiButActiveOnly(C, block, bt) )
|
||||
if (0 == uiButActiveOnly(C, block, bt) )
|
||||
tselem->flag &= ~TSE_TEXTBUT;
|
||||
}
|
||||
}
|
||||
@@ -882,8 +882,8 @@ static void tselem_draw_icon_uibut(struct DrawIconArg *arg, int icon)
|
||||
}
|
||||
else {
|
||||
/* XXX investigate: button placement of icons is way different than UI_icon_draw? */
|
||||
float ufac= UI_UNIT_X/20.0f;
|
||||
uiBut *but = uiDefIconBut(arg->block, LABEL, 0, icon, arg->x-3.0f*ufac, arg->y, UI_UNIT_X-4.0f*ufac, UI_UNIT_Y-4.0f*ufac, NULL, 0.0, 0.0, 1.0, arg->alpha, (arg->id && arg->id->lib) ? arg->id->lib->name : "");
|
||||
float ufac = UI_UNIT_X / 20.0f;
|
||||
uiBut *but = uiDefIconBut(arg->block, LABEL, 0, icon, arg->x - 3.0f * ufac, arg->y, UI_UNIT_X - 4.0f * ufac, UI_UNIT_Y - 4.0f * ufac, NULL, 0.0, 0.0, 1.0, arg->alpha, (arg->id && arg->id->lib) ? arg->id->lib->name : "");
|
||||
|
||||
if (arg->id)
|
||||
uiButSetDragID(but, arg->id);
|
||||
@@ -896,15 +896,15 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
|
||||
struct DrawIconArg arg;
|
||||
|
||||
/* make function calls a bit compacter */
|
||||
arg.block= block;
|
||||
arg.id= tselem->id;
|
||||
arg.block = block;
|
||||
arg.id = tselem->id;
|
||||
arg.xmax = xmax;
|
||||
arg.x= x;
|
||||
arg.y= y;
|
||||
arg.alpha= alpha;
|
||||
arg.x = x;
|
||||
arg.y = y;
|
||||
arg.alpha = alpha;
|
||||
|
||||
if (tselem->type) {
|
||||
switch ( tselem->type) {
|
||||
switch (tselem->type) {
|
||||
case TSE_ANIM_DATA:
|
||||
UI_icon_draw(x, y, ICON_ANIM_DATA); break; // xxx
|
||||
case TSE_NLA:
|
||||
@@ -930,8 +930,8 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
|
||||
UI_icon_draw(x, y, ICON_PARTICLES); break;
|
||||
case TSE_MODIFIER:
|
||||
{
|
||||
Object *ob= (Object *)tselem->id;
|
||||
ModifierData *md= BLI_findlink(&ob->modifiers, tselem->nr);
|
||||
Object *ob = (Object *)tselem->id;
|
||||
ModifierData *md = BLI_findlink(&ob->modifiers, tselem->nr);
|
||||
switch (md->type) {
|
||||
case eModifierType_Subsurf:
|
||||
UI_icon_draw(x, y, ICON_MOD_SUBSURF); break;
|
||||
@@ -1033,15 +1033,15 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
|
||||
case TSE_POSEGRP_BASE:
|
||||
UI_icon_draw(x, y, ICON_VERTEXSEL); break;
|
||||
case TSE_SEQUENCE:
|
||||
if (te->idcode==SEQ_MOVIE)
|
||||
if (te->idcode == SEQ_MOVIE)
|
||||
UI_icon_draw(x, y, ICON_SEQUENCE);
|
||||
else if (te->idcode==SEQ_META)
|
||||
else if (te->idcode == SEQ_META)
|
||||
UI_icon_draw(x, y, ICON_DOT);
|
||||
else if (te->idcode==SEQ_SCENE)
|
||||
else if (te->idcode == SEQ_SCENE)
|
||||
UI_icon_draw(x, y, ICON_SCENE);
|
||||
else if (te->idcode==SEQ_SOUND)
|
||||
else if (te->idcode == SEQ_SOUND)
|
||||
UI_icon_draw(x, y, ICON_SOUND);
|
||||
else if (te->idcode==SEQ_IMAGE)
|
||||
else if (te->idcode == SEQ_IMAGE)
|
||||
UI_icon_draw(x, y, ICON_IMAGE_COL);
|
||||
else
|
||||
UI_icon_draw(x, y, ICON_PARTICLES);
|
||||
@@ -1054,7 +1054,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
|
||||
break;
|
||||
case TSE_RNA_STRUCT:
|
||||
if (RNA_struct_is_ID(te->rnaptr.type)) {
|
||||
arg.id= (ID *)te->rnaptr.data;
|
||||
arg.id = (ID *)te->rnaptr.data;
|
||||
tselem_draw_icon_uibut(&arg, RNA_struct_ui_icon(te->rnaptr.type));
|
||||
}
|
||||
else
|
||||
@@ -1065,7 +1065,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
|
||||
}
|
||||
}
|
||||
else if (GS(tselem->id->name) == ID_OB) {
|
||||
Object *ob= (Object *)tselem->id;
|
||||
Object *ob = (Object *)tselem->id;
|
||||
switch (ob->type) {
|
||||
case OB_LAMP:
|
||||
tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_LAMP); break;
|
||||
@@ -1093,7 +1093,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch ( GS(tselem->id->name)) {
|
||||
switch (GS(tselem->id->name)) {
|
||||
case ID_SCE:
|
||||
tselem_draw_icon_uibut(&arg, ICON_SCENE_DATA); break;
|
||||
case ID_ME:
|
||||
@@ -1106,7 +1106,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
|
||||
tselem_draw_icon_uibut(&arg, ICON_OUTLINER_DATA_LATTICE); break;
|
||||
case ID_LA:
|
||||
{
|
||||
Lamp *la= (Lamp *)tselem->id;
|
||||
Lamp *la = (Lamp *)tselem->id;
|
||||
|
||||
switch (la->type) {
|
||||
case LA_LOCAL:
|
||||
@@ -1161,46 +1161,46 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa
|
||||
TreeStoreElem *tselem;
|
||||
int active;
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
|
||||
/* exit drawing early */
|
||||
if ((*offsx) - UI_UNIT_X > xmax)
|
||||
break;
|
||||
|
||||
tselem= TREESTORE(te);
|
||||
tselem = TREESTORE(te);
|
||||
|
||||
/* object hierarchy always, further constrained on level */
|
||||
if (level<1 || (tselem->type==0 && te->idcode==ID_OB)) {
|
||||
if (level < 1 || (tselem->type == 0 && te->idcode == ID_OB)) {
|
||||
|
||||
/* active blocks get white circle */
|
||||
if (tselem->type==0) {
|
||||
if (te->idcode==ID_OB) active= (OBACT==(Object *)tselem->id);
|
||||
else if (scene->obedit && scene->obedit->data==tselem->id) active= 1; // XXX use context?
|
||||
else active= tree_element_active(C, scene, soops, te, 0);
|
||||
if (tselem->type == 0) {
|
||||
if (te->idcode == ID_OB) active = (OBACT == (Object *)tselem->id);
|
||||
else if (scene->obedit && scene->obedit->data == tselem->id) active = 1; // XXX use context?
|
||||
else active = tree_element_active(C, scene, soops, te, 0);
|
||||
}
|
||||
else active= tree_element_type_active(NULL, scene, soops, te, tselem, 0);
|
||||
else active = tree_element_type_active(NULL, scene, soops, te, tselem, 0);
|
||||
|
||||
if (active) {
|
||||
float ufac= UI_UNIT_X/20.0f;
|
||||
float ufac = UI_UNIT_X / 20.0f;
|
||||
|
||||
uiSetRoundBox(UI_CNR_ALL);
|
||||
glColor4ub(255, 255, 255, 100);
|
||||
uiRoundBox((float) * offsx-0.5f*ufac, (float)ys-1.0f*ufac, (float)*offsx+UI_UNIT_Y-3.0f*ufac, (float)ys+UI_UNIT_Y-3.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac);
|
||||
uiRoundBox((float) *offsx - 0.5f * ufac, (float)ys - 1.0f * ufac, (float)*offsx + UI_UNIT_Y - 3.0f * ufac, (float)ys + UI_UNIT_Y - 3.0f * ufac, UI_UNIT_Y / 2.0f - 2.0f * ufac);
|
||||
glEnable(GL_BLEND); /* roundbox disables */
|
||||
}
|
||||
|
||||
tselem_draw_icon(block, xmax, (float)*offsx, (float)ys, tselem, te, 0.5f);
|
||||
te->xs= (float)*offsx;
|
||||
te->ys= (float)ys;
|
||||
te->xend= (short)*offsx+UI_UNIT_X;
|
||||
te->flag |= TE_ICONROW; // for click
|
||||
te->xs = (float)*offsx;
|
||||
te->ys = (float)ys;
|
||||
te->xend = (short)*offsx + UI_UNIT_X;
|
||||
te->flag |= TE_ICONROW; // for click
|
||||
|
||||
(*offsx) += UI_UNIT_X;
|
||||
}
|
||||
|
||||
/* this tree element always has same amount of branches, so don't draw */
|
||||
if (tselem->type!=TSE_R_LAYER)
|
||||
outliner_draw_iconrow(C, block, scene, soops, &te->subtree, level+1, xmax, offsx, ys);
|
||||
if (tselem->type != TSE_R_LAYER)
|
||||
outliner_draw_iconrow(C, block, scene, soops, &te->subtree, level + 1, xmax, offsx, ys);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1211,11 +1211,11 @@ static void outliner_set_coord_tree_element(SpaceOops *soops, TreeElement *te, i
|
||||
TreeElement *ten;
|
||||
|
||||
/* store coord and continue, we need coordinates for elements outside view too */
|
||||
te->xs= (float)startx;
|
||||
te->ys= (float)(*starty);
|
||||
te->xs = (float)startx;
|
||||
te->ys = (float)(*starty);
|
||||
|
||||
for (ten= te->subtree.first; ten; ten= ten->next) {
|
||||
outliner_set_coord_tree_element(soops, ten, startx+UI_UNIT_X, starty);
|
||||
for (ten = te->subtree.first; ten; ten = ten->next) {
|
||||
outliner_set_coord_tree_element(soops, ten, startx + UI_UNIT_X, starty);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1224,17 +1224,17 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
|
||||
{
|
||||
TreeElement *ten;
|
||||
TreeStoreElem *tselem;
|
||||
float ufac= UI_UNIT_X/20.0f;
|
||||
int offsx= 0, active=0; // active=1 active obj, else active data
|
||||
float ufac = UI_UNIT_X / 20.0f;
|
||||
int offsx = 0, active = 0; // active=1 active obj, else active data
|
||||
|
||||
tselem= TREESTORE(te);
|
||||
tselem = TREESTORE(te);
|
||||
|
||||
if (*starty+2*UI_UNIT_Y >= ar->v2d.cur.ymin && *starty<= ar->v2d.cur.ymax) {
|
||||
int xmax= ar->v2d.cur.xmax;
|
||||
if (*starty + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && *starty <= ar->v2d.cur.ymax) {
|
||||
int xmax = ar->v2d.cur.xmax;
|
||||
|
||||
/* icons can be ui buts, we don't want it to overlap with restrict */
|
||||
if ((soops->flag & SO_HIDE_RESTRICTCOLS)==0)
|
||||
xmax-= OL_TOGW+UI_UNIT_X;
|
||||
if ((soops->flag & SO_HIDE_RESTRICTCOLS) == 0)
|
||||
xmax -= OL_TOGW + UI_UNIT_X;
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
@@ -1242,149 +1242,149 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
|
||||
* we don't expand items when searching in the datablocks but we
|
||||
* still want to highlight any filter matches.
|
||||
*/
|
||||
if ( (SEARCHING_OUTLINER(soops) || (soops->outlinevis==SO_DATABLOCKS && soops->search_string[0]!=0)) &&
|
||||
(tselem->flag & TSE_SEARCHMATCH))
|
||||
if ( (SEARCHING_OUTLINER(soops) || (soops->outlinevis == SO_DATABLOCKS && soops->search_string[0] != 0)) &&
|
||||
(tselem->flag & TSE_SEARCHMATCH))
|
||||
{
|
||||
char col[4];
|
||||
UI_GetThemeColorType4ubv(TH_MATCH, SPACE_OUTLINER, col);
|
||||
col[3]=100;
|
||||
col[3] = 100;
|
||||
glColor4ubv((GLubyte *)col);
|
||||
glRecti(startx, *starty+1, ar->v2d.cur.xmax, *starty+UI_UNIT_Y-1);
|
||||
glRecti(startx, *starty + 1, ar->v2d.cur.xmax, *starty + UI_UNIT_Y - 1);
|
||||
}
|
||||
|
||||
/* colors for active/selected data */
|
||||
if (tselem->type==0) {
|
||||
if (te->idcode==ID_SCE) {
|
||||
if (tselem->type == 0) {
|
||||
if (te->idcode == ID_SCE) {
|
||||
if (tselem->id == (ID *)scene) {
|
||||
glColor4ub(255, 255, 255, 100);
|
||||
active= 2;
|
||||
active = 2;
|
||||
}
|
||||
}
|
||||
else if (te->idcode==ID_GR) {
|
||||
else if (te->idcode == ID_GR) {
|
||||
Group *gr = (Group *)tselem->id;
|
||||
|
||||
if (group_select_flag(gr)) {
|
||||
char col[4];
|
||||
UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col);
|
||||
col[3]= 100;
|
||||
col[3] = 100;
|
||||
glColor4ubv((GLubyte *)col);
|
||||
|
||||
active= 2;
|
||||
active = 2;
|
||||
}
|
||||
}
|
||||
else if (te->idcode==ID_OB) {
|
||||
Object *ob= (Object *)tselem->id;
|
||||
else if (te->idcode == ID_OB) {
|
||||
Object *ob = (Object *)tselem->id;
|
||||
|
||||
if (ob==OBACT || (ob->flag & SELECT)) {
|
||||
char col[4]= {0, 0, 0, 0};
|
||||
if (ob == OBACT || (ob->flag & SELECT)) {
|
||||
char col[4] = {0, 0, 0, 0};
|
||||
|
||||
/* outliner active ob: always white text, circle color now similar to view3d */
|
||||
|
||||
active= 2; /* means it draws a color circle */
|
||||
if (ob==OBACT) {
|
||||
active = 2; /* means it draws a color circle */
|
||||
if (ob == OBACT) {
|
||||
if (ob->flag & SELECT) {
|
||||
UI_GetThemeColorType4ubv(TH_ACTIVE, SPACE_VIEW3D, col);
|
||||
col[3]= 100;
|
||||
col[3] = 100;
|
||||
}
|
||||
|
||||
active= 1; /* means it draws white text */
|
||||
active = 1; /* means it draws white text */
|
||||
}
|
||||
else if (ob->flag & SELECT) {
|
||||
UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col);
|
||||
col[3]= 100;
|
||||
col[3] = 100;
|
||||
}
|
||||
|
||||
glColor4ubv((GLubyte *)col);
|
||||
}
|
||||
|
||||
}
|
||||
else if (scene->obedit && scene->obedit->data==tselem->id) {
|
||||
else if (scene->obedit && scene->obedit->data == tselem->id) {
|
||||
glColor4ub(255, 255, 255, 100);
|
||||
active= 2;
|
||||
active = 2;
|
||||
}
|
||||
else {
|
||||
if (tree_element_active(C, scene, soops, te, 0)) {
|
||||
glColor4ub(220, 220, 255, 100);
|
||||
active= 2;
|
||||
active = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( tree_element_type_active(NULL, scene, soops, te, tselem, 0) ) active= 2;
|
||||
if (tree_element_type_active(NULL, scene, soops, te, tselem, 0) ) active = 2;
|
||||
glColor4ub(220, 220, 255, 100);
|
||||
}
|
||||
|
||||
/* active circle */
|
||||
if (active) {
|
||||
uiSetRoundBox(UI_CNR_ALL);
|
||||
uiRoundBox((float)startx+UI_UNIT_Y-1.5f*ufac, (float)*starty+2.0f*ufac, (float)startx+2.0f*UI_UNIT_Y-4.0f*ufac, (float)*starty+UI_UNIT_Y-1.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac);
|
||||
glEnable(GL_BLEND); /* roundbox disables it */
|
||||
uiRoundBox((float)startx + UI_UNIT_Y - 1.5f * ufac, (float)*starty + 2.0f * ufac, (float)startx + 2.0f * UI_UNIT_Y - 4.0f * ufac, (float)*starty + UI_UNIT_Y - 1.0f * ufac, UI_UNIT_Y / 2.0f - 2.0f * ufac);
|
||||
glEnable(GL_BLEND); /* roundbox disables it */
|
||||
|
||||
te->flag |= TE_ACTIVE; // for lookup in display hierarchies
|
||||
}
|
||||
|
||||
/* open/close icon, only when sublevels, except for scene */
|
||||
if (te->subtree.first || (tselem->type==0 && te->idcode==ID_SCE) || (te->flag & TE_LAZY_CLOSED)) {
|
||||
if (te->subtree.first || (tselem->type == 0 && te->idcode == ID_SCE) || (te->flag & TE_LAZY_CLOSED)) {
|
||||
int icon_x;
|
||||
if (tselem->type==0 && ELEM(te->idcode, ID_OB, ID_SCE))
|
||||
if (tselem->type == 0 && ELEM(te->idcode, ID_OB, ID_SCE))
|
||||
icon_x = startx;
|
||||
else
|
||||
icon_x = startx+5*ufac;
|
||||
icon_x = startx + 5 * ufac;
|
||||
|
||||
// icons a bit higher
|
||||
// icons a bit higher
|
||||
if (TSELEM_OPEN(tselem, soops))
|
||||
UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_DOWN);
|
||||
UI_icon_draw((float)icon_x, (float)*starty + 2 * ufac, ICON_DISCLOSURE_TRI_DOWN);
|
||||
else
|
||||
UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_RIGHT);
|
||||
UI_icon_draw((float)icon_x, (float)*starty + 2 * ufac, ICON_DISCLOSURE_TRI_RIGHT);
|
||||
}
|
||||
offsx+= UI_UNIT_X;
|
||||
offsx += UI_UNIT_X;
|
||||
|
||||
/* datatype icon */
|
||||
|
||||
if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))) {
|
||||
// icons a bit higher
|
||||
tselem_draw_icon(block, xmax, (float)startx+offsx - 0.5f*ufac, (float)*starty+2.0f*ufac, tselem, te, 1.0f);
|
||||
tselem_draw_icon(block, xmax, (float)startx + offsx - 0.5f * ufac, (float)*starty + 2.0f * ufac, tselem, te, 1.0f);
|
||||
|
||||
offsx+= UI_UNIT_X;
|
||||
offsx += UI_UNIT_X;
|
||||
}
|
||||
else
|
||||
offsx+= 2*ufac;
|
||||
offsx += 2 * ufac;
|
||||
|
||||
if (tselem->type==0 && tselem->id->lib) {
|
||||
if (tselem->type == 0 && tselem->id->lib) {
|
||||
glPixelTransferf(GL_ALPHA_SCALE, 0.5f);
|
||||
if (tselem->id->flag & LIB_INDIRECT)
|
||||
UI_icon_draw((float)startx+offsx, (float)*starty+2*ufac, ICON_LIBRARY_DATA_INDIRECT);
|
||||
UI_icon_draw((float)startx + offsx, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_INDIRECT);
|
||||
else
|
||||
UI_icon_draw((float)startx+offsx, (float)*starty+2*ufac, ICON_LIBRARY_DATA_DIRECT);
|
||||
UI_icon_draw((float)startx + offsx, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_DIRECT);
|
||||
glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
|
||||
offsx+= UI_UNIT_X;
|
||||
offsx += UI_UNIT_X;
|
||||
}
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
/* name */
|
||||
if (active==1) UI_ThemeColor(TH_TEXT_HI);
|
||||
if (active == 1) UI_ThemeColor(TH_TEXT_HI);
|
||||
else if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.75f);
|
||||
else UI_ThemeColor(TH_TEXT);
|
||||
|
||||
UI_DrawString(startx+offsx, *starty+5*ufac, te->name);
|
||||
UI_DrawString(startx + offsx, *starty + 5 * ufac, te->name);
|
||||
|
||||
offsx+= (int)(UI_UNIT_X + UI_GetStringWidth(te->name));
|
||||
offsx += (int)(UI_UNIT_X + UI_GetStringWidth(te->name));
|
||||
|
||||
/* closed item, we draw the icons, not when it's a scene, or master-server list though */
|
||||
if (!TSELEM_OPEN(tselem, soops)) {
|
||||
if (te->subtree.first) {
|
||||
if (tselem->type==0 && te->idcode==ID_SCE);
|
||||
else if (tselem->type!=TSE_R_LAYER) { /* this tree element always has same amount of branches, so don't draw */
|
||||
int tempx= startx+offsx;
|
||||
if (tselem->type == 0 && te->idcode == ID_SCE) ;
|
||||
else if (tselem->type != TSE_R_LAYER) { /* this tree element always has same amount of branches, so don't draw */
|
||||
int tempx = startx + offsx;
|
||||
|
||||
// divider
|
||||
UI_ThemeColorShade(TH_BACK, -40);
|
||||
glRecti(tempx -10, *starty+4, tempx -8, *starty+UI_UNIT_Y-4);
|
||||
glRecti(tempx - 10, *starty + 4, tempx - 8, *starty + UI_UNIT_Y - 4);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glPixelTransferf(GL_ALPHA_SCALE, 0.5);
|
||||
|
||||
outliner_draw_iconrow(C, block, scene, soops, &te->subtree, 0, xmax, &tempx, *starty+2);
|
||||
outliner_draw_iconrow(C, block, scene, soops, &te->subtree, 0, xmax, &tempx, *starty + 2);
|
||||
|
||||
glPixelTransferf(GL_ALPHA_SCALE, 1.0);
|
||||
glDisable(GL_BLEND);
|
||||
@@ -1393,21 +1393,21 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
|
||||
}
|
||||
}
|
||||
/* store coord and continue, we need coordinates for elements outside view too */
|
||||
te->xs= (float)startx;
|
||||
te->ys= (float)*starty;
|
||||
te->xend= startx+offsx;
|
||||
te->xs = (float)startx;
|
||||
te->ys = (float)*starty;
|
||||
te->xend = startx + offsx;
|
||||
|
||||
if (TSELEM_OPEN(tselem, soops)) {
|
||||
*starty-= UI_UNIT_Y;
|
||||
*starty -= UI_UNIT_Y;
|
||||
|
||||
for (ten= te->subtree.first; ten; ten= ten->next)
|
||||
outliner_draw_tree_element(C, block, scene, ar, soops, ten, startx+UI_UNIT_X, starty);
|
||||
for (ten = te->subtree.first; ten; ten = ten->next)
|
||||
outliner_draw_tree_element(C, block, scene, ar, soops, ten, startx + UI_UNIT_X, starty);
|
||||
}
|
||||
else {
|
||||
for (ten= te->subtree.first; ten; ten= ten->next)
|
||||
for (ten = te->subtree.first; ten; ten = ten->next)
|
||||
outliner_set_coord_tree_element(soops, te, startx, starty);
|
||||
|
||||
*starty-= UI_UNIT_Y;
|
||||
*starty -= UI_UNIT_Y;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1417,30 +1417,30 @@ static void outliner_draw_hierarchy(SpaceOops *soops, ListBase *lb, int startx,
|
||||
TreeStoreElem *tselem;
|
||||
int y1, y2;
|
||||
|
||||
if (lb->first==NULL) return;
|
||||
if (lb->first == NULL) return;
|
||||
|
||||
y1=y2= *starty; /* for vertical lines between objects */
|
||||
for (te=lb->first; te; te= te->next) {
|
||||
y2= *starty;
|
||||
tselem= TREESTORE(te);
|
||||
y1 = y2 = *starty; /* for vertical lines between objects */
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
y2 = *starty;
|
||||
tselem = TREESTORE(te);
|
||||
|
||||
/* horizontal line? */
|
||||
if (tselem->type==0 && (te->idcode==ID_OB || te->idcode==ID_SCE))
|
||||
glRecti(startx, *starty, startx+UI_UNIT_X, *starty-1);
|
||||
if (tselem->type == 0 && (te->idcode == ID_OB || te->idcode == ID_SCE))
|
||||
glRecti(startx, *starty, startx + UI_UNIT_X, *starty - 1);
|
||||
|
||||
*starty-= UI_UNIT_Y;
|
||||
*starty -= UI_UNIT_Y;
|
||||
|
||||
if (TSELEM_OPEN(tselem, soops))
|
||||
outliner_draw_hierarchy(soops, &te->subtree, startx+UI_UNIT_X, starty);
|
||||
outliner_draw_hierarchy(soops, &te->subtree, startx + UI_UNIT_X, starty);
|
||||
}
|
||||
|
||||
/* vertical line */
|
||||
te= lb->last;
|
||||
if (te->parent || lb->first!=lb->last) {
|
||||
tselem= TREESTORE(te);
|
||||
if (tselem->type==0 && te->idcode==ID_OB) {
|
||||
te = lb->last;
|
||||
if (te->parent || lb->first != lb->last) {
|
||||
tselem = TREESTORE(te);
|
||||
if (tselem->type == 0 && te->idcode == ID_OB) {
|
||||
|
||||
glRecti(startx, y1+UI_UNIT_Y, startx+1, y2);
|
||||
glRecti(startx, y1 + UI_UNIT_Y, startx + 1, y2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1450,19 +1450,19 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase *
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
|
||||
/* selection status */
|
||||
if (TSELEM_OPEN(tselem, soops))
|
||||
if (tselem->type == TSE_RNA_STRUCT)
|
||||
glRecti(0, *starty+1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, *starty+UI_UNIT_Y-1);
|
||||
glRecti(0, *starty + 1, (int)ar->v2d.cur.xmax + V2D_SCROLL_WIDTH, *starty + UI_UNIT_Y - 1);
|
||||
|
||||
*starty-= UI_UNIT_Y;
|
||||
*starty -= UI_UNIT_Y;
|
||||
if (TSELEM_OPEN(tselem, soops)) {
|
||||
outliner_draw_struct_marks(ar, soops, &te->subtree, starty);
|
||||
if (tselem->type == TSE_RNA_STRUCT)
|
||||
fdrawline(0, (float)*starty+UI_UNIT_Y, ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (float)*starty+UI_UNIT_Y);
|
||||
fdrawline(0, (float)*starty + UI_UNIT_Y, ar->v2d.cur.xmax + V2D_SCROLL_WIDTH, (float)*starty + UI_UNIT_Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1472,14 +1472,14 @@ static void outliner_draw_selection(ARegion *ar, SpaceOops *soops, ListBase *lb,
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
|
||||
/* selection status */
|
||||
if (tselem->flag & TSE_SELECTED) {
|
||||
glRecti(0, *starty+1, (int)ar->v2d.cur.xmax, *starty+UI_UNIT_Y-1);
|
||||
glRecti(0, *starty + 1, (int)ar->v2d.cur.xmax, *starty + UI_UNIT_Y - 1);
|
||||
}
|
||||
*starty-= UI_UNIT_Y;
|
||||
*starty -= UI_UNIT_Y;
|
||||
if (TSELEM_OPEN(tselem, soops)) outliner_draw_selection(ar, soops, &te->subtree, starty);
|
||||
}
|
||||
}
|
||||
@@ -1497,26 +1497,26 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio
|
||||
/* struct marks */
|
||||
UI_ThemeColorShadeAlpha(TH_BACK, -15, -200);
|
||||
//UI_ThemeColorShade(TH_BACK, -20);
|
||||
starty= (int)ar->v2d.tot.ymax-UI_UNIT_Y-OL_Y_OFFSET;
|
||||
starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
|
||||
outliner_draw_struct_marks(ar, soops, &soops->tree, &starty);
|
||||
}
|
||||
|
||||
/* always draw selection fill before hierarchy */
|
||||
UI_GetThemeColor3fv(TH_SELECT_HIGHLIGHT, col);
|
||||
glColor3fv(col);
|
||||
starty= (int)ar->v2d.tot.ymax-UI_UNIT_Y-OL_Y_OFFSET;
|
||||
starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
|
||||
outliner_draw_selection(ar, soops, &soops->tree, &starty);
|
||||
|
||||
// grey hierarchy lines
|
||||
UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.4f);
|
||||
starty= (int)ar->v2d.tot.ymax-UI_UNIT_Y/2-OL_Y_OFFSET;
|
||||
startx= 6;
|
||||
starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y / 2 - OL_Y_OFFSET;
|
||||
startx = 6;
|
||||
outliner_draw_hierarchy(soops, &soops->tree, startx, &starty);
|
||||
|
||||
// items themselves
|
||||
starty= (int)ar->v2d.tot.ymax-UI_UNIT_Y-OL_Y_OFFSET;
|
||||
startx= 0;
|
||||
for (te= soops->tree.first; te; te= te->next) {
|
||||
starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
|
||||
startx = 0;
|
||||
for (te = soops->tree.first; te; te = te->next) {
|
||||
outliner_draw_tree_element(C, block, scene, ar, soops, te, startx, &starty);
|
||||
}
|
||||
}
|
||||
@@ -1527,12 +1527,12 @@ static void outliner_back(ARegion *ar)
|
||||
int ystart;
|
||||
|
||||
UI_ThemeColorShade(TH_BACK, 6);
|
||||
ystart= (int)ar->v2d.tot.ymax;
|
||||
ystart= UI_UNIT_Y*(ystart/(UI_UNIT_Y))-OL_Y_OFFSET;
|
||||
ystart = (int)ar->v2d.tot.ymax;
|
||||
ystart = UI_UNIT_Y * (ystart / (UI_UNIT_Y)) - OL_Y_OFFSET;
|
||||
|
||||
while (ystart+2*UI_UNIT_Y > ar->v2d.cur.ymin) {
|
||||
glRecti(0, ystart, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, ystart+UI_UNIT_Y);
|
||||
ystart-= 2*UI_UNIT_Y;
|
||||
while (ystart + 2 * UI_UNIT_Y > ar->v2d.cur.ymin) {
|
||||
glRecti(0, ystart, (int)ar->v2d.cur.xmax + V2D_SCROLL_WIDTH, ystart + UI_UNIT_Y);
|
||||
ystart -= 2 * UI_UNIT_Y;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1542,36 +1542,36 @@ static void outliner_draw_restrictcols(ARegion *ar)
|
||||
|
||||
/* background underneath */
|
||||
UI_ThemeColor(TH_BACK);
|
||||
glRecti((int)ar->v2d.cur.xmax-OL_TOGW, (int)ar->v2d.cur.ymin-V2D_SCROLL_HEIGHT-1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (int)ar->v2d.cur.ymax);
|
||||
glRecti((int)ar->v2d.cur.xmax - OL_TOGW, (int)ar->v2d.cur.ymin - V2D_SCROLL_HEIGHT - 1, (int)ar->v2d.cur.xmax + V2D_SCROLL_WIDTH, (int)ar->v2d.cur.ymax);
|
||||
|
||||
UI_ThemeColorShade(TH_BACK, 6);
|
||||
ystart= (int)ar->v2d.tot.ymax;
|
||||
ystart= UI_UNIT_Y*(ystart/(UI_UNIT_Y))-OL_Y_OFFSET;
|
||||
ystart = (int)ar->v2d.tot.ymax;
|
||||
ystart = UI_UNIT_Y * (ystart / (UI_UNIT_Y)) - OL_Y_OFFSET;
|
||||
|
||||
while (ystart+2*UI_UNIT_Y > ar->v2d.cur.ymin) {
|
||||
glRecti((int)ar->v2d.cur.xmax-OL_TOGW, ystart, (int)ar->v2d.cur.xmax, ystart+UI_UNIT_Y);
|
||||
ystart-= 2*UI_UNIT_Y;
|
||||
while (ystart + 2 * UI_UNIT_Y > ar->v2d.cur.ymin) {
|
||||
glRecti((int)ar->v2d.cur.xmax - OL_TOGW, ystart, (int)ar->v2d.cur.xmax, ystart + UI_UNIT_Y);
|
||||
ystart -= 2 * UI_UNIT_Y;
|
||||
}
|
||||
|
||||
UI_ThemeColorShadeAlpha(TH_BACK, -15, -200);
|
||||
|
||||
/* view */
|
||||
fdrawline(ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX,
|
||||
ar->v2d.cur.ymax,
|
||||
ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX,
|
||||
ar->v2d.cur.ymin - V2D_SCROLL_HEIGHT);
|
||||
fdrawline(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX,
|
||||
ar->v2d.cur.ymax,
|
||||
ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX,
|
||||
ar->v2d.cur.ymin - V2D_SCROLL_HEIGHT);
|
||||
|
||||
/* render */
|
||||
fdrawline(ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX,
|
||||
ar->v2d.cur.ymax,
|
||||
ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX,
|
||||
ar->v2d.cur.ymin - V2D_SCROLL_HEIGHT);
|
||||
fdrawline(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX,
|
||||
ar->v2d.cur.ymax,
|
||||
ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX,
|
||||
ar->v2d.cur.ymin - V2D_SCROLL_HEIGHT);
|
||||
|
||||
/* render */
|
||||
fdrawline(ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX,
|
||||
ar->v2d.cur.ymax,
|
||||
ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX,
|
||||
ar->v2d.cur.ymin - V2D_SCROLL_HEIGHT);
|
||||
fdrawline(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX,
|
||||
ar->v2d.cur.ymax,
|
||||
ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX,
|
||||
ar->v2d.cur.ymin - V2D_SCROLL_HEIGHT);
|
||||
}
|
||||
|
||||
/* ****************************************************** */
|
||||
@@ -1579,13 +1579,13 @@ static void outliner_draw_restrictcols(ARegion *ar)
|
||||
|
||||
void draw_outliner(const bContext *C)
|
||||
{
|
||||
Main *mainvar= CTX_data_main(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
View2D *v2d= &ar->v2d;
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
Main *mainvar = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
View2D *v2d = &ar->v2d;
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
uiBlock *block;
|
||||
int sizey= 0, sizex= 0, sizex_rna= 0;
|
||||
int sizey = 0, sizex = 0, sizex_rna = 0;
|
||||
|
||||
outliner_build_tree(mainvar, scene, soops); // always
|
||||
|
||||
@@ -1594,7 +1594,7 @@ void draw_outliner(const bContext *C)
|
||||
|
||||
if (ELEM3(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF, SO_KEYMAP)) {
|
||||
/* RNA has two columns:
|
||||
* - column 1 is (max_width + OL_RNA_COL_SPACEX) or
|
||||
* - column 1 is (max_width + OL_RNA_COL_SPACEX) or
|
||||
* (OL_RNA_COL_X), whichever is wider...
|
||||
* - column 2 is fixed at OL_RNA_COL_SIZEX
|
||||
*
|
||||
@@ -1603,13 +1603,13 @@ void draw_outliner(const bContext *C)
|
||||
|
||||
/* get actual width of column 1 */
|
||||
outliner_rna_width(soops, &soops->tree, &sizex_rna, 0);
|
||||
sizex_rna= MAX2(OL_RNA_COLX, sizex_rna+OL_RNA_COL_SPACEX);
|
||||
sizex_rna = MAX2(OL_RNA_COLX, sizex_rna + OL_RNA_COL_SPACEX);
|
||||
|
||||
/* get width of data (for setting 'tot' rect, this is column 1 + column 2 + a bit extra) */
|
||||
if (soops->outlinevis == SO_KEYMAP)
|
||||
sizex= sizex_rna + OL_RNA_COL_SIZEX*3 + 50; // XXX this is only really a quick hack to make this wide enough...
|
||||
sizex = sizex_rna + OL_RNA_COL_SIZEX * 3 + 50; // XXX this is only really a quick hack to make this wide enough...
|
||||
else
|
||||
sizex= sizex_rna + OL_RNA_COL_SIZEX + 50;
|
||||
sizex = sizex_rna + OL_RNA_COL_SIZEX + 50;
|
||||
}
|
||||
else {
|
||||
/* width must take into account restriction columns (if visible) so that entries will still be visible */
|
||||
@@ -1618,8 +1618,8 @@ void draw_outliner(const bContext *C)
|
||||
|
||||
/* constant offset for restriction columns */
|
||||
// XXX this isn't that great yet...
|
||||
if ((soops->flag & SO_HIDE_RESTRICTCOLS)==0)
|
||||
sizex += OL_TOGW*3;
|
||||
if ((soops->flag & SO_HIDE_RESTRICTCOLS) == 0)
|
||||
sizex += OL_TOGW * 3;
|
||||
}
|
||||
|
||||
/* tweak to display last line (when list bigger than window) */
|
||||
@@ -1632,13 +1632,13 @@ void draw_outliner(const bContext *C)
|
||||
UI_view2d_totRect_set(v2d, sizex, sizey);
|
||||
|
||||
/* force display to pixel coords */
|
||||
v2d->flag |= (V2D_PIXELOFS_X|V2D_PIXELOFS_Y);
|
||||
v2d->flag |= (V2D_PIXELOFS_X | V2D_PIXELOFS_Y);
|
||||
/* set matrix for 2d-view controls */
|
||||
UI_view2d_view_ortho(v2d);
|
||||
|
||||
/* draw outliner stuff (background, hierachy lines and names) */
|
||||
outliner_back(ar);
|
||||
block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
|
||||
outliner_draw_tree((bContext *)C, block, scene, ar, soops);
|
||||
|
||||
if (ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) {
|
||||
|
||||
@@ -75,13 +75,13 @@
|
||||
static int outliner_open_back(SpaceOops *soops, TreeElement *te)
|
||||
{
|
||||
TreeStoreElem *tselem;
|
||||
int retval= 0;
|
||||
int retval = 0;
|
||||
|
||||
for (te= te->parent; te; te= te->parent) {
|
||||
tselem= TREESTORE(te);
|
||||
for (te = te->parent; te; te = te->parent) {
|
||||
tselem = TREESTORE(te);
|
||||
if (tselem->flag & TSE_CLOSED) {
|
||||
tselem->flag &= ~TSE_CLOSED;
|
||||
retval= 1;
|
||||
retval = 1;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
@@ -92,17 +92,17 @@ static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *te
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
/* check if this tree-element was the one we're seeking */
|
||||
if (te == teFind) {
|
||||
*found= 1;
|
||||
*found = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
/* try to see if sub-tree contains it then */
|
||||
outliner_open_reveal(soops, &te->subtree, teFind, found);
|
||||
if (*found) {
|
||||
tselem= TREESTORE(te);
|
||||
tselem = TREESTORE(te);
|
||||
if (tselem->flag & TSE_CLOSED)
|
||||
tselem->flag &= ~TSE_CLOSED;
|
||||
return;
|
||||
@@ -119,8 +119,8 @@ static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *te
|
||||
static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement *te, int all, const float mval[2])
|
||||
{
|
||||
|
||||
if (mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
|
||||
TreeStoreElem *tselem= TREESTORE(te);
|
||||
if (mval[1] > te->ys && mval[1] < te->ys + UI_UNIT_Y) {
|
||||
TreeStoreElem *tselem = TREESTORE(te);
|
||||
|
||||
/* all below close/open? */
|
||||
if (all) {
|
||||
@@ -135,7 +135,7 @@ static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (te= te->subtree.first; te; te= te->next) {
|
||||
for (te = te->subtree.first; te; te = te->next) {
|
||||
if (do_outliner_item_openclose(C, soops, te, all, mval))
|
||||
return 1;
|
||||
}
|
||||
@@ -146,15 +146,15 @@ static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement
|
||||
/* event can enterkey, then it opens/closes */
|
||||
static int outliner_item_openclose(bContext *C, wmOperator *op, wmEvent *event)
|
||||
{
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
TreeElement *te;
|
||||
float fmval[2];
|
||||
int all= RNA_boolean_get(op->ptr, "all");
|
||||
int all = RNA_boolean_get(op->ptr, "all");
|
||||
|
||||
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
|
||||
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval + 1);
|
||||
|
||||
for (te= soops->tree.first; te; te= te->next) {
|
||||
for (te = soops->tree.first; te; te = te->next) {
|
||||
if (do_outliner_item_openclose(C, soops, te, all, fmval))
|
||||
break;
|
||||
}
|
||||
@@ -183,12 +183,12 @@ static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem,
|
||||
{
|
||||
/* can't rename rna datablocks entries */
|
||||
if (ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
|
||||
/* do nothing */;
|
||||
/* do nothing */;
|
||||
}
|
||||
else if (ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE,
|
||||
TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
|
||||
TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
|
||||
{
|
||||
BKE_report(reports, RPT_WARNING, "Cannot edit builtin name");
|
||||
BKE_report(reports, RPT_WARNING, "Cannot edit builtin name");
|
||||
}
|
||||
else if (ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) {
|
||||
BKE_report(reports, RPT_WARNING, "Cannot edit sequence name");
|
||||
@@ -207,27 +207,27 @@ static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem,
|
||||
|
||||
void item_rename_cb(bContext *C, Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
|
||||
{
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
ReportList *reports= CTX_wm_reports(C); // XXX
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ReportList *reports = CTX_wm_reports(C); // XXX
|
||||
do_item_rename(ar, te, tselem, reports);
|
||||
}
|
||||
|
||||
static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, TreeElement *te, const float mval[2])
|
||||
{
|
||||
ReportList *reports= CTX_wm_reports(C); // XXX
|
||||
ReportList *reports = CTX_wm_reports(C); // XXX
|
||||
|
||||
if (mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
|
||||
TreeStoreElem *tselem= TREESTORE(te);
|
||||
if (mval[1] > te->ys && mval[1] < te->ys + UI_UNIT_Y) {
|
||||
TreeStoreElem *tselem = TREESTORE(te);
|
||||
|
||||
/* name and first icon */
|
||||
if (mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) {
|
||||
if (mval[0] > te->xs + UI_UNIT_X && mval[0] < te->xend) {
|
||||
|
||||
do_item_rename(ar, te, tselem, reports);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (te= te->subtree.first; te; te= te->next) {
|
||||
for (te = te->subtree.first; te; te = te->next) {
|
||||
if (do_outliner_item_rename(C, ar, soops, te, mval)) return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -235,14 +235,14 @@ static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, T
|
||||
|
||||
static int outliner_item_rename(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
|
||||
{
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
TreeElement *te;
|
||||
float fmval[2];
|
||||
|
||||
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
|
||||
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval + 1);
|
||||
|
||||
for (te= soops->tree.first; te; te= te->next) {
|
||||
for (te = soops->tree.first; te; te = te->next) {
|
||||
if (do_outliner_item_rename(C, ar, soops, te, fmval)) break;
|
||||
}
|
||||
|
||||
@@ -272,12 +272,12 @@ void OUTLINER_OT_item_rename(wmOperatorType *ot)
|
||||
static int outliner_count_levels(SpaceOops *soops, ListBase *lb, int curlevel)
|
||||
{
|
||||
TreeElement *te;
|
||||
int level=curlevel, lev;
|
||||
int level = curlevel, lev;
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
|
||||
lev= outliner_count_levels(soops, &te->subtree, curlevel+1);
|
||||
if (lev>level) level= lev;
|
||||
lev = outliner_count_levels(soops, &te->subtree, curlevel + 1);
|
||||
if (lev > level) level = lev;
|
||||
}
|
||||
return level;
|
||||
}
|
||||
@@ -288,11 +288,11 @@ int outliner_has_one_flag(SpaceOops *soops, ListBase *lb, short flag, short curl
|
||||
TreeStoreElem *tselem;
|
||||
int level;
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
if (tselem->flag & flag) return curlevel;
|
||||
|
||||
level= outliner_has_one_flag(soops, &te->subtree, flag, curlevel+1);
|
||||
level = outliner_has_one_flag(soops, &te->subtree, flag, curlevel + 1);
|
||||
if (level) return level;
|
||||
}
|
||||
return 0;
|
||||
@@ -303,9 +303,9 @@ void outliner_set_flag(SpaceOops *soops, ListBase *lb, short flag, short set)
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
if (set==0) tselem->flag &= ~flag;
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
if (set == 0) tselem->flag &= ~flag;
|
||||
else tselem->flag |= flag;
|
||||
outliner_set_flag(soops, &te->subtree, flag, set);
|
||||
}
|
||||
@@ -321,7 +321,7 @@ int common_restrict_check(bContext *C, Object *ob)
|
||||
/* Don't allow hide an object in edit mode,
|
||||
* check the bug #22153 and #21609, #23977
|
||||
*/
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
if (obedit && obedit == ob) {
|
||||
/* found object is hidden, reset */
|
||||
if (ob->restrictflag & OB_RESTRICT_VIEW)
|
||||
@@ -342,13 +342,13 @@ int common_restrict_check(bContext *C, Object *ob)
|
||||
|
||||
void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
|
||||
{
|
||||
Base *base= (Base *)te->directdata;
|
||||
Base *base = (Base *)te->directdata;
|
||||
Object *ob = (Object *)tselem->id;
|
||||
|
||||
/* add check for edit mode */
|
||||
if (!common_restrict_check(C, ob)) return;
|
||||
|
||||
if (base || (base= BKE_scene_base_find(scene, ob))) {
|
||||
if (base || (base = BKE_scene_base_find(scene, ob))) {
|
||||
if ((base->object->restrictflag ^= OB_RESTRICT_VIEW)) {
|
||||
ED_base_object_select(base, BA_DESELECT);
|
||||
}
|
||||
@@ -357,19 +357,19 @@ void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, Tre
|
||||
|
||||
void group_toggle_visibility_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
|
||||
{
|
||||
Group *group= (Group *)tselem->id;
|
||||
Group *group = (Group *)tselem->id;
|
||||
restrictbutton_gr_restrict_flag(scene, group, OB_RESTRICT_VIEW);
|
||||
}
|
||||
|
||||
static int outliner_toggle_visibility_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
|
||||
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_visibility_cb);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_VISIBLE, scene);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_VISIBLE, scene);
|
||||
ED_region_tag_redraw(ar);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -386,36 +386,36 @@ void OUTLINER_OT_visibility_toggle(wmOperatorType *ot)
|
||||
ot->exec = outliner_toggle_visibility_exec;
|
||||
ot->poll = ED_operator_outliner_active_no_editobject;
|
||||
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* Toggle Selectability ---------------------------------------- */
|
||||
|
||||
void object_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
|
||||
{
|
||||
Base *base= (Base *)te->directdata;
|
||||
Base *base = (Base *)te->directdata;
|
||||
|
||||
if (base==NULL) base= BKE_scene_base_find(scene, (Object *)tselem->id);
|
||||
if (base == NULL) base = BKE_scene_base_find(scene, (Object *)tselem->id);
|
||||
if (base) {
|
||||
base->object->restrictflag^=OB_RESTRICT_SELECT;
|
||||
base->object->restrictflag ^= OB_RESTRICT_SELECT;
|
||||
}
|
||||
}
|
||||
|
||||
void group_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
|
||||
{
|
||||
Group *group= (Group *)tselem->id;
|
||||
Group *group = (Group *)tselem->id;
|
||||
restrictbutton_gr_restrict_flag(scene, group, OB_RESTRICT_SELECT);
|
||||
}
|
||||
|
||||
static int outliner_toggle_selectability_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
|
||||
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_selectability_cb);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
ED_region_tag_redraw(ar);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -432,35 +432,35 @@ void OUTLINER_OT_selectability_toggle(wmOperatorType *ot)
|
||||
ot->exec = outliner_toggle_selectability_exec;
|
||||
ot->poll = ED_operator_outliner_active_no_editobject;
|
||||
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* Toggle Renderability ---------------------------------------- */
|
||||
|
||||
void object_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
|
||||
{
|
||||
Base *base= (Base *)te->directdata;
|
||||
Base *base = (Base *)te->directdata;
|
||||
|
||||
if (base==NULL) base= BKE_scene_base_find(scene, (Object *)tselem->id);
|
||||
if (base == NULL) base = BKE_scene_base_find(scene, (Object *)tselem->id);
|
||||
if (base) {
|
||||
base->object->restrictflag^=OB_RESTRICT_RENDER;
|
||||
base->object->restrictflag ^= OB_RESTRICT_RENDER;
|
||||
}
|
||||
}
|
||||
|
||||
void group_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
|
||||
{
|
||||
Group *group= (Group *)tselem->id;
|
||||
Group *group = (Group *)tselem->id;
|
||||
restrictbutton_gr_restrict_flag(scene, group, OB_RESTRICT_RENDER);
|
||||
}
|
||||
|
||||
static int outliner_toggle_renderability_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_renderability_cb);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, scene);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_RENDER, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -476,7 +476,7 @@ void OUTLINER_OT_renderability_toggle(wmOperatorType *ot)
|
||||
ot->exec = outliner_toggle_renderability_exec;
|
||||
ot->poll = ED_operator_outliner_active;
|
||||
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* =============================================== */
|
||||
@@ -486,8 +486,8 @@ void OUTLINER_OT_renderability_toggle(wmOperatorType *ot)
|
||||
|
||||
static int outliner_toggle_expanded_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
|
||||
if (outliner_has_one_flag(soops, &soops->tree, TSE_CLOSED, 1))
|
||||
outliner_set_flag(soops, &soops->tree, TSE_CLOSED, 0);
|
||||
@@ -517,9 +517,9 @@ void OUTLINER_OT_expanded_toggle(wmOperatorType *ot)
|
||||
|
||||
static int outliner_toggle_selected_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
if (outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1))
|
||||
outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 0);
|
||||
@@ -528,7 +528,7 @@ static int outliner_toggle_selected_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
soops->storeflag |= SO_TREESTORE_REDRAW;
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
ED_region_tag_redraw(ar);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -555,10 +555,10 @@ void OUTLINER_OT_selected_toggle(wmOperatorType *ot)
|
||||
|
||||
static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
SpaceOops *so= CTX_wm_space_outliner(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
View2D *v2d= &ar->v2d;
|
||||
SpaceOops *so = CTX_wm_space_outliner(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
View2D *v2d = &ar->v2d;
|
||||
|
||||
TreeElement *te;
|
||||
int xdelta, ytop;
|
||||
@@ -567,14 +567,14 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
if (OBACT == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
te= outliner_find_id(so, &so->tree, (ID *)OBACT);
|
||||
te = outliner_find_id(so, &so->tree, (ID *)OBACT);
|
||||
if (te) {
|
||||
/* make te->ys center of view */
|
||||
ytop= (int)(te->ys + (v2d->mask.ymax - v2d->mask.ymin)/2);
|
||||
if (ytop>0) ytop= 0;
|
||||
ytop = (int)(te->ys + (v2d->mask.ymax - v2d->mask.ymin) / 2);
|
||||
if (ytop > 0) ytop = 0;
|
||||
|
||||
v2d->cur.ymax = (float)ytop;
|
||||
v2d->cur.ymin = (float)(ytop-(v2d->mask.ymax - v2d->mask.ymin));
|
||||
v2d->cur.ymin = (float)(ytop - (v2d->mask.ymax - v2d->mask.ymin));
|
||||
|
||||
/* make te->xs ==> te->xend center of view */
|
||||
xdelta = (int)(te->xs - v2d->cur.xmin);
|
||||
@@ -605,16 +605,16 @@ void OUTLINER_OT_show_active(wmOperatorType *ot)
|
||||
|
||||
static int outliner_scroll_page_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
int dy= ar->v2d.mask.ymax - ar->v2d.mask.ymin;
|
||||
int up= 0;
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
int dy = ar->v2d.mask.ymax - ar->v2d.mask.ymin;
|
||||
int up = 0;
|
||||
|
||||
if (RNA_boolean_get(op->ptr, "up"))
|
||||
up= 1;
|
||||
up = 1;
|
||||
|
||||
if (up == 0) dy= -dy;
|
||||
ar->v2d.cur.ymin+= dy;
|
||||
ar->v2d.cur.ymax+= dy;
|
||||
if (up == 0) dy = -dy;
|
||||
ar->v2d.cur.ymin += dy;
|
||||
ar->v2d.cur.ymax += dy;
|
||||
|
||||
ED_region_tag_redraw(ar);
|
||||
|
||||
@@ -645,17 +645,17 @@ void OUTLINER_OT_scroll_page(wmOperatorType *ot)
|
||||
/* recursive helper for function below */
|
||||
static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te, int startx, int *starty)
|
||||
{
|
||||
TreeStoreElem *tselem= TREESTORE(te);
|
||||
TreeStoreElem *tselem = TREESTORE(te);
|
||||
|
||||
/* store coord and continue, we need coordinates for elements outside view too */
|
||||
te->xs= (float)startx;
|
||||
te->ys= (float)(*starty);
|
||||
*starty-= UI_UNIT_Y;
|
||||
te->xs = (float)startx;
|
||||
te->ys = (float)(*starty);
|
||||
*starty -= UI_UNIT_Y;
|
||||
|
||||
if (TSELEM_OPEN(tselem, soops)) {
|
||||
TreeElement *ten;
|
||||
for (ten= te->subtree.first; ten; ten= ten->next) {
|
||||
outliner_set_coordinates_element(soops, ten, startx+UI_UNIT_X, starty);
|
||||
for (ten = te->subtree.first; ten; ten = ten->next) {
|
||||
outliner_set_coordinates_element(soops, ten, startx + UI_UNIT_X, starty);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -665,10 +665,10 @@ static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te,
|
||||
static void outliner_set_coordinates(ARegion *ar, SpaceOops *soops)
|
||||
{
|
||||
TreeElement *te;
|
||||
int starty= (int)(ar->v2d.tot.ymax)-UI_UNIT_Y;
|
||||
int startx= 0;
|
||||
int starty = (int)(ar->v2d.tot.ymax) - UI_UNIT_Y;
|
||||
int startx = 0;
|
||||
|
||||
for (te= soops->tree.first; te; te= te->next) {
|
||||
for (te = soops->tree.first; te; te = te->next) {
|
||||
outliner_set_coordinates_element(soops, te, startx, &starty);
|
||||
}
|
||||
}
|
||||
@@ -678,7 +678,7 @@ static TreeElement *outliner_find_name(SpaceOops *soops, ListBase *lb, char *nam
|
||||
{
|
||||
TreeElement *te, *tes;
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
int found = outliner_filter_has_name(te, name, flags);
|
||||
|
||||
if (found) {
|
||||
@@ -694,7 +694,7 @@ static TreeElement *outliner_find_name(SpaceOops *soops, ListBase *lb, char *nam
|
||||
return te;
|
||||
}
|
||||
|
||||
tes= outliner_find_name(soops, &te->subtree, name, flags, prev, prevFound);
|
||||
tes = outliner_find_name(soops, &te->subtree, name, flags, prev, prevFound);
|
||||
if (tes) return tes;
|
||||
}
|
||||
|
||||
@@ -705,32 +705,32 @@ static TreeElement *outliner_find_name(SpaceOops *soops, ListBase *lb, char *nam
|
||||
static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *soops, int again, int flags)
|
||||
{
|
||||
ReportList *reports = NULL; // CTX_wm_reports(C);
|
||||
TreeElement *te= NULL;
|
||||
TreeElement *te = NULL;
|
||||
TreeElement *last_find;
|
||||
TreeStoreElem *tselem;
|
||||
int ytop, xdelta, prevFound=0;
|
||||
int ytop, xdelta, prevFound = 0;
|
||||
char name[sizeof(soops->search_string)];
|
||||
|
||||
/* get last found tree-element based on stored search_tse */
|
||||
last_find= outliner_find_tse(soops, &soops->search_tse);
|
||||
last_find = outliner_find_tse(soops, &soops->search_tse);
|
||||
|
||||
/* determine which type of search to do */
|
||||
if (again && last_find) {
|
||||
/* no popup panel - previous + user wanted to search for next after previous */
|
||||
BLI_strncpy(name, soops->search_string, sizeof(name));
|
||||
flags= soops->search_flags;
|
||||
flags = soops->search_flags;
|
||||
|
||||
/* try to find matching element */
|
||||
te= outliner_find_name(soops, &soops->tree, name, flags, last_find, &prevFound);
|
||||
if (te==NULL) {
|
||||
te = outliner_find_name(soops, &soops->tree, name, flags, last_find, &prevFound);
|
||||
if (te == NULL) {
|
||||
/* no more matches after previous, start from beginning again */
|
||||
prevFound= 1;
|
||||
te= outliner_find_name(soops, &soops->tree, name, flags, last_find, &prevFound);
|
||||
prevFound = 1;
|
||||
te = outliner_find_name(soops, &soops->tree, name, flags, last_find, &prevFound);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* pop up panel - no previous, or user didn't want search after previous */
|
||||
name[0]= '\0';
|
||||
name[0] = '\0';
|
||||
// XXX if (sbutton(name, 0, sizeof(name)-1, "Find: ") && name[0]) {
|
||||
// te= outliner_find_name(soops, &soops->tree, name, flags, NULL, &prevFound);
|
||||
// }
|
||||
@@ -739,10 +739,10 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
|
||||
|
||||
/* do selection and reveal */
|
||||
if (te) {
|
||||
tselem= TREESTORE(te);
|
||||
tselem = TREESTORE(te);
|
||||
if (tselem) {
|
||||
/* expand branches so that it will be visible, we need to get correct coordinates */
|
||||
if ( outliner_open_back(soops, te))
|
||||
if (outliner_open_back(soops, te))
|
||||
outliner_set_coordinates(ar, soops);
|
||||
|
||||
/* deselect all visible, and select found element */
|
||||
@@ -750,10 +750,10 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
|
||||
tselem->flag |= TSE_SELECTED;
|
||||
|
||||
/* make te->ys center of view */
|
||||
ytop= (int)(te->ys + (ar->v2d.mask.ymax-ar->v2d.mask.ymin)/2);
|
||||
if (ytop>0) ytop= 0;
|
||||
ytop = (int)(te->ys + (ar->v2d.mask.ymax - ar->v2d.mask.ymin) / 2);
|
||||
if (ytop > 0) ytop = 0;
|
||||
ar->v2d.cur.ymax = (float)ytop;
|
||||
ar->v2d.cur.ymin = (float)(ytop-(ar->v2d.mask.ymax-ar->v2d.mask.ymin));
|
||||
ar->v2d.cur.ymin = (float)(ytop - (ar->v2d.mask.ymax - ar->v2d.mask.ymin));
|
||||
|
||||
/* make te->xs ==> te->xend center of view */
|
||||
xdelta = (int)(te->xs - ar->v2d.cur.xmin);
|
||||
@@ -761,10 +761,10 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
|
||||
ar->v2d.cur.xmax += xdelta;
|
||||
|
||||
/* store selection */
|
||||
soops->search_tse= *tselem;
|
||||
soops->search_tse = *tselem;
|
||||
|
||||
BLI_strncpy(soops->search_string, name, sizeof(soops->search_string));
|
||||
soops->search_flags= flags;
|
||||
soops->search_flags = flags;
|
||||
|
||||
/* redraw */
|
||||
soops->storeflag |= SO_TREESTORE_REDRAW;
|
||||
@@ -785,34 +785,34 @@ static void outliner_openclose_level(SpaceOops *soops, ListBase *lb, int curleve
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
|
||||
if (open) {
|
||||
if (curlevel<=level) tselem->flag &= ~TSE_CLOSED;
|
||||
if (curlevel <= level) tselem->flag &= ~TSE_CLOSED;
|
||||
}
|
||||
else {
|
||||
if (curlevel>=level) tselem->flag |= TSE_CLOSED;
|
||||
if (curlevel >= level) tselem->flag |= TSE_CLOSED;
|
||||
}
|
||||
|
||||
outliner_openclose_level(soops, &te->subtree, curlevel+1, level, open);
|
||||
outliner_openclose_level(soops, &te->subtree, curlevel + 1, level, open);
|
||||
}
|
||||
}
|
||||
|
||||
static int outliner_one_level_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
int add= RNA_boolean_get(op->ptr, "open");
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
int add = RNA_boolean_get(op->ptr, "open");
|
||||
int level;
|
||||
|
||||
level= outliner_has_one_flag(soops, &soops->tree, TSE_CLOSED, 1);
|
||||
if (add==1) {
|
||||
level = outliner_has_one_flag(soops, &soops->tree, TSE_CLOSED, 1);
|
||||
if (add == 1) {
|
||||
if (level) outliner_openclose_level(soops, &soops->tree, 1, level, 1);
|
||||
}
|
||||
else {
|
||||
if (level==0) level= outliner_count_levels(soops, &soops->tree, 0);
|
||||
if (level) outliner_openclose_level(soops, &soops->tree, 1, level-1, 0);
|
||||
if (level == 0) level = outliner_count_levels(soops, &soops->tree, 0);
|
||||
if (level) outliner_openclose_level(soops, &soops->tree, 1, level - 1, 0);
|
||||
}
|
||||
|
||||
ED_region_tag_redraw(ar);
|
||||
@@ -845,10 +845,10 @@ static int subtree_has_objects(SpaceOops *soops, ListBase *lb)
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
if (tselem->type==0 && te->idcode==ID_OB) return 1;
|
||||
if ( subtree_has_objects(soops, &te->subtree)) return 1;
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
if (tselem->type == 0 && te->idcode == ID_OB) return 1;
|
||||
if (subtree_has_objects(soops, &te->subtree)) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -860,15 +860,15 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase
|
||||
TreeStoreElem *tselem;
|
||||
|
||||
/* open all object elems, close others */
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
|
||||
if (tselem->type==0) {
|
||||
if (te->idcode==ID_SCE) {
|
||||
if (tselem->id!=(ID *)scene) tselem->flag |= TSE_CLOSED;
|
||||
else tselem->flag &= ~TSE_CLOSED;
|
||||
if (tselem->type == 0) {
|
||||
if (te->idcode == ID_SCE) {
|
||||
if (tselem->id != (ID *)scene) tselem->flag |= TSE_CLOSED;
|
||||
else tselem->flag &= ~TSE_CLOSED;
|
||||
}
|
||||
else if (te->idcode==ID_OB) {
|
||||
else if (te->idcode == ID_OB) {
|
||||
if (subtree_has_objects(soops, &te->subtree)) tselem->flag &= ~TSE_CLOSED;
|
||||
else tselem->flag |= TSE_CLOSED;
|
||||
}
|
||||
@@ -882,9 +882,9 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase
|
||||
/* show entire object level hierarchy */
|
||||
static int outliner_show_hierarchy_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
/* recursively open/close levels */
|
||||
tree_element_show_hierarchy(scene, soops, &soops->tree);
|
||||
@@ -915,9 +915,9 @@ void OUTLINER_OT_show_hierarchy(wmOperatorType *ot)
|
||||
/* specialized poll callback for these operators to work in Datablocks view only */
|
||||
static int ed_operator_outliner_datablocks_active(bContext *C)
|
||||
{
|
||||
ScrArea *sa= CTX_wm_area(C);
|
||||
if ((sa) && (sa->spacetype==SPACE_OUTLINER)) {
|
||||
SpaceOops *so= CTX_wm_space_outliner(C);
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
if ((sa) && (sa->spacetype == SPACE_OUTLINER)) {
|
||||
SpaceOops *so = CTX_wm_space_outliner(C);
|
||||
return (so->outlinevis == SO_DATABLOCKS);
|
||||
}
|
||||
return 0;
|
||||
@@ -929,7 +929,7 @@ static int ed_operator_outliner_datablocks_active(bContext *C)
|
||||
* this function does not do that yet
|
||||
*/
|
||||
static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem,
|
||||
ID **id, char **path, int *array_index, short *flag, short *UNUSED(groupmode))
|
||||
ID **id, char **path, int *array_index, short *flag, short *UNUSED(groupmode))
|
||||
{
|
||||
ListBase hierarchy = {NULL, NULL};
|
||||
LinkData *ld;
|
||||
@@ -937,7 +937,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
|
||||
TreeStoreElem *tse /* , *tsenext */ /* UNUSED */;
|
||||
PointerRNA *ptr, *nextptr;
|
||||
PropertyRNA *prop;
|
||||
char *newpath=NULL;
|
||||
char *newpath = NULL;
|
||||
|
||||
/* optimize tricks:
|
||||
* - Don't do anything if the selected item is a 'struct', but arrays are allowed
|
||||
@@ -946,28 +946,28 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
|
||||
return;
|
||||
|
||||
/* Overview of Algorithm:
|
||||
* 1. Go up the chain of parents until we find the 'root', taking note of the
|
||||
* 1. Go up the chain of parents until we find the 'root', taking note of the
|
||||
* levels encountered in reverse-order (i.e. items are added to the start of the list
|
||||
* for more convenient looping later)
|
||||
* 2. Walk down the chain, adding from the first ID encountered
|
||||
* 2. Walk down the chain, adding from the first ID encountered
|
||||
* (which will become the 'ID' for the KeyingSet Path), and build a
|
||||
* path as we step through the chain
|
||||
* path as we step through the chain
|
||||
*/
|
||||
|
||||
/* step 1: flatten out hierarchy of parents into a flat chain */
|
||||
for (tem= te->parent; tem; tem= tem->parent) {
|
||||
ld= MEM_callocN(sizeof(LinkData), "LinkData for tree_element_to_path()");
|
||||
ld->data= tem;
|
||||
for (tem = te->parent; tem; tem = tem->parent) {
|
||||
ld = MEM_callocN(sizeof(LinkData), "LinkData for tree_element_to_path()");
|
||||
ld->data = tem;
|
||||
BLI_addhead(&hierarchy, ld);
|
||||
}
|
||||
|
||||
/* step 2: step down hierarchy building the path (NOTE: addhead in previous loop was needed so that we can loop like this) */
|
||||
for (ld= hierarchy.first; ld; ld= ld->next) {
|
||||
for (ld = hierarchy.first; ld; ld = ld->next) {
|
||||
/* get data */
|
||||
tem= (TreeElement *)ld->data;
|
||||
tse= TREESTORE(tem);
|
||||
ptr= &tem->rnaptr;
|
||||
prop= tem->directdata;
|
||||
tem = (TreeElement *)ld->data;
|
||||
tse = TREESTORE(tem);
|
||||
ptr = &tem->rnaptr;
|
||||
prop = tem->directdata;
|
||||
|
||||
/* check if we're looking for first ID, or appending to path */
|
||||
if (*id) {
|
||||
@@ -977,43 +977,43 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
|
||||
if (tse->type == TSE_RNA_PROPERTY) {
|
||||
if (RNA_property_type(prop) == PROP_POINTER) {
|
||||
/* for pointer we just append property name */
|
||||
newpath= RNA_path_append(*path, ptr, prop, 0, NULL);
|
||||
newpath = RNA_path_append(*path, ptr, prop, 0, NULL);
|
||||
}
|
||||
else if (RNA_property_type(prop) == PROP_COLLECTION) {
|
||||
char buf[128], *name;
|
||||
|
||||
temnext= (TreeElement*)(ld->next->data);
|
||||
temnext = (TreeElement *)(ld->next->data);
|
||||
/* tsenext= TREESTORE(temnext); */ /* UNUSED */
|
||||
|
||||
nextptr= &temnext->rnaptr;
|
||||
name= RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf), NULL);
|
||||
nextptr = &temnext->rnaptr;
|
||||
name = RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf), NULL);
|
||||
|
||||
if (name) {
|
||||
/* if possible, use name as a key in the path */
|
||||
newpath= RNA_path_append(*path, NULL, prop, 0, name);
|
||||
newpath = RNA_path_append(*path, NULL, prop, 0, name);
|
||||
|
||||
if (name != buf)
|
||||
MEM_freeN(name);
|
||||
}
|
||||
else {
|
||||
/* otherwise use index */
|
||||
int index= 0;
|
||||
int index = 0;
|
||||
|
||||
for (temsub=tem->subtree.first; temsub; temsub=temsub->next, index++)
|
||||
for (temsub = tem->subtree.first; temsub; temsub = temsub->next, index++)
|
||||
if (temsub == temnext)
|
||||
break;
|
||||
|
||||
newpath= RNA_path_append(*path, NULL, prop, index, NULL);
|
||||
newpath = RNA_path_append(*path, NULL, prop, index, NULL);
|
||||
}
|
||||
|
||||
ld= ld->next;
|
||||
ld = ld->next;
|
||||
}
|
||||
}
|
||||
|
||||
if (newpath) {
|
||||
if (*path) MEM_freeN(*path);
|
||||
*path= newpath;
|
||||
newpath= NULL;
|
||||
*path = newpath;
|
||||
newpath = NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1021,12 +1021,12 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
|
||||
if (tse->type == TSE_RNA_STRUCT) {
|
||||
/* ptr->data not ptr->id.data seems to be the one we want, since ptr->data is sometimes the owner of this ID? */
|
||||
if (RNA_struct_is_ID(ptr->type)) {
|
||||
*id= (ID *)ptr->data;
|
||||
*id = (ID *)ptr->data;
|
||||
|
||||
/* clear path */
|
||||
if (*path) {
|
||||
MEM_freeN(*path);
|
||||
path= NULL;
|
||||
path = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1036,13 +1036,13 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
|
||||
/* step 3: if we've got an ID, add the current item to the path */
|
||||
if (*id) {
|
||||
/* add the active property to the path */
|
||||
ptr= &te->rnaptr;
|
||||
prop= te->directdata;
|
||||
ptr = &te->rnaptr;
|
||||
prop = te->directdata;
|
||||
|
||||
/* array checks */
|
||||
if (tselem->type == TSE_RNA_ARRAY_ELEM) {
|
||||
/* item is part of an array, so must set the array_index */
|
||||
*array_index= te->index;
|
||||
*array_index = te->index;
|
||||
}
|
||||
else if (RNA_property_array_length(ptr, prop)) {
|
||||
/* entire array was selected, so keyframe all */
|
||||
@@ -1050,9 +1050,9 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
|
||||
}
|
||||
|
||||
/* path */
|
||||
newpath= RNA_path_append(*path, NULL, prop, 0, NULL);
|
||||
newpath = RNA_path_append(*path, NULL, prop, 0, NULL);
|
||||
if (*path) MEM_freeN(*path);
|
||||
*path= newpath;
|
||||
*path = newpath;
|
||||
}
|
||||
|
||||
/* free temp data */
|
||||
@@ -1066,7 +1066,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
|
||||
* they depend on having RNA paths and/or hierarchies available.
|
||||
*/
|
||||
enum {
|
||||
DRIVERS_EDITMODE_ADD = 0,
|
||||
DRIVERS_EDITMODE_ADD = 0,
|
||||
DRIVERS_EDITMODE_REMOVE,
|
||||
} /*eDrivers_EditModes*/;
|
||||
|
||||
@@ -1078,22 +1078,22 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
|
||||
for (te= tree->first; te; te=te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
for (te = tree->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
|
||||
/* if item is selected, perform operation */
|
||||
if (tselem->flag & TSE_SELECTED) {
|
||||
ID *id= NULL;
|
||||
char *path= NULL;
|
||||
int array_index= 0;
|
||||
short flag= 0;
|
||||
short groupmode= KSP_GROUP_KSNAME;
|
||||
ID *id = NULL;
|
||||
char *path = NULL;
|
||||
int array_index = 0;
|
||||
short flag = 0;
|
||||
short groupmode = KSP_GROUP_KSNAME;
|
||||
|
||||
/* check if RNA-property described by this selected element is an animatable prop */
|
||||
if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM) && RNA_property_animateable(&te->rnaptr, te->directdata)) {
|
||||
/* get id + path + index info from the selected element */
|
||||
tree_element_to_path(soops, te, tselem,
|
||||
&id, &path, &array_index, &flag, &groupmode);
|
||||
&id, &path, &array_index, &flag, &groupmode);
|
||||
}
|
||||
|
||||
/* only if ID and path were set, should we perform any actions */
|
||||
@@ -1104,10 +1104,10 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL
|
||||
/* array checks */
|
||||
if (flag & KSP_FLAG_WHOLE_ARRAY) {
|
||||
/* entire array was selected, so add drivers for all */
|
||||
arraylen= RNA_property_array_length(&te->rnaptr, te->directdata);
|
||||
arraylen = RNA_property_array_length(&te->rnaptr, te->directdata);
|
||||
}
|
||||
else
|
||||
arraylen= array_index;
|
||||
arraylen = array_index;
|
||||
|
||||
/* we should do at least one step */
|
||||
if (arraylen == array_index)
|
||||
@@ -1122,13 +1122,13 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL
|
||||
/* add a new driver with the information obtained (only if valid) */
|
||||
ANIM_add_driver(reports, id, path, array_index, dflags, DRIVER_TYPE_PYTHON);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case DRIVERS_EDITMODE_REMOVE:
|
||||
{
|
||||
/* remove driver matching the information obtained (only if valid) */
|
||||
ANIM_remove_driver(reports, id, path, array_index, dflags);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1149,7 +1149,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL
|
||||
|
||||
static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceOops *soutliner= CTX_wm_space_outliner(C);
|
||||
SpaceOops *soutliner = CTX_wm_space_outliner(C);
|
||||
|
||||
/* check for invalid states */
|
||||
if (soutliner == NULL)
|
||||
@@ -1159,7 +1159,7 @@ static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op)
|
||||
do_outliner_drivers_editop(soutliner, &soutliner->tree, op->reports, DRIVERS_EDITMODE_ADD);
|
||||
|
||||
/* send notifiers */
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_FCURVES_ORDER, NULL); // XXX
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -1176,7 +1176,7 @@ void OUTLINER_OT_drivers_add_selected(wmOperatorType *ot)
|
||||
ot->poll = ed_operator_outliner_datablocks_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
|
||||
@@ -1184,7 +1184,7 @@ void OUTLINER_OT_drivers_add_selected(wmOperatorType *ot)
|
||||
|
||||
static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceOops *soutliner= CTX_wm_space_outliner(C);
|
||||
SpaceOops *soutliner = CTX_wm_space_outliner(C);
|
||||
|
||||
/* check for invalid states */
|
||||
if (soutliner == NULL)
|
||||
@@ -1211,7 +1211,7 @@ void OUTLINER_OT_drivers_delete_selected(wmOperatorType *ot)
|
||||
ot->poll = ed_operator_outliner_datablocks_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* =============================================== */
|
||||
@@ -1221,7 +1221,7 @@ void OUTLINER_OT_drivers_delete_selected(wmOperatorType *ot)
|
||||
* they depend on having RNA paths and/or hierarchies available.
|
||||
*/
|
||||
enum {
|
||||
KEYINGSET_EDITMODE_ADD = 0,
|
||||
KEYINGSET_EDITMODE_ADD = 0,
|
||||
KEYINGSET_EDITMODE_REMOVE,
|
||||
} /*eKeyingSet_EditModes*/;
|
||||
|
||||
@@ -1231,7 +1231,7 @@ enum {
|
||||
// TODO: should this be an API func?
|
||||
static KeyingSet *verify_active_keyingset(Scene *scene, short add)
|
||||
{
|
||||
KeyingSet *ks= NULL;
|
||||
KeyingSet *ks = NULL;
|
||||
|
||||
/* sanity check */
|
||||
if (scene == NULL)
|
||||
@@ -1239,13 +1239,13 @@ static KeyingSet *verify_active_keyingset(Scene *scene, short add)
|
||||
|
||||
/* try to find one from scene */
|
||||
if (scene->active_keyingset > 0)
|
||||
ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
|
||||
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
|
||||
|
||||
/* add if none found */
|
||||
// XXX the default settings have yet to evolve
|
||||
if ((add) && (ks==NULL)) {
|
||||
ks= BKE_keyingset_add(&scene->keyingsets, NULL, NULL, KEYINGSET_ABSOLUTE, 0);
|
||||
scene->active_keyingset= BLI_countlist(&scene->keyingsets);
|
||||
if ((add) && (ks == NULL)) {
|
||||
ks = BKE_keyingset_add(&scene->keyingsets, NULL, NULL, KEYINGSET_ABSOLUTE, 0);
|
||||
scene->active_keyingset = BLI_countlist(&scene->keyingsets);
|
||||
}
|
||||
|
||||
return ks;
|
||||
@@ -1257,22 +1257,22 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
|
||||
for (te= tree->first; te; te=te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
for (te = tree->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
|
||||
/* if item is selected, perform operation */
|
||||
if (tselem->flag & TSE_SELECTED) {
|
||||
ID *id= NULL;
|
||||
char *path= NULL;
|
||||
int array_index= 0;
|
||||
short flag= 0;
|
||||
short groupmode= KSP_GROUP_KSNAME;
|
||||
ID *id = NULL;
|
||||
char *path = NULL;
|
||||
int array_index = 0;
|
||||
short flag = 0;
|
||||
short groupmode = KSP_GROUP_KSNAME;
|
||||
|
||||
/* check if RNA-property described by this selected element is an animatable prop */
|
||||
if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM) && RNA_property_animateable(&te->rnaptr, te->directdata)) {
|
||||
/* get id + path + index info from the selected element */
|
||||
tree_element_to_path(soops, te, tselem,
|
||||
&id, &path, &array_index, &flag, &groupmode);
|
||||
&id, &path, &array_index, &flag, &groupmode);
|
||||
}
|
||||
|
||||
/* only if ID and path were set, should we perform any actions */
|
||||
@@ -1284,22 +1284,22 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
|
||||
/* add a new path with the information obtained (only if valid) */
|
||||
// TODO: what do we do with group name? for now, we don't supply one, and just let this use the KeyingSet name
|
||||
BKE_keyingset_add_path(ks, id, NULL, path, array_index, flag, groupmode);
|
||||
ks->active_path= BLI_countlist(&ks->paths);
|
||||
ks->active_path = BLI_countlist(&ks->paths);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case KEYINGSET_EDITMODE_REMOVE:
|
||||
{
|
||||
/* find the relevant path, then remove it from the KeyingSet */
|
||||
KS_Path *ksp= BKE_keyingset_find_path(ks, id, NULL, path, array_index, groupmode);
|
||||
KS_Path *ksp = BKE_keyingset_find_path(ks, id, NULL, path, array_index, groupmode);
|
||||
|
||||
if (ksp) {
|
||||
/* free path's data */
|
||||
BKE_keyingset_free_path(ks, ksp);
|
||||
|
||||
ks->active_path= 0;
|
||||
ks->active_path = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
/* free path, since it had to be generated */
|
||||
@@ -1317,9 +1317,9 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
|
||||
|
||||
static int outliner_keyingset_additems_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceOops *soutliner= CTX_wm_space_outliner(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
KeyingSet *ks= verify_active_keyingset(scene, 1);
|
||||
SpaceOops *soutliner = CTX_wm_space_outliner(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
KeyingSet *ks = verify_active_keyingset(scene, 1);
|
||||
|
||||
/* check for invalid states */
|
||||
if (ks == NULL) {
|
||||
@@ -1333,7 +1333,7 @@ static int outliner_keyingset_additems_exec(bContext *C, wmOperator *op)
|
||||
do_outliner_keyingset_editop(soutliner, ks, &soutliner->tree, KEYINGSET_EDITMODE_ADD);
|
||||
|
||||
/* send notifiers */
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -1350,7 +1350,7 @@ void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot)
|
||||
ot->poll = ed_operator_outliner_datablocks_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
|
||||
@@ -1358,9 +1358,9 @@ void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot)
|
||||
|
||||
static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
SpaceOops *soutliner= CTX_wm_space_outliner(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
KeyingSet *ks= verify_active_keyingset(scene, 1);
|
||||
SpaceOops *soutliner = CTX_wm_space_outliner(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
KeyingSet *ks = verify_active_keyingset(scene, 1);
|
||||
|
||||
/* check for invalid states */
|
||||
if (soutliner == NULL)
|
||||
@@ -1370,7 +1370,7 @@ static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *UNUSED(o
|
||||
do_outliner_keyingset_editop(soutliner, ks, &soutliner->tree, KEYINGSET_EDITMODE_REMOVE);
|
||||
|
||||
/* send notifiers */
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -1387,7 +1387,7 @@ void OUTLINER_OT_keyingset_remove_selected(wmOperatorType *ot)
|
||||
ot->poll = ed_operator_outliner_datablocks_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* ******************** Parent Drop Operator *********************** */
|
||||
@@ -1395,23 +1395,23 @@ void OUTLINER_OT_keyingset_remove_selected(wmOperatorType *ot)
|
||||
static int parent_drop_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *par = NULL, *ob = NULL;
|
||||
Main *bmain= CTX_data_main(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
int partype = -1;
|
||||
char parname[MAX_ID_NAME], childname[MAX_ID_NAME];
|
||||
|
||||
partype= RNA_enum_get(op->ptr, "type");
|
||||
partype = RNA_enum_get(op->ptr, "type");
|
||||
RNA_string_get(op->ptr, "parent", parname);
|
||||
par= (Object *)BKE_libblock_find_name(ID_OB, parname);
|
||||
par = (Object *)BKE_libblock_find_name(ID_OB, parname);
|
||||
RNA_string_get(op->ptr, "child", childname);
|
||||
ob= (Object *)BKE_libblock_find_name(ID_OB, childname);
|
||||
ob = (Object *)BKE_libblock_find_name(ID_OB, childname);
|
||||
|
||||
ED_object_parent_set(op->reports, bmain, scene, ob, par, partype);
|
||||
|
||||
DAG_scene_sort(bmain, scene);
|
||||
DAG_ids_flush_update(bmain, 0);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, NULL);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -1419,8 +1419,8 @@ static int parent_drop_exec(bContext *C, wmOperator *op)
|
||||
/* Used for drag and drop parenting */
|
||||
TreeElement *outliner_dropzone_parent(bContext *C, wmEvent *event, TreeElement *te, float *fmval)
|
||||
{
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
TreeStoreElem *tselem= TREESTORE(te);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
TreeStoreElem *tselem = TREESTORE(te);
|
||||
|
||||
if ((fmval[1] > te->ys) && (fmval[1] < (te->ys + UI_UNIT_Y))) {
|
||||
/* name and first icon */
|
||||
@@ -1436,10 +1436,10 @@ TreeElement *outliner_dropzone_parent(bContext *C, wmEvent *event, TreeElement *
|
||||
}
|
||||
|
||||
/* Not it. Let's look at its children. */
|
||||
if ((tselem->flag & TSE_CLOSED)==0 && (te->subtree.first)) {
|
||||
if ((tselem->flag & TSE_CLOSED) == 0 && (te->subtree.first)) {
|
||||
for (te = te->subtree.first; te; te = te->next) {
|
||||
TreeElement *te_valid;
|
||||
te_valid= outliner_dropzone_parent(C, event, te, fmval);
|
||||
te_valid = outliner_dropzone_parent(C, event, te, fmval);
|
||||
if (te_valid) return te_valid;
|
||||
}
|
||||
}
|
||||
@@ -1448,24 +1448,24 @@ TreeElement *outliner_dropzone_parent(bContext *C, wmEvent *event, TreeElement *
|
||||
|
||||
static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
{
|
||||
Object *par= NULL;
|
||||
Object *ob= NULL;
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
Main *bmain= CTX_data_main(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
TreeElement *te= NULL;
|
||||
TreeElement *te_found= NULL;
|
||||
Object *par = NULL;
|
||||
Object *ob = NULL;
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
TreeElement *te = NULL;
|
||||
TreeElement *te_found = NULL;
|
||||
char childname[MAX_ID_NAME];
|
||||
char parname[MAX_ID_NAME];
|
||||
int partype= 0;
|
||||
int partype = 0;
|
||||
float fmval[2];
|
||||
|
||||
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
|
||||
|
||||
/* Find object hovered over */
|
||||
for (te= soops->tree.first; te; te= te->next) {
|
||||
te_found= outliner_dropzone_parent(C, event, te, fmval);
|
||||
for (te = soops->tree.first; te; te = te->next) {
|
||||
te_found = outliner_dropzone_parent(C, event, te, fmval);
|
||||
if (te_found) break;
|
||||
}
|
||||
|
||||
@@ -1473,9 +1473,9 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
RNA_string_set(op->ptr, "parent", te_found->name);
|
||||
/* Identify parent and child */
|
||||
RNA_string_get(op->ptr, "child", childname);
|
||||
ob= (Object *)BKE_libblock_find_name(ID_OB, childname);
|
||||
ob = (Object *)BKE_libblock_find_name(ID_OB, childname);
|
||||
RNA_string_get(op->ptr, "parent", parname);
|
||||
par= (Object *)BKE_libblock_find_name(ID_OB, parname);
|
||||
par = (Object *)BKE_libblock_find_name(ID_OB, parname);
|
||||
|
||||
if (ELEM(NULL, ob, par)) {
|
||||
if (par == NULL) printf("par==NULL\n");
|
||||
@@ -1493,14 +1493,14 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
if (ED_object_parent_set(op->reports, bmain, scene, ob, par, partype)) {
|
||||
DAG_scene_sort(bmain, scene);
|
||||
DAG_ids_flush_update(bmain, 0);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, NULL);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Menu creation */
|
||||
uiPopupMenu *pup= uiPupMenuBegin(C, IFACE_("Set Parent To"), ICON_NONE);
|
||||
uiLayout *layout= uiPupMenuLayout(pup);
|
||||
uiPopupMenu *pup = uiPupMenuBegin(C, IFACE_("Set Parent To"), ICON_NONE);
|
||||
uiLayout *layout = uiPupMenuLayout(pup);
|
||||
|
||||
PointerRNA ptr;
|
||||
|
||||
@@ -1513,7 +1513,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
|
||||
|
||||
/* par becomes parent, make the associated menus */
|
||||
if (par->type==OB_ARMATURE) {
|
||||
if (par->type == OB_ARMATURE) {
|
||||
WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
|
||||
RNA_string_set(&ptr, "parent", parname);
|
||||
RNA_string_set(&ptr, "child", childname);
|
||||
@@ -1549,7 +1549,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("Bone"),
|
||||
0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
|
||||
}
|
||||
else if (par->type==OB_CURVE) {
|
||||
else if (par->type == OB_CURVE) {
|
||||
WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
|
||||
RNA_string_set(&ptr, "parent", parname);
|
||||
RNA_string_set(&ptr, "child", childname);
|
||||
@@ -1606,7 +1606,7 @@ void OUTLINER_OT_parent_drop(wmOperatorType *ot)
|
||||
ot->poll = ED_operator_outliner_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
RNA_def_string(ot->srna, "child", "Object", MAX_ID_NAME, "Child", "Child Object");
|
||||
@@ -1616,15 +1616,15 @@ void OUTLINER_OT_parent_drop(wmOperatorType *ot)
|
||||
|
||||
int outliner_dropzone_parent_clear(bContext *C, wmEvent *event, TreeElement *te, float *fmval)
|
||||
{
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
TreeStoreElem *tselem= TREESTORE(te);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
TreeStoreElem *tselem = TREESTORE(te);
|
||||
|
||||
/* Check for row */
|
||||
if ((fmval[1] > te->ys) && (fmval[1] < (te->ys + UI_UNIT_Y))) {
|
||||
/* Ignore drop on scene tree elements */
|
||||
if ((fmval[0] > te->xs + UI_UNIT_X) && (fmval[0] < te->xend)) {
|
||||
if ((te->idcode == ID_SCE) &&
|
||||
!ELEM3(tselem->type, TSE_R_LAYER_BASE, TSE_R_LAYER, TSE_R_PASS))
|
||||
!ELEM3(tselem->type, TSE_R_LAYER_BASE, TSE_R_LAYER, TSE_R_PASS))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -1639,11 +1639,11 @@ int outliner_dropzone_parent_clear(bContext *C, wmEvent *event, TreeElement *te,
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0; // ID_OB, but mouse in undefined dropzone.
|
||||
return 0; // ID_OB, but mouse in undefined dropzone.
|
||||
}
|
||||
|
||||
/* Not this row. Let's look at its children. */
|
||||
if ((tselem->flag & TSE_CLOSED)==0 && (te->subtree.first)) {
|
||||
if ((tselem->flag & TSE_CLOSED) == 0 && (te->subtree.first)) {
|
||||
for (te = te->subtree.first; te; te = te->next) {
|
||||
if (outliner_dropzone_parent_clear(C, event, te, fmval))
|
||||
return 1;
|
||||
@@ -1654,12 +1654,12 @@ int outliner_dropzone_parent_clear(bContext *C, wmEvent *event, TreeElement *te,
|
||||
|
||||
static int parent_clear_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *ob= NULL;
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *ob = NULL;
|
||||
char obname[MAX_ID_NAME];
|
||||
|
||||
RNA_string_get(op->ptr, "dragged_obj", obname);
|
||||
ob= (Object *)BKE_libblock_find_name(ID_OB, obname);
|
||||
ob = (Object *)BKE_libblock_find_name(ID_OB, obname);
|
||||
|
||||
/* check dragged object (child) is active */
|
||||
if (ob != CTX_data_active_object(C))
|
||||
@@ -1683,7 +1683,7 @@ void OUTLINER_OT_parent_clear(wmOperatorType *ot)
|
||||
ot->poll = ED_operator_outliner_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
RNA_def_string(ot->srna, "dragged_obj", "Object", MAX_ID_NAME, "Child", "Child Object");
|
||||
|
||||
@@ -48,82 +48,82 @@ struct Object;
|
||||
typedef struct TreeElement {
|
||||
struct TreeElement *next, *prev, *parent;
|
||||
ListBase subtree;
|
||||
float xs, ys; // do selection
|
||||
int store_index; // offset in tree store
|
||||
short flag; // flag for non-saved stuff
|
||||
short index; // index for data arrays
|
||||
short idcode; // from TreeStore id
|
||||
short xend; // width of item display, for select
|
||||
float xs, ys; // do selection
|
||||
int store_index; // offset in tree store
|
||||
short flag; // flag for non-saved stuff
|
||||
short index; // index for data arrays
|
||||
short idcode; // from TreeStore id
|
||||
short xend; // width of item display, for select
|
||||
const char *name;
|
||||
void *directdata; // Armature Bones, Base, Sequence, Strip...
|
||||
PointerRNA rnaptr; // RNA Pointer
|
||||
void *directdata; // Armature Bones, Base, Sequence, Strip...
|
||||
PointerRNA rnaptr; // RNA Pointer
|
||||
} TreeElement;
|
||||
|
||||
/* TreeElement->flag */
|
||||
#define TE_ACTIVE 1
|
||||
#define TE_ICONROW 2
|
||||
#define TE_LAZY_CLOSED 4
|
||||
#define TE_FREE_NAME 8
|
||||
#define TE_ACTIVE 1
|
||||
#define TE_ICONROW 2
|
||||
#define TE_LAZY_CLOSED 4
|
||||
#define TE_FREE_NAME 8
|
||||
|
||||
/* TreeStoreElem types */
|
||||
#define TSE_NLA 1
|
||||
#define TSE_NLA_ACTION 2
|
||||
#define TSE_DEFGROUP_BASE 3
|
||||
#define TSE_DEFGROUP 4
|
||||
#define TSE_BONE 5
|
||||
#define TSE_EBONE 6
|
||||
#define TSE_CONSTRAINT_BASE 7
|
||||
#define TSE_CONSTRAINT 8
|
||||
#define TSE_MODIFIER_BASE 9
|
||||
#define TSE_MODIFIER 10
|
||||
#define TSE_LINKED_OB 11
|
||||
#define TSE_SCRIPT_BASE 12
|
||||
#define TSE_POSE_BASE 13
|
||||
#define TSE_POSE_CHANNEL 14
|
||||
#define TSE_ANIM_DATA 15
|
||||
#define TSE_DRIVER_BASE 16
|
||||
#define TSE_DRIVER 17
|
||||
#define TSE_NLA 1
|
||||
#define TSE_NLA_ACTION 2
|
||||
#define TSE_DEFGROUP_BASE 3
|
||||
#define TSE_DEFGROUP 4
|
||||
#define TSE_BONE 5
|
||||
#define TSE_EBONE 6
|
||||
#define TSE_CONSTRAINT_BASE 7
|
||||
#define TSE_CONSTRAINT 8
|
||||
#define TSE_MODIFIER_BASE 9
|
||||
#define TSE_MODIFIER 10
|
||||
#define TSE_LINKED_OB 11
|
||||
#define TSE_SCRIPT_BASE 12
|
||||
#define TSE_POSE_BASE 13
|
||||
#define TSE_POSE_CHANNEL 14
|
||||
#define TSE_ANIM_DATA 15
|
||||
#define TSE_DRIVER_BASE 16
|
||||
#define TSE_DRIVER 17
|
||||
|
||||
#define TSE_PROXY 18
|
||||
#define TSE_R_LAYER_BASE 19
|
||||
#define TSE_R_LAYER 20
|
||||
#define TSE_R_PASS 21
|
||||
#define TSE_LINKED_MAT 22
|
||||
#define TSE_PROXY 18
|
||||
#define TSE_R_LAYER_BASE 19
|
||||
#define TSE_R_LAYER 20
|
||||
#define TSE_R_PASS 21
|
||||
#define TSE_LINKED_MAT 22
|
||||
/* NOTE, is used for light group */
|
||||
#define TSE_LINKED_LAMP 23
|
||||
#define TSE_POSEGRP_BASE 24
|
||||
#define TSE_POSEGRP 25
|
||||
#define TSE_SEQUENCE 26
|
||||
#define TSE_SEQ_STRIP 27
|
||||
#define TSE_SEQUENCE_DUP 28
|
||||
#define TSE_LINKED_LAMP 23
|
||||
#define TSE_POSEGRP_BASE 24
|
||||
#define TSE_POSEGRP 25
|
||||
#define TSE_SEQUENCE 26
|
||||
#define TSE_SEQ_STRIP 27
|
||||
#define TSE_SEQUENCE_DUP 28
|
||||
#define TSE_LINKED_PSYS 29
|
||||
#define TSE_RNA_STRUCT 30
|
||||
#define TSE_RNA_PROPERTY 31
|
||||
#define TSE_RNA_ARRAY_ELEM 32
|
||||
#define TSE_NLA_TRACK 33
|
||||
#define TSE_KEYMAP 34
|
||||
#define TSE_KEYMAP_ITEM 35
|
||||
#define TSE_RNA_STRUCT 30
|
||||
#define TSE_RNA_PROPERTY 31
|
||||
#define TSE_RNA_ARRAY_ELEM 32
|
||||
#define TSE_NLA_TRACK 33
|
||||
#define TSE_KEYMAP 34
|
||||
#define TSE_KEYMAP_ITEM 35
|
||||
|
||||
/* button events */
|
||||
#define OL_NAMEBUTTON 1
|
||||
#define OL_NAMEBUTTON 1
|
||||
|
||||
/* get TreeStoreElem associated with a TreeElement
|
||||
* < a: (TreeElement) tree element to find stored element for
|
||||
*/
|
||||
#define TREESTORE(a) ((a)?soops->treestore->data+(a)->store_index:NULL)
|
||||
#define TREESTORE(a) ((a) ? soops->treestore->data + (a)->store_index : NULL)
|
||||
|
||||
/* size constants */
|
||||
#define OL_Y_OFFSET 2
|
||||
#define OL_Y_OFFSET 2
|
||||
|
||||
#define OL_TOG_RESTRICT_VIEWX (UI_UNIT_X*3)
|
||||
#define OL_TOG_RESTRICT_SELECTX (UI_UNIT_X*2)
|
||||
#define OL_TOG_RESTRICT_RENDERX UI_UNIT_X
|
||||
#define OL_TOG_RESTRICT_VIEWX (UI_UNIT_X * 3)
|
||||
#define OL_TOG_RESTRICT_SELECTX (UI_UNIT_X * 2)
|
||||
#define OL_TOG_RESTRICT_RENDERX UI_UNIT_X
|
||||
|
||||
#define OL_TOGW OL_TOG_RESTRICT_VIEWX
|
||||
|
||||
#define OL_RNA_COLX (UI_UNIT_X*15)
|
||||
#define OL_RNA_COL_SIZEX (UI_UNIT_X*7.5f)
|
||||
#define OL_RNA_COL_SPACEX (UI_UNIT_X*2.5f)
|
||||
#define OL_RNA_COLX (UI_UNIT_X * 15)
|
||||
#define OL_RNA_COL_SIZEX (UI_UNIT_X * 7.5f)
|
||||
#define OL_RNA_COL_SPACEX (UI_UNIT_X * 2.5f)
|
||||
|
||||
|
||||
/* Outliner Searching --
|
||||
@@ -145,7 +145,7 @@ typedef struct TreeElement {
|
||||
#define SEARCHING_OUTLINER(sov) (sov->search_flags & SO_SEARCH_RECURSIVE)
|
||||
|
||||
/* is the currrent element open? if so we also show children */
|
||||
#define TSELEM_OPEN(telm,sv) ( (telm->flag & TSE_CLOSED)==0 || (SEARCHING_OUTLINER(sv) && (telm->flag & TSE_CHILDSEARCH)) )
|
||||
#define TSELEM_OPEN(telm, sv) ( (telm->flag & TSE_CLOSED) == 0 || (SEARCHING_OUTLINER(sv) && (telm->flag & TSE_CHILDSEARCH)) )
|
||||
|
||||
/* outliner_tree.c ----------------------------------------------- */
|
||||
|
||||
@@ -170,7 +170,7 @@ int tree_element_active(struct bContext *C, struct Scene *scene, SpaceOops *soop
|
||||
/* outliner_edit.c ---------------------------------------------- */
|
||||
|
||||
void outliner_do_object_operation(struct bContext *C, struct Scene *scene, struct SpaceOops *soops, struct ListBase *lb,
|
||||
void (*operation_cb)(struct bContext *C, struct Scene *scene, struct TreeElement *, struct TreeStoreElem *, TreeStoreElem *));
|
||||
void (*operation_cb)(struct bContext *C, struct Scene *scene, struct TreeElement *, struct TreeStoreElem *, TreeStoreElem *));
|
||||
|
||||
int common_restrict_check(struct bContext *C, struct Object *ob);
|
||||
|
||||
|
||||
@@ -73,21 +73,21 @@ static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *se
|
||||
{
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
int change= 0;
|
||||
int change = 0;
|
||||
|
||||
for (te= lb->first; te && *index >= 0; te=te->next, (*index)--) {
|
||||
tselem= TREESTORE(te);
|
||||
for (te = lb->first; te && *index >= 0; te = te->next, (*index)--) {
|
||||
tselem = TREESTORE(te);
|
||||
|
||||
/* if we've encountered the right item, set its 'Outliner' selection status */
|
||||
if (*index == 0) {
|
||||
/* this should be the last one, so no need to do anything with index */
|
||||
if ((te->flag & TE_ICONROW)==0) {
|
||||
if ((te->flag & TE_ICONROW) == 0) {
|
||||
/* -1 value means toggle testing for now... */
|
||||
if (*selecting == -1) {
|
||||
if (tselem->flag & TSE_SELECTED)
|
||||
*selecting= 0;
|
||||
*selecting = 0;
|
||||
else
|
||||
*selecting= 1;
|
||||
*selecting = 1;
|
||||
}
|
||||
|
||||
/* set selection */
|
||||
@@ -103,9 +103,9 @@ static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *se
|
||||
/* Only try selecting sub-elements if we haven't hit the right element yet
|
||||
*
|
||||
* Hack warning:
|
||||
* Index must be reduced before supplying it to the sub-tree to try to do
|
||||
* selection, however, we need to increment it again for the next loop to
|
||||
* function correctly
|
||||
* Index must be reduced before supplying it to the sub-tree to try to do
|
||||
* selection, however, we need to increment it again for the next loop to
|
||||
* function correctly
|
||||
*/
|
||||
(*index)--;
|
||||
change |= outliner_select(soops, &te->subtree, index, selecting);
|
||||
@@ -124,45 +124,45 @@ static int tree_element_active_renderlayer(bContext *C, TreeElement *te, TreeSto
|
||||
Scene *sce;
|
||||
|
||||
/* paranoia check */
|
||||
if (te->idcode!=ID_SCE)
|
||||
if (te->idcode != ID_SCE)
|
||||
return 0;
|
||||
sce= (Scene *)tselem->id;
|
||||
sce = (Scene *)tselem->id;
|
||||
|
||||
if (set) {
|
||||
sce->r.actlay= tselem->nr;
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, sce);
|
||||
sce->r.actlay = tselem->nr;
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, sce);
|
||||
}
|
||||
else {
|
||||
return sce->r.actlay==tselem->nr;
|
||||
return sce->r.actlay == tselem->nr;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
|
||||
{
|
||||
TreeStoreElem *tselem= TREESTORE(te);
|
||||
TreeStoreElem *tselem = TREESTORE(te);
|
||||
Scene *sce;
|
||||
Base *base;
|
||||
Object *ob= NULL;
|
||||
Object *ob = NULL;
|
||||
|
||||
/* if id is not object, we search back */
|
||||
if (te->idcode==ID_OB) ob= (Object *)tselem->id;
|
||||
if (te->idcode == ID_OB) ob = (Object *)tselem->id;
|
||||
else {
|
||||
ob= (Object *)outliner_search_back(soops, te, ID_OB);
|
||||
if (ob==OBACT) return 0;
|
||||
ob = (Object *)outliner_search_back(soops, te, ID_OB);
|
||||
if (ob == OBACT) return 0;
|
||||
}
|
||||
if (ob==NULL) return 0;
|
||||
if (ob == NULL) return 0;
|
||||
|
||||
sce= (Scene *)outliner_search_back(soops, te, ID_SCE);
|
||||
sce = (Scene *)outliner_search_back(soops, te, ID_SCE);
|
||||
if (sce && scene != sce) {
|
||||
ED_screen_set_scene(C, CTX_wm_screen(C), sce);
|
||||
}
|
||||
|
||||
/* find associated base in current scene */
|
||||
base= BKE_scene_base_find(scene, ob);
|
||||
base = BKE_scene_base_find(scene, ob);
|
||||
|
||||
if (base) {
|
||||
if (set==2) {
|
||||
if (set == 2) {
|
||||
/* swap select */
|
||||
if (base->flag & SELECT)
|
||||
ED_base_object_select(base, BA_DESELECT);
|
||||
@@ -176,12 +176,12 @@ static int tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops
|
||||
}
|
||||
if (C) {
|
||||
ED_base_object_activate(C, base); /* adds notifier */
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
}
|
||||
}
|
||||
|
||||
if (ob!=scene->obedit)
|
||||
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
|
||||
if (ob != scene->obedit)
|
||||
ED_object_exit_editmode(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -192,35 +192,35 @@ static int tree_element_active_material(bContext *C, Scene *scene, SpaceOops *so
|
||||
Object *ob;
|
||||
|
||||
/* we search for the object parent */
|
||||
ob= (Object *)outliner_search_back(soops, te, ID_OB);
|
||||
ob = (Object *)outliner_search_back(soops, te, ID_OB);
|
||||
// note: ob->matbits can be NULL when a local object points to a library mesh.
|
||||
if (ob==NULL || ob!=OBACT || ob->matbits==NULL) return 0; // just paranoia
|
||||
if (ob == NULL || ob != OBACT || ob->matbits == NULL) return 0; // just paranoia
|
||||
|
||||
/* searching in ob mat array? */
|
||||
tes= te->parent;
|
||||
if (tes->idcode==ID_OB) {
|
||||
tes = te->parent;
|
||||
if (tes->idcode == ID_OB) {
|
||||
if (set) {
|
||||
ob->actcol= te->index+1;
|
||||
ob->matbits[te->index]= 1; // make ob material active too
|
||||
ob->actcol = te->index + 1;
|
||||
ob->matbits[te->index] = 1; // make ob material active too
|
||||
}
|
||||
else {
|
||||
if (ob->actcol == te->index+1)
|
||||
if (ob->actcol == te->index + 1)
|
||||
if (ob->matbits[te->index]) return 1;
|
||||
}
|
||||
}
|
||||
/* or we search for obdata material */
|
||||
else {
|
||||
if (set) {
|
||||
ob->actcol= te->index+1;
|
||||
ob->matbits[te->index]= 0; // make obdata material active too
|
||||
ob->actcol = te->index + 1;
|
||||
ob->matbits[te->index] = 0; // make obdata material active too
|
||||
}
|
||||
else {
|
||||
if (ob->actcol == te->index+1)
|
||||
if (ob->matbits[te->index]==0) return 1;
|
||||
if (ob->actcol == te->index + 1)
|
||||
if (ob->matbits[te->index] == 0) return 1;
|
||||
}
|
||||
}
|
||||
if (set) {
|
||||
WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, NULL);
|
||||
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, NULL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -229,10 +229,10 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
|
||||
{
|
||||
TreeElement *tep;
|
||||
TreeStoreElem /* *tselem,*/ *tselemp;
|
||||
Object *ob=OBACT;
|
||||
SpaceButs *sbuts=NULL;
|
||||
Object *ob = OBACT;
|
||||
SpaceButs *sbuts = NULL;
|
||||
|
||||
if (ob==NULL) return 0; // no active object
|
||||
if (ob == NULL) return 0; // no active object
|
||||
|
||||
/*tselem= TREESTORE(te);*/ /*UNUSED*/
|
||||
|
||||
@@ -240,11 +240,11 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
|
||||
/* XXX removed finding sbuts */
|
||||
|
||||
/* where is texture linked to? */
|
||||
tep= te->parent;
|
||||
tselemp= TREESTORE(tep);
|
||||
tep = te->parent;
|
||||
tselemp = TREESTORE(tep);
|
||||
|
||||
if (tep->idcode==ID_WO) {
|
||||
World *wrld= (World *)tselemp->id;
|
||||
if (tep->idcode == ID_WO) {
|
||||
World *wrld = (World *)tselemp->id;
|
||||
|
||||
if (set) {
|
||||
if (sbuts) {
|
||||
@@ -252,43 +252,43 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
|
||||
// XXX sbuts->texfrom= 1;
|
||||
}
|
||||
// XXX extern_set_butspace(F6KEY, 0); // force shading buttons texture
|
||||
wrld->texact= te->index;
|
||||
wrld->texact = te->index;
|
||||
}
|
||||
else if (tselemp->id == (ID *)(scene->world)) {
|
||||
if (wrld->texact==te->index) return 1;
|
||||
if (wrld->texact == te->index) return 1;
|
||||
}
|
||||
}
|
||||
else if (tep->idcode==ID_LA) {
|
||||
Lamp *la= (Lamp *)tselemp->id;
|
||||
else if (tep->idcode == ID_LA) {
|
||||
Lamp *la = (Lamp *)tselemp->id;
|
||||
if (set) {
|
||||
if (sbuts) {
|
||||
// XXX sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
|
||||
// XXX sbuts->texfrom= 2;
|
||||
}
|
||||
// XXX extern_set_butspace(F6KEY, 0); // force shading buttons texture
|
||||
la->texact= te->index;
|
||||
la->texact = te->index;
|
||||
}
|
||||
else {
|
||||
if (tselemp->id == ob->data) {
|
||||
if (la->texact==te->index) return 1;
|
||||
if (la->texact == te->index) return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tep->idcode==ID_MA) {
|
||||
Material *ma= (Material *)tselemp->id;
|
||||
else if (tep->idcode == ID_MA) {
|
||||
Material *ma = (Material *)tselemp->id;
|
||||
if (set) {
|
||||
if (sbuts) {
|
||||
//sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
|
||||
// XXX sbuts->texfrom= 0;
|
||||
}
|
||||
// XXX extern_set_butspace(F6KEY, 0); // force shading buttons texture
|
||||
ma->texact= (char)te->index;
|
||||
ma->texact = (char)te->index;
|
||||
|
||||
/* also set active material */
|
||||
ob->actcol= tep->index+1;
|
||||
ob->actcol = tep->index + 1;
|
||||
}
|
||||
else if (tep->flag & TE_ACTIVE) { // this is active material
|
||||
if (ma->texact==te->index) return 1;
|
||||
else if (tep->flag & TE_ACTIVE) { // this is active material
|
||||
if (ma->texact == te->index) return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,8 +304,8 @@ static int tree_element_active_lamp(bContext *UNUSED(C), Scene *scene, SpaceOops
|
||||
Object *ob;
|
||||
|
||||
/* we search for the object parent */
|
||||
ob= (Object *)outliner_search_back(soops, te, ID_OB);
|
||||
if (ob==NULL || ob!=OBACT) return 0; // just paranoia
|
||||
ob = (Object *)outliner_search_back(soops, te, ID_OB);
|
||||
if (ob == NULL || ob != OBACT) return 0; // just paranoia
|
||||
|
||||
if (set) {
|
||||
// XXX extern_set_butspace(F5KEY, 0);
|
||||
@@ -317,7 +317,7 @@ static int tree_element_active_lamp(bContext *UNUSED(C), Scene *scene, SpaceOops
|
||||
|
||||
static int tree_element_active_camera(bContext *UNUSED(C), Scene *scene, SpaceOops *soops, TreeElement *te, int set)
|
||||
{
|
||||
Object *ob= (Object *)outliner_search_back(soops, te, ID_OB);
|
||||
Object *ob = (Object *)outliner_search_back(soops, te, ID_OB);
|
||||
|
||||
if (set)
|
||||
return 0;
|
||||
@@ -328,22 +328,22 @@ static int tree_element_active_camera(bContext *UNUSED(C), Scene *scene, SpaceOo
|
||||
static int tree_element_active_world(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
|
||||
{
|
||||
TreeElement *tep;
|
||||
TreeStoreElem *tselem=NULL;
|
||||
Scene *sce=NULL;
|
||||
TreeStoreElem *tselem = NULL;
|
||||
Scene *sce = NULL;
|
||||
|
||||
tep= te->parent;
|
||||
tep = te->parent;
|
||||
if (tep) {
|
||||
tselem= TREESTORE(tep);
|
||||
sce= (Scene *)tselem->id;
|
||||
tselem = TREESTORE(tep);
|
||||
sce = (Scene *)tselem->id;
|
||||
}
|
||||
|
||||
if (set) { // make new scene active
|
||||
if (set) { // make new scene active
|
||||
if (sce && scene != sce) {
|
||||
ED_screen_set_scene(C, CTX_wm_screen(C), sce);
|
||||
}
|
||||
}
|
||||
|
||||
if (tep==NULL || tselem->id == (ID *)scene) {
|
||||
if (tep == NULL || tselem->id == (ID *)scene) {
|
||||
if (set) {
|
||||
// XXX extern_set_butspace(F8KEY, 0);
|
||||
}
|
||||
@@ -359,34 +359,34 @@ static int tree_element_active_defgroup(bContext *C, Scene *scene, TreeElement *
|
||||
Object *ob;
|
||||
|
||||
/* id in tselem is object */
|
||||
ob= (Object *)tselem->id;
|
||||
ob = (Object *)tselem->id;
|
||||
if (set) {
|
||||
BLI_assert(te->index+1 >= 0);
|
||||
ob->actdef= te->index+1;
|
||||
BLI_assert(te->index + 1 >= 0);
|
||||
ob->actdef = te->index + 1;
|
||||
|
||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, ob);
|
||||
}
|
||||
else {
|
||||
if (ob==OBACT)
|
||||
if (ob->actdef== te->index+1) return 1;
|
||||
if (ob == OBACT)
|
||||
if (ob->actdef == te->index + 1) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tree_element_active_posegroup(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
|
||||
{
|
||||
Object *ob= (Object *)tselem->id;
|
||||
Object *ob = (Object *)tselem->id;
|
||||
|
||||
if (set) {
|
||||
if (ob->pose) {
|
||||
ob->pose->active_group= te->index+1;
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
||||
ob->pose->active_group = te->index + 1;
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ob==OBACT && ob->pose) {
|
||||
if (ob->pose->active_group== te->index+1) return 1;
|
||||
if (ob == OBACT && ob->pose) {
|
||||
if (ob->pose->active_group == te->index + 1) return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -394,30 +394,30 @@ static int tree_element_active_posegroup(bContext *C, Scene *scene, TreeElement
|
||||
|
||||
static int tree_element_active_posechannel(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
|
||||
{
|
||||
Object *ob= (Object *)tselem->id;
|
||||
bArmature *arm= ob->data;
|
||||
bPoseChannel *pchan= te->directdata;
|
||||
Object *ob = (Object *)tselem->id;
|
||||
bArmature *arm = ob->data;
|
||||
bPoseChannel *pchan = te->directdata;
|
||||
|
||||
if (set) {
|
||||
if (!(pchan->bone->flag & BONE_HIDDEN_P)) {
|
||||
|
||||
if (set==2) ED_pose_deselectall(ob, 2); // 2 = clear active tag
|
||||
else ED_pose_deselectall(ob, 0); // 0 = deselect
|
||||
if (set == 2) ED_pose_deselectall(ob, 2); // 2 = clear active tag
|
||||
else ED_pose_deselectall(ob, 0); // 0 = deselect
|
||||
|
||||
if (set==2 && (pchan->bone->flag & BONE_SELECTED)) {
|
||||
if (set == 2 && (pchan->bone->flag & BONE_SELECTED)) {
|
||||
pchan->bone->flag &= ~BONE_SELECTED;
|
||||
}
|
||||
else {
|
||||
pchan->bone->flag |= BONE_SELECTED;
|
||||
arm->act_bone= pchan->bone;
|
||||
arm->act_bone = pchan->bone;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, ob);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, ob);
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ob==OBACT && ob->pose) {
|
||||
if (ob == OBACT && ob->pose) {
|
||||
if (pchan->bone->flag & BONE_SELECTED) return 1;
|
||||
}
|
||||
}
|
||||
@@ -426,29 +426,29 @@ static int tree_element_active_posechannel(bContext *C, Scene *scene, TreeElemen
|
||||
|
||||
static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
|
||||
{
|
||||
bArmature *arm= (bArmature *)tselem->id;
|
||||
Bone *bone= te->directdata;
|
||||
bArmature *arm = (bArmature *)tselem->id;
|
||||
Bone *bone = te->directdata;
|
||||
|
||||
if (set) {
|
||||
if (!(bone->flag & BONE_HIDDEN_P)) {
|
||||
if (set==2) ED_pose_deselectall(OBACT, 2); // 2 is clear active tag
|
||||
if (set == 2) ED_pose_deselectall(OBACT, 2); // 2 is clear active tag
|
||||
else ED_pose_deselectall(OBACT, 0);
|
||||
|
||||
if (set==2 && (bone->flag & BONE_SELECTED)) {
|
||||
if (set == 2 && (bone->flag & BONE_SELECTED)) {
|
||||
bone->flag &= ~BONE_SELECTED;
|
||||
}
|
||||
else {
|
||||
bone->flag |= BONE_SELECTED;
|
||||
arm->act_bone= bone;
|
||||
arm->act_bone = bone;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, OBACT);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, OBACT);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Object *ob= OBACT;
|
||||
Object *ob = OBACT;
|
||||
|
||||
if (ob && ob->data==arm) {
|
||||
if (ob && ob->data == arm) {
|
||||
if (bone->flag & BONE_SELECTED) return 1;
|
||||
}
|
||||
}
|
||||
@@ -460,32 +460,32 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te,
|
||||
static void tree_element_active_ebone__sel(bContext *C, Scene *scene, bArmature *arm, EditBone *ebone, short sel)
|
||||
{
|
||||
if (sel) {
|
||||
ebone->flag |= BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL;
|
||||
arm->act_edbone= ebone;
|
||||
ebone->flag |= BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL;
|
||||
arm->act_edbone = ebone;
|
||||
// flush to parent?
|
||||
if (ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag |= BONE_TIPSEL;
|
||||
}
|
||||
else {
|
||||
ebone->flag &= ~(BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL);
|
||||
ebone->flag &= ~(BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL);
|
||||
// flush to parent?
|
||||
if (ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag &= ~BONE_TIPSEL;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, scene->obedit);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, scene->obedit);
|
||||
}
|
||||
static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
|
||||
{
|
||||
bArmature *arm= scene->obedit->data;
|
||||
EditBone *ebone= te->directdata;
|
||||
bArmature *arm = scene->obedit->data;
|
||||
EditBone *ebone = te->directdata;
|
||||
|
||||
if (set==1) {
|
||||
if (set == 1) {
|
||||
if (!(ebone->flag & BONE_HIDDEN_A)) {
|
||||
ED_armature_deselect_all(scene->obedit, 0); // deselect
|
||||
ED_armature_deselect_all(scene->obedit, 0); // deselect
|
||||
tree_element_active_ebone__sel(C, scene, arm, ebone, TRUE);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (set==2) {
|
||||
else if (set == 2) {
|
||||
if (!(ebone->flag & BONE_HIDDEN_A)) {
|
||||
if (!(ebone->flag & BONE_SELECTED)) {
|
||||
tree_element_active_ebone__sel(C, scene, arm, ebone, TRUE);
|
||||
@@ -507,9 +507,9 @@ static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te,
|
||||
static int tree_element_active_modifier(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
|
||||
{
|
||||
if (set) {
|
||||
Object *ob= (Object *)tselem->id;
|
||||
Object *ob = (Object *)tselem->id;
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
|
||||
|
||||
// XXX extern_set_butspace(F9KEY, 0);
|
||||
}
|
||||
@@ -520,9 +520,9 @@ static int tree_element_active_modifier(bContext *C, TreeElement *UNUSED(te), Tr
|
||||
static int tree_element_active_psys(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
|
||||
{
|
||||
if (set) {
|
||||
Object *ob= (Object *)tselem->id;
|
||||
Object *ob = (Object *)tselem->id;
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_EDITED, ob);
|
||||
|
||||
// XXX extern_set_butspace(F7KEY, 0);
|
||||
}
|
||||
@@ -533,9 +533,9 @@ static int tree_element_active_psys(bContext *C, Scene *UNUSED(scene), TreeEleme
|
||||
static int tree_element_active_constraint(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
|
||||
{
|
||||
if (set) {
|
||||
Object *ob= (Object *)tselem->id;
|
||||
Object *ob = (Object *)tselem->id;
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
|
||||
// XXX extern_set_butspace(F7KEY, 0);
|
||||
}
|
||||
|
||||
@@ -550,12 +550,12 @@ static int tree_element_active_text(bContext *UNUSED(C), Scene *UNUSED(scene), S
|
||||
|
||||
static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
|
||||
{
|
||||
Object *ob= (Object *)tselem->id;
|
||||
Base *base= BKE_scene_base_find(scene, ob);
|
||||
Object *ob = (Object *)tselem->id;
|
||||
Base *base = BKE_scene_base_find(scene, ob);
|
||||
|
||||
if (set) {
|
||||
if (scene->obedit)
|
||||
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
|
||||
ED_object_exit_editmode(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
|
||||
|
||||
if (ob->mode & OB_MODE_POSE)
|
||||
ED_armature_exit_posemode(C, base);
|
||||
@@ -570,7 +570,7 @@ static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *UNUS
|
||||
|
||||
static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
|
||||
{
|
||||
Sequence *seq= (Sequence*) te->directdata;
|
||||
Sequence *seq = (Sequence *) te->directdata;
|
||||
|
||||
if (set) {
|
||||
// XXX select_single_seq(seq, 1);
|
||||
@@ -585,26 +585,26 @@ static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *UNUSED(t
|
||||
static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
|
||||
{
|
||||
Sequence *seq, *p;
|
||||
Editing *ed= seq_give_editing(scene, FALSE);
|
||||
Editing *ed = seq_give_editing(scene, FALSE);
|
||||
|
||||
seq= (Sequence*)te->directdata;
|
||||
if (set==0) {
|
||||
seq = (Sequence *)te->directdata;
|
||||
if (set == 0) {
|
||||
if (seq->flag & SELECT)
|
||||
return(1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
// XXX select_single_seq(seq, 1);
|
||||
p= ed->seqbasep->first;
|
||||
p = ed->seqbasep->first;
|
||||
while (p) {
|
||||
if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
|
||||
p= p->next;
|
||||
p = p->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
// if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
|
||||
// XXX select_single_seq(p, 0);
|
||||
p= p->next;
|
||||
p = p->next;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
@@ -613,7 +613,7 @@ static int tree_element_active_keymap_item(bContext *UNUSED(C), TreeElement *te,
|
||||
{
|
||||
wmKeyMapItem *kmi = te->directdata;
|
||||
|
||||
if (set==0) {
|
||||
if (set == 0) {
|
||||
if (kmi->flag & KMI_INACTIVE) return 0;
|
||||
return 1;
|
||||
}
|
||||
@@ -663,7 +663,7 @@ int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, TreeEl
|
||||
return tree_element_active_modifier(C, te, tselem, set);
|
||||
case TSE_LINKED_OB:
|
||||
if (set) tree_element_set_active_object(C, scene, soops, te, set);
|
||||
else if (tselem->id==(ID *)OBACT) return 1;
|
||||
else if (tselem->id == (ID *)OBACT) return 1;
|
||||
break;
|
||||
case TSE_LINKED_PSYS:
|
||||
return tree_element_active_psys(C, scene, te, tselem, set);
|
||||
@@ -693,14 +693,14 @@ int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, TreeEl
|
||||
static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int extend, const float mval[2])
|
||||
{
|
||||
|
||||
if (mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
|
||||
TreeStoreElem *tselem= TREESTORE(te);
|
||||
int openclose= 0;
|
||||
if (mval[1] > te->ys && mval[1] < te->ys + UI_UNIT_Y) {
|
||||
TreeStoreElem *tselem = TREESTORE(te);
|
||||
int openclose = 0;
|
||||
|
||||
/* open close icon */
|
||||
if ((te->flag & TE_ICONROW)==0) { // hidden icon, no open/close
|
||||
if ( mval[0]>te->xs && mval[0]<te->xs+UI_UNIT_X)
|
||||
openclose= 1;
|
||||
if ((te->flag & TE_ICONROW) == 0) { // hidden icon, no open/close
|
||||
if (mval[0] > te->xs && mval[0] < te->xs + UI_UNIT_X)
|
||||
openclose = 1;
|
||||
}
|
||||
|
||||
if (openclose) {
|
||||
@@ -718,62 +718,62 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa
|
||||
return 1;
|
||||
}
|
||||
/* name and first icon */
|
||||
else if (mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) {
|
||||
else if (mval[0] > te->xs + UI_UNIT_X && mval[0] < te->xend) {
|
||||
|
||||
/* always makes active object */
|
||||
if (tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP)
|
||||
tree_element_set_active_object(C, scene, soops, te, 1 + (extend!=0 && tselem->type==0));
|
||||
if (tselem->type != TSE_SEQUENCE && tselem->type != TSE_SEQ_STRIP && tselem->type != TSE_SEQUENCE_DUP)
|
||||
tree_element_set_active_object(C, scene, soops, te, 1 + (extend != 0 && tselem->type == 0));
|
||||
|
||||
if (tselem->type==0) { // the lib blocks
|
||||
if (tselem->type == 0) { // the lib blocks
|
||||
/* editmode? */
|
||||
if (te->idcode==ID_SCE) {
|
||||
if (scene!=(Scene *)tselem->id) {
|
||||
if (te->idcode == ID_SCE) {
|
||||
if (scene != (Scene *)tselem->id) {
|
||||
ED_screen_set_scene(C, CTX_wm_screen(C), (Scene *)tselem->id);
|
||||
}
|
||||
}
|
||||
else if (te->idcode==ID_GR) {
|
||||
Group *gr= (Group *)tselem->id;
|
||||
else if (te->idcode == ID_GR) {
|
||||
Group *gr = (Group *)tselem->id;
|
||||
GroupObject *gob;
|
||||
|
||||
if (extend) {
|
||||
int sel= BA_SELECT;
|
||||
for (gob= gr->gobject.first; gob; gob= gob->next) {
|
||||
int sel = BA_SELECT;
|
||||
for (gob = gr->gobject.first; gob; gob = gob->next) {
|
||||
if (gob->ob->flag & SELECT) {
|
||||
sel= BA_DESELECT;
|
||||
sel = BA_DESELECT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (gob= gr->gobject.first; gob; gob= gob->next) {
|
||||
for (gob = gr->gobject.first; gob; gob = gob->next) {
|
||||
ED_base_object_select(BKE_scene_base_find(scene, gob->ob), sel);
|
||||
}
|
||||
}
|
||||
else {
|
||||
BKE_scene_base_deselect_all(scene);
|
||||
|
||||
for (gob= gr->gobject.first; gob; gob= gob->next) {
|
||||
for (gob = gr->gobject.first; gob; gob = gob->next) {
|
||||
if ((gob->ob->flag & SELECT) == 0)
|
||||
ED_base_object_select(BKE_scene_base_find(scene, gob->ob), BA_SELECT);
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
}
|
||||
else if (ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) {
|
||||
WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_INVOKE_REGION_WIN, NULL);
|
||||
}
|
||||
else { // rest of types
|
||||
else { // rest of types
|
||||
tree_element_active(C, scene, soops, te, 1);
|
||||
}
|
||||
|
||||
}
|
||||
else tree_element_type_active(C, scene, soops, te, tselem, 1+(extend!=0));
|
||||
else tree_element_type_active(C, scene, soops, te, tselem, 1 + (extend != 0));
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (te= te->subtree.first; te; te= te->next) {
|
||||
for (te = te->subtree.first; te; te = te->next) {
|
||||
if (do_outliner_item_activate(C, scene, ar, soops, te, extend, mval)) return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -782,23 +782,23 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa
|
||||
/* event can enterkey, then it opens/closes */
|
||||
static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
TreeElement *te;
|
||||
float fmval[2];
|
||||
int extend= RNA_boolean_get(op->ptr, "extend");
|
||||
int extend = RNA_boolean_get(op->ptr, "extend");
|
||||
|
||||
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
|
||||
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval + 1);
|
||||
|
||||
if ( !ELEM3(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF, SO_KEYMAP) &&
|
||||
!(soops->flag & SO_HIDE_RESTRICTCOLS) &&
|
||||
(fmval[0] > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX))
|
||||
if (!ELEM3(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF, SO_KEYMAP) &&
|
||||
!(soops->flag & SO_HIDE_RESTRICTCOLS) &&
|
||||
(fmval[0] > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
for (te= soops->tree.first; te; te= te->next) {
|
||||
for (te = soops->tree.first; te; te = te->next) {
|
||||
if (do_outliner_item_activate(C, scene, ar, soops, te, extend, fmval)) break;
|
||||
}
|
||||
|
||||
@@ -806,12 +806,12 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
|
||||
ED_undo_push(C, "Outliner click event");
|
||||
}
|
||||
else {
|
||||
short selecting= -1;
|
||||
short selecting = -1;
|
||||
int row;
|
||||
|
||||
/* get row number - 100 here is just a dummy value since we don't need the column */
|
||||
UI_view2d_listview_view_to_cell(&ar->v2d, 1000, UI_UNIT_Y, 0.0f, OL_Y_OFFSET,
|
||||
fmval[0], fmval[1], NULL, &row);
|
||||
fmval[0], fmval[1], NULL, &row);
|
||||
|
||||
/* select relevant row */
|
||||
if (outliner_select(soops, &soops->tree, &row, &selecting)) {
|
||||
@@ -847,7 +847,7 @@ void OUTLINER_OT_item_activate(wmOperatorType *ot)
|
||||
/* **************** Border Select Tool ****************** */
|
||||
static void outliner_item_border_select(Scene *scene, SpaceOops *soops, rctf *rectf, TreeElement *te, int gesture_mode)
|
||||
{
|
||||
TreeStoreElem *tselem= TREESTORE(te);
|
||||
TreeStoreElem *tselem = TREESTORE(te);
|
||||
|
||||
if (te->ys <= rectf->ymax && te->ys + UI_UNIT_Y >= rectf->ymin) {
|
||||
if (gesture_mode == GESTURE_MODAL_SELECT) {
|
||||
@@ -869,13 +869,13 @@ static void outliner_item_border_select(Scene *scene, SpaceOops *soops, rctf *re
|
||||
|
||||
static int outliner_border_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
TreeElement *te;
|
||||
rcti rect;
|
||||
rctf rectf;
|
||||
int gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
|
||||
int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
|
||||
|
||||
rect.xmin = RNA_int_get(op->ptr, "xmin");
|
||||
rect.ymin = RNA_int_get(op->ptr, "ymin");
|
||||
@@ -885,11 +885,11 @@ static int outliner_border_select_exec(bContext *C, wmOperator *op)
|
||||
rect.ymax = RNA_int_get(op->ptr, "ymax");
|
||||
UI_view2d_region_to_view(&ar->v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
|
||||
|
||||
for (te= soops->tree.first; te; te= te->next) {
|
||||
for (te = soops->tree.first; te; te = te->next) {
|
||||
outliner_item_border_select(scene, soops, &rectf, te, gesture_mode);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
ED_region_tag_redraw(ar);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -911,7 +911,7 @@ void OUTLINER_OT_select_border(wmOperatorType *ot)
|
||||
ot->poll = ED_operator_outliner_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_border(ot, FALSE);
|
||||
|
||||
@@ -77,31 +77,31 @@
|
||||
/* ************ SELECTION OPERATIONS ********* */
|
||||
|
||||
static void set_operation_types(SpaceOops *soops, ListBase *lb,
|
||||
int *scenelevel,
|
||||
int *objectlevel,
|
||||
int *idlevel,
|
||||
int *datalevel)
|
||||
int *scenelevel,
|
||||
int *objectlevel,
|
||||
int *idlevel,
|
||||
int *datalevel)
|
||||
{
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
if (tselem->flag & TSE_SELECTED) {
|
||||
if (tselem->type) {
|
||||
if (*datalevel==0)
|
||||
*datalevel= tselem->type;
|
||||
else if (*datalevel!=tselem->type)
|
||||
*datalevel= -1;
|
||||
if (*datalevel == 0)
|
||||
*datalevel = tselem->type;
|
||||
else if (*datalevel != tselem->type)
|
||||
*datalevel = -1;
|
||||
}
|
||||
else {
|
||||
int idcode= GS(tselem->id->name);
|
||||
int idcode = GS(tselem->id->name);
|
||||
switch (idcode) {
|
||||
case ID_SCE:
|
||||
*scenelevel= 1;
|
||||
*scenelevel = 1;
|
||||
break;
|
||||
case ID_OB:
|
||||
*objectlevel= 1;
|
||||
*objectlevel = 1;
|
||||
break;
|
||||
|
||||
case ID_ME: case ID_CU: case ID_MB: case ID_LT:
|
||||
@@ -109,9 +109,9 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb,
|
||||
case ID_MA: case ID_TE: case ID_IP: case ID_IM:
|
||||
case ID_SO: case ID_KE: case ID_WO: case ID_AC:
|
||||
case ID_NLA: case ID_TXT: case ID_GR:
|
||||
if (*idlevel==0) *idlevel= idcode;
|
||||
else if (*idlevel!=idcode) *idlevel= -1;
|
||||
break;
|
||||
if (*idlevel == 0) *idlevel = idcode;
|
||||
else if (*idlevel != idcode) *idlevel = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,62 +130,62 @@ static void unlink_action_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNU
|
||||
|
||||
static void unlink_material_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem))
|
||||
{
|
||||
Material **matar=NULL;
|
||||
int a, totcol=0;
|
||||
Material **matar = NULL;
|
||||
int a, totcol = 0;
|
||||
|
||||
if ( GS(tsep->id->name)==ID_OB) {
|
||||
Object *ob= (Object *)tsep->id;
|
||||
totcol= ob->totcol;
|
||||
matar= ob->mat;
|
||||
if (GS(tsep->id->name) == ID_OB) {
|
||||
Object *ob = (Object *)tsep->id;
|
||||
totcol = ob->totcol;
|
||||
matar = ob->mat;
|
||||
}
|
||||
else if ( GS(tsep->id->name)==ID_ME) {
|
||||
Mesh *me= (Mesh *)tsep->id;
|
||||
totcol= me->totcol;
|
||||
matar= me->mat;
|
||||
else if (GS(tsep->id->name) == ID_ME) {
|
||||
Mesh *me = (Mesh *)tsep->id;
|
||||
totcol = me->totcol;
|
||||
matar = me->mat;
|
||||
}
|
||||
else if ( GS(tsep->id->name)==ID_CU) {
|
||||
Curve *cu= (Curve *)tsep->id;
|
||||
totcol= cu->totcol;
|
||||
matar= cu->mat;
|
||||
else if (GS(tsep->id->name) == ID_CU) {
|
||||
Curve *cu = (Curve *)tsep->id;
|
||||
totcol = cu->totcol;
|
||||
matar = cu->mat;
|
||||
}
|
||||
else if ( GS(tsep->id->name)==ID_MB) {
|
||||
MetaBall *mb= (MetaBall *)tsep->id;
|
||||
totcol= mb->totcol;
|
||||
matar= mb->mat;
|
||||
else if (GS(tsep->id->name) == ID_MB) {
|
||||
MetaBall *mb = (MetaBall *)tsep->id;
|
||||
totcol = mb->totcol;
|
||||
matar = mb->mat;
|
||||
}
|
||||
|
||||
for (a=0; a<totcol; a++) {
|
||||
if (a==te->index && matar[a]) {
|
||||
for (a = 0; a < totcol; a++) {
|
||||
if (a == te->index && matar[a]) {
|
||||
matar[a]->id.us--;
|
||||
matar[a]= NULL;
|
||||
matar[a] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem))
|
||||
{
|
||||
MTex **mtex= NULL;
|
||||
MTex **mtex = NULL;
|
||||
int a;
|
||||
|
||||
if ( GS(tsep->id->name)==ID_MA) {
|
||||
Material *ma= (Material *)tsep->id;
|
||||
mtex= ma->mtex;
|
||||
if (GS(tsep->id->name) == ID_MA) {
|
||||
Material *ma = (Material *)tsep->id;
|
||||
mtex = ma->mtex;
|
||||
}
|
||||
else if ( GS(tsep->id->name)==ID_LA) {
|
||||
Lamp *la= (Lamp *)tsep->id;
|
||||
mtex= la->mtex;
|
||||
else if (GS(tsep->id->name) == ID_LA) {
|
||||
Lamp *la = (Lamp *)tsep->id;
|
||||
mtex = la->mtex;
|
||||
}
|
||||
else if ( GS(tsep->id->name)==ID_WO) {
|
||||
World *wrld= (World *)tsep->id;
|
||||
mtex= wrld->mtex;
|
||||
else if (GS(tsep->id->name) == ID_WO) {
|
||||
World *wrld = (World *)tsep->id;
|
||||
mtex = wrld->mtex;
|
||||
}
|
||||
else return;
|
||||
|
||||
for (a=0; a<MAX_MTEX; a++) {
|
||||
if (a==te->index && mtex[a]) {
|
||||
for (a = 0; a < MAX_MTEX; a++) {
|
||||
if (a == te->index && mtex[a]) {
|
||||
if (mtex[a]->tex) {
|
||||
mtex[a]->tex->id.us--;
|
||||
mtex[a]->tex= NULL;
|
||||
mtex[a]->tex = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,12 +193,12 @@ static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEle
|
||||
|
||||
static void unlink_group_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tsep, TreeStoreElem *tselem)
|
||||
{
|
||||
Group *group= (Group *)tselem->id;
|
||||
Group *group = (Group *)tselem->id;
|
||||
|
||||
if (tsep) {
|
||||
if ( GS(tsep->id->name)==ID_OB) {
|
||||
Object *ob= (Object *)tsep->id;
|
||||
ob->dup_group= NULL;
|
||||
if (GS(tsep->id->name) == ID_OB) {
|
||||
Object *ob = (Object *)tsep->id;
|
||||
ob->dup_group = NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -217,16 +217,16 @@ static void unlink_world_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEleme
|
||||
}
|
||||
|
||||
static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops *soops, ListBase *lb,
|
||||
void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *))
|
||||
void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *))
|
||||
{
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
|
||||
for (te=lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
if (tselem->flag & TSE_SELECTED) {
|
||||
if (tselem->type==0) {
|
||||
TreeStoreElem *tsep= TREESTORE(te->parent);
|
||||
if (tselem->type == 0) {
|
||||
TreeStoreElem *tsep = TREESTORE(te->parent);
|
||||
operation_cb(C, scene, te, tsep, tselem);
|
||||
}
|
||||
}
|
||||
@@ -240,10 +240,10 @@ static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops *
|
||||
|
||||
static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
|
||||
{
|
||||
Base *base= (Base *)te->directdata;
|
||||
Base *base = (Base *)te->directdata;
|
||||
|
||||
if (base==NULL) base= BKE_scene_base_find(scene, (Object *)tselem->id);
|
||||
if (base && ((base->object->restrictflag & OB_RESTRICT_VIEW)==0)) {
|
||||
if (base == NULL) base = BKE_scene_base_find(scene, (Object *)tselem->id);
|
||||
if (base && ((base->object->restrictflag & OB_RESTRICT_VIEW) == 0)) {
|
||||
base->flag |= SELECT;
|
||||
base->object->flag |= SELECT;
|
||||
}
|
||||
@@ -251,9 +251,9 @@ static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te,
|
||||
|
||||
static void object_deselect_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
|
||||
{
|
||||
Base *base= (Base *)te->directdata;
|
||||
Base *base = (Base *)te->directdata;
|
||||
|
||||
if (base==NULL) base= BKE_scene_base_find(scene, (Object *)tselem->id);
|
||||
if (base == NULL) base = BKE_scene_base_find(scene, (Object *)tselem->id);
|
||||
if (base) {
|
||||
base->flag &= ~SELECT;
|
||||
base->object->flag &= ~SELECT;
|
||||
@@ -262,18 +262,18 @@ static void object_deselect_cb(bContext *UNUSED(C), Scene *scene, TreeElement *t
|
||||
|
||||
static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
|
||||
{
|
||||
Base *base= (Base *)te->directdata;
|
||||
Base *base = (Base *)te->directdata;
|
||||
|
||||
if (base==NULL)
|
||||
base= BKE_scene_base_find(scene, (Object *)tselem->id);
|
||||
if (base == NULL)
|
||||
base = BKE_scene_base_find(scene, (Object *)tselem->id);
|
||||
if (base) {
|
||||
// check also library later
|
||||
if (scene->obedit==base->object)
|
||||
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
|
||||
if (scene->obedit == base->object)
|
||||
ED_object_exit_editmode(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
|
||||
|
||||
ED_base_object_free_and_unlink(CTX_data_main(C), scene, base);
|
||||
te->directdata= NULL;
|
||||
tselem->id= NULL;
|
||||
te->directdata = NULL;
|
||||
tselem->id = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ static void id_local_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(t
|
||||
/* if the ID type has no special local function,
|
||||
* just clear the lib */
|
||||
if (id_make_local(tselem->id, FALSE) == FALSE) {
|
||||
Main *bmain= CTX_data_main(C);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
id_clear_lib_data(bmain, tselem->id);
|
||||
}
|
||||
}
|
||||
@@ -344,41 +344,41 @@ static void singleuser_world_cb(bContext *C, Scene *UNUSED(scene), TreeElement *
|
||||
|
||||
static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
|
||||
{
|
||||
Group *group= (Group *)tselem->id;
|
||||
Group *group = (Group *)tselem->id;
|
||||
GroupObject *gob;
|
||||
Base *base;
|
||||
|
||||
for (gob=group->gobject.first; gob; gob=gob->next) {
|
||||
base= BKE_scene_base_find(scene, gob->ob);
|
||||
for (gob = group->gobject.first; gob; gob = gob->next) {
|
||||
base = BKE_scene_base_find(scene, gob->ob);
|
||||
if (base) {
|
||||
base->object->flag |= SELECT;
|
||||
base->flag |= SELECT;
|
||||
}
|
||||
else {
|
||||
/* link to scene */
|
||||
base= MEM_callocN(sizeof(Base), "add_base");
|
||||
base = MEM_callocN(sizeof(Base), "add_base");
|
||||
BLI_addhead(&scene->base, base);
|
||||
base->lay= (1<<20)-1; /*v3d->lay;*/ /* would be nice to use the 3d layer but the include's not here */
|
||||
base->lay = (1 << 20) - 1; /*v3d->lay;*/ /* would be nice to use the 3d layer but the include's not here */
|
||||
gob->ob->flag |= SELECT;
|
||||
base->flag = gob->ob->flag;
|
||||
base->object= gob->ob;
|
||||
base->object = gob->ob;
|
||||
id_lib_extern((ID *)gob->ob); /* in case these are from a linked group */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soops, ListBase *lb,
|
||||
void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *))
|
||||
void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *))
|
||||
{
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
|
||||
for (te=lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
if (tselem->flag & TSE_SELECTED) {
|
||||
if (tselem->type==0 && te->idcode==ID_OB) {
|
||||
if (tselem->type == 0 && te->idcode == ID_OB) {
|
||||
// when objects selected in other scenes... dunno if that should be allowed
|
||||
Scene *scene_owner= (Scene *)outliner_search_back(soops, te, ID_SCE);
|
||||
Scene *scene_owner = (Scene *)outliner_search_back(soops, te, ID_SCE);
|
||||
if (scene_owner && scene_act != scene_owner) {
|
||||
ED_screen_set_scene(C, CTX_wm_screen(C), scene_owner);
|
||||
}
|
||||
@@ -416,7 +416,7 @@ static void refreshdrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te
|
||||
FCurve *fcu;
|
||||
|
||||
/* loop over drivers, performing refresh (i.e. check graph_buttons.c and rna_fcurve.c for details) */
|
||||
for (fcu = iat->adt->drivers.first; fcu; fcu= fcu->next) {
|
||||
for (fcu = iat->adt->drivers.first; fcu; fcu = fcu->next) {
|
||||
fcu->flag &= ~FCURVE_DISABLED;
|
||||
|
||||
if (fcu->driver)
|
||||
@@ -428,70 +428,70 @@ static void refreshdrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te
|
||||
|
||||
static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
|
||||
{
|
||||
bPoseChannel *pchan= (bPoseChannel *)te->directdata;
|
||||
bPoseChannel *pchan = (bPoseChannel *)te->directdata;
|
||||
|
||||
if (event==1)
|
||||
if (event == 1)
|
||||
pchan->bone->flag |= BONE_SELECTED;
|
||||
else if (event==2)
|
||||
else if (event == 2)
|
||||
pchan->bone->flag &= ~BONE_SELECTED;
|
||||
else if (event==3) {
|
||||
else if (event == 3) {
|
||||
pchan->bone->flag |= BONE_HIDDEN_P;
|
||||
pchan->bone->flag &= ~BONE_SELECTED;
|
||||
}
|
||||
else if (event==4)
|
||||
else if (event == 4)
|
||||
pchan->bone->flag &= ~BONE_HIDDEN_P;
|
||||
}
|
||||
|
||||
static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
|
||||
{
|
||||
Bone *bone= (Bone *)te->directdata;
|
||||
Bone *bone = (Bone *)te->directdata;
|
||||
|
||||
if (event==1)
|
||||
if (event == 1)
|
||||
bone->flag |= BONE_SELECTED;
|
||||
else if (event==2)
|
||||
else if (event == 2)
|
||||
bone->flag &= ~BONE_SELECTED;
|
||||
else if (event==3) {
|
||||
else if (event == 3) {
|
||||
bone->flag |= BONE_HIDDEN_P;
|
||||
bone->flag &= ~BONE_SELECTED;
|
||||
}
|
||||
else if (event==4)
|
||||
else if (event == 4)
|
||||
bone->flag &= ~BONE_HIDDEN_P;
|
||||
}
|
||||
|
||||
static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
|
||||
{
|
||||
EditBone *ebone= (EditBone *)te->directdata;
|
||||
EditBone *ebone = (EditBone *)te->directdata;
|
||||
|
||||
if (event==1)
|
||||
if (event == 1)
|
||||
ebone->flag |= BONE_SELECTED;
|
||||
else if (event==2)
|
||||
else if (event == 2)
|
||||
ebone->flag &= ~BONE_SELECTED;
|
||||
else if (event==3) {
|
||||
else if (event == 3) {
|
||||
ebone->flag |= BONE_HIDDEN_A;
|
||||
ebone->flag &= ~BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
|
||||
ebone->flag &= ~BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL;
|
||||
}
|
||||
else if (event==4)
|
||||
else if (event == 4)
|
||||
ebone->flag &= ~BONE_HIDDEN_A;
|
||||
}
|
||||
|
||||
static void sequence_cb(int event, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tselem))
|
||||
{
|
||||
// Sequence *seq= (Sequence*) te->directdata;
|
||||
if (event==1) {
|
||||
if (event == 1) {
|
||||
// XXX select_single_seq(seq, 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void outliner_do_data_operation(SpaceOops *soops, int type, int event, ListBase *lb,
|
||||
void (*operation_cb)(int, TreeElement *, TreeStoreElem *))
|
||||
void (*operation_cb)(int, TreeElement *, TreeStoreElem *))
|
||||
{
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
|
||||
for (te=lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
if (tselem->flag & TSE_SELECTED) {
|
||||
if (tselem->type==type) {
|
||||
if (tselem->type == type) {
|
||||
operation_cb(event, te, tselem);
|
||||
}
|
||||
}
|
||||
@@ -516,34 +516,34 @@ static EnumPropertyItem prop_object_op_types[] = {
|
||||
|
||||
static int outliner_object_operation_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain= CTX_data_main(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
int event;
|
||||
const char *str= NULL;
|
||||
const char *str = NULL;
|
||||
|
||||
/* check for invalid states */
|
||||
if (soops == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
event= RNA_enum_get(op->ptr, "type");
|
||||
event = RNA_enum_get(op->ptr, "type");
|
||||
|
||||
if (event==1) {
|
||||
Scene *sce= scene; // to be able to delete, scenes are set...
|
||||
if (event == 1) {
|
||||
Scene *sce = scene; // to be able to delete, scenes are set...
|
||||
outliner_do_object_operation(C, scene, soops, &soops->tree, object_select_cb);
|
||||
if (scene != sce) {
|
||||
ED_screen_set_scene(C, CTX_wm_screen(C), sce);
|
||||
}
|
||||
|
||||
str= "Select Objects";
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
||||
str = "Select Objects";
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
}
|
||||
else if (event==2) {
|
||||
else if (event == 2) {
|
||||
outliner_do_object_operation(C, scene, soops, &soops->tree, object_deselect_cb);
|
||||
str= "Deselect Objects";
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
||||
str = "Deselect Objects";
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
}
|
||||
else if (event==4) {
|
||||
else if (event == 4) {
|
||||
outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb);
|
||||
|
||||
/* XXX: tree management normally happens from draw_outliner(), but when
|
||||
@@ -554,31 +554,31 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
|
||||
outliner_cleanup_tree(soops);
|
||||
|
||||
DAG_scene_sort(bmain, scene);
|
||||
str= "Delete Objects";
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
|
||||
str = "Delete Objects";
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
|
||||
}
|
||||
else if (event==5) { /* disabled, see above enum (ton) */
|
||||
else if (event == 5) { /* disabled, see above enum (ton) */
|
||||
outliner_do_object_operation(C, scene, soops, &soops->tree, id_local_cb);
|
||||
str= "Localized Objects";
|
||||
str = "Localized Objects";
|
||||
}
|
||||
else if (event==6) {
|
||||
else if (event == 6) {
|
||||
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_visibility_cb);
|
||||
str= "Toggle Visibility";
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_VISIBLE, scene);
|
||||
str = "Toggle Visibility";
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_VISIBLE, scene);
|
||||
}
|
||||
else if (event==7) {
|
||||
else if (event == 7) {
|
||||
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_selectability_cb);
|
||||
str= "Toggle Selectability";
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
||||
str = "Toggle Selectability";
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||
}
|
||||
else if (event==8) {
|
||||
else if (event == 8) {
|
||||
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_renderability_cb);
|
||||
str= "Toggle Renderability";
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, scene);
|
||||
str = "Toggle Renderability";
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_RENDER, scene);
|
||||
}
|
||||
else if (event==9) {
|
||||
else if (event == 9) {
|
||||
outliner_do_object_operation(C, scene, soops, &soops->tree, item_rename_cb);
|
||||
str= "Rename Object";
|
||||
str = "Rename Object";
|
||||
}
|
||||
|
||||
ED_undo_push(C, str);
|
||||
@@ -619,44 +619,44 @@ static EnumPropertyItem prop_group_op_types[] = {
|
||||
|
||||
static int outliner_group_operation_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
int event;
|
||||
const char *str= NULL;
|
||||
const char *str = NULL;
|
||||
|
||||
/* check for invalid states */
|
||||
if (soops == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
event= RNA_enum_get(op->ptr, "type");
|
||||
event = RNA_enum_get(op->ptr, "type");
|
||||
|
||||
if (event==1) {
|
||||
if (event == 1) {
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_group_cb);
|
||||
str= "Unlink group";
|
||||
str = "Unlink group";
|
||||
}
|
||||
else if (event==2) {
|
||||
else if (event == 2) {
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb);
|
||||
str= "Localized Data";
|
||||
str = "Localized Data";
|
||||
}
|
||||
else if (event==3) {
|
||||
else if (event == 3) {
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_linkobs2scene_cb);
|
||||
str= "Link Group Objects to Scene";
|
||||
str = "Link Group Objects to Scene";
|
||||
}
|
||||
else if (event==4) {
|
||||
else if (event == 4) {
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_visibility_cb);
|
||||
str= "Toggle Visibility";
|
||||
str = "Toggle Visibility";
|
||||
}
|
||||
else if (event==5) {
|
||||
else if (event == 5) {
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_selectability_cb);
|
||||
str= "Toggle Selectability";
|
||||
str = "Toggle Selectability";
|
||||
}
|
||||
else if (event==6) {
|
||||
else if (event == 6) {
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_renderability_cb);
|
||||
str= "Toggle Renderability";
|
||||
str = "Toggle Renderability";
|
||||
}
|
||||
else if (event==7) {
|
||||
else if (event == 7) {
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb);
|
||||
str= "Rename";
|
||||
str = "Rename";
|
||||
}
|
||||
|
||||
|
||||
@@ -711,9 +711,9 @@ static EnumPropertyItem prop_id_op_types[] = {
|
||||
|
||||
static int outliner_id_operation_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0;
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
|
||||
eOutlinerIdOpTypes event;
|
||||
|
||||
/* check for invalid states */
|
||||
@@ -722,7 +722,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
|
||||
|
||||
set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
|
||||
|
||||
event= RNA_enum_get(op->ptr, "type");
|
||||
event = RNA_enum_get(op->ptr, "type");
|
||||
|
||||
switch (event) {
|
||||
case OUTLINER_IDOP_UNLINK:
|
||||
@@ -732,25 +732,25 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
|
||||
case ID_AC:
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_action_cb);
|
||||
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_NLA_ACTCHANGE, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
|
||||
ED_undo_push(C, "Unlink action");
|
||||
break;
|
||||
case ID_MA:
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_material_cb);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, NULL);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, NULL);
|
||||
ED_undo_push(C, "Unlink material");
|
||||
break;
|
||||
case ID_TE:
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_texture_cb);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, NULL);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, NULL);
|
||||
ED_undo_push(C, "Unlink texture");
|
||||
break;
|
||||
case ID_WO:
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_world_cb);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_WORLD, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_WORLD, NULL);
|
||||
ED_undo_push(C, "Unlink world");
|
||||
break;
|
||||
default:
|
||||
@@ -758,7 +758,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case OUTLINER_IDOP_LOCAL:
|
||||
{
|
||||
@@ -766,7 +766,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb);
|
||||
ED_undo_push(C, "Localized Data");
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case OUTLINER_IDOP_SINGLE:
|
||||
{
|
||||
@@ -775,14 +775,14 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
|
||||
case ID_AC:
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, singleuser_action_cb);
|
||||
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_NLA_ACTCHANGE, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
|
||||
ED_undo_push(C, "Single-User Action");
|
||||
break;
|
||||
|
||||
case ID_WO:
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, singleuser_world_cb);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_WORLD, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_WORLD, NULL);
|
||||
ED_undo_push(C, "Single-User World");
|
||||
break;
|
||||
|
||||
@@ -791,36 +791,36 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case OUTLINER_IDOP_FAKE_ADD:
|
||||
{
|
||||
/* set fake user */
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_fake_user_set_cb);
|
||||
|
||||
WM_event_add_notifier(C, NC_ID|NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
|
||||
ED_undo_push(C, "Add Fake User");
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case OUTLINER_IDOP_FAKE_CLEAR:
|
||||
{
|
||||
/* clear fake user */
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_fake_user_clear_cb);
|
||||
|
||||
WM_event_add_notifier(C, NC_ID|NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
|
||||
ED_undo_push(C, "Clear Fake User");
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case OUTLINER_IDOP_RENAME:
|
||||
{
|
||||
/* rename */
|
||||
outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb);
|
||||
|
||||
WM_event_add_notifier(C, NC_ID|NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
|
||||
ED_undo_push(C, "Rename");
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
// invalid - unhandled
|
||||
@@ -828,10 +828,10 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
/* wrong notifier still... */
|
||||
WM_event_add_notifier(C, NC_ID|NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
|
||||
|
||||
// XXX: this is just so that outliner is always up to date
|
||||
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_OUTLINER, NULL);
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
@@ -857,15 +857,15 @@ void OUTLINER_OT_id_operation(wmOperatorType *ot)
|
||||
/* **************************************** */
|
||||
|
||||
static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *lb, ID *newid,
|
||||
void (*operation_cb)(TreeElement *, TreeStoreElem *, TreeStoreElem *, ID *))
|
||||
void (*operation_cb)(TreeElement *, TreeStoreElem *, TreeStoreElem *, ID *))
|
||||
{
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
|
||||
for (te=lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
if (tselem->flag & TSE_SELECTED) {
|
||||
if (tselem->type==type) {
|
||||
if (tselem->type == type) {
|
||||
TreeStoreElem *tsep = TREESTORE(te->parent);
|
||||
operation_cb(te, tselem, tsep, newid);
|
||||
}
|
||||
@@ -898,8 +898,8 @@ static void actionset_id_cb(TreeElement *UNUSED(te), TreeStoreElem *tselem, Tree
|
||||
|
||||
static int outliner_action_set_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0;
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
|
||||
|
||||
bAction *act;
|
||||
|
||||
@@ -909,7 +909,7 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op)
|
||||
set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
|
||||
|
||||
/* get action to use */
|
||||
act= BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "action"));
|
||||
act = BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "action"));
|
||||
|
||||
if (act == NULL) {
|
||||
BKE_report(op->reports, RPT_ERROR, "No valid Action to add");
|
||||
@@ -918,20 +918,20 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op)
|
||||
else if (act->idroot == 0) {
|
||||
/* hopefully in this case (i.e. library of userless actions), the user knows what they're doing... */
|
||||
BKE_reportf(op->reports, RPT_WARNING,
|
||||
"Action '%s' does not specify what datablocks it can be used on. Try setting the 'ID Root Type' setting from the Datablocks Editor for this Action to avoid future problems",
|
||||
act->id.name+2);
|
||||
"Action '%s' does not specify what datablocks it can be used on. Try setting the 'ID Root Type' setting from the Datablocks Editor for this Action to avoid future problems",
|
||||
act->id.name + 2);
|
||||
}
|
||||
|
||||
/* perform action if valid channel */
|
||||
if (datalevel == TSE_ANIM_DATA)
|
||||
outliner_do_id_set_operation(soops, datalevel, &soops->tree, (ID*)act, actionset_id_cb);
|
||||
outliner_do_id_set_operation(soops, datalevel, &soops->tree, (ID *)act, actionset_id_cb);
|
||||
else if (idlevel == ID_AC)
|
||||
outliner_do_id_set_operation(soops, idlevel, &soops->tree, (ID*)act, actionset_id_cb);
|
||||
outliner_do_id_set_operation(soops, idlevel, &soops->tree, (ID *)act, actionset_id_cb);
|
||||
else
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
/* set notifier that things have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_NLA_ACTCHANGE, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
|
||||
ED_undo_push(C, "Set action");
|
||||
|
||||
/* done */
|
||||
@@ -956,8 +956,8 @@ void OUTLINER_OT_action_set(wmOperatorType *ot)
|
||||
ot->flag = 0;
|
||||
|
||||
/* props */
|
||||
// TODO: this would be nicer as an ID-pointer...
|
||||
prop= RNA_def_enum(ot->srna, "action", DummyRNA_NULL_items, 0, "Action", "");
|
||||
// TODO: this would be nicer as an ID-pointer...
|
||||
prop = RNA_def_enum(ot->srna, "action", DummyRNA_NULL_items, 0, "Action", "");
|
||||
RNA_def_enum_funcs(prop, RNA_action_itemf);
|
||||
ot->prop = prop;
|
||||
}
|
||||
@@ -989,8 +989,8 @@ static EnumPropertyItem prop_animdata_op_types[] = {
|
||||
|
||||
static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0;
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
|
||||
eOutliner_AnimDataOps event;
|
||||
short updateDeps = 0;
|
||||
|
||||
@@ -998,7 +998,7 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
|
||||
if (soops == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
event= RNA_enum_get(op->ptr, "type");
|
||||
event = RNA_enum_get(op->ptr, "type");
|
||||
set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
|
||||
|
||||
if (datalevel != TSE_ANIM_DATA)
|
||||
@@ -1015,14 +1015,14 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
|
||||
/* clear active action - using standard rules */
|
||||
outliner_do_data_operation(soops, datalevel, event, &soops->tree, unlinkact_animdata_cb);
|
||||
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_NLA_ACTCHANGE, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
|
||||
ED_undo_push(C, "Unlink action");
|
||||
break;
|
||||
|
||||
case OUTLINER_ANIMOP_REFRESH_DRV:
|
||||
outliner_do_data_operation(soops, datalevel, event, &soops->tree, refreshdrivers_animdata_cb);
|
||||
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL);
|
||||
//ED_undo_push(C, "Refresh Drivers"); /* no undo needed - shouldn't have any impact? */
|
||||
updateDeps = 1;
|
||||
break;
|
||||
@@ -1030,7 +1030,7 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
|
||||
case OUTLINER_ANIMOP_CLEAR_DRV:
|
||||
outliner_do_data_operation(soops, datalevel, event, &soops->tree, cleardrivers_animdata_cb);
|
||||
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL);
|
||||
ED_undo_push(C, "Clear Drivers");
|
||||
updateDeps = 1;
|
||||
break;
|
||||
@@ -1084,40 +1084,40 @@ static EnumPropertyItem prop_data_op_types[] = {
|
||||
|
||||
static int outliner_data_operation_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0;
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
|
||||
int event;
|
||||
|
||||
/* check for invalid states */
|
||||
if (soops == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
event= RNA_enum_get(op->ptr, "type");
|
||||
event = RNA_enum_get(op->ptr, "type");
|
||||
set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
|
||||
|
||||
if (datalevel==TSE_POSE_CHANNEL) {
|
||||
if (event>0) {
|
||||
if (datalevel == TSE_POSE_CHANNEL) {
|
||||
if (event > 0) {
|
||||
outliner_do_data_operation(soops, datalevel, event, &soops->tree, pchan_cb);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
|
||||
ED_undo_push(C, "PoseChannel operation");
|
||||
}
|
||||
}
|
||||
else if (datalevel==TSE_BONE) {
|
||||
if (event>0) {
|
||||
else if (datalevel == TSE_BONE) {
|
||||
if (event > 0) {
|
||||
outliner_do_data_operation(soops, datalevel, event, &soops->tree, bone_cb);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
|
||||
ED_undo_push(C, "Bone operation");
|
||||
}
|
||||
}
|
||||
else if (datalevel==TSE_EBONE) {
|
||||
if (event>0) {
|
||||
else if (datalevel == TSE_EBONE) {
|
||||
if (event > 0) {
|
||||
outliner_do_data_operation(soops, datalevel, event, &soops->tree, ebone_cb);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
|
||||
ED_undo_push(C, "EditBone operation");
|
||||
}
|
||||
}
|
||||
else if (datalevel==TSE_SEQUENCE) {
|
||||
if (event>0) {
|
||||
else if (datalevel == TSE_SEQUENCE) {
|
||||
if (event > 0) {
|
||||
outliner_do_data_operation(soops, datalevel, event, &soops->tree, sequence_cb);
|
||||
}
|
||||
}
|
||||
@@ -1151,14 +1151,14 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
|
||||
{
|
||||
ReportList *reports = CTX_wm_reports(C); // XXX...
|
||||
|
||||
if (mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
|
||||
int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0;
|
||||
TreeStoreElem *tselem= TREESTORE(te);
|
||||
if (mval[1] > te->ys && mval[1] < te->ys + UI_UNIT_Y) {
|
||||
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
|
||||
TreeStoreElem *tselem = TREESTORE(te);
|
||||
|
||||
/* select object that's clicked on and popup context menu */
|
||||
if (!(tselem->flag & TSE_SELECTED)) {
|
||||
|
||||
if ( outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1) )
|
||||
if (outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1) )
|
||||
outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 0);
|
||||
|
||||
tselem->flag |= TSE_SELECTED;
|
||||
@@ -1177,16 +1177,16 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
|
||||
WM_operator_name_call(C, "OUTLINER_OT_object_operation", WM_OP_INVOKE_REGION_WIN, NULL);
|
||||
}
|
||||
else if (idlevel) {
|
||||
if (idlevel==-1 || datalevel) BKE_report(reports, RPT_WARNING, "Mixed selection");
|
||||
if (idlevel == -1 || datalevel) BKE_report(reports, RPT_WARNING, "Mixed selection");
|
||||
else {
|
||||
if (idlevel==ID_GR)
|
||||
if (idlevel == ID_GR)
|
||||
WM_operator_name_call(C, "OUTLINER_OT_group_operation", WM_OP_INVOKE_REGION_WIN, NULL);
|
||||
else
|
||||
WM_operator_name_call(C, "OUTLINER_OT_id_operation", WM_OP_INVOKE_REGION_WIN, NULL);
|
||||
}
|
||||
}
|
||||
else if (datalevel) {
|
||||
if (datalevel==-1) BKE_report(reports, RPT_WARNING, "Mixed selection");
|
||||
if (datalevel == -1) BKE_report(reports, RPT_WARNING, "Mixed selection");
|
||||
else {
|
||||
if (datalevel == TSE_ANIM_DATA)
|
||||
WM_operator_name_call(C, "OUTLINER_OT_animdata_operation", WM_OP_INVOKE_REGION_WIN, NULL);
|
||||
@@ -1202,7 +1202,7 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (te= te->subtree.first; te; te= te->next) {
|
||||
for (te = te->subtree.first; te; te = te->next) {
|
||||
if (do_outliner_operation_event(C, scene, ar, soops, te, event, mval))
|
||||
return 1;
|
||||
}
|
||||
@@ -1212,15 +1212,15 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
|
||||
|
||||
static int outliner_operation(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
TreeElement *te;
|
||||
float fmval[2];
|
||||
|
||||
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
|
||||
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval + 1);
|
||||
|
||||
for (te= soops->tree.first; te; te= te->next) {
|
||||
for (te = soops->tree.first; te; te = te->next) {
|
||||
if (do_outliner_operation_event(C, scene, ar, soops, te, event, fmval)) break;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,50 +82,50 @@
|
||||
/* ********************************************************* */
|
||||
/* Defines */
|
||||
|
||||
#define TS_CHUNK 128
|
||||
#define TS_CHUNK 128
|
||||
|
||||
/* ********************************************************* */
|
||||
/* Persistent Data */
|
||||
|
||||
static void outliner_storage_cleanup(SpaceOops *soops)
|
||||
{
|
||||
TreeStore *ts= soops->treestore;
|
||||
TreeStore *ts = soops->treestore;
|
||||
|
||||
if (ts) {
|
||||
TreeStoreElem *tselem;
|
||||
int a, unused= 0;
|
||||
int a, unused = 0;
|
||||
|
||||
/* each element used once, for ID blocks with more users to have each a treestore */
|
||||
for (a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) tselem->used= 0;
|
||||
for (a = 0, tselem = ts->data; a < ts->usedelem; a++, tselem++) tselem->used = 0;
|
||||
|
||||
/* cleanup only after reading file or undo step, and always for
|
||||
* RNA datablocks view in order to save memory */
|
||||
if (soops->storeflag & SO_TREESTORE_CLEANUP) {
|
||||
|
||||
for (a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) {
|
||||
if (tselem->id==NULL) unused++;
|
||||
for (a = 0, tselem = ts->data; a < ts->usedelem; a++, tselem++) {
|
||||
if (tselem->id == NULL) unused++;
|
||||
}
|
||||
|
||||
if (unused) {
|
||||
if (ts->usedelem == unused) {
|
||||
MEM_freeN(ts->data);
|
||||
ts->data= NULL;
|
||||
ts->usedelem= ts->totelem= 0;
|
||||
ts->data = NULL;
|
||||
ts->usedelem = ts->totelem = 0;
|
||||
}
|
||||
else {
|
||||
TreeStoreElem *tsnewar, *tsnew;
|
||||
|
||||
tsnew=tsnewar= MEM_mallocN((ts->usedelem-unused)*sizeof(TreeStoreElem), "new tselem");
|
||||
for (a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) {
|
||||
tsnew = tsnewar = MEM_mallocN((ts->usedelem - unused) * sizeof(TreeStoreElem), "new tselem");
|
||||
for (a = 0, tselem = ts->data; a < ts->usedelem; a++, tselem++) {
|
||||
if (tselem->id) {
|
||||
*tsnew= *tselem;
|
||||
*tsnew = *tselem;
|
||||
tsnew++;
|
||||
}
|
||||
}
|
||||
MEM_freeN(ts->data);
|
||||
ts->data= tsnewar;
|
||||
ts->usedelem-= unused;
|
||||
ts->totelem= ts->usedelem;
|
||||
ts->data = tsnewar;
|
||||
ts->usedelem -= unused;
|
||||
ts->totelem = ts->usedelem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,45 +139,45 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty
|
||||
int a;
|
||||
|
||||
/* case 1; no TreeStore */
|
||||
if (soops->treestore==NULL) {
|
||||
soops->treestore= MEM_callocN(sizeof(TreeStore), "treestore");
|
||||
if (soops->treestore == NULL) {
|
||||
soops->treestore = MEM_callocN(sizeof(TreeStore), "treestore");
|
||||
}
|
||||
ts= soops->treestore;
|
||||
ts = soops->treestore;
|
||||
|
||||
/* check if 'te' is in treestore */
|
||||
tselem= ts->data;
|
||||
for (a=0; a<ts->usedelem; a++, tselem++) {
|
||||
if (tselem->id==id && tselem->used==0) {
|
||||
if ((type==0 && tselem->type==0) ||(tselem->type==type && tselem->nr==nr)) {
|
||||
te->store_index= a;
|
||||
tselem->used= 1;
|
||||
tselem = ts->data;
|
||||
for (a = 0; a < ts->usedelem; a++, tselem++) {
|
||||
if (tselem->id == id && tselem->used == 0) {
|
||||
if ((type == 0 && tselem->type == 0) || (tselem->type == type && tselem->nr == nr)) {
|
||||
te->store_index = a;
|
||||
tselem->used = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* add 1 element to treestore */
|
||||
if (ts->usedelem==ts->totelem) {
|
||||
if (ts->usedelem == ts->totelem) {
|
||||
TreeStoreElem *tsnew;
|
||||
|
||||
tsnew= MEM_mallocN((ts->totelem+TS_CHUNK)*sizeof(TreeStoreElem), "treestore data");
|
||||
tsnew = MEM_mallocN((ts->totelem + TS_CHUNK) * sizeof(TreeStoreElem), "treestore data");
|
||||
if (ts->data) {
|
||||
memcpy(tsnew, ts->data, ts->totelem*sizeof(TreeStoreElem));
|
||||
memcpy(tsnew, ts->data, ts->totelem * sizeof(TreeStoreElem));
|
||||
MEM_freeN(ts->data);
|
||||
}
|
||||
ts->data= tsnew;
|
||||
ts->totelem+= TS_CHUNK;
|
||||
ts->data = tsnew;
|
||||
ts->totelem += TS_CHUNK;
|
||||
}
|
||||
|
||||
tselem= ts->data+ts->usedelem;
|
||||
tselem = ts->data + ts->usedelem;
|
||||
|
||||
tselem->type= type;
|
||||
if (type) tselem->nr= nr; // we're picky! :)
|
||||
else tselem->nr= 0;
|
||||
tselem->id= id;
|
||||
tselem->type = type;
|
||||
if (type) tselem->nr = nr; // we're picky! :)
|
||||
else tselem->nr = 0;
|
||||
tselem->id = id;
|
||||
tselem->used = 0;
|
||||
tselem->flag= TSE_CLOSED;
|
||||
te->store_index= ts->usedelem;
|
||||
tselem->flag = TSE_CLOSED;
|
||||
te->store_index = ts->usedelem;
|
||||
|
||||
ts->usedelem++;
|
||||
}
|
||||
@@ -188,7 +188,7 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty
|
||||
void outliner_free_tree(ListBase *lb)
|
||||
{
|
||||
while (lb->first) {
|
||||
TreeElement *te= lb->first;
|
||||
TreeElement *te = lb->first;
|
||||
|
||||
outliner_free_tree(&te->subtree);
|
||||
BLI_remlink(lb, te);
|
||||
@@ -207,12 +207,12 @@ void outliner_cleanup_tree(SpaceOops *soops)
|
||||
/* Find ith item from the treestore */
|
||||
static TreeElement *outliner_find_tree_element(ListBase *lb, int store_index)
|
||||
{
|
||||
TreeElement *te= lb->first, *tes;
|
||||
TreeElement *te = lb->first, *tes;
|
||||
while (te) {
|
||||
if (te->store_index==store_index) return te;
|
||||
tes= outliner_find_tree_element(&te->subtree, store_index);
|
||||
if (te->store_index == store_index) return te;
|
||||
tes = outliner_find_tree_element(&te->subtree, store_index);
|
||||
if (tes) return tes;
|
||||
te= te->next;
|
||||
te = te->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -220,17 +220,17 @@ static TreeElement *outliner_find_tree_element(ListBase *lb, int store_index)
|
||||
/* tse is not in the treestore, we use its contents to find a match */
|
||||
TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse)
|
||||
{
|
||||
TreeStore *ts= soops->treestore;
|
||||
TreeStore *ts = soops->treestore;
|
||||
TreeStoreElem *tselem;
|
||||
int a;
|
||||
|
||||
if (tse->id==NULL) return NULL;
|
||||
if (tse->id == NULL) return NULL;
|
||||
|
||||
/* check if 'tse' is in treestore */
|
||||
tselem= ts->data;
|
||||
for (a=0; a<ts->usedelem; a++, tselem++) {
|
||||
if ((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) {
|
||||
if (tselem->id==tse->id) {
|
||||
tselem = ts->data;
|
||||
for (a = 0; a < ts->usedelem; a++, tselem++) {
|
||||
if ((tse->type == 0 && tselem->type == 0) || (tselem->type == tse->type && tselem->nr == tse->nr)) {
|
||||
if (tselem->id == tse->id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -247,13 +247,13 @@ TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id)
|
||||
TreeElement *te, *tes;
|
||||
TreeStoreElem *tselem;
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
tselem= TREESTORE(te);
|
||||
if (tselem->type==0) {
|
||||
if (tselem->id==id) return te;
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
tselem = TREESTORE(te);
|
||||
if (tselem->type == 0) {
|
||||
if (tselem->id == id) return te;
|
||||
/* only deeper on scene or object */
|
||||
if ( te->idcode==ID_OB || te->idcode==ID_SCE || (soops->outlinevis == SO_GROUPS && te->idcode==ID_GR)) {
|
||||
tes= outliner_find_id(soops, &te->subtree, id);
|
||||
if (te->idcode == ID_OB || te->idcode == ID_SCE || (soops->outlinevis == SO_GROUPS && te->idcode == ID_GR)) {
|
||||
tes = outliner_find_id(soops, &te->subtree, id);
|
||||
if (tes) return tes;
|
||||
}
|
||||
}
|
||||
@@ -265,12 +265,12 @@ TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id)
|
||||
ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode)
|
||||
{
|
||||
TreeStoreElem *tselem;
|
||||
te= te->parent;
|
||||
te = te->parent;
|
||||
|
||||
while (te) {
|
||||
tselem= TREESTORE(te);
|
||||
if (tselem->type==0 && te->idcode==idcode) return tselem->id;
|
||||
te= te->parent;
|
||||
tselem = TREESTORE(te);
|
||||
if (tselem->type == 0 && te->idcode == idcode) return tselem->id;
|
||||
te = te->parent;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -280,28 +280,28 @@ ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode)
|
||||
|
||||
/* Prototype, see functions below */
|
||||
static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv,
|
||||
TreeElement *parent, short type, short index);
|
||||
TreeElement *parent, short type, short index);
|
||||
|
||||
/* -------------------------------------------------------- */
|
||||
|
||||
/* special handling of hierarchical non-lib data */
|
||||
static void outliner_add_bone(SpaceOops *soops, ListBase *lb, ID *id, Bone *curBone,
|
||||
TreeElement *parent, int *a)
|
||||
TreeElement *parent, int *a)
|
||||
{
|
||||
TreeElement *te= outliner_add_element(soops, lb, id, parent, TSE_BONE, *a);
|
||||
TreeElement *te = outliner_add_element(soops, lb, id, parent, TSE_BONE, *a);
|
||||
|
||||
(*a)++;
|
||||
te->name= curBone->name;
|
||||
te->directdata= curBone;
|
||||
te->name = curBone->name;
|
||||
te->directdata = curBone;
|
||||
|
||||
for (curBone= curBone->childbase.first; curBone; curBone=curBone->next) {
|
||||
for (curBone = curBone->childbase.first; curBone; curBone = curBone->next) {
|
||||
outliner_add_bone(soops, &te->subtree, id, curBone, te, a);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------- */
|
||||
|
||||
#define LOG2I(x) (int)(log(x)/M_LN2)
|
||||
#define LOG2I(x) (int)(log(x) / M_LN2)
|
||||
|
||||
static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, SceneRenderLayer *srl)
|
||||
{
|
||||
@@ -311,82 +311,82 @@ static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, Sc
|
||||
/* log stuff is to convert bitflags (powers of 2) to small integers,
|
||||
* in order to not overflow short tselem->nr */
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_COMBINED));
|
||||
te->name= "Combined";
|
||||
te->directdata= &srl->passflag;
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_COMBINED));
|
||||
te->name = "Combined";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
/* save cpu cycles, but we add the first to invoke an open/close triangle */
|
||||
tselem = TREESTORE(tenla);
|
||||
if (tselem->flag & TSE_CLOSED)
|
||||
return;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_Z));
|
||||
te->name= "Z";
|
||||
te->directdata= &srl->passflag;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_VECTOR));
|
||||
te->name= "Vector";
|
||||
te->directdata= &srl->passflag;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_NORMAL));
|
||||
te->name= "Normal";
|
||||
te->directdata= &srl->passflag;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_UV));
|
||||
te->name= "UV";
|
||||
te->directdata= &srl->passflag;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_MIST));
|
||||
te->name= "Mist";
|
||||
te->directdata= &srl->passflag;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDEXOB));
|
||||
te->name= "Index Object";
|
||||
te->directdata= &srl->passflag;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDEXMA));
|
||||
te->name= "Index Material";
|
||||
te->directdata= &srl->passflag;
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_Z));
|
||||
te->name = "Z";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_RGBA));
|
||||
te->name= "Color";
|
||||
te->directdata= &srl->passflag;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_DIFFUSE));
|
||||
te->name= "Diffuse";
|
||||
te->directdata= &srl->passflag;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_SPEC));
|
||||
te->name= "Specular";
|
||||
te->directdata= &srl->passflag;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_SHADOW));
|
||||
te->name= "Shadow";
|
||||
te->directdata= &srl->passflag;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_AO));
|
||||
te->name= "AO";
|
||||
te->directdata= &srl->passflag;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_REFLECT));
|
||||
te->name= "Reflection";
|
||||
te->directdata= &srl->passflag;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_REFRACT));
|
||||
te->name= "Refraction";
|
||||
te->directdata= &srl->passflag;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDIRECT));
|
||||
te->name= "Indirect";
|
||||
te->directdata= &srl->passflag;
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_VECTOR));
|
||||
te->name = "Vector";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_ENVIRONMENT));
|
||||
te->name= "Environment";
|
||||
te->directdata= &srl->passflag;
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_NORMAL));
|
||||
te->name = "Normal";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_EMIT));
|
||||
te->name= "Emit";
|
||||
te->directdata= &srl->passflag;
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_UV));
|
||||
te->name = "UV";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_MIST));
|
||||
te->name = "Mist";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDEXOB));
|
||||
te->name = "Index Object";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDEXMA));
|
||||
te->name = "Index Material";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_RGBA));
|
||||
te->name = "Color";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_DIFFUSE));
|
||||
te->name = "Diffuse";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_SPEC));
|
||||
te->name = "Specular";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_SHADOW));
|
||||
te->name = "Shadow";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_AO));
|
||||
te->name = "AO";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_REFLECT));
|
||||
te->name = "Reflection";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_REFRACT));
|
||||
te->name = "Refraction";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDIRECT));
|
||||
te->name = "Indirect";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_ENVIRONMENT));
|
||||
te->name = "Environment";
|
||||
te->directdata = &srl->passflag;
|
||||
|
||||
te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_EMIT));
|
||||
te->name = "Emit";
|
||||
te->directdata = &srl->passflag;
|
||||
}
|
||||
|
||||
#undef LOG2I
|
||||
@@ -394,14 +394,14 @@ static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, Sc
|
||||
static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *sce, TreeElement *te)
|
||||
{
|
||||
SceneRenderLayer *srl;
|
||||
TreeElement *tenla= outliner_add_element(soops, lb, sce, te, TSE_R_LAYER_BASE, 0);
|
||||
TreeElement *tenla = outliner_add_element(soops, lb, sce, te, TSE_R_LAYER_BASE, 0);
|
||||
int a;
|
||||
|
||||
tenla->name= "RenderLayers";
|
||||
for (a=0, srl= sce->r.layers.first; srl; srl= srl->next, a++) {
|
||||
TreeElement *tenlay= outliner_add_element(soops, &tenla->subtree, sce, te, TSE_R_LAYER, a);
|
||||
tenlay->name= srl->name;
|
||||
tenlay->directdata= &srl->passflag;
|
||||
tenla->name = "RenderLayers";
|
||||
for (a = 0, srl = sce->r.layers.first; srl; srl = srl->next, a++) {
|
||||
TreeElement *tenlay = outliner_add_element(soops, &tenla->subtree, sce, te, TSE_R_LAYER, a);
|
||||
tenlay->name = srl->name;
|
||||
tenlay->directdata = &srl->passflag;
|
||||
|
||||
if (srl->light_override)
|
||||
outliner_add_element(soops, &tenlay->subtree, srl->light_override, tenlay, TSE_LINKED_LAMP, 0);
|
||||
@@ -428,66 +428,66 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
|
||||
|
||||
outliner_add_element(soops, &te->subtree, ob->poselib, te, 0, 0); // XXX FIXME.. add a special type for this
|
||||
|
||||
if (ob->proxy && ob->id.lib==NULL)
|
||||
if (ob->proxy && ob->id.lib == NULL)
|
||||
outliner_add_element(soops, &te->subtree, ob->proxy, te, TSE_PROXY, 0);
|
||||
|
||||
outliner_add_element(soops, &te->subtree, ob->data, te, 0, 0);
|
||||
|
||||
if (ob->pose) {
|
||||
bArmature *arm= ob->data;
|
||||
bArmature *arm = ob->data;
|
||||
bPoseChannel *pchan;
|
||||
TreeElement *ten;
|
||||
TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_POSE_BASE, 0);
|
||||
TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_POSE_BASE, 0);
|
||||
|
||||
tenla->name= "Pose";
|
||||
tenla->name = "Pose";
|
||||
|
||||
/* channels undefined in editmode, but we want the 'tenla' pose icon itself */
|
||||
if ((arm->edbo == NULL) && (ob->mode & OB_MODE_POSE)) {
|
||||
int a= 0, const_index= 1000; /* ensure unique id for bone constraints */
|
||||
int a = 0, const_index = 1000; /* ensure unique id for bone constraints */
|
||||
|
||||
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next, a++) {
|
||||
ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a);
|
||||
ten->name= pchan->name;
|
||||
ten->directdata= pchan;
|
||||
pchan->temp= (void *)ten;
|
||||
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next, a++) {
|
||||
ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a);
|
||||
ten->name = pchan->name;
|
||||
ten->directdata = pchan;
|
||||
pchan->temp = (void *)ten;
|
||||
|
||||
if (pchan->constraints.first) {
|
||||
//Object *target;
|
||||
bConstraint *con;
|
||||
TreeElement *ten1;
|
||||
TreeElement *tenla1= outliner_add_element(soops, &ten->subtree, ob, ten, TSE_CONSTRAINT_BASE, 0);
|
||||
TreeElement *tenla1 = outliner_add_element(soops, &ten->subtree, ob, ten, TSE_CONSTRAINT_BASE, 0);
|
||||
//char *str;
|
||||
|
||||
tenla1->name= "Constraints";
|
||||
for (con= pchan->constraints.first; con; con= con->next, const_index++) {
|
||||
ten1= outliner_add_element(soops, &tenla1->subtree, ob, tenla1, TSE_CONSTRAINT, const_index);
|
||||
tenla1->name = "Constraints";
|
||||
for (con = pchan->constraints.first; con; con = con->next, const_index++) {
|
||||
ten1 = outliner_add_element(soops, &tenla1->subtree, ob, tenla1, TSE_CONSTRAINT, const_index);
|
||||
#if 0 /* disabled as it needs to be reworked for recoded constraints system */
|
||||
target= get_constraint_target(con, &str);
|
||||
if (str && str[0]) ten1->name= str;
|
||||
else if (target) ten1->name= target->id.name+2;
|
||||
else ten1->name= con->name;
|
||||
target = get_constraint_target(con, &str);
|
||||
if (str && str[0]) ten1->name = str;
|
||||
else if (target) ten1->name = target->id.name + 2;
|
||||
else ten1->name = con->name;
|
||||
#endif
|
||||
ten1->name= con->name;
|
||||
ten1->directdata= con;
|
||||
ten1->name = con->name;
|
||||
ten1->directdata = con;
|
||||
/* possible add all other types links? */
|
||||
}
|
||||
}
|
||||
}
|
||||
/* make hierarchy */
|
||||
ten= tenla->subtree.first;
|
||||
ten = tenla->subtree.first;
|
||||
while (ten) {
|
||||
TreeElement *nten= ten->next, *par;
|
||||
tselem= TREESTORE(ten);
|
||||
if (tselem->type==TSE_POSE_CHANNEL) {
|
||||
pchan= (bPoseChannel *)ten->directdata;
|
||||
TreeElement *nten = ten->next, *par;
|
||||
tselem = TREESTORE(ten);
|
||||
if (tselem->type == TSE_POSE_CHANNEL) {
|
||||
pchan = (bPoseChannel *)ten->directdata;
|
||||
if (pchan->parent) {
|
||||
BLI_remlink(&tenla->subtree, ten);
|
||||
par= (TreeElement *)pchan->parent->temp;
|
||||
par = (TreeElement *)pchan->parent->temp;
|
||||
BLI_addtail(&par->subtree, ten);
|
||||
ten->parent= par;
|
||||
ten->parent = par;
|
||||
}
|
||||
}
|
||||
ten= nten;
|
||||
ten = nten;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,39 +495,39 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
|
||||
if (ob->pose->agroups.first) {
|
||||
bActionGroup *agrp;
|
||||
TreeElement *ten;
|
||||
TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_POSEGRP_BASE, 0);
|
||||
int a= 0;
|
||||
TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_POSEGRP_BASE, 0);
|
||||
int a = 0;
|
||||
|
||||
tenla->name= "Bone Groups";
|
||||
for (agrp=ob->pose->agroups.first; agrp; agrp=agrp->next, a++) {
|
||||
ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSEGRP, a);
|
||||
ten->name= agrp->name;
|
||||
ten->directdata= agrp;
|
||||
tenla->name = "Bone Groups";
|
||||
for (agrp = ob->pose->agroups.first; agrp; agrp = agrp->next, a++) {
|
||||
ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSEGRP, a);
|
||||
ten->name = agrp->name;
|
||||
ten->directdata = agrp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (a=0; a<ob->totcol; a++)
|
||||
for (a = 0; a < ob->totcol; a++)
|
||||
outliner_add_element(soops, &te->subtree, ob->mat[a], te, 0, a);
|
||||
|
||||
if (ob->constraints.first) {
|
||||
//Object *target;
|
||||
bConstraint *con;
|
||||
TreeElement *ten;
|
||||
TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_CONSTRAINT_BASE, 0);
|
||||
TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_CONSTRAINT_BASE, 0);
|
||||
//char *str;
|
||||
|
||||
tenla->name= "Constraints";
|
||||
for (con=ob->constraints.first, a=0; con; con= con->next, a++) {
|
||||
ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_CONSTRAINT, a);
|
||||
tenla->name = "Constraints";
|
||||
for (con = ob->constraints.first, a = 0; con; con = con->next, a++) {
|
||||
ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_CONSTRAINT, a);
|
||||
#if 0 /* disabled due to constraints system targets recode... code here needs review */
|
||||
target= get_constraint_target(con, &str);
|
||||
if (str && str[0]) ten->name= str;
|
||||
else if (target) ten->name= target->id.name+2;
|
||||
else ten->name= con->name;
|
||||
target = get_constraint_target(con, &str);
|
||||
if (str && str[0]) ten->name = str;
|
||||
else if (target) ten->name = target->id.name + 2;
|
||||
else ten->name = con->name;
|
||||
#endif
|
||||
ten->name= con->name;
|
||||
ten->directdata= con;
|
||||
ten->name = con->name;
|
||||
ten->directdata = con;
|
||||
/* possible add all other types links? */
|
||||
}
|
||||
}
|
||||
@@ -538,30 +538,30 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
|
||||
int index;
|
||||
|
||||
temod->name = "Modifiers";
|
||||
for (index=0, md=ob->modifiers.first; md; index++, md=md->next) {
|
||||
for (index = 0, md = ob->modifiers.first; md; index++, md = md->next) {
|
||||
TreeElement *te = outliner_add_element(soops, &temod->subtree, ob, temod, TSE_MODIFIER, index);
|
||||
te->name= md->name;
|
||||
te->name = md->name;
|
||||
te->directdata = md;
|
||||
|
||||
if (md->type==eModifierType_Lattice) {
|
||||
outliner_add_element(soops, &te->subtree, ((LatticeModifierData*) md)->object, te, TSE_LINKED_OB, 0);
|
||||
if (md->type == eModifierType_Lattice) {
|
||||
outliner_add_element(soops, &te->subtree, ((LatticeModifierData *) md)->object, te, TSE_LINKED_OB, 0);
|
||||
}
|
||||
else if (md->type==eModifierType_Curve) {
|
||||
outliner_add_element(soops, &te->subtree, ((CurveModifierData*) md)->object, te, TSE_LINKED_OB, 0);
|
||||
else if (md->type == eModifierType_Curve) {
|
||||
outliner_add_element(soops, &te->subtree, ((CurveModifierData *) md)->object, te, TSE_LINKED_OB, 0);
|
||||
}
|
||||
else if (md->type==eModifierType_Armature) {
|
||||
outliner_add_element(soops, &te->subtree, ((ArmatureModifierData*) md)->object, te, TSE_LINKED_OB, 0);
|
||||
else if (md->type == eModifierType_Armature) {
|
||||
outliner_add_element(soops, &te->subtree, ((ArmatureModifierData *) md)->object, te, TSE_LINKED_OB, 0);
|
||||
}
|
||||
else if (md->type==eModifierType_Hook) {
|
||||
outliner_add_element(soops, &te->subtree, ((HookModifierData*) md)->object, te, TSE_LINKED_OB, 0);
|
||||
else if (md->type == eModifierType_Hook) {
|
||||
outliner_add_element(soops, &te->subtree, ((HookModifierData *) md)->object, te, TSE_LINKED_OB, 0);
|
||||
}
|
||||
else if (md->type==eModifierType_ParticleSystem) {
|
||||
else if (md->type == eModifierType_ParticleSystem) {
|
||||
TreeElement *ten;
|
||||
ParticleSystem *psys= ((ParticleSystemModifierData*) md)->psys;
|
||||
ParticleSystem *psys = ((ParticleSystemModifierData *) md)->psys;
|
||||
|
||||
ten = outliner_add_element(soops, &te->subtree, ob, te, TSE_LINKED_PSYS, 0);
|
||||
ten->directdata = psys;
|
||||
ten->name = psys->part->id.name+2;
|
||||
ten->name = psys->part->id.name + 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -570,13 +570,13 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
|
||||
if (ob->defbase.first) {
|
||||
bDeformGroup *defgroup;
|
||||
TreeElement *ten;
|
||||
TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_DEFGROUP_BASE, 0);
|
||||
TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_DEFGROUP_BASE, 0);
|
||||
|
||||
tenla->name= "Vertex Groups";
|
||||
for (defgroup=ob->defbase.first, a=0; defgroup; defgroup=defgroup->next, a++) {
|
||||
ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_DEFGROUP, a);
|
||||
ten->name= defgroup->name;
|
||||
ten->directdata= defgroup;
|
||||
tenla->name = "Vertex Groups";
|
||||
for (defgroup = ob->defbase.first, a = 0; defgroup; defgroup = defgroup->next, a++) {
|
||||
ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_DEFGROUP, a);
|
||||
ten->name = defgroup->name;
|
||||
ten->directdata = defgroup;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,147 +589,147 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
|
||||
static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, ID *id)
|
||||
{
|
||||
/* tuck pointer back in object, to construct hierarchy */
|
||||
if (GS(id->name)==ID_OB) id->newid= (ID *)te;
|
||||
if (GS(id->name) == ID_OB) id->newid = (ID *)te;
|
||||
|
||||
/* expand specific data always */
|
||||
switch (GS(id->name)) {
|
||||
case ID_LI:
|
||||
{
|
||||
te->name= ((Library *)id)->name;
|
||||
te->name = ((Library *)id)->name;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ID_SCE:
|
||||
{
|
||||
outliner_add_scene_contents(soops, &te->subtree, (Scene *)id, te);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ID_OB:
|
||||
{
|
||||
outliner_add_object_contents(soops, te, tselem, (Object *)id);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ID_ME:
|
||||
{
|
||||
Mesh *me= (Mesh *)id;
|
||||
Mesh *me = (Mesh *)id;
|
||||
int a;
|
||||
|
||||
if (me->adt)
|
||||
outliner_add_element(soops, &te->subtree, me, te, TSE_ANIM_DATA, 0);
|
||||
|
||||
outliner_add_element(soops, &te->subtree, me->key, te, 0, 0);
|
||||
for (a=0; a<me->totcol; a++)
|
||||
for (a = 0; a < me->totcol; a++)
|
||||
outliner_add_element(soops, &te->subtree, me->mat[a], te, 0, a);
|
||||
/* could do tfaces with image links, but the images are not grouped nicely.
|
||||
* would require going over all tfaces, sort images in use. etc... */
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ID_CU:
|
||||
{
|
||||
Curve *cu= (Curve *)id;
|
||||
Curve *cu = (Curve *)id;
|
||||
int a;
|
||||
|
||||
if (cu->adt)
|
||||
outliner_add_element(soops, &te->subtree, cu, te, TSE_ANIM_DATA, 0);
|
||||
|
||||
for (a=0; a<cu->totcol; a++)
|
||||
for (a = 0; a < cu->totcol; a++)
|
||||
outliner_add_element(soops, &te->subtree, cu->mat[a], te, 0, a);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ID_MB:
|
||||
{
|
||||
MetaBall *mb= (MetaBall *)id;
|
||||
MetaBall *mb = (MetaBall *)id;
|
||||
int a;
|
||||
|
||||
if (mb->adt)
|
||||
outliner_add_element(soops, &te->subtree, mb, te, TSE_ANIM_DATA, 0);
|
||||
|
||||
for (a=0; a<mb->totcol; a++)
|
||||
for (a = 0; a < mb->totcol; a++)
|
||||
outliner_add_element(soops, &te->subtree, mb->mat[a], te, 0, a);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ID_MA:
|
||||
{
|
||||
Material *ma= (Material *)id;
|
||||
Material *ma = (Material *)id;
|
||||
int a;
|
||||
|
||||
if (ma->adt)
|
||||
outliner_add_element(soops, &te->subtree, ma, te, TSE_ANIM_DATA, 0);
|
||||
|
||||
for (a=0; a<MAX_MTEX; a++) {
|
||||
for (a = 0; a < MAX_MTEX; a++) {
|
||||
if (ma->mtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, 0, a);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ID_TE:
|
||||
{
|
||||
Tex *tex= (Tex *)id;
|
||||
Tex *tex = (Tex *)id;
|
||||
|
||||
if (tex->adt)
|
||||
outliner_add_element(soops, &te->subtree, tex, te, TSE_ANIM_DATA, 0);
|
||||
|
||||
outliner_add_element(soops, &te->subtree, tex->ima, te, 0, 0);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ID_CA:
|
||||
{
|
||||
Camera *ca= (Camera *)id;
|
||||
Camera *ca = (Camera *)id;
|
||||
|
||||
if (ca->adt)
|
||||
outliner_add_element(soops, &te->subtree, ca, te, TSE_ANIM_DATA, 0);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ID_LA:
|
||||
{
|
||||
Lamp *la= (Lamp *)id;
|
||||
Lamp *la = (Lamp *)id;
|
||||
int a;
|
||||
|
||||
if (la->adt)
|
||||
outliner_add_element(soops, &te->subtree, la, te, TSE_ANIM_DATA, 0);
|
||||
|
||||
for (a=0; a<MAX_MTEX; a++) {
|
||||
for (a = 0; a < MAX_MTEX; a++) {
|
||||
if (la->mtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, 0, a);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ID_SPK:
|
||||
{
|
||||
Speaker *spk= (Speaker *)id;
|
||||
{
|
||||
Speaker *spk = (Speaker *)id;
|
||||
|
||||
if (spk->adt)
|
||||
outliner_add_element(soops, &te->subtree, spk, te, TSE_ANIM_DATA, 0);
|
||||
}
|
||||
break;
|
||||
if (spk->adt)
|
||||
outliner_add_element(soops, &te->subtree, spk, te, TSE_ANIM_DATA, 0);
|
||||
}
|
||||
break;
|
||||
case ID_WO:
|
||||
{
|
||||
World *wrld= (World *)id;
|
||||
World *wrld = (World *)id;
|
||||
int a;
|
||||
|
||||
if (wrld->adt)
|
||||
outliner_add_element(soops, &te->subtree, wrld, te, TSE_ANIM_DATA, 0);
|
||||
|
||||
for (a=0; a<MAX_MTEX; a++) {
|
||||
for (a = 0; a < MAX_MTEX; a++) {
|
||||
if (wrld->mtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, 0, a);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ID_KE:
|
||||
{
|
||||
Key *key= (Key *)id;
|
||||
Key *key = (Key *)id;
|
||||
|
||||
if (key->adt)
|
||||
outliner_add_element(soops, &te->subtree, key, te, TSE_ANIM_DATA, 0);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ID_AC:
|
||||
{
|
||||
// XXX do we want to be exposing the F-Curves here?
|
||||
//bAction *act= (bAction *)id;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ID_AR:
|
||||
{
|
||||
bArmature *arm= (bArmature *)id;
|
||||
int a= 0;
|
||||
bArmature *arm = (bArmature *)id;
|
||||
int a = 0;
|
||||
|
||||
if (arm->adt)
|
||||
outliner_add_element(soops, &te->subtree, arm, te, TSE_ANIM_DATA, 0);
|
||||
@@ -738,115 +738,115 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
|
||||
EditBone *ebone;
|
||||
TreeElement *ten;
|
||||
|
||||
for (ebone = arm->edbo->first; ebone; ebone=ebone->next, a++) {
|
||||
ten= outliner_add_element(soops, &te->subtree, id, te, TSE_EBONE, a);
|
||||
ten->directdata= ebone;
|
||||
ten->name= ebone->name;
|
||||
ebone->temp= ten;
|
||||
for (ebone = arm->edbo->first; ebone; ebone = ebone->next, a++) {
|
||||
ten = outliner_add_element(soops, &te->subtree, id, te, TSE_EBONE, a);
|
||||
ten->directdata = ebone;
|
||||
ten->name = ebone->name;
|
||||
ebone->temp = ten;
|
||||
}
|
||||
/* make hierarchy */
|
||||
ten= arm->edbo->first ? ((EditBone *)arm->edbo->first)->temp : NULL;
|
||||
ten = arm->edbo->first ? ((EditBone *)arm->edbo->first)->temp : NULL;
|
||||
while (ten) {
|
||||
TreeElement *nten= ten->next, *par;
|
||||
ebone= (EditBone *)ten->directdata;
|
||||
TreeElement *nten = ten->next, *par;
|
||||
ebone = (EditBone *)ten->directdata;
|
||||
if (ebone->parent) {
|
||||
BLI_remlink(&te->subtree, ten);
|
||||
par= ebone->parent->temp;
|
||||
par = ebone->parent->temp;
|
||||
BLI_addtail(&par->subtree, ten);
|
||||
ten->parent= par;
|
||||
ten->parent = par;
|
||||
}
|
||||
ten= nten;
|
||||
ten = nten;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* do not extend Armature when we have posemode */
|
||||
tselem= TREESTORE(te->parent);
|
||||
if ( GS(tselem->id->name)==ID_OB && ((Object *)tselem->id)->mode & OB_MODE_POSE);
|
||||
tselem = TREESTORE(te->parent);
|
||||
if (GS(tselem->id->name) == ID_OB && ((Object *)tselem->id)->mode & OB_MODE_POSE) ;
|
||||
else {
|
||||
Bone *curBone;
|
||||
for (curBone=arm->bonebase.first; curBone; curBone=curBone->next) {
|
||||
for (curBone = arm->bonebase.first; curBone; curBone = curBone->next) {
|
||||
outliner_add_bone(soops, &te->subtree, id, curBone, te, &a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: this function needs to be split up! It's getting a bit too large...
|
||||
static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv,
|
||||
TreeElement *parent, short type, short index)
|
||||
TreeElement *parent, short type, short index)
|
||||
{
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
ID *id= idv;
|
||||
ID *id = idv;
|
||||
int a = 0;
|
||||
|
||||
if (ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
|
||||
id= ((PointerRNA*)idv)->id.data;
|
||||
if (!id) id= ((PointerRNA*)idv)->data;
|
||||
id = ((PointerRNA *)idv)->id.data;
|
||||
if (!id) id = ((PointerRNA *)idv)->data;
|
||||
}
|
||||
|
||||
if (id==NULL) return NULL;
|
||||
if (id == NULL) return NULL;
|
||||
|
||||
te= MEM_callocN(sizeof(TreeElement), "tree elem");
|
||||
te = MEM_callocN(sizeof(TreeElement), "tree elem");
|
||||
/* add to the visual tree */
|
||||
BLI_addtail(lb, te);
|
||||
/* add to the storage */
|
||||
check_persistent(soops, te, id, type, index);
|
||||
tselem= TREESTORE(te);
|
||||
tselem = TREESTORE(te);
|
||||
|
||||
/* if we are searching for something expand to see child elements */
|
||||
if (SEARCHING_OUTLINER(soops))
|
||||
tselem->flag |= TSE_CHILDSEARCH;
|
||||
|
||||
te->parent= parent;
|
||||
te->index= index; // for data arays
|
||||
if (ELEM3(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP));
|
||||
else if (ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM));
|
||||
else if (type==TSE_ANIM_DATA);
|
||||
te->parent = parent;
|
||||
te->index = index; // for data arays
|
||||
if (ELEM3(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) ;
|
||||
else if (ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) ;
|
||||
else if (type == TSE_ANIM_DATA) ;
|
||||
else {
|
||||
te->name= id->name+2; // default, can be overridden by Library or non-ID data
|
||||
te->idcode= GS(id->name);
|
||||
te->name = id->name + 2; // default, can be overridden by Library or non-ID data
|
||||
te->idcode = GS(id->name);
|
||||
}
|
||||
|
||||
if (type==0) {
|
||||
if (type == 0) {
|
||||
/* ID datablock */
|
||||
outliner_add_id_contents(soops, te, tselem, id);
|
||||
}
|
||||
else if (type==TSE_ANIM_DATA) {
|
||||
else if (type == TSE_ANIM_DATA) {
|
||||
IdAdtTemplate *iat = (IdAdtTemplate *)idv;
|
||||
AnimData *adt= (AnimData *)iat->adt;
|
||||
AnimData *adt = (AnimData *)iat->adt;
|
||||
|
||||
/* this element's info */
|
||||
te->name= "Animation";
|
||||
te->directdata= adt;
|
||||
te->name = "Animation";
|
||||
te->directdata = adt;
|
||||
|
||||
/* Action */
|
||||
outliner_add_element(soops, &te->subtree, adt->action, te, 0, 0);
|
||||
|
||||
/* Drivers */
|
||||
if (adt->drivers.first) {
|
||||
TreeElement *ted= outliner_add_element(soops, &te->subtree, adt, te, TSE_DRIVER_BASE, 0);
|
||||
ID *lastadded= NULL;
|
||||
TreeElement *ted = outliner_add_element(soops, &te->subtree, adt, te, TSE_DRIVER_BASE, 0);
|
||||
ID *lastadded = NULL;
|
||||
FCurve *fcu;
|
||||
|
||||
ted->name= "Drivers";
|
||||
ted->name = "Drivers";
|
||||
|
||||
for (fcu= adt->drivers.first; fcu; fcu= fcu->next) {
|
||||
for (fcu = adt->drivers.first; fcu; fcu = fcu->next) {
|
||||
if (fcu->driver && fcu->driver->variables.first) {
|
||||
ChannelDriver *driver= fcu->driver;
|
||||
ChannelDriver *driver = fcu->driver;
|
||||
DriverVar *dvar;
|
||||
|
||||
for (dvar= driver->variables.first; dvar; dvar= dvar->next) {
|
||||
for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
|
||||
/* loop over all targets used here */
|
||||
DRIVER_TARGETS_USED_LOOPER(dvar)
|
||||
{
|
||||
if (lastadded != dtar->id) {
|
||||
// XXX this lastadded check is rather lame, and also fails quite badly...
|
||||
outliner_add_element(soops, &ted->subtree, dtar->id, ted, TSE_LINKED_OB, 0);
|
||||
lastadded= dtar->id;
|
||||
lastadded = dtar->id;
|
||||
}
|
||||
}
|
||||
DRIVER_TARGETS_LOOPER_END
|
||||
@@ -857,29 +857,29 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
|
||||
|
||||
/* NLA Data */
|
||||
if (adt->nla_tracks.first) {
|
||||
TreeElement *tenla= outliner_add_element(soops, &te->subtree, adt, te, TSE_NLA, 0);
|
||||
TreeElement *tenla = outliner_add_element(soops, &te->subtree, adt, te, TSE_NLA, 0);
|
||||
NlaTrack *nlt;
|
||||
int a= 0;
|
||||
int a = 0;
|
||||
|
||||
tenla->name= "NLA Tracks";
|
||||
tenla->name = "NLA Tracks";
|
||||
|
||||
for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
|
||||
TreeElement *tenlt= outliner_add_element(soops, &tenla->subtree, nlt, tenla, TSE_NLA_TRACK, a);
|
||||
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
|
||||
TreeElement *tenlt = outliner_add_element(soops, &tenla->subtree, nlt, tenla, TSE_NLA_TRACK, a);
|
||||
NlaStrip *strip;
|
||||
TreeElement *ten;
|
||||
int b= 0;
|
||||
int b = 0;
|
||||
|
||||
tenlt->name= nlt->name;
|
||||
tenlt->name = nlt->name;
|
||||
|
||||
for (strip=nlt->strips.first; strip; strip=strip->next, b++) {
|
||||
ten= outliner_add_element(soops, &tenlt->subtree, strip->act, tenlt, TSE_NLA_ACTION, b);
|
||||
if (ten) ten->directdata= strip;
|
||||
for (strip = nlt->strips.first; strip; strip = strip->next, b++) {
|
||||
ten = outliner_add_element(soops, &tenlt->subtree, strip->act, tenlt, TSE_NLA_ACTION, b);
|
||||
if (ten) ten->directdata = strip;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type==TSE_SEQUENCE) {
|
||||
Sequence *seq= (Sequence*) idv;
|
||||
else if (type == TSE_SEQUENCE) {
|
||||
Sequence *seq = (Sequence *) idv;
|
||||
Sequence *p;
|
||||
|
||||
/*
|
||||
@@ -887,56 +887,56 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
|
||||
* only check te->idcode if te->type is equal to zero,
|
||||
* so this is "safe".
|
||||
*/
|
||||
te->idcode= seq->type;
|
||||
te->directdata= seq;
|
||||
te->idcode = seq->type;
|
||||
te->directdata = seq;
|
||||
|
||||
if (seq->type<7) {
|
||||
if (seq->type < 7) {
|
||||
/*
|
||||
* This work like the sequence.
|
||||
* If the sequence have a name (not default name)
|
||||
* show it, in other case put the filename.
|
||||
*/
|
||||
if (strcmp(seq->name, "SQ"))
|
||||
te->name= seq->name;
|
||||
te->name = seq->name;
|
||||
else {
|
||||
if ((seq->strip) && (seq->strip->stripdata))
|
||||
te->name= seq->strip->stripdata->name;
|
||||
te->name = seq->strip->stripdata->name;
|
||||
else
|
||||
te->name= "SQ None";
|
||||
te->name = "SQ None";
|
||||
}
|
||||
|
||||
if (seq->type==SEQ_META) {
|
||||
te->name= "Meta Strip";
|
||||
p= seq->seqbase.first;
|
||||
if (seq->type == SEQ_META) {
|
||||
te->name = "Meta Strip";
|
||||
p = seq->seqbase.first;
|
||||
while (p) {
|
||||
outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index);
|
||||
p= p->next;
|
||||
outliner_add_element(soops, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
else
|
||||
outliner_add_element(soops, &te->subtree, (void*)seq->strip, te, TSE_SEQ_STRIP, index);
|
||||
outliner_add_element(soops, &te->subtree, (void *)seq->strip, te, TSE_SEQ_STRIP, index);
|
||||
}
|
||||
else
|
||||
te->name= "Effect";
|
||||
te->name = "Effect";
|
||||
}
|
||||
else if (type==TSE_SEQ_STRIP) {
|
||||
Strip *strip= (Strip *)idv;
|
||||
else if (type == TSE_SEQ_STRIP) {
|
||||
Strip *strip = (Strip *)idv;
|
||||
|
||||
if (strip->dir)
|
||||
te->name= strip->dir;
|
||||
te->name = strip->dir;
|
||||
else
|
||||
te->name= "Strip None";
|
||||
te->directdata= strip;
|
||||
te->name = "Strip None";
|
||||
te->directdata = strip;
|
||||
}
|
||||
else if (type==TSE_SEQUENCE_DUP) {
|
||||
Sequence *seq= (Sequence*)idv;
|
||||
else if (type == TSE_SEQUENCE_DUP) {
|
||||
Sequence *seq = (Sequence *)idv;
|
||||
|
||||
te->idcode= seq->type;
|
||||
te->directdata= seq;
|
||||
te->name= seq->strip->stripdata->name;
|
||||
te->idcode = seq->type;
|
||||
te->directdata = seq;
|
||||
te->name = seq->strip->stripdata->name;
|
||||
}
|
||||
else if (ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
|
||||
PointerRNA pptr, propptr, *ptr= (PointerRNA*)idv;
|
||||
PointerRNA pptr, propptr, *ptr = (PointerRNA *)idv;
|
||||
PropertyRNA *prop, *iterprop;
|
||||
PropertyType proptype;
|
||||
int a, tot;
|
||||
@@ -944,22 +944,22 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
|
||||
/* we do lazy build, for speed and to avoid infinite recusion */
|
||||
|
||||
if (ptr->data == NULL) {
|
||||
te->name= "(empty)";
|
||||
te->name = "(empty)";
|
||||
}
|
||||
else if (type == TSE_RNA_STRUCT) {
|
||||
/* struct */
|
||||
te->name= RNA_struct_name_get_alloc(ptr, NULL, 0, NULL);
|
||||
te->name = RNA_struct_name_get_alloc(ptr, NULL, 0, NULL);
|
||||
|
||||
if (te->name)
|
||||
te->flag |= TE_FREE_NAME;
|
||||
else
|
||||
te->name= RNA_struct_ui_name(ptr->type);
|
||||
te->name = RNA_struct_ui_name(ptr->type);
|
||||
|
||||
/* If searching don't expand RNA entries */
|
||||
if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA", te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
|
||||
if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA", te->name) == 0) tselem->flag &= ~TSE_CHILDSEARCH;
|
||||
|
||||
iterprop= RNA_struct_iterator_property(ptr->type);
|
||||
tot= RNA_property_collection_length(ptr, iterprop);
|
||||
iterprop = RNA_struct_iterator_property(ptr->type);
|
||||
tot = RNA_property_collection_length(ptr, iterprop);
|
||||
|
||||
/* auto open these cases */
|
||||
if (!parent || (RNA_property_type(parent->directdata)) == PROP_POINTER)
|
||||
@@ -967,57 +967,57 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
|
||||
tselem->flag &= ~TSE_CLOSED;
|
||||
|
||||
if (TSELEM_OPEN(tselem, soops)) {
|
||||
for (a=0; a<tot; a++)
|
||||
outliner_add_element(soops, &te->subtree, (void*)ptr, te, TSE_RNA_PROPERTY, a);
|
||||
for (a = 0; a < tot; a++)
|
||||
outliner_add_element(soops, &te->subtree, (void *)ptr, te, TSE_RNA_PROPERTY, a);
|
||||
}
|
||||
else if (tot)
|
||||
te->flag |= TE_LAZY_CLOSED;
|
||||
|
||||
te->rnaptr= *ptr;
|
||||
te->rnaptr = *ptr;
|
||||
}
|
||||
else if (type == TSE_RNA_PROPERTY) {
|
||||
/* property */
|
||||
iterprop= RNA_struct_iterator_property(ptr->type);
|
||||
iterprop = RNA_struct_iterator_property(ptr->type);
|
||||
RNA_property_collection_lookup_int(ptr, iterprop, index, &propptr);
|
||||
|
||||
prop= propptr.data;
|
||||
proptype= RNA_property_type(prop);
|
||||
prop = propptr.data;
|
||||
proptype = RNA_property_type(prop);
|
||||
|
||||
te->name= RNA_property_ui_name(prop);
|
||||
te->directdata= prop;
|
||||
te->rnaptr= *ptr;
|
||||
te->name = RNA_property_ui_name(prop);
|
||||
te->directdata = prop;
|
||||
te->rnaptr = *ptr;
|
||||
|
||||
/* If searching don't expand RNA entries */
|
||||
if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA", te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
|
||||
if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA", te->name) == 0) tselem->flag &= ~TSE_CHILDSEARCH;
|
||||
|
||||
if (proptype == PROP_POINTER) {
|
||||
pptr= RNA_property_pointer_get(ptr, prop);
|
||||
pptr = RNA_property_pointer_get(ptr, prop);
|
||||
|
||||
if (pptr.data) {
|
||||
if (TSELEM_OPEN(tselem, soops))
|
||||
outliner_add_element(soops, &te->subtree, (void*)&pptr, te, TSE_RNA_STRUCT, -1);
|
||||
outliner_add_element(soops, &te->subtree, (void *)&pptr, te, TSE_RNA_STRUCT, -1);
|
||||
else
|
||||
te->flag |= TE_LAZY_CLOSED;
|
||||
}
|
||||
}
|
||||
else if (proptype == PROP_COLLECTION) {
|
||||
tot= RNA_property_collection_length(ptr, prop);
|
||||
tot = RNA_property_collection_length(ptr, prop);
|
||||
|
||||
if (TSELEM_OPEN(tselem, soops)) {
|
||||
for (a=0; a<tot; a++) {
|
||||
for (a = 0; a < tot; a++) {
|
||||
RNA_property_collection_lookup_int(ptr, prop, a, &pptr);
|
||||
outliner_add_element(soops, &te->subtree, (void*)&pptr, te, TSE_RNA_STRUCT, a);
|
||||
outliner_add_element(soops, &te->subtree, (void *)&pptr, te, TSE_RNA_STRUCT, a);
|
||||
}
|
||||
}
|
||||
else if (tot)
|
||||
te->flag |= TE_LAZY_CLOSED;
|
||||
}
|
||||
else if (ELEM3(proptype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
|
||||
tot= RNA_property_array_length(ptr, prop);
|
||||
tot = RNA_property_array_length(ptr, prop);
|
||||
|
||||
if (TSELEM_OPEN(tselem, soops)) {
|
||||
for (a=0; a<tot; a++)
|
||||
outliner_add_element(soops, &te->subtree, (void*)ptr, te, TSE_RNA_ARRAY_ELEM, a);
|
||||
for (a = 0; a < tot; a++)
|
||||
outliner_add_element(soops, &te->subtree, (void *)ptr, te, TSE_RNA_ARRAY_ELEM, a);
|
||||
}
|
||||
else if (tot)
|
||||
te->flag |= TE_LAZY_CLOSED;
|
||||
@@ -1026,51 +1026,51 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
|
||||
else if (type == TSE_RNA_ARRAY_ELEM) {
|
||||
char c;
|
||||
|
||||
prop= parent->directdata;
|
||||
prop = parent->directdata;
|
||||
|
||||
te->directdata= prop;
|
||||
te->rnaptr= *ptr;
|
||||
te->index= index;
|
||||
te->directdata = prop;
|
||||
te->rnaptr = *ptr;
|
||||
te->index = index;
|
||||
|
||||
c= RNA_property_array_item_char(prop, index);
|
||||
c = RNA_property_array_item_char(prop, index);
|
||||
|
||||
te->name= MEM_callocN(sizeof(char)*20, "OutlinerRNAArrayName");
|
||||
te->name = MEM_callocN(sizeof(char) * 20, "OutlinerRNAArrayName");
|
||||
if (c) sprintf((char *)te->name, " %c", c);
|
||||
else sprintf((char *)te->name, " %d", index+1);
|
||||
else sprintf((char *)te->name, " %d", index + 1);
|
||||
te->flag |= TE_FREE_NAME;
|
||||
}
|
||||
}
|
||||
else if (type == TSE_KEYMAP) {
|
||||
wmKeyMap *km= (wmKeyMap *)idv;
|
||||
wmKeyMap *km = (wmKeyMap *)idv;
|
||||
wmKeyMapItem *kmi;
|
||||
char opname[OP_MAX_TYPENAME];
|
||||
|
||||
te->directdata= idv;
|
||||
te->name= km->idname;
|
||||
te->directdata = idv;
|
||||
te->name = km->idname;
|
||||
|
||||
if (TSELEM_OPEN(tselem, soops)) {
|
||||
a= 0;
|
||||
a = 0;
|
||||
|
||||
for (kmi = km->items.first; kmi; kmi = kmi->next, a++) {
|
||||
const char *key= WM_key_event_string(kmi->type);
|
||||
const char *key = WM_key_event_string(kmi->type);
|
||||
|
||||
if (key[0]) {
|
||||
wmOperatorType *ot= NULL;
|
||||
wmOperatorType *ot = NULL;
|
||||
|
||||
if (kmi->propvalue);
|
||||
else ot= WM_operatortype_find(kmi->idname, 0);
|
||||
if (kmi->propvalue) ;
|
||||
else ot = WM_operatortype_find(kmi->idname, 0);
|
||||
|
||||
if (ot || kmi->propvalue) {
|
||||
TreeElement *ten= outliner_add_element(soops, &te->subtree, kmi, te, TSE_KEYMAP_ITEM, a);
|
||||
TreeElement *ten = outliner_add_element(soops, &te->subtree, kmi, te, TSE_KEYMAP_ITEM, a);
|
||||
|
||||
ten->directdata= kmi;
|
||||
ten->directdata = kmi;
|
||||
|
||||
if (kmi->propvalue) {
|
||||
ten->name= "Modal map, not yet";
|
||||
ten->name = "Modal map, not yet";
|
||||
}
|
||||
else {
|
||||
WM_operator_py_idname(opname, ot->idname);
|
||||
ten->name= BLI_strdup(opname);
|
||||
ten->name = BLI_strdup(opname);
|
||||
ten->flag |= TE_FREE_NAME;
|
||||
}
|
||||
}
|
||||
@@ -1099,28 +1099,28 @@ static int need_add_seq_dup(Sequence *seq)
|
||||
* First check backward, if we found a duplicate
|
||||
* sequence before this, don't need it, just return.
|
||||
*/
|
||||
p= seq->prev;
|
||||
p = seq->prev;
|
||||
while (p) {
|
||||
if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
|
||||
p= p->prev;
|
||||
p = p->prev;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
|
||||
return(2);
|
||||
p= p->prev;
|
||||
p = p->prev;
|
||||
}
|
||||
|
||||
p= seq->next;
|
||||
p = seq->next;
|
||||
while (p) {
|
||||
if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
|
||||
p= p->next;
|
||||
p = p->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
|
||||
return(0);
|
||||
p= p->next;
|
||||
p = p->next;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
@@ -1130,16 +1130,16 @@ static void outliner_add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *t
|
||||
/* TreeElement *ch; */ /* UNUSED */
|
||||
Sequence *p;
|
||||
|
||||
p= seq;
|
||||
p = seq;
|
||||
while (p) {
|
||||
if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
|
||||
p= p->next;
|
||||
p = p->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
|
||||
/* ch= */ /* UNUSED */ outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index);
|
||||
p= p->next;
|
||||
/* ch= */ /* UNUSED */ outliner_add_element(soops, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1156,22 +1156,22 @@ static void outliner_make_hierarchy(SpaceOops *soops, ListBase *lb)
|
||||
|
||||
/* build hierarchy */
|
||||
// XXX also, set extents here...
|
||||
te= lb->first;
|
||||
te = lb->first;
|
||||
while (te) {
|
||||
ten= te->next;
|
||||
tselem= TREESTORE(te);
|
||||
ten = te->next;
|
||||
tselem = TREESTORE(te);
|
||||
|
||||
if (tselem->type==0 && te->idcode==ID_OB) {
|
||||
Object *ob= (Object *)tselem->id;
|
||||
if (tselem->type == 0 && te->idcode == ID_OB) {
|
||||
Object *ob = (Object *)tselem->id;
|
||||
if (ob->parent && ob->parent->id.newid) {
|
||||
BLI_remlink(lb, te);
|
||||
tep= (TreeElement *)ob->parent->id.newid;
|
||||
tep = (TreeElement *)ob->parent->id.newid;
|
||||
BLI_addtail(&tep->subtree, te);
|
||||
// set correct parent pointers
|
||||
for (te=tep->subtree.first; te; te= te->next) te->parent= tep;
|
||||
for (te = tep->subtree.first; te; te = te->next) te->parent = tep;
|
||||
}
|
||||
}
|
||||
te= ten;
|
||||
te = ten;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1187,20 +1187,20 @@ typedef struct tTreeSort {
|
||||
/* alphabetical comparator */
|
||||
static int treesort_alpha(const void *v1, const void *v2)
|
||||
{
|
||||
const tTreeSort *x1= v1, *x2= v2;
|
||||
const tTreeSort *x1 = v1, *x2 = v2;
|
||||
int comp;
|
||||
|
||||
/* first put objects last (hierarchy) */
|
||||
comp= (x1->idcode==ID_OB);
|
||||
if (x2->idcode==ID_OB) comp+=2;
|
||||
comp = (x1->idcode == ID_OB);
|
||||
if (x2->idcode == ID_OB) comp += 2;
|
||||
|
||||
if (comp==1) return 1;
|
||||
else if (comp==2) return -1;
|
||||
else if (comp==3) {
|
||||
comp= strcmp(x1->name, x2->name);
|
||||
if (comp == 1) return 1;
|
||||
else if (comp == 2) return -1;
|
||||
else if (comp == 3) {
|
||||
comp = strcmp(x1->name, x2->name);
|
||||
|
||||
if ( comp>0 ) return 1;
|
||||
else if ( comp<0) return -1;
|
||||
if (comp > 0) return 1;
|
||||
else if (comp < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
@@ -1210,23 +1210,23 @@ static int treesort_alpha(const void *v1, const void *v2)
|
||||
#if 0
|
||||
static int treesort_obtype_alpha(const void *v1, const void *v2)
|
||||
{
|
||||
const tTreeSort *x1= v1, *x2= v2;
|
||||
const tTreeSort *x1 = v1, *x2 = v2;
|
||||
|
||||
/* first put objects last (hierarchy) */
|
||||
if (x1->idcode==ID_OB && x2->idcode!=ID_OB) return 1;
|
||||
else if (x2->idcode==ID_OB && x1->idcode!=ID_OB) return -1;
|
||||
if (x1->idcode == ID_OB && x2->idcode != ID_OB) return 1;
|
||||
else if (x2->idcode == ID_OB && x1->idcode != ID_OB) return -1;
|
||||
else {
|
||||
/* 2nd we check ob type */
|
||||
if (x1->idcode==ID_OB && x2->idcode==ID_OB) {
|
||||
if (x1->idcode == ID_OB && x2->idcode == ID_OB) {
|
||||
if ( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return 1;
|
||||
else if ( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return -1;
|
||||
else return 0;
|
||||
}
|
||||
else {
|
||||
int comp= strcmp(x1->name, x2->name);
|
||||
int comp = strcmp(x1->name, x2->name);
|
||||
|
||||
if ( comp>0 ) return 1;
|
||||
else if ( comp<0) return -1;
|
||||
if (comp > 0) return 1;
|
||||
else if (comp < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1238,40 +1238,40 @@ static void outliner_sort(SpaceOops *soops, ListBase *lb)
|
||||
{
|
||||
TreeElement *te;
|
||||
TreeStoreElem *tselem;
|
||||
int totelem=0;
|
||||
int totelem = 0;
|
||||
|
||||
te= lb->last;
|
||||
if (te==NULL) return;
|
||||
tselem= TREESTORE(te);
|
||||
te = lb->last;
|
||||
if (te == NULL) return;
|
||||
tselem = TREESTORE(te);
|
||||
|
||||
/* sorting rules; only object lists or deformgroups */
|
||||
if ( (tselem->type==TSE_DEFGROUP) || (tselem->type==0 && te->idcode==ID_OB)) {
|
||||
if ( (tselem->type == TSE_DEFGROUP) || (tselem->type == 0 && te->idcode == ID_OB)) {
|
||||
|
||||
/* count first */
|
||||
for (te= lb->first; te; te= te->next) totelem++;
|
||||
for (te = lb->first; te; te = te->next) totelem++;
|
||||
|
||||
if (totelem>1) {
|
||||
tTreeSort *tear= MEM_mallocN(totelem*sizeof(tTreeSort), "tree sort array");
|
||||
tTreeSort *tp=tear;
|
||||
int skip= 0;
|
||||
|
||||
for (te= lb->first; te; te= te->next, tp++) {
|
||||
tselem= TREESTORE(te);
|
||||
tp->te= te;
|
||||
tp->name= te->name;
|
||||
tp->idcode= te->idcode;
|
||||
if (tselem->type && tselem->type!=TSE_DEFGROUP) tp->idcode= 0; // don't sort this
|
||||
tp->id= tselem->id;
|
||||
if (totelem > 1) {
|
||||
tTreeSort *tear = MEM_mallocN(totelem * sizeof(tTreeSort), "tree sort array");
|
||||
tTreeSort *tp = tear;
|
||||
int skip = 0;
|
||||
|
||||
for (te = lb->first; te; te = te->next, tp++) {
|
||||
tselem = TREESTORE(te);
|
||||
tp->te = te;
|
||||
tp->name = te->name;
|
||||
tp->idcode = te->idcode;
|
||||
if (tselem->type && tselem->type != TSE_DEFGROUP) tp->idcode = 0; // don't sort this
|
||||
tp->id = tselem->id;
|
||||
}
|
||||
/* keep beginning of list */
|
||||
for (tp= tear, skip=0; skip<totelem; skip++, tp++)
|
||||
for (tp = tear, skip = 0; skip < totelem; skip++, tp++)
|
||||
if (tp->idcode) break;
|
||||
|
||||
if (skip<totelem)
|
||||
qsort(tear+skip, totelem-skip, sizeof(tTreeSort), treesort_alpha);
|
||||
if (skip < totelem)
|
||||
qsort(tear + skip, totelem - skip, sizeof(tTreeSort), treesort_alpha);
|
||||
|
||||
lb->first=lb->last= NULL;
|
||||
tp= tear;
|
||||
lb->first = lb->last = NULL;
|
||||
tp = tear;
|
||||
while (totelem--) {
|
||||
BLI_addtail(lb, tp->te);
|
||||
tp++;
|
||||
@@ -1280,7 +1280,7 @@ static void outliner_sort(SpaceOops *soops, ListBase *lb)
|
||||
}
|
||||
}
|
||||
|
||||
for (te= lb->first; te; te= te->next) {
|
||||
for (te = lb->first; te; te = te->next) {
|
||||
outliner_sort(soops, &te->subtree);
|
||||
}
|
||||
}
|
||||
@@ -1290,36 +1290,36 @@ static void outliner_sort(SpaceOops *soops, ListBase *lb)
|
||||
static int outliner_filter_has_name(TreeElement *te, const char *name, int flags)
|
||||
{
|
||||
#if 0
|
||||
int found= 0;
|
||||
int found = 0;
|
||||
|
||||
/* determine if match */
|
||||
if (flags & SO_FIND_CASE_SENSITIVE) {
|
||||
if (flags & SO_FIND_COMPLETE)
|
||||
found= strcmp(te->name, name) == 0;
|
||||
found = strcmp(te->name, name) == 0;
|
||||
else
|
||||
found= strstr(te->name, name) != NULL;
|
||||
found = strstr(te->name, name) != NULL;
|
||||
}
|
||||
else {
|
||||
if (flags & SO_FIND_COMPLETE)
|
||||
found= BLI_strcasecmp(te->name, name) == 0;
|
||||
found = BLI_strcasecmp(te->name, name) == 0;
|
||||
else
|
||||
found= BLI_strcasestr(te->name, name) != NULL;
|
||||
found = BLI_strcasestr(te->name, name) != NULL;
|
||||
}
|
||||
#else
|
||||
|
||||
int fn_flag= 0;
|
||||
int found= 0;
|
||||
int fn_flag = 0;
|
||||
int found = 0;
|
||||
|
||||
if ((flags & SO_FIND_CASE_SENSITIVE) == 0)
|
||||
fn_flag |= FNM_CASEFOLD;
|
||||
|
||||
if (flags & SO_FIND_COMPLETE) {
|
||||
found= fnmatch(name, te->name, fn_flag)==0;
|
||||
found = fnmatch(name, te->name, fn_flag) == 0;
|
||||
}
|
||||
else {
|
||||
char fn_name[sizeof(((struct SpaceOops *)NULL)->search_string) + 2];
|
||||
BLI_snprintf(fn_name, sizeof(fn_name), "*%s*", name);
|
||||
found= fnmatch(fn_name, te->name, fn_flag)==0;
|
||||
found = fnmatch(fn_name, te->name, fn_flag) == 0;
|
||||
}
|
||||
return found;
|
||||
#endif
|
||||
@@ -1333,25 +1333,25 @@ static int outliner_filter_tree(SpaceOops *soops, ListBase *lb)
|
||||
/* although we don't have any search string, we return TRUE
|
||||
* since the entire tree is ok then...
|
||||
*/
|
||||
if (soops->search_string[0]==0)
|
||||
if (soops->search_string[0] == 0)
|
||||
return 1;
|
||||
|
||||
for (te= lb->first; te; te= ten) {
|
||||
ten= te->next;
|
||||
for (te = lb->first; te; te = ten) {
|
||||
ten = te->next;
|
||||
|
||||
if (0==outliner_filter_has_name(te, soops->search_string, soops->search_flags)) {
|
||||
if (0 == outliner_filter_has_name(te, soops->search_string, soops->search_flags)) {
|
||||
/* item isn't something we're looking for, but...
|
||||
* - if the subtree is expanded, check if there are any matches that can be easily found
|
||||
* - if the subtree is expanded, check if there are any matches that can be easily found
|
||||
* so that searching for "cu" in the default scene will still match the Cube
|
||||
* - otherwise, we can't see within the subtree and the item doesn't match,
|
||||
* so these can be safely ignored (i.e. the subtree can get freed)
|
||||
*/
|
||||
tselem= TREESTORE(te);
|
||||
tselem = TREESTORE(te);
|
||||
|
||||
/* flag as not a found item */
|
||||
tselem->flag &= ~TSE_SEARCHMATCH;
|
||||
|
||||
if ((!TSELEM_OPEN(tselem, soops)) || outliner_filter_tree(soops, &te->subtree)==0) {
|
||||
if ((!TSELEM_OPEN(tselem, soops)) || outliner_filter_tree(soops, &te->subtree) == 0) {
|
||||
outliner_free_tree(&te->subtree);
|
||||
BLI_remlink(lb, te);
|
||||
|
||||
@@ -1360,7 +1360,7 @@ static int outliner_filter_tree(SpaceOops *soops, ListBase *lb)
|
||||
}
|
||||
}
|
||||
else {
|
||||
tselem= TREESTORE(te);
|
||||
tselem = TREESTORE(te);
|
||||
|
||||
/* flag as a found item - we can then highlight it */
|
||||
tselem->flag |= TSE_SEARCHMATCH;
|
||||
@@ -1383,14 +1383,14 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
|
||||
{
|
||||
Base *base;
|
||||
Object *ob;
|
||||
TreeElement *te=NULL, *ten;
|
||||
TreeElement *te = NULL, *ten;
|
||||
TreeStoreElem *tselem;
|
||||
int show_opened= (soops->treestore==NULL); /* on first view, we open scenes */
|
||||
int show_opened = (soops->treestore == NULL); /* on first view, we open scenes */
|
||||
|
||||
/* Are we looking for something - we want to tag parents to filter child matches
|
||||
* - NOT in datablocks view - searching all datablocks takes way too long to be useful
|
||||
* - this variable is only set once per tree build */
|
||||
if (soops->search_string[0]!=0 && soops->outlinevis!=SO_DATABLOCKS)
|
||||
if (soops->search_string[0] != 0 && soops->outlinevis != SO_DATABLOCKS)
|
||||
soops->search_flags |= SO_SEARCH_RECURSIVE;
|
||||
else
|
||||
soops->search_flags &= ~SO_SEARCH_RECURSIVE;
|
||||
@@ -1402,64 +1402,64 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
|
||||
outliner_storage_cleanup(soops);
|
||||
|
||||
/* clear ob id.new flags */
|
||||
for (ob= mainvar->object.first; ob; ob= ob->id.next) ob->id.newid= NULL;
|
||||
for (ob = mainvar->object.first; ob; ob = ob->id.next) ob->id.newid = NULL;
|
||||
|
||||
/* options */
|
||||
if (soops->outlinevis == SO_LIBRARIES) {
|
||||
Library *lib;
|
||||
|
||||
for (lib= mainvar->library.first; lib; lib= lib->id.next) {
|
||||
ten= outliner_add_element(soops, &soops->tree, lib, NULL, 0, 0);
|
||||
lib->id.newid= (ID *)ten;
|
||||
for (lib = mainvar->library.first; lib; lib = lib->id.next) {
|
||||
ten = outliner_add_element(soops, &soops->tree, lib, NULL, 0, 0);
|
||||
lib->id.newid = (ID *)ten;
|
||||
}
|
||||
/* make hierarchy */
|
||||
ten= soops->tree.first;
|
||||
ten = soops->tree.first;
|
||||
while (ten) {
|
||||
TreeElement *nten= ten->next, *par;
|
||||
tselem= TREESTORE(ten);
|
||||
lib= (Library *)tselem->id;
|
||||
TreeElement *nten = ten->next, *par;
|
||||
tselem = TREESTORE(ten);
|
||||
lib = (Library *)tselem->id;
|
||||
if (lib->parent) {
|
||||
BLI_remlink(&soops->tree, ten);
|
||||
par= (TreeElement *)lib->parent->id.newid;
|
||||
par = (TreeElement *)lib->parent->id.newid;
|
||||
BLI_addtail(&par->subtree, ten);
|
||||
ten->parent= par;
|
||||
ten->parent = par;
|
||||
}
|
||||
ten= nten;
|
||||
ten = nten;
|
||||
}
|
||||
/* restore newid pointers */
|
||||
for (lib= mainvar->library.first; lib; lib= lib->id.next)
|
||||
lib->id.newid= NULL;
|
||||
for (lib = mainvar->library.first; lib; lib = lib->id.next)
|
||||
lib->id.newid = NULL;
|
||||
|
||||
}
|
||||
else if (soops->outlinevis == SO_ALL_SCENES) {
|
||||
Scene *sce;
|
||||
for (sce= mainvar->scene.first; sce; sce= sce->id.next) {
|
||||
te= outliner_add_element(soops, &soops->tree, sce, NULL, 0, 0);
|
||||
tselem= TREESTORE(te);
|
||||
if (sce==scene && show_opened)
|
||||
for (sce = mainvar->scene.first; sce; sce = sce->id.next) {
|
||||
te = outliner_add_element(soops, &soops->tree, sce, NULL, 0, 0);
|
||||
tselem = TREESTORE(te);
|
||||
if (sce == scene && show_opened)
|
||||
tselem->flag &= ~TSE_CLOSED;
|
||||
|
||||
for (base= sce->base.first; base; base= base->next) {
|
||||
ten= outliner_add_element(soops, &te->subtree, base->object, te, 0, 0);
|
||||
ten->directdata= base;
|
||||
for (base = sce->base.first; base; base = base->next) {
|
||||
ten = outliner_add_element(soops, &te->subtree, base->object, te, 0, 0);
|
||||
ten->directdata = base;
|
||||
}
|
||||
outliner_make_hierarchy(soops, &te->subtree);
|
||||
/* clear id.newid, to prevent objects be inserted in wrong scenes (parent in other scene) */
|
||||
for (base= sce->base.first; base; base= base->next) base->object->id.newid= NULL;
|
||||
for (base = sce->base.first; base; base = base->next) base->object->id.newid = NULL;
|
||||
}
|
||||
}
|
||||
else if (soops->outlinevis == SO_CUR_SCENE) {
|
||||
|
||||
outliner_add_scene_contents(soops, &soops->tree, scene, NULL);
|
||||
|
||||
for (base= scene->base.first; base; base= base->next) {
|
||||
ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
|
||||
ten->directdata= base;
|
||||
for (base = scene->base.first; base; base = base->next) {
|
||||
ten = outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
|
||||
ten->directdata = base;
|
||||
}
|
||||
outliner_make_hierarchy(soops, &soops->tree);
|
||||
}
|
||||
else if (soops->outlinevis == SO_VISIBLE) {
|
||||
for (base= scene->base.first; base; base= base->next) {
|
||||
for (base = scene->base.first; base; base = base->next) {
|
||||
if (base->lay & scene->lay)
|
||||
outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
|
||||
}
|
||||
@@ -1469,102 +1469,102 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
|
||||
Group *group;
|
||||
GroupObject *go;
|
||||
|
||||
for (group= mainvar->group.first; group; group= group->id.next) {
|
||||
for (group = mainvar->group.first; group; group = group->id.next) {
|
||||
if (group->gobject.first) {
|
||||
te= outliner_add_element(soops, &soops->tree, group, NULL, 0, 0);
|
||||
te = outliner_add_element(soops, &soops->tree, group, NULL, 0, 0);
|
||||
|
||||
for (go= group->gobject.first; go; go= go->next) {
|
||||
ten= outliner_add_element(soops, &te->subtree, go->ob, te, 0, 0);
|
||||
ten->directdata= NULL; /* eh, why? */
|
||||
for (go = group->gobject.first; go; go = go->next) {
|
||||
ten = outliner_add_element(soops, &te->subtree, go->ob, te, 0, 0);
|
||||
ten->directdata = NULL; /* eh, why? */
|
||||
}
|
||||
outliner_make_hierarchy(soops, &te->subtree);
|
||||
/* clear id.newid, to prevent objects be inserted in wrong scenes (parent in other scene) */
|
||||
for (go= group->gobject.first; go; go= go->next) go->ob->id.newid= NULL;
|
||||
for (go = group->gobject.first; go; go = go->next) go->ob->id.newid = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (soops->outlinevis == SO_SAME_TYPE) {
|
||||
Object *ob= OBACT;
|
||||
Object *ob = OBACT;
|
||||
if (ob) {
|
||||
for (base= scene->base.first; base; base= base->next) {
|
||||
if (base->object->type==ob->type) {
|
||||
ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
|
||||
ten->directdata= base;
|
||||
for (base = scene->base.first; base; base = base->next) {
|
||||
if (base->object->type == ob->type) {
|
||||
ten = outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
|
||||
ten->directdata = base;
|
||||
}
|
||||
}
|
||||
outliner_make_hierarchy(soops, &soops->tree);
|
||||
}
|
||||
}
|
||||
else if (soops->outlinevis == SO_SELECTED) {
|
||||
for (base= scene->base.first; base; base= base->next) {
|
||||
for (base = scene->base.first; base; base = base->next) {
|
||||
if (base->lay & scene->lay) {
|
||||
if (base==BASACT || (base->flag & SELECT)) {
|
||||
ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
|
||||
ten->directdata= base;
|
||||
if (base == BASACT || (base->flag & SELECT)) {
|
||||
ten = outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
|
||||
ten->directdata = base;
|
||||
}
|
||||
}
|
||||
}
|
||||
outliner_make_hierarchy(soops, &soops->tree);
|
||||
}
|
||||
else if (soops->outlinevis==SO_SEQUENCE) {
|
||||
else if (soops->outlinevis == SO_SEQUENCE) {
|
||||
Sequence *seq;
|
||||
Editing *ed= seq_give_editing(scene, FALSE);
|
||||
Editing *ed = seq_give_editing(scene, FALSE);
|
||||
int op;
|
||||
|
||||
if (ed==NULL)
|
||||
if (ed == NULL)
|
||||
return;
|
||||
|
||||
seq= ed->seqbasep->first;
|
||||
seq = ed->seqbasep->first;
|
||||
if (!seq)
|
||||
return;
|
||||
|
||||
while (seq) {
|
||||
op= need_add_seq_dup(seq);
|
||||
if (op==1) {
|
||||
/* ten= */ outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE, 0);
|
||||
op = need_add_seq_dup(seq);
|
||||
if (op == 1) {
|
||||
/* ten= */ outliner_add_element(soops, &soops->tree, (void *)seq, NULL, TSE_SEQUENCE, 0);
|
||||
}
|
||||
else if (op==0) {
|
||||
ten= outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE_DUP, 0);
|
||||
else if (op == 0) {
|
||||
ten = outliner_add_element(soops, &soops->tree, (void *)seq, NULL, TSE_SEQUENCE_DUP, 0);
|
||||
outliner_add_seq_dup(soops, seq, ten, 0);
|
||||
}
|
||||
seq= seq->next;
|
||||
seq = seq->next;
|
||||
}
|
||||
}
|
||||
else if (soops->outlinevis==SO_DATABLOCKS) {
|
||||
else if (soops->outlinevis == SO_DATABLOCKS) {
|
||||
PointerRNA mainptr;
|
||||
|
||||
RNA_main_pointer_create(mainvar, &mainptr);
|
||||
|
||||
ten= outliner_add_element(soops, &soops->tree, (void*)&mainptr, NULL, TSE_RNA_STRUCT, -1);
|
||||
ten = outliner_add_element(soops, &soops->tree, (void *)&mainptr, NULL, TSE_RNA_STRUCT, -1);
|
||||
|
||||
if (show_opened) {
|
||||
tselem= TREESTORE(ten);
|
||||
tselem = TREESTORE(ten);
|
||||
tselem->flag &= ~TSE_CLOSED;
|
||||
}
|
||||
}
|
||||
else if (soops->outlinevis==SO_USERDEF) {
|
||||
else if (soops->outlinevis == SO_USERDEF) {
|
||||
PointerRNA userdefptr;
|
||||
|
||||
RNA_pointer_create(NULL, &RNA_UserPreferences, &U, &userdefptr);
|
||||
|
||||
ten= outliner_add_element(soops, &soops->tree, (void*)&userdefptr, NULL, TSE_RNA_STRUCT, -1);
|
||||
ten = outliner_add_element(soops, &soops->tree, (void *)&userdefptr, NULL, TSE_RNA_STRUCT, -1);
|
||||
|
||||
if (show_opened) {
|
||||
tselem= TREESTORE(ten);
|
||||
tselem = TREESTORE(ten);
|
||||
tselem->flag &= ~TSE_CLOSED;
|
||||
}
|
||||
}
|
||||
else if (soops->outlinevis==SO_KEYMAP) {
|
||||
wmWindowManager *wm= mainvar->wm.first;
|
||||
else if (soops->outlinevis == SO_KEYMAP) {
|
||||
wmWindowManager *wm = mainvar->wm.first;
|
||||
wmKeyMap *km;
|
||||
|
||||
for (km= wm->defaultconf->keymaps.first; km; km= km->next) {
|
||||
/* ten= */ outliner_add_element(soops, &soops->tree, (void*)km, NULL, TSE_KEYMAP, 0);
|
||||
for (km = wm->defaultconf->keymaps.first; km; km = km->next) {
|
||||
/* ten= */ outliner_add_element(soops, &soops->tree, (void *)km, NULL, TSE_KEYMAP, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ten= outliner_add_element(soops, &soops->tree, OBACT, NULL, 0, 0);
|
||||
if (ten) ten->directdata= BASACT;
|
||||
ten = outliner_add_element(soops, &soops->tree, OBACT, NULL, 0, 0);
|
||||
if (ten) ten->directdata = BASACT;
|
||||
}
|
||||
|
||||
outliner_sort(soops, &soops->tree);
|
||||
|
||||
@@ -77,20 +77,20 @@ static void outliner_main_area_init(wmWindowManager *wm, ARegion *ar)
|
||||
|
||||
static int outliner_parent_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
|
||||
{
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
TreeElement *te= NULL;
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
TreeElement *te = NULL;
|
||||
float fmval[2];
|
||||
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
|
||||
|
||||
if (drag->type == WM_DRAG_ID) {
|
||||
ID *id = (ID *)drag->poin;
|
||||
if ( GS(id->name) == ID_OB ) {
|
||||
if (GS(id->name) == ID_OB) {
|
||||
/* Ensure item under cursor is valid drop target */
|
||||
/* Find object hovered over */
|
||||
for (te= soops->tree.first; te; te= te->next) {
|
||||
for (te = soops->tree.first; te; te = te->next) {
|
||||
TreeElement *te_valid;
|
||||
te_valid= outliner_dropzone_parent(C, event, te, fmval);
|
||||
te_valid = outliner_dropzone_parent(C, event, te, fmval);
|
||||
if (te_valid) return 1;
|
||||
}
|
||||
}
|
||||
@@ -102,30 +102,30 @@ static void outliner_parent_drop_copy(wmDrag *drag, wmDropBox *drop)
|
||||
{
|
||||
ID *id = (ID *)drag->poin;
|
||||
|
||||
RNA_string_set(drop->ptr, "child", id->name+2);
|
||||
RNA_string_set(drop->ptr, "child", id->name + 2);
|
||||
}
|
||||
|
||||
static int outliner_parent_clear_poll(bContext *C, wmDrag *drag, wmEvent *event)
|
||||
{
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
SpaceOops *soops= CTX_wm_space_outliner(C);
|
||||
TreeElement *te= NULL;
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
TreeElement *te = NULL;
|
||||
float fmval[2];
|
||||
|
||||
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
|
||||
|
||||
if (drag->type == WM_DRAG_ID) {
|
||||
ID *id = (ID *)drag->poin;
|
||||
if ( GS(id->name) == ID_OB ) {
|
||||
if (GS(id->name) == ID_OB) {
|
||||
//TODO: Check if no parent?
|
||||
/* Ensure location under cursor is valid dropzone */
|
||||
for (te= soops->tree.first; te; te= te->next) {
|
||||
for (te = soops->tree.first; te; te = te->next) {
|
||||
if (outliner_dropzone_parent_clear(C, event, te, fmval)) return 1;
|
||||
}
|
||||
/* Check if mouse cursor is below the tree */
|
||||
te= soops->tree.last;
|
||||
while (((te->flag & TE_LAZY_CLOSED)==0) && (te->subtree.last)) {
|
||||
te= te->subtree.last;
|
||||
te = soops->tree.last;
|
||||
while (((te->flag & TE_LAZY_CLOSED) == 0) && (te->subtree.last)) {
|
||||
te = te->subtree.last;
|
||||
}
|
||||
if (fmval[1] < te->ys) return 1;
|
||||
}
|
||||
@@ -136,7 +136,7 @@ static int outliner_parent_clear_poll(bContext *C, wmDrag *drag, wmEvent *event)
|
||||
static void outliner_parent_clear_copy(wmDrag *drag, wmDropBox *drop)
|
||||
{
|
||||
ID *id = (ID *)drag->poin;
|
||||
RNA_string_set(drop->ptr, "dragged_obj", id->name+2);
|
||||
RNA_string_set(drop->ptr, "dragged_obj", id->name + 2);
|
||||
|
||||
/* Set to simple parent clear type. Avoid menus for drag and drop if possible.
|
||||
* If desired, user can toggle the different "Clear Parent" types in the operator
|
||||
@@ -155,7 +155,7 @@ static void outliner_dropboxes(void)
|
||||
|
||||
static void outliner_main_area_draw(const bContext *C, ARegion *ar)
|
||||
{
|
||||
View2D *v2d= &ar->v2d;
|
||||
View2D *v2d = &ar->v2d;
|
||||
View2DScrollers *scrollers;
|
||||
|
||||
/* clear */
|
||||
@@ -168,7 +168,7 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar)
|
||||
UI_view2d_view_restore(C);
|
||||
|
||||
/* scrollers */
|
||||
scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
|
||||
scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
|
||||
UI_view2d_scrollers_draw(C, v2d, scrollers);
|
||||
UI_view2d_scrollers_free(scrollers);
|
||||
}
|
||||
@@ -234,11 +234,11 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
|
||||
/* For updating lamp icons, when changing lamp type */
|
||||
if (wmn->data == ND_LIGHTING_DRAW)
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
break;
|
||||
case NC_SPACE:
|
||||
if (wmn->data == ND_SPACE_OUTLINER)
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
break;
|
||||
case NC_ID:
|
||||
if (wmn->action == NA_RENAME)
|
||||
ED_region_tag_redraw(ar);
|
||||
@@ -269,7 +269,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
case ND_ANIMCHAN:
|
||||
if (wmn->action==NA_SELECTED)
|
||||
if (wmn->action == NA_SELECTED)
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
}
|
||||
@@ -318,35 +318,35 @@ static SpaceLink *outliner_new(const bContext *UNUSED(C))
|
||||
ARegion *ar;
|
||||
SpaceOops *soutliner;
|
||||
|
||||
soutliner= MEM_callocN(sizeof(SpaceOops), "initoutliner");
|
||||
soutliner->spacetype= SPACE_OUTLINER;
|
||||
soutliner = MEM_callocN(sizeof(SpaceOops), "initoutliner");
|
||||
soutliner->spacetype = SPACE_OUTLINER;
|
||||
|
||||
/* header */
|
||||
ar= MEM_callocN(sizeof(ARegion), "header for outliner");
|
||||
ar = MEM_callocN(sizeof(ARegion), "header for outliner");
|
||||
|
||||
BLI_addtail(&soutliner->regionbase, ar);
|
||||
ar->regiontype= RGN_TYPE_HEADER;
|
||||
ar->alignment= RGN_ALIGN_BOTTOM;
|
||||
ar->regiontype = RGN_TYPE_HEADER;
|
||||
ar->alignment = RGN_ALIGN_BOTTOM;
|
||||
|
||||
/* main area */
|
||||
ar= MEM_callocN(sizeof(ARegion), "main area for outliner");
|
||||
ar = MEM_callocN(sizeof(ARegion), "main area for outliner");
|
||||
|
||||
BLI_addtail(&soutliner->regionbase, ar);
|
||||
ar->regiontype= RGN_TYPE_WINDOW;
|
||||
ar->regiontype = RGN_TYPE_WINDOW;
|
||||
|
||||
ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM_O);
|
||||
ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
|
||||
ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
|
||||
ar->v2d.keeptot= V2D_KEEPTOT_STRICT;
|
||||
ar->v2d.minzoom= ar->v2d.maxzoom= 1.0f;
|
||||
ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM_O);
|
||||
ar->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
|
||||
ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
|
||||
ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
|
||||
ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
|
||||
|
||||
return (SpaceLink*)soutliner;
|
||||
return (SpaceLink *)soutliner;
|
||||
}
|
||||
|
||||
/* not spacelink itself */
|
||||
static void outliner_free(SpaceLink *sl)
|
||||
{
|
||||
SpaceOops *soutliner= (SpaceOops*)sl;
|
||||
SpaceOops *soutliner = (SpaceOops *)sl;
|
||||
|
||||
outliner_free_tree(&soutliner->tree);
|
||||
if (soutliner->treestore) {
|
||||
@@ -364,11 +364,11 @@ static void outliner_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
|
||||
|
||||
static SpaceLink *outliner_duplicate(SpaceLink *sl)
|
||||
{
|
||||
SpaceOops *soutliner= (SpaceOops *)sl;
|
||||
SpaceOops *soutlinern= MEM_dupallocN(soutliner);
|
||||
SpaceOops *soutliner = (SpaceOops *)sl;
|
||||
SpaceOops *soutlinern = MEM_dupallocN(soutliner);
|
||||
|
||||
soutlinern->tree.first= soutlinern->tree.last= NULL;
|
||||
soutlinern->treestore= NULL;
|
||||
soutlinern->tree.first = soutlinern->tree.last = NULL;
|
||||
soutlinern->treestore = NULL;
|
||||
|
||||
return (SpaceLink *)soutlinern;
|
||||
}
|
||||
@@ -376,41 +376,41 @@ static SpaceLink *outliner_duplicate(SpaceLink *sl)
|
||||
/* only called once, from space_api/spacetypes.c */
|
||||
void ED_spacetype_outliner(void)
|
||||
{
|
||||
SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype time");
|
||||
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype time");
|
||||
ARegionType *art;
|
||||
|
||||
st->spaceid= SPACE_OUTLINER;
|
||||
st->spaceid = SPACE_OUTLINER;
|
||||
strncpy(st->name, "Outliner", BKE_ST_MAXNAME);
|
||||
|
||||
st->new= outliner_new;
|
||||
st->free= outliner_free;
|
||||
st->init= outliner_init;
|
||||
st->duplicate= outliner_duplicate;
|
||||
st->operatortypes= outliner_operatortypes;
|
||||
st->keymap= outliner_keymap;
|
||||
st->dropboxes= outliner_dropboxes;
|
||||
st->new = outliner_new;
|
||||
st->free = outliner_free;
|
||||
st->init = outliner_init;
|
||||
st->duplicate = outliner_duplicate;
|
||||
st->operatortypes = outliner_operatortypes;
|
||||
st->keymap = outliner_keymap;
|
||||
st->dropboxes = outliner_dropboxes;
|
||||
|
||||
/* regions: main window */
|
||||
art= MEM_callocN(sizeof(ARegionType), "spacetype time region");
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype time region");
|
||||
art->regionid = RGN_TYPE_WINDOW;
|
||||
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
|
||||
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D;
|
||||
|
||||
art->init= outliner_main_area_init;
|
||||
art->draw= outliner_main_area_draw;
|
||||
art->free= outliner_main_area_free;
|
||||
art->listener= outliner_main_area_listener;
|
||||
art->init = outliner_main_area_init;
|
||||
art->draw = outliner_main_area_draw;
|
||||
art->free = outliner_main_area_free;
|
||||
art->listener = outliner_main_area_listener;
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* regions: header */
|
||||
art= MEM_callocN(sizeof(ARegionType), "spacetype time region");
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype time region");
|
||||
art->regionid = RGN_TYPE_HEADER;
|
||||
art->prefsizey= HEADERY;
|
||||
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
|
||||
art->prefsizey = HEADERY;
|
||||
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
|
||||
|
||||
art->init= outliner_header_area_init;
|
||||
art->draw= outliner_header_area_draw;
|
||||
art->free= outliner_header_area_free;
|
||||
art->listener= outliner_header_area_listener;
|
||||
art->init = outliner_header_area_init;
|
||||
art->draw = outliner_header_area_draw;
|
||||
art->free = outliner_header_area_free;
|
||||
art->listener = outliner_header_area_listener;
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
BKE_spacetype_register(st);
|
||||
|
||||
@@ -2304,7 +2304,7 @@ void VIEW3D_OT_view_lock_clear(wmOperatorType *ot)
|
||||
|
||||
/* identifiers */
|
||||
ot->name = "View Lock Clear";
|
||||
ot->description = "Clears all view locking";
|
||||
ot->description = "Clear all view locking";
|
||||
ot->idname = "VIEW3D_OT_view_lock_clear";
|
||||
|
||||
/* api callbacks */
|
||||
|
||||
@@ -507,8 +507,8 @@ static void rna_def_lamp_shadow(StructRNA *srna, int spot, int area)
|
||||
|
||||
static EnumPropertyItem prop_numbuffer_items[] = {
|
||||
{1, "BUFFERS_1", 0, "1", "Only one buffer rendered"},
|
||||
{4, "BUFFERS_4", 0, "4", "Renders 4 buffers for better AA, this quadruples memory usage"},
|
||||
{9, "BUFFERS_9", 0, "9", "Renders 9 buffers for better AA, this uses nine times more memory"},
|
||||
{4, "BUFFERS_4", 0, "4", "Render 4 buffers for better AA, this quadruples memory usage"},
|
||||
{9, "BUFFERS_9", 0, "9", "Render 9 buffers for better AA, this uses nine times more memory"},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
/* GE only */
|
||||
|
||||
@@ -707,7 +707,7 @@ static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
|
||||
Scene *scene = ptr->id.data;
|
||||
RenderData *rd = &scene->r;
|
||||
#ifdef WITH_FFMPEG
|
||||
ffmpeg_verify_image_type(rd, imf);
|
||||
BKE_ffmpeg_image_type_verify(rd, imf);
|
||||
#endif
|
||||
#ifdef WITH_QUICKTIME
|
||||
quicktime_verify_image_type(rd, imf);
|
||||
@@ -750,7 +750,7 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *C, P
|
||||
Scene *scene = ptr->id.data;
|
||||
RenderData *rd = &scene->r;
|
||||
|
||||
if (ffmpeg_alpha_channel_supported(rd))
|
||||
if (BKE_ffmpeg_alpha_channel_is_supported(rd))
|
||||
chan_flag |= IMA_CHAN_FLAG_ALPHA;
|
||||
}
|
||||
#endif
|
||||
@@ -941,7 +941,7 @@ static void rna_FFmpegSettings_lossless_output_set(PointerRNA *ptr, int value)
|
||||
else
|
||||
rd->ffcodecdata.flags &= ~FFMPEG_LOSSLESS_OUTPUT;
|
||||
|
||||
ffmpeg_verify_codec_settings(rd);
|
||||
BKE_ffmpeg_codec_settings_verify(rd);
|
||||
}
|
||||
|
||||
static void rna_FFmpegSettings_codec_settings_update(Main *UNUSED(bmain), Scene *UNUSED(scene_unused), PointerRNA *ptr)
|
||||
@@ -949,7 +949,7 @@ static void rna_FFmpegSettings_codec_settings_update(Main *UNUSED(bmain), Scene
|
||||
Scene *scene = (Scene *) ptr->id.data;
|
||||
RenderData *rd = &scene->r;
|
||||
|
||||
ffmpeg_verify_codec_settings(rd);
|
||||
BKE_ffmpeg_codec_settings_verify(rd);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ static void rna_Scene_update_tagged(Scene *scene)
|
||||
static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name)
|
||||
{
|
||||
if (BKE_imtype_is_movie(rd->im_format.imtype))
|
||||
BKE_makeanimstring(name, rd);
|
||||
BKE_movie_filepath_get(name, rd);
|
||||
else
|
||||
BKE_makepicstring(name, rd->pic, G.main->name, (frame == INT_MIN) ? rd->cfra : frame, rd->im_format.imtype,
|
||||
rd->scemode & R_EXTENSION, TRUE);
|
||||
|
||||
@@ -474,16 +474,16 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
||||
|
||||
/* just added, calc the normal */
|
||||
BLI_array_empty(face_angles);
|
||||
BLI_array_reserve(face_angles, mp->totloop);
|
||||
for (j = 0, ml = mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
|
||||
MLoop *ml_prev = ME_POLY_LOOP_PREV(mloop, mp, j);
|
||||
MLoop *ml_next = ME_POLY_LOOP_NEXT(mloop, mp, j);
|
||||
|
||||
float e1[3], e2[3], angle;
|
||||
|
||||
float e1[3], e2[3];
|
||||
|
||||
sub_v3_v3v3(e1, mvert[ml_next->v].co, mvert[ml->v].co);
|
||||
sub_v3_v3v3(e2, mvert[ml_prev->v].co, mvert[ml->v].co);
|
||||
angle = M_PI - angle_normalized_v3v3(e1, e2);
|
||||
BLI_array_append(face_angles, angle);
|
||||
face_angles[j] = (float)M_PI - angle_v3v3(e1, e2);
|
||||
}
|
||||
|
||||
for (j = 0, ml = mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
|
||||
|
||||
@@ -2131,7 +2131,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
|
||||
/* saves images to disk */
|
||||
void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_override, unsigned int lay, int sfra, int efra, int tfra)
|
||||
{
|
||||
bMovieHandle *mh= BKE_get_movie_handle(scene->r.im_format.imtype);
|
||||
bMovieHandle *mh= BKE_movie_handle_get(scene->r.im_format.imtype);
|
||||
int cfrao= scene->r.cfra;
|
||||
int nfra, totrendered= 0, totskipped= 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user