Refactor: in USD importer extract read_mesh params into a struct #104459
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#104459
Loading…
Reference in New Issue
No description provided.
Delete Branch "SonnyCampbell_Unity/blender:unity/T91369-parameter-refactor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is a small initial refactor to extract the USDGeomReader.read_mesh parameters into a separate struct. This will allow for adding extra paramters to handle importing velocities for
#104462
https://archive.blender.org/developer/D15430
Original patch was being reviewed here:
https://archive.blender.org/developer/D15435
unity/T91369-parameter-refactorto USD Importer refactor: Extracting read_mesh params into a structUSD Importer refactor: Extracting read_mesh params into a structto Refactor: in USD importer extract read_mesh params into a struct@ -38,3 +38,2 @@
Mesh *read_mesh(struct Mesh *existing_mesh,
double motionSampleTime,
int read_flag,
const USDMeshReadParams params,
Remove
const
, it has no meaning in function declarations for pass-by-value types.Same in other declarations with a
const USDMeshReadParams params
parameter.Done
The patch compiles now :)
Just a few minor remarks.
@ -69,0 +70,4 @@
* usd file for the mesh sequence cache.
*/
typedef struct USDMeshReadParams {
double motion_sample_time; /* Read USD TimeCode in frames. */
"Read" is ambiguous here. Is it past or future tense?
It's neither. It's read as opposed to write. It's usage is everywhere as a parameter in a
read_mesh
function, so it's very clear what it means from the context.It's also consistent with
ABCReadParams
forABC_read_mesh
in the alembic import codeIn that case I would just change the comment to "USD TimeCode in frames", as it then limits itself to just describing the units of measurement, and not the operation that it's involved with. The fact that it's used for reading is clear from the name of the struct.
Done
@ -249,3 +249,2 @@
# ifdef WITH_USD
result = USD_read_mesh(
mcmd->reader, ctx->object, mesh, time * FPS, &err_str, mcmd->read_flag);
USDMeshReadParams params = {};
Since there are multiple places where a
USDMeshReadParams
is created, it'll be better to have a function that takes the fields as arguments, and returns aUSDMeshReadParams
struct.That will cause compiler errors if ever a field was added but not handled in that particular bit of code. It also aids in
const
ness as it allows forconst USDMeshReadParams params = newUSDMeshReadParams(bla, bla);
here.Done
@ -465,12 +465,19 @@ static USDPrimReader *get_usd_reader(CacheReader *reader,
return usd_reader;
}
USDMeshReadParams create_mesh_read_params(double motion_sample_time, int read_flags)
const
for both parameters.@ -471,3 +479,1 @@
const double time,
const char **err_str,
const int read_flag)
USDMeshReadParams params,
const
Nice, thanks!
LGTM too.
@makowalski want to do the commit?
409ee2669b
to035fa023cd
@blender-bot build
@blender-bot build
Only blender organization members with write access can start builds. See documentation for details.
@blender-bot build
My apologies. The pull request emails were getting filtered into my junk folder, so I didn't get this message till now. I'll do the commit on Monday, since it's right before the weekend. Thanks.
Committed on the command line to
1b7076bd4f
Pull request closed