Esempio n. 1
0
// is an element of a specified type? it does include inheritance inspection
GBool GElement::IsOfType(const GClassID& Class_ID) const {

	// trivial case
	if ((Class_ID == ClassID()) || (Class_ID == DerivedClassID()))
		return G_TRUE;
	return IsTypeOfType(ClassID(), Class_ID);
}
Esempio n. 2
0
void STARTUP_pore() {
  GenesisObject* object;
  GenesisObject  tobject;
  char*          slotnames[50];
  char*          argv[50];

  /* Definition of object Napores */
  BZERO(&tobject,sizeof(GenesisObject));
  tobject.name = "Napores";
  tobject.type = "Na_pore_type";
  tobject.size = sizeof(struct Na_pore_type);
  { extern int NaPorePop(); tobject.function = NaPorePop; HashFunc("NaPorePop", NaPorePop, "int"); }
  ObjectAddClass(&tobject,ClassID("segment"),CLASS_PERMANENT);
  AddDefaultFieldList(&tobject);
  tobject.defaults = (Element*) calloc(1, tobject.size);
  AddObject(&tobject);
  object = GetObject("Napores");
  object->defaults->object = object;
  object->defaults->name = CopyString("Napores");
  { extern int NaPorePop(); AddActionToObject(object, "INIT", NaPorePop, 0) ? 0 : (Error(), printf("adding action 'INIT' to object 'Napores'\n")); HashFunc("NaPorePop", NaPorePop, "int"); }
  { extern int NaPorePop(); AddActionToObject(object, "PROCESS", NaPorePop, 0) ? 0 : (Error(), printf("adding action 'PROCESS' to object 'Napores'\n")); HashFunc("NaPorePop", NaPorePop, "int"); }
  { extern int NaPorePop(); AddActionToObject(object, "RESET", NaPorePop, 0) ? 0 : (Error(), printf("adding action 'RESET' to object 'Napores'\n")); HashFunc("NaPorePop", NaPorePop, "int"); }
  { extern int NaPorePop(); AddActionToObject(object, "CHECK", NaPorePop, 0) ? 0 : (Error(), printf("adding action 'CHECK' to object 'Napores'\n")); HashFunc("NaPorePop", NaPorePop, "int"); }
  slotnames[0] = "Vm";
  MsgListAdd(object, "VOLTAGE", Napores_VOLTAGE, slotnames, 1);
  object->author = "Adam Strassberg";
  object->description = "Sodium pore population represented through eight state Markov kinetic scheme (see Strassberg and DeFelice, 1992).\n";
  FieldListMakePermanent(object);
  MsgListMakePermanent(object);

  /* Definition of object Kpores */
  BZERO(&tobject,sizeof(GenesisObject));
  tobject.name = "Kpores";
  tobject.type = "K_pore_type";
  tobject.size = sizeof(struct K_pore_type);
  { extern int KPorePop(); tobject.function = KPorePop; HashFunc("KPorePop", KPorePop, "int"); }
  ObjectAddClass(&tobject,ClassID("segment"),CLASS_PERMANENT);
  AddDefaultFieldList(&tobject);
  tobject.defaults = (Element*) calloc(1, tobject.size);
  AddObject(&tobject);
  object = GetObject("Kpores");
  object->defaults->object = object;
  object->defaults->name = CopyString("Kpores");
  { extern int KPorePop(); AddActionToObject(object, "INIT", KPorePop, 0) ? 0 : (Error(), printf("adding action 'INIT' to object 'Kpores'\n")); HashFunc("KPorePop", KPorePop, "int"); }
  { extern int KPorePop(); AddActionToObject(object, "PROCESS", KPorePop, 0) ? 0 : (Error(), printf("adding action 'PROCESS' to object 'Kpores'\n")); HashFunc("KPorePop", KPorePop, "int"); }
  { extern int KPorePop(); AddActionToObject(object, "RESET", KPorePop, 0) ? 0 : (Error(), printf("adding action 'RESET' to object 'Kpores'\n")); HashFunc("KPorePop", KPorePop, "int"); }
  { extern int KPorePop(); AddActionToObject(object, "CHECK", KPorePop, 0) ? 0 : (Error(), printf("adding action 'CHECK' to object 'Kpores'\n")); HashFunc("KPorePop", KPorePop, "int"); }
  slotnames[0] = "Vm";
  MsgListAdd(object, "VOLTAGE", Kpores_VOLTAGE, slotnames, 1);
  object->author = "Adam Strassberg";
  object->description = "Potassium pore population represented through five state Markov kinetic scheme (see Strassberg and DeFelice, 1992).\n";
  FieldListMakePermanent(object);
  MsgListMakePermanent(object);

/* Script variables */

} /* STARTUP_pore */
Esempio n. 3
0
//SETUPPROPERTIES
// Tests if IPB2 pointers are healthy and sets up the MaxNode Data
bool plArmatureComponent::SetupProperties(plMaxNode* node, plErrorMsg* pErrMsg)
{
    // Global issues
    node->SetMovable(true);
    node->SetForceLocal(true);

#ifndef BOB_SORT_AVATAR_FACES
    ISetupAvatarRenderPropsRecurse(node);
#endif


//  float mass, friction, restitution;
//  if(ClassID() == AVATAR_CLASS_ID || ClassID() == LOD_AVATAR_CLASS_ID)
//  {
//      mass = 12;  // *** good number from old physical player
//      restitution = 0.5f;
//      friction = 0.1f;
//  }
    plMaxNode *animRoot = nil;

    if(ClassID() == AVATAR_CLASS_ID)
        animRoot = (plMaxNode *)fCompPB->GetINode(plAvatarComponent::kRootNode);
    else if (ClassID() == LOD_AVATAR_CLASS_ID)
        animRoot = (plMaxNode *)fCompPB->GetINode(plLODAvatarComponent::kRootNodeAddBtn);

    if(animRoot)
    {
        const char *nodeName = animRoot->GetName();
        animRoot->SetDrawable(false);       // make sure our root bone is invisible
    }

    // Ignore all of the old physicals, so old scenes can export
    if (ClassID() == AVATAR_CLASS_ID || ClassID() == LOD_AVATAR_CLASS_ID)
    {
        bool isLOD = ((ClassID() == LOD_AVATAR_CLASS_ID) != 0);

        plMaxNode* ignoreNode = (plMaxNode*)fCompPB->GetINode(isLOD ? plLODAvatarComponent::kPhysicsProxyFeet_DEAD : plAvatarComponent::kPhysicsProxyFeet_DEAD);
        if (ignoreNode)
            ignoreNode->SetCanConvert(false);

        ignoreNode = (plMaxNode*)fCompPB->GetINode(isLOD ? plLODAvatarComponent::kPhysicsProxyTorso_DEAD : plAvatarComponent::kPhysicsProxyTorso_DEAD);
        if (ignoreNode)
            ignoreNode->SetCanConvert(false);

        ignoreNode = (plMaxNode*)fCompPB->GetINode(isLOD ? plLODAvatarComponent::kPhysicsProxyHead_DEAD : plAvatarComponent::kPhysicsProxyHead_DEAD);
        if (ignoreNode)
            ignoreNode->SetCanConvert(false);
    }

    return true;
}
Esempio n. 4
0
/*!
	\param Class_Name a string containing the class name that we wanna know the descriptor of
	\param OutID a class descriptor that will be returned in case of successful operation.
	\return If operation will succeed G_NO_ERROR constant, else an error code.
	\note Class name comparison is case-insensitive.\n
	A return value of G_UNSUPPORTED_CLASSID means that specified Class_Name does not correspond to any
	registered proxies, so the class descriptor cannot be "resolved".
*/
GError GElement::ClassIDFromClassName(const GString& Class_Name, GClassID& OutID) const {

	// first lets see if class name match my class name
	if (StrUtils::SameText(Class_Name, ClassID().IDName())) {
		OutID = ClassID();
		return G_NO_ERROR;
	}
	// now try with owner
	if (gOwner) {
		G_ASSERT(gOwner->IsOfType(G_KERNEL_CLASSID) == G_TRUE);
		GKernel *kernel = (GKernel *)gOwner;
		return kernel->ClassIDFromClassName(Class_Name, OutID);
	}
	return G_UNSUPPORTED_CLASSID;
}
Esempio n. 5
0
GrFillRRectOp::GrFillRRectOp(
        GrAAType aaType, const SkRRect& rrect, Flags flags,
        const SkMatrix& totalShapeMatrix, GrPaint&& paint, const SkRect& devBounds)
        : GrDrawOp(ClassID())
        , fAAType(aaType)
        , fOriginalColor(paint.getColor4f())
        , fLocalRect(rrect.rect())
        , fFlags(flags)
        , fProcessors(std::move(paint)) {
    SkASSERT((fFlags & Flags::kHasPerspective) == totalShapeMatrix.hasPerspective());
    this->setBounds(devBounds, GrOp::HasAABloat::kYes, GrOp::IsZeroArea::kNo);

    // Write the matrix attribs.
    const SkMatrix& m = totalShapeMatrix;
    if (!(fFlags & Flags::kHasPerspective)) {
        // Affine 2D transformation (float2x2 plus float2 translate).
        SkASSERT(!m.hasPerspective());
        this->writeInstanceData(m.getScaleX(), m.getSkewX(), m.getSkewY(), m.getScaleY());
        this->writeInstanceData(m.getTranslateX(), m.getTranslateY());
    } else {
        // Perspective float3x3 transformation matrix.
        SkASSERT(m.hasPerspective());
        m.get9(this->appendInstanceData<float>(9));
    }

    // Convert the radii to [-1, -1, +1, +1] space and write their attribs.
    Sk4f radiiX, radiiY;
    Sk4f::Load2(SkRRectPriv::GetRadiiArray(rrect), &radiiX, &radiiY);
    (radiiX * (2/rrect.width())).store(this->appendInstanceData<float>(4));
    (radiiY * (2/rrect.height())).store(this->appendInstanceData<float>(4));

    // We will write the color and local rect attribs during finalize().
}
Esempio n. 6
0
        Op(GrRecordingContext* ctx, GrProxyProvider* proxyProvider,
           LazyProxyTest* test, bool nullTexture)
                    : GrDrawOp(ClassID()), fTest(test) {
            const GrBackendFormat format =
                    ctx->priv().caps()->getBackendFormatFromColorType(kRGB_565_SkColorType);
            fProxy = GrProxyProvider::MakeFullyLazyProxy(
                    [this, nullTexture](
                            GrResourceProvider* rp) -> GrSurfaceProxy::LazyInstantiationResult {
                        REPORTER_ASSERT(fTest->fReporter, !fTest->fHasOpTexture);
                        fTest->fHasOpTexture = true;
                        if (nullTexture) {
                            return {};
                        } else {
                            GrSurfaceDesc desc;
                            desc.fWidth = 1234;
                            desc.fHeight = 567;
                            desc.fConfig = kRGB_565_GrPixelConfig;
                            sk_sp<GrTexture> texture = rp->createTexture(
                                desc, SkBudgeted::kYes, GrResourceProvider::Flags::kNoPendingIO);
                            REPORTER_ASSERT(fTest->fReporter, texture);
                            return std::move(texture);
                        }
                    },
                    format, GrProxyProvider::Renderable::kNo, kTopLeft_GrSurfaceOrigin,
                    kRGB_565_GrPixelConfig, *proxyProvider->caps());

            this->setBounds(SkRectPriv::MakeLargest(), GrOp::HasAABloat::kNo,
                            GrOp::IsZeroArea::kNo);
        }
Esempio n. 7
0
GrDrawPathRangeBatch::GrDrawPathRangeBatch(const SkMatrix& viewMatrix, const SkMatrix& localMatrix,
                                           GrColor color, GrPathRange* range, GrPathRangeDraw* draw)
    : INHERITED(ClassID(), viewMatrix, color)
    , fPathRange(range)
    , fDraws(4)
    , fLocalMatrix(localMatrix) {
    SkDEBUGCODE(draw->fUsedInBatch = true;)
Esempio n. 8
0
    PLSPathBatch(const Geometry& geometry) : INHERITED(ClassID()) {
        fGeoData.push_back(geometry);

        // compute bounds
        fBounds = geometry.fPath.getBounds();
        geometry.fViewMatrix.mapRect(&fBounds);
    }
        DEFINE_OP_CLASS_ID

        Op(GrProxyProvider* proxyProvider, LazyProxyTest* test, bool nullTexture)
                    : GrDrawOp(ClassID()), fTest(test) {
            fProxy = proxyProvider->createFullyLazyProxy([this, nullTexture](
                                        GrResourceProvider* rp) {
                if (!rp) {
                    return sk_sp<GrTexture>();
                }
                REPORTER_ASSERT(fTest->fReporter, !fTest->fHasOpTexture);
                fTest->fHasOpTexture = true;
                if (nullTexture) {
                    return sk_sp<GrTexture>();
                } else {
                    GrSurfaceDesc desc;
                    desc.fWidth = 1234;
                    desc.fHeight = 567;
                    desc.fOrigin = kTopLeft_GrSurfaceOrigin;
                    desc.fConfig = kRGB_565_GrPixelConfig;
                    sk_sp<GrTexture> texture = rp->createTexture(desc, SkBudgeted::kYes);
                    REPORTER_ASSERT(fTest->fReporter, texture);
                    return texture;
                }
            }, GrProxyProvider::Renderable::kNo, kTopLeft_GrSurfaceOrigin, kRGB_565_GrPixelConfig);
            this->setBounds(SkRectPriv::MakeLargest(), GrOp::HasAABloat::kNo, GrOp::IsZeroArea::kNo);
        }
void OrientConstRotation::Copy(Control *from)
{
	if(GetLocked()==false)
	{
	Quat fvalRot;
	if (from->ClassID()==ClassID()) {
		OrientConstRotation *ctrl = (OrientConstRotation*)from;
		// a copy will construct its own pblock to keep the pblock-to-owner 1-to-1.
		ReplaceReference(ORIENT_ROT_PBLOCK_REF, CloneRefHierarchy(ctrl->pblock));
		curRot   =			ctrl->curRot;
		baseRotQuatLocal =  ctrl->baseRotQuatLocal;
		baseRotQuatWorld =  ctrl->baseRotQuatWorld;
		flags    = ctrl->flags;
		mLocked = ctrl->mLocked;
	} else {
		if(from&&GetLockedTrackInterface(from))
		  mLocked = GetLockedTrackInterface(from)->GetLocked();
		from->GetValue(GetCOREInterface()->GetTime(), &fvalRot, Interval(0, 0));	// to know the object orientation before the
		firstTimeFlag = 1;
		baseRotQuatLocal = fvalRot;
		baseRotQuatLocal.Normalize(); // current controller was active
		}
	ivalid.SetEmpty();
	NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE);
	}
}
    DEFINE_OP_CLASS_ID

    GrPipelineDynamicStateTestOp(ScissorState scissorState, sk_sp<const GrBuffer> vbuff)
        : INHERITED(ClassID())
        , fScissorState(scissorState)
        , fVertexBuffer(std::move(vbuff)) {
        this->setBounds(SkRect::MakeIWH(kScreenSize, kScreenSize),
                        HasAABloat::kNo, IsZeroArea::kNo);
    }
Esempio n. 12
0
// this is a little gross...the armature component shouldn't know that the subclasses
// actually exist....it's a hard-to-detect implementation detail that breaks new subclasses....
bool plArmatureComponent::Convert(plMaxNode* node, plErrorMsg *pErrMsg)
{
//  plHKPhysical *physical = plHKPhysical::ConvertToPhysical(node->GetSceneObject());
 // physical->SetProperty(plSimulationInterface::kUpright, true);

    IAttachModifiers(node, pErrMsg);
    ISetupClothes(node, fArmMod, pErrMsg);

    // ArmatureEffects
    plArmatureEffectsMgr *effects = new plArmatureEffectsMgr();
    hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), effects, node->GetLocation());
    plGenRefMsg *msg = new plGenRefMsg(fArmMod->GetKey(), plRefMsg::kOnCreate, -1, -1);
    hsgResMgr::ResMgr()->AddViaNotify(effects->GetKey(), msg, plRefFlags::kActiveRef); // Attach effects

    plSceneObject *obj = node->GetSceneObject();
    node->MakeCharacterHierarchy(pErrMsg);

    const plAGModifier *temp = static_cast<const plAGModifier *>(FindModifierByClass(obj, plAGModifier::Index()));
    plAGModifier *agMod = const_cast<plAGModifier *>(temp);

    hsAssert(agMod, "Armature root didn't get a agmod. I'll make one for you.");
    if( ! agMod)
    {
        // MakeCharacterHierarchy will attach agmodifiers to all the bones in the hierarchy;
        // have to manually add any for non-bone objects...
        agMod = new plAGModifier("Handle");     // the player root is known as the handle
        node->AddModifier(agMod, IGetUniqueName(node));
    }

    agMod->SetChannelName("Handle");

    // Get the position and radius of the head and torso physicals
    if (ClassID() == AVATAR_CLASS_ID || ClassID() == LOD_AVATAR_CLASS_ID)
    {
        bool isLOD = ((ClassID() == LOD_AVATAR_CLASS_ID) != 0);
        float height = fCompPB->GetFloat(isLOD ? plLODAvatarComponent::kPhysicsHeight : plAvatarComponent::kPhysicsHeight);
        float width = fCompPB->GetFloat(isLOD ? plLODAvatarComponent::kPhysicsWidth : plAvatarComponent::kPhysicsWidth);
        fArmMod->SetPhysicalDims(height, width);
    }

//  node->SetupBonesAliasesRecur(node->GetKey()->GetName());

    return true;
}
Esempio n. 13
0
 static std::string Help() {
   return ClassID() + "\n"
 "Output scatter data which emits all superfluous points.  These points   \n"
 "are defined by all points where, if emitted, a line graph would remain  \n"
 "unchanged.  In practice, this routine will determine if points lie along\n"
 " a minimum angle, which is passed as an argument.                       \n"
 "OPTIONS                                                                 \n"
 "   MinAngle=double;  # Threshold angle for point to be printed          \n"
 ;
 };
Esempio n. 14
0
    static std::string Help() {
      return ClassID()+"\n"
	"Generates a separate file each time AppendToFileImpl is called,\n"
	"and outputs x_i and y_i as two columns in to each file. \n"
	"The i-th data-point is omitted if the angle calculated between \n"
	"the line-segment connecting and the i-th and (i+1)-st gridpoint \n"
	"is less than some user-specifiable minimum angle. \n"
	"OPTIONS: \n"
	" MinAngle = double\n";
    };
Esempio n. 15
0
 DEFINE_BATCH_CLASS_ID
 PLSPathBatch(GrColor color, const SkPath& path, const SkMatrix& viewMatrix)
         : INHERITED(ClassID())
         , fColor(color)
         , fPath(path)
         , fViewMatrix(viewMatrix) {
     // compute bounds
     fBounds = path.getBounds();
     fViewMatrix.mapRect(&fBounds);
 }
ClassID ClassDictionary::lookup(const std::string &class_name) {
    auto it = store.find(class_name);
    if (it == store.end()) {
        // Insert the class name into the store.
        ClassID id = ClassID(uint32_t(ClassID::Named) + offset++);
        store.emplace(class_name, id);
        return id;
    } else {
        return it->second;
    }
}
Esempio n. 17
0
void EulerExposeControl::Copy(Control *from)
{
	if (from->ClassID()==ClassID())
	{
		exposeTransform = ((EulerExposeControl*)from)->exposeTransform;
		paramID = ((EulerExposeControl*)from)->paramID;
		ivalid = ((EulerExposeControl*)from)->ivalid;
		curVal = ((EulerExposeControl*)from)->curVal;
		NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE);
	}
}
Esempio n. 18
0
GrDrawPathRangeBatch::GrDrawPathRangeBatch(const SkMatrix& viewMatrix, SkScalar scale, SkScalar x,
                                           SkScalar y, GrColor color,
                                           GrPathRendering::FillType fill, GrPathRange* range,
                                           const InstanceData* instanceData, const SkRect& bounds)
    : INHERITED(ClassID(), viewMatrix, color, fill)
    , fPathRange(range)
    , fTotalPathCount(instanceData->count())
    , fScale(scale) {
    fDraws.addToHead()->set(instanceData, x, y);
    this->setBounds(bounds, HasAABloat::kNo, IsZeroArea::kNo);
}
IOResult RigidBodyWorldDesc::Save(ISave* isave)
{
	IOResult ret = ClassDesc2::Save(isave);

	ULONG retVal;
	isave->BeginChunk(USHORT (ClassID().PartB()));
	isave->Write((const char*)&m_gravity, sizeof (m_gravity), &retVal);
	isave->Write((const char*)&m_minFps, sizeof (m_minFps), &retVal);
	isave->EndChunk();

	return ret;
}
Esempio n. 20
0
bool SkeletalExporterBase::isBone(INode* node)
{
    // Root node is never a bone
    if (node->IsRootNode())
        return false;

    // Check for standard Max bone class
    auto os = node->EvalWorldState(0);
    if (os.obj->ClassID() == Class_ID(BONE_CLASS_ID, 0) || os.obj->ClassID() == Class_ID(BONE_OBJ_CLASSID) ||
        node->GetBoneNodeOnOff())
        return true;

    // Ignore dummy objects
    if (os.obj->ClassID() == Class_ID(DUMMY_CLASS_ID, 0))
        return false;

    auto c = node->GetTMController();

    // Check for Character Studio bone classes
    return c->ClassID() == BIPSLAVE_CONTROL_CLASS_ID || c->ClassID() == BIPBODY_CONTROL_CLASS_ID;
}
Esempio n. 21
0
void AudioPositionControl::Copy(Control* from)
{
	Point3 fval;

	if (from->ClassID() == ClassID()) {
		basePoint = ((AudioPositionControl*)from)->basePoint;
		targetPoint = ((AudioPositionControl*)from)->targetPoint;
	}
	else {
		from->GetValue(0, &fval, Interval(0,0));
		basePoint = fval;
		targetPoint = fval;
	}
}
Esempio n. 22
0
GBool GElement::IsTypeOfType(const GClassID& InspectedType, const GClassID& Class_ID) const {

	// trivial case
	if (Class_ID == InspectedType)
		return G_TRUE;
	// as an element, i can just say that my ClassID is of DerivedClassID type
	if ((InspectedType == ClassID()) && (Class_ID == DerivedClassID()))
		return G_TRUE;
	// try with owner
	if (gOwner)
		return gOwner->IsTypeOfType(InspectedType, Class_ID);
	// no more chances left
	return G_FALSE;
}
Esempio n. 23
0
    static std::string Help() { 
      return ClassID() +                                                  "\n"
        "Raises 1st index of a rank 2 Tensor<DataMesh>.                    \n"
	"   T^i_j = g^{ik} T_kj                                            \n"
        "OPTIONS:                                                          \n"
        "   Input       = string; # T_{kj}                                 \n"
        "   Output      = string; # T^i_j                                  \n"
	"   InvMetric   = string; # g^{ik}                                 \n"
  	"REQUIRES in DataBox:                                              \n"
        "   Tensor<DataMesh>     [Input,InvMetric]                         \n"
        "PRESENTS to the DataBox                                           \n"
        "   Tensor<DataMesh>     [Output]                                  \n"
	;
    };
 static std::string Help() {
   return ClassID()+"\n"
   "  Adds Strahlkorper Surface, Mesh, and SurfaceWithMesh \n"
   "  so that routines can have exact copies.              \n"
   "Options:                                               \n"
   "  SurfaceName = string; # name of Surface in DataBox   \n"
   "  MeshName = string; # name of Mesh in DataBox         \n"
   "  L = int; # spherical harmonic                        \n"
   "  M = int; # spherical harmonic                        \n"
   "  Radius = double; # radius of spherical surface       \n"
   "  Center = MyVector<double>; # location of center      \n"
   "                                                       \n"
   "Output quantities:                                     \n"
   "  StrahlkorperSurface [SurfaceName]                    \n"
   "  StrahlkorperMesh [MeshName]                          \n";
 };
    AADistanceFieldPathBatch(GrColor color,
                             const GrShape& shape,
                             bool antiAlias,
                             const SkMatrix& viewMatrix,
                             GrBatchAtlas* atlas,
                             ShapeCache* shapeCache, ShapeDataList* shapeList,
                             bool gammaCorrect)
            : INHERITED(ClassID()) {
        SkASSERT(shape.hasUnstyledKey());
        fBatch.fViewMatrix = viewMatrix;
        fGeoData.emplace_back(Geometry{color, shape, antiAlias});

        fAtlas = atlas;
        fShapeCache = shapeCache;
        fShapeList = shapeList;
        fGammaCorrect = gammaCorrect;

        // Compute bounds
        this->setTransformedBounds(shape.bounds(), viewMatrix, HasAABloat::kYes, IsZeroArea::kNo);
    }
Esempio n. 26
0
/*!
	If copy can't be done an error code is returned, else G_NO_ERROR.
	The copy schema is subdivided into 3 steps:

	-# If Source is the same object pointed by 'this' pointer, just exit with a G_NO_ERROR code.
	-# If Source is not of the same type of this element, use owner (kernel) to do the copy (using Copy() function).\n
	The kernel will try to do a (physical) type conversion (using registered converters plugins), and then do the
	conversion. For further details see GKernel::Copy().
	-# If Source is of the same type of this element, then it is safe to call BaseClone().

	\note If as Source parameter will be passed a 'this' reference the function just returns a G_NO_ERROR without doing
	nothing. So a call like element->CopyFrom(*element) is not dangerous.

*/
GError GElement::CopyFrom(const GElement& Source) {

	const GElement *ptr	= &Source;

	// check for a self to self copy
	if (ptr == this)
		return G_NO_ERROR;
	// check for a valid (compatible) source
	if (!Source.IsOfType(ClassID())) {
		if (gOwner) {
			G_ASSERT(gOwner->IsOfType(G_KERNEL_CLASSID) == G_TRUE);
			GKernel *kernel = (GKernel *)gOwner;
			return kernel->Copy(Source, *this);
		}
		else
			return G_UNSUPPORTED_CLASSID;
	}
	// now is safe to do a clone
	return BaseClone(Source);
}
Esempio n. 27
0
Modifier* SkeletalExporterBase::findModifier(INode* node, const Class_ID& classID)
{
    auto object = node->GetObjectRef();

    while (object && object->SuperClassID() == GEN_DERIVOB_CLASS_ID)
    {
        auto derivedObject = static_cast<IDerivedObject*>(object);

        // Iterate over all entries of the modifier stack.
        for (auto i = 0; i < derivedObject->NumModifiers(); i++)
        {
            // If this modifier is a physique then return it
            auto modifier = derivedObject->GetModifier(i);
            if (modifier->ClassID() == classID)
                return modifier;
        }

        object = derivedObject->GetObjRef();
    }

    return nullptr;
}
void OrientConstRotation::EndEditParams( IObjParam *ip, ULONG flags,Animatable *next )
{
	if(editCont!=NULL)
	{
		editCont = NULL;
		IParamMap2* pmap = pblock->GetMap();
		if (pmap != NULL)
		{
			if (next && next->ClassID() == ClassID() && ((OrientConstRotation*)next)->pblock&&((OrientConstRotation*)next)->GetLocked()==false)
			{
				pmap->SetParamBlock(((OrientConstRotation*)next)->pblock);
				ip->ClearPickMode();
			}
			else
				orientCD.EndEditParams(ip, this, flags | END_EDIT_REMOVEUI, next);
		}
		else
		{
			int index = aprops.FindProperty(PROPID_INTERPUI);
			if (index>=0) {
				InterpCtrlUI *ui = (InterpCtrlUI*)aprops[index];
				if (ui->hParams) {
					ip->UnRegisterDlgWnd(ui->hParams);
					ip->DeleteRollupPage(ui->hParams);			
					}
				index = aprops.FindProperty(PROPID_INTERPUI);
				if (index>=0) {
					delete aprops[index];
					aprops.Delete(index,1);
					}
				}	
		}
			ip->UnRegisterTimeChangeCallback(&orientConstTimeChangeCallback);
			ip->ClearPickMode(); // need this, otherwise will crash on undo, while pickmode is active.
			this->ip = NULL;
			hWnd = NULL;
	}
}
LoadedModel_SemSceneNode::LoadedModel_SemSceneNode() : ISemanticSceneNode(ClassID())
{
  // initialise variables
  m_sFilename = std::string();
  m_bEnvironmentMapping = false;
}
    DEFINE_BATCH_CLASS_ID

    GLBatch(GLInstancedRendering* instRendering) : INHERITED(ClassID(), instRendering) {}