forked from bartvdbraak/blender
Merging r50522 through r50572 from trunk into soc-2011-tomato
This commit is contained in:
parent
4f9ee399c0
commit
de7a57a242
@ -27,7 +27,10 @@ macro(list_insert_after
|
||||
list_id item_check item_add
|
||||
)
|
||||
set(_index)
|
||||
list(FIND ${list_id} "${item_check}" _index)
|
||||
list(FIND "${list_id}" "${item_check}" _index)
|
||||
if("${_index}" MATCHES "-1")
|
||||
message(FATAL_ERROR "'${list_id}' doesn't contain '${item_check}'")
|
||||
endif()
|
||||
math(EXPR _index "${_index} + 1")
|
||||
list(INSERT ${list_id} "${_index}" ${item_add})
|
||||
unset(_index)
|
||||
@ -37,7 +40,10 @@ macro(list_insert_before
|
||||
list_id item_check item_add
|
||||
)
|
||||
set(_index)
|
||||
list(FIND ${list_id} "${item_check}" _index)
|
||||
list(FIND "${list_id}" "${item_check}" _index)
|
||||
if("${_index}" MATCHES "-1")
|
||||
message(FATAL_ERROR "'${list_id}' doesn't contain '${item_check}'")
|
||||
endif()
|
||||
list(INSERT ${list_id} "${_index}" ${item_add})
|
||||
unset(_index)
|
||||
endmacro()
|
||||
|
5
extern/libmv/third_party/ceres/SConscript
vendored
5
extern/libmv/third_party/ceres/SConscript
vendored
@ -25,6 +25,11 @@ defs.append('CERES_RESTRICT_SCHUR_SPECIALIZATION')
|
||||
|
||||
incs = '. ../../ ../../../Eigen3 ./include ./internal ../gflags'
|
||||
|
||||
# work around broken hashtable in 10.5 SDK
|
||||
if env['OURPLATFORM'] == 'darwin' and env['WITH_BF_BOOST']:
|
||||
incs += ' ' + env['BF_BOOST_INC']
|
||||
defs.append('CERES_HASH_BOOST')
|
||||
|
||||
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
|
||||
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
|
||||
incs += ' ../msinttypes'
|
||||
|
@ -33,6 +33,10 @@
|
||||
#ifndef CERES_INTERNAL_COLLECTIONS_PORT_H_
|
||||
#define CERES_INTERNAL_COLLECTIONS_PORT_H_
|
||||
|
||||
#ifdef CERES_HASH_BOOST
|
||||
#include <boost/tr1/unordered_map.hpp>
|
||||
#include <boost/tr1/unordered_set.hpp>
|
||||
#else
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1700
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
@ -40,6 +44,8 @@
|
||||
#include <tr1/unordered_map>
|
||||
#include <tr1/unordered_set>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <utility>
|
||||
#include "ceres/integral_types.h"
|
||||
#include "ceres/internal/port.h"
|
||||
@ -118,7 +124,11 @@ CERES_HASH_NAMESPACE_START
|
||||
|
||||
// Hasher for STL pairs. Requires hashers for both members to be defined.
|
||||
template<typename T>
|
||||
#ifdef CERES_HASH_BOOST
|
||||
struct hash {
|
||||
#else
|
||||
struct hash<pair<T, T> > {
|
||||
#endif
|
||||
size_t operator()(const pair<T, T>& p) const {
|
||||
size_t h1 = hash<T>()(p.first);
|
||||
size_t h2 = hash<T>()(p.second);
|
||||
|
@ -53,19 +53,20 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
|
||||
|
||||
scene = context.scene
|
||||
cscene = scene.cycles
|
||||
device_type = context.user_preferences.system.compute_device_type
|
||||
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
sub = col.column()
|
||||
sub.active = cscene.device == 'CPU'
|
||||
sub.enabled = (device_type == 'NONE' or cscene.device == 'CPU')
|
||||
sub.prop(cscene, "progressive")
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.prop(cscene, "seed")
|
||||
sub.prop(cscene, "sample_clamp")
|
||||
|
||||
if cscene.progressive or cscene.device != 'CPU':
|
||||
if cscene.progressive or (device_type != 'NONE' and cscene.device == 'GPU'):
|
||||
col = split.column()
|
||||
col.label(text="Samples:")
|
||||
sub = col.column(align=True)
|
||||
|
@ -372,6 +372,12 @@ void BlenderSession::synchronize()
|
||||
return;
|
||||
}
|
||||
|
||||
/* if the session is still resetting the device come back later */
|
||||
if(session->resetting()) {
|
||||
tag_update();
|
||||
return;
|
||||
}
|
||||
|
||||
/* increase samples, but never decrease */
|
||||
session->set_samples(session_params.samples);
|
||||
session->set_pause(BlenderSync::get_session_pause(b_scene, background));
|
||||
|
@ -115,6 +115,7 @@ public:
|
||||
virtual void task_add(DeviceTask& task) = 0;
|
||||
virtual void task_wait() = 0;
|
||||
virtual void task_cancel() = 0;
|
||||
virtual bool task_cancelled() = 0;
|
||||
|
||||
/* opengl drawing */
|
||||
virtual void draw_pixels(device_memory& mem, int y, int w, int h,
|
||||
|
@ -273,6 +273,11 @@ public:
|
||||
{
|
||||
task_pool.cancel();
|
||||
}
|
||||
|
||||
bool task_cancelled()
|
||||
{
|
||||
return task_pool.cancelled();
|
||||
}
|
||||
};
|
||||
|
||||
Device *device_cpu_create(DeviceInfo& info, int threads)
|
||||
|
@ -892,6 +892,11 @@ public:
|
||||
{
|
||||
task_pool.cancel();
|
||||
}
|
||||
|
||||
bool task_cancelled()
|
||||
{
|
||||
return task_pool.cancelled();
|
||||
}
|
||||
};
|
||||
|
||||
Device *device_cuda_create(DeviceInfo& info, bool background)
|
||||
|
@ -312,6 +312,14 @@ public:
|
||||
foreach(SubDevice& sub, devices)
|
||||
sub.device->task_cancel();
|
||||
}
|
||||
|
||||
bool task_cancelled()
|
||||
{
|
||||
foreach(SubDevice& sub, devices)
|
||||
if (sub.device->task_cancelled())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Device *device_multi_create(DeviceInfo& info, bool background)
|
||||
|
@ -724,6 +724,11 @@ public:
|
||||
{
|
||||
task_pool.cancel();
|
||||
}
|
||||
|
||||
bool task_cancelled()
|
||||
{
|
||||
return task_pool.cancelled();
|
||||
}
|
||||
};
|
||||
|
||||
Device *device_opencl_create(DeviceInfo& info, bool background)
|
||||
@ -734,29 +739,31 @@ Device *device_opencl_create(DeviceInfo& info, bool background)
|
||||
void device_opencl_info(vector<DeviceInfo>& devices)
|
||||
{
|
||||
vector<cl_device_id> device_ids;
|
||||
cl_uint num_devices;
|
||||
cl_platform_id platform_id;
|
||||
cl_uint num_platforms;
|
||||
cl_uint num_devices = 0;
|
||||
vector<cl_platform_id> platform_ids;
|
||||
cl_uint num_platforms = 0;
|
||||
|
||||
/* get devices */
|
||||
if(clGetPlatformIDs(0, NULL, &num_platforms) != CL_SUCCESS || num_platforms == 0)
|
||||
return;
|
||||
|
||||
if(clGetPlatformIDs(1, &platform_id, NULL) != CL_SUCCESS)
|
||||
platform_ids.resize(num_platforms);
|
||||
|
||||
if(clGetPlatformIDs(num_platforms, &platform_ids[0], NULL) != CL_SUCCESS)
|
||||
return;
|
||||
|
||||
if(clGetDeviceIDs(platform_id, CL_DEVICE_TYPE_GPU|CL_DEVICE_TYPE_ACCELERATOR, 0, NULL, &num_devices) != CL_SUCCESS)
|
||||
if(clGetDeviceIDs(platform_ids[0], CL_DEVICE_TYPE_GPU|CL_DEVICE_TYPE_ACCELERATOR, 0, NULL, &num_devices) != CL_SUCCESS || num_devices == 0)
|
||||
return;
|
||||
|
||||
device_ids.resize(num_devices);
|
||||
|
||||
if(clGetDeviceIDs(platform_id, CL_DEVICE_TYPE_GPU|CL_DEVICE_TYPE_ACCELERATOR, num_devices, &device_ids[0], NULL) != CL_SUCCESS)
|
||||
if(clGetDeviceIDs(platform_ids[0], CL_DEVICE_TYPE_GPU|CL_DEVICE_TYPE_ACCELERATOR, num_devices, &device_ids[0], NULL) != CL_SUCCESS)
|
||||
return;
|
||||
|
||||
/* add devices */
|
||||
for(int num = 0; num < num_devices; num++) {
|
||||
cl_device_id device_id = device_ids[num];
|
||||
char name[1024];
|
||||
char name[1024] = "\0";
|
||||
|
||||
if(clGetDeviceInfo(device_id, CL_DEVICE_NAME, sizeof(name), &name, NULL) != CL_SUCCESS)
|
||||
continue;
|
||||
|
@ -140,6 +140,12 @@ void Session::reset_gpu(BufferParams& buffer_params, int samples)
|
||||
pause_cond.notify_all();
|
||||
}
|
||||
|
||||
bool Session::resetting_gpu() const
|
||||
{
|
||||
/* no need to wait for gpu device */
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Session::draw_gpu(BufferParams& buffer_params)
|
||||
{
|
||||
/* block for buffer access */
|
||||
@ -290,6 +296,11 @@ void Session::reset_cpu(BufferParams& buffer_params, int samples)
|
||||
pause_cond.notify_all();
|
||||
}
|
||||
|
||||
bool Session::resetting_cpu() const
|
||||
{
|
||||
return device->task_cancelled();
|
||||
}
|
||||
|
||||
bool Session::draw_cpu(BufferParams& buffer_params)
|
||||
{
|
||||
thread_scoped_lock display_lock(display_mutex);
|
||||
@ -584,6 +595,14 @@ void Session::reset(BufferParams& buffer_params, int samples)
|
||||
reset_cpu(buffer_params, samples);
|
||||
}
|
||||
|
||||
bool Session::resetting() const
|
||||
{
|
||||
if(device_use_gl)
|
||||
return resetting_gpu();
|
||||
else
|
||||
return resetting_cpu();
|
||||
}
|
||||
|
||||
void Session::set_samples(int samples)
|
||||
{
|
||||
if(samples != params.samples) {
|
||||
|
@ -116,6 +116,7 @@ public:
|
||||
|
||||
bool ready_to_reset();
|
||||
void reset(BufferParams& params, int samples);
|
||||
bool resetting() const;
|
||||
void set_samples(int samples);
|
||||
void set_pause(bool pause);
|
||||
|
||||
@ -139,10 +140,12 @@ protected:
|
||||
void run_cpu();
|
||||
bool draw_cpu(BufferParams& params);
|
||||
void reset_cpu(BufferParams& params, int samples);
|
||||
bool resetting_cpu() const;
|
||||
|
||||
void run_gpu();
|
||||
bool draw_gpu(BufferParams& params);
|
||||
void reset_gpu(BufferParams& params, int samples);
|
||||
bool resetting_gpu() const;
|
||||
|
||||
bool acquire_tile(Device *tile_device, RenderTile& tile);
|
||||
void update_tile_sample(RenderTile& tile);
|
||||
|
@ -235,8 +235,10 @@ int clLibraryInit()
|
||||
__clewEnqueueBarrier = (PFNCLENQUEUEBARRIER )CLCC_DYNLIB_IMPORT(module, "clEnqueueBarrier");
|
||||
__clewGetExtensionFunctionAddress = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLCC_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress");
|
||||
|
||||
if(__clewGetPlatformIDs == NULL)
|
||||
return 0;
|
||||
if(__clewGetPlatformIDs == NULL) return 0;
|
||||
if(__clewGetPlatformInfo == NULL) return 0;
|
||||
if(__clewGetDeviceIDs == NULL) return 0;
|
||||
if(__clewGetDeviceInfo == NULL) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -38,6 +38,8 @@ TaskPool::~TaskPool()
|
||||
|
||||
void TaskPool::push(Task *task, bool front)
|
||||
{
|
||||
thread_scoped_lock num_lock(num_mutex);
|
||||
|
||||
TaskScheduler::Entry entry;
|
||||
|
||||
entry.task = task;
|
||||
@ -102,22 +104,17 @@ void TaskPool::wait_work()
|
||||
|
||||
void TaskPool::cancel()
|
||||
{
|
||||
thread_scoped_lock num_lock(num_mutex);
|
||||
|
||||
do_cancel = true;
|
||||
|
||||
TaskScheduler::clear(this);
|
||||
|
||||
{
|
||||
thread_scoped_lock num_lock(num_mutex);
|
||||
|
||||
while(num)
|
||||
num_cond.wait(num_lock);
|
||||
}
|
||||
|
||||
do_cancel = false;
|
||||
}
|
||||
|
||||
void TaskPool::stop()
|
||||
{
|
||||
thread_scoped_lock num_lock(num_mutex);
|
||||
|
||||
TaskScheduler::clear(this);
|
||||
|
||||
assert(num == 0);
|
||||
@ -130,20 +127,20 @@ bool TaskPool::cancelled()
|
||||
|
||||
void TaskPool::num_decrease(int done)
|
||||
{
|
||||
num_mutex.lock();
|
||||
num -= done;
|
||||
|
||||
assert(num >= 0);
|
||||
if(num == 0)
|
||||
num_cond.notify_all();
|
||||
|
||||
num_mutex.unlock();
|
||||
if(num == 0) {
|
||||
do_cancel = false;
|
||||
|
||||
num_cond.notify_all();
|
||||
}
|
||||
}
|
||||
|
||||
void TaskPool::num_increase()
|
||||
{
|
||||
thread_scoped_lock num_lock(num_mutex);
|
||||
num++;
|
||||
|
||||
num_cond.notify_all();
|
||||
}
|
||||
|
||||
@ -239,7 +236,11 @@ void TaskScheduler::thread_run(int thread_id)
|
||||
delete entry.task;
|
||||
|
||||
/* notify pool task was done */
|
||||
entry.pool->num_decrease(1);
|
||||
{
|
||||
/* not called from TaskPool, have to explicitly lock the mutex here */
|
||||
thread_scoped_lock num_lock(entry.pool->num_mutex);
|
||||
entry.pool->num_decrease(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,8 +146,14 @@ class PlayRenderedAnim(Operator):
|
||||
# launch it
|
||||
print("Executing command:\n %r" % " ".join(cmd))
|
||||
|
||||
# workaround for boost 1.46, can be eventually removed. bug: [#32350]
|
||||
env_copy = os.environ.copy()
|
||||
if preset == 'INTERNAL':
|
||||
env_copy["LC_ALL"] = "C"
|
||||
# end workaround
|
||||
|
||||
try:
|
||||
subprocess.Popen(cmd)
|
||||
subprocess.Popen(cmd, env=env_copy)
|
||||
except Exception as e:
|
||||
self.report({'ERROR'},
|
||||
"Couldn't run external animation player with command "
|
||||
|
@ -847,28 +847,35 @@ class WM_OT_doc_view_manual(Operator):
|
||||
doc_id = doc_id
|
||||
|
||||
@staticmethod
|
||||
def _find_reference(rna_id, url_mapping):
|
||||
print("online manual check for: '%s'... " % rna_id)
|
||||
def _find_reference(rna_id, url_mapping, verbose=True):
|
||||
if verbose:
|
||||
print("online manual check for: '%s'... " % rna_id)
|
||||
from fnmatch import fnmatch
|
||||
for pattern, url_suffix in url_mapping:
|
||||
if fnmatch(rna_id, pattern):
|
||||
print(" match found: '%s' --> '%s'" % (pattern, url_suffix))
|
||||
if verbose:
|
||||
print(" match found: '%s' --> '%s'" % (pattern, url_suffix))
|
||||
return url_suffix
|
||||
print("match not found")
|
||||
if verbose:
|
||||
print("match not found")
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def _lookup_rna_url(rna_id, verbose=True):
|
||||
url = None
|
||||
for prefix, url_manual_mapping in bpy.utils.manual_map():
|
||||
rna_ref = WM_OT_doc_view_manual._find_reference(rna_id, url_manual_mapping, verbose=verbose)
|
||||
if rna_ref is not None:
|
||||
url = prefix + rna_ref
|
||||
break
|
||||
return url
|
||||
|
||||
def execute(self, context):
|
||||
rna_id = _wm_doc_get_id(self.doc_id, do_url=False)
|
||||
if rna_id is None:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
url = None
|
||||
|
||||
for prefix, url_manual_mapping in bpy.utils.manual_map():
|
||||
rna_ref = self._find_reference(rna_id, url_manual_mapping)
|
||||
if rna_ref is not None:
|
||||
url = prefix + rna_ref
|
||||
break
|
||||
url = self._lookup_rna_url(rna_id)
|
||||
|
||||
if url is None:
|
||||
self.report({'WARNING'}, "No reference available %r, "
|
||||
|
@ -65,6 +65,7 @@ int where_on_path(struct Object *ob, float ctime, float vec[4], float dir[3], fl
|
||||
/* ---------------------------------------------------- */
|
||||
/* Dupli-Geometry */
|
||||
|
||||
struct ListBase *object_duplilist_ex(struct Scene *sce, struct Object *ob, int update);
|
||||
struct ListBase *object_duplilist(struct Scene *sce, struct Object *ob);
|
||||
void free_object_duplilist(struct ListBase *lb);
|
||||
int count_duplilist(struct Object *ob);
|
||||
|
@ -203,6 +203,10 @@ int BKE_image_scale(struct Image *image, int width, int height);
|
||||
/* check if texture has alpha (depth=32) */
|
||||
int BKE_image_has_alpha(struct Image *image);
|
||||
|
||||
void BKE_image_get_size(struct Image *image, struct ImageUser *iuser, int *width, int *height);
|
||||
void BKE_image_get_size_fl(struct Image *image, struct ImageUser *iuser, float size[2]);
|
||||
void BKE_image_get_aspect(struct Image *image, float *aspx, float *aspy);
|
||||
|
||||
/* image_gen.c */
|
||||
void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width, int height, const float color[4]);
|
||||
void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int height, int width);
|
||||
|
@ -28,6 +28,8 @@
|
||||
#ifndef __BKE_MASK_H__
|
||||
#define __BKE_MASK_H__
|
||||
|
||||
struct ImageUser;
|
||||
struct Image;
|
||||
struct ListBase;
|
||||
struct Main;
|
||||
struct Mask;
|
||||
@ -103,10 +105,12 @@ struct Mask *BKE_mask_copy(struct Mask *mask);
|
||||
void BKE_mask_free(struct Mask *mask);
|
||||
void BKE_mask_unlink(struct Main *bmain, struct Mask *mask);
|
||||
|
||||
void BKE_mask_coord_from_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2]);
|
||||
void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2]);
|
||||
void BKE_mask_coord_to_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2]);
|
||||
void BKE_mask_coord_from_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2]);
|
||||
void BKE_mask_coord_from_image(struct Image *image, struct ImageUser *iuser, float r_co[2], const float co[2]);
|
||||
void BKE_mask_coord_to_frame(float r_co[2], const float co[2], const float frame_size[2]);
|
||||
void BKE_mask_coord_to_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2]);
|
||||
void BKE_mask_coord_to_image(struct Image *image, struct ImageUser *iuser, float r_co[2], const float co[2]);
|
||||
|
||||
/* parenting */
|
||||
|
||||
|
@ -51,9 +51,10 @@ struct ImBuf *BKE_movieclip_get_postprocessed_ibuf(struct MovieClip *clip, struc
|
||||
struct ImBuf *BKE_movieclip_get_stable_ibuf(struct MovieClip *clip, struct MovieClipUser *user, float loc[2], float *scale, float *angle, int postprocess_flag);
|
||||
struct ImBuf *BKE_movieclip_get_ibuf_flag(struct MovieClip *clip, struct MovieClipUser *user, int flag, int cache_flag);
|
||||
void BKE_movieclip_get_size(struct MovieClip *clip, struct MovieClipUser *user, int *width, int *height);
|
||||
int BKE_movieclip_get_duration(struct MovieClip *clip);
|
||||
void BKE_movieclip_aspect(struct MovieClip *clip, float *aspx, float *aspy);
|
||||
int BKE_movieclip_has_frame(struct MovieClip *clip, struct MovieClipUser *user);
|
||||
void BKE_movieclip_get_size_fl(struct MovieClip *clip, struct MovieClipUser *user, float size[2]);
|
||||
int BKE_movieclip_get_duration(struct MovieClip *clip);
|
||||
void BKE_movieclip_get_aspect(struct MovieClip *clip, float *aspx, float *aspy);
|
||||
int BKE_movieclip_has_frame(struct MovieClip *clip, struct MovieClipUser *user);
|
||||
void BKE_movieclip_user_set_frame(struct MovieClipUser *user, int framenr);
|
||||
|
||||
void BKE_movieclip_update_scopes(struct MovieClip *clip, struct MovieClipUser *user, struct MovieClipScopes *scopes);
|
||||
|
@ -307,6 +307,7 @@ int BKE_sequence_swap(struct Sequence *seq_a, struct Sequence *seq_b, const char
|
||||
|
||||
int BKE_sequence_check_depend(struct Sequence *seq, struct Sequence *cur);
|
||||
void BKE_sequence_invalidate_cache(struct Scene *scene, struct Sequence *seq);
|
||||
void BKE_sequence_invalidate_deendent(struct Scene *scene, struct Sequence *seq);
|
||||
void BKE_sequence_invalidate_cache_for_modifier(struct Scene *scene, struct Sequence *seq);
|
||||
|
||||
void BKE_sequencer_update_sound_bounds_all(struct Scene *scene);
|
||||
|
@ -532,12 +532,6 @@ void BKE_pose_copy_data(bPose **dst, bPose *src, int copycon)
|
||||
return;
|
||||
}
|
||||
|
||||
if (*dst == src) {
|
||||
printf("BKE_pose_copy_data source and target are the same\n");
|
||||
*dst = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
outPose = MEM_callocN(sizeof(bPose), "pose");
|
||||
|
||||
BLI_duplicatelist(&outPose->chanbase, &src->chanbase);
|
||||
|
@ -74,7 +74,8 @@
|
||||
/* --------------------- */
|
||||
/* forward declarations */
|
||||
|
||||
static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int par_index, int level, int animated);
|
||||
static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int par_index,
|
||||
int level, short animated, short update);
|
||||
|
||||
/* ******************************************************************** */
|
||||
/* Animation Visualization */
|
||||
@ -699,7 +700,7 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
|
||||
/* ******************************************************************** */
|
||||
/* Dupli-Geometry */
|
||||
|
||||
static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], int lay, int index, int par_index, int type, int animated)
|
||||
static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], int lay, int index, int par_index, int type, short animated)
|
||||
{
|
||||
DupliObject *dob = MEM_callocN(sizeof(DupliObject), "dupliobject");
|
||||
|
||||
@ -717,7 +718,8 @@ static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], i
|
||||
return dob;
|
||||
}
|
||||
|
||||
static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_index, int level, int animated)
|
||||
static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_index,
|
||||
int level, short animated, short update)
|
||||
{
|
||||
DupliObject *dob;
|
||||
Group *group;
|
||||
@ -731,8 +733,14 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_inde
|
||||
if (level > MAX_DUPLI_RECUR) return;
|
||||
|
||||
/* handles animated groups, and */
|
||||
|
||||
/* we need to check update for objects that are not in scene... */
|
||||
group_handle_recalc_and_update(scene, ob, group);
|
||||
if (update) {
|
||||
/* note: update is optional because we don't always need object
|
||||
* transformations to be correct. Also fixes bug [#29616]. */
|
||||
group_handle_recalc_and_update(scene, ob, group);
|
||||
}
|
||||
|
||||
animated = animated || group_is_animated(ob, group);
|
||||
|
||||
for (go = group->gobject.first; go; go = go->next) {
|
||||
@ -764,14 +772,14 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_inde
|
||||
|
||||
if (go->ob->transflag & OB_DUPLI) {
|
||||
copy_m4_m4(dob->ob->obmat, dob->mat);
|
||||
object_duplilist_recursive(&group->id, scene, go->ob, lb, ob->obmat, par_index, level + 1, animated);
|
||||
object_duplilist_recursive(&group->id, scene, go->ob, lb, ob->obmat, par_index, level + 1, animated, update);
|
||||
copy_m4_m4(dob->ob->obmat, dob->omat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_index, int level, int animated)
|
||||
static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_index, int level, short animated)
|
||||
{
|
||||
extern int enable_cu_speed; /* object.c */
|
||||
Object copyob;
|
||||
@ -843,7 +851,8 @@ static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_ind
|
||||
typedef struct VertexDupliData {
|
||||
ID *id; /* scene or group, for recursive loops */
|
||||
int level;
|
||||
int animated;
|
||||
short animated;
|
||||
short update;
|
||||
ListBase *lb;
|
||||
float pmat[4][4];
|
||||
float obmat[4][4]; /* Only used for dupliverts inside dupligroups, where the ob->obmat is modified */
|
||||
@ -899,12 +908,13 @@ static void vertex_dupli__mapFunc(void *userData, int index, const float co[3],
|
||||
float tmpmat[4][4];
|
||||
copy_m4_m4(tmpmat, vdd->ob->obmat);
|
||||
copy_m4_m4(vdd->ob->obmat, obmat); /* pretend we are really this mat */
|
||||
object_duplilist_recursive((ID *)vdd->id, vdd->scene, vdd->ob, vdd->lb, obmat, vdd->par_index, vdd->level + 1, vdd->animated);
|
||||
object_duplilist_recursive((ID *)vdd->id, vdd->scene, vdd->ob, vdd->lb, obmat, vdd->par_index, vdd->level + 1, vdd->animated, vdd->update);
|
||||
copy_m4_m4(vdd->ob->obmat, tmpmat);
|
||||
}
|
||||
}
|
||||
|
||||
static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int par_index, int level, int animated)
|
||||
static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int par_index,
|
||||
int level, short animated, short update)
|
||||
{
|
||||
Object *ob, *ob_iter;
|
||||
Mesh *me = par->data;
|
||||
@ -983,6 +993,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
|
||||
vdd.id = id;
|
||||
vdd.level = level;
|
||||
vdd.animated = animated;
|
||||
vdd.update = update;
|
||||
vdd.lb = lb;
|
||||
vdd.ob = ob;
|
||||
vdd.scene = scene;
|
||||
@ -1027,7 +1038,8 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
|
||||
dm->release(dm);
|
||||
}
|
||||
|
||||
static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int par_index, int level, int animated)
|
||||
static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int par_index,
|
||||
int level, short animated, short update)
|
||||
{
|
||||
Object *ob, *ob_iter;
|
||||
Base *base = NULL;
|
||||
@ -1197,7 +1209,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
|
||||
float tmpmat[4][4];
|
||||
copy_m4_m4(tmpmat, ob->obmat);
|
||||
copy_m4_m4(ob->obmat, obmat); /* pretend we are really this mat */
|
||||
object_duplilist_recursive((ID *)id, scene, ob, lb, ob->obmat, par_index, level + 1, animated);
|
||||
object_duplilist_recursive((ID *)id, scene, ob, lb, ob->obmat, par_index, level + 1, animated, update);
|
||||
copy_m4_m4(ob->obmat, tmpmat);
|
||||
}
|
||||
}
|
||||
@ -1217,7 +1229,8 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
|
||||
dm->release(dm);
|
||||
}
|
||||
|
||||
static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int UNUSED(par_index), ParticleSystem *psys, int level, int animated)
|
||||
static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int UNUSED(par_index), ParticleSystem *psys,
|
||||
int level, short animated, short update)
|
||||
{
|
||||
GroupObject *go;
|
||||
Object *ob = NULL, **oblist = NULL, obcopy, *obcopylist = NULL;
|
||||
@ -1300,7 +1313,9 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
|
||||
|
||||
/* gather list of objects or single object */
|
||||
if (part->ren_as == PART_DRAW_GR) {
|
||||
group_handle_recalc_and_update(scene, par, part->dup_group);
|
||||
if (update) {
|
||||
group_handle_recalc_and_update(scene, par, part->dup_group);
|
||||
}
|
||||
|
||||
if (part->draw & PART_DRAW_COUNT_GR) {
|
||||
for (dw = part->dupliweights.first; dw; dw = dw->next)
|
||||
@ -1555,7 +1570,7 @@ static Object *find_family_object(Object **obar, char *family, char ch)
|
||||
}
|
||||
|
||||
|
||||
static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int par_index, int level, int animated)
|
||||
static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int par_index, int level, short animated)
|
||||
{
|
||||
Object *ob, *obar[256] = {NULL};
|
||||
Curve *cu;
|
||||
@ -1603,7 +1618,8 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int par_inde
|
||||
|
||||
/* ------------- */
|
||||
|
||||
static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int par_index, int level, int animated)
|
||||
static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int par_index,
|
||||
int level, short animated, short update)
|
||||
{
|
||||
if ((ob->transflag & OB_DUPLI) == 0)
|
||||
return;
|
||||
@ -1623,11 +1639,11 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
|
||||
if (ob->transflag & OB_DUPLIPARTS) {
|
||||
ParticleSystem *psys = ob->particlesystem.first;
|
||||
for (; psys; psys = psys->next)
|
||||
new_particle_duplilist(duplilist, id, scene, ob, par_space_mat, par_index, psys, level + 1, animated);
|
||||
new_particle_duplilist(duplilist, id, scene, ob, par_space_mat, par_index, psys, level + 1, animated, update);
|
||||
}
|
||||
else if (ob->transflag & OB_DUPLIVERTS) {
|
||||
if (ob->type == OB_MESH) {
|
||||
vertex_duplilist(duplilist, id, scene, ob, par_space_mat, par_index, level + 1, animated);
|
||||
vertex_duplilist(duplilist, id, scene, ob, par_space_mat, par_index, level + 1, animated, update);
|
||||
}
|
||||
else if (ob->type == OB_FONT) {
|
||||
if (GS(id->name) == ID_SCE) { /* TODO - support dupligroups */
|
||||
@ -1637,7 +1653,7 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
|
||||
}
|
||||
else if (ob->transflag & OB_DUPLIFACES) {
|
||||
if (ob->type == OB_MESH)
|
||||
face_duplilist(duplilist, id, scene, ob, par_space_mat, par_index, level + 1, animated);
|
||||
face_duplilist(duplilist, id, scene, ob, par_space_mat, par_index, level + 1, animated, update);
|
||||
}
|
||||
else if (ob->transflag & OB_DUPLIFRAMES) {
|
||||
if (GS(id->name) == ID_SCE) { /* TODO - support dupligroups */
|
||||
@ -1647,7 +1663,7 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
|
||||
else if (ob->transflag & OB_DUPLIGROUP) {
|
||||
DupliObject *dob;
|
||||
|
||||
group_duplilist(duplilist, scene, ob, par_index, level + 1, animated); /* now recursive */
|
||||
group_duplilist(duplilist, scene, ob, par_index, level + 1, animated, update); /* now recursive */
|
||||
|
||||
if (level == 0) {
|
||||
for (dob = duplilist->first; dob; dob = dob->next)
|
||||
@ -1659,14 +1675,22 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
|
||||
|
||||
/* Returns a list of DupliObject
|
||||
* note; group dupli's already set transform matrix. see note in group_duplilist() */
|
||||
ListBase *object_duplilist(Scene *sce, Object *ob)
|
||||
ListBase *object_duplilist_ex(Scene *sce, Object *ob, int update)
|
||||
{
|
||||
ListBase *duplilist = MEM_mallocN(sizeof(ListBase), "duplilist");
|
||||
duplilist->first = duplilist->last = NULL;
|
||||
object_duplilist_recursive((ID *)sce, sce, ob, duplilist, NULL, 0, 0, 0);
|
||||
object_duplilist_recursive((ID *)sce, sce, ob, duplilist, NULL, 0, 0, 0, update);
|
||||
return duplilist;
|
||||
}
|
||||
|
||||
/* note: previously updating was always done, this is why it defaults to be on
|
||||
* but there are likely places it can be called without updating */
|
||||
ListBase *object_duplilist(Scene *sce, Object *ob)
|
||||
{
|
||||
return object_duplilist_ex(sce, ob, TRUE);
|
||||
}
|
||||
|
||||
|
||||
void free_object_duplilist(ListBase *lb)
|
||||
{
|
||||
DupliObject *dob;
|
||||
|
@ -504,8 +504,8 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo
|
||||
xmaxv = MAX3(xmaxv, bezt_last->vec[1][0], bezt_last->vec[2][0]);
|
||||
}
|
||||
else {
|
||||
xminv = MIN2(xminv, bezt_first->vec[1][0]);
|
||||
xmaxv = MAX2(xmaxv, bezt_last->vec[1][0]);
|
||||
xminv = minf(xminv, bezt_first->vec[1][0]);
|
||||
xmaxv = maxf(xmaxv, bezt_last->vec[1][0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -521,8 +521,8 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo
|
||||
ymaxv = MAX4(ymaxv, bezt->vec[1][1], bezt->vec[0][1], bezt->vec[2][1]);
|
||||
}
|
||||
else {
|
||||
yminv = MIN2(yminv, bezt->vec[1][1]);
|
||||
ymaxv = MAX2(ymaxv, bezt->vec[1][1]);
|
||||
yminv = minf(yminv, bezt->vec[1][1]);
|
||||
ymaxv = maxf(ymaxv, bezt->vec[1][1]);
|
||||
}
|
||||
|
||||
foundvert = TRUE;
|
||||
@ -533,8 +533,8 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo
|
||||
else if (fcu->fpt) {
|
||||
/* frame range can be directly calculated from end verts */
|
||||
if (xmin || xmax) {
|
||||
xminv = MIN2(xminv, fcu->fpt[0].vec[0]);
|
||||
xmaxv = MAX2(xmaxv, fcu->fpt[fcu->totvert - 1].vec[0]);
|
||||
xminv = minf(xminv, fcu->fpt[0].vec[0]);
|
||||
xmaxv = maxf(xmaxv, fcu->fpt[fcu->totvert - 1].vec[0]);
|
||||
}
|
||||
|
||||
/* only loop over keyframes to find extents for values if needed */
|
||||
@ -591,15 +591,15 @@ void calc_fcurve_range(FCurve *fcu, float *start, float *end,
|
||||
if (bezt_first) {
|
||||
BLI_assert(bezt_last != NULL);
|
||||
|
||||
min = MIN2(min, bezt_first->vec[1][0]);
|
||||
max = MAX2(max, bezt_last->vec[1][0]);
|
||||
min = minf(min, bezt_first->vec[1][0]);
|
||||
max = maxf(max, bezt_last->vec[1][0]);
|
||||
|
||||
foundvert = TRUE;
|
||||
}
|
||||
}
|
||||
else if (fcu->fpt) {
|
||||
min = MIN2(min, fcu->fpt[0].vec[0]);
|
||||
max = MAX2(max, fcu->fpt[fcu->totvert - 1].vec[0]);
|
||||
min = minf(min, fcu->fpt[0].vec[0]);
|
||||
max = maxf(max, fcu->fpt[fcu->totvert - 1].vec[0]);
|
||||
|
||||
foundvert = TRUE;
|
||||
}
|
||||
|
@ -2977,3 +2977,40 @@ int BKE_image_has_alpha(struct Image *image)
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void BKE_image_get_size(Image *image, ImageUser *iuser, int *width, int *height)
|
||||
{
|
||||
ImBuf *ibuf = NULL;
|
||||
void *lock;
|
||||
|
||||
ibuf = BKE_image_acquire_ibuf(image, iuser, &lock);
|
||||
|
||||
if (ibuf && ibuf->x > 0 && ibuf->y > 0) {
|
||||
*width = ibuf->x;
|
||||
*height = ibuf->y;
|
||||
}
|
||||
else {
|
||||
*width = IMG_SIZE_FALLBACK;
|
||||
*height = IMG_SIZE_FALLBACK;
|
||||
}
|
||||
|
||||
BKE_image_release_ibuf(image, lock);
|
||||
}
|
||||
|
||||
void BKE_image_get_size_fl(Image *image, ImageUser *iuser, float size[2])
|
||||
{
|
||||
int width, height;
|
||||
BKE_image_get_size(image, iuser, &width, &height);
|
||||
|
||||
size[0] = (float)width;
|
||||
size[1] = (float)height;
|
||||
|
||||
}
|
||||
|
||||
void BKE_image_get_aspect(Image *image, float *aspx, float *aspy)
|
||||
{
|
||||
*aspx = 1.0;
|
||||
|
||||
/* x is always 1 */
|
||||
*aspy = image->aspy / image->aspx;
|
||||
}
|
||||
|
@ -691,8 +691,8 @@ static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const
|
||||
if (nu->bp) {
|
||||
step = nu->pntsu * nu->pntsv;
|
||||
|
||||
a1 = MAX2(a, start);
|
||||
a2 = MIN2(a + step, end);
|
||||
a1 = maxi(a, start);
|
||||
a2 = mini(a + step, end);
|
||||
|
||||
if (a1 < a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BPOINT);
|
||||
}
|
||||
@ -700,8 +700,8 @@ static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const
|
||||
step = 3 * nu->pntsu;
|
||||
|
||||
/* exception because keys prefer to work with complete blocks */
|
||||
a1 = MAX2(a, start);
|
||||
a2 = MIN2(a + step, end);
|
||||
a1 = maxi(a, start);
|
||||
a2 = mini(a + step, end);
|
||||
|
||||
if (a1 < a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BEZTRIPLE);
|
||||
}
|
||||
@ -1217,7 +1217,7 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in
|
||||
remain = step;
|
||||
}
|
||||
|
||||
count = MIN2(remain, estep);
|
||||
count = mini(remain, estep);
|
||||
if (mode == KEY_MODE_BEZTRIPLE) {
|
||||
count += 3 - count % 3;
|
||||
}
|
||||
@ -1573,7 +1573,7 @@ void key_to_latt(KeyBlock *kb, Lattice *lt)
|
||||
fp = kb->data;
|
||||
|
||||
tot = lt->pntsu * lt->pntsv * lt->pntsw;
|
||||
tot = MIN2(kb->totelem, tot);
|
||||
tot = mini(kb->totelem, tot);
|
||||
|
||||
for (a = 0; a < tot; a++, fp += 3, bp++) {
|
||||
copy_v3_v3(bp->vec, fp);
|
||||
@ -1645,7 +1645,7 @@ void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
|
||||
|
||||
tot = BKE_nurbList_verts_count(nurb);
|
||||
|
||||
tot = MIN2(kb->totelem, tot);
|
||||
tot = mini(kb->totelem, tot);
|
||||
|
||||
while (nu && tot > 0) {
|
||||
|
||||
@ -1713,7 +1713,7 @@ void key_to_mesh(KeyBlock *kb, Mesh *me)
|
||||
mvert = me->mvert;
|
||||
fp = kb->data;
|
||||
|
||||
tot = MIN2(kb->totelem, me->totvert);
|
||||
tot = mini(kb->totelem, me->totvert);
|
||||
|
||||
for (a = 0; a < tot; a++, fp += 3, mvert++) {
|
||||
copy_v3_v3(mvert->co, fp);
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "BKE_sequencer.h"
|
||||
#include "BKE_tracking.h"
|
||||
#include "BKE_movieclip.h"
|
||||
#include "BKE_image.h"
|
||||
|
||||
static MaskSplinePoint *mask_spline_point_next(MaskSpline *spline, MaskSplinePoint *points_array, MaskSplinePoint *point)
|
||||
{
|
||||
@ -1010,14 +1011,26 @@ void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float fra
|
||||
}
|
||||
void BKE_mask_coord_from_movieclip(MovieClip *clip, MovieClipUser *user, float r_co[2], const float co[2])
|
||||
{
|
||||
int width, height;
|
||||
float aspx, aspy;
|
||||
float frame_size[2];
|
||||
|
||||
/* scaling for the clip */
|
||||
BKE_movieclip_get_size(clip, user, &width, &height);
|
||||
BKE_movieclip_get_size_fl(clip, user, frame_size);
|
||||
BKE_movieclip_get_aspect(clip, &aspx, &aspy);
|
||||
|
||||
frame_size[0] = (float)width;
|
||||
frame_size[1] = (float)height;
|
||||
frame_size[1] *= (aspy / aspx);
|
||||
|
||||
BKE_mask_coord_from_frame(r_co, co, frame_size);
|
||||
}
|
||||
void BKE_mask_coord_from_image(Image *image, ImageUser *iuser, float r_co[2], const float co[2])
|
||||
{
|
||||
float aspx, aspy;
|
||||
float frame_size[2];
|
||||
|
||||
BKE_image_get_size_fl(image, iuser, frame_size);
|
||||
BKE_image_get_aspect(image, &aspx, &aspy);
|
||||
|
||||
frame_size[1] *= (aspy / aspx);
|
||||
|
||||
BKE_mask_coord_from_frame(r_co, co, frame_size);
|
||||
}
|
||||
@ -1040,14 +1053,27 @@ void BKE_mask_coord_to_frame(float r_co[2], const float co[2], const float frame
|
||||
}
|
||||
void BKE_mask_coord_to_movieclip(MovieClip *clip, MovieClipUser *user, float r_co[2], const float co[2])
|
||||
{
|
||||
int width, height;
|
||||
float aspx, aspy;
|
||||
float frame_size[2];
|
||||
|
||||
/* scaling for the clip */
|
||||
BKE_movieclip_get_size(clip, user, &width, &height);
|
||||
BKE_movieclip_get_size_fl(clip, user, frame_size);
|
||||
BKE_movieclip_get_aspect(clip, &aspx, &aspy);
|
||||
|
||||
frame_size[0] = (float)width;
|
||||
frame_size[1] = (float)height;
|
||||
frame_size[1] /= (aspy / aspx);
|
||||
|
||||
BKE_mask_coord_to_frame(r_co, co, frame_size);
|
||||
}
|
||||
void BKE_mask_coord_to_image(Image *image, ImageUser *iuser, float r_co[2], const float co[2])
|
||||
{
|
||||
float aspx, aspy;
|
||||
float frame_size[2];
|
||||
|
||||
/* scaling for the clip */
|
||||
BKE_image_get_size_fl(image, iuser, frame_size);
|
||||
BKE_image_get_aspect(image, &aspx, &aspy);
|
||||
|
||||
frame_size[1] /= (aspy / aspx);
|
||||
|
||||
BKE_mask_coord_to_frame(r_co, co, frame_size);
|
||||
}
|
||||
|
@ -26,6 +26,46 @@
|
||||
|
||||
/** \file blender/blenkernel/intern/mask_rasterize.c
|
||||
* \ingroup bke
|
||||
*
|
||||
* This module exposes a rasterizer that works as a black box - implementation details are confined to this file,
|
||||
*
|
||||
* The basic method to access is:
|
||||
* - create & initialize a handle from a #Mask datablock.
|
||||
* - execute pixel lookups.
|
||||
* - free the handle.
|
||||
*
|
||||
* This file is admittedly a bit confusticated, in quite few areas speed was chosen over readability,
|
||||
* though it is commented - so shouldn't be so hard to see whats going on.
|
||||
*
|
||||
*
|
||||
* Implementation:
|
||||
*
|
||||
* To rasterize the mask its converted into geometry that use a ray-cast for each pixel lookup.
|
||||
*
|
||||
* Initially 'kdopbvh' was used but this ended up being too slow.
|
||||
*
|
||||
* To gain some extra speed we take advantage of a few shortcuts that can be made rasterizing masks specifically.
|
||||
* - all triangles are known to be completely white - so no depth check is done on triangle intersection.
|
||||
* - all quads are known to be feather outlines - the 1 and 0 depths are known by the vertex order in the quad,
|
||||
* - there is no color - just a value for each mask pixel.
|
||||
* - the mask spacial structure always maps to space 0-1 on X and Y axis.
|
||||
* - bucketing is used to speed up lookups for geometry.
|
||||
*
|
||||
* Other Details:
|
||||
* - used unsigned values all over for some extra speed on some arch's.
|
||||
* - anti-aliasing is faked, just ensuring at least one pixel feather - avoids oversampling.
|
||||
* - initializing the spacial structure doesn't need to be as optimized as pixel lookups are.
|
||||
* - mask lookups need not be pixel aligned so any sub-pixel values from x/y (0 - 1), can be found.
|
||||
* (perhaps masks can be used as a vector texture in 3D later on)
|
||||
*
|
||||
*
|
||||
* Currently, to build the spacial structure we have to calculate the total number of faces ahead of time.
|
||||
*
|
||||
* This is getting a bit complicated with the addition of unfilled splines and end capping -
|
||||
* If large changes are needed here we would be better off using an iterable
|
||||
* BLI_mempool for triangles and converting to a contiguous array afterwards.
|
||||
*
|
||||
* - Campbell
|
||||
*/
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
@ -1009,6 +1009,14 @@ void BKE_movieclip_get_size(MovieClip *clip, MovieClipUser *user, int *width, in
|
||||
IMB_freeImBuf(ibuf);
|
||||
}
|
||||
}
|
||||
void BKE_movieclip_get_size_fl(MovieClip *clip, MovieClipUser *user, float size[2])
|
||||
{
|
||||
int width, height;
|
||||
BKE_movieclip_get_size(clip, user, &width, &height);
|
||||
|
||||
size[0] = (float)width;
|
||||
size[1] = (float)height;
|
||||
}
|
||||
|
||||
int BKE_movieclip_get_duration(MovieClip *clip)
|
||||
{
|
||||
@ -1019,9 +1027,9 @@ int BKE_movieclip_get_duration(MovieClip *clip)
|
||||
return clip->len;
|
||||
}
|
||||
|
||||
void BKE_movieclip_aspect(MovieClip *clip, float *aspx, float *aspy)
|
||||
void BKE_movieclip_get_aspect(MovieClip *clip, float *aspx, float *aspy)
|
||||
{
|
||||
*aspx = *aspy = 1.0;
|
||||
*aspx = 1.0;
|
||||
|
||||
/* x is always 1 */
|
||||
*aspy = clip->aspy / clip->aspx / clip->tracking.camera.pixel_aspect;
|
||||
|
@ -2700,7 +2700,7 @@ void BKE_object_handle_update(Scene *scene, Object *ob)
|
||||
if (pid->cache->flag & PTCACHE_OUTDATED || (pid->cache->flag & PTCACHE_SIMULATION_VALID) == 0) {
|
||||
scene->physics_settings.quick_cache_step =
|
||||
scene->physics_settings.quick_cache_step ?
|
||||
MIN2(scene->physics_settings.quick_cache_step, pid->cache->step) :
|
||||
mini(scene->physics_settings.quick_cache_step, pid->cache->step) :
|
||||
pid->cache->step;
|
||||
}
|
||||
}
|
||||
|
@ -1029,7 +1029,8 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
|
||||
if (scene && (duplis-- > 0) && (ob->transflag & OB_DUPLI)) {
|
||||
ListBase *lb_dupli_ob;
|
||||
|
||||
if ((lb_dupli_ob=object_duplilist(scene, ob))) {
|
||||
/* don't update the dupli groups, we only wan't their pid's */
|
||||
if ((lb_dupli_ob = object_duplilist_ex(scene, ob, FALSE))) {
|
||||
DupliObject *dob;
|
||||
for (dob= lb_dupli_ob->first; dob; dob= dob->next) {
|
||||
if (dob->ob != ob) { /* avoids recursive loops with dupliframes: bug 22988 */
|
||||
|
@ -3049,13 +3049,18 @@ int BKE_sequence_check_depend(Sequence *seq, Sequence *cur)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void sequence_invalidate_cache(Scene *scene, Sequence *seq, int invalidate_preprocess)
|
||||
static void sequence_invalidate_cache(Scene *scene, Sequence *seq, int invalidate_self, int invalidate_preprocess)
|
||||
{
|
||||
Editing *ed = scene->ed;
|
||||
Sequence *cur;
|
||||
|
||||
/* invalidate cache for current sequence */
|
||||
BKE_sequencer_cache_cleanup_sequence(seq);
|
||||
if (invalidate_self)
|
||||
BKE_sequencer_cache_cleanup_sequence(seq);
|
||||
|
||||
/* if invalidation is invoked from sequence free routine, effectdata would be NULL here */
|
||||
if (seq->effectdata && seq->type == SEQ_TYPE_SPEED)
|
||||
BKE_sequence_effect_speed_rebuild_map(scene, seq, TRUE);
|
||||
|
||||
if (invalidate_preprocess)
|
||||
BKE_sequencer_preprocessed_cache_cleanup_sequence(seq);
|
||||
@ -3076,12 +3081,17 @@ static void sequence_invalidate_cache(Scene *scene, Sequence *seq, int invalidat
|
||||
|
||||
void BKE_sequence_invalidate_cache(Scene *scene, Sequence *seq)
|
||||
{
|
||||
sequence_invalidate_cache(scene, seq, TRUE);
|
||||
sequence_invalidate_cache(scene, seq, TRUE, TRUE);
|
||||
}
|
||||
|
||||
void BKE_sequence_invalidate_deendent(Scene *scene, Sequence *seq)
|
||||
{
|
||||
sequence_invalidate_cache(scene, seq, FALSE, TRUE);
|
||||
}
|
||||
|
||||
void BKE_sequence_invalidate_cache_for_modifier(Scene *scene, Sequence *seq)
|
||||
{
|
||||
sequence_invalidate_cache(scene, seq, FALSE);
|
||||
sequence_invalidate_cache(scene, seq, TRUE, FALSE);
|
||||
}
|
||||
|
||||
void BKE_sequencer_free_imbuf(Scene *scene, ListBase *seqbase, int for_render)
|
||||
|
@ -2229,7 +2229,7 @@ void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[
|
||||
t2 = mean_value_half_tan_v3(co, vmid, vnext);
|
||||
|
||||
len = len_v3v3(co, vmid);
|
||||
w[i] = (t1 + t2) / len;
|
||||
w[i] = (len != 0.0f)? (t1 + t2) / len: 0.0f;
|
||||
totweight += w[i];
|
||||
}
|
||||
|
||||
@ -2257,7 +2257,7 @@ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[
|
||||
t2 = mean_value_half_tan_v2(co, vmid, vnext);
|
||||
|
||||
len = len_v2v2(co, vmid);
|
||||
w[i] = (t1 + t2) / len;
|
||||
w[i] = (len != 0.0f)? (t1 + t2) / len: 0.0f;
|
||||
totweight += w[i];
|
||||
}
|
||||
|
||||
|
@ -340,6 +340,8 @@ BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
|
||||
return f;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
||||
/**
|
||||
* Check the element is valid.
|
||||
*
|
||||
@ -476,6 +478,8 @@ int bmesh_elem_check(void *element, const char htype)
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif /* NDEBUG */
|
||||
|
||||
/**
|
||||
* low level function, only frees the vert,
|
||||
* doesn't change or adjust surrounding geometry
|
||||
|
@ -123,12 +123,12 @@ void *BM_iter_as_arrayN(BMesh *bm, const char itype, void *data, int *r_len)
|
||||
if (BM_iter_init(&iter, bm, itype, data) && iter.count > 0) {
|
||||
BMElem *ele;
|
||||
BMElem **array = MEM_mallocN(sizeof(ele) * iter.count, __func__);
|
||||
int i;
|
||||
int i = 0;
|
||||
|
||||
*r_len = iter.count; /* set before iterating */
|
||||
|
||||
for (ele = BM_iter_step(&iter), i = 0; ele; ele = BM_iter_step(&iter), i++) {
|
||||
array[i] = ele;
|
||||
while ((ele = BM_iter_step(&iter))) {
|
||||
array[i++] = ele;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
@ -37,21 +37,21 @@
|
||||
*/
|
||||
|
||||
/* returns positive nonzero on error */
|
||||
int bmesh_elem_check(void *element, const char htype);
|
||||
|
||||
#define BM_CHECK_ELEMENT(el) \
|
||||
#ifdef NDEBUG
|
||||
/* no error checking for release,
|
||||
* it can take most of the CPU time when running some tools */
|
||||
# define BM_CHECK_ELEMENT(el) (void)(el)
|
||||
#else
|
||||
int bmesh_elem_check(void *element, const char htype);
|
||||
# define BM_CHECK_ELEMENT(el) \
|
||||
if (bmesh_elem_check(el, ((BMHeader *)el)->htype)) { \
|
||||
printf("check_element failure, with code %i on line %i in file\n" \
|
||||
" \"%s\"\n\n", \
|
||||
bmesh_elem_check(el, ((BMHeader *)el)->htype), \
|
||||
bmesh_elem_check(el, ((BMHeader *)el)->htype), \
|
||||
__LINE__, __FILE__); \
|
||||
}
|
||||
|
||||
#define BM_DISK_EDGE_LINK_GET(e, v) ( \
|
||||
((v) == ((BMEdge *)(e))->v1) ? \
|
||||
&((e)->v1_disk_link) : \
|
||||
&((e)->v2_disk_link) \
|
||||
)
|
||||
} (void)0
|
||||
#endif
|
||||
|
||||
int bmesh_radial_length(BMLoop *l);
|
||||
int bmesh_disk_count(BMVert *v);
|
||||
|
@ -153,10 +153,22 @@ int bmesh_edge_swapverts(BMEdge *e, BMVert *orig, BMVert *newv)
|
||||
* advantage is that no intrinsic properties of the data structures are dependent upon the
|
||||
* cycle order and all non-manifold conditions are represented trivially.
|
||||
*/
|
||||
|
||||
BLI_INLINE BMDiskLink *bmesh_disk_edge_link_from_vert(BMEdge *e, BMVert *v)
|
||||
{
|
||||
if (v == e->v1) {
|
||||
return &e->v1_disk_link;
|
||||
}
|
||||
else {
|
||||
BLI_assert(v == e->v2);
|
||||
return &e->v2_disk_link;
|
||||
}
|
||||
}
|
||||
|
||||
int bmesh_disk_edge_append(BMEdge *e, BMVert *v)
|
||||
{
|
||||
if (!v->e) {
|
||||
BMDiskLink *dl1 = BM_DISK_EDGE_LINK_GET(e, v);
|
||||
BMDiskLink *dl1 = bmesh_disk_edge_link_from_vert(e, v);
|
||||
|
||||
v->e = e;
|
||||
dl1->next = dl1->prev = e;
|
||||
@ -164,9 +176,9 @@ int bmesh_disk_edge_append(BMEdge *e, BMVert *v)
|
||||
else {
|
||||
BMDiskLink *dl1, *dl2, *dl3;
|
||||
|
||||
dl1 = BM_DISK_EDGE_LINK_GET(e, v);
|
||||
dl2 = BM_DISK_EDGE_LINK_GET(v->e, v);
|
||||
dl3 = dl2->prev ? BM_DISK_EDGE_LINK_GET(dl2->prev, v) : NULL;
|
||||
dl1 = bmesh_disk_edge_link_from_vert(e, v);
|
||||
dl2 = bmesh_disk_edge_link_from_vert(v->e, v);
|
||||
dl3 = dl2->prev ? bmesh_disk_edge_link_from_vert(dl2->prev, v) : NULL;
|
||||
|
||||
dl1->next = v->e;
|
||||
dl1->prev = dl2->prev;
|
||||
@ -183,14 +195,14 @@ void bmesh_disk_edge_remove(BMEdge *e, BMVert *v)
|
||||
{
|
||||
BMDiskLink *dl1, *dl2;
|
||||
|
||||
dl1 = BM_DISK_EDGE_LINK_GET(e, v);
|
||||
dl1 = bmesh_disk_edge_link_from_vert(e, v);
|
||||
if (dl1->prev) {
|
||||
dl2 = BM_DISK_EDGE_LINK_GET(dl1->prev, v);
|
||||
dl2 = bmesh_disk_edge_link_from_vert(dl1->prev, v);
|
||||
dl2->next = dl1->next;
|
||||
}
|
||||
|
||||
if (dl1->next) {
|
||||
dl2 = BM_DISK_EDGE_LINK_GET(dl1->next, v);
|
||||
dl2 = bmesh_disk_edge_link_from_vert(dl1->next, v);
|
||||
dl2->prev = dl1->prev;
|
||||
}
|
||||
|
||||
|
@ -339,7 +339,6 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
j = 0;
|
||||
if (vv1[0] == vv1[lenv1 - 1]) {
|
||||
lenv1--;
|
||||
}
|
||||
|
@ -163,6 +163,8 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
|
||||
COLLADABU::NativeString(std::string(this->export_settings->filepath));
|
||||
COLLADASW::StreamWriter sw(native_filename);
|
||||
|
||||
fprintf(stdout, "Collada export: %s\n", this->export_settings->filepath);
|
||||
|
||||
// open <collada>
|
||||
sw.startDocument();
|
||||
|
||||
|
@ -132,14 +132,17 @@ void GeometryExporter::operator()(Object *ob)
|
||||
|
||||
createLooseEdgeList(ob, me, geom_id, norind);
|
||||
|
||||
// XXX slow
|
||||
if (ob->totcol) {
|
||||
for (int a = 0; a < ob->totcol; a++) {
|
||||
createPolylist(a, has_uvs, has_color, ob, me, geom_id, norind);
|
||||
// Only create Polylists if number of faces > 0
|
||||
if (me->totface > 0) {
|
||||
// XXX slow
|
||||
if (ob->totcol) {
|
||||
for (int a = 0; a < ob->totcol; a++) {
|
||||
createPolylist(a, has_uvs, has_color, ob, me, geom_id, norind);
|
||||
}
|
||||
}
|
||||
else {
|
||||
createPolylist(0, has_uvs, has_color, ob, me, geom_id, norind);
|
||||
}
|
||||
}
|
||||
else {
|
||||
createPolylist(0, has_uvs, has_color, ob, me, geom_id, norind);
|
||||
}
|
||||
|
||||
closeMesh();
|
||||
@ -248,7 +251,7 @@ void GeometryExporter::createPolylist(short material_index,
|
||||
|
||||
// no faces using this material
|
||||
if (faces_in_polylist == 0) {
|
||||
fprintf(stderr, "%s: no faces use material %d\n", id_name(ob).c_str(), material_index);
|
||||
fprintf(stderr, "%s: material with index %d is not used.\n", id_name(ob).c_str(), material_index);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -119,12 +119,15 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies)
|
||||
|
||||
// This image is already located on the file system.
|
||||
// But we want to create copies here.
|
||||
// To avoid overwroting images with same file name but
|
||||
// differenet source locations
|
||||
// To move images into the same export directory.
|
||||
// Note: If an image is already located in the export folder,
|
||||
// then skip the copy (as it would result in a file copy error).
|
||||
|
||||
if (BLI_copy(source_path, export_path) != 0) {
|
||||
fprintf(stderr, "Collada export: Cannot copy image:\n source:%s\ndest :%s\n", source_path, export_path);
|
||||
return;
|
||||
if (BLI_path_cmp(source_path, export_path) != 0) {
|
||||
if (BLI_copy(source_path, export_path) != 0) {
|
||||
fprintf(stderr, "Collada export: Cannot copy image:\n source:%s\ndest :%s\n", source_path, export_path);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BLI_strncpy(export_path, export_file, sizeof(export_path));
|
||||
@ -132,7 +135,7 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies)
|
||||
}
|
||||
else {
|
||||
|
||||
// Do not make any vopies, but use the source path directly as reference
|
||||
// Do not make any copies, but use the source path directly as reference
|
||||
// to the original image
|
||||
|
||||
BLI_strncpy(export_path, source_path, sizeof(export_path));
|
||||
|
@ -124,19 +124,26 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOper
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
unsigned int index;
|
||||
vector<InputSocket *> &inputsockets = this->getInputSockets();
|
||||
|
||||
for (index = 0; index < inputsockets.size(); index++) {
|
||||
InputSocket *inputsocket = inputsockets[index];
|
||||
if (inputsocket->isConnected()) {
|
||||
NodeOperation *inputoperation = (NodeOperation *)inputsocket->getConnection()->getFromNode();
|
||||
bool result = inputoperation->determineDependingAreaOfInterest(input, readOperation, output);
|
||||
if (result) {
|
||||
return true;
|
||||
rcti tempOutput;
|
||||
bool first = true;
|
||||
for (int i = 0 ; i < getNumberOfInputSockets() ; i ++) {
|
||||
NodeOperation * inputOperation = this->getInputOperation(i);
|
||||
if (inputOperation && inputOperation->determineDependingAreaOfInterest(input, readOperation, &tempOutput)) {
|
||||
if (first) {
|
||||
output->xmin = tempOutput.xmin;
|
||||
output->ymin = tempOutput.ymin;
|
||||
output->xmax = tempOutput.xmax;
|
||||
output->ymax = tempOutput.ymax;
|
||||
first = false;
|
||||
}
|
||||
else {
|
||||
output->xmin = MIN2(output->xmin, tempOutput.xmin);
|
||||
output->ymin = MIN2(output->ymin, tempOutput.ymin);
|
||||
output->xmax = MAX2(output->xmax, tempOutput.xmax);
|
||||
output->ymax = MAX2(output->ymax, tempOutput.ymax);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return !first;
|
||||
}
|
||||
}
|
||||
|
@ -37,31 +37,6 @@ CombineChannelsOperation::CombineChannelsOperation() : NodeOperation()
|
||||
this->m_inputChannel4Operation = NULL;
|
||||
}
|
||||
|
||||
bool CombineChannelsOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti tempOutput;
|
||||
bool first = true;
|
||||
for (int i = 0 ; i < 4 ; i ++) {
|
||||
NodeOperation * inputOperation = this->getInputOperation(i);
|
||||
if (inputOperation->determineDependingAreaOfInterest(input, readOperation, &tempOutput)) {
|
||||
if (first) {
|
||||
output->xmin = tempOutput.xmin;
|
||||
output->ymin = tempOutput.ymin;
|
||||
output->xmax = tempOutput.xmax;
|
||||
output->ymax = tempOutput.ymax;
|
||||
first = false;
|
||||
}
|
||||
else {
|
||||
output->xmin = MIN2(output->xmin, tempOutput.xmin);
|
||||
output->ymin = MIN2(output->ymin, tempOutput.ymin);
|
||||
output->xmax = MAX2(output->xmax, tempOutput.xmax);
|
||||
output->ymax = MAX2(output->ymax, tempOutput.ymax);
|
||||
}
|
||||
}
|
||||
}
|
||||
return !first;
|
||||
}
|
||||
|
||||
void CombineChannelsOperation::initExecution()
|
||||
{
|
||||
this->m_inputChannel1Operation = this->getInputSocketReader(0);
|
||||
@ -82,7 +57,6 @@ void CombineChannelsOperation::deinitExecution()
|
||||
void CombineChannelsOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float input[4];
|
||||
/// @todo: remove if statements
|
||||
if (this->m_inputChannel1Operation) {
|
||||
this->m_inputChannel1Operation->read(input, x, y, sampler);
|
||||
output[0] = input[0];
|
||||
|
@ -37,8 +37,6 @@ public:
|
||||
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
|
||||
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1019,6 +1019,7 @@ static void select_timeline_marker_frame(ListBase *markers, int frame, unsigned
|
||||
static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
|
||||
{
|
||||
ListBase *markers = ED_context_get_markers(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
View2D *v2d = UI_view2d_fromcontext(C);
|
||||
float viewx;
|
||||
int x, y, cfra;
|
||||
@ -1026,8 +1027,8 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
|
||||
if (markers == NULL)
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
|
||||
x = evt->x - CTX_wm_region(C)->winrct.xmin;
|
||||
y = evt->y - CTX_wm_region(C)->winrct.ymin;
|
||||
x = evt->x - ar->winrct.xmin;
|
||||
y = evt->y - ar->winrct.ymin;
|
||||
|
||||
UI_view2d_region_to_view(v2d, x, y, &viewx, NULL);
|
||||
|
||||
|
@ -61,9 +61,7 @@ void ED_space_image_get_uv_aspect(struct SpaceImage *sima, float *aspx, float *a
|
||||
void ED_space_image_paint_update(struct wmWindowManager *wm, struct ToolSettings *settings);
|
||||
void ED_space_image_uv_sculpt_update(struct wmWindowManager *wm, struct ToolSettings *settings);
|
||||
|
||||
void ED_image_get_size(struct Image *ima, int *width, int *height);
|
||||
void ED_image_get_aspect(struct Image *ima, float *aspx, float *aspy);
|
||||
void ED_image_get_uv_aspect(struct Image *ima, float *aspx, float *aspy);
|
||||
void ED_image_get_uv_aspect(struct Image *ima, struct ImageUser *iuser, float *aspx, float *aspy);
|
||||
void ED_image_mouse_pos(struct SpaceImage *sima, struct ARegion *ar, const int mval[2], float co[2]);
|
||||
void ED_image_point_pos(struct SpaceImage *sima, struct ARegion *ar, float x, float y, float *xr, float *yr);
|
||||
void ED_image_point_pos__reverse(struct SpaceImage *sima, struct ARegion *ar, const float co[2], float r_co[2]);
|
||||
|
@ -56,7 +56,8 @@ void ED_operatormacros_mask(void);
|
||||
void ED_mask_draw(const bContext *C, const char draw_flag, const char draw_type);
|
||||
void ED_mask_draw_region(struct Mask *mask, struct ARegion *ar,
|
||||
const char draw_flag, const char draw_type,
|
||||
int width, int height,
|
||||
const int width_i, const int height_i,
|
||||
const float aspx, const float aspy,
|
||||
const short do_scale_applied, const short do_post_draw,
|
||||
float stabmat[4][4],
|
||||
const bContext *C);
|
||||
|
@ -187,16 +187,17 @@ typedef struct uiLayout uiLayout;
|
||||
* - bit 8: for 'bit'
|
||||
* - bit 9-15: button type (now 6 bits, 64 types)
|
||||
* */
|
||||
typedef enum {
|
||||
UI_BUT_POIN_CHAR = 32,
|
||||
UI_BUT_POIN_SHORT = 64,
|
||||
UI_BUT_POIN_INT = 96,
|
||||
UI_BUT_POIN_FLOAT = 128,
|
||||
/* UI_BUT_POIN_FUNCTION = 192, */ /*UNUSED*/
|
||||
UI_BUT_POIN_BIT = 256 /* OR'd with a bit index*/
|
||||
} eButPointerType;
|
||||
|
||||
#define CHA 32
|
||||
#define SHO 64
|
||||
#define INT 96
|
||||
#define FLO 128
|
||||
/*#define FUN 192*/ /*UNUSED*/
|
||||
#define BIT 256
|
||||
|
||||
/* button reqyires a pointer */
|
||||
#define BUTPOIN (FLO | SHO | CHA)
|
||||
/* button requires a pointer */
|
||||
#define UI_BUT_POIN_TYPES (UI_BUT_POIN_FLOAT | UI_BUT_POIN_SHORT | UI_BUT_POIN_CHAR)
|
||||
|
||||
/* assigned to but->type, OR'd with the flags above when passing args */
|
||||
typedef enum {
|
||||
@ -214,7 +215,7 @@ typedef enum {
|
||||
ICONROW = (12 << 9),
|
||||
ICONTOG = (13 << 9),
|
||||
NUMSLI = (14 << 9),
|
||||
COL = (15 << 9),
|
||||
COLOR = (15 << 9),
|
||||
IDPOIN = (16 << 9),
|
||||
HSVSLI = (17 << 9),
|
||||
SCROLL = (18 << 9),
|
||||
|
@ -761,7 +761,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
|
||||
* fun first pass on all buttons so first word chars always get first priority */
|
||||
|
||||
for (but = block->buttons.first; but; but = but->next) {
|
||||
if (!ELEM4(but->type, BUT, MENU, BLOCK, PULLDOWN) || (but->flag & UI_HIDDEN)) {
|
||||
if (!ELEM5(but->type, BUT, BUTM, MENU, BLOCK, PULLDOWN) || (but->flag & UI_HIDDEN)) {
|
||||
/* pass */
|
||||
}
|
||||
else if (but->menu_key == '\0') {
|
||||
@ -1151,7 +1151,7 @@ static void ui_is_but_sel(uiBut *but, double *value)
|
||||
if (*value == (double)but->hardmax) is_push = 1;
|
||||
}
|
||||
break;
|
||||
case COL:
|
||||
case COLOR:
|
||||
is_push = 2;
|
||||
break;
|
||||
default:
|
||||
@ -1311,13 +1311,13 @@ void ui_get_but_vectorf(uiBut *but, float vec[3])
|
||||
vec[a] = RNA_property_float_get_index(&but->rnapoin, prop, a);
|
||||
}
|
||||
}
|
||||
else if (but->pointype == CHA) {
|
||||
else if (but->pointype == UI_BUT_POIN_CHAR) {
|
||||
char *cp = (char *)but->poin;
|
||||
vec[0] = ((float)cp[0]) / 255.0f;
|
||||
vec[1] = ((float)cp[1]) / 255.0f;
|
||||
vec[2] = ((float)cp[2]) / 255.0f;
|
||||
}
|
||||
else if (but->pointype == FLO) {
|
||||
else if (but->pointype == UI_BUT_POIN_FLOAT) {
|
||||
float *fp = (float *)but->poin;
|
||||
copy_v3_v3(vec, fp);
|
||||
}
|
||||
@ -1357,13 +1357,13 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3])
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (but->pointype == CHA) {
|
||||
else if (but->pointype == UI_BUT_POIN_CHAR) {
|
||||
char *cp = (char *)but->poin;
|
||||
cp[0] = (char)(0.5f + vec[0] * 255.0f);
|
||||
cp[1] = (char)(0.5f + vec[1] * 255.0f);
|
||||
cp[2] = (char)(0.5f + vec[2] * 255.0f);
|
||||
}
|
||||
else if (but->pointype == FLO) {
|
||||
else if (but->pointype == UI_BUT_POIN_FLOAT) {
|
||||
float *fp = (float *)but->poin;
|
||||
copy_v3_v3(fp, vec);
|
||||
}
|
||||
@ -1371,7 +1371,7 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3])
|
||||
|
||||
int ui_is_but_float(uiBut *but)
|
||||
{
|
||||
if (but->pointype == FLO && but->poin)
|
||||
if (but->pointype == UI_BUT_POIN_FLOAT && but->poin)
|
||||
return 1;
|
||||
|
||||
if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_FLOAT)
|
||||
@ -1467,16 +1467,16 @@ double ui_get_but_val(uiBut *but)
|
||||
case 'V': value = hsv[2]; break;
|
||||
}
|
||||
}
|
||||
else if (but->pointype == CHA) {
|
||||
else if (but->pointype == UI_BUT_POIN_CHAR) {
|
||||
value = *(char *)but->poin;
|
||||
}
|
||||
else if (but->pointype == SHO) {
|
||||
else if (but->pointype == UI_BUT_POIN_SHORT) {
|
||||
value = *(short *)but->poin;
|
||||
}
|
||||
else if (but->pointype == INT) {
|
||||
else if (but->pointype == UI_BUT_POIN_INT) {
|
||||
value = *(int *)but->poin;
|
||||
}
|
||||
else if (but->pointype == FLO) {
|
||||
else if (but->pointype == UI_BUT_POIN_FLOAT) {
|
||||
value = *(float *)but->poin;
|
||||
}
|
||||
|
||||
@ -1548,9 +1548,10 @@ void ui_set_but_val(uiBut *but, double value)
|
||||
}
|
||||
else {
|
||||
/* first do rounding */
|
||||
if (but->pointype == CHA)
|
||||
if (but->pointype == UI_BUT_POIN_CHAR) {
|
||||
value = (char)floor(value + 0.5);
|
||||
else if (but->pointype == SHO) {
|
||||
}
|
||||
else if (but->pointype == UI_BUT_POIN_SHORT) {
|
||||
/* gcc 3.2.1 seems to have problems
|
||||
* casting a double like 32772.0 to
|
||||
* a short so we cast to an int, then
|
||||
@ -1564,9 +1565,9 @@ void ui_set_but_val(uiBut *but, double value)
|
||||
gcckludge = (int) floor(value + 0.5);
|
||||
value = (short)gcckludge;
|
||||
}
|
||||
else if (but->pointype == INT)
|
||||
else if (but->pointype == UI_BUT_POIN_INT)
|
||||
value = (int)floor(value + 0.5);
|
||||
else if (but->pointype == FLO) {
|
||||
else if (but->pointype == UI_BUT_POIN_FLOAT) {
|
||||
float fval = (float)value;
|
||||
if (fval >= -0.00001f && fval <= 0.00001f) fval = 0.0f; /* prevent negative zero */
|
||||
value = fval;
|
||||
@ -1575,13 +1576,13 @@ void ui_set_but_val(uiBut *but, double value)
|
||||
/* then set value with possible edit override */
|
||||
if (but->editval)
|
||||
value = *but->editval = value;
|
||||
else if (but->pointype == CHA)
|
||||
else if (but->pointype == UI_BUT_POIN_CHAR)
|
||||
value = *((char *)but->poin) = (char)value;
|
||||
else if (but->pointype == SHO)
|
||||
else if (but->pointype == UI_BUT_POIN_SHORT)
|
||||
value = *((short *)but->poin) = (short)value;
|
||||
else if (but->pointype == INT)
|
||||
else if (but->pointype == UI_BUT_POIN_INT)
|
||||
value = *((int *)but->poin) = (int)value;
|
||||
else if (but->pointype == FLO)
|
||||
else if (but->pointype == UI_BUT_POIN_FLOAT)
|
||||
value = *((float *)but->poin) = (float)value;
|
||||
}
|
||||
|
||||
@ -2620,7 +2621,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
|
||||
uiBut *but;
|
||||
int slen;
|
||||
|
||||
if (type & BUTPOIN) { /* a pointer is required */
|
||||
if (type & UI_BUT_POIN_TYPES) { /* a pointer is required */
|
||||
if (poin == NULL)
|
||||
return NULL;
|
||||
}
|
||||
@ -2628,8 +2629,8 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
|
||||
but = MEM_callocN(sizeof(uiBut), "uiBut");
|
||||
|
||||
but->type = type & BUTTYPE;
|
||||
but->pointype = type & BUTPOIN;
|
||||
but->bit = type & BIT;
|
||||
but->pointype = type & UI_BUT_POIN_TYPES;
|
||||
but->bit = type & UI_BUT_POIN_BIT;
|
||||
but->bitnr = type & 31;
|
||||
but->icon = ICON_NONE;
|
||||
but->iconadd = 0;
|
||||
@ -3102,40 +3103,40 @@ static uiBut *uiDefButBit(uiBlock *block, int type, int bit, int retval, const c
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
return uiDefBut(block, type | BIT | bitIdx, retval, str, x, y, width, height, poin, min, max, a1, a2, tip);
|
||||
return uiDefBut(block, type | UI_BUT_POIN_BIT | bitIdx, retval, str, x, y, width, height, poin, min, max, a1, a2, tip);
|
||||
}
|
||||
}
|
||||
uiBut *uiDefButF(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefBut(block, type | FLO, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefBut(block, type | UI_BUT_POIN_FLOAT, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefButBitF(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefButBit(block, type | FLO, bit, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefButBit(block, type | UI_BUT_POIN_FLOAT, bit, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefButI(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefBut(block, type | INT, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefBut(block, type | UI_BUT_POIN_INT, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefButBitI(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefButBit(block, type | INT, bit, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefButBit(block, type | UI_BUT_POIN_INT, bit, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefButS(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefBut(block, type | SHO, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefBut(block, type | UI_BUT_POIN_SHORT, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefButBitS(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefButBit(block, type | SHO, bit, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefButBit(block, type | UI_BUT_POIN_SHORT, bit, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefButC(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefBut(block, type | CHA, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefBut(block, type | UI_BUT_POIN_CHAR, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefButBit(block, type | CHA, bit, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefButBit(block, type | UI_BUT_POIN_CHAR, bit, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefButR(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
@ -3187,41 +3188,41 @@ static uiBut *uiDefIconButBit(uiBlock *block, int type, int bit, int retval, int
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
return uiDefIconBut(block, type | BIT | bitIdx, retval, icon, x, y, width, height, poin, min, max, a1, a2, tip);
|
||||
return uiDefIconBut(block, type | UI_BUT_POIN_BIT | bitIdx, retval, icon, x, y, width, height, poin, min, max, a1, a2, tip);
|
||||
}
|
||||
}
|
||||
|
||||
uiBut *uiDefIconButF(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefIconBut(block, type | FLO, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefIconBut(block, type | UI_BUT_POIN_FLOAT, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconButBitF(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefIconButBit(block, type | FLO, bit, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefIconButBit(block, type | UI_BUT_POIN_FLOAT, bit, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconButI(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefIconBut(block, type | INT, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefIconBut(block, type | UI_BUT_POIN_INT, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconButBitI(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefIconButBit(block, type | INT, bit, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefIconButBit(block, type | UI_BUT_POIN_INT, bit, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconButS(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefIconBut(block, type | SHO, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefIconBut(block, type | UI_BUT_POIN_SHORT, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconButBitS(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefIconButBit(block, type | SHO, bit, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefIconButBit(block, type | UI_BUT_POIN_SHORT, bit, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconButC(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefIconBut(block, type | CHA, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefIconBut(block, type | UI_BUT_POIN_CHAR, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconButBitC(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefIconButBit(block, type | CHA, bit, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefIconButBit(block, type | UI_BUT_POIN_CHAR, bit, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconButR(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
@ -3266,41 +3267,41 @@ static uiBut *uiDefIconTextButBit(uiBlock *block, int type, int bit, int retval,
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
return uiDefIconTextBut(block, type | BIT | bitIdx, retval, icon, str, x, y, width, height, poin, min, max, a1, a2, tip);
|
||||
return uiDefIconTextBut(block, type | UI_BUT_POIN_BIT | bitIdx, retval, icon, str, x, y, width, height, poin, min, max, a1, a2, tip);
|
||||
}
|
||||
}
|
||||
|
||||
uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefIconTextBut(block, type | FLO, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefIconTextBut(block, type | UI_BUT_POIN_FLOAT, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefIconTextButBit(block, type | FLO, bit, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefIconTextButBit(block, type | UI_BUT_POIN_FLOAT, bit, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefIconTextBut(block, type | INT, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefIconTextBut(block, type | UI_BUT_POIN_INT, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconTextButBitI(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefIconTextButBit(block, type | INT, bit, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefIconTextButBit(block, type | UI_BUT_POIN_INT, bit, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefIconTextBut(block, type | SHO, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefIconTextBut(block, type | UI_BUT_POIN_SHORT, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefIconTextButBit(block, type | SHO, bit, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefIconTextButBit(block, type | UI_BUT_POIN_SHORT, bit, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefIconTextBut(block, type | CHA, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefIconTextBut(block, type | UI_BUT_POIN_CHAR, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
return uiDefIconTextButBit(block, type | CHA, bit, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
return uiDefIconTextButBit(block, type | UI_BUT_POIN_CHAR, bit, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
@ -3698,7 +3699,7 @@ uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int
|
||||
|
||||
uiBut *uiDefKeyevtButS(uiBlock *block, int retval, const char *str, int x, int y, short width, short height, short *spoin, const char *tip)
|
||||
{
|
||||
uiBut *but = ui_def_but(block, KEYEVT | SHO, retval, str, x, y, width, height, spoin, 0.0, 0.0, 0.0, 0.0, tip);
|
||||
uiBut *but = ui_def_but(block, KEYEVT | UI_BUT_POIN_SHORT, retval, str, x, y, width, height, spoin, 0.0, 0.0, 0.0, 0.0, tip);
|
||||
ui_check_but(but);
|
||||
return but;
|
||||
}
|
||||
@ -3707,7 +3708,7 @@ uiBut *uiDefKeyevtButS(uiBlock *block, int retval, const char *str, int x, int y
|
||||
/* modkeypoin will be set to KM_SHIFT, KM_ALT, KM_CTRL, KM_OSKEY bits */
|
||||
uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x, int y, short width, short height, short *keypoin, short *modkeypoin, const char *tip)
|
||||
{
|
||||
uiBut *but = ui_def_but(block, HOTKEYEVT | SHO, retval, str, x, y, width, height, keypoin, 0.0, 0.0, 0.0, 0.0, tip);
|
||||
uiBut *but = ui_def_but(block, HOTKEYEVT | UI_BUT_POIN_SHORT, retval, str, x, y, width, height, keypoin, 0.0, 0.0, 0.0, 0.0, tip);
|
||||
but->modifier_key = *modkeypoin;
|
||||
ui_check_but(but);
|
||||
return but;
|
||||
|
@ -494,10 +494,12 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data)
|
||||
|
||||
/* local hack... */
|
||||
if (but->type == BUT_TOGDUAL && data->togdual) {
|
||||
if (but->pointype == SHO)
|
||||
if (but->pointype == UI_BUT_POIN_SHORT) {
|
||||
but->poin += 2;
|
||||
else if (but->pointype == INT)
|
||||
}
|
||||
else if (but->pointype == UI_BUT_POIN_INT) {
|
||||
but->poin += 4;
|
||||
}
|
||||
}
|
||||
|
||||
value = ui_get_but_val(but);
|
||||
@ -534,10 +536,12 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data)
|
||||
|
||||
/* end local hack... */
|
||||
if (but->type == BUT_TOGDUAL && data->togdual) {
|
||||
if (but->pointype == SHO)
|
||||
if (but->pointype == UI_BUT_POIN_SHORT) {
|
||||
but->poin -= 2;
|
||||
else if (but->pointype == INT)
|
||||
}
|
||||
else if (but->pointype == UI_BUT_POIN_INT) {
|
||||
but->poin -= 4;
|
||||
}
|
||||
}
|
||||
|
||||
ui_apply_but_func(C, but);
|
||||
@ -605,7 +609,7 @@ static void ui_apply_but_NUM(bContext *C, uiBut *but, uiHandleButtonData *data)
|
||||
|
||||
static void ui_apply_but_TOG3(bContext *C, uiBut *but, uiHandleButtonData *data)
|
||||
{
|
||||
if (but->pointype == SHO) {
|
||||
if (but->pointype == UI_BUT_POIN_SHORT) {
|
||||
short *sp = (short *)but->poin;
|
||||
|
||||
if (UI_BITBUT_TEST(sp[1], but->bitnr)) {
|
||||
@ -1049,7 +1053,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
|
||||
case PULLDOWN:
|
||||
ui_apply_but_BLOCK(C, but, data);
|
||||
break;
|
||||
case COL:
|
||||
case COLOR:
|
||||
if (data->cancel)
|
||||
ui_apply_but_VEC(C, but, data);
|
||||
else
|
||||
@ -1180,7 +1184,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
|
||||
}
|
||||
|
||||
/* RGB triple */
|
||||
else if (but->type == COL) {
|
||||
else if (but->type == COLOR) {
|
||||
float rgb[3];
|
||||
|
||||
if (but->poin == NULL && but->rnapoin.data == NULL) ;
|
||||
@ -2092,12 +2096,12 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
|
||||
menufunc = ui_block_func_ICONTEXTROW;
|
||||
arg = but;
|
||||
break;
|
||||
case COL:
|
||||
case COLOR:
|
||||
ui_get_but_vectorf(but, data->origvec);
|
||||
copy_v3_v3(data->vec, data->origvec);
|
||||
but->editvec = data->vec;
|
||||
|
||||
handlefunc = ui_block_func_COL;
|
||||
handlefunc = ui_block_func_COLOR;
|
||||
arg = but;
|
||||
break;
|
||||
|
||||
@ -3001,7 +3005,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
|
||||
return WM_UI_HANDLER_BREAK;
|
||||
}
|
||||
}
|
||||
else if (but->type == COL) {
|
||||
else if (but->type == COLOR) {
|
||||
if (ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) {
|
||||
float *hsv = ui_block_hsv_get(but->block);
|
||||
float col[3];
|
||||
@ -4914,7 +4918,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
|
||||
case BUTM:
|
||||
retval = ui_do_but_BUT(C, but, data, event);
|
||||
break;
|
||||
case COL:
|
||||
case COLOR:
|
||||
if (but->a1 == UI_GRAD_V_ALT) /* signal to prevent calling up color picker */
|
||||
retval = ui_do_but_EXIT(C, but, data, event);
|
||||
else
|
||||
@ -5880,7 +5884,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
|
||||
}
|
||||
}
|
||||
|
||||
if (but->type != COL) { /* exception */
|
||||
if (but->type != COLOR) { /* exception */
|
||||
data->cancel = TRUE;
|
||||
}
|
||||
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
||||
@ -5990,7 +5994,7 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut *
|
||||
|
||||
/* copy over return values from the closing menu */
|
||||
if ((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_UPDATE)) {
|
||||
if (but->type == COL)
|
||||
if (but->type == COLOR)
|
||||
copy_v3_v3(data->vec, menu->retvec);
|
||||
else if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
|
||||
data->value = menu->retvalue;
|
||||
@ -6420,7 +6424,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
|
||||
for (but = block->buttons.first; but; but = but->next) {
|
||||
|
||||
if (but->menu_key == event->type) {
|
||||
if (but->type == BUT) {
|
||||
if (ELEM(but->type, BUT, BUTM)) {
|
||||
/* mainly for operator buttons */
|
||||
ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_APPLY);
|
||||
}
|
||||
|
@ -94,8 +94,7 @@ typedef enum {
|
||||
UI_WTYPE_BOX,
|
||||
UI_WTYPE_SCROLL,
|
||||
UI_WTYPE_LISTITEM,
|
||||
UI_WTYPE_PROGRESSBAR,
|
||||
|
||||
UI_WTYPE_PROGRESSBAR
|
||||
} uiWidgetTypeEnum;
|
||||
|
||||
/* panel limits */
|
||||
@ -133,7 +132,7 @@ typedef enum {
|
||||
|
||||
/* bit button defines */
|
||||
/* Bit operations */
|
||||
#define UI_BITBUT_TEST(a, b) ( ( (a) & 1 << (b) ) != 0)
|
||||
#define UI_BITBUT_TEST(a, b) ( ( (a) & 1 << (b) ) != 0)
|
||||
#define UI_BITBUT_SET(a, b) ( (a) | 1 << (b) )
|
||||
#define UI_BITBUT_CLR(a, b) ( (a) & ~(1 << (b)) )
|
||||
/* bit-row */
|
||||
@ -159,8 +158,9 @@ typedef struct {
|
||||
struct uiBut {
|
||||
struct uiBut *next, *prev;
|
||||
int flag, drawflag;
|
||||
eButType type;
|
||||
short pointype, bit, bitnr, retval, strwidth, ofs, pos, selsta, selend, alignnr;
|
||||
eButType type;
|
||||
eButPointerType pointype;
|
||||
short bit, bitnr, retval, strwidth, ofs, pos, selsta, selend, alignnr;
|
||||
|
||||
char *str;
|
||||
char strdata[UI_MAX_NAME_STR];
|
||||
@ -430,7 +430,7 @@ struct uiPopupBlockHandle {
|
||||
float retvec[4];
|
||||
};
|
||||
|
||||
uiBlock *ui_block_func_COL(struct bContext *C, uiPopupBlockHandle *handle, void *arg_but);
|
||||
uiBlock *ui_block_func_COLOR(struct bContext *C, uiPopupBlockHandle *handle, void *arg_but);
|
||||
void ui_block_func_ICONROW(struct bContext *C, uiLayout *layout, void *arg_but);
|
||||
void ui_block_func_ICONTEXTROW(struct bContext *C, uiLayout *layout, void *arg_but);
|
||||
|
||||
|
@ -1808,11 +1808,11 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
|
||||
bt->flag = UI_TEXT_LEFT;
|
||||
}
|
||||
else if (entry->icon) {
|
||||
uiDefIconTextButF(block, BUTM | FLO, B_NOP, entry->icon, entry->str, 0, 0,
|
||||
uiDefIconTextButF(block, BUTM, B_NOP, entry->icon, entry->str, 0, 0,
|
||||
UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, (float) entry->retval, 0.0, 0, 0, "");
|
||||
}
|
||||
else {
|
||||
uiDefButF(block, BUTM | FLO, B_NOP, entry->str, 0, 0,
|
||||
uiDefButF(block, BUTM, B_NOP, entry->str, 0, 0,
|
||||
UI_UNIT_X * 5, UI_UNIT_X, &handle->retvalue, (float) entry->retval, 0.0, 0, 0, "");
|
||||
}
|
||||
}
|
||||
@ -1830,7 +1830,7 @@ void ui_block_func_ICONROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but)
|
||||
uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
|
||||
|
||||
for (a = (int)but->hardmin; a <= (int)but->hardmax; a++)
|
||||
uiDefIconButF(block, BUTM | FLO, B_NOP, but->icon + (a - but->hardmin), 0, 0, UI_UNIT_X * 5, UI_UNIT_Y,
|
||||
uiDefIconButF(block, BUTM, B_NOP, but->icon + (a - but->hardmin), 0, 0, UI_UNIT_X * 5, UI_UNIT_Y,
|
||||
&handle->retvalue, (float)a, 0.0, 0, 0, "");
|
||||
}
|
||||
|
||||
@ -1860,7 +1860,7 @@ void ui_block_func_ICONTEXTROW(bContext *UNUSED(C), uiLayout *layout, void *arg_
|
||||
if (entry->sepr)
|
||||
uiItemS(layout);
|
||||
else
|
||||
uiDefIconTextButF(block, BUTM | FLO, B_NOP, (short)((but->icon) + (entry->retval - but->hardmin)), entry->str,
|
||||
uiDefIconTextButF(block, BUTM, B_NOP, (short)((but->icon) + (entry->retval - but->hardmin)), entry->str,
|
||||
0, 0, UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, (float) entry->retval, 0.0, 0, 0, "");
|
||||
}
|
||||
|
||||
@ -2244,7 +2244,7 @@ static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, w
|
||||
return 0;
|
||||
}
|
||||
|
||||
uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_but)
|
||||
uiBlock *ui_block_func_COLOR(bContext *C, uiPopupBlockHandle *handle, void *arg_but)
|
||||
{
|
||||
uiBut *but = arg_but;
|
||||
uiBlock *block;
|
||||
|
@ -78,7 +78,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
|
||||
|
||||
if (arraylen && index == -1) {
|
||||
if (ELEM(RNA_property_subtype(prop), PROP_COLOR, PROP_COLOR_GAMMA))
|
||||
but = uiDefButR_prop(block, COL, 0, name, x1, y1, x2, y2, ptr, prop, 0, 0, 0, -1, -1, NULL);
|
||||
but = uiDefButR_prop(block, COLOR, 0, name, x1, y1, x2, y2, ptr, prop, 0, 0, 0, -1, -1, NULL);
|
||||
}
|
||||
else if (RNA_property_subtype(prop) == PROP_PERCENTAGE || RNA_property_subtype(prop) == PROP_FACTOR)
|
||||
but = uiDefButR_prop(block, NUMSLI, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
|
||||
|
@ -1255,10 +1255,12 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
|
||||
|
||||
if (but->type == BUT_TOGDUAL) {
|
||||
int dualset = 0;
|
||||
if (but->pointype == SHO)
|
||||
if (but->pointype == UI_BUT_POIN_SHORT) {
|
||||
dualset = UI_BITBUT_TEST(*(((short *)but->poin) + 1), but->bitnr);
|
||||
else if (but->pointype == INT)
|
||||
}
|
||||
else if (but->pointype == UI_BUT_POIN_INT) {
|
||||
dualset = UI_BITBUT_TEST(*(((int *)but->poin) + 1), but->bitnr);
|
||||
}
|
||||
|
||||
widget_draw_icon(but, ICON_DOT, dualset ? 1.0f : 0.25f, rect);
|
||||
}
|
||||
@ -3158,7 +3160,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
|
||||
wt = widget_type(UI_WTYPE_MENU_ITEM);
|
||||
break;
|
||||
|
||||
case COL:
|
||||
case COLOR:
|
||||
wt = widget_type(UI_WTYPE_SWATCH);
|
||||
break;
|
||||
|
||||
|
@ -556,6 +556,7 @@ static int add_vertex_new(const bContext *C, Mask *mask, MaskLayer *masklay, con
|
||||
|
||||
static int add_vertex_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Mask *mask = CTX_data_edit_mask(C);
|
||||
MaskLayer *masklay;
|
||||
|
||||
@ -595,7 +596,7 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
|
||||
BKE_mask_calc_handle_point_auto(spline, point_other, FALSE);
|
||||
|
||||
/* TODO: only update this spline */
|
||||
BKE_mask_update_display(mask, CTX_data_scene(C)->r.cfra);
|
||||
BKE_mask_update_display(mask, CFRA);
|
||||
|
||||
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
||||
return OPERATOR_FINISHED;
|
||||
@ -617,7 +618,7 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
/* TODO: only update this spline */
|
||||
BKE_mask_update_display(mask, CTX_data_scene(C)->r.cfra);
|
||||
BKE_mask_update_display(mask, CFRA);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -496,7 +496,8 @@ void ED_mask_draw(const bContext *C,
|
||||
* width, height are to match the values from ED_mask_get_size() */
|
||||
void ED_mask_draw_region(Mask *mask, ARegion *ar,
|
||||
const char draw_flag, const char draw_type,
|
||||
int width, int height,
|
||||
const int width_i, const int height_i, /* convert directly into aspect corrected vars */
|
||||
const float aspx, const float aspy,
|
||||
const short do_scale_applied, const short do_post_draw,
|
||||
float stabmat[4][4], /* optional - only used by clip */
|
||||
const bContext *C /* optional - only used when do_post_draw is set */
|
||||
@ -504,6 +505,9 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar,
|
||||
{
|
||||
struct View2D *v2d = &ar->v2d;
|
||||
|
||||
/* aspect always scales vertically in movie and image spaces */
|
||||
const float width = width_i, height = (float)height_i * (aspy / aspx);
|
||||
|
||||
int x, y;
|
||||
/* int w, h; */
|
||||
float zoomx, zoomy;
|
||||
|
@ -109,11 +109,9 @@ void ED_mask_mouse_pos(ScrArea *sa, ARegion *ar, const int mval[2], float co[2])
|
||||
}
|
||||
case SPACE_IMAGE:
|
||||
{
|
||||
float frame_size[2];
|
||||
SpaceImage *sima = sa->spacedata.first;
|
||||
ED_space_image_get_size_fl(sima, frame_size);
|
||||
ED_image_mouse_pos(sima, ar, mval, co);
|
||||
BKE_mask_coord_from_frame(co, co, frame_size);
|
||||
BKE_mask_coord_from_image(sima->image, &sima->iuser, co, co);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -149,11 +147,9 @@ void ED_mask_point_pos(ScrArea *sa, ARegion *ar, float x, float y, float *xr, fl
|
||||
break;
|
||||
case SPACE_IMAGE:
|
||||
{
|
||||
float frame_size[2];
|
||||
SpaceImage *sima = sa->spacedata.first;
|
||||
ED_space_image_get_size_fl(sima, frame_size);
|
||||
ED_image_point_pos(sima, ar, x, y, &co[0], &co[1]);
|
||||
BKE_mask_coord_from_frame(co, co, frame_size);
|
||||
BKE_mask_coord_from_image(sima->image, &sima->iuser, co, co);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -192,13 +188,10 @@ void ED_mask_point_pos__reverse(ScrArea *sa, ARegion *ar, float x, float y, floa
|
||||
break;
|
||||
case SPACE_IMAGE:
|
||||
{
|
||||
float frame_size[2];
|
||||
SpaceImage *sima = sa->spacedata.first;
|
||||
ED_space_image_get_size_fl(sima, frame_size);
|
||||
|
||||
co[0] = x;
|
||||
co[1] = y;
|
||||
BKE_mask_coord_to_frame(co, co, frame_size);
|
||||
BKE_mask_coord_to_image(sima->image, &sima->iuser, co, co);
|
||||
ED_image_point_pos__reverse(sima, ar, co, co);
|
||||
break;
|
||||
}
|
||||
|
@ -915,6 +915,7 @@ static void delete_feather_points(MaskSplinePoint *point)
|
||||
|
||||
static int delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Mask *mask = CTX_data_edit_mask(C);
|
||||
MaskLayer *masklay;
|
||||
|
||||
@ -1002,7 +1003,7 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
}
|
||||
|
||||
/* TODO: only update edited splines */
|
||||
BKE_mask_update_display(mask, CTX_data_scene(C)->r.cfra);
|
||||
BKE_mask_update_display(mask, CFRA);
|
||||
|
||||
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
||||
|
||||
@ -1060,7 +1061,7 @@ static int mask_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
if (change) {
|
||||
/* TODO: only update this spline */
|
||||
BKE_mask_update_display(mask, CTX_data_scene(C)->r.cfra);
|
||||
BKE_mask_update_display(mask, CFRA);
|
||||
|
||||
WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);
|
||||
|
||||
@ -1126,7 +1127,7 @@ static int mask_normals_make_consistent_exec(bContext *C, wmOperator *UNUSED(op)
|
||||
|
||||
if (change) {
|
||||
/* TODO: only update this spline */
|
||||
BKE_mask_update_display(mask, CTX_data_scene(C)->r.cfra);
|
||||
BKE_mask_update_display(mask, CFRA);
|
||||
|
||||
WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);
|
||||
|
||||
@ -1324,6 +1325,7 @@ void MASK_OT_hide_view_set(wmOperatorType *ot)
|
||||
|
||||
static int mask_feather_weight_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Mask *mask = CTX_data_edit_mask(C);
|
||||
MaskLayer *masklay;
|
||||
int changed = FALSE;
|
||||
@ -1351,7 +1353,7 @@ static int mask_feather_weight_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
if (changed) {
|
||||
/* TODO: only update edited splines */
|
||||
BKE_mask_update_display(mask, CTX_data_scene(C)->r.cfra);
|
||||
BKE_mask_update_display(mask, CFRA);
|
||||
|
||||
WM_event_add_notifier(C, NC_MASK | ND_DRAW, mask);
|
||||
DAG_id_tag_update(&mask->id, 0);
|
||||
|
@ -1352,6 +1352,8 @@ static void init_bake_internal(BakeRender *bkr, bContext *C)
|
||||
|
||||
static void finish_bake_internal(BakeRender *bkr)
|
||||
{
|
||||
Image *ima;
|
||||
|
||||
RE_Database_Free(bkr->re);
|
||||
|
||||
/* restore raytrace and AO */
|
||||
@ -1363,27 +1365,30 @@ static void finish_bake_internal(BakeRender *bkr)
|
||||
if (bkr->prev_r_raytrace == 0)
|
||||
bkr->scene->r.mode &= ~R_RAYTRACE;
|
||||
|
||||
if (bkr->result == BAKE_RESULT_OK) {
|
||||
Image *ima;
|
||||
/* force OpenGL reload and mipmap recalc */
|
||||
for (ima = G.main->image.first; ima; ima = ima->id.next) {
|
||||
|
||||
/* force OpenGL reload and mipmap recalc */
|
||||
for (ima = G.main->image.first; ima; ima = ima->id.next) {
|
||||
ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
|
||||
|
||||
if (bkr->result == BAKE_RESULT_OK) {
|
||||
if (ima->ok == IMA_OK_LOADED) {
|
||||
ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
|
||||
if (ibuf) {
|
||||
if (ibuf->userflags & IB_BITMAPDIRTY) {
|
||||
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
|
||||
GPU_free_image(ima);
|
||||
imb_freemipmapImBuf(ibuf);
|
||||
}
|
||||
|
||||
/* freed when baking is done, but if its canceled we need to free here */
|
||||
if (ibuf->userdata) {
|
||||
MEM_freeN(ibuf->userdata);
|
||||
ibuf->userdata = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* freed when baking is done, but if its canceled we need to free here */
|
||||
if (ibuf) {
|
||||
if (ibuf->userdata) {
|
||||
MEM_freeN(ibuf->userdata);
|
||||
ibuf->userdata = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1658,7 +1658,7 @@ static int skin_radii_equalize_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
void OBJECT_OT_skin_radii_equalize(wmOperatorType *ot)
|
||||
{
|
||||
ot->name = "Skin Radii Equalize";
|
||||
ot->description = "Make skin radii of selected vertices equal";
|
||||
ot->description = "Make skin radii of selected vertices equal on each axis";
|
||||
ot->idname = "OBJECT_OT_skin_radii_equalize";
|
||||
|
||||
ot->poll = skin_edit_poll;
|
||||
|
@ -158,7 +158,7 @@ void ED_space_clip_get_aspect(SpaceClip *sc, float *aspx, float *aspy)
|
||||
MovieClip *clip = ED_space_clip_get_clip(sc);
|
||||
|
||||
if (clip)
|
||||
BKE_movieclip_aspect(clip, aspx, aspy);
|
||||
BKE_movieclip_get_aspect(clip, aspx, aspy);
|
||||
else
|
||||
*aspx = *aspy = 1.0f;
|
||||
|
||||
|
@ -1131,10 +1131,13 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar)
|
||||
if (mask) {
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
int width, height;
|
||||
float aspx, aspy;
|
||||
ED_mask_get_size(sa, &width, &height);
|
||||
ED_space_clip_get_aspect(sc, &aspx, &aspy);
|
||||
ED_mask_draw_region(mask, ar,
|
||||
sc->mask_info.draw_flag, sc->mask_info.draw_type,
|
||||
width, height,
|
||||
aspx, aspy,
|
||||
TRUE, TRUE,
|
||||
sc->stabmat, C);
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ static FileSelection file_selection_get(bContext *C, const rcti *rect, short fil
|
||||
return sel;
|
||||
}
|
||||
|
||||
static FileSelect file_select_do(bContext *C, int selected_idx)
|
||||
static FileSelect file_select_do(bContext *C, int selected_idx, short do_diropen)
|
||||
{
|
||||
FileSelect retval = FILE_SELECT_NOTHING;
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
@ -172,8 +172,12 @@ static FileSelect file_select_do(bContext *C, int selected_idx)
|
||||
params->active_file = selected_idx;
|
||||
|
||||
if (S_ISDIR(file->type)) {
|
||||
if (do_diropen == FALSE) {
|
||||
params->file[0] = '\0';
|
||||
retval = FILE_SELECT_DIR;
|
||||
}
|
||||
/* the path is too long and we are not going up! */
|
||||
if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX) {
|
||||
else if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX) {
|
||||
// XXX error("Path too long, cannot enter this directory");
|
||||
}
|
||||
else {
|
||||
@ -202,7 +206,7 @@ static FileSelect file_select_do(bContext *C, int selected_idx)
|
||||
}
|
||||
|
||||
|
||||
static FileSelect file_select(bContext *C, const rcti *rect, FileSelType select, short fill)
|
||||
static FileSelect file_select(bContext *C, const rcti *rect, FileSelType select, short fill, short do_diropen)
|
||||
{
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
FileSelect retval = FILE_SELECT_NOTHING;
|
||||
@ -219,7 +223,7 @@ static FileSelect file_select(bContext *C, const rcti *rect, FileSelType select,
|
||||
if ((sel.last >= 0) && ((select == FILE_SEL_ADD) || (select == FILE_SEL_TOGGLE))) {
|
||||
/* Check last selection, if selected, act on the file or dir */
|
||||
if (filelist_is_selected(sfile->files, sel.last, check_type)) {
|
||||
retval = file_select_do(C, sel.last);
|
||||
retval = file_select_do(C, sel.last, do_diropen);
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,7 +288,7 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
|
||||
|
||||
BLI_rcti_isect(&(ar->v2d.mask), &rect, &rect);
|
||||
|
||||
ret = file_select(C, &rect, select ? FILE_SEL_ADD : FILE_SEL_REMOVE, 0);
|
||||
ret = file_select(C, &rect, select ? FILE_SEL_ADD : FILE_SEL_REMOVE, FALSE, FALSE);
|
||||
if (FILE_SELECT_DIR == ret) {
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
|
||||
}
|
||||
@ -320,6 +324,7 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
rcti rect;
|
||||
int extend = RNA_boolean_get(op->ptr, "extend");
|
||||
int fill = RNA_boolean_get(op->ptr, "fill");
|
||||
int do_diropen = RNA_boolean_get(op->ptr, "open");
|
||||
|
||||
if (ar->regiontype != RGN_TYPE_WINDOW)
|
||||
return OPERATOR_CANCELLED;
|
||||
@ -333,7 +338,7 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
/* single select, deselect all selected first */
|
||||
if (!extend) file_deselect_all(sfile, SELECTED_FILE);
|
||||
|
||||
ret = file_select(C, &rect, extend ? FILE_SEL_TOGGLE : FILE_SEL_ADD, fill);
|
||||
ret = file_select(C, &rect, extend ? FILE_SEL_TOGGLE : FILE_SEL_ADD, fill, do_diropen);
|
||||
if (FILE_SELECT_DIR == ret)
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
|
||||
else if (FILE_SELECT_FILE == ret)
|
||||
@ -357,8 +362,9 @@ void FILE_OT_select(wmOperatorType *ot)
|
||||
ot->poll = ED_operator_file_active;
|
||||
|
||||
/* rna */
|
||||
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first");
|
||||
RNA_def_boolean(ot->srna, "fill", 0, "Fill", "Select everything beginning with the last selection");
|
||||
RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
|
||||
RNA_def_boolean(ot->srna, "fill", FALSE, "Fill", "Select everything beginning with the last selection");
|
||||
RNA_def_boolean(ot->srna, "open", TRUE, "Open", "Open a directory when selecting it");
|
||||
}
|
||||
|
||||
static int file_select_all_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
@ -284,8 +284,6 @@ static void file_main_area_init(wmWindowManager *wm, ARegion *ar)
|
||||
|
||||
keymap = WM_keymap_find(wm->defaultconf, "File Browser Main", SPACE_FILE, 0);
|
||||
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void file_main_area_listener(ARegion *ar, wmNotifier *wmn)
|
||||
@ -418,12 +416,26 @@ static void file_keymap(struct wmKeyConfig *keyconf)
|
||||
keymap = WM_keymap_find(keyconf, "File Browser Main", SPACE_FILE, 0);
|
||||
kmi = WM_keymap_add_item(keymap, "FILE_OT_execute", LEFTMOUSE, KM_DBL_CLICK, 0, 0);
|
||||
RNA_boolean_set(kmi->ptr, "need_active", TRUE);
|
||||
|
||||
/* left mouse selects and opens */
|
||||
WM_keymap_add_item(keymap, "FILE_OT_select", LEFTMOUSE, KM_CLICK, 0, 0);
|
||||
kmi = WM_keymap_add_item(keymap, "FILE_OT_select", LEFTMOUSE, KM_CLICK, KM_SHIFT, 0);
|
||||
RNA_boolean_set(kmi->ptr, "extend", TRUE);
|
||||
kmi = WM_keymap_add_item(keymap, "FILE_OT_select", LEFTMOUSE, KM_CLICK, KM_ALT, 0);
|
||||
RNA_boolean_set(kmi->ptr, "extend", TRUE);
|
||||
RNA_boolean_set(kmi->ptr, "fill", TRUE);
|
||||
|
||||
/* right mouse selects without opening */
|
||||
kmi = WM_keymap_add_item(keymap, "FILE_OT_select", RIGHTMOUSE, KM_CLICK, 0, 0);
|
||||
RNA_boolean_set(kmi->ptr, "open", FALSE);
|
||||
kmi = WM_keymap_add_item(keymap, "FILE_OT_select", RIGHTMOUSE, KM_CLICK, KM_SHIFT, 0);
|
||||
RNA_boolean_set(kmi->ptr, "extend", TRUE);
|
||||
RNA_boolean_set(kmi->ptr, "open", FALSE);
|
||||
kmi = WM_keymap_add_item(keymap, "FILE_OT_select", RIGHTMOUSE, KM_CLICK, KM_ALT, 0);
|
||||
RNA_boolean_set(kmi->ptr, "extend", TRUE);
|
||||
RNA_boolean_set(kmi->ptr, "fill", TRUE);
|
||||
RNA_boolean_set(kmi->ptr, "open", FALSE);
|
||||
|
||||
WM_keymap_add_item(keymap, "FILE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "FILE_OT_refresh", PADPERIOD, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "FILE_OT_select_border", BKEY, KM_PRESS, 0, 0);
|
||||
|
@ -143,27 +143,6 @@ int ED_space_image_has_buffer(SpaceImage *sima)
|
||||
return has_buffer;
|
||||
}
|
||||
|
||||
void ED_image_get_size(Image *ima, int *width, int *height)
|
||||
{
|
||||
ImBuf *ibuf = NULL;
|
||||
void *lock;
|
||||
|
||||
if (ima)
|
||||
ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
|
||||
|
||||
if (ibuf && ibuf->x > 0 && ibuf->y > 0) {
|
||||
*width = ibuf->x;
|
||||
*height = ibuf->y;
|
||||
}
|
||||
else {
|
||||
*width = IMG_SIZE_FALLBACK;
|
||||
*height = IMG_SIZE_FALLBACK;
|
||||
}
|
||||
|
||||
if (ima)
|
||||
BKE_image_release_ibuf(ima, lock);
|
||||
}
|
||||
|
||||
void ED_space_image_get_size(SpaceImage *sima, int *width, int *height)
|
||||
{
|
||||
Scene *scene = sima->iuser.scene;
|
||||
@ -205,23 +184,18 @@ void ED_space_image_get_size_fl(SpaceImage *sima, float size[2])
|
||||
size[1] = size_i[1];
|
||||
}
|
||||
|
||||
void ED_image_get_aspect(Image *ima, float *aspx, float *aspy)
|
||||
{
|
||||
*aspx = *aspy = 1.0;
|
||||
|
||||
if ((ima == NULL) || (ima->type == IMA_TYPE_R_RESULT) || (ima->type == IMA_TYPE_COMPOSITE) ||
|
||||
(ima->aspx == 0.0f || ima->aspy == 0.0f))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* x is always 1 */
|
||||
*aspy = ima->aspy / ima->aspx;
|
||||
}
|
||||
|
||||
void ED_space_image_get_aspect(SpaceImage *sima, float *aspx, float *aspy)
|
||||
{
|
||||
ED_image_get_aspect(ED_space_image(sima), aspx, aspy);
|
||||
Image *ima = sima->image;
|
||||
if ((ima == NULL) || (ima->type == IMA_TYPE_R_RESULT) || (ima->type == IMA_TYPE_COMPOSITE) ||
|
||||
(ima->aspx == 0.0f || ima->aspy == 0.0f))
|
||||
{
|
||||
*aspx = *aspy = 1.0;
|
||||
}
|
||||
else {
|
||||
BKE_image_get_aspect(ima, aspx, aspy);
|
||||
}
|
||||
}
|
||||
|
||||
void ED_space_image_get_zoom(SpaceImage *sima, ARegion *ar, float *zoomx, float *zoomy)
|
||||
@ -254,12 +228,12 @@ void ED_space_image_get_uv_aspect(SpaceImage *sima, float *aspx, float *aspy)
|
||||
}
|
||||
}
|
||||
|
||||
void ED_image_get_uv_aspect(Image *ima, float *aspx, float *aspy)
|
||||
void ED_image_get_uv_aspect(Image *ima, ImageUser *iuser, float *aspx, float *aspy)
|
||||
{
|
||||
int w, h;
|
||||
|
||||
ED_image_get_aspect(ima, aspx, aspy);
|
||||
ED_image_get_size(ima, &w, &h);
|
||||
BKE_image_get_aspect(ima, aspx, aspy);
|
||||
BKE_image_get_size(ima, iuser, &w, &h);
|
||||
|
||||
*aspx *= (float)w;
|
||||
*aspy *= (float)h;
|
||||
|
@ -633,7 +633,7 @@ static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
ima = ED_space_image(sima);
|
||||
ED_space_image_get_size(sima, &width, &height);
|
||||
ED_image_get_aspect(ima, &aspx, &aspy);
|
||||
ED_space_image_get_aspect(sima, &aspx, &aspy);
|
||||
|
||||
width = width * aspx;
|
||||
height = height * aspy;
|
||||
|
@ -679,10 +679,13 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
|
||||
|
||||
if (mask) {
|
||||
int width, height;
|
||||
float aspx, aspy;
|
||||
ED_space_image_get_size(sima, &width, &height);
|
||||
ED_space_image_get_aspect(sima, &aspx, &aspy);
|
||||
ED_mask_draw_region(mask, ar,
|
||||
sima->mask_info.draw_flag, sima->mask_info.draw_type,
|
||||
width, height,
|
||||
aspx, aspy,
|
||||
TRUE, FALSE,
|
||||
NULL, C);
|
||||
|
||||
|
@ -2162,7 +2162,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
|
||||
0.0, 1.0, 0, 0, "Sets the volume of this sound");
|
||||
uiDefButF(block, NUM, 0, "Pitch:", xco+wval+10, yco-66, wval, 19, &sa->pitch, -12.0,
|
||||
12.0, 0, 0, "Sets the pitch of this sound");
|
||||
uiDefButS(block, TOG | BIT, 0, "3D Sound", xco+10, yco-88, width-20, 19,
|
||||
uiDefButS(block, TOG | UI_BUT_POIN_BIT, 0, "3D Sound", xco+10, yco-88, width-20, 19,
|
||||
&sa->flag, 0.0, 1.0, 0.0, 0.0, "Plays the sound positioned in 3D space");
|
||||
if (sa->flag & ACT_SND_3D_SOUND) {
|
||||
uiDefButF(block, NUM, 0, "Minimum Gain: ", xco+10, yco-110, wval, 19,
|
||||
@ -3398,7 +3398,13 @@ static void draw_sensor_message(uiLayout *layout, PointerRNA *ptr)
|
||||
|
||||
static void draw_sensor_mouse(uiLayout *layout, PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "mouse_event", 0, NULL, ICON_NONE);
|
||||
uiLayout *split;
|
||||
|
||||
split = uiLayoutSplit(layout, 0.8f, FALSE);
|
||||
uiItemR(split, ptr, "mouse_event", 0, NULL, ICON_NONE);
|
||||
|
||||
if (RNA_enum_get(ptr, "mouse_event") == BL_SENS_MOUSE_MOUSEOVER_ANY)
|
||||
uiItemR(split, ptr, "use_pulse", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void draw_sensor_near(uiLayout *layout, PointerRNA *ptr)
|
||||
|
@ -172,7 +172,7 @@ static void node_socket_button_color(const bContext *C, uiBlock *block,
|
||||
int labelw = width - 40;
|
||||
RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr);
|
||||
|
||||
bt = uiDefButR(block, COL, B_NODE_EXEC, "",
|
||||
bt = uiDefButR(block, COLOR, B_NODE_EXEC, "",
|
||||
x, y + 2, (labelw > 0 ? 40 : width), NODE_DY - 2,
|
||||
&ptr, "default_value", 0, 0, 0, -1, -1, NULL);
|
||||
if (node)
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
#include "BLF_translation.h"
|
||||
|
||||
#include "BKE_blender.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
@ -64,7 +65,7 @@ static void do_node_add(bContext *C, bNodeTemplate *ntemp)
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar;
|
||||
bNode *node;
|
||||
bNode *node, *node_new;
|
||||
|
||||
/* get location to add node at mouse */
|
||||
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
@ -84,7 +85,7 @@ static void do_node_add(bContext *C, bNodeTemplate *ntemp)
|
||||
else node->flag &= ~NODE_TEST;
|
||||
}
|
||||
|
||||
/* node= */ node_add_node(snode, bmain, scene, ntemp, snode->cursor[0], snode->cursor[1]);
|
||||
node_new = node_add_node(snode, bmain, scene, ntemp, snode->cursor[0], snode->cursor[1]);
|
||||
|
||||
/* select previous selection before autoconnect */
|
||||
for (node = snode->edittree->nodes.first; node; node = node->next) {
|
||||
@ -96,6 +97,13 @@ static void do_node_add(bContext *C, bNodeTemplate *ntemp)
|
||||
if (node->flag & NODE_TEST) node->flag &= ~NODE_SELECT;
|
||||
}
|
||||
|
||||
/* once this is called from an operator, this should be removed */
|
||||
if (node_new) {
|
||||
char undostr[BKE_UNDO_STR_MAX];
|
||||
BLI_snprintf(undostr, sizeof(BKE_UNDO_STR_MAX), "Add Node %s", nodeLabel(node_new));
|
||||
BKE_write_undo(C, undostr);
|
||||
}
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
}
|
||||
|
@ -1126,6 +1126,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
|
||||
|
||||
if (mask) {
|
||||
int width, height;
|
||||
float aspx = 1.0f, aspy = 1.0f;
|
||||
// ED_mask_get_size(C, &width, &height);
|
||||
|
||||
//Scene *scene = CTX_data_scene(C);
|
||||
@ -1135,6 +1136,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
|
||||
ED_mask_draw_region(mask, ar,
|
||||
0, 0, /* TODO */
|
||||
width, height,
|
||||
aspx, aspy,
|
||||
FALSE, TRUE,
|
||||
NULL, C);
|
||||
}
|
||||
|
@ -1141,12 +1141,16 @@ static int sequencer_mute_exec(bContext *C, wmOperator *op)
|
||||
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
||||
if ((seq->flag & SEQ_LOCK) == 0) {
|
||||
if (selected) { /* mute unselected */
|
||||
if (seq->flag & SELECT)
|
||||
if (seq->flag & SELECT) {
|
||||
seq->flag |= SEQ_MUTE;
|
||||
BKE_sequence_invalidate_deendent(scene, seq);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((seq->flag & SELECT) == 0)
|
||||
if ((seq->flag & SELECT) == 0) {
|
||||
seq->flag |= SEQ_MUTE;
|
||||
BKE_sequence_invalidate_deendent(scene, seq);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1188,12 +1192,16 @@ static int sequencer_unmute_exec(bContext *C, wmOperator *op)
|
||||
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
||||
if ((seq->flag & SEQ_LOCK) == 0) {
|
||||
if (selected) { /* unmute unselected */
|
||||
if (seq->flag & SELECT)
|
||||
if (seq->flag & SELECT) {
|
||||
seq->flag &= ~SEQ_MUTE;
|
||||
BKE_sequence_invalidate_deendent(scene, seq);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((seq->flag & SELECT) == 0)
|
||||
if ((seq->flag & SELECT) == 0) {
|
||||
seq->flag &= ~SEQ_MUTE;
|
||||
BKE_sequence_invalidate_deendent(scene, seq);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,7 @@
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_pointcache.h"
|
||||
#include "BKE_unit.h"
|
||||
#include "BKE_mask.h"
|
||||
|
||||
#include "ED_image.h"
|
||||
#include "ED_keyframing.h"
|
||||
@ -228,9 +229,27 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2])
|
||||
project_int_noclip(t->ar, vec, adr);
|
||||
}
|
||||
else if (t->spacetype == SPACE_IMAGE) {
|
||||
SpaceImage *sima = t->sa->spacedata.first;
|
||||
|
||||
if (t->options & CTX_MASK) {
|
||||
/* not working quite right, TODO (see below too) */
|
||||
float aspx, aspy;
|
||||
float v[2];
|
||||
ED_mask_point_pos__reverse(t->sa, t->ar, vec[0], vec[1], &v[0], &v[1]);
|
||||
|
||||
ED_space_image_get_aspect(sima, &aspx, &aspy);
|
||||
|
||||
copy_v2_v2(v, vec);
|
||||
|
||||
v[0] = v[0] / aspx;
|
||||
v[1] = v[1] / aspy;
|
||||
|
||||
BKE_mask_coord_to_image(sima->image, &sima->iuser, v, v);
|
||||
|
||||
v[0] = v[0] / aspx;
|
||||
v[1] = v[1] / aspy;
|
||||
|
||||
ED_image_point_pos__reverse(sima, t->ar, v, v);
|
||||
|
||||
adr[0] = v[0];
|
||||
adr[1] = v[1];
|
||||
}
|
||||
@ -278,23 +297,41 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2])
|
||||
adr[1] = out[1];
|
||||
}
|
||||
else if (t->spacetype == SPACE_CLIP) {
|
||||
float v[2];
|
||||
float aspx = 1.0f, aspy = 1.0f;
|
||||
SpaceClip *sc = t->sa->spacedata.first;
|
||||
|
||||
copy_v2_v2(v, vec);
|
||||
if (t->options & CTX_MASK) {
|
||||
/* not working quite right, TODO (see above too) */
|
||||
float aspx, aspy;
|
||||
float v[2];
|
||||
|
||||
if (t->options & CTX_MOVIECLIP) {
|
||||
ED_space_clip_get_aspect(sc, &aspx, &aspy);
|
||||
|
||||
copy_v2_v2(v, vec);
|
||||
|
||||
v[0] = v[0] / aspx;
|
||||
v[1] = v[1] / aspy;
|
||||
|
||||
BKE_mask_coord_to_movieclip(sc->clip, &sc->user, v, v);
|
||||
|
||||
v[0] = v[0] / aspx;
|
||||
v[1] = v[1] / aspy;
|
||||
|
||||
ED_clip_point_stable_pos__reverse(sc, t->ar, v, v);
|
||||
|
||||
adr[0] = v[0];
|
||||
adr[1] = v[1];
|
||||
}
|
||||
else if (t->options & CTX_MOVIECLIP) {
|
||||
float v[2], aspx, aspy;
|
||||
|
||||
copy_v2_v2(v, vec);
|
||||
ED_space_clip_get_aspect_dimension_aware(t->sa->spacedata.first, &aspx, &aspy);
|
||||
}
|
||||
else if (t->options & CTX_MASK) {
|
||||
/* MASKTODO - not working as expected */
|
||||
ED_space_clip_get_aspect(t->sa->spacedata.first, &aspx, &aspy);
|
||||
}
|
||||
|
||||
v[0] /= aspx;
|
||||
v[1] /= aspy;
|
||||
v[0] /= aspx;
|
||||
v[1] /= aspy;
|
||||
|
||||
UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr + 1);
|
||||
UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr + 1);
|
||||
}
|
||||
}
|
||||
else if (t->spacetype == SPACE_NODE) {
|
||||
UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], adr, adr + 1);
|
||||
|
@ -992,6 +992,9 @@ static void createTransPose(TransInfo *t, Object *ob)
|
||||
t->flag |= T_POSE;
|
||||
t->poseobj = ob; /* we also allow non-active objects to be transformed, in weightpaint */
|
||||
|
||||
/* disable PET, its not usable in pose mode yet [#32444] */
|
||||
t->flag &= ~(T_PROP_EDIT | T_PROP_CONNECTED);
|
||||
|
||||
/* init trans data */
|
||||
td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransPoseBone");
|
||||
tdx = t->ext = MEM_callocN(t->total * sizeof(TransDataExtension), "TransPoseBoneExt");
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_lattice_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_sequence_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
@ -894,6 +895,17 @@ static void recalcData_view3d(TransInfo *t)
|
||||
/* helper for recalcData() - for sequencer transforms */
|
||||
static void recalcData_sequencer(TransInfo *t)
|
||||
{
|
||||
Editing *ed = BKE_sequencer_editing_get(t->scene, FALSE);
|
||||
Sequence *seq;
|
||||
|
||||
SEQ_BEGIN(ed, seq)
|
||||
{
|
||||
if (seq->flag & SELECT) {
|
||||
BKE_sequence_invalidate_deendent(t->scene, seq);
|
||||
}
|
||||
}
|
||||
SEQ_END
|
||||
|
||||
BKE_sequencer_preprocessed_cache_cleanup();
|
||||
|
||||
flushTransSeq(t);
|
||||
|
@ -107,8 +107,7 @@ void ED_undo_push(bContext *C, const char *str)
|
||||
PE_undo_push(CTX_data_scene(C), str);
|
||||
}
|
||||
else {
|
||||
if (U.uiflag & USER_GLOBALUNDO)
|
||||
BKE_write_undo(C, str);
|
||||
BKE_write_undo(C, str);
|
||||
}
|
||||
|
||||
if (wm->file_saved) {
|
||||
|
@ -201,7 +201,7 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em,
|
||||
float aspx, aspy;
|
||||
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
|
||||
|
||||
ED_image_get_uv_aspect(tf->tpage, &aspx, &aspy);
|
||||
ED_image_get_uv_aspect(tf->tpage, NULL, &aspx, &aspy);
|
||||
|
||||
if (aspx != aspy)
|
||||
param_aspect_ratio(handle, aspx, aspy);
|
||||
@ -393,7 +393,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e
|
||||
float aspx, aspy;
|
||||
tf = CustomData_bmesh_get(&em->bm->pdata, editFace->head.data, CD_MTEXPOLY);
|
||||
|
||||
ED_image_get_uv_aspect(tf->tpage, &aspx, &aspy);
|
||||
ED_image_get_uv_aspect(tf->tpage, NULL, &aspx, &aspy);
|
||||
|
||||
if (aspx != aspy)
|
||||
param_aspect_ratio(handle, aspx, aspy);
|
||||
@ -1021,7 +1021,7 @@ static void correct_uv_aspect(BMEditMesh *em)
|
||||
MTexPoly *tf;
|
||||
|
||||
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
|
||||
ED_image_get_uv_aspect(tf->tpage, &aspx, &aspy);
|
||||
ED_image_get_uv_aspect(tf->tpage, NULL, &aspx, &aspy);
|
||||
}
|
||||
|
||||
if (aspx == aspy)
|
||||
|
@ -133,11 +133,11 @@ typedef struct RegionView3D {
|
||||
short rflag;
|
||||
|
||||
|
||||
/* last view */
|
||||
/* last view (use when switching out of camera view) */
|
||||
float lviewquat[4];
|
||||
short lpersp, lview; /* lpersp can never be set to 'RV3D_CAMOB' */
|
||||
float gridview;
|
||||
|
||||
float gridview;
|
||||
float twangle[3];
|
||||
|
||||
|
||||
|
@ -1659,8 +1659,9 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value)
|
||||
IDP_Int(idprop) = value;
|
||||
rna_idproperty_touch(idprop);
|
||||
}
|
||||
else if (bprop->set)
|
||||
else if (bprop->set) {
|
||||
bprop->set(ptr, value);
|
||||
}
|
||||
else if (prop->flag & PROP_EDITABLE) {
|
||||
IDPropertyTemplate val = {0};
|
||||
IDProperty *group;
|
||||
|
@ -417,6 +417,11 @@ static void rna_def_mouse_sensor(BlenderRNA *brna)
|
||||
RNA_def_property_enum_items(prop, mouse_event_items);
|
||||
RNA_def_property_ui_text(prop, "Mouse Event", "Type of event this mouse sensor should trigger on");
|
||||
RNA_def_property_update(prop, NC_LOGIC, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "use_pulse", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_MOUSE_FOCUS_PULSE);
|
||||
RNA_def_property_ui_text(prop, "Pulse", "Moving the mouse over a different object generates a pulse");
|
||||
RNA_def_property_update(prop, NC_LOGIC, NULL);
|
||||
}
|
||||
|
||||
static void rna_def_touch_sensor(BlenderRNA *brna)
|
||||
|
@ -1541,7 +1541,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
|
||||
RNA_def_property_float_sdna(prop, NULL, "near");
|
||||
RNA_def_property_range(prop, 0.001f, FLT_MAX);
|
||||
RNA_def_property_float_default(prop, 0.1f);
|
||||
RNA_def_property_ui_text(prop, "Clip Start", "3D View near clipping distance");
|
||||
RNA_def_property_ui_text(prop, "Clip Start", "3D View near clipping distance (perspective view only)");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
|
||||
|
@ -3265,6 +3265,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
|
||||
RNA_def_property_enum_items(prop, compute_device_type_items);
|
||||
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_userdef_compute_device_type_itemf");
|
||||
RNA_def_property_ui_text(prop, "Compute Device Type", "Device to use for computation (rendering with Cycles)");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "compute_device", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
|
||||
|
@ -105,6 +105,41 @@ static void foreachObjectLink(ModifierData *md, Object *ob,
|
||||
walk(userData, ob, &pimd->ob);
|
||||
}
|
||||
|
||||
static int particle_skip(ParticleInstanceModifierData *pimd, ParticleSystem *psys, int p)
|
||||
{
|
||||
ParticleData *pa;
|
||||
|
||||
if (pimd->flag & eParticleInstanceFlag_Parents) {
|
||||
if (p >= psys->totpart) {
|
||||
if (psys->part->childtype == PART_CHILD_PARTICLES) {
|
||||
pa = psys->particles + (psys->child + p - psys->totpart)->parent;
|
||||
}
|
||||
else {
|
||||
pa = NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
pa = psys->particles + p;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (psys->part->childtype == PART_CHILD_PARTICLES) {
|
||||
pa = psys->particles + (psys->child + p)->parent;
|
||||
}
|
||||
else {
|
||||
pa = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (pa) {
|
||||
if (pa->alive == PARS_UNBORN && (pimd->flag & eParticleInstanceFlag_Unborn) == 0) return 1;
|
||||
if (pa->alive == PARS_ALIVE && (pimd->flag & eParticleInstanceFlag_Alive) == 0) return 1;
|
||||
if (pa->alive == PARS_DEAD && (pimd->flag & eParticleInstanceFlag_Dead) == 0) return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
||||
DerivedMesh *derivedData,
|
||||
ModifierApplyFlag UNUSED(flag))
|
||||
@ -113,11 +148,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
||||
ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *) md;
|
||||
ParticleSimulationData sim;
|
||||
ParticleSystem *psys = NULL;
|
||||
ParticleData *pa = NULL, *pars = NULL;
|
||||
ParticleData *pa = NULL;
|
||||
MPoly *mpoly, *orig_mpoly;
|
||||
MLoop *mloop, *orig_mloop;
|
||||
MVert *mvert, *orig_mvert;
|
||||
int i, totvert, totpoly, totloop, maxvert, maxpoly, maxloop, totpart = 0, first_particle = 0;
|
||||
int totvert, totpoly, totloop /* , totedge */;
|
||||
int maxvert, maxpoly, maxloop, totpart = 0, first_particle = 0;
|
||||
int k, p, p_skip;
|
||||
short track = ob->trackflag % 3, trackneg, axis = pimd->axis;
|
||||
float max_co = 0.0, min_co = 0.0, temp_co[3], cross[3];
|
||||
float *size = NULL;
|
||||
@ -153,7 +190,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
||||
sim.psmd = psys_get_modifier(pimd->ob, psys);
|
||||
|
||||
if (pimd->flag & eParticleInstanceFlag_UseSize) {
|
||||
int p;
|
||||
float *si;
|
||||
si = size = MEM_callocN(totpart * sizeof(float), "particle size array");
|
||||
|
||||
@ -171,15 +207,24 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
||||
}
|
||||
}
|
||||
|
||||
pars = psys->particles;
|
||||
|
||||
totvert = dm->getNumVerts(dm);
|
||||
totpoly = dm->getNumPolys(dm);
|
||||
totloop = dm->getNumLoops(dm);
|
||||
/* totedge = dm->getNumEdges(dm); */ /* UNUSED */
|
||||
|
||||
maxvert = totvert * totpart;
|
||||
maxpoly = totpoly * totpart;
|
||||
maxloop = totloop * totpart;
|
||||
/* count particles */
|
||||
maxvert = 0;
|
||||
maxpoly = 0;
|
||||
maxloop = 0;
|
||||
|
||||
for (p = 0; p < totpart; p++) {
|
||||
if (particle_skip(pimd, psys, p))
|
||||
continue;
|
||||
|
||||
maxvert += totvert;
|
||||
maxpoly += totpoly;
|
||||
maxloop += totloop;
|
||||
}
|
||||
|
||||
psys->lattice = psys_get_lattice(&sim);
|
||||
|
||||
@ -191,127 +236,110 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
||||
max_co = max_r[track];
|
||||
}
|
||||
|
||||
result = CDDM_from_template(dm, maxvert, dm->getNumEdges(dm) * totpart, 0, maxloop, maxpoly);
|
||||
result = CDDM_from_template(dm, maxvert, 0, 0, maxloop, maxpoly);
|
||||
|
||||
mvert = result->getVertArray(result);
|
||||
orig_mvert = dm->getVertArray(dm);
|
||||
|
||||
for (i = 0; i < maxvert; i++) {
|
||||
MVert *inMV;
|
||||
MVert *mv = mvert + i;
|
||||
ParticleKey state;
|
||||
|
||||
inMV = orig_mvert + i % totvert;
|
||||
DM_copy_vert_data(dm, result, i % totvert, i, 1);
|
||||
*mv = *inMV;
|
||||
|
||||
/*change orientation based on object trackflag*/
|
||||
copy_v3_v3(temp_co, mv->co);
|
||||
mv->co[axis] = temp_co[track];
|
||||
mv->co[(axis + 1) % 3] = temp_co[(track + 1) % 3];
|
||||
mv->co[(axis + 2) % 3] = temp_co[(track + 2) % 3];
|
||||
|
||||
if ((psys->flag & (PSYS_HAIR_DONE | PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED) &&
|
||||
(pimd->flag & eParticleInstanceFlag_Path))
|
||||
{
|
||||
float ran = 0.0f;
|
||||
if (pimd->random_position != 0.0f) {
|
||||
BLI_srandom(psys->seed + (i / totvert) % totpart);
|
||||
ran = pimd->random_position * BLI_frand();
|
||||
}
|
||||
|
||||
if (pimd->flag & eParticleInstanceFlag_KeepShape) {
|
||||
state.time = pimd->position * (1.0f - ran);
|
||||
}
|
||||
else {
|
||||
state.time = (mv->co[axis] - min_co) / (max_co - min_co) * pimd->position * (1.0f - ran);
|
||||
|
||||
if (trackneg)
|
||||
state.time = 1.0f - state.time;
|
||||
|
||||
mv->co[axis] = 0.0;
|
||||
}
|
||||
|
||||
psys_get_particle_on_path(&sim, first_particle + i / totvert, &state, 1);
|
||||
|
||||
normalize_v3(state.vel);
|
||||
|
||||
/* TODO: incremental rotations somehow */
|
||||
if (state.vel[axis] < -0.9999f || state.vel[axis] > 0.9999f) {
|
||||
unit_qt(state.rot);
|
||||
}
|
||||
else {
|
||||
float temp[3] = {0.0f, 0.0f, 0.0f};
|
||||
temp[axis] = 1.0f;
|
||||
|
||||
cross_v3_v3v3(cross, temp, state.vel);
|
||||
|
||||
/* state.vel[axis] is the only component surviving from a dot product with the axis */
|
||||
axis_angle_to_quat(state.rot, cross, saacos(state.vel[axis]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
state.time = -1.0;
|
||||
psys_get_particle_state(&sim, first_particle + i / totvert, &state, 1);
|
||||
}
|
||||
|
||||
mul_qt_v3(state.rot, mv->co);
|
||||
if (pimd->flag & eParticleInstanceFlag_UseSize)
|
||||
mul_v3_fl(mv->co, size[i / totvert]);
|
||||
add_v3_v3(mv->co, state.co);
|
||||
}
|
||||
|
||||
mpoly = result->getPolyArray(result);
|
||||
orig_mpoly = dm->getPolyArray(dm);
|
||||
mloop = result->getLoopArray(result);
|
||||
orig_mloop = dm->getLoopArray(dm);
|
||||
|
||||
for (i = 0; i < maxpoly; i++) {
|
||||
MPoly *inMP = orig_mpoly + i % totpoly;
|
||||
MPoly *mp = mpoly + i;
|
||||
for (p = 0, p_skip = 0; p < totpart; p++) {
|
||||
/* skip particle? */
|
||||
if (particle_skip(pimd, psys, p))
|
||||
continue;
|
||||
|
||||
if (pimd->flag & eParticleInstanceFlag_Parents) {
|
||||
if (i / totpoly >= psys->totpart) {
|
||||
if (psys->part->childtype == PART_CHILD_PARTICLES) {
|
||||
pa = psys->particles + (psys->child + i / totpoly - psys->totpart)->parent;
|
||||
/* set vertices coordinates */
|
||||
for (k = 0; k < totvert; k++) {
|
||||
ParticleKey state;
|
||||
MVert *inMV;
|
||||
MVert *mv = mvert + p_skip * totvert + k;
|
||||
|
||||
inMV = orig_mvert + k;
|
||||
DM_copy_vert_data(dm, result, k, p_skip * totvert + k, 1);
|
||||
*mv = *inMV;
|
||||
|
||||
/*change orientation based on object trackflag*/
|
||||
copy_v3_v3(temp_co, mv->co);
|
||||
mv->co[axis] = temp_co[track];
|
||||
mv->co[(axis + 1) % 3] = temp_co[(track + 1) % 3];
|
||||
mv->co[(axis + 2) % 3] = temp_co[(track + 2) % 3];
|
||||
|
||||
/* get particle state */
|
||||
if ((psys->flag & (PSYS_HAIR_DONE | PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED) &&
|
||||
(pimd->flag & eParticleInstanceFlag_Path))
|
||||
{
|
||||
float ran = 0.0f;
|
||||
if (pimd->random_position != 0.0f) {
|
||||
BLI_srandom(psys->seed + p);
|
||||
ran = pimd->random_position * BLI_frand();
|
||||
}
|
||||
|
||||
if (pimd->flag & eParticleInstanceFlag_KeepShape) {
|
||||
state.time = pimd->position * (1.0f - ran);
|
||||
}
|
||||
else {
|
||||
pa = NULL;
|
||||
state.time = (mv->co[axis] - min_co) / (max_co - min_co) * pimd->position * (1.0f - ran);
|
||||
|
||||
if (trackneg)
|
||||
state.time = 1.0f - state.time;
|
||||
|
||||
mv->co[axis] = 0.0;
|
||||
}
|
||||
|
||||
psys_get_particle_on_path(&sim, first_particle + p, &state, 1);
|
||||
|
||||
normalize_v3(state.vel);
|
||||
|
||||
/* TODO: incremental rotations somehow */
|
||||
if (state.vel[axis] < -0.9999f || state.vel[axis] > 0.9999f) {
|
||||
unit_qt(state.rot);
|
||||
}
|
||||
else {
|
||||
float temp[3] = {0.0f, 0.0f, 0.0f};
|
||||
temp[axis] = 1.0f;
|
||||
|
||||
cross_v3_v3v3(cross, temp, state.vel);
|
||||
|
||||
/* state.vel[axis] is the only component surviving from a dot product with the axis */
|
||||
axis_angle_to_quat(state.rot, cross, saacos(state.vel[axis]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
pa = pars + i / totpoly;
|
||||
state.time = -1.0;
|
||||
psys_get_particle_state(&sim, first_particle + p, &state, 1);
|
||||
}
|
||||
|
||||
mul_qt_v3(state.rot, mv->co);
|
||||
if (pimd->flag & eParticleInstanceFlag_UseSize)
|
||||
mul_v3_fl(mv->co, size[p]);
|
||||
add_v3_v3(mv->co, state.co);
|
||||
}
|
||||
else {
|
||||
if (psys->part->childtype == PART_CHILD_PARTICLES) {
|
||||
pa = psys->particles + (psys->child + i / totpoly)->parent;
|
||||
}
|
||||
else {
|
||||
pa = NULL;
|
||||
|
||||
/* create polys and loops */
|
||||
for (k = 0; k < totpoly; k++) {
|
||||
MPoly *inMP = orig_mpoly + k;
|
||||
MPoly *mp = mpoly + p_skip * totpoly + k;
|
||||
|
||||
DM_copy_poly_data(dm, result, k, p_skip * totpoly + k, 1);
|
||||
*mp = *inMP;
|
||||
mp->loopstart += p_skip * totloop;
|
||||
|
||||
{
|
||||
MLoop *inML = orig_mloop + inMP->loopstart;
|
||||
MLoop *ml = mloop + mp->loopstart;
|
||||
int j = mp->totloop;
|
||||
|
||||
DM_copy_loop_data(dm, result, inMP->loopstart, mp->loopstart, j);
|
||||
for (; j; j--, ml++, inML++) {
|
||||
ml->v = inML->v + (p_skip * totvert);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pa) {
|
||||
if (pa->alive == PARS_UNBORN && (pimd->flag & eParticleInstanceFlag_Unborn) == 0) continue;
|
||||
if (pa->alive == PARS_ALIVE && (pimd->flag & eParticleInstanceFlag_Alive) == 0) continue;
|
||||
if (pa->alive == PARS_DEAD && (pimd->flag & eParticleInstanceFlag_Dead) == 0) continue;
|
||||
}
|
||||
|
||||
DM_copy_poly_data(dm, result, i % totpoly, i, 1);
|
||||
*mp = *inMP;
|
||||
mp->loopstart += (i / totpoly) * totloop;
|
||||
|
||||
{
|
||||
MLoop *inML = orig_mloop + inMP->loopstart;
|
||||
MLoop *ml = mloop + mp->loopstart;
|
||||
int j = mp->totloop;
|
||||
|
||||
DM_copy_loop_data(dm, result, inMP->loopstart, mp->loopstart, j);
|
||||
for (; j; j--, ml++, inML++) {
|
||||
ml->v = inML->v + ((i / totpoly) * totvert);
|
||||
}
|
||||
}
|
||||
p_skip++;
|
||||
}
|
||||
|
||||
CDDM_calc_edges(result);
|
||||
|
@ -857,7 +857,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
||||
|
||||
mp_new->loopstart = mpoly_index * 4;
|
||||
mp_new->totloop = 4;
|
||||
mp_new->flag = ME_SMOOTH;
|
||||
mp_new->flag = mpoly_flag;
|
||||
origindex[mpoly_index] = ORIGINDEX_NONE;
|
||||
mp_new++;
|
||||
ml_new += 4;
|
||||
|
@ -1054,6 +1054,8 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
|
||||
|
||||
if ((ibuf == NULL) || ((ibuf->rect == NULL) && (ibuf->rect_float == NULL))) return retval;
|
||||
|
||||
ima->flag |= IMA_USED_FOR_RENDER;
|
||||
|
||||
/* mipmap test */
|
||||
image_mipmap_test(tex, ibuf);
|
||||
|
||||
|
@ -326,7 +326,11 @@ static void build_pict_list(char *first, int totframes, int fstep, int fontid)
|
||||
int file;
|
||||
|
||||
file = open(filepath, O_BINARY | O_RDONLY, 0);
|
||||
if (file < 0) return;
|
||||
if (file < 0) {
|
||||
/* print errno? */
|
||||
return;
|
||||
}
|
||||
|
||||
picture = (PlayAnimPict *)MEM_callocN(sizeof(PlayAnimPict), "picture");
|
||||
if (picture == NULL) {
|
||||
printf("Not enough memory for pict struct '%s'\n", filepath);
|
||||
@ -700,11 +704,11 @@ void playanim_window_open(const char *title, int posx, int posy, int sizex, int
|
||||
inital_state = start_maximized ? GHOST_kWindowStateMaximized : GHOST_kWindowStateNormal;
|
||||
|
||||
g_WS.ghost_window = GHOST_CreateWindow(g_WS.ghost_system,
|
||||
title,
|
||||
posx, posy, sizex, sizey,
|
||||
inital_state,
|
||||
GHOST_kDrawingContextTypeOpenGL,
|
||||
FALSE /* no stereo */, FALSE);
|
||||
title,
|
||||
posx, posy, sizex, sizey,
|
||||
inital_state,
|
||||
GHOST_kDrawingContextTypeOpenGL,
|
||||
FALSE /* no stereo */, FALSE);
|
||||
|
||||
//if (ghostwin) {
|
||||
//if (win) {
|
||||
|
@ -1727,11 +1727,6 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to)
|
||||
brick->Replace_IScene(to);
|
||||
brick->Replace_NetworkScene(to->GetNetworkScene());
|
||||
|
||||
SCA_ISensor *sensor= dynamic_cast<class SCA_ISensor *>(brick);
|
||||
if (sensor) {
|
||||
sensor->Replace_EventManager(logicmgr);
|
||||
}
|
||||
|
||||
/* near sensors have physics controllers */
|
||||
#ifdef USE_BULLET
|
||||
KX_TouchSensor *touch_sensor = dynamic_cast<class KX_TouchSensor *>(brick);
|
||||
@ -1739,6 +1734,14 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to)
|
||||
touch_sensor->GetPhysicsController()->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
|
||||
}
|
||||
#endif
|
||||
|
||||
// If we end up replacing a KX_TouchEventManager, we need to make sure
|
||||
// physics controllers are properly in place. In other words, do this
|
||||
// after merging physics controllers!
|
||||
SCA_ISensor *sensor= dynamic_cast<class SCA_ISensor *>(brick);
|
||||
if (sensor) {
|
||||
sensor->Replace_EventManager(logicmgr);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_BULLET
|
||||
|
70
source/tests/bl_rna_wiki_reference.py
Normal file
70
source/tests/bl_rna_wiki_reference.py
Normal file
@ -0,0 +1,70 @@
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
# Use for validating our wiki interlinking.
|
||||
# ./blender.bin --background -noaudio --python source/tests/bl_rna_wiki_reference.py
|
||||
#
|
||||
# 1) test_lookup_coverage() -- ensure that we have lookups for _every_ RNA path
|
||||
# 2) test_urls() -- ensure all the URL's are correct
|
||||
# 3) test_language_coverage() -- ensure language lookup table is complete
|
||||
#
|
||||
|
||||
import bpy
|
||||
|
||||
# a stripped down version of api_dump() in rna_info_dump.py
|
||||
|
||||
|
||||
def test_lookup_coverage():
|
||||
|
||||
def rna_ids():
|
||||
|
||||
import rna_info
|
||||
struct = rna_info.BuildRNAInfo()[0]
|
||||
for struct_id, v in sorted(struct.items()):
|
||||
props = [(prop.identifier, prop) for prop in v.properties]
|
||||
for prop_id, prop in props:
|
||||
yield "bpy.types.%s.%s" % (struct_id[1], prop_id)
|
||||
|
||||
for submod_id in dir(bpy.ops):
|
||||
for op_id in dir(getattr(bpy.ops, submod_id)):
|
||||
yield "bpy.ops.%s.%s" % (submod_id, op_id)
|
||||
|
||||
# check coverage
|
||||
from bl_operators import wm
|
||||
|
||||
for rna_id in rna_ids():
|
||||
url = wm.WM_OT_doc_view_manual._lookup_rna_url(rna_id, verbose=False)
|
||||
print(rna_id, "->", url)
|
||||
|
||||
|
||||
def test_urls():
|
||||
pass # TODO
|
||||
|
||||
|
||||
def test_language_coverage():
|
||||
pass # TODO
|
||||
|
||||
|
||||
def main():
|
||||
test_lookup_coverage()
|
||||
test_language_coverage()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -19,7 +19,7 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
# Used for generating API diff's between releases
|
||||
# ./blender.bin --background -noaudio --python release/test/rna_info_dump.py
|
||||
# ./blender.bin --background -noaudio --python source/tests/rna_info_dump.py
|
||||
|
||||
import bpy
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user