mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 00:06:44 -04:00
dtoolbase: fix repeated calls to TypeRegistry::ptr() in register_type
This commit is contained in:
parent
7fa373bd6a
commit
343c808fc4
@ -25,37 +25,41 @@ register_type(TypeHandle &type_handle, const std::string &name) {
|
|||||||
INLINE void
|
INLINE void
|
||||||
register_type(TypeHandle &type_handle, const std::string &name,
|
register_type(TypeHandle &type_handle, const std::string &name,
|
||||||
TypeHandle parent1) {
|
TypeHandle parent1) {
|
||||||
if (TypeRegistry::ptr()->register_type(type_handle, name)) {
|
TypeRegistry *registry = TypeRegistry::ptr();
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent1);
|
if (registry->register_type(type_handle, name)) {
|
||||||
|
registry->record_derivation(type_handle, parent1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
INLINE void
|
INLINE void
|
||||||
register_type(TypeHandle &type_handle, const std::string &name,
|
register_type(TypeHandle &type_handle, const std::string &name,
|
||||||
TypeHandle parent1, TypeHandle parent2) {
|
TypeHandle parent1, TypeHandle parent2) {
|
||||||
if (TypeRegistry::ptr()->register_type(type_handle, name)) {
|
TypeRegistry *registry = TypeRegistry::ptr();
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent1);
|
if (registry->register_type(type_handle, name)) {
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent2);
|
registry->record_derivation(type_handle, parent1);
|
||||||
|
registry->record_derivation(type_handle, parent2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
INLINE void
|
INLINE void
|
||||||
register_type(TypeHandle &type_handle, const std::string &name,
|
register_type(TypeHandle &type_handle, const std::string &name,
|
||||||
TypeHandle parent1, TypeHandle parent2,
|
TypeHandle parent1, TypeHandle parent2,
|
||||||
TypeHandle parent3) {
|
TypeHandle parent3) {
|
||||||
if (TypeRegistry::ptr()->register_type(type_handle, name)) {
|
TypeRegistry *registry = TypeRegistry::ptr();
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent1);
|
if (registry->register_type(type_handle, name)) {
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent2);
|
registry->record_derivation(type_handle, parent1);
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent3);
|
registry->record_derivation(type_handle, parent2);
|
||||||
|
registry->record_derivation(type_handle, parent3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
INLINE void
|
INLINE void
|
||||||
register_type(TypeHandle &type_handle, const std::string &name,
|
register_type(TypeHandle &type_handle, const std::string &name,
|
||||||
TypeHandle parent1, TypeHandle parent2,
|
TypeHandle parent1, TypeHandle parent2,
|
||||||
TypeHandle parent3, TypeHandle parent4) {
|
TypeHandle parent3, TypeHandle parent4) {
|
||||||
if (TypeRegistry::ptr()->register_type(type_handle, name)) {
|
TypeRegistry *registry = TypeRegistry::ptr();
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent1);
|
if (registry->register_type(type_handle, name)) {
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent2);
|
registry->record_derivation(type_handle, parent1);
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent3);
|
registry->record_derivation(type_handle, parent2);
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent4);
|
registry->record_derivation(type_handle, parent3);
|
||||||
|
registry->record_derivation(type_handle, parent4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,40 +75,40 @@ register_dynamic_type(const std::string &name) {
|
|||||||
}
|
}
|
||||||
INLINE TypeHandle
|
INLINE TypeHandle
|
||||||
register_dynamic_type(const std::string &name, TypeHandle parent1) {
|
register_dynamic_type(const std::string &name, TypeHandle parent1) {
|
||||||
TypeHandle type_handle =
|
TypeRegistry *registry = TypeRegistry::ptr();
|
||||||
TypeRegistry::ptr()->register_dynamic_type(name);
|
TypeHandle type_handle = registry->register_dynamic_type(name);
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent1);
|
registry->record_derivation(type_handle, parent1);
|
||||||
return type_handle;
|
return type_handle;
|
||||||
}
|
}
|
||||||
INLINE TypeHandle
|
INLINE TypeHandle
|
||||||
register_dynamic_type(const std::string &name,
|
register_dynamic_type(const std::string &name,
|
||||||
TypeHandle parent1, TypeHandle parent2) {
|
TypeHandle parent1, TypeHandle parent2) {
|
||||||
TypeHandle type_handle =
|
TypeRegistry *registry = TypeRegistry::ptr();
|
||||||
TypeRegistry::ptr()->register_dynamic_type(name);
|
TypeHandle type_handle = registry->register_dynamic_type(name);
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent1);
|
registry->record_derivation(type_handle, parent1);
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent2);
|
registry->record_derivation(type_handle, parent2);
|
||||||
return type_handle;
|
return type_handle;
|
||||||
}
|
}
|
||||||
INLINE TypeHandle
|
INLINE TypeHandle
|
||||||
register_dynamic_type(const std::string &name,
|
register_dynamic_type(const std::string &name,
|
||||||
TypeHandle parent1, TypeHandle parent2,
|
TypeHandle parent1, TypeHandle parent2,
|
||||||
TypeHandle parent3) {
|
TypeHandle parent3) {
|
||||||
TypeHandle type_handle =
|
TypeRegistry *registry = TypeRegistry::ptr();
|
||||||
TypeRegistry::ptr()->register_dynamic_type(name);
|
TypeHandle type_handle = registry->register_dynamic_type(name);
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent1);
|
registry->record_derivation(type_handle, parent1);
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent2);
|
registry->record_derivation(type_handle, parent2);
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent3);
|
registry->record_derivation(type_handle, parent3);
|
||||||
return type_handle;
|
return type_handle;
|
||||||
}
|
}
|
||||||
INLINE TypeHandle
|
INLINE TypeHandle
|
||||||
register_dynamic_type(const std::string &name,
|
register_dynamic_type(const std::string &name,
|
||||||
TypeHandle parent1, TypeHandle parent2,
|
TypeHandle parent1, TypeHandle parent2,
|
||||||
TypeHandle parent3, TypeHandle parent4) {
|
TypeHandle parent3, TypeHandle parent4) {
|
||||||
TypeHandle type_handle =
|
TypeRegistry *registry = TypeRegistry::ptr();
|
||||||
TypeRegistry::ptr()->register_dynamic_type(name);
|
TypeHandle type_handle = registry->register_dynamic_type(name);
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent1);
|
registry->record_derivation(type_handle, parent1);
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent2);
|
registry->record_derivation(type_handle, parent2);
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent3);
|
registry->record_derivation(type_handle, parent3);
|
||||||
TypeRegistry::ptr()->record_derivation(type_handle, parent4);
|
registry->record_derivation(type_handle, parent4);
|
||||||
return type_handle;
|
return type_handle;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user