static StructRNA *rna_Curve_refine(PointerRNA *ptr) { Curve *cu= (Curve*)ptr->data; short obtype= curve_type(cu); if(obtype == OB_FONT) return &RNA_TextCurve; else if(obtype == OB_SURF) return &RNA_SurfaceCurve; else return &RNA_Curve; }
Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, const char *name, ID *data) { Object *ob; int type= OB_EMPTY; if(data) { switch(GS(data->name)) { case ID_ME: type= OB_MESH; break; case ID_CU: type= curve_type((struct Curve *)data); break; case ID_MB: type= OB_MBALL; break; case ID_LA: type= OB_LAMP; break; case ID_SPK: type= OB_SPEAKER; break; case ID_CA: type= OB_CAMERA; break; case ID_LT: type= OB_LATTICE; break; case ID_AR: type= OB_ARMATURE; break; default: { const char *idname; if(RNA_enum_id_from_value(id_type_items, GS(data->name), &idname) == 0) idname= "UNKNOWN"; BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for a object.", idname); return NULL; } } id_us_plus(data); } ob= add_only_object(type, name); id_us_min(&ob->id); ob->data= data; test_object_materials(ob->data); return ob; }
std::vector<uint8_t> EC_Group::DER_encode(EC_Group_Encoding form) const { if(form == EC_DOMPAR_ENC_EXPLICIT) { const size_t ecpVers1 = 1; OID curve_type("1.2.840.10045.1.1"); const size_t p_bytes = m_curve.get_p().bytes(); return DER_Encoder() .start_cons(SEQUENCE) .encode(ecpVers1) .start_cons(SEQUENCE) .encode(curve_type) .encode(m_curve.get_p()) .end_cons() .start_cons(SEQUENCE) .encode(BigInt::encode_1363(m_curve.get_a(), p_bytes), OCTET_STRING) .encode(BigInt::encode_1363(m_curve.get_b(), p_bytes), OCTET_STRING) .end_cons() .encode(EC2OSP(m_base_point, PointGFp::UNCOMPRESSED), OCTET_STRING) .encode(m_order) .encode(m_cofactor) .end_cons() .get_contents_unlocked(); } else if(form == EC_DOMPAR_ENC_OID) return DER_Encoder().encode(OID(get_oid())).get_contents_unlocked(); else if(form == EC_DOMPAR_ENC_IMPLICITCA) return DER_Encoder().encode_null().get_contents_unlocked(); else throw Internal_Error("EC_Group::DER_encode: Unknown encoding"); }