Merge branch 'master' into blender2.8
This commit is contained in:
@@ -1365,24 +1365,19 @@ class CyclesPreferences(bpy.types.AddonPreferences):
|
||||
|
||||
devices = bpy.props.CollectionProperty(type=CyclesDeviceSettings)
|
||||
|
||||
def get_devices(self):
|
||||
import _cycles
|
||||
# Layout of the device tuples: (Name, Type, Persistent ID)
|
||||
device_list = _cycles.available_devices()
|
||||
def find_existing_device_entry(self, device):
|
||||
for device_entry in self.devices:
|
||||
if device_entry.id == device[2] and device_entry.type == device[1]:
|
||||
return device_entry
|
||||
return None
|
||||
|
||||
cuda_devices = []
|
||||
opencl_devices = []
|
||||
cpu_devices = []
|
||||
|
||||
def update_device_entries(self, device_list):
|
||||
for device in device_list:
|
||||
if not device[1] in {'CUDA', 'OPENCL', 'CPU'}:
|
||||
continue
|
||||
|
||||
entry = None
|
||||
# Try to find existing Device entry
|
||||
for dev in self.devices:
|
||||
if dev.id == device[2] and dev.type == device[1]:
|
||||
entry = dev
|
||||
break
|
||||
entry = self.find_existing_device_entry(device)
|
||||
if not entry:
|
||||
# Create new entry if no existing one was found
|
||||
entry = self.devices.add()
|
||||
@@ -1394,17 +1389,30 @@ class CyclesPreferences(bpy.types.AddonPreferences):
|
||||
# Update name in case it changed
|
||||
entry.name = device[0]
|
||||
|
||||
# Sort entries into lists
|
||||
|
||||
def get_devices(self):
|
||||
import _cycles
|
||||
# Layout of the device tuples: (Name, Type, Persistent ID)
|
||||
device_list = _cycles.available_devices()
|
||||
# Make sure device entries are up to date and not referenced before
|
||||
# we know we don't add new devices. This way we guarantee to not
|
||||
# hold pointers to a resized array.
|
||||
self.update_device_entries(device_list)
|
||||
# Sort entries into lists
|
||||
cuda_devices = []
|
||||
opencl_devices = []
|
||||
cpu_devices = []
|
||||
for device in device_list:
|
||||
entry = self.find_existing_device_entry(device)
|
||||
if entry.type == 'CUDA':
|
||||
cuda_devices.append(entry)
|
||||
elif entry.type == 'OPENCL':
|
||||
opencl_devices.append(entry)
|
||||
else:
|
||||
elif entry.type == 'CPU':
|
||||
cpu_devices.append(entry)
|
||||
|
||||
# Extend all GPU devices with CPU.
|
||||
cuda_devices.extend(cpu_devices)
|
||||
opencl_devices.extend(cpu_devices)
|
||||
|
||||
return cuda_devices, opencl_devices
|
||||
|
||||
|
||||
|
||||
@@ -137,6 +137,7 @@ KM_HIERARCHY = [
|
||||
('Standard Modal Map', 'EMPTY', 'WINDOW', []),
|
||||
('Transform Modal Map', 'EMPTY', 'WINDOW', []),
|
||||
('Eyedropper Modal Map', 'EMPTY', 'WINDOW', []),
|
||||
('Eyedropper ColorBand PointSampling Map', 'EMPTY', 'WINDOW', []),
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ struct VFont *BKE_vfont_load_exists(struct Main *bmain, const char *filepath);
|
||||
|
||||
void BKE_vfont_make_local(struct Main *bmain, struct VFont *vfont, const bool lib_local);
|
||||
|
||||
bool BKE_vfont_to_curve_ex(struct Main *bmain, struct Object *ob, int mode,
|
||||
bool BKE_vfont_to_curve_ex(struct Main *bmain, struct Object *ob, struct Curve *cu, int mode,
|
||||
struct ListBase *r_nubase,
|
||||
const wchar_t **r_text, int *r_text_len, bool *r_text_free,
|
||||
struct CharTrans **r_chartransdata);
|
||||
|
||||
@@ -4938,12 +4938,27 @@ void BKE_curve_nurb_vert_active_validate(Curve *cu)
|
||||
bool BKE_curve_minmax(Curve *cu, bool use_radius, float min[3], float max[3])
|
||||
{
|
||||
ListBase *nurb_lb = BKE_curve_nurbs_get(cu);
|
||||
Nurb *nu;
|
||||
|
||||
for (nu = nurb_lb->first; nu; nu = nu->next)
|
||||
ListBase temp_nurb_lb = {NULL, NULL};
|
||||
const bool is_font = (BLI_listbase_is_empty(nurb_lb)) && (cu->len != 0);
|
||||
/* For font curves we generate temp list of splines.
|
||||
*
|
||||
* This is likely to be fine, this function is not supposed to be called
|
||||
* often, and it's the only way to get meaningful bounds for fonts.
|
||||
*/
|
||||
if (is_font) {
|
||||
nurb_lb = &temp_nurb_lb;
|
||||
BKE_vfont_to_curve_ex(G.main, NULL, cu, FO_EDIT, nurb_lb,
|
||||
NULL, NULL, NULL, NULL);
|
||||
use_radius = false;
|
||||
}
|
||||
/* Do bounding box based on splines. */
|
||||
for (Nurb *nu = nurb_lb->first; nu; nu = nu->next) {
|
||||
BKE_nurb_minmax(nu, use_radius, min, max);
|
||||
|
||||
return (BLI_listbase_is_empty(nurb_lb) == false);
|
||||
}
|
||||
const bool result = (BLI_listbase_is_empty(nurb_lb) == false);
|
||||
/* Cleanup if needed. */
|
||||
BKE_nurbList_free(&temp_nurb_lb);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool BKE_curve_center_median(Curve *cu, float cent[3])
|
||||
|
||||
@@ -635,11 +635,10 @@ struct TempLineInfo {
|
||||
int wspace_nr; /* number of whitespaces of line */
|
||||
};
|
||||
|
||||
bool BKE_vfont_to_curve_ex(Main *bmain, Object *ob, int mode, ListBase *r_nubase,
|
||||
bool BKE_vfont_to_curve_ex(Main *bmain, Object *ob, Curve *cu, int mode, ListBase *r_nubase,
|
||||
const wchar_t **r_text, int *r_text_len, bool *r_text_free,
|
||||
struct CharTrans **r_chartransdata)
|
||||
{
|
||||
Curve *cu = ob->data;
|
||||
EditFont *ef = cu->editfont;
|
||||
EditFontSelBox *selboxes = NULL;
|
||||
VFont *vfont, *oldvfont;
|
||||
@@ -670,7 +669,7 @@ bool BKE_vfont_to_curve_ex(Main *bmain, Object *ob, int mode, ListBase *r_nubase
|
||||
/* remark: do calculations including the trailing '\0' of a string
|
||||
* because the cursor can be at that location */
|
||||
|
||||
BLI_assert(ob->type == OB_FONT);
|
||||
BLI_assert(ob == NULL || ob->type == OB_FONT);
|
||||
|
||||
/* Set font data */
|
||||
vfont = cu->vfont;
|
||||
@@ -708,7 +707,7 @@ bool BKE_vfont_to_curve_ex(Main *bmain, Object *ob, int mode, ListBase *r_nubase
|
||||
if (cu->tb == NULL)
|
||||
cu->tb = MEM_callocN(MAXTEXTBOX * sizeof(TextBox), "TextBox compat");
|
||||
|
||||
if (ef) {
|
||||
if (ef != NULL && ob != NULL) {
|
||||
if (ef->selboxes)
|
||||
MEM_freeN(ef->selboxes);
|
||||
|
||||
@@ -1258,7 +1257,7 @@ makebreak:
|
||||
cha = towupper(cha);
|
||||
}
|
||||
|
||||
if (info->mat_nr > (ob->totcol)) {
|
||||
if (ob == NULL || info->mat_nr > (ob->totcol)) {
|
||||
/* printf("Error: Illegal material index (%d) in text object, setting to 0\n", info->mat_nr); */
|
||||
info->mat_nr = 0;
|
||||
}
|
||||
@@ -1334,7 +1333,7 @@ bool BKE_vfont_to_curve_nubase(Main *bmain, Object *ob, int mode, ListBase *r_nu
|
||||
{
|
||||
BLI_assert(ob->type == OB_FONT);
|
||||
|
||||
return BKE_vfont_to_curve_ex(bmain, ob, mode, r_nubase,
|
||||
return BKE_vfont_to_curve_ex(bmain, ob, ob->data, mode, r_nubase,
|
||||
NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
@@ -1342,7 +1341,7 @@ bool BKE_vfont_to_curve(Main *bmain, Object *ob, int mode)
|
||||
{
|
||||
Curve *cu = ob->data;
|
||||
|
||||
return BKE_vfont_to_curve_ex(bmain, ob, mode, &cu->nurb, NULL, NULL, NULL, NULL);
|
||||
return BKE_vfont_to_curve_ex(bmain, ob, ob->data, mode, &cu->nurb, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -613,7 +613,7 @@ static void make_duplis_font(const DupliContext *ctx)
|
||||
|
||||
/* in par the family name is stored, use this to find the other objects */
|
||||
|
||||
BKE_vfont_to_curve_ex(G.main, par, FO_DUPLI, NULL,
|
||||
BKE_vfont_to_curve_ex(G.main, par, par->data, FO_DUPLI, NULL,
|
||||
&text, &text_len, &text_free, &chartransdata);
|
||||
|
||||
if (text == NULL || chartransdata == NULL) {
|
||||
|
||||
@@ -1135,6 +1135,12 @@ void UI_butstore_register(uiButStore *bs_handle, uiBut **but_p);
|
||||
bool UI_butstore_register_update(uiBlock *block, uiBut *but_dst, const uiBut *but_src);
|
||||
void UI_butstore_unregister(uiButStore *bs_handle, uiBut **but_p);
|
||||
|
||||
/* ui_interface_region_tooltip.c */
|
||||
struct ARegion *UI_tooltip_create_from_button(struct bContext *C, struct ARegion *butregion, uiBut *but);
|
||||
void UI_tooltip_free(struct bContext *C, struct ARegion *ar);
|
||||
|
||||
/* How long before a tool-tip shows. */
|
||||
#define UI_TOOLTIP_DELAY 0.5
|
||||
|
||||
/* Float precision helpers */
|
||||
#define UI_PRECISION_FLOAT_MAX 6
|
||||
|
||||
@@ -130,7 +130,6 @@ static bool ui_mouse_motion_keynav_test(struct uiKeyNavLock *keynav, const wmEve
|
||||
|
||||
/***************** structs and defines ****************/
|
||||
|
||||
#define BUTTON_TOOLTIP_DELAY 0.500
|
||||
#define BUTTON_FLASH_DELAY 0.020
|
||||
#define MENU_SCROLL_INTERVAL 0.1
|
||||
#define PIE_MENU_INTERVAL 0.01
|
||||
@@ -7697,8 +7696,8 @@ void UI_but_tooltip_refresh(bContext *C, uiBut *but)
|
||||
|
||||
data = but->active;
|
||||
if (data && data->tooltip) {
|
||||
ui_tooltip_free(C, data->tooltip);
|
||||
data->tooltip = ui_tooltip_create_from_button(C, data->region, but);
|
||||
UI_tooltip_free(C, data->tooltip);
|
||||
data->tooltip = UI_tooltip_create_from_button(C, data->region, but);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7715,7 +7714,7 @@ void UI_but_tooltip_timer_remove(bContext *C, uiBut *but)
|
||||
data->tooltiptimer = NULL;
|
||||
}
|
||||
if (data->tooltip) {
|
||||
ui_tooltip_free(C, data->tooltip);
|
||||
UI_tooltip_free(C, data->tooltip);
|
||||
data->tooltip = NULL;
|
||||
}
|
||||
|
||||
@@ -7741,7 +7740,7 @@ static void button_tooltip_timer_reset(bContext *C, uiBut *but)
|
||||
if ((U.flag & USER_TOOLTIPS) || (data->tooltip_force)) {
|
||||
if (!but->block->tooltipdisabled) {
|
||||
if (!wm->drags.first) {
|
||||
data->tooltiptimer = WM_event_add_timer(data->wm, data->window, TIMER, BUTTON_TOOLTIP_DELAY);
|
||||
data->tooltiptimer = WM_event_add_timer(data->wm, data->window, TIMER, UI_TOOLTIP_DELAY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8443,7 +8442,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
|
||||
data->tooltiptimer = NULL;
|
||||
|
||||
if (!data->tooltip)
|
||||
data->tooltip = ui_tooltip_create_from_button(C, data->region, but);
|
||||
data->tooltip = UI_tooltip_create_from_button(C, data->region, but);
|
||||
}
|
||||
/* handle menu auto open timer */
|
||||
else if (event->customdata == data->autoopentimer) {
|
||||
|
||||
@@ -590,8 +590,7 @@ struct uiPopupBlockHandle {
|
||||
/* interface_region_*.c */
|
||||
|
||||
/* interface_region_tooltip.c */
|
||||
struct ARegion *ui_tooltip_create_from_button(struct bContext *C, struct ARegion *butregion, uiBut *but);
|
||||
void ui_tooltip_free(struct bContext *C, struct ARegion *ar);
|
||||
/* exposed as public API in UI_interface.h */
|
||||
|
||||
/* interface_region_color_picker.c */
|
||||
void ui_rgb_to_color_picker_compat_v(const float rgb[3], float r_cp[3]);
|
||||
|
||||
@@ -781,7 +781,7 @@ static ARegion *ui_tooltip_create_with_data(
|
||||
* \{ */
|
||||
|
||||
|
||||
ARegion *ui_tooltip_create_from_button(bContext *C, ARegion *butregion, uiBut *but)
|
||||
ARegion *UI_tooltip_create_from_button(bContext *C, ARegion *butregion, uiBut *but)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
/* aspect values that shrink text are likely unreadable */
|
||||
@@ -827,7 +827,7 @@ ARegion *ui_tooltip_create_from_button(bContext *C, ARegion *butregion, uiBut *b
|
||||
return ui_tooltip_create_with_data(C, data, init_position, aspect);
|
||||
}
|
||||
|
||||
void ui_tooltip_free(bContext *C, ARegion *ar)
|
||||
void UI_tooltip_free(bContext *C, ARegion *ar)
|
||||
{
|
||||
ui_region_temp_remove(C, CTX_wm_screen(C), ar);
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ static void rna_Struct_property_tags_begin(CollectionPropertyIterator *iter, Poi
|
||||
/* here ptr->data should always be the same as iter->parent.type */
|
||||
StructRNA *srna = (StructRNA *)ptr->data;
|
||||
const EnumPropertyItem *tag_defines = RNA_struct_property_tag_defines(srna);
|
||||
unsigned int tag_count = RNA_enum_items_count(tag_defines);
|
||||
unsigned int tag_count = tag_defines ? RNA_enum_items_count(tag_defines) : 0;
|
||||
|
||||
rna_iterator_array_begin(iter, (void *)tag_defines, sizeof(EnumPropertyItem), tag_count, 0, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user