Skip to content
Permalink
Browse files

Merge branch 'release/1.10.x'

  • Loading branch information
rdb committed Nov 11, 2019
2 parents f1b235e + 47feac9 commit d088263f6f937759f96241bfdc2b5becbb277b7a
@@ -365,7 +365,7 @@ def finalize_options(self):
tmp.update(self.file_handlers)
self.file_handlers = tmp

tmp = self.package_data_dirs.copy()
tmp = PACKAGE_DATA_DIRS.copy()
tmp.update(self.package_data_dirs)
self.package_data_dirs = tmp

@@ -6,13 +6,14 @@
from direct.directnotify import DirectNotifyGlobal
import sys


class ForceGroup(DirectObject):

notify = DirectNotifyGlobal.directNotify.newCategory('ForceGroup')
id = 1

def __init__(self, name=None):
if (name == None):
if name is None:
self.name = 'ForceGroup-%d' % ForceGroup.id
ForceGroup.id += 1
else:
@@ -60,9 +61,12 @@ def removeForce(self, force):

# Get/set
def getName(self):
"""Deprecated: access .name directly instead."""
return self.name

def getNode(self):
return self.node

def getNodePath(self):
return self.nodePath

@@ -124,3 +128,9 @@ def printParams(self, file = sys.stdout, targ = 'self'):
file.write(fname + ' = AngularVectorForce(Quat(%.4f, %.4f, %.4f))\n' % (vec[0], vec[1], vec[2], vec[3]))
file.write(fname + '.setActive(%d)\n' % f.getActive())
file.write(targ + '.addForce(%s)\n' % fname)

is_enabled = isEnabled
get_node = getNode
get_node_path = getNodePath
as_list = asList
print_params = printParams
@@ -14,12 +14,13 @@
FileNotFoundError = IOError



class ParticleEffect(NodePath):
notify = DirectNotifyGlobal.directNotify.newCategory('ParticleEffect')
pid = 1

def __init__(self, name=None, particles=None):
if name == None:
if name is None:
name = 'particle-effect-%d' % ParticleEffect.pid
ParticleEffect.pid += 1
NodePath.__init__(self, name)
@@ -31,7 +32,7 @@ def __init__(self, name=None, particles=None):
self.particlesDict = {}
self.forceGroupDict = {}
# The effect's particle system
if particles != None:
if particles is not None:
self.addParticles(particles)
self.renderParent = None

@@ -61,7 +62,7 @@ def start(self, parent=None, renderParent=None):
assert self.notify.debug('start() - name: %s' % self.name)
self.renderParent = renderParent
self.enable()
if parent != None:
if parent is not None:
self.reparentTo(parent)

def enable(self):
@@ -134,7 +135,7 @@ def addParticles(self, particles):
particles.addForce(fg[i])

def removeParticles(self, particles):
if particles == None:
if particles is None:
self.notify.warning('removeParticles() - particles == None!')
return
particles.nodePath.detachNode()
@@ -231,10 +232,13 @@ def softStop(self):
for particles in self.getParticlesList():
particles.softStop()

def softStart(self):
def softStart(self, firstBirthDelay=None):
if self.__isValid():
for particles in self.getParticlesList():
particles.softStart()
if firstBirthDelay is not None:
particles.softStart(br=-1, first_birth_delay=firstBirthDelay)
else:
particles.softStart()
else:
# Not asserting here since we want to crash live clients for more expedient bugfix
# (Sorry, live clients)
@@ -243,3 +247,25 @@ def softStart(self):
def __isValid(self):
return hasattr(self, 'forceGroupDict') and \
hasattr(self, 'particlesDict')

# Snake-case aliases.
is_enabled = isEnabled
add_force_group = addForceGroup
add_force = addForce
remove_force_group = removeForceGroup
remove_force = removeForce
remove_all_forces = removeAllForces
add_particles = addParticles
remove_particles = removeParticles
remove_all_particles = removeAllParticles
get_particles_list = getParticlesList
get_particles_named = getParticlesNamed
get_particles_dict = getParticlesDict
get_force_group_list = getForceGroupList
get_force_group_named = getForceGroupNamed
get_force_group_dict = getForceGroupDict
save_config = saveConfig
load_config = loadConfig
clear_to_initial = clearToInitial
soft_stop = softStop
soft_start = softStart
@@ -600,3 +600,17 @@ def accelerate(self,time,stepCount = 1,stepTime=0.0):
base.physicsMgr.doPhysics(remainder,self)

self.render()

# Snake-case aliases.
is_enabled = isEnabled
set_factory = setFactory
set_renderer = setRenderer
set_emitter = setEmitter
add_force = addForce
remove_force = removeForce
set_render_node_path = setRenderNodePath
get_factory = getFactory
get_emitter = getEmitter
get_renderer = getRenderer
print_params = printParams
get_pool_size_ranges = getPoolSizeRanges
@@ -187,7 +187,7 @@ mount_loop(const Filename &virtual_filename, const Filename &mount_point,

/**
* Adds the given VirtualFileMount object to the mount list. This is a lower-
* level function that the other flavors of mount(); it requires you to create
* level function than the other flavors of mount(); it requires you to create
* a VirtualFileMount object specifically.
*/
bool VirtualFileSystem::
@@ -7378,15 +7378,21 @@ framebuffer_copy_to_ram(Texture *tex, int view, int z,
z_size = 1;
}

int num_views = tex->get_num_views();
if (tex->get_x_size() != w || tex->get_y_size() != h ||
tex->get_z_size() != z_size ||
tex->get_component_type() != component_type ||
tex->get_format() != format ||
tex->get_texture_type() != texture_type) {
tex->get_texture_type() != texture_type ||
view >= num_views) {

tex->setup_texture(texture_type, w, h, z_size, component_type, format);

// Re-setup the texture; its properties have changed.
tex->setup_texture(texture_type, w, h, z_size,
component_type, format);
// The above resets the number of views to 1, so set this back.
num_views = std::max(view + 1, num_views);
if (num_views > 1) {
tex->set_num_views(num_views);
}
}

nassertr(z < tex->get_z_size(), false);
@@ -7458,6 +7464,7 @@ framebuffer_copy_to_ram(Texture *tex, int view, int z,
}
if (view > 0) {
image_ptr += (view * tex->get_z_size()) * image_size;
nassertr(view < tex->get_num_views(), false);
}
}

@@ -14445,7 +14452,17 @@ do_extract_texture_data(CLP(TextureContext) *gtc) {
return false;
}

tex->set_ram_image(image, compression, page_size);
int num_views = tex->get_num_views();
if (num_views == 1) {
// Replace the entire image, since we are modifying the only view.
tex->set_ram_image(image, compression, page_size);
} else {
// We're only modifying a single view, so we can't stomp all over the
// existing content.
PTA_uchar ram_image = tex->modify_ram_image();
nassertr(ram_image.size() == image.size() * num_views, false);
memcpy(ram_image.p() + image.size() * gtc->get_view(), image.p(), image.size());
}

if (gtc->_uses_mipmaps) {
// Also get the mipmap levels.
@@ -14461,7 +14478,12 @@ do_extract_texture_data(CLP(TextureContext) *gtc) {
type, compression, n)) {
return false;
}
tex->set_ram_mipmap_image(n, image, page_size);
if (num_views == 1) {
tex->set_ram_mipmap_image(n, image, page_size);
} else {
PTA_uchar ram_mipmap_image = tex->modify_ram_mipmap_image(n);
memcpy(ram_mipmap_image.p() + image.size() * gtc->get_view(), image.p(), image.size());
}
}
}

@@ -14525,13 +14547,13 @@ extract_texture_image(PTA_uchar &image, size_t &page_size,
#ifndef OPENGLES
} else if (target == GL_TEXTURE_BUFFER) {
// In the case of a buffer texture, we need to get it from the buffer.
image = PTA_uchar::empty_array(tex->get_expected_ram_mipmap_image_size(n));
image = PTA_uchar::empty_array(tex->get_expected_ram_mipmap_view_size(n));
_glGetBufferSubData(target, 0, image.size(), image.p());
#endif

} else if (compression == Texture::CM_off) {
// An uncompressed 1-d, 2-d, or 3-d texture.
image = PTA_uchar::empty_array(tex->get_expected_ram_mipmap_image_size(n));
image = PTA_uchar::empty_array(tex->get_expected_ram_mipmap_view_size(n));
GLenum external_format = get_external_image_format(tex);
GLenum pixel_type = get_component_type(type);
glGetTexImage(target, n, external_format, pixel_type, image.p());
@@ -20,7 +20,13 @@ TypeHandle IndexBufferContext::_type_handle;
*/
void IndexBufferContext::
output(std::ostream &out) const {
out << *get_data() << ", " << get_data_size_bytes();
GeomPrimitive *prim = get_data();
if (prim != nullptr) {
out << *prim;
} else {
out << "NULL";
}
out << ", " << get_data_size_bytes();
}

/**
@@ -21,7 +21,13 @@ TypeHandle VertexBufferContext::_type_handle;
*/
void VertexBufferContext::
output(std::ostream &out) const {
out << *get_data() << ", " << get_data_size_bytes();
GeomVertexArrayData *data = get_data();
if (data != nullptr) {
out << *data;
} else {
out << "NULL";
}
out << ", " << get_data_size_bytes();
}

/**
@@ -58,6 +58,18 @@ soft_start(PN_stdfloat br) {
_tics_since_birth = 0.0f;
}

/**
* Causes system to use birth rate set by set_birth_rate(), with the system's
* first birth being delayed by the value of first_birth_delay. Note that a
* negative delay is perfectly valid, causing the first birth to happen
* sooner rather than later.
*/
INLINE void ParticleSystem::
soft_start(PN_stdfloat br, PN_stdfloat first_birth_delay) {
soft_start(br);
_tics_since_birth = -first_birth_delay;
}

/**
* Causes system to use birth rate set by set_soft_birth_rate()
*/
@@ -342,6 +354,14 @@ get_floor_z() const {
return _floor_z;
}

/**

*/
INLINE PN_stdfloat ParticleSystem::
get_tics_since_birth() const {
return _tics_since_birth;
}

/**

*/
@@ -83,6 +83,7 @@ class EXPCL_PANDA_PARTICLESYSTEM ParticleSystem : public Physical {
INLINE BaseParticleEmitter *get_emitter() const;
INLINE BaseParticleFactory *get_factory() const;
INLINE PN_stdfloat get_floor_z() const;
INLINE PN_stdfloat get_tics_since_birth() const;

// particle template vector

@@ -96,6 +97,7 @@ class EXPCL_PANDA_PARTICLESYSTEM ParticleSystem : public Physical {
INLINE void clear_to_initial();
INLINE void soft_stop(PN_stdfloat br = 0.0);
INLINE void soft_start(PN_stdfloat br = 0.0);
INLINE void soft_start(PN_stdfloat br, PN_stdfloat first_birth_delay);
void update(PN_stdfloat dt);

virtual void output(std::ostream &out) const;

0 comments on commit d088263

Please sign in to comment.
You can’t perform that action at this time.