Skip to content

Commit

Permalink
Merge tag 'v1.10.0' into astron-master
Browse files Browse the repository at this point in the history
SDK 1.10.0 release
  • Loading branch information
CFSworks committed Jan 4, 2019
2 parents 09b2c8c + 7e562b0 commit ffe4f38
Show file tree
Hide file tree
Showing 359 changed files with 21,169 additions and 8,527 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ script:
notifications:
irc:
channels:
- "chat.freenode.net#panda3d"
- secure: "jfwHT9RHAVOGRGTMY8TpYKJI6rq8nFoIj41Y0soZdJQNWtSSFEK9AyzZeMY+2dHga7cR/X+/0NWZ2ehhedTnd9FvlzOnMWWC3K0I/b3XWbEdVEqIZnggFkKGqs82Gy3omguRC63yWupeJCcSCckIhoWbLzWy6xV8lF5WC80iXi8="
on_success: change
on_failure: always
use_notice: true
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ depending on whether you are on a 32-bit or 64-bit system, or you can
[click here](https://github.com/rdb/panda3d-thirdparty) for instructions on
building them from source.

http://rdb.name/thirdparty-vc14-x64.7z
http://rdb.name/thirdparty-vc14.7z
https://www.panda3d.org/download/panda3d-1.10.0/panda3d-1.10.0-tools-win64.zip
https://www.panda3d.org/download/panda3d-1.10.0/panda3d-1.10.0-tools-win32.zip

After acquiring these dependencies, you may simply build Panda3D from the
command prompt using the following command. (Change `14.1` to `14` if you are
Expand Down
Binary file modified contrib/src/panda3dtoolsgui/pandaIcon.ico
Binary file not shown.
12 changes: 0 additions & 12 deletions direct/src/actor/Actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,15 +653,11 @@ def useLOD(self, lodName):
"""
# make sure we don't call this twice in a row
# and pollute the the switches dictionary
## sortedKeys = list(self.switches.keys())
## sortedKeys.sort()
child = self.__LODNode.find(str(lodName))
index = self.__LODNode.node().findChild(child.node())
self.__LODNode.node().forceSwitch(index)

def printLOD(self):
## sortedKeys = list(self.switches.keys())
## sortedKeys.sort()
sortedKeys = self.__sortedLODNames
for eachLod in sortedKeys:
print("python switches for %s: in: %d, out %d" % (eachLod,
Expand All @@ -679,12 +675,6 @@ def resetLOD(self):
"""
Restore all switch distance info (usually after a useLOD call)"""
self.__LODNode.node().clearForceSwitch()
## sortedKeys = list(self.switches.keys())
## sortedKeys.sort()
## for eachLod in sortedKeys:
## index = sortedKeys.index(eachLod)
## self.__LODNode.node().setSwitch(index, self.switches[eachLod][0],
## self.switches[eachLod][1])

def addLOD(self, lodName, inDist=0, outDist=0, center=None):
"""addLOD(self, string)
Expand All @@ -706,8 +696,6 @@ def setLOD(self, lodName, inDist=0, outDist=0):
# save the switch distance info
self.switches[lodName] = [inDist, outDist]
# add the switch distance info
## sortedKeys = list(self.switches.keys())
## sortedKeys.sort()
self.__LODNode.node().setSwitch(self.getLODIndex(lodName), inDist, outDist)

def getLODIndex(self, lodName):
Expand Down
72 changes: 72 additions & 0 deletions direct/src/dcparser/dcArrayParameter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,38 @@ pack_string(DCPackData &pack_data, const string &value,
}
}

/**
* Packs the indicated numeric or string value into the stream.
*/
void DCArrayParameter::
pack_blob(DCPackData &pack_data, const vector_uchar &value,
bool &pack_error, bool &range_error) const {
// We can only pack a string if the array element type is char or int8.
DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
if (simple_type == nullptr) {
pack_error = true;
return;
}

size_t blob_size = value.size();

switch (simple_type->get_type()) {
case ST_char:
case ST_uint8:
case ST_int8:
_array_size_range.validate(blob_size, range_error);
if (_num_length_bytes != 0) {
nassertv(_num_length_bytes == 2);
do_pack_uint16(pack_data.get_write_pointer(2), blob_size);
}
pack_data.append_data((const char *)value.data(), blob_size);
break;

default:
pack_error = true;
}
}

/**
* Packs the arrayParameter's specified default value (or a sensible default
* if no value is specified) into the stream. Returns true if the default
Expand Down Expand Up @@ -339,6 +371,46 @@ unpack_string(const char *data, size_t length, size_t &p, string &value,
}
}

/**
* Unpacks the current numeric or string value from the stream.
*/
void DCArrayParameter::
unpack_blob(const char *data, size_t length, size_t &p, vector_uchar &value,
bool &pack_error, bool &range_error) const {
// We can only unpack a string if the array element type is char or int8.
DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
if (simple_type == nullptr) {
pack_error = true;
return;
}

size_t blob_size;

switch (simple_type->get_type()) {
case ST_char:
case ST_uint8:
case ST_int8:
if (_num_length_bytes != 0) {
blob_size = do_unpack_uint16(data + p);
p += 2;
} else {
nassertv(_array_size >= 0);
blob_size = _array_size;
}
if (p + blob_size > length) {
pack_error = true;
return;
}
value = vector_uchar((const unsigned char *)data + p,
(const unsigned char *)data + p + blob_size);
p += blob_size;
break;

default:
pack_error = true;
}
}

/**
* Returns true if the other interface is bitwise the same as this one--that
* is, a uint32 only matches a uint32, etc. Names of components, and range
Expand Down
4 changes: 4 additions & 0 deletions direct/src/dcparser/dcArrayParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@ class EXPCL_DIRECT_DCPARSER DCArrayParameter : public DCParameter {
virtual void generate_hash(HashGenerator &hashgen) const;
virtual void pack_string(DCPackData &pack_data, const std::string &value,
bool &pack_error, bool &range_error) const;
virtual void pack_blob(DCPackData &pack_data, const vector_uchar &value,
bool &pack_error, bool &range_error) const;
virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
virtual void unpack_string(const char *data, size_t length, size_t &p,
std::string &value, bool &pack_error, bool &range_error) const;
virtual void unpack_blob(const char *data, size_t length, size_t &p,
vector_uchar &value, bool &pack_error, bool &range_error) const;

protected:
virtual bool do_check_match(const DCPackerInterface *other) const;
Expand Down
10 changes: 5 additions & 5 deletions direct/src/dcparser/dcAtomicField.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ get_element(int n) const {
* If the element is an array-type element, the returned value will include
* the two-byte length preceding the array data.
*
* This is deprecated; use get_element() instead.
* @deprecated use get_element() instead.
*/
string DCAtomicField::
vector_uchar DCAtomicField::
get_element_default(int n) const {
nassertr(n >= 0 && n < (int)_elements.size(), string());
nassertr(n >= 0 && n < (int)_elements.size(), vector_uchar());
return _elements[n]->get_default_value();
}

/**
* Returns true if the nth element of the field has a default value specified,
* false otherwise.
*
* This is deprecated; use get_element() instead.
* @deprecated use get_element() instead.
*/
bool DCAtomicField::
has_element_default(int n) const {
Expand All @@ -113,7 +113,7 @@ has_element_default(int n) const {
* for documentary purposes; it does not generally affect operation. If a
* name is not specified, this will be the empty string.
*
* This method is deprecated; use get_element()->get_name() instead.
* @deprecated use get_element()->get_name() instead.
*/
string DCAtomicField::
get_element_name(int n) const {
Expand Down
2 changes: 1 addition & 1 deletion direct/src/dcparser/dcAtomicField.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class EXPCL_DIRECT_DCPARSER DCAtomicField : public DCField {
DCParameter *get_element(int n) const;

// These five methods are deprecated and will be removed soon.
std::string get_element_default(int n) const;
vector_uchar get_element_default(int n) const;
bool has_element_default(int n) const;
std::string get_element_name(int n) const;
DCSubatomicType get_element_type(int n) const;
Expand Down
11 changes: 9 additions & 2 deletions direct/src/dcparser/dcClass.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ receive_update_other(PyObject *distobj, DatagramIterator &di) const {
*/
void DCClass::
direct_update(PyObject *distobj, const string &field_name,
const string &value_blob) {
const vector_uchar &value_blob) {
DCField *field = get_field_by_name(field_name);
nassertv_always(field != nullptr);

Expand All @@ -606,7 +606,14 @@ direct_update(PyObject *distobj, const string &field_name,
void DCClass::
direct_update(PyObject *distobj, const string &field_name,
const Datagram &datagram) {
direct_update(distobj, field_name, datagram.get_message());
DCField *field = get_field_by_name(field_name);
nassertv_always(field != nullptr);

DCPacker packer;
packer.set_unpack_data((const char *)datagram.get_data(), datagram.get_length(), false);
packer.begin_unpack(field);
field->receive_update(packer, distobj);
packer.end_unpack();
}
#endif // HAVE_PYTHON

Expand Down
2 changes: 1 addition & 1 deletion direct/src/dcparser/dcClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class EXPCL_DIRECT_DCPARSER DCClass : public DCDeclaration {
void receive_update_other(PyObject *distobj, DatagramIterator &di) const;

void direct_update(PyObject *distobj, const std::string &field_name,
const std::string &value_blob);
const vector_uchar &value_blob);
void direct_update(PyObject *distobj, const std::string &field_name,
const Datagram &datagram);
bool pack_required_field(Datagram &datagram, PyObject *distobj,
Expand Down
6 changes: 3 additions & 3 deletions direct/src/dcparser/dcField.I
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ has_default_value() const {
* explicitly set (e.g. has_default_value() returns true), returns that
* value; otherwise, returns an implicit default for the field.
*/
INLINE const std::string &DCField::
INLINE const vector_uchar &DCField::
get_default_value() const {
if (_default_value_stale) {
((DCField *)this)->refresh_default_value();
Expand Down Expand Up @@ -172,8 +172,8 @@ set_class(DCClass *dclass) {
* Establishes a default value for this field.
*/
INLINE void DCField::
set_default_value(const std::string &default_value) {
_default_value = default_value;
set_default_value(vector_uchar default_value) {
_default_value = std::move(default_value);
_has_default_value = true;
_default_value_stale = false;
}
19 changes: 10 additions & 9 deletions direct/src/dcparser/dcField.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ as_parameter() const {
* is an error.
*/
string DCField::
format_data(const string &packed_data, bool show_field_names) {
format_data(const vector_uchar &packed_data, bool show_field_names) {
DCPacker packer;
packer.set_unpack_data(packed_data);
packer.begin_unpack(this);
Expand All @@ -178,20 +178,20 @@ format_data(const string &packed_data, bool show_field_names) {
* above) that represents the value of this field, parse the string and return
* the corresponding packed data. Returns empty string if there is an error.
*/
string DCField::
vector_uchar DCField::
parse_string(const string &formatted_string) {
DCPacker packer;
packer.begin_pack(this);
if (!packer.parse_and_pack(formatted_string)) {
// Parse error.
return string();
return vector_uchar();
}
if (!packer.end_pack()) {
// Data type mismatch.
return string();
return vector_uchar();
}

return packer.get_string();
return packer.get_bytes();
}

/**
Expand All @@ -200,7 +200,7 @@ parse_string(const string &formatted_string) {
* record. Returns true if all fields are valid, false otherwise.
*/
bool DCField::
validate_ranges(const string &packed_data) const {
validate_ranges(const vector_uchar &packed_data) const {
DCPacker packer;
packer.set_unpack_data(packed_data);
packer.begin_unpack(this);
Expand All @@ -209,7 +209,7 @@ validate_ranges(const string &packed_data) const {
return false;
}

return (packer.get_num_unpacked_bytes() == packed_data.length());
return (packer.get_num_unpacked_bytes() == packed_data.size());
}

#ifdef HAVE_PYTHON
Expand Down Expand Up @@ -488,7 +488,7 @@ pack_default_value(DCPackData &pack_data, bool &) const {
// The default behavior is to pack the default value if we got it;
// otherwise, to return false and let the packer visit our nested elements.
if (!_default_value_stale) {
pack_data.append_data(_default_value.data(), _default_value.length());
pack_data.append_data((const char *)_default_value.data(), _default_value.size());
return true;
}

Expand Down Expand Up @@ -566,7 +566,8 @@ refresh_default_value() {
if (!packer.end_pack()) {
std::cerr << "Error while packing default value for " << get_name() << "\n";
} else {
_default_value.assign(packer.get_data(), packer.get_length());
const unsigned char *data = (const unsigned char *)packer.get_data();
_default_value = vector_uchar(data, data + packer.get_length());
}
_default_value_stale = false;
}
12 changes: 6 additions & 6 deletions direct/src/dcparser/dcField.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ class EXPCL_DIRECT_DCPARSER DCField : public DCPackerInterface, public DCKeyword
virtual DCParameter *as_parameter();
virtual const DCParameter *as_parameter() const;

std::string format_data(const std::string &packed_data, bool show_field_names = true);
std::string parse_string(const std::string &formatted_string);
std::string format_data(const vector_uchar &packed_data, bool show_field_names = true);
vector_uchar parse_string(const std::string &formatted_string);

bool validate_ranges(const std::string &packed_data) const;
bool validate_ranges(const vector_uchar &packed_data) const;

INLINE bool has_default_value() const;
INLINE const std::string &get_default_value() const;
INLINE const vector_uchar &get_default_value() const;

INLINE bool is_bogus_field() const;

Expand Down Expand Up @@ -98,7 +98,7 @@ class EXPCL_DIRECT_DCPARSER DCField : public DCPackerInterface, public DCKeyword

INLINE void set_number(int number);
INLINE void set_class(DCClass *dclass);
INLINE void set_default_value(const std::string &default_value);
INLINE void set_default_value(vector_uchar default_value);

#ifdef HAVE_PYTHON
static std::string get_pystr(PyObject *value);
Expand All @@ -115,7 +115,7 @@ class EXPCL_DIRECT_DCPARSER DCField : public DCPackerInterface, public DCKeyword
bool _bogus_field;

private:
std::string _default_value;
vector_uchar _default_value;

#ifdef WITHIN_PANDA
PStatCollector _field_update_pcollector;
Expand Down
Loading

0 comments on commit ffe4f38

Please sign in to comment.