Alembic 파일 형식 소개 - 아이디어 및 아이디어 4

8323 단어

Simple Property 드릴다운


컨테이너 계층 관계에 유의하십시오. Simple Property는 Sample을 포함합니다.Sample에는 데이터가 포함되어 있습니다.대부분의 경우, Sample과 데이터는 하나의 것으로 간주할 수 있으며, 대부분의 클라이언트 코드는 같은 방식으로property를 만들고 조종한다.Google은 형상이 아닌 데이터를 중심으로 Abc를 처리할 것입니다.그런 다음 AbcGeom 레이어에서 Abc 레이어의 Property를 사용하여 형상 데이터를 구축하는 방법에 대해 설명합니다.
OScalarProperties
먼저, "O"가 시작되고 쓰여진 API를 살펴보겠습니다.Abc층에서 Simple Property는 Scalar와 Array와 같은 유형과 무유형으로 한층 더 나뉘어진다.유형이 없는 OScalar Properties는lib/Alembic/Abc/OScalar Property에 있습니다.h에서 정의한 유형이 있는 OTypedScalrProperty와 가장 큰 차이점은 그들이 void* 형식의 데이터를 수신하고 AbcA::DataType의 실례로 구성해야 한다는 것이다. 이것은 견본의 기하학적 크기와 유형을 설명하는 클래스이다.따라서 Alembic은 리소스를 정확하게 추적할 수 있습니다.OTyped Scalar Property는 다른 한편, 그에게 전송된 데이터의 크기와 유형을 추측할 수 있다. 왜냐하면 그는 자신이 어떤 유형의 데이터를 지원하는지 알고 있기 때문이다.대부분의 클라이언트는 유형의 데이터를 처리합니다. OTyped Scalar Property는 OScalar Property이기 때문에 일부 방법과 OTyped Scalar Property의 구성원은 모두 부류에서 왔습니다.이 장은 OtypedScalarProperties에 중점을 두고 있습니다.
OTypedScalarProperty의 구성 과정을 살펴보십시오. 주요 절차는 다음과 같습니다.
    //! Create a new TypedScalarProperty
    //! as a child of the passed COMPOUND_PTR
    //! Arguments can specify metadata, timesampling, and error handling.
    template
    OTypedScalarProperty(
         COMPOUND_PTR iParent,
         const std::string&iName,

         constArgument&iArg0 =Argument(),
         constArgument&iArg1 =Argument(),
         constArgument&iArg2 =Argument());

템플릿 매개 변수, COMPOUNDPTR,AbcA::CompoundPropertyWritePtr(침입변환은 "has-a"또는 "is-a"CompoundPropertyWriterPtr 는 상속 유형에서 추출하거나 상속 클래스에서 변환할 수 있습니다.마지막 세 가지 선택할 수 있는 매개 변수는 Abc:::Arguments는boost::variants입니다. 하나의 union 유형의 클래스입니다. 간단하게 설명하지만 어떤 종류의 단서를 전달해야 하는지 알려 줍니다.매개 변수는 여러 종류이기 때문에, 너는 많이 전달할 수도 있고, 적게 전달할 수도 있기 때문에, 호출의 위치를 걱정할 필요가 없다.
만약 앞의 것을 이해하지 못하면 조급해하지 마라. 많은 Alembic의 내용은 그 의미가 명확하지 않으니 이를 분해해라.
  • 필수 매개 변수, iParent,property의 부 노드입니다. 클라이언트 구조의Alembic 인터페이스는 등급에 따라야 하지만 Archive는 포함되지 않습니다.
  • Simple property의 부모 노드는 반드시Compound Property입니다.
  • 두 번째 매개변수는 이름이며 해당 레이어에서 고유해야 합니다.
  • 단순 property를 구성할 때 선택할 수 있는 매개 변수인 Time Sampling의 예가 있습니다.
  • Abc의 유형은 대상을 바탕으로 하는 봉인기이고 AbcCore Abstract의 더 낮은 기하학적 유형을 봉인한다. 각 OcompoundProperty에는 AbcA::CompoundPropertyWriterPtr가 있다.

  • 이것들은 Simple Property에 대한 전체적인 사상이고 구체적인 것도 많다. Simple Property가 아니라 Alembic를 하나의 전체로 하는 것이다.
  • 접두사'Ptr'는 AbcA::CompoundPropertyWriterPtr에 있는 것처럼 그 유형은boost::shared 이다pro의 바늘은 앞의 실례를 가리킨다(앞의 예는 바로 AbcA::CompoundPropertyWriter).
  • Alembic의 실체는 MetaData로 구축할 수 있다. 예를 들어 AbcA::MetaData의 실례로 그것은string,string의 키워드인 값의 해시 표이다.

  • 실제로, 쓰는Simple Property는 OScalar Properties뿐만 아니라, 모두 Abc:::Ocompound Property가 있습니다.
    어쨌든 OScalar Properities에서 주제에서 벗어나 본론으로 돌아왔다.lib/Alembic/Abc/OTypedScalarProperty를 보시면h, 파일 맨 뒤에 많은 typedef가 템플릿화된 OTyped Scalar Properties를 정의하여 기억하기 쉬운 이름을 가지고 있습니다.
    typedefOTypedScalarProperty         OBoolProperty;
    typedefOTypedScalarProperty           OUcharProperty;
    typedefOTypedScalarProperty            OCharProperty;
    typedefOTypedScalarProperty          OUInt16Property;
    typedefOTypedScalarProperty           OInt16Property;
    typedefOTypedScalarProperty          OUInt32Property;
    typedefOTypedScalarProperty           OInt32Property;
    typedefOTypedScalarProperty          OUInt64Property;
    typedefOTypedScalarProperty           OInt64Property;
    typedefOTypedScalarProperty         OHalfProperty;
    typedefOTypedScalarProperty         OFloatProperty;
    typedefOTypedScalarProperty         ODoubleProperty;
    typedefOTypedScalarProperty          OStringProperty;
    typedefOTypedScalarProperty         OWstringProperty;
    

    템플릿 매개 변수, 각종'TPTraints'는 STL의traints와 대응하고 특수점은 각property가 몇 바이트를 차지하는지도 있다.이것들의traits는lib/Alembic/Abc/TypedPropertyTraits에 있습니다.h에서 한 번 보고 싶다면.OTyped Scalar Property를 구성할 때 다음과 같이 합니다.
    OTypedScalarProperty myProp( parent,“this_is_the_property_name”);
    

    대신, 당신은 그 중의dypedef 이름을 호출할 것입니다. 예를 들어
    ODoubleProperty myDoubleProp( parent,“this_is_the_property_name”);
    

    모든 Alembic은 64비트의 부동 소수점 수를 저장한다는 것을 알고 있습니다.
    property에 저장된 값을 말하자면 set () 방법이 있습니다. 서명된 것은 다음과 같습니다:voidset (constvalue type & iVal)
    매개변수 유형 선언,valuetype, OTypedScalarProperty.h의 상단 정의와property에 대한traits 템플릿을 정의합니다.ODouble Property,valuetype은 Alembic::Util::float64 입니다.t.lib/Alembic/Util/PlainOldDataType를 보십시오.h의 구체적인 유형.주어진 일을 되돌려줍니다:Property에 값을 저장합니다.예를 들어 ODouble Property를 구성하면'my Double Property'는 위에서 보여준 것과 같다.TimeSampling 인스턴스로 구성되지 않기 때문에 기본 TimeSampling을 사용하고 데이터가 0.0부터 시작되면 앞의 샘플보다 1.0chrono 더 많다고 가정합니다.ts. 다음 코드는 myDoubleProp에 10개의 견본을 설정합니다.
    for( size_t i =0; i <10;++i )
    {
       myDoubleProp.set(2.0* i );
    }
    

    이제 myDouble Prop를 호출합니다.getNumSamples(), 10. 반환0번째 샘플은 0.0이고 첫 번째는 2.0이며 두 번째는 4.0이다.다음 소프트웨어 목록에서 컴파일을 실행하면 Alembic의 Archive가 다음과 같이 설명된 Simple Property로 생성됩니다.
    #include
    // the following include is for the concrete implementation of Alembic
    #include
    
    usingnamespaceAlembic::Abc;
    
    int main(int,char**)
    {
       OArchive archive(Alembic::AbcCoreHDF5::WriteArchive(),“myFirstArchive.abc”);
       OObject child( archive.getTop(),“childObject”);
       ODoubleProperty myDoubleProp( child.getProperties(),“doubleProp”);
       for( size_t i =0; i <10;++i )
       {
           myDoubleProp.set(2.0* i );
       }
       return0;
    }
    

    다다야, 상당히 간단하지 않니?물론, 그건 HDF5의 일이야, archive.getTop().getProperties (), 다음에 더 잘 설명합니다.get Properties () 는 Abc::Ocompound Property로 돌아가는 방법이지만, 당신이 옳을 수도 있습니다.그 방법의 전체 이름은 Abc: OObject::get Properties () 입니다. 이것도 맞힐 수 있습니다. 정확한 것은 Abc:::OArchive::::get Top () 이 Abc::OObject로 되돌아옵니다.다시 한 번 OScalar Properites 화제를 벗어났고 getTop () 과 getProperties () 의 화제를 되돌려줍니다.
    코드처럼 간단하다. 대답보다 질문을 더 많이 한다. 앞의 그림에서 암시한 질문을 제외한다.
  • 데이터가 쓰기에 적합합니까?
  • ODouble Property가 아니라면 Oreally Heavy Value Type Property가 있습니다. 예를 들어 set에 전송된 메모리 데이터를 더미에 분배하면 언제 안전하게 방출할 수 있습니까?이것들은 모두 좋은 문제들이다.

  • 코드에 뚜렷한 자원 관리가 없다는 것을 알아차렸을 것이다.표준 포인터를 사용할 때 Alembic이 해줬기 때문이다.Alembic에서는 생존 기간이 지나면 데이터가 기록됩니다.따라서main이 끝나면 Archive는 자신을 하드디스크에 기록하고 Archive의 맨 윗부분은 같은 일을 하며 맨 윗부분의Compoundproperty는 따라가고 마지막은compoundproperty의simpleproperty(doubleProp로 하드디스크에 쓰기).abcecho 프로그램을 사용하여 examples/bin/AbcEcho/AbcEcho.cpp, 당신은 결과를 보게 될 것입니다. Archive에는 단순한 Propety가 있습니다. 당신이 기대했던 것처럼:
    $ abcecho myFirstArchive.abc
    Object name=/childObject
       ScalarProperty name=doubleProp;interpretation=;datatype=float64_t;numsamps=10
    $
    

    두 번째 질문처럼 언제 자원을 안전하게 방출할 수 있습니까?정답은 set () 함수를 호출하면 Alembic이 데이터를 가지고 있으면 안전하게 방출할 수 있다는 것이다.이것은 Alembic의 모든properties(scalar, Array)에 유용하며 AbcGeom의 상위 형상 유형에도 적용됩니다.
    이 점에서 쓰기에서 분리하는 것이 좋다. 원본 코드를 write/read 예로 확장해서 생존 범위의 작업 메커니즘을 보여주는 것은 API의 대칭성과 비슷하다.
    #include
    #include
    #include
    
    usingnamespaceAlembic::Abc;
    
    int main(int,char**)
    {
       std::string archiveName(“myFirstArchive.abc”);
       {// open new scope for writing
           OArchive archive(Alembic::AbcCoreHDF5::WriteArchive(),
                             archiveName );
           OObject child( archive.getTop(),“childObject”);
           ODoubleProperty myDoubleProp( child.getProperties(),“doubleProp”);
           for( std::size_t i =0; i <10;++i )
           {
               myDoubleProp.set(2.0* i );
           }
       }// the Archive is written here when it goes out of scope
    
       {// open new scope for reading
           IArchive archive(Alembic::AbcCoreHDF5::ReadArchive(),
                             archiveName );
           IObject child( archive.getTop(),“childObject”);
           IDoubleProperty myDoubleProp( child.getProperties(),“doubleProp”);
           for( std::size_t i =0; i < myDoubleProp.getNumSamples();++i )
           {
               std::cout << i <

    좋은 웹페이지 즐겨찾기