Skip to content

Commit

Permalink
Additional Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JerryLingjieMei authored and pvl-bot committed Nov 11, 2024
1 parent 58f1ccc commit 5334df8
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 28 deletions.
2 changes: 2 additions & 0 deletions infinigen/assets/lighting/holdout_lighting.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def holdout_lighting(

def add_lighting():
nw = NodeWrangler(bpy.context.scene.world.node_tree)
if not os.path.exists(HOLDOUT_RESOURCES):
return
surface = holdout_lighting(nw)
nw.new_node(Nodes.WorldOutput, input_kwargs={"Surface": surface})
bpy.context.scene.world.cycles_visibility.camera = False
4 changes: 4 additions & 0 deletions infinigen/assets/materials/art.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ def shader_art_composite(nw: NodeWrangler, **kwargs):

return shader_art_composite

@classmethod
def make_sphere(cls):
return text.make_sphere()


class ArtRug(ArtComposite):
@property
Expand Down
6 changes: 3 additions & 3 deletions infinigen/assets/materials/fabrics/general_fabric.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def func_fabric(nw: NodeWrangler, **kwargs):

mix = nw.new_node(
Nodes.Mix,
input_kwargs={1: map_range.outputs["Result"], 2: map_range_1.outputs["Result"]},
input_kwargs={6: map_range.outputs["Result"], 7: map_range_1.outputs["Result"]},
attrs={"data_type": "RGBA"},
)

Expand Down Expand Up @@ -130,7 +130,7 @@ def func_fabric(nw: NodeWrangler, **kwargs):

mix_4 = nw.new_node(
Nodes.Mix,
input_kwargs={0: less_than, 1: mix_2.outputs[2], 2: group_input["Color1"]},
input_kwargs={0: less_than, 6: mix_2.outputs[2], 7: group_input["Color1"]},
attrs={"data_type": "RGBA"},
)

Expand Down Expand Up @@ -175,7 +175,7 @@ def func_fabric(nw: NodeWrangler, **kwargs):

mix_1 = nw.new_node(
Nodes.Mix,
input_kwargs={1: musgrave_texture, 2: mix.outputs[2]},
input_kwargs={6: musgrave_texture, 7: mix.outputs[2]},
attrs={"data_type": "RGBA"},
)

Expand Down
2 changes: 1 addition & 1 deletion infinigen/assets/materials/fabrics/velvet.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def shader_velvet(nw: NodeWrangler, **kwargs):

mix_6 = nw.new_node(
Nodes.Mix,
input_kwargs={0: 0.1125, 1: voronoi_texture.outputs["Color"]},
input_kwargs={0: 0.1125, 6: voronoi_texture.outputs["Color"]},
attrs={"data_type": "RGBA"},
)

Expand Down
2 changes: 1 addition & 1 deletion infinigen/assets/objects/organizer/basket.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def geometry_nodes(nw: NodeWrangler, **kwargs):

multiply = nw.new_node(
Nodes.Math,
input_kwargs={0: thickness, 2: 0.2500},
input_kwargs={0: thickness, 1: 0.2500},
attrs={"operation": "MULTIPLY"},
)

Expand Down
2 changes: 1 addition & 1 deletion infinigen/assets/objects/seating/chairs/bar_chair.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def create_asset(self, **params):
obj = bpy.context.active_object

surface.add_geomod(
obj, geometry_assemble_chair, apply=True, input_kwargs=self.params
obj, geometry_assemble_chair, apply=False, input_kwargs=self.params
)
tagging.tag_system.relabel_obj(obj)

Expand Down
8 changes: 4 additions & 4 deletions infinigen/assets/objects/seating/sofa.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ def nodegroup_sofa_geometry(nw: NodeWrangler):

equal_1 = nw.new_node(
Nodes.Compare,
input_kwargs={0: 4.0000, 2: reroute_13, 3: 4},
input_kwargs={2: reroute_13, 3: 4},
attrs={"operation": "EQUAL", "data_type": "INT"},
)

Expand Down Expand Up @@ -962,7 +962,7 @@ def nodegroup_sofa_geometry(nw: NodeWrangler):

equal_2 = nw.new_node(
Nodes.Compare,
input_kwargs={1: 4.0000, 2: reroute_10, 3: 4},
input_kwargs={2: reroute_10, 3: 4},
attrs={"operation": "EQUAL", "data_type": "INT"},
)

Expand All @@ -982,7 +982,7 @@ def nodegroup_sofa_geometry(nw: NodeWrangler):

equal_3 = nw.new_node(
Nodes.Compare,
input_kwargs={1: 4.0000, 2: reroute_10, 3: 4},
input_kwargs={2: reroute_10, 3: 4},
attrs={"operation": "EQUAL", "data_type": "INT"},
)

Expand Down Expand Up @@ -1446,7 +1446,7 @@ def create_placeholder(self, **_):
ng_inputs={
**self.params,
},
apply=True,
apply=False,
)
tagging.tag_system.relabel_obj(obj)
surface.add_material(obj, self.sofa_fabric)
Expand Down
2 changes: 1 addition & 1 deletion infinigen/assets/objects/tables/table_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def nodegroup_create_legs_and_strechers(nw: NodeWrangler):

switch_1 = nw.new_node(
Nodes.Switch,
input_kwargs={0: group_input.outputs["Keep Legs"], 1: realize_instances},
input_kwargs={0: group_input.outputs["Keep Legs"], 2: realize_instances},
)

multiply_1 = nw.new_node(
Expand Down
29 changes: 13 additions & 16 deletions infinigen/core/init.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright (C) 2023, Princeton University.
# This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory
# of this source tree.

import ast
import logging
import os
Expand All @@ -15,12 +14,12 @@
os.environ["OPENCV_IO_ENABLE_OPENEXR"] = "1" # This must be done BEFORE import cv2.
# See https://github.com/opencv/opencv/issues/21326#issuecomment-1008517425

import addon_utils
import gin
import numpy as np
from numpy.random import randint

import infinigen
from infinigen.core.util import blender as butil
from infinigen.core.util.logging import LogLevel
from infinigen.core.util.math import int_hash
from infinigen.core.util.organization import Task
Expand Down Expand Up @@ -298,18 +297,16 @@ def configure_blender(
addons = ["extra_mesh_objects", "real_snow", "antlandscape"]
for addon in addons:
long = f"bl_ext.blender_org.{addon}"
try:
with butil.Suppress():
bpy.ops.preferences.addon_enable(module=long)
assert long in bpy.context.preferences.addons.keys()
logger.info(f"Add-on {addon} enabled.")
except RuntimeError:
with butil.Suppress():
bpy.ops.extensions.userpref_allow_online()
all_addons = set(a.__name__ for a in addon_utils.modules(refresh=True))
if long in all_addons:
bpy.ops.preferences.addon_enable(module=long)
else:
bpy.ops.extensions.userpref_allow_online()
logger.info(f"Installing Add-on {addon}.")
with butil.Suppress():
bpy.ops.extensions.package_install(
repo_index=0, pkg_id=addon, enable_on_install=True
)
assert long in bpy.context.preferences.addons.keys()
logger.info(f"Add-on {addon} Installed.")
bpy.ops.extensions.repo_sync(repo_index=0)
bpy.ops.extensions.package_install(
repo_index=0, pkg_id=addon, enable_on_install=True
)
bpy.ops.preferences.addon_enable(module=long)
assert long in bpy.context.preferences.addons.keys()
logger.info(f"{addon} enabled.")
1 change: 1 addition & 0 deletions infinigen/datagen/customgt/dependencies/fast_obj
Submodule fast_obj added at 85778d
1 change: 1 addition & 0 deletions infinigen/datagen/customgt/dependencies/indicators
Submodule indicators added at a5bc05
1 change: 1 addition & 0 deletions infinigen/datagen/customgt/dependencies/tinycolormap
Submodule tinycolormap added at 67198d
2 changes: 1 addition & 1 deletion infinigen/infinigen_gpl

0 comments on commit 5334df8

Please sign in to comment.