
/* Automatically generated struct definitions for the Data API.
 * Do not edit manually, changes will be overwritten.           */

#define RNA_RUNTIME

#include <float.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>

#include <stddef.h>

#include "MEM_guardedalloc.h"

#include "DNA_ID.h"
#include "DNA_scene_types.h"
#include "BLI_blenlib.h"

#include "BLI_utildefines.h"

#include "BKE_context.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "RNA_define.h"
#include "RNA_types.h"
#include "rna_internal.h"

#include "rna_prototypes_gen.h"

#include "rna_group.c"

/* Autogenerated Functions */


extern CollectionPropertyRNA rna_ID_rna_properties;
extern PointerPropertyRNA rna_ID_rna_type;
extern StringPropertyRNA rna_ID_name;
extern IntPropertyRNA rna_ID_users;
extern BoolPropertyRNA rna_ID_use_fake_user;
extern BoolPropertyRNA rna_ID_tag;
extern BoolPropertyRNA rna_ID_is_updated;
extern BoolPropertyRNA rna_ID_is_updated_data;
extern BoolPropertyRNA rna_ID_is_library_indirect;
extern PointerPropertyRNA rna_ID_library;
extern PointerPropertyRNA rna_ID_preview;

FloatPropertyRNA rna_Group_dupli_offset;
BoolPropertyRNA rna_Group_layers;
CollectionPropertyRNA rna_Group_objects;

extern FunctionRNA rna_ID_copy_func;
extern PointerPropertyRNA rna_ID_copy_id;

extern FunctionRNA rna_ID_user_clear_func;
extern FunctionRNA rna_ID_user_remap_func;
extern PointerPropertyRNA rna_ID_user_remap_new_id;

extern FunctionRNA rna_ID_make_local_func;
extern BoolPropertyRNA rna_ID_make_local_clear_proxy;
extern PointerPropertyRNA rna_ID_make_local_id;

extern FunctionRNA rna_ID_user_of_id_func;
extern PointerPropertyRNA rna_ID_user_of_id_id;
extern IntPropertyRNA rna_ID_user_of_id_count;

extern FunctionRNA rna_ID_animation_data_create_func;
extern PointerPropertyRNA rna_ID_animation_data_create_anim_data;

extern FunctionRNA rna_ID_animation_data_clear_func;
extern FunctionRNA rna_ID_update_tag_func;
extern EnumPropertyRNA rna_ID_update_tag_refresh;



CollectionPropertyRNA rna_GroupObjects_rna_properties;
PointerPropertyRNA rna_GroupObjects_rna_type;

extern FunctionRNA rna_GroupObjects_link_func;
extern PointerPropertyRNA rna_GroupObjects_link_object;

extern FunctionRNA rna_GroupObjects_unlink_func;
extern PointerPropertyRNA rna_GroupObjects_unlink_object;


void Group_dupli_offset_get(PointerRNA *ptr, float values[3])
{
	Group *data = (Group *)(ptr->data);
	unsigned int i;

	for (i = 0; i < 3; i++) {
		values[i] = (float)(((float *)data->dupli_ofs)[i]);
	}
}

void Group_dupli_offset_set(PointerRNA *ptr, const float values[3])
{
	Group *data = (Group *)(ptr->data);
	unsigned int i;

	for (i = 0; i < 3; i++) {
		((float *)data->dupli_ofs)[i] = values[i];
	}
}

void Group_layers_get(PointerRNA *ptr, int values[20])
{
	Group *data = (Group *)(ptr->data);
	unsigned int i;

	for (i = 0; i < 20; i++) {
		values[i] = ((data->layer & (1u << i)) != 0);
	}
}

void Group_layers_set(PointerRNA *ptr, const int values[20])
{
	Group *data = (Group *)(ptr->data);
	unsigned int i;

	for (i = 0; i < 20; i++) {
		if (values[i]) data->layer |= (1u << i);
		else data->layer &= ~(1u << i);
	}
}

static PointerRNA Group_objects_get(CollectionPropertyIterator *iter)
{
	return rna_Group_objects_get(iter);
}

void Group_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
	Group *data = (Group *)(ptr->data);

	memset(iter, 0, sizeof(*iter));
	iter->parent = *ptr;
	iter->prop = (PropertyRNA *)&rna_Group_objects;

	rna_iterator_listbase_begin(iter, &data->gobject, NULL);

	if (iter->valid)
		iter->ptr = Group_objects_get(iter);
}

void Group_objects_next(CollectionPropertyIterator *iter)
{
	rna_iterator_listbase_next(iter);

	if (iter->valid)
		iter->ptr = Group_objects_get(iter);
}

void Group_objects_end(CollectionPropertyIterator *iter)
{
	rna_iterator_listbase_end(iter);
}

int Group_objects_lookup_int(PointerRNA *ptr, int index, PointerRNA *r_ptr)
{
	int found = 0;
	CollectionPropertyIterator iter;

	Group_objects_begin(&iter, ptr);

	if (iter.valid) {
		ListBaseIterator *internal = &iter.internal.listbase;
		if (internal->skip) {
			while (index-- > 0 && iter.valid) {
				rna_iterator_listbase_next(&iter);
			}
			found = (index == -1 && iter.valid);
		}
		else {
			while (index-- > 0 && internal->link)
				internal->link = internal->link->next;
			found = (index == -1 && internal->link);
		}
		if (found) *r_ptr = Group_objects_get(&iter);
	}

	Group_objects_end(&iter);

	return found;
}

int Group_objects_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
{
	extern int ID_name_length(PointerRNA *);
	extern void ID_name_get(PointerRNA *, char *);

	bool found = false;
	CollectionPropertyIterator iter;
	char namebuf[1024];
	char *name;

	Group_objects_begin(&iter, ptr);

	while (iter.valid) {
		if (iter.ptr.data) {
			int namelen = ID_name_length(&iter.ptr);
			if (namelen < 1024) {
				ID_name_get(&iter.ptr, namebuf);
				if (strcmp(namebuf, key) == 0) {
					found = true;
					*r_ptr = iter.ptr;
					break;
				}
			}
			else {
				name = MEM_mallocN(namelen+1, "name string");
				ID_name_get(&iter.ptr, name);
				if (strcmp(name, key) == 0) {
					MEM_freeN(name);

					found = true;
					*r_ptr = iter.ptr;
					break;
				}
				else {
					MEM_freeN(name);
				}
			}
		}
		Group_objects_next(&iter);
	}
	Group_objects_end(&iter);

	return found;
}

static PointerRNA GroupObjects_rna_properties_get(CollectionPropertyIterator *iter)
{
	return rna_builtin_properties_get(iter);
}

void GroupObjects_rna_properties_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{

	memset(iter, 0, sizeof(*iter));
	iter->parent = *ptr;
	iter->prop = (PropertyRNA *)&rna_GroupObjects_rna_properties;

	rna_builtin_properties_begin(iter, ptr);

	if (iter->valid)
		iter->ptr = GroupObjects_rna_properties_get(iter);
}

void GroupObjects_rna_properties_next(CollectionPropertyIterator *iter)
{
	rna_builtin_properties_next(iter);

	if (iter->valid)
		iter->ptr = GroupObjects_rna_properties_get(iter);
}

void GroupObjects_rna_properties_end(CollectionPropertyIterator *iter)
{
	rna_iterator_listbase_end(iter);
}

int GroupObjects_rna_properties_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
{
	return rna_builtin_properties_lookup_string(ptr, key, r_ptr);
}

PointerRNA GroupObjects_rna_type_get(PointerRNA *ptr)
{
	return rna_builtin_type_get(ptr);
}


void GroupObjects_link(struct Group *_self, bContext *C, ReportList *reports, struct Object *object)
{
	rna_Group_objects_link(_self, C, reports, object);
}

void GroupObjects_link_call(bContext *C, ReportList *reports, PointerRNA *_ptr, ParameterList *_parms)
{
	struct Group *_self;
	struct Object *object;
	char *_data;
	
	_self = (struct Group *)_ptr->data;
	_data = (char *)_parms->data;
	object = *((struct Object **)_data);
	
	rna_Group_objects_link(_self, C, reports, object);
}

void GroupObjects_unlink(struct Group *_self, bContext *C, ReportList *reports, struct Object *object)
{
	rna_Group_objects_unlink(_self, C, reports, object);
}

void GroupObjects_unlink_call(bContext *C, ReportList *reports, PointerRNA *_ptr, ParameterList *_parms)
{
	struct Group *_self;
	struct Object *object;
	char *_data;
	
	_self = (struct Group *)_ptr->data;
	_data = (char *)_parms->data;
	object = *((struct Object **)_data);
	
	rna_Group_objects_unlink(_self, C, reports, object);
}

/* Repeated prototypes to detect errors */

void rna_Group_objects_link(struct Group *_self, bContext *C, ReportList *reports, struct Object *object);
void rna_Group_objects_unlink(struct Group *_self, bContext *C, ReportList *reports, struct Object *object);

/* Group */
static float rna_Group_dupli_offset_default[3] = {
	0.0f,
	0.0f,
	0.0f
};

FloatPropertyRNA rna_Group_dupli_offset = {
	{(PropertyRNA *)&rna_Group_layers, NULL,
	-1, "dupli_offset", 3, 0, 4, "Dupli Offset",
	"Offset from the origin to use when instancing as DupliGroup",
	0, "*",
	PROP_FLOAT, PROP_TRANSLATION | PROP_UNIT_LENGTH, NULL, 1, {3, 0, 0}, 3,
	NULL, 85393408, NULL, NULL,
	offsetof(Group, dupli_ofs), 4, NULL},
	NULL, NULL, Group_dupli_offset_get, Group_dupli_offset_set, NULL, NULL, NULL, NULL, NULL, NULL, -10000.0f, 10000.0f, -FLT_MAX, FLT_MAX, 10.0f, 5, 0.0f, rna_Group_dupli_offset_default
};

static int rna_Group_layers_default[20] = {
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0
};

BoolPropertyRNA rna_Group_layers = {
	{(PropertyRNA *)&rna_Group_objects, (PropertyRNA *)&rna_Group_dupli_offset,
	-1, "layers", 3, 0, 0, "Dupli Layers",
	"Layers visible when this group is instanced as a dupli",
	0, "*",
	PROP_BOOLEAN, PROP_LAYER | PROP_UNIT_NONE, NULL, 1, {20, 0, 0}, 20,
	NULL, 85393408, NULL, NULL,
	0, -1, NULL},
	NULL, NULL, Group_layers_get, Group_layers_set, NULL, NULL, NULL, NULL, 0, rna_Group_layers_default
};

CollectionPropertyRNA rna_Group_objects = {
	{NULL, (PropertyRNA *)&rna_Group_layers,
	-1, "objects", 0, 0, 0, "Objects",
	"A collection of this groups objects",
	0, "*",
	PROP_COLLECTION, PROP_NONE | PROP_UNIT_NONE, NULL, 0, {0, 0, 0}, 0,
	NULL, 0, NULL, NULL,
	0, -1, &RNA_GroupObjects},
	Group_objects_begin, Group_objects_next, Group_objects_end, Group_objects_get, NULL, Group_objects_lookup_int, Group_objects_lookup_string, NULL, &RNA_Object
};

StructRNA RNA_Group = {
	{(ContainerRNA *)&RNA_GroupObjects, (ContainerRNA *)&RNA_GPencilPaletteColor,
	NULL,
	{(PropertyRNA *)&rna_Group_dupli_offset, (PropertyRNA *)&rna_Group_objects}},
	"Group", NULL, NULL, 5, "Group",
	"Group of Object data-blocks",
	"*", 171,
	(PropertyRNA *)&rna_ID_name, (PropertyRNA *)&rna_ID_rna_properties,
	&RNA_ID,
	NULL,
	rna_ID_refine,
	NULL,
	NULL,
	NULL,
	NULL,
	rna_ID_idprops,
	{NULL, NULL}
};

/* Group Objects */
CollectionPropertyRNA rna_GroupObjects_rna_properties = {
	{(PropertyRNA *)&rna_GroupObjects_rna_type, NULL,
	-1, "rna_properties", 0, 0, 1, "Properties",
	"RNA property collection",
	0, "*",
	PROP_COLLECTION, PROP_NONE | PROP_UNIT_NONE, NULL, 0, {0, 0, 0}, 0,
	NULL, 0, NULL, NULL,
	0, -1, NULL},
	GroupObjects_rna_properties_begin, GroupObjects_rna_properties_next, GroupObjects_rna_properties_end, GroupObjects_rna_properties_get, NULL, NULL, GroupObjects_rna_properties_lookup_string, NULL, &RNA_Property
};

PointerPropertyRNA rna_GroupObjects_rna_type = {
	{NULL, (PropertyRNA *)&rna_GroupObjects_rna_properties,
	-1, "rna_type", 8912896, 0, 0, "RNA",
	"RNA type definition",
	0, "*",
	PROP_POINTER, PROP_NONE | PROP_UNIT_NONE, NULL, 0, {0, 0, 0}, 0,
	NULL, 0, NULL, NULL,
	0, -1, NULL},
	GroupObjects_rna_type_get, NULL, NULL, NULL,&RNA_Struct
};

PointerPropertyRNA rna_GroupObjects_link_object = {
	{NULL, NULL,
	-1, "object", 8650752, 1, 0, "",
	"Object to add",
	0, "*",
	PROP_POINTER, PROP_NONE | PROP_UNIT_NONE, NULL, 0, {0, 0, 0}, 0,
	NULL, 0, NULL, NULL,
	0, -1, NULL},
	NULL, NULL, NULL, NULL,&RNA_Object
};

FunctionRNA rna_GroupObjects_link_func = {
	{(FunctionRNA *)&rna_GroupObjects_unlink_func, NULL,
	NULL,
	{(PropertyRNA *)&rna_GroupObjects_link_object, (PropertyRNA *)&rna_GroupObjects_link_object}},
	"link", 24, "Add this object to a group",
	GroupObjects_link_call,
	NULL
};

PointerPropertyRNA rna_GroupObjects_unlink_object = {
	{NULL, NULL,
	-1, "object", 8388608, 1, 0, "",
	"Object to remove",
	0, "*",
	PROP_POINTER, PROP_NONE | PROP_UNIT_NONE, NULL, 0, {0, 0, 0}, 0,
	NULL, 0, NULL, NULL,
	0, -1, NULL},
	NULL, NULL, NULL, NULL,&RNA_Object
};

FunctionRNA rna_GroupObjects_unlink_func = {
	{NULL, (FunctionRNA *)&rna_GroupObjects_link_func,
	NULL,
	{(PropertyRNA *)&rna_GroupObjects_unlink_object, (PropertyRNA *)&rna_GroupObjects_unlink_object}},
	"unlink", 24, "Remove this object to a group",
	GroupObjects_unlink_call,
	NULL
};

StructRNA RNA_GroupObjects = {
	{(ContainerRNA *)&RNA_RenderSlot, (ContainerRNA *)&RNA_Group,
	NULL,
	{(PropertyRNA *)&rna_GroupObjects_rna_properties, (PropertyRNA *)&rna_GroupObjects_rna_type}},
	"GroupObjects", NULL, NULL, 4, "Group Objects",
	"Collection of group objects",
	"*", 17,
	NULL, (PropertyRNA *)&rna_GroupObjects_rna_properties,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	{(FunctionRNA *)&rna_GroupObjects_link_func, (FunctionRNA *)&rna_GroupObjects_unlink_func}
};

