Merge branch 'master' into blender2.8
This commit is contained in:
@@ -673,7 +673,7 @@ BVHNode* BVHBuild::build_node(const BVHObjectBinning& range, int level)
|
|||||||
return create_leaf_node(range, references);
|
return create_leaf_node(range, references);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Check whether unaligned split is better than the regulat one. */
|
/* Check whether unaligned split is better than the regular one. */
|
||||||
if(unalignedSplitSAH < splitSAH) {
|
if(unalignedSplitSAH < splitSAH) {
|
||||||
do_unalinged_split = true;
|
do_unalinged_split = true;
|
||||||
}
|
}
|
||||||
|
@@ -959,7 +959,7 @@ ccl_device_forceinline void triangle_light_sample(KernelGlobals *kg, int prim, i
|
|||||||
|
|
||||||
const float3 C_ = safe_normalize(q * A + sqrtf(temp) * U);
|
const float3 C_ = safe_normalize(q * A + sqrtf(temp) * U);
|
||||||
|
|
||||||
/* Finally, select a random point along the edge of the new triangle
|
/* Finally, select a random point along the edge of the new triangle
|
||||||
* That point on the spherical triangle is the sampled ray direction */
|
* That point on the spherical triangle is the sampled ray direction */
|
||||||
const float z = 1.0f - randv * (1.0f - dot(C_, B));
|
const float z = 1.0f - randv * (1.0f - dot(C_, B));
|
||||||
ls->D = z * B + safe_sqrtf(1.0f - z*z) * safe_normalize(C_ - dot(C_, B) * B);
|
ls->D = z * B + safe_sqrtf(1.0f - z*z) * safe_normalize(C_ - dot(C_, B) * B);
|
||||||
@@ -967,11 +967,11 @@ ccl_device_forceinline void triangle_light_sample(KernelGlobals *kg, int prim, i
|
|||||||
/* calculate intersection with the planar triangle */
|
/* calculate intersection with the planar triangle */
|
||||||
ray_triangle_intersect(P, ls->D, FLT_MAX,
|
ray_triangle_intersect(P, ls->D, FLT_MAX,
|
||||||
#if defined(__KERNEL_SSE2__) && defined(__KERNEL_SSE__)
|
#if defined(__KERNEL_SSE2__) && defined(__KERNEL_SSE__)
|
||||||
(ssef*)V,
|
(ssef*)V,
|
||||||
#else
|
#else
|
||||||
V[0], V[1], V[2],
|
V[0], V[1], V[2],
|
||||||
#endif
|
#endif
|
||||||
&ls->u, &ls->v, &ls->t);
|
&ls->u, &ls->v, &ls->t);
|
||||||
ls->P = P + ls->D * ls->t;
|
ls->P = P + ls->D * ls->t;
|
||||||
|
|
||||||
/* pdf_triangles is calculated over triangle area, but we're sampling over solid angle */
|
/* pdf_triangles is calculated over triangle area, but we're sampling over solid angle */
|
||||||
|
@@ -96,7 +96,7 @@ class DATA_PT_display(ArmatureButtonsPanel, Panel):
|
|||||||
col.prop(arm, "use_deform_delay", text="Delay Refresh")
|
col.prop(arm, "use_deform_delay", text="Delay Refresh")
|
||||||
|
|
||||||
|
|
||||||
class DATA_PT_bone_group_specials(Menu):
|
class DATA_MT_bone_group_specials(Menu):
|
||||||
bl_label = "Bone Group Specials"
|
bl_label = "Bone Group Specials"
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
@@ -130,7 +130,7 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, Panel):
|
|||||||
col.active = (ob.proxy is None)
|
col.active = (ob.proxy is None)
|
||||||
col.operator("pose.group_add", icon='ZOOMIN', text="")
|
col.operator("pose.group_add", icon='ZOOMIN', text="")
|
||||||
col.operator("pose.group_remove", icon='ZOOMOUT', text="")
|
col.operator("pose.group_remove", icon='ZOOMOUT', text="")
|
||||||
col.menu("DATA_PT_bone_group_specials", icon='DOWNARROW_HLT', text="")
|
col.menu("DATA_MT_bone_group_specials", icon='DOWNARROW_HLT', text="")
|
||||||
if group:
|
if group:
|
||||||
col.separator()
|
col.separator()
|
||||||
col.operator("pose.group_move", icon='TRIA_UP', text="").direction = 'UP'
|
col.operator("pose.group_move", icon='TRIA_UP', text="").direction = 'UP'
|
||||||
@@ -337,7 +337,7 @@ classes = (
|
|||||||
DATA_PT_context_arm,
|
DATA_PT_context_arm,
|
||||||
DATA_PT_skeleton,
|
DATA_PT_skeleton,
|
||||||
DATA_PT_display,
|
DATA_PT_display,
|
||||||
DATA_PT_bone_group_specials,
|
DATA_MT_bone_group_specials,
|
||||||
DATA_PT_bone_groups,
|
DATA_PT_bone_groups,
|
||||||
DATA_PT_pose_library,
|
DATA_PT_pose_library,
|
||||||
DATA_PT_ghost,
|
DATA_PT_ghost,
|
||||||
|
@@ -463,7 +463,7 @@ class GreasePencilBrushCurvesPanel:
|
|||||||
|
|
||||||
###############################
|
###############################
|
||||||
|
|
||||||
class GPENCIL_PIE_tool_palette(Menu):
|
class GPENCIL_MT_pie_tool_palette(Menu):
|
||||||
"""A pie menu for quick access to Grease Pencil tools"""
|
"""A pie menu for quick access to Grease Pencil tools"""
|
||||||
bl_label = "Grease Pencil Tools"
|
bl_label = "Grease Pencil Tools"
|
||||||
|
|
||||||
@@ -487,7 +487,7 @@ class GPENCIL_PIE_tool_palette(Menu):
|
|||||||
# E - "Settings" Palette is included here too, since it needs to be in a stable position...
|
# E - "Settings" Palette is included here too, since it needs to be in a stable position...
|
||||||
if gpd and gpd.layers.active:
|
if gpd and gpd.layers.active:
|
||||||
col.separator()
|
col.separator()
|
||||||
col.operator("wm.call_menu_pie", text="Settings...", icon='SCRIPTWIN').name = "GPENCIL_PIE_settings_palette"
|
col.operator("wm.call_menu_pie", text="Settings...", icon='SCRIPTWIN').name = "GPENCIL_MT_pie_settings_palette"
|
||||||
|
|
||||||
# Editing tools
|
# Editing tools
|
||||||
if gpd:
|
if gpd:
|
||||||
@@ -525,13 +525,13 @@ class GPENCIL_PIE_tool_palette(Menu):
|
|||||||
col.operator("gpencil.delete", icon='X', text="Delete...")
|
col.operator("gpencil.delete", icon='X', text="Delete...")
|
||||||
|
|
||||||
# SE - More Tools
|
# SE - More Tools
|
||||||
pie.operator("wm.call_menu_pie", text="More...").name = "GPENCIL_PIE_tools_more"
|
pie.operator("wm.call_menu_pie", text="More...").name = "GPENCIL_MT_pie_tools_more"
|
||||||
else:
|
else:
|
||||||
# Toggle Edit Mode
|
# Toggle Edit Mode
|
||||||
pie.operator("gpencil.editmode_toggle", text="Enable Stroke Editing", icon='EDIT')
|
pie.operator("gpencil.editmode_toggle", text="Enable Stroke Editing", icon='EDIT')
|
||||||
|
|
||||||
|
|
||||||
class GPENCIL_PIE_settings_palette(Menu):
|
class GPENCIL_MT_pie_settings_palette(Menu):
|
||||||
"""A pie menu for quick access to Grease Pencil settings"""
|
"""A pie menu for quick access to Grease Pencil settings"""
|
||||||
bl_label = "Grease Pencil Settings"
|
bl_label = "Grease Pencil Settings"
|
||||||
|
|
||||||
@@ -614,7 +614,7 @@ class GPENCIL_PIE_settings_palette(Menu):
|
|||||||
col.prop(gpd, "show_stroke_direction", text="Show drawing direction")
|
col.prop(gpd, "show_stroke_direction", text="Show drawing direction")
|
||||||
|
|
||||||
|
|
||||||
class GPENCIL_PIE_tools_more(Menu):
|
class GPENCIL_MT_pie_tools_more(Menu):
|
||||||
"""A pie menu for accessing more Grease Pencil tools"""
|
"""A pie menu for accessing more Grease Pencil tools"""
|
||||||
bl_label = "More Grease Pencil Tools"
|
bl_label = "More Grease Pencil Tools"
|
||||||
|
|
||||||
@@ -643,10 +643,10 @@ class GPENCIL_PIE_tools_more(Menu):
|
|||||||
pie.operator("transform.tosphere", icon='MOD_MULTIRES')
|
pie.operator("transform.tosphere", icon='MOD_MULTIRES')
|
||||||
|
|
||||||
pie.operator("gpencil.convert", icon='OUTLINER_OB_CURVE', text="Convert...")
|
pie.operator("gpencil.convert", icon='OUTLINER_OB_CURVE', text="Convert...")
|
||||||
pie.operator("wm.call_menu_pie", text="Back to Main Palette...").name = "GPENCIL_PIE_tool_palette"
|
pie.operator("wm.call_menu_pie", text="Back to Main Palette...").name = "GPENCIL_MT_pie_tool_palette"
|
||||||
|
|
||||||
|
|
||||||
class GPENCIL_PIE_sculpt(Menu):
|
class GPENCIL_MT_pie_sculpt(Menu):
|
||||||
"""A pie menu for accessing Grease Pencil stroke sculpting settings"""
|
"""A pie menu for accessing Grease Pencil stroke sculpting settings"""
|
||||||
bl_label = "Grease Pencil Sculpt"
|
bl_label = "Grease Pencil Sculpt"
|
||||||
|
|
||||||
@@ -1158,10 +1158,10 @@ class GreasePencilToolsPanel:
|
|||||||
|
|
||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
GPENCIL_PIE_tool_palette,
|
GPENCIL_MT_pie_tool_palette,
|
||||||
GPENCIL_PIE_settings_palette,
|
GPENCIL_MT_pie_settings_palette,
|
||||||
GPENCIL_PIE_tools_more,
|
GPENCIL_MT_pie_tools_more,
|
||||||
GPENCIL_PIE_sculpt,
|
GPENCIL_MT_pie_sculpt,
|
||||||
GPENCIL_MT_snap,
|
GPENCIL_MT_snap,
|
||||||
GPENCIL_MT_gpencil_edit_specials,
|
GPENCIL_MT_gpencil_edit_specials,
|
||||||
GPENCIL_UL_brush,
|
GPENCIL_UL_brush,
|
||||||
|
@@ -1086,7 +1086,7 @@ class IMAGE_PT_tools_paint_options(BrushButtonsPanel, Panel):
|
|||||||
col.prop(ups, "use_unified_color", text="Color")
|
col.prop(ups, "use_unified_color", text="Color")
|
||||||
|
|
||||||
|
|
||||||
class IMAGE_UV_sculpt_curve(Panel):
|
class IMAGE_PT_uv_sculpt_curve(Panel):
|
||||||
bl_space_type = 'IMAGE_EDITOR'
|
bl_space_type = 'IMAGE_EDITOR'
|
||||||
bl_region_type = 'TOOLS'
|
bl_region_type = 'TOOLS'
|
||||||
bl_label = "UV Sculpt Curve"
|
bl_label = "UV Sculpt Curve"
|
||||||
@@ -1117,7 +1117,7 @@ class IMAGE_UV_sculpt_curve(Panel):
|
|||||||
row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
|
row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
|
||||||
|
|
||||||
|
|
||||||
class IMAGE_UV_sculpt(Panel, ImagePaintPanel):
|
class IMAGE_PT_uv_sculpt(Panel, ImagePaintPanel):
|
||||||
bl_space_type = 'IMAGE_EDITOR'
|
bl_space_type = 'IMAGE_EDITOR'
|
||||||
bl_region_type = 'TOOLS'
|
bl_region_type = 'TOOLS'
|
||||||
bl_category = "Tools"
|
bl_category = "Tools"
|
||||||
@@ -1370,8 +1370,8 @@ classes = (
|
|||||||
IMAGE_PT_tools_imagepaint_symmetry,
|
IMAGE_PT_tools_imagepaint_symmetry,
|
||||||
IMAGE_PT_tools_brush_appearance,
|
IMAGE_PT_tools_brush_appearance,
|
||||||
IMAGE_PT_tools_paint_options,
|
IMAGE_PT_tools_paint_options,
|
||||||
IMAGE_UV_sculpt,
|
IMAGE_PT_uv_sculpt,
|
||||||
IMAGE_UV_sculpt_curve,
|
IMAGE_PT_uv_sculpt_curve,
|
||||||
IMAGE_PT_view_histogram,
|
IMAGE_PT_view_histogram,
|
||||||
IMAGE_PT_view_waveform,
|
IMAGE_PT_view_waveform,
|
||||||
IMAGE_PT_view_vectorscope,
|
IMAGE_PT_view_vectorscope,
|
||||||
|
@@ -1939,16 +1939,18 @@ extern const char *RE_engine_id_CYCLES;
|
|||||||
/* **************** SCENE ********************* */
|
/* **************** SCENE ********************* */
|
||||||
|
|
||||||
/* note that much higher maxframes give imprecise sub-frames, see: T46859 */
|
/* note that much higher maxframes give imprecise sub-frames, see: T46859 */
|
||||||
|
/* Current precision is 16 for the sub-frames closer to MAXFRAME. */
|
||||||
|
|
||||||
/* for general use */
|
/* for general use */
|
||||||
#define MAXFRAME 500000
|
#define MAXFRAME 1048574
|
||||||
#define MAXFRAMEF 500000.0f
|
#define MAXFRAMEF 1048574.0f
|
||||||
|
|
||||||
#define MINFRAME 0
|
#define MINFRAME 0
|
||||||
#define MINFRAMEF 0.0f
|
#define MINFRAMEF 0.0f
|
||||||
|
|
||||||
/* (minimum frame number for current-frame) */
|
/* (minimum frame number for current-frame) */
|
||||||
#define MINAFRAME -500000
|
#define MINAFRAME -1048574
|
||||||
#define MINAFRAMEF -500000.0f
|
#define MINAFRAMEF -1048574.0f
|
||||||
|
|
||||||
/* depricate this! */
|
/* depricate this! */
|
||||||
#define TESTBASE(v3d, base) ( \
|
#define TESTBASE(v3d, base) ( \
|
||||||
|
@@ -800,6 +800,7 @@ const struct ListBase *RNA_struct_type_functions(StructRNA *srna);
|
|||||||
char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, int *r_len);
|
char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, int *r_len);
|
||||||
|
|
||||||
bool RNA_struct_available_or_report(struct ReportList *reports, const char *identifier);
|
bool RNA_struct_available_or_report(struct ReportList *reports, const char *identifier);
|
||||||
|
bool RNA_struct_bl_idname_ok_or_report(struct ReportList *reports, const char *identifier, const char *sep);
|
||||||
|
|
||||||
/* Properties
|
/* Properties
|
||||||
*
|
*
|
||||||
|
@@ -437,6 +437,8 @@ typedef enum StructFlag {
|
|||||||
STRUCT_NO_IDPROPERTIES = (1 << 6), /* Menus and Panels don't need properties */
|
STRUCT_NO_IDPROPERTIES = (1 << 6), /* Menus and Panels don't need properties */
|
||||||
STRUCT_NO_DATABLOCK_IDPROPERTIES = (1 << 7), /* e.g. for Operator */
|
STRUCT_NO_DATABLOCK_IDPROPERTIES = (1 << 7), /* e.g. for Operator */
|
||||||
STRUCT_CONTAINS_DATABLOCK_IDPROPERTIES = (1 << 8), /* for PropertyGroup which contains pointers to datablocks */
|
STRUCT_CONTAINS_DATABLOCK_IDPROPERTIES = (1 << 8), /* for PropertyGroup which contains pointers to datablocks */
|
||||||
|
STRUCT_PUBLIC_NAMESPACE = (1 << 9), /* Added to type-map #BlenderRNA.structs_map */
|
||||||
|
STRUCT_PUBLIC_NAMESPACE_INHERIT = (1 << 10), /* All subtypes are added too. */
|
||||||
} StructFlag;
|
} StructFlag;
|
||||||
|
|
||||||
typedef int (*StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function);
|
typedef int (*StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function);
|
||||||
|
@@ -290,10 +290,6 @@ StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain), ReportList *reports,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!RNA_struct_available_or_report(reports, identifier)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_PropertyGroup); /* XXX */
|
return RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_PropertyGroup); /* XXX */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -90,6 +90,7 @@ void RNA_init(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BLI_assert(srna->flag & STRUCT_PUBLIC_NAMESPACE);
|
||||||
BLI_ghash_insert(BLENDER_RNA.structs_map, (void *)srna->identifier, srna);
|
BLI_ghash_insert(BLENDER_RNA.structs_map, (void *)srna->identifier, srna);
|
||||||
BLENDER_RNA.structs_len += 1;
|
BLENDER_RNA.structs_len += 1;
|
||||||
}
|
}
|
||||||
@@ -831,6 +832,9 @@ char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, i
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use when registering structs with the #STRUCT_PUBLIC_NAMESPACE flag.
|
||||||
|
*/
|
||||||
bool RNA_struct_available_or_report(ReportList *reports, const char *identifier)
|
bool RNA_struct_available_or_report(ReportList *reports, const char *identifier)
|
||||||
{
|
{
|
||||||
const StructRNA *srna_exists = RNA_struct_find(identifier);
|
const StructRNA *srna_exists = RNA_struct_find(identifier);
|
||||||
@@ -863,6 +867,46 @@ bool RNA_struct_available_or_report(ReportList *reports, const char *identifier)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RNA_struct_bl_idname_ok_or_report(ReportList *reports, const char *identifier, const char *sep)
|
||||||
|
{
|
||||||
|
const int len_sep = strlen(sep);
|
||||||
|
const int len_id = strlen(identifier);
|
||||||
|
const char *p = strstr(identifier, sep);
|
||||||
|
if (p == NULL || p == identifier || p + len_sep >= identifier + len_id) {
|
||||||
|
BKE_reportf(reports, RPT_ERROR, "'%s' doesn't contain '%s' with prefix & suffix", identifier, sep);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *c, *start, *end, *last;
|
||||||
|
start = identifier;
|
||||||
|
end = p;
|
||||||
|
last = end - 1;
|
||||||
|
for (c = start; c != end; c++) {
|
||||||
|
if (((*c >= 'A' && *c <= 'Z') ||
|
||||||
|
((c != start) && (*c >= '0' && *c <= '9')) ||
|
||||||
|
((c != start) && (c != last) && (*c == '_'))) == 0)
|
||||||
|
{
|
||||||
|
BKE_reportf(reports, RPT_ERROR, "'%s' doesn't have upper case alpha-numeric prefix", identifier);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
start = p + len_sep;
|
||||||
|
end = identifier + len_id;
|
||||||
|
last = end - 1;
|
||||||
|
for (c = start; c != end; c++) {
|
||||||
|
if (((*c >= 'A' && *c <= 'Z') ||
|
||||||
|
(*c >= 'a' && *c <= 'z') ||
|
||||||
|
(*c >= '0' && *c <= '9') ||
|
||||||
|
((c != start) && (c != last) && (*c == '_'))) == 0)
|
||||||
|
{
|
||||||
|
BKE_reportf(reports, RPT_ERROR, "'%s' doesn't have an alpha-numeric suffix", identifier);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/* Property Information */
|
/* Property Information */
|
||||||
|
|
||||||
const char *RNA_property_identifier(PropertyRNA *prop)
|
const char *RNA_property_identifier(PropertyRNA *prop)
|
||||||
|
@@ -274,9 +274,6 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, v
|
|||||||
if (ksi && ksi->ext.srna) {
|
if (ksi && ksi->ext.srna) {
|
||||||
rna_KeyingSetInfo_unregister(bmain, ksi->ext.srna);
|
rna_KeyingSetInfo_unregister(bmain, ksi->ext.srna);
|
||||||
}
|
}
|
||||||
if (!RNA_struct_available_or_report(reports, dummyksi.idname)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create a new KeyingSetInfo type */
|
/* create a new KeyingSetInfo type */
|
||||||
ksi = MEM_callocN(sizeof(KeyingSetInfo), "python keying set info");
|
ksi = MEM_callocN(sizeof(KeyingSetInfo), "python keying set info");
|
||||||
|
@@ -142,7 +142,9 @@ static void rna_brna_structs_add(BlenderRNA *brna, StructRNA *srna)
|
|||||||
|
|
||||||
/* This exception is only needed for pre-processing.
|
/* This exception is only needed for pre-processing.
|
||||||
* otherwise we don't allow empty names. */
|
* otherwise we don't allow empty names. */
|
||||||
if (srna->identifier[0] != '\0') {
|
if ((srna->flag & STRUCT_PUBLIC_NAMESPACE) &&
|
||||||
|
(srna->identifier[0] != '\0'))
|
||||||
|
{
|
||||||
BLI_ghash_insert(brna->structs_map, (void *)srna->identifier, srna);
|
BLI_ghash_insert(brna->structs_map, (void *)srna->identifier, srna);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,7 +152,7 @@ static void rna_brna_structs_add(BlenderRNA *brna, StructRNA *srna)
|
|||||||
#ifdef RNA_RUNTIME
|
#ifdef RNA_RUNTIME
|
||||||
static void rna_brna_structs_remove_and_free(BlenderRNA *brna, StructRNA *srna)
|
static void rna_brna_structs_remove_and_free(BlenderRNA *brna, StructRNA *srna)
|
||||||
{
|
{
|
||||||
if (brna->structs_map) {
|
if ((srna->flag & STRUCT_PUBLIC_NAMESPACE) && brna->structs_map) {
|
||||||
if (srna->identifier[0] != '\0') {
|
if (srna->identifier[0] != '\0') {
|
||||||
BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL);
|
BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL);
|
||||||
}
|
}
|
||||||
@@ -763,12 +765,19 @@ StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRN
|
|||||||
BLI_listbase_clear(&srna->functions);
|
BLI_listbase_clear(&srna->functions);
|
||||||
srna->py_type = NULL;
|
srna->py_type = NULL;
|
||||||
|
|
||||||
|
srna->base = srnafrom;
|
||||||
|
|
||||||
if (DefRNA.preprocess) {
|
if (DefRNA.preprocess) {
|
||||||
srna->base = srnafrom;
|
|
||||||
dsfrom = rna_find_def_struct(srnafrom);
|
dsfrom = rna_find_def_struct(srnafrom);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
srna->base = srnafrom;
|
if (srnafrom->flag & STRUCT_PUBLIC_NAMESPACE_INHERIT) {
|
||||||
|
srna->flag |= STRUCT_PUBLIC_NAMESPACE | STRUCT_PUBLIC_NAMESPACE_INHERIT;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
srna->flag &= ~(STRUCT_PUBLIC_NAMESPACE | STRUCT_PUBLIC_NAMESPACE_INHERIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
srna->identifier = identifier;
|
srna->identifier = identifier;
|
||||||
@@ -780,6 +789,10 @@ StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRN
|
|||||||
if (!srnafrom)
|
if (!srnafrom)
|
||||||
srna->icon = ICON_DOT;
|
srna->icon = ICON_DOT;
|
||||||
|
|
||||||
|
if (DefRNA.preprocess) {
|
||||||
|
srna->flag |= STRUCT_PUBLIC_NAMESPACE;
|
||||||
|
}
|
||||||
|
|
||||||
rna_brna_structs_add(brna, srna);
|
rna_brna_structs_add(brna, srna);
|
||||||
|
|
||||||
if (DefRNA.preprocess) {
|
if (DefRNA.preprocess) {
|
||||||
@@ -1001,12 +1014,14 @@ void RNA_def_struct_identifier(BlenderRNA *brna, StructRNA *srna, const char *id
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Operator registration may set twice, see: operator_properties_init */
|
/* Operator registration may set twice, see: operator_properties_init */
|
||||||
if (identifier != srna->identifier) {
|
if (srna->flag & STRUCT_PUBLIC_NAMESPACE) {
|
||||||
if (srna->identifier[0] != '\0') {
|
if (identifier != srna->identifier) {
|
||||||
BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL);
|
if (srna->identifier[0] != '\0') {
|
||||||
}
|
BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL);
|
||||||
if (identifier[0] != '\0') {
|
}
|
||||||
BLI_ghash_insert(brna->structs_map, (void *)identifier, srna);
|
if (identifier[0] != '\0') {
|
||||||
|
BLI_ghash_insert(brna->structs_map, (void *)identifier, srna);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3316,8 +3331,10 @@ void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
|
|||||||
void RNA_def_struct_duplicate_pointers(BlenderRNA *brna, StructRNA *srna)
|
void RNA_def_struct_duplicate_pointers(BlenderRNA *brna, StructRNA *srna)
|
||||||
{
|
{
|
||||||
if (srna->identifier) {
|
if (srna->identifier) {
|
||||||
srna->identifier = BLI_strdup(srna->identifier);
|
if (srna->flag & STRUCT_PUBLIC_NAMESPACE) {
|
||||||
BLI_ghash_replace_key(brna->structs_map, (void *)srna->identifier);
|
srna->identifier = BLI_strdup(srna->identifier);
|
||||||
|
BLI_ghash_replace_key(brna->structs_map, (void *)srna->identifier);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (srna->name) {
|
if (srna->name) {
|
||||||
srna->name = BLI_strdup(srna->name);
|
srna->name = BLI_strdup(srna->name);
|
||||||
@@ -3333,8 +3350,10 @@ void RNA_def_struct_free_pointers(BlenderRNA *brna, StructRNA *srna)
|
|||||||
{
|
{
|
||||||
if (srna->flag & STRUCT_FREE_POINTERS) {
|
if (srna->flag & STRUCT_FREE_POINTERS) {
|
||||||
if (srna->identifier) {
|
if (srna->identifier) {
|
||||||
if (brna != NULL) {
|
if (srna->flag & STRUCT_PUBLIC_NAMESPACE) {
|
||||||
BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL);
|
if (brna != NULL) {
|
||||||
|
BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MEM_freeN((void *)srna->identifier);
|
MEM_freeN((void *)srna->identifier);
|
||||||
}
|
}
|
||||||
|
@@ -404,6 +404,8 @@ struct StructRNA {
|
|||||||
|
|
||||||
struct BlenderRNA {
|
struct BlenderRNA {
|
||||||
ListBase structs;
|
ListBase structs;
|
||||||
|
/* A map of structs: {StructRNA.identifier -> StructRNA}
|
||||||
|
* These are ensured to have unique names (with STRUCT_PUBLIC_NAMESPACE enabled). */
|
||||||
struct GHash *structs_map;
|
struct GHash *structs_map;
|
||||||
/* Needed because types with an empty identifier aren't included in 'structs_map'. */
|
/* Needed because types with an empty identifier aren't included in 'structs_map'. */
|
||||||
unsigned int structs_len;
|
unsigned int structs_len;
|
||||||
|
@@ -637,9 +637,6 @@ static StructRNA *rna_NodeTree_register(
|
|||||||
if (nt) {
|
if (nt) {
|
||||||
rna_NodeTree_unregister(bmain, nt->ext.srna);
|
rna_NodeTree_unregister(bmain, nt->ext.srna);
|
||||||
}
|
}
|
||||||
if (!RNA_struct_available_or_report(reports, dummynt.idname)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create a new node tree type */
|
/* create a new node tree type */
|
||||||
nt = MEM_callocN(sizeof(bNodeTreeType), "node tree type");
|
nt = MEM_callocN(sizeof(bNodeTreeType), "node tree type");
|
||||||
@@ -1403,9 +1400,6 @@ static bNodeType *rna_Node_register_base(Main *bmain, ReportList *reports, Struc
|
|||||||
if (nt) {
|
if (nt) {
|
||||||
rna_Node_unregister(bmain, nt->ext.srna);
|
rna_Node_unregister(bmain, nt->ext.srna);
|
||||||
}
|
}
|
||||||
if (!RNA_struct_available_or_report(reports, dummynt.idname)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create a new node type */
|
/* create a new node type */
|
||||||
nt = MEM_callocN(sizeof(bNodeType), "node type");
|
nt = MEM_callocN(sizeof(bNodeType), "node type");
|
||||||
|
@@ -341,9 +341,6 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!RNA_struct_available_or_report(reports, dummyet.idname)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create a new engine type */
|
/* create a new engine type */
|
||||||
et = MEM_callocN(sizeof(RenderEngineType), "python render engine");
|
et = MEM_callocN(sizeof(RenderEngineType), "python render engine");
|
||||||
|
@@ -983,10 +983,18 @@ static int rna_Function_use_self_type_get(PointerRNA *ptr)
|
|||||||
|
|
||||||
/* Blender RNA */
|
/* Blender RNA */
|
||||||
|
|
||||||
|
static int rna_struct_is_publc(CollectionPropertyIterator *UNUSED(iter), void *data)
|
||||||
|
{
|
||||||
|
StructRNA *srna = data;
|
||||||
|
|
||||||
|
return !(srna->flag & STRUCT_PUBLIC_NAMESPACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void rna_BlenderRNA_structs_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
static void rna_BlenderRNA_structs_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
BlenderRNA *brna = ptr->data;
|
BlenderRNA *brna = ptr->data;
|
||||||
rna_iterator_listbase_begin(iter, &brna->structs, NULL);
|
rna_iterator_listbase_begin(iter, &brna->structs, rna_struct_is_publc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* optional, for faster lookups */
|
/* optional, for faster lookups */
|
||||||
|
@@ -232,6 +232,9 @@ static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *dat
|
|||||||
if (!RNA_struct_available_or_report(reports, dummypt.idname)) {
|
if (!RNA_struct_available_or_report(reports, dummypt.idname)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (!RNA_struct_bl_idname_ok_or_report(reports, dummypt.idname, "_PT_")) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* create a new panel type */
|
/* create a new panel type */
|
||||||
pt = MEM_callocN(sizeof(PanelType), "python buttons panel");
|
pt = MEM_callocN(sizeof(PanelType), "python buttons panel");
|
||||||
@@ -497,6 +500,9 @@ static StructRNA *rna_UIList_register(Main *bmain, ReportList *reports, void *da
|
|||||||
if (!RNA_struct_available_or_report(reports, dummyult.idname)) {
|
if (!RNA_struct_available_or_report(reports, dummyult.idname)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (!RNA_struct_bl_idname_ok_or_report(reports, dummyult.idname, "_UL_")) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* create a new menu type */
|
/* create a new menu type */
|
||||||
ult = MEM_callocN(sizeof(uiListType) + over_alloc, "python uilist");
|
ult = MEM_callocN(sizeof(uiListType) + over_alloc, "python uilist");
|
||||||
@@ -602,6 +608,9 @@ static StructRNA *rna_Header_register(Main *bmain, ReportList *reports, void *da
|
|||||||
if (!RNA_struct_available_or_report(reports, dummyht.idname)) {
|
if (!RNA_struct_available_or_report(reports, dummyht.idname)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (!RNA_struct_bl_idname_ok_or_report(reports, dummyht.idname, "_HT_")) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* create a new header type */
|
/* create a new header type */
|
||||||
ht = MEM_callocN(sizeof(HeaderType), "python buttons header");
|
ht = MEM_callocN(sizeof(HeaderType), "python buttons header");
|
||||||
@@ -728,6 +737,9 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data
|
|||||||
if (!RNA_struct_available_or_report(reports, dummymt.idname)) {
|
if (!RNA_struct_available_or_report(reports, dummymt.idname)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (!RNA_struct_bl_idname_ok_or_report(reports, dummymt.idname, "_MT_")) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* create a new menu type */
|
/* create a new menu type */
|
||||||
if (_menu_descr[0]) {
|
if (_menu_descr[0]) {
|
||||||
@@ -949,6 +961,7 @@ static void rna_def_panel(BlenderRNA *brna)
|
|||||||
RNA_def_struct_refine_func(srna, "rna_Panel_refine");
|
RNA_def_struct_refine_func(srna, "rna_Panel_refine");
|
||||||
RNA_def_struct_register_funcs(srna, "rna_Panel_register", "rna_Panel_unregister", NULL);
|
RNA_def_struct_register_funcs(srna, "rna_Panel_register", "rna_Panel_unregister", NULL);
|
||||||
RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||||
|
RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
|
||||||
|
|
||||||
/* poll */
|
/* poll */
|
||||||
func = RNA_def_function(srna, "poll", NULL);
|
func = RNA_def_function(srna, "poll", NULL);
|
||||||
@@ -1051,7 +1064,7 @@ static void rna_def_uilist(BlenderRNA *brna)
|
|||||||
RNA_def_struct_refine_func(srna, "rna_UIList_refine");
|
RNA_def_struct_refine_func(srna, "rna_UIList_refine");
|
||||||
RNA_def_struct_register_funcs(srna, "rna_UIList_register", "rna_UIList_unregister", NULL);
|
RNA_def_struct_register_funcs(srna, "rna_UIList_register", "rna_UIList_unregister", NULL);
|
||||||
RNA_def_struct_idprops_func(srna, "rna_UIList_idprops");
|
RNA_def_struct_idprops_func(srna, "rna_UIList_idprops");
|
||||||
RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
|
RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES | STRUCT_PUBLIC_NAMESPACE_INHERIT);
|
||||||
|
|
||||||
/* Registration */
|
/* Registration */
|
||||||
prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
|
prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
|
||||||
@@ -1173,6 +1186,7 @@ static void rna_def_header(BlenderRNA *brna)
|
|||||||
RNA_def_struct_sdna(srna, "Header");
|
RNA_def_struct_sdna(srna, "Header");
|
||||||
RNA_def_struct_refine_func(srna, "rna_Header_refine");
|
RNA_def_struct_refine_func(srna, "rna_Header_refine");
|
||||||
RNA_def_struct_register_funcs(srna, "rna_Header_register", "rna_Header_unregister", NULL);
|
RNA_def_struct_register_funcs(srna, "rna_Header_register", "rna_Header_unregister", NULL);
|
||||||
|
RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
|
||||||
|
|
||||||
/* draw */
|
/* draw */
|
||||||
func = RNA_def_function(srna, "draw", NULL);
|
func = RNA_def_function(srna, "draw", NULL);
|
||||||
@@ -1220,6 +1234,7 @@ static void rna_def_menu(BlenderRNA *brna)
|
|||||||
RNA_def_struct_refine_func(srna, "rna_Menu_refine");
|
RNA_def_struct_refine_func(srna, "rna_Menu_refine");
|
||||||
RNA_def_struct_register_funcs(srna, "rna_Menu_register", "rna_Menu_unregister", NULL);
|
RNA_def_struct_register_funcs(srna, "rna_Menu_register", "rna_Menu_unregister", NULL);
|
||||||
RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||||
|
RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
|
||||||
|
|
||||||
/* poll */
|
/* poll */
|
||||||
func = RNA_def_function(srna, "poll", NULL);
|
func = RNA_def_function(srna, "poll", NULL);
|
||||||
|
@@ -618,9 +618,6 @@ static StructRNA *rna_AddonPref_register(Main *bmain, ReportList *reports, void
|
|||||||
if (apt && apt->ext.srna) {
|
if (apt && apt->ext.srna) {
|
||||||
rna_AddonPref_unregister(bmain, apt->ext.srna);
|
rna_AddonPref_unregister(bmain, apt->ext.srna);
|
||||||
}
|
}
|
||||||
if (!RNA_struct_available_or_report(reports, identifier)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create a new header type */
|
/* create a new header type */
|
||||||
apt = MEM_mallocN(sizeof(bAddonPrefType), "addonpreftype");
|
apt = MEM_mallocN(sizeof(bAddonPrefType), "addonpreftype");
|
||||||
|
@@ -1638,7 +1638,7 @@ static void rna_def_operator(BlenderRNA *brna)
|
|||||||
RNA_def_struct_ui_text(srna, "Operator Properties", "Input properties of an Operator");
|
RNA_def_struct_ui_text(srna, "Operator Properties", "Input properties of an Operator");
|
||||||
RNA_def_struct_refine_func(srna, "rna_OperatorProperties_refine");
|
RNA_def_struct_refine_func(srna, "rna_OperatorProperties_refine");
|
||||||
RNA_def_struct_idprops_func(srna, "rna_OperatorProperties_idprops");
|
RNA_def_struct_idprops_func(srna, "rna_OperatorProperties_idprops");
|
||||||
RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
|
RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES | STRUCT_PUBLIC_NAMESPACE_INHERIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_def_macro_operator(BlenderRNA *brna)
|
static void rna_def_macro_operator(BlenderRNA *brna)
|
||||||
|
@@ -53,7 +53,7 @@ static void operator_properties_init(wmOperatorType *ot)
|
|||||||
*
|
*
|
||||||
* Note the 'no_struct_map' function is used since the actual struct name is already used by the operator.
|
* Note the 'no_struct_map' function is used since the actual struct name is already used by the operator.
|
||||||
*/
|
*/
|
||||||
RNA_def_struct_identifier_no_struct_map(ot->srna, ot->idname);
|
RNA_def_struct_identifier(&BLENDER_RNA, ot->srna, ot->idname);
|
||||||
|
|
||||||
if (pyrna_deferred_register_class(ot->srna, py_class) != 0) {
|
if (pyrna_deferred_register_class(ot->srna, py_class) != 0) {
|
||||||
PyErr_Print(); /* failed to register operator props */
|
PyErr_Print(); /* failed to register operator props */
|
||||||
|
@@ -6965,15 +6965,7 @@ static PyObject *pyrna_basetype_dir(BPy_BaseTypeRNA *self)
|
|||||||
RNA_PROP_BEGIN (&self->ptr, itemptr, self->prop)
|
RNA_PROP_BEGIN (&self->ptr, itemptr, self->prop)
|
||||||
{
|
{
|
||||||
StructRNA *srna = itemptr.data;
|
StructRNA *srna = itemptr.data;
|
||||||
StructRNA *srna_base = RNA_struct_base(itemptr.data);
|
PyList_APPEND(ret, PyUnicode_FromString(RNA_struct_identifier(srna)));
|
||||||
/* skip own operators, these double up [#29666] */
|
|
||||||
if (ELEM(srna_base, &RNA_Operator, &RNA_Manipulator)) {
|
|
||||||
/* do nothing */
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* add to python list */
|
|
||||||
PyList_APPEND(ret, PyUnicode_FromString(RNA_struct_identifier(srna)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
RNA_PROP_END;
|
RNA_PROP_END;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user