Пример #1
0
/* settings for 'single property' driver variable type */
static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVar *dvar)
{
	DriverTarget *dtar = &dvar->targets[0];
	PointerRNA dtar_ptr;
	uiLayout *row, *col;
	
	/* initialize RNA pointer to the target */
	RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); 
	
	/* Target ID */
	row = uiLayoutRow(layout, false);
	uiLayoutSetRedAlert(row, ((dtar->flag & DTAR_FLAG_INVALID) && !dtar->id));
	uiTemplateAnyID(row, &dtar_ptr, "id", "id_type", IFACE_("Prop:"));
	
	/* Target Property */
	if (dtar->id) {
		PointerRNA root_ptr;
		
		/* get pointer for resolving the property selected */
		RNA_id_pointer_create(dtar->id, &root_ptr);
		
		/* rna path */
		col = uiLayoutColumn(layout, true);
		uiLayoutSetRedAlert(col, (dtar->flag & DTAR_FLAG_INVALID));
		uiTemplatePathBuilder(col, &dtar_ptr, "data_path", &root_ptr, IFACE_("Path"));
	}
}
Пример #2
0
/* settings for 'transform channel' driver variable type */
static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar *dvar)
{
	DriverTarget *dtar = &dvar->targets[0];
	Object *ob = (Object *)dtar->id;
	PointerRNA dtar_ptr;
	uiLayout *col, *sub;
	
	/* initialize RNA pointer to the target */
	RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); 
	
	/* properties */
	col = uiLayoutColumn(layout, true);
	uiLayoutSetRedAlert(col, (dtar->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */
	uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Ob/Bone:"));
		
	if (dtar->id && GS(dtar->id->name) == ID_OB && ob->pose) {
		PointerRNA tar_ptr;
		
		RNA_pointer_create(dtar->id, &RNA_Pose, ob->pose, &tar_ptr);
		uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
	}
		
	sub = uiLayoutColumn(layout, true);
	uiItemR(sub, &dtar_ptr, "transform_type", 0, NULL, ICON_NONE);
	uiItemR(sub, &dtar_ptr, "transform_space", 0, IFACE_("Space"), ICON_NONE);
}
Пример #3
0
/* settings for 'location difference' driver variable type */
static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *dvar)
{
	DriverTarget *dtar  = &dvar->targets[0];
	DriverTarget *dtar2 = &dvar->targets[1];
	Object *ob1 = (Object *)dtar->id;
	Object *ob2 = (Object *)dtar2->id;
	PointerRNA dtar_ptr, dtar2_ptr;
	uiLayout *col;
	
	/* initialize RNA pointer to the target */
	RNA_pointer_create(id, &RNA_DriverTarget, dtar,  &dtar_ptr); 
	RNA_pointer_create(id, &RNA_DriverTarget, dtar2, &dtar2_ptr); 
	
	/* Bone 1 */
	col = uiLayoutColumn(layout, true);
	uiLayoutSetRedAlert(col, (dtar->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */
	uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Ob/Bone 1:"));
		
	if (dtar->id && GS(dtar->id->name) == ID_OB && ob1->pose) {
		PointerRNA tar_ptr;
		
		RNA_pointer_create(dtar->id, &RNA_Pose, ob1->pose, &tar_ptr);
		uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
	}
	
	uiLayoutSetRedAlert(col, false); /* we can clear it again now - it's only needed when creating the ID/Bone fields */
	uiItemR(col, &dtar_ptr, "transform_space", 0, NULL, ICON_NONE);
	
	col = uiLayoutColumn(layout, true);
	uiLayoutSetRedAlert(col, (dtar2->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */
	uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", IFACE_("Ob/Bone 2:"));
		
	if (dtar2->id && GS(dtar2->id->name) == ID_OB && ob2->pose) {
		PointerRNA tar_ptr;
		
		RNA_pointer_create(dtar2->id, &RNA_Pose, ob2->pose, &tar_ptr);
		uiItemPointerR(col, &dtar2_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
	}
		
	uiLayoutSetRedAlert(col, false); /* we can clear it again now - it's only needed when creating the ID/Bone fields */
	uiItemR(col, &dtar2_ptr, "transform_space", 0, NULL, ICON_NONE);
}
Пример #4
0
/* settings for 'rotation difference' driver variable type */
static void graph_panel_driverVar__rotDiff(uiLayout *layout, ID *id, DriverVar *dvar)
{
	DriverTarget *dtar = &dvar->targets[0];
	DriverTarget *dtar2 = &dvar->targets[1];
	Object *ob1 = (Object *)dtar->id;
	Object *ob2 = (Object *)dtar2->id;
	PointerRNA dtar_ptr, dtar2_ptr;
	uiLayout *col;
	
	/* initialize RNA pointer to the target */
	RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); 
	RNA_pointer_create(id, &RNA_DriverTarget, dtar2, &dtar2_ptr); 
	
	/* Bone 1 */
	col = uiLayoutColumn(layout, true);
	uiLayoutSetRedAlert(col, (dtar->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */
	uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Bone 1:"));
	
	if (dtar->id && GS(dtar->id->name) == ID_OB && ob1->pose) {
		PointerRNA tar_ptr;
		
		RNA_pointer_create(dtar->id, &RNA_Pose, ob1->pose, &tar_ptr);
		uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
	}
	
	col = uiLayoutColumn(layout, true);
	uiLayoutSetRedAlert(col, (dtar2->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */
	uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", IFACE_("Bone 2:"));
		
	if (dtar2->id && GS(dtar2->id->name) == ID_OB && ob2->pose) {
		PointerRNA tar_ptr;
		
		RNA_pointer_create(dtar2->id, &RNA_Pose, ob2->pose, &tar_ptr);
		uiItemPointerR(col, &dtar2_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
	}
}
Пример #5
0
static void rna_UILayout_red_alert_set(PointerRNA *ptr, bool value)
{
	uiLayoutSetRedAlert(ptr->data, value);
}